@marketrix.ai/widget 3.2.171 → 3.2.172
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/src/components/base/IconButton.d.ts +11 -0
- package/dist/src/components/base/IconButton.d.ts.map +1 -0
- package/dist/src/components/base/Indicator.d.ts +10 -0
- package/dist/src/components/base/Indicator.d.ts.map +1 -0
- package/dist/src/components/base/Pill.d.ts +11 -0
- package/dist/src/components/base/Pill.d.ts.map +1 -0
- package/dist/src/components/base/Surface.d.ts +14 -0
- package/dist/src/components/base/Surface.d.ts.map +1 -0
- package/dist/src/components/base/Text.d.ts +16 -0
- package/dist/src/components/base/Text.d.ts.map +1 -0
- package/dist/src/components/base/index.d.ts +5 -0
- package/dist/src/components/base/index.d.ts.map +1 -1
- package/dist/src/components/chat/MessageItem.d.ts.map +1 -1
- package/dist/src/components/input/MessageInput.d.ts +0 -2
- package/dist/src/components/input/MessageInput.d.ts.map +1 -1
- package/dist/src/components/input/ModeSelector.d.ts.map +1 -1
- package/dist/src/components/layout/WidgetButton.d.ts.map +1 -1
- package/dist/src/components/navigation/MessengerShell.d.ts.map +1 -1
- package/dist/src/components/navigation/TabBar.d.ts +0 -3
- package/dist/src/components/navigation/TabBar.d.ts.map +1 -1
- package/dist/src/components/views/ChatView.d.ts.map +1 -1
- package/dist/src/components/views/HomeView.d.ts.map +1 -1
- package/dist/src/design-system/semantic-tokens.d.ts +7 -0
- package/dist/src/design-system/semantic-tokens.d.ts.map +1 -1
- package/dist/src/design-system/themes/high-contrast.d.ts.map +1 -1
- package/dist/widget.mjs +83 -81
- package/dist/widget.mjs.map +1 -1
- package/package.json +4 -4
package/dist/widget.mjs
CHANGED
|
@@ -1,69 +1,71 @@
|
|
|
1
|
-
import*as e from"react";import t,{createContext as n,createElement as r,forwardRef as o,lazy as i,useCallback as s,useContext as a,useEffect as l,useId as c,useLayoutEffect as d,useMemo as u,useRef as p,useState as h}from"react";import{createRoot as m}from"react-dom/client";import{Fragment as f,jsx as g,jsxs as y}from"react/jsx-runtime";var w=Object.defineProperty,b=(e,t)=>()=>(e&&(t=e(e=0)),t),v=(e,t)=>{let n={};for(var r in e)w(n,r,{get:e[r],enumerable:!0});return t||w(n,Symbol.toStringTag,{value:"Module"}),n},x=2147483002,k=2147483001,_=2147483005,S={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_font_size:"14px",widget_width:"400px",widget_height:"600px",widget_shadow:"0 5px 40px 0 rgba(0, 0, 0, 0.3)",widget_animation_duration:"300ms",widget_fade_duration:"200ms"};function C(e){return{color:{background:e.widget_background_color,foreground:e.widget_text_color,border:e.widget_border_color,primary:e.widget_accent_color,primaryForeground:"#ffffff",secondary:e.widget_secondary_color,secondaryForeground:"#ffffff"},radius:e.widget_border_radius,shadow:e.widget_shadow,typography:{fontSizeBase:e.widget_font_size},motion:{durationAnimation:e.widget_animation_duration,durationFade:e.widget_fade_duration},size:{widgetWidth:e.widget_width,widgetHeight:e.widget_height}}}C(S);function I(e){return Array.isArray(e)?e:null==e?[]:[e]}var E="orpc",T=class extends Error{constructor(...e){super(...e),this.name="AbortError"}};function A(e){let t;return()=>{if(t)return t.result;const n=e();return t={result:n},n}}function M(){return globalThis["__@orpc/shared@1.13.9/otel/config__"]}function O(e,t={},n){return(M()?.tracer)?.startSpan(e,t,n)}function N(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 R({name:e,context:t,...n},r){const o=M()?.tracer;if(!o)return r();const i=async e=>{try{return await r(e)}catch(t){throw N(e,t,n),t}finally{e.end()}};return t?o.startActiveSpan(e,n,t,i):o.startActiveSpan(e,n,i)}async function z(e,t){const n=M();if(!e||!n)return t();const r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function P(e){return!(!e||"object"!=typeof e)&&("next"in e&&"function"==typeof e.next&&Symbol.asyncIterator in e&&"function"==typeof e[Symbol.asyncIterator])}var L=Symbol.asyncDispose??Symbol.for("asyncDispose"),D=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[L](){this.#e=!0,this.#t||(this.#t=!0,await this.#n("dispose"))}[Symbol.asyncIterator](){return this}};function $({name:e,...t},n){let r;return new D(async()=>{r??=O(e);try{const e=await z(r,()=>n.next());return r?.addEvent(e.done?"completed":"yielded"),e}catch(o){throw N(r,o,t),o}},async e=>{try{"next"!==e&&await z(r,()=>n.return?.())}catch(o){throw N(r,o,t),o}finally{r?.end()}})}function j(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 F(e){if(e)return JSON.parse(e)}function U(e){return JSON.stringify(e)}function B(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function W(e){return!!e&&("object"==typeof e||"function"==typeof e)}function G(e,...t){return"function"==typeof e?e(...t):e}function H(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)&&Z.test(t.toString()));var t}))return Reflect.apply(t,n,r);let o=!0;r[0].call(n,H(new Proxy(e,{get:(e,t,n)=>{if(!o||"then"!==t)return Reflect.get(e,t,n);o=!1}})))}})}})}var Z=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;var V={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 q=Symbol.for("__@orpc/client@1.13.9/error/ORPC_ERROR_CONSTRUCTORS__");globalThis[q]??=/* @__PURE__ */new WeakSet;var J=globalThis[q],Y=class extends Error{defined;code;status;data;constructor(e,...t){const n=function(e){return e[0]??{}}(t);if(void 0!==n.status&&!K(n.status))throw new Error("[ORPCError] Invalid error status code.");const r=function(e,t){return t||V[e]?.message||e}(e,n.message);super(r,n),this.code=e,this.status=function(e,t){return t??V[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(J.has(this)){const t=function(e){return W(e)?Object.getPrototypeOf(e)?.constructor:null}(e);if(t&&J.has(t))return!0}return super[Symbol.hasInstance](e)}};function K(e){return e<200||e>=400}function Q(e){if(!B(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&&K(e.status)&&"message"in e&&"string"==typeof e.message)}function X(e,t={}){return new Y(e.code,{...t,...e})}J.add(Y);var ee=class extends TypeError{},te=class extends TypeError{},ne=class extends Error{data;constructor(e){super(e?.message??"An error event was received",e),this.data=e?.data}};function re(e){const t=e.replace(/\n+$/,"").split(/\n/),n={data:void 0,event:void 0,id:void 0,retry:void 0,comments:[]};for(const r of t){const e=r.indexOf(":"),t=-1===e?r:r.slice(0,e),o=-1===e?"":r.slice(e+1).replace(/^\s/,"");if(0===e)n.comments.push(o);else if("data"===t)n.data??="",n.data+=`${o}\n`;else if("event"===t)n.event=o;else if("id"===t)n.id=o;else if("retry"===t){const e=Number.parseInt(o);Number.isInteger(e)&&e>=0&&e.toString()===o&&(n.retry=e)}}return n.data=n.data?.replace(/\n$/,""),n}var oe=class{constructor(e={}){this.options=e}incomplete="";feed(e){this.incomplete+=e;const t=this.incomplete.lastIndexOf("\n\n");if(-1===t)return;const n=this.incomplete.slice(0,t).split(/\n\n/);this.incomplete=this.incomplete.slice(t+2);for(const r of n){const e=re(`${r}\n\n`);this.options.onEvent&&this.options.onEvent(e)}}end(){if(this.incomplete)throw new te("Event Iterator ended before complete")}},ie=class extends TransformStream{constructor(){let e;super({start(t){e=new oe({onEvent:e=>{t.enqueue(e)}})},transform(t){e.feed(t)},flush(){e.end()}})}};function se(e){if(e.includes("\n"))throw new ee("Event's id must not contain a newline character")}function ae(e){if(!Number.isInteger(e)||e<0)throw new ee("Event's retry must be a integer and >= 0")}function le(e){if(e.includes("\n"))throw new ee("Event's comment must not contain a newline character")}function ce(e){let t="";return t+=function(e){let t="";for(const n of e??[])le(n),t+=`: ${n}\n`;return t}(e.comments),void 0!==e.event&&(!function(e){if(e.includes("\n"))throw new ee("Event's event must not contain a newline character")}(e.event),t+=`event: ${e.event}\n`),void 0!==e.retry&&(ae(e.retry),t+=`retry: ${e.retry}\n`),void 0!==e.id&&(se(e.id),t+=`id: ${e.id}\n`),t+=function(e){const t=e?.split(/\n/)??[];let n="";for(const r of t)n+=`data: ${r}\n`;return n}(e.data),t+="\n",t}var de=Symbol("ORPC_EVENT_SOURCE_META");function ue(e,t){if(void 0===t.id&&void 0===t.retry&&!t.comments?.length)return e;if(void 0!==t.id&&se(t.id),void 0!==t.retry&&ae(t.retry),void 0!==t.comments)for(const n of t.comments)le(n);return new Proxy(e,{get:(e,n,r)=>n===de?t:Reflect.get(e,n,r)})}function pe(e){return W(e)?Reflect.get(e,de):void 0}function he(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 me(e,t){const n=async e=>{let n=await t.error(e);if(n!==e){const t=pe(e);t&&W(n)&&(n=ue(n,t))}return n};return new D(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=pe(o);e&&W(i)&&(i=ue(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 H(new Proxy(async(...[t,r={}])=>await e.call(n,t,function(e){return{...e,context:e.context??{}}}(r)),{get:(r,o)=>"string"!=typeof o?Reflect.get(r,o):fe(e,{...t,path:[...n,o]})}))}function ge(e,t={}){return R({name:"parse_standard_body",signal:t.signal},async()=>{const n=e.headers.get("content-disposition");if("string"==typeof n){const t=he(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 F(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 ie))?.getReader();let r,o=!1;return new D(async()=>{r??=O("consume_event_iterator_stream");try{for(;;){if(void 0===n)return{done:!0,value:void 0};const{done:e,value:t}=await z(r,()=>n.read());if(e){if(o)throw new T("Stream was cancelled");return{done:!0,value:void 0}}switch(t.event){case"message":{let e=F(t.data);return W(e)&&(e=ue(e,t)),r?.addEvent("message"),{done:!1,value:e}}case"error":{let e=new ne({data:F(t.data)});throw e=ue(e,t),r?.addEvent("error"),e}case"done":{let e=F(t.data);return W(e)&&(e=ue(e,t)),r?.addEvent("done"),{done:!0,value:e}}default:r?.addEvent("maybe_keepalive")}}}catch(e){throw e instanceof ne||N(r,e,t),e}},async e=>{try{"next"!==e&&(o=!0,r?.addEvent("cancelled")),await z(r,()=>n?.cancel())}catch(i){throw N(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 ye(e,t,n={}){const r=t.get("content-disposition");var o;if(t.delete("content-type"),t.delete("content-disposition"),void 0!==e)return e instanceof Blob?(t.set("content-type",e.type),t.set("content-length",e.size.toString()),t.set("content-disposition",r??`inline; filename="${(o=e instanceof File?e.name:"blob").replace(/"/g,'\\"')}"; filename*=utf-8''${encodeURIComponent(o).replace(/['()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)))}`),e):e instanceof FormData||e instanceof URLSearchParams?e:P(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,l,c=!1;return new ReadableStream({start(e){l=O("stream_event_iterator"),i&&e.enqueue(ce({comments:[s]}))},async pull(t){try{n&&(a=setInterval(()=>{t.enqueue(ce({comments:[o]})),l?.addEvent("keepalive")},r));const i=await z(l,()=>e.next());if(clearInterval(a),c)return;const s=pe(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:U(i.value)})),l?.addEvent(e)}i.done&&(t.close(),l?.end())}catch(i){if(clearInterval(a),c)return;i instanceof ne?(t.enqueue(ce({...pe(i),event:"error",data:U(i.data)})),l?.addEvent("error"),t.close()):(N(l,i),t.error(i)),l?.end()}},async cancel(){try{c=!0,clearInterval(a),l?.addEvent("cancelled"),await z(l,()=>e.return?.())}catch(t){throw N(l,t),t}finally{l?.end()}}}).pipeThrough(new TextEncoderStream)}(e,n)):(t.set("content-type","application/json"),U(e))}function we(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=ye(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)}},xe=class{constructor(e,t,n={}){this.codec=e,this.sender=t,new ve(n.plugins).init(n),this.interceptors=I(n.interceptors),this.clientInterceptors=I(n.clientInterceptors)}interceptors;clientInterceptors;call(e,t,n){return R({name:`${E}.${e.join("/")}`,signal:n.signal},r=>(r?.setAttribute("rpc.system",E),r?.setAttribute("rpc.method",e.join(".")),P(t)&&(t=$({name:"consume_event_iterator_input",signal:n.signal},t)),j(this.interceptors,{...n,path:e,input:t},async({path:e,input:t,...n})=>{const o=M();let i;const s=o?.trace.getActiveSpan()??r;s&&o&&(i=o?.trace.setSpan(o.context.active(),s));const a=await R({name:"encode_request",context:i},()=>this.codec.encode(e,t,n)),l=await j(this.clientInterceptors,{...n,input:t,path:e,request:a},({input:e,path:t,request:n,...r})=>R({name:"send_request",signal:r.signal,context:i},()=>this.sender.call(n,r,t,e))),c=await R({name:"decode_response",context:i},()=>this.codec.decode(l,n,e,t));return P(c)?$({name:"consume_event_iterator_output",signal:n.signal},c):c})))}},ke=0,_e=1,Se=2,Ce=3,Ie=4,Ee=5,Te=6,Ae=7,Me=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([ke,...t]),[e.toString(),n,r,o];if(e instanceof Date)return n.push([_e,...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([Ie,...t]),[e.toString(),n,r,o];if(e instanceof RegExp)return n.push([Ee,...t]),[e.toString(),n,r,o];if(e instanceof Set){const i=this.serialize(Array.from(e),t,n,r,o);return n.push([Te,...t]),i}if(e instanceof Map){const i=this.serialize(Array.from(e.entries()),t,n,r,o);return n.push([Ae,...t]),i}if(Array.isArray(e))return[e.map((e,i)=>void 0===e?(n.push([Ce,...t,i]),e):this.serialize(e,[...t,i],n,r,o)[0]),n,r,o];if(B(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 ke:t[n]=BigInt(t[n]);break;case _e:t[n]=new Date(t[n]??"Invalid Date");break;case Se:t[n]=NaN;break;case Ce:t[n]=void 0;break;case Ie:t[n]=new URL(t[n]);break;case Ee:{const[,e,r]=t[n].match(/^\/(.*)\/([a-z]*)$/);t[n]=new RegExp(e,r);break}case Te:t[n]=new Set(t[n]);break;case Ae:t[n]=new Map(t[n])}}return o.data}};var 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?we(e):e}(await G(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]=[...I(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 G(this.expectedMethod,n,e,t),i=await G(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||P(a))){const i=await G(this.maxUrlLength,n,e,t),l=new URL(s);if(l.searchParams.append("data",U(a)),l.toString().length<=i)return{body:void 0,method:o,headers:r,url:l,signal:n.signal}}return{url:s,method:"GET"===o?this.fallbackMethod:o,headers:r,body:a,signal:n.signal}}async decode(e){const t=!K(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(Q(n))throw X(n);throw new Y((r=e.status,Object.entries(V).find(([,e])=>e.status===r)?.[0]??"MALFORMED_ORPC_ERROR_RESPONSE"),{status:e.status,data:{...e,body:n}})}var r;return n}},Ne=class{constructor(e){this.jsonSerializer=e}serialize(e){return P(e)?me(e,{value:async e=>this.#o(e,!1),error:async e=>{return new ne({data:this.#o((t=e,t instanceof Y?t:new Y("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",U({json:n,meta:s,maps:o})),i.forEach((e,t)=>{a.set(t.toString(),e)}),a}deserialize(e){return P(e)?me(e,{value:async e=>this.#i(e),error:async e=>{if(!(e instanceof ne))return e;const t=this.#i(e.data);return Q(t)?X(t,{cause:e}):new ne({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()))}},Re=class extends xe{constructor(e,t){super(new Oe(new Ne(new Me(t)),t),e,t)}},ze=class extends ve{initRuntimeAdapter(e){for(const t of this.plugins)t.initRuntimeAdapter?.(e)}},Pe=class{fetch;toFetchRequestOptions;adapterInterceptors;constructor(e){new ze(e.plugins).initRuntimeAdapter(e),this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=e,this.adapterInterceptors=I(e.adapterInterceptors)}async call(e,t,n,r){const o=be(e,this.toFetchRequestOptions);return function(e,t={}){return{body:A(()=>ge(e,t)),status:e.status,get headers(){const t=we(e.headers);return Object.defineProperty(this,"headers",{value:t,writable:!0}),t},set headers(e){Object.defineProperty(this,"headers",{value:e,writable:!0})}}}(await j(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})}},Le=class extends Re{constructor(e){super(new Pe(e),e)}};Object.freeze({status:"aborted"});function De(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 $e=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"}},Fe={};function Ue(e){return e&&Object.assign(Fe,e),Fe}function Be(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 We(e,t){return"bigint"==typeof t?t.toString():t}function Ge(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function He(e){return null==e}function Ze(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var Ve=Symbol("evaluating");function qe(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 Je(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ye(...e){const t={};for(const n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Ke(e){return JSON.stringify(e)}var Qe="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Xe(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var et=Ge(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function tt(e){if(!1===Xe(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!==Xe(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function nt(e){return tt(e)?{...e}:Array.isArray(e)?[...e]:e}var rt=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 lt(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 ct(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function dt(e){return"string"==typeof e?e:e?.message}function ut(e,t,n){const r={...e,path:e.path??[]};return e.message||(r.message=dt(e.inst?._zod.def?.error?.(e))??dt(t?.error?.(e))??dt(n.customError?.(e))??dt(n.localeError?.(e))??"Invalid input"),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function pt(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function ht(...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,We,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ft=De("$ZodError",mt),gt=De("$ZodError",mt,{Parent:Error});var yt=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new $e;if(s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>ut(e,i,Ue())));throw Qe(t,o?.callee),t}return s.value},wt=e=>async(t,n,r,o)=>{const i=r?Object.assign(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=>ut(e,i,Ue())));throw Qe(t,o?.callee),t}return s.value},bt=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 $e;return i.issues.length?{success:!1,error:new(e??ft)(i.issues.map(e=>ut(e,o,Ue())))}:{success:!0,data:i.value}},vt=/* @__PURE__ */bt(gt),xt=e=>async(t,n,r)=>{const o=r?Object.assign(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=>ut(e,o,Ue())))}:{success:!0,data:i.value}},kt=/* @__PURE__ */xt(gt),_t=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return yt(e)(t,n,o)},St=e=>(t,n,r)=>yt(e)(t,n,r),Ct=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return wt(e)(t,n,o)},It=e=>async(t,n,r)=>wt(e)(t,n,r),Et=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bt(e)(t,n,o)},Tt=e=>(t,n,r)=>bt(e)(t,n,r),At=e=>async(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xt(e)(t,n,o)},Mt=e=>async(t,n,r)=>xt(e)(t,n,r),Ot=/^[cC][^\s-]{8,}$/,Nt=/^[0-9a-z]+$/,Rt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,zt=/^[0-9a-vA-V]{20}$/,Pt=/^[A-Za-z0-9]{27}$/,Lt=/^[a-zA-Z0-9_-]{21}$/,Dt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$t=/^([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})$/,jt=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)$/,Ft=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ut=/^(?:(?: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}|:))$/,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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Gt=/^(([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])$/,Ht=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zt=/^[A-Za-z0-9_-]*$/,Vt=/^\+[1-9]\d{6,14}$/,qt="(?:(?:\\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])))",Jt=/* @__PURE__ */new RegExp(`^${qt}$`);function Yt(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 Kt=/^-?\d+$/,Qt=/^-?\d+(?:\.\d+)?$/,Xt=/^(?:true|false)$/i,en=/^null$/i,tn=/^[^A-Z]*$/,nn=/^[^a-z]*$/,rn=/* @__PURE__ */De("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),on={number:"number",bigint:"bigint",object:"date"},sn=/* @__PURE__ */De("$ZodCheckLessThan",(e,t)=>{rn.init(e,t);const n=on[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})}}),an=/* @__PURE__ */De("$ZodCheckGreaterThan",(e,t)=>{rn.init(e,t);const n=on[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__ */De("$ZodCheckMultipleOf",(e,t)=>{rn.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.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const i=n>o?n:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(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})}}),cn=/* @__PURE__ */De("$ZodCheckNumberFormat",(e,t)=>{rn.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=Kt)}),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})}}),dn=/* @__PURE__ */De("$ZodCheckMaxLength",(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!He(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=pt(r);n.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),un=/* @__PURE__ */De("$ZodCheckMinLength",(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!He(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=pt(r);n.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),pn=/* @__PURE__ */De("$ZodCheckLengthEquals",(e,t)=>{var n;rn.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!He(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=pt(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})}}),hn=/* @__PURE__ */De("$ZodCheckStringFormat",(e,t)=>{var n,r;rn.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__ */De("$ZodCheckRegex",(e,t)=>{hn.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})}}),fn=/* @__PURE__ */De("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=tn),hn.init(e,t)}),gn=/* @__PURE__ */De("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=nn),hn.init(e,t)}),yn=/* @__PURE__ */De("$ZodCheckIncludes",(e,t)=>{rn.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})}}),wn=/* @__PURE__ */De("$ZodCheckStartsWith",(e,t)=>{rn.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})}}),bn=/* @__PURE__ */De("$ZodCheckEndsWith",(e,t)=>{rn.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})}}),vn=/* @__PURE__ */De("$ZodCheckOverwrite",(e,t)=>{rn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),xn=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,n=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,n.join("\n"))}},kn={major:4,minor:3,patch:6},_n=/* @__PURE__ */De("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kn;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=lt(e);for(const i of t){if(i._zod.def.when){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 $e;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(o||(o=lt(e,t)))});else{if(e.issues.length===t)continue;o||(o=lt(e,t))}}return r?r.then(()=>e):e},n=(n,o,i)=>{if(lt(n))return n.aborted=!0,n;const s=t(o,r,i);if(s instanceof Promise){if(!1===i.async)throw new $e;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 $e;return s.then(e=>t(e,r,i))}return t(s,r,i)}}qe(e,"~standard",()=>({validate:t=>{try{const n=vt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return kt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Sn=/* @__PURE__ */De("$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__ */De("$ZodStringFormat",(e,t)=>{hn.init(e,t),Sn.init(e,t)}),In=/* @__PURE__ */De("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=$t),Cn.init(e,t)}),En=/* @__PURE__ */De("$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=jt(e))}else t.pattern??(t.pattern=jt());Cn.init(e,t)}),Tn=/* @__PURE__ */De("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ft),Cn.init(e,t)}),An=/* @__PURE__ */De("$ZodURL",(e,t)=>{Cn.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),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})}}}),Mn=/* @__PURE__ */De("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Cn.init(e,t)}),On=/* @__PURE__ */De("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Lt),Cn.init(e,t)}),Nn=/* @__PURE__ */De("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ot),Cn.init(e,t)}),Rn=/* @__PURE__ */De("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nt),Cn.init(e,t)}),zn=/* @__PURE__ */De("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Rt),Cn.init(e,t)}),Pn=/* @__PURE__ */De("$ZodXID",(e,t)=>{t.pattern??(t.pattern=zt),Cn.init(e,t)}),Ln=/* @__PURE__ */De("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pt),Cn.init(e,t)}),Dn=/* @__PURE__ */De("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Yt({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(`^${qt}T(?:${r})$`)}(t)),Cn.init(e,t)}),$n=/* @__PURE__ */De("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Jt),Cn.init(e,t)}),jn=/* @__PURE__ */De("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Yt(t)}$`)),Cn.init(e,t)}),Fn=/* @__PURE__ */De("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Dt),Cn.init(e,t)}),Un=/* @__PURE__ */De("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ut),Cn.init(e,t),e._zod.bag.format="ipv4"}),Bn=/* @__PURE__ */De("$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})}}}),Wn=/* @__PURE__ */De("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Wt),Cn.init(e,t)}),Gn=/* @__PURE__ */De("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Gt),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 Hn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Zn=/* @__PURE__ */De("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ht),Cn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Hn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});var Vn=/* @__PURE__ */De("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Zt),Cn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!Zt.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Hn(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})}}),qn=/* @__PURE__ */De("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Vt),Cn.init(e,t)});var Jn=/* @__PURE__ */De("$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})}}),Yn=/* @__PURE__ */De("$ZodNumber",(e,t)=>{_n.init(e,t),e._zod.pattern=e._zod.bag.pattern??Qt,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__ */De("$ZodNumberFormat",(e,t)=>{cn.init(e,t),Yn.init(e,t)}),Qn=/* @__PURE__ */De("$ZodBoolean",(e,t)=>{_n.init(e,t),e._zod.pattern=Xt,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}}),Xn=/* @__PURE__ */De("$ZodNull",(e,t)=>{_n.init(e,t),e._zod.pattern=en,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{const r=t.value;return null===r||t.issues.push({expected:"null",code:"invalid_type",input:r,inst:e}),t}}),er=/* @__PURE__ */De("$ZodUnknown",(e,t)=>{_n.init(e,t),e._zod.parse=e=>e}),tr=/* @__PURE__ */De("$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__ */De("$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(...ct(n,e.issues)),t.value[n]=e.value}var or=/* @__PURE__ */De("$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){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...ct(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}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,l=o.catchall._zod,c=l.def.type,d="optional"===l.optout;for(const u in t){if(a.has(u))continue;if("never"===c){s.push(u);continue}const o=l.run({value:t[u],issues:[]},r);o instanceof Promise?e.push(o.then(e=>ir(e,n,u,t,d))):ir(o,n,u,t,d)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}var lr=/* @__PURE__ */De("$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=Ge(()=>sr(t));qe(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=Xe,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 l=[],c=i.shape;for(const e of i.keys){const n=c[e],r="optional"===n._zod.optout,o=n._zod.run({value:a[e],issues:[]},s);o instanceof Promise?l.push(o.then(n=>ir(n,t,e,a,r))):ir(o,t,e,a,r)}return o?ar(l,a,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),cr=/* @__PURE__ */De("$ZodObjectJIT",(e,t)=>{lr.init(e,t);const n=e._zod.parse,r=Ge(()=>sr(t));let o;const i=Xe,s=!Fe.jitless,a=s&&et.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=r.value);const p=d.value;return i(p)?s&&a&&!1===u?.async&&!0!==u.jitless?(o||(o=(e=>{const t=new xn(["shape","payload","ctx"]),n=r.value,o=e=>{const t=Ke(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=Ke(r),a="optional"===e[r]?._zod?.optout;t.write(`const ${n} = ${o(r)};`),a?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 `):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("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),d=o(d,u),l?ar([],p,d,u,c,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=>!lt(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=>ut(e,r,Ue())))}),t)}var ur=/* @__PURE__ */De("$ZodUnion",(e,t)=>{_n.init(e,t),qe(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),qe(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),qe(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),qe(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=>Ze(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>dr(t,o,e,i)):dr(a,o,e,i)}}),pr=/* @__PURE__ */De("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ur.init(e,t);const n=e._zod.parse;qe(e._zod,"propValues",()=>{const e={};for(const n of t.options){const r=n._zod.propValues;if(!r||0===Object.keys(r).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const[t,n]of Object.entries(r)){e[t]||(e[t]=/* @__PURE__ */new Set);for(const r of n)e[t].add(r)}}return e});const r=Ge(()=>{const e=t.options,n=/* @__PURE__ */new Map;for(const r of e){const e=r._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const t of e){if(n.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(o,i)=>{const s=o.value;if(!Xe(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o)}}),hr=/* @__PURE__ */De("$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 mr(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=mr(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=mr(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}),lt(e))return e;const s=mr(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 gr=/* @__PURE__ */De("$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 e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const s=t.valueType._zod.run({value:o[e],issues:[]},r);s instanceof Promise?i.push(s.then(t=>{t.issues.length&&n.issues.push(...ct(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...ct(e,s.issues)),n.value[e]=s.value)}let l;for(const e in o)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const s of Reflect.ownKeys(o)){if("__proto__"===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&&Qt.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=>ut(e,r,Ue())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(e=>{e.issues.length&&n.issues.push(...ct(s,e.issues)),n.value[a.value]=e.value})):(l.issues.length&&n.issues.push(...ct(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),yr=/* @__PURE__ */De("$ZodEnum",(e,t)=>{_n.init(e,t);const n=Be(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}}),wr=/* @__PURE__ */De("$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__ */De("$ZodTransform",(e,t)=>{_n.init(e,t),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));if(o instanceof Promise)throw new $e;return n.value=o,n}});function vr(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}var xr=/* @__PURE__ */De("$ZodOptional",(e,t)=>{_n.init(e,t),e._zod.optin="optional",e._zod.optout="optional",qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),qe(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ze(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>vr(t,e.value)):vr(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),kr=/* @__PURE__ */De("$ZodExactOptional",(e,t)=>{xr.init(e,t),qe(e._zod,"values",()=>t.innerType._zod.values),qe(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),_r=/* @__PURE__ */De("$ZodNullable",(e,t)=>{_n.init(e,t),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Ze(e.source)}|null)$`):void 0}),qe(e._zod,"values",()=>t.innerType._zod.values?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__ */De("$ZodDefault",(e,t)=>{_n.init(e,t),e._zod.optin="optional",qe(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=>Cr(e,t)):Cr(r,t)}});function Cr(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var Ir=/* @__PURE__ */De("$ZodPrefault",(e,t)=>{_n.init(e,t),e._zod.optin="optional",qe(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))}),Er=/* @__PURE__ */De("$ZodNonOptional",(e,t)=>{_n.init(e,t),qe(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=>Tr(t,e)):Tr(o,e)}});function Tr(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 Ar=/* @__PURE__ */De("$ZodCatch",(e,t)=>{_n.init(e,t),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(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=>ut(e,n,Ue()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ut(e,n,Ue()))},input:e.value}),e.issues=[]),e)}}),Mr=/* @__PURE__ */De("$ZodPipe",(e,t)=>{_n.init(e,t),qe(e._zod,"values",()=>t.in._zod.values),qe(e._zod,"optin",()=>t.in._zod.optin),qe(e._zod,"optout",()=>t.out._zod.optout),qe(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=>Or(e,t.in,n)):Or(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Or(e,t.out,n)):Or(r,t.out,n)}});function Or(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Nr=/* @__PURE__ */De("$ZodReadonly",(e,t)=>{_n.init(e,t),qe(e._zod,"propValues",()=>t.innerType._zod.propValues),qe(e._zod,"values",()=>t.innerType._zod.values),qe(e._zod,"optin",()=>t.innerType?._zod?.optin),qe(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 zr,Pr=/* @__PURE__ */De("$ZodCustom",(e,t)=>{rn.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=>Lr(t,n,r,e));Lr(o,n,r,e)}});function Lr(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(ht(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)}};(zr=globalThis).__zod_globalRegistry??(zr.__zod_globalRegistry=new Dr);var $r=globalThis.__zod_globalRegistry;function jr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...st(t)})}function Fr(e,t){return new sn({check:"less_than",...st(t),value:e,inclusive:!1})}function Ur(e,t){return new sn({check:"less_than",...st(t),value:e,inclusive:!0})}function Br(e,t){return new an({check:"greater_than",...st(t),value:e,inclusive:!1})}function Wr(e,t){return new an({check:"greater_than",...st(t),value:e,inclusive:!0})}function Gr(e,t){return new ln({check:"multiple_of",...st(t),value:e})}function Hr(e,t){return new dn({check:"max_length",...st(t),maximum:e})}function Zr(e,t){return new un({check:"min_length",...st(t),minimum:e})}function Vr(e,t){return new pn({check:"length_equals",...st(t),length:e})}function qr(e){return new vn({check:"overwrite",tx:e})}function Jr(e,t){const n=new rn({check:"custom",...st(t)});return n._zod.check=e,n}function Yr(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 l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&eo(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((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 Xr(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 a of[...e.seen.entries()].reverse())r(a[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.external?.defs??{};for(const a of e.seen.entries()){const e=a[1];e.def&&e.defId&&(i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?o.$defs=i:o.definitions=i);try{const n=JSON.parse(JSON.stringify(o));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:to(t,"input",e.processors),output:to(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(s){throw new Error("Error converting schema to JSON.")}}function eo(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 eo(r.element,n);if("set"===r.type)return eo(r.valueType,n);if("lazy"===r.type)return eo(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 eo(r.innerType,n);if("intersection"===r.type)return eo(r.left,n)||eo(r.right,n);if("record"===r.type||"map"===r.type)return eo(r.keyType,n)||eo(r.valueType,n);if("pipe"===r.type)return eo(r.in,n)||eo(r.out,n);if("object"===r.type){for(const e in r.shape)if(eo(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(eo(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(eo(e,n))return!0;return!(!r.rest||!eo(r.rest,n))}return!1}var to=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},s=Yr({...o??{},target:i,io:t,processors:n});return Kr(e,s),Qr(s,e),Xr(s,e)},no={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ro=(e,t,n,r)=>{const o=e._zod.def;Kr(o.innerType,t,r);t.seen.get(e).ref=o.innerType},oo=/* @__PURE__ */De("ZodISODateTime",(e,t)=>{Dn.init(e,t),Oo.init(e,t)});function io(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...st(t)})}(oo,e)}var so=/* @__PURE__ */De("ZodISODate",(e,t)=>{$n.init(e,t),Oo.init(e,t)});function ao(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...st(t)})}(so,e)}var lo=/* @__PURE__ */De("ZodISOTime",(e,t)=>{jn.init(e,t),Oo.init(e,t)});function co(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...st(t)})}(lo,e)}var uo=/* @__PURE__ */De("ZodISODuration",(e,t)=>{Fn.init(e,t),Oo.init(e,t)});function po(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...st(t)})}(uo,e)}var ho=(e,t)=>{ft.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},r=e=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>r({issues:e}));else if("invalid_key"===o.code)r({issues:o.issues});else if("invalid_element"===o.code)r({issues:o.issues});else if(0===o.path.length)n._errors.push(t(o));else{let e=n,r=0;for(;r<o.path.length;){const n=o.path[r];r!==o.path.length-1?e[n]=e[n]||{_errors:[]}:(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(o))),e=e[n],r++}}};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,We,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,We,2)}},isEmpty:{get:()=>0===e.issues.length}})},mo=(De("ZodError",ho),De("ZodError",ho,{Parent:Error})),fo=/* @__PURE__ */yt(mo),go=/* @__PURE__ */wt(mo),yo=/* @__PURE__ */bt(mo),wo=/* @__PURE__ */xt(mo),bo=/* @__PURE__ */_t(mo),vo=/* @__PURE__ */St(mo),xo=/* @__PURE__ */Ct(mo),ko=/* @__PURE__ */It(mo),_o=/* @__PURE__ */Et(mo),So=/* @__PURE__ */Tt(mo),Co=/* @__PURE__ */At(mo),Io=/* @__PURE__ */Mt(mo),Eo=/* @__PURE__ */De("ZodType",(e,t)=>(_n.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:to(e,"input"),output:to(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=Yr({...n,processors:t});return Kr(e,r),Qr(r,e),Xr(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ye(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>it(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>fo(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>yo(e,t,n),e.parseAsync=async(t,n)=>go(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>wo(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>bo(e,t,n),e.decode=(t,n)=>vo(e,t,n),e.encodeAsync=async(t,n)=>xo(e,t,n),e.decodeAsync=async(t,n)=>ko(e,t,n),e.safeEncode=(t,n)=>_o(e,t,n),e.safeDecode=(t,n)=>So(e,t,n),e.safeEncodeAsync=async(t,n)=>Co(e,t,n),e.safeDecodeAsync=async(t,n)=>Io(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...st(n)})}($i,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=/* @__PURE__ */Jr(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(ht(e,n.value,t._zod.def));else{const r=e;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=t),r.continue??(r.continue=!t._zod.def.abort),n.issues.push(ht(r))}},e(n.value,n)));return t}(t)),e.overwrite=t=>e.check(qr(t)),e.optional=()=>Ei(e),e.exactOptional=()=>new Ti({type:"optional",innerType:e}),e.nullable=()=>Mi(e),e.nullish=()=>Ei(Mi(e)),e.nonoptional=t=>function(e,t){return new Ri({type:"nonoptional",innerType:e,...st(t)})}(e,t),e.array=()=>di(e),e.or=t=>mi([e,t]),e.and=t=>new yi({type:"intersection",left:e,right:t}),e.transform=t=>Li(e,Ci(t)),e.default=t=>{return n=t,new Oi({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():nt(n)}});var n},e.prefault=t=>{return n=t,new Ni({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():nt(n)}});var n},e.catch=t=>{return new zi({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>Li(e,t),e.readonly=()=>new Di({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return $r.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>$r.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return $r.get(e);const n=e.clone();return $r.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),To=/* @__PURE__ */De("_ZodString",(e,t)=>{Sn.init(e,t),Eo.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:l}=e._zod.bag;if("number"==typeof o&&(r.minLength=o),"number"==typeof i&&(r.maxLength=i),s&&(r.format=no[s]??s,""===r.format&&delete r.format,"time"===s&&delete r.format),l&&(r.contentEncoding=l),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,e.regex=(...t)=>e.check(function(e,t){return new mn({check:"string_format",format:"regex",...st(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new yn({check:"string_format",format:"includes",...st(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new wn({check:"string_format",format:"starts_with",...st(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new bn({check:"string_format",format:"ends_with",...st(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Zr(...t)),e.max=(...t)=>e.check(Hr(...t)),e.length=(...t)=>e.check(Vr(...t)),e.nonempty=(...t)=>e.check(Zr(1,...t)),e.lowercase=t=>e.check(function(e){return new fn({check:"string_format",format:"lowercase",...st(e)})}(t)),e.uppercase=t=>e.check(function(e){return new gn({check:"string_format",format:"uppercase",...st(e)})}(t)),e.trim=()=>e.check(/* @__PURE__ */qr(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){/* @__PURE__ */
|
|
2
|
-
return qr(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(/* @__PURE__ */qr(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(/* @__PURE__ */qr(e=>e.toUpperCase())),e.slugify=()=>e.check(/* @__PURE__ */qr(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Ao=/* @__PURE__ */De("ZodString",(e,t)=>{Sn.init(e,t),To.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...st(t)})}(No,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...st(t)})}(Po,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...st(t)})}(Yo,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...st(t)})}(Lo,t)),e.guid=t=>e.check(jr(Ro,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...st(t)})}(zo,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)})}(zo,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)})}(zo,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)})}(zo,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...st(t)})}(Do,t)),e.guid=t=>e.check(jr(Ro,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...st(t)})}($o,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...st(t)})}(jo,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...st(t)})}(Fo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...st(t)})}(Vo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...st(t)})}(qo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...st(t)})}(Uo,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...st(t)})}(Bo,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...st(t)})}(Wo,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...st(t)})}(Go,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...st(t)})}(Ho,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...st(t)})}(Zo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...st(t)})}(Jo,t)),e.datetime=t=>e.check(io(t)),e.date=t=>e.check(ao(t)),e.time=t=>e.check(co(t)),e.duration=t=>e.check(po(t))});function Mo(e){return function(e,t){return new e({type:"string",...st(t)})}(Ao,e)}var Oo=/* @__PURE__ */De("ZodStringFormat",(e,t)=>{Cn.init(e,t),To.init(e,t)}),No=/* @__PURE__ */De("ZodEmail",(e,t)=>{Tn.init(e,t),Oo.init(e,t)}),Ro=/* @__PURE__ */De("ZodGUID",(e,t)=>{In.init(e,t),Oo.init(e,t)}),zo=/* @__PURE__ */De("ZodUUID",(e,t)=>{En.init(e,t),Oo.init(e,t)}),Po=/* @__PURE__ */De("ZodURL",(e,t)=>{An.init(e,t),Oo.init(e,t)}),Lo=/* @__PURE__ */De("ZodEmoji",(e,t)=>{Mn.init(e,t),Oo.init(e,t)}),Do=/* @__PURE__ */De("ZodNanoID",(e,t)=>{On.init(e,t),Oo.init(e,t)}),$o=/* @__PURE__ */De("ZodCUID",(e,t)=>{Nn.init(e,t),Oo.init(e,t)}),jo=/* @__PURE__ */De("ZodCUID2",(e,t)=>{Rn.init(e,t),Oo.init(e,t)}),Fo=/* @__PURE__ */De("ZodULID",(e,t)=>{zn.init(e,t),Oo.init(e,t)}),Uo=/* @__PURE__ */De("ZodXID",(e,t)=>{Pn.init(e,t),Oo.init(e,t)}),Bo=/* @__PURE__ */De("ZodKSUID",(e,t)=>{Ln.init(e,t),Oo.init(e,t)}),Wo=/* @__PURE__ */De("ZodIPv4",(e,t)=>{Un.init(e,t),Oo.init(e,t)}),Go=/* @__PURE__ */De("ZodIPv6",(e,t)=>{Bn.init(e,t),Oo.init(e,t)}),Ho=/* @__PURE__ */De("ZodCIDRv4",(e,t)=>{Wn.init(e,t),Oo.init(e,t)}),Zo=/* @__PURE__ */De("ZodCIDRv6",(e,t)=>{Gn.init(e,t),Oo.init(e,t)}),Vo=/* @__PURE__ */De("ZodBase64",(e,t)=>{Zn.init(e,t),Oo.init(e,t)}),qo=/* @__PURE__ */De("ZodBase64URL",(e,t)=>{Vn.init(e,t),Oo.init(e,t)}),Jo=/* @__PURE__ */De("ZodE164",(e,t)=>{qn.init(e,t),Oo.init(e,t)}),Yo=/* @__PURE__ */De("ZodJWT",(e,t)=>{Jn.init(e,t),Oo.init(e,t)}),Ko=/* @__PURE__ */De("ZodNumber",(e,t)=>{Yn.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:o,maximum:i,format:s,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?r.type="integer":r.type="number","number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.minimum=c,r.exclusiveMinimum=!0):r.exclusiveMinimum=c),"number"==typeof o&&(r.minimum=o,"number"==typeof c&&"draft-04"!==t.target&&(c>=o?delete r.minimum:delete r.exclusiveMinimum)),"number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(r.maximum=l,r.exclusiveMaximum=!0):r.exclusiveMaximum=l),"number"==typeof i&&(r.maximum=i,"number"==typeof l&&"draft-04"!==t.target&&(l<=i?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(Br(t,n)),e.gte=(t,n)=>e.check(Wr(t,n)),e.min=(t,n)=>e.check(Wr(t,n)),e.lt=(t,n)=>e.check(Fr(t,n)),e.lte=(t,n)=>e.check(Ur(t,n)),e.max=(t,n)=>e.check(Ur(t,n)),e.int=t=>e.check(ei(t)),e.safe=t=>e.check(ei(t)),e.positive=t=>e.check(Br(0,t)),e.nonnegative=t=>e.check(Wr(0,t)),e.negative=t=>e.check(Fr(0,t)),e.nonpositive=t=>e.check(Ur(0,t)),e.multipleOf=(t,n)=>e.check(Gr(t,n)),e.step=(t,n)=>e.check(Gr(t,n)),e.finite=()=>e;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 Qo(e){return function(e,t){return new e({type:"number",checks:[],...st(t)})}(Ko,e)}var Xo=/* @__PURE__ */De("ZodNumberFormat",(e,t)=>{Kn.init(e,t),Ko.init(e,t)});function ei(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...st(t)})}(Xo,e)}var ti=/* @__PURE__ */De("ZodBoolean",(e,t)=>{Qn.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function ni(e){return function(e,t){return new e({type:"boolean",...st(t)})}(ti,e)}var ri=/* @__PURE__ */De("ZodNull",(e,t)=>{Xn.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{"openapi-3.0"===t.target?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"})(0,e,t)});var oi=/* @__PURE__ */De("ZodUnknown",(e,t)=>{er.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function ii(){return new oi({type:"unknown"})}var si=/* @__PURE__ */De("ZodNever",(e,t)=>{tr.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function ai(e){return function(e,t){return new e({type:"never",...st(t)})}(si,e)}var li=/* @__PURE__ */De("ZodDate",(e,t)=>{nr.init(e,t),Eo.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(Wr(t,n)),e.max=(t,n)=>e.check(Ur(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}),ci=/* @__PURE__ */De("ZodArray",(e,t)=>{or.init(e,t),Eo.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,e.min=(t,n)=>e.check(Zr(t,n)),e.nonempty=t=>e.check(Zr(1,t)),e.max=(t,n)=>e.check(Hr(t,n)),e.length=(t,n)=>e.check(Vr(t,n)),e.unwrap=()=>e.element});function di(e,t){return function(e,t,n){return new e({type:"array",element:t,...st(n)})}(ci,e,t)}var ui=/* @__PURE__ */De("ZodObject",(e,t)=>{cr.init(e,t),Eo.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 c in s)o.properties[c]=Kr(s[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const n=i.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(o.required=Array.from(l)),"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),qe(e,"shape",()=>t.shape),e.keyof=()=>xi(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ii()}),e.loose=()=>e.clone({...e._zod.def,catchall:ii()}),e.strict=()=>e.clone({...e._zod.def,catchall:ai()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>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,Ye(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Je(this,"shape",n),n}}))}(e,t),e.safeExtend=t=>function(e,t){if(!tt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return it(e,Ye(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Je(this,"shape",n),n}}))}(e,t),e.merge=t=>{return r=t,it(n=e,Ye(n._zod.def,{get shape(){const e={...n._zod.def.shape,...r._zod.def.shape};return Je(this,"shape",e),e},get catchall(){return r._zod.def.catchall},checks:[]}));var n,r},e.pick=t=>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,Ye(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 Je(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>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,Ye(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 Je(this,"shape",r),r},checks:[]}))}(e,t),e.partial=(...t)=>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,Ye(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 Je(this,"shape",o),o},checks:[]}))}(Ii,e,t[0]),e.required=(...t)=>{return n=Ri,r=e,o=t[0],it(r,Ye(r._zod.def,{get shape(){const e=r._zod.def.shape,t={...e};if(o)for(const r in o){if(!(r in t))throw new Error(`Unrecognized key: "${r}"`);o[r]&&(t[r]=new n({type:"nonoptional",innerType:e[r]}))}else for(const r in e)t[r]=new n({type:"nonoptional",innerType:e[r]});return Je(this,"shape",t),t}}));var n,r,o}});function pi(e,t){return new ui({type:"object",shape:e??{},...st(t)})}var hi=/* @__PURE__ */De("ZodUnion",(e,t)=>{ur.init(e,t),Eo.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 mi(e,t){return new hi({type:"union",options:e,...st(t)})}var fi=/* @__PURE__ */De("ZodDiscriminatedUnion",(e,t)=>{hi.init(e,t),pr.init(e,t)});function gi(e,t,n){return new fi({type:"union",options:t,discriminator:e,...st(n)})}var yi=/* @__PURE__ */De("ZodIntersection",(e,t)=>{hr.init(e,t),Eo.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 wi=/* @__PURE__ */De("ZodRecord",(e,t)=>{gr.init(e,t),Eo.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 l=s._zod.values;if(l){const e=[...l].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 bi(e,t,n){return new wi({type:"record",keyType:e,valueType:t,...st(n)})}var vi=/* @__PURE__ */De("ZodEnum",(e,t)=>{yr.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=Be(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 vi({...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 vi({...t,checks:[],...st(r),entries:o})}});function xi(e,t){return new vi({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...st(t)})}var ki=/* @__PURE__ */De("ZodLiteral",(e,t)=>{wr.init(e,t),Eo.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]}})});function _i(e,t){return new ki({type:"literal",values:Array.isArray(e)?e:[e],...st(t)})}var Si=/* @__PURE__ */De("ZodTransform",(e,t)=>{br.init(e,t),Eo.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(ht(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(ht(t))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(e=>(n.value=e,n)):(n.value=o,n)}});function Ci(e){return new Si({type:"transform",transform:e})}var Ii=/* @__PURE__ */De("ZodOptional",(e,t)=>{xr.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function Ei(e){return new Ii({type:"optional",innerType:e})}var Ti=/* @__PURE__ */De("ZodExactOptional",(e,t)=>{kr.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ro(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Ai=/* @__PURE__ */De("ZodNullable",(e,t)=>{_r.init(e,t),Eo.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 Mi(e){return new Ai({type:"nullable",innerType:e})}var Oi=/* @__PURE__ */De("ZodDefault",(e,t)=>{Sr.init(e,t),Eo.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 Ni=/* @__PURE__ */De("ZodPrefault",(e,t)=>{Ir.init(e,t),Eo.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 Ri=/* @__PURE__ */De("ZodNonOptional",(e,t)=>{Er.init(e,t),Eo.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 zi=/* @__PURE__ */De("ZodCatch",(e,t)=>{Ar.init(e,t),Eo.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 Pi=/* @__PURE__ */De("ZodPipe",(e,t)=>{Mr.init(e,t),Eo.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const o=e._zod.def,i="input"===t.io?"transform"===o.in._zod.def.type?o.out:o.in:o.out;Kr(i,t,r),t.seen.get(e).ref=i})(e,t,0,r),e.in=t.in,e.out=t.out});function Li(e,t){return new Pi({type:"pipe",in:e,out:t})}var Di=/* @__PURE__ */De("ZodReadonly",(e,t)=>{Nr.init(e,t),Eo.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 $i=/* @__PURE__ */De("ZodCustom",(e,t)=>{Pr.init(e,t),Eo.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 ji(e,t={}){const n=new $i({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...st(t)});return n._zod.bag.Class=e,n._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:n,path:[...n._zod.def.path??[]]})},n}function Fi(e,t){return Li(Ci(e),t)}function Ui(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...st(t)})}(Ko,e)}function Bi(e){return function(e,t){return new e({type:"boolean",coerce:!0,...st(t)})}(ti,e)}function Wi(e){return function(e,t){return new e({type:"date",coerce:!0,...st(t)})}(li,e)}xi(["free","starter","growth","enterprise"]);var Gi,Hi=xi(["created","active","suspended","pending_approval"]),Zi=xi(["free","starter","growth","enterprise"]),Vi=xi(["human","ai"]),qi=xi(["male","female"]),Ji=xi(["active","learning","error"]),Yi=pi({vector_index_created:ni().nullable(),graph_index_created:ni().nullable()}),Ki=xi(["document","video"]),Qi=xi(["pending","processing","waiting_review","completed","failed"]),Xi=(xi(["pending","running","completed","failed"]),xi(["pending","running","completed","failed","cancelled"])),es=xi(["user","agent"]),ts=xi(["widget","app"]),ns=(xi(["tell","show","do"]),xi(["app","website"])),rs=xi(["widget","slack"]),os=xi(["timer","github","slack","teams","jira"]),is=xi(["user_login","url_visit","update_workspace","create_user","update_user","delete_user","create_agent","update_agent","delete_agent","create_application","update_application","delete_application","create_widget","update_widget","delete_widget","create_knowledge","update_knowledge","delete_knowledge","approve_user","deny_user","request_workspace","widget_question","qa_run_started","start_simulation","create_automation","update_automation","delete_automation","toggle_automation"]),ss=pi({id:Qo().optional(),created_at:Wi().optional(),updated_at:Wi().optional()}),as=pi({file:ji(File),application_id:Ui().optional()}),ls=pi({id:Ui()}),cs=pi({slug:Mo()}),ds=pi({agent_id:Ui()}),us=pi({widget_id:Ui()}),ps=pi({simulation_id:Ui()}),hs=pi({application_id:Ui()}),ms=pi({user_id:Ui()}),fs=pi({success:_i(!0)}),gs=fs.extend({message:Mo()}),ys=(pi({workspace_id:Ui().optional()}),pi({application_id:Ui().optional()}),pi({limit:Ui().optional().default(50),offset:Ui().optional().default(0)})),ws=e=>pi({items:di(e),total:Qo(),limit:Qo(),offset:Qo()}),bs=e=>pi({items:di(e),count:Qo()}),vs=pi({status:Mo(),timestamp:Mo(),service:Mo(),version:Mo(),build:Mo()}),xs=pi({name:Mo(),version:Mo(),build:Mo(),status:Mo(),timestamp:Mo()}),ks=xi(["password","oauth"]),_s=ss.extend({is_super:ni(),status:Hi,email:Mo().email(),external_id:Mo().nullish(),first_name:Mo().nullish(),last_name:Mo().nullish(),password:Mo().nullish(),image_url:Mo().nullish(),prompt_limit:Qo().nullish(),last_login_at:Wi().nullish(),auth_method:ks.nullish()}),Ss=_s.partial().extend({email:Mo().email(),password:Mo()}),Cs=_s.partial(),Is=pi({users:di(Ss)}),Es=pi({users:di(_s.partial())}),Ts=(pi({token:Mo()}),ss.extend({name:Mo(),slug:Mo(),status:Hi,package:Zi,ending_date:Wi().nullish(),external_workspace_id:Mo().nullish()})),As=Ts.partial().extend({name:Mo().min(1)}),Ms=Ts.partial(),Os=xi(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]),Ns=ss.extend({workspace_id:Qo(),package:Zi,ending_date:Wi(),stripe_subscription_id:Mo().nullable(),stripe_price_id:Mo().nullable(),status:Os.default("active").optional()}),Rs=(Ns.partial().extend({workspace_id:Qo(),package:Zi}),Ns.partial(),xi(["owner","member"])),zs=ss.extend({workspace_id:Qo(),user_id:Qo(),role:Rs}),Ps=pi({id:Qo(),agent_name:Mo(),image_url:Mo().nullish()}),Ls=ss.extend({workspace_id:Qo(),application_id:Qo().optional(),file_name:Mo().min(1),file_size:Ui(),file_type:Ki,file_url:Mo(),source_url:Mo().nullish(),agents:di(Ps).optional()}),Ds=xi(["chromium","firefox","webkit"]),$s=pi({browsers:di(Ds).default(["chromium"]),parallel:ni().default(!1),fail_fast:ni().default(!1),timeout_per_browser:Qo().int().min(60).max(3600).optional()}),js=ss.extend({workspace_id:Qo(),user_id:Qo(),application_id:Qo(),file_name:Mo().min(1),file_size:Ui(),file_type:Mo(),file_url:Mo(),file_path:Mo().nullable(),text_content:Mo().nullish(),additional_instructions:Mo().max(1e3).nullish(),status:Qi,processing_step:Mo().nullish(),ultimate_goal:Mo().nullish(),browser_config:$s.nullish()}),Fs=pi({application_id:Ui(),file:ji(File).optional(),text_content:Mo().optional(),file_name:Mo().optional(),additional_instructions:Mo().max(1e3).optional()}),Us=ss.extend({qa_flow_id:Qo(),workspace_id:Qo(),triggered_by:Qo(),status:Xi,browser_type:Ds,browser_config:$s.nullish(),total_tests:Qo().int().nonnegative(),passed_tests:Qo().int().nonnegative(),failed_tests:Qo().int().nonnegative(),started_at:Wi().nullish(),completed_at:Wi().nullish()}),Bs=pi({step:Qo(),message:Mo(),timestamp:Mo(),status:xi(["success","error","info"])}),Ws=pi({run_id:Qo(),status:xi(["pending","running","passed","failed","skipped"]),browser_type:Ds.nullish(),progress_log:di(Bs).default([]),error_message:Mo().nullish(),screenshot_url:Mo().nullish(),simulation_id:Qo().nullish(),duration_ms:Qo().nullish(),started_at:Mo().nullish(),completed_at:Mo().nullish()}),Gs=pi({version:Qo().int().positive(),test_title:Mo(),test_objective:Mo(),test_steps:di(Mo()),expected_outcome:Mo(),priority:xi(["Low","Medium","High"]),change_type:xi(["created","modified","self_healed","refined","deleted"]),change_reason:Mo().nullish(),changed_by:Qo().nullish(),created_at:Mo(),accepted:ni().optional()}),Hs=pi({failure_type:xi(["locator","assertion","timeout","flow_change","environment"]),failure_message:Mo().nullish(),failure_context:bi(Mo(),ii()).nullish(),repair_strategy:Mo().nullish(),repair_details:bi(Mo(),ii()).nullish(),confidence_score:Qo().min(0).max(1).nullish(),validation_status:xi(["pending","validated","failed","rejected"]),simulation_id:Qo().nullish(),validation_simulation_id:Qo().nullish(),healed_version:Qo().nullish(),created_at:Mo()}),Zs=ss.extend({qa_flow_id:Qo(),workspace_id:Qo(),order_index:Qo().int().nonnegative(),test_title:Mo(),test_objective:Mo(),test_steps:di(Mo()),expected_outcome:Mo(),priority:xi(["Low","Medium","High"]),is_active:Fi(e=>"number"==typeof e?0!==e:e,ni()),current_version:Qo().int().positive(),version_history:di(Gs).nullable(),executions:di(Ws).nullable(),healing_attempts:di(Hs).nullable(),healing_metadata:bi(Mo(),ii()).nullish(),last_healed_at:Wi().nullish()}),Vs=(pi({qa_flow_id:Qo(),test_title:Mo(),test_objective:Mo(),test_steps:di(Mo()),expected_outcome:Mo(),priority:xi(["Low","Medium","High"]).optional()}),pi({ultimateGoal:Mo(),document:js,testCases:di(pi({id:Qo(),title:Mo(),prompt:Mo(),objective:Mo(),steps:di(Mo()),expectedOutcome:Mo(),priority:xi(["Low","Medium","High"])})),summary:pi({total:Qo(),estimatedTime:Mo(),complexity:xi(["Low","Medium","High"])})})),qs=pi({ultimate_goal:Mo(),test_cases:di(pi({test_title:Mo(),test_objective:Mo(),test_steps:di(Mo()),expected_outcome:Mo(),priority:xi(["Low","Medium","High"])})),summary:pi({total_tests:Qo(),high_priority:Qo(),medium_priority:Qo(),low_priority:Qo(),estimated_time_minutes:Qo()})}),Js=(gi("event",[pi({event:_i("response.created"),data:pi({message:Mo()})}),pi({event:_i("response.progress"),data:pi({message:Mo()})}),pi({event:_i("response.clear"),data:pi({}).optional()}),pi({event:_i("response.completed"),data:qs}),pi({event:_i("error"),data:pi({detail:Mo()})})]),mi([Mo(),Qo(),ni(),di(Mo()),function(e,t){return new e({type:"null",...st(t)})}(ri,Gi)])),Ys=(xi(["created","modified","self_healed","refined","deleted"]),xi(["locator","assertion","timeout","flow_change","environment"])),Ks=(xi(["pending","validated","failed","rejected"]),pi({healing_enabled:ni().default(!0),auto_apply:ni().default(!1),min_confidence_threshold:Qo().min(0).max(1).default(.85),max_healing_attempts:Qo().int().min(1).max(5).default(2),last_healing_attempt:Mo().datetime().nullable(),total_healing_attempts:Qo().int().default(0),successful_heals:Qo().int().default(0)}),pi({failure_type:Ys,is_healable:ni(),is_actual_bug:ni(),failure_message:Mo(),failure_context:bi(Mo(),ii()),suggested_repair:pi({type:xi(["update_locator","update_assertion","update_steps","skip_test"]),confidence:Qo().min(0).max(1),details:bi(Mo(),ii())}).nullable()})),Qs=(pi({go_to_url:pi({url:Mo(),new_tab:ni()})}),pi({click_element_by_index:pi({index:Qo().int().min(1)})}),pi({input_text:pi({index:Qo(),text:Mo(),clear_existing:ni()})}),pi({write_file:pi({file_name:Mo(),content:Mo(),append:ni(),trailing_newline:ni(),leading_newline:ni()})}),pi({get_otp:pi({question:Mo()})}),pi({done:pi({success:ni(),message:Mo().optional()})}),pi({wait:pi({seconds:Qo()})}),pi({reload_page:pi({})}),pi({open_new_tab:pi({url:Mo()})}),pi({navigate_to_url:pi({url:Mo()})}),bi(Mo(),ii())),Xs=pi({evaluation_previous_goal:Mo().optional().nullable(),memory:Mo().optional().nullable(),next_goal:Mo().optional().nullable(),action:di(Qs).optional().nullable(),thinking:Mo().optional().nullable()}).passthrough(),ea=pi({is_done:ni(),success:ni().optional().nullable(),long_term_memory:Mo().optional().nullable(),extracted_content:Mo().optional().nullable(),include_extracted_content_only_once:ni().optional().nullable(),include_in_memory:ni().optional().nullable(),error:Mo().optional().nullable(),metadata:pi({click_x:Qo().optional(),click_y:Qo().optional(),new_tab_opened:ni().optional(),input_x:Qo().optional(),input_y:Qo().optional()}).passthrough().optional().nullable()}).passthrough(),ta=pi({url:Mo(),title:Mo(),tab_id:Mo().optional(),parent_tab_id:Mo().optional().nullable()}).passthrough(),na=pi({node_id:Qo().optional(),backend_node_id:Qo().optional(),frame_id:Mo().optional().nullable(),node_type:Qo().optional(),node_value:Mo().optional(),node_name:Mo().optional(),attributes:bi(Mo(),Mo()).optional().nullable(),x_path:Mo().optional(),element_hash:Qo().optional(),bounds:pi({x:Qo(),y:Qo(),width:Qo(),height:Qo()}).passthrough().optional().nullable(),stable_hash:Qo().optional(),ax_name:Mo().optional().nullable()}).passthrough(),ra=pi({tabs:di(ta),screenshot_path:Mo().nullable(),interacted_element:di(na.nullable()),url:Mo(),title:Mo()}).passthrough(),oa=pi({step_start_time:Qo().optional().nullable(),step_end_time:Qo().optional().nullable(),step_number:Qo().optional().nullable(),step_interval:Qo().optional().nullable()}).passthrough(),ia=pi({model_output:Xs.nullable(),result:di(ea),state:ra,metadata:oa.nullable(),state_message:Mo().optional().nullable()}).passthrough(),sa=(pi({history:di(ia)}),pi({step_number:Qo().int().positive(),topic:Mo(),screenshot_url:Mo().nullable(),title:Mo().optional().nullable(),url:Mo().optional().nullable()})),aa=pi({status:Mo(),status_message:Mo().nullable(),num_steps:Qo().int().nonnegative().nullable(),created_at:Wi()}),la=ss.extend({application_id:Qo(),agent_id:Qo(),job_id:Mo(),session_id:Mo().nullish(),status:Mo(),status_message:Mo().nullish(),path:Mo().nullish(),instructions:Mo().nullish(),num_steps:Qo().int().nonnegative(),pinned:ni().optional(),source:xi(["direct","qa"]).optional(),agent_name:Mo().nullish(),graph_index_id:Mo().nullish(),progress_log:di(aa).optional(),agents:di(Ps).optional()}),ca=(pi({user_id:Qo(),email:Mo(),first_name:Mo().optional().nullable(),last_name:Mo().optional().nullable(),last_simulation_at:Mo().optional()}),la.partial().extend({application_id:Qo(),agent_id:Qo(),instructions:Mo(),max_steps:Qo().int().positive().max(1e3).optional(),timeout:Qo().positive().max(360).optional()})),da=pi({job_id:Mo().optional(),status:Mo().optional(),status_message:Mo().optional(),num_steps:Qo().int().nonnegative().optional(),pinned:ni().optional(),graph_index_id:Mo().optional()}),ua=pi({answer:Mo().min(1)}),pa=ss.extend({session_id:Mo(),chat_id:Mo(),application_id:Ui().nullish(),blob_url:Mo().nullable(),event_count:Ui().int().nonnegative(),started_at:Wi(),ended_at:Wi().nullable(),is_active:Fi(e=>"number"==typeof e?0!==e:e,ni()),metadata:pi({userAgent:Mo().optional(),url:Mo().optional()}).nullable(),last_batch_index:Ui().int().nullable(),last_event_timestamp:Ui().int().nullable(),last_upload_time:Wi().nullable()}),ha=pi({session_id:Mo().min(1),chat_id:Mo().min(1),application_id:Qo().int().nullish(),blob_url:Mo().nullish(),event_count:Qo().int().nonnegative().optional(),started_at:Wi().optional(),ended_at:Wi().nullish(),is_active:Fi(e=>"number"==typeof e?0!==e:e,ni()).optional(),metadata:pi({userAgent:Mo().optional(),url:Mo().optional(),applicationId:Qo().optional()}).nullable().optional(),last_batch_index:Qo().int().nonnegative().nullish(),last_event_timestamp:Qo().int().nullish(),last_upload_time:Wi().nullish()}),ma=pi({id:Qo(),simulation_id:Qo(),status:Mo(),status_message:Mo().nullable(),num_steps:Qo().int().nonnegative().nullable(),created_at:Wi()}),fa=pi({start:Mo(),end:Mo(),action:Mo()}),ga=pi({id:Mo(),screenshots:di(Mo()),title:Mo(),url:Mo(),state:di(Mo()),mentions:di(Mo())}),ya=pi({nodes:di(ga),edges:di(fa)}),wa=ss.extend({workspace_id:Qo(),user_id:Qo().nullish(),application_id:Qo(),agent_name:Mo(),agent_type:Vi,agent_voice:qi,agent_description:Mo().nullish(),instructions:Mo().nullish(),image_url:Mo().nullish(),graph_index_id:Mo().nullish(),vector_store_id:Mo().nullish(),status:Ji,status_message:Mo().nullish(),learning_progress:Yi.nullish(),learning_started_at:Wi().nullish(),workspace:Ts.optional(),user:_s.optional(),knowledge:di(Ls).optional(),simulations:di(la).optional(),simulation_count:Qo().int().nonnegative().optional(),knowledge_count:Qo().int().nonnegative().optional()}),ba=e=>{if(Array.isArray(e))return e.map(e=>Number(e));if("string"==typeof e){const t=JSON.parse(e);return Array.isArray(t)?t.map(e=>Number(e)):[]}return[]},va=mi([di(Qo()),Mo()]).transform(ba),xa=mi([di(Qo()),Mo()]).transform(ba),ka=wa.partial().extend({application_id:Ui(),agent_name:Mo(),agent_type:Vi,agent_voice:qi,agent_description:Mo(),instructions:Mo(),file:ji(File).optional(),image_url:Mo().optional(),knowledge_ids:va,simulation_ids:xa}),_a=wa.partial().extend({file:ji(File).optional(),knowledge_ids:va,simulation_ids:xa}),Sa=(pi({text:Mo(),task_id:Mo().optional()}),pi({status:Mo(),message:Mo().optional()}),pi({task_id:Mo().optional(),status:Mo().optional(),current_step:Mo().optional(),error:Mo().optional(),message:Mo().optional()}),pi({workflow_id:Mo(),workflow_type:Mo(),status:Mo(),current_step:Mo(),error:Mo().nullable(),created_at:Mo(),updated_at:Mo()}),pi({session_id:Mo().optional(),live_view_url:Mo().nullish(),status:Mo().optional(),message:Mo().nullish(),success:ni().optional()}),xi(["pending","running","completed","failed","cancelled","has_question","in_progress"]),pi({contentType:xi(["document","video","automation_log","screenshot","all"]).optional(),context:Mo().optional(),previousActions:di(Mo()).optional(),top:Ui().min(1).max(100).optional(),minConfidence:Ui().min(0).max(1).optional(),entities:di(Mo()).optional(),useVectorSearch:ni().optional(),vectorThreshold:Ui().min(0).max(1).optional()}),pi({id:Mo(),content:Mo(),contentType:xi(["document","video","automation_log","screenshot"]),sourceFile:Mo(),sourceType:Mo(),metadata:Mo(),confidence:Qo(),keyPhrases:di(Mo()),entities:di(Mo()),sentiment:Mo(),vectorContent:di(Qo())})),Ca=(pi({document:Sa,score:Qo(),highlights:bi(Mo(),di(Mo())).optional()}),pi({simulation_id:Ui().positive("Simulation ID must be a positive number")})),Ia=pi({agent:wa,simulation_id:Qo(),knowledge_id:Qo(),message:Mo()}),Ea=ss.extend({workspace_id:Qo(),name:Mo(),type:ns,url:Mo().nullish(),username:Mo().nullish(),password:Mo().nullish(),allowed_domains:di(Mo()).nullish().default([])}),Ta=Ea.partial().extend({type:ns,name:Mo().min(1),url:Mo(),allowed_domains:di(Mo()).optional().default([])}),Aa=Ea.partial().omit({workspace_id:!0}),Ma=pi({chip_mode:xi(["show","tell","do"]),chip_text:Mo()}),Oa=pi({widget_enabled:ni(),widget_appearance:xi(["default","compact","full"]),widget_position:xi(["bottom_left","bottom_right","top_left","top_right"]),widget_device:xi(["desktop","mobile","desktop_mobile"]),widget_header:Mo(),widget_body:Mo(),widget_greeting:Mo(),widget_feature_tell:ni(),widget_feature_show:ni(),widget_feature_do:ni(),widget_feature_human:ni(),widget_background_color:Mo(),widget_text_color:Mo(),widget_border_color:Mo(),widget_accent_color:Mo(),widget_secondary_color:Mo(),widget_border_radius:Mo(),widget_font_size:Mo(),widget_width:Mo(),widget_height:Mo(),widget_shadow:Mo(),widget_animation_duration:Mo(),widget_fade_duration:Mo(),widget_bounce_effect:ni(),widget_chips:di(Ma)}),Na=pi({webhook_url:Mo().url(),channel:Mo(),bot_token:Mo(),notifications_enabled:ni()}),Ra=ss.extend({application_id:Qo(),agent_id:Qo(),type:rs,settings:mi([Oa,Na]),status:Hi,marketrix_id:Mo(),marketrix_key:Mo(),snippet:Mo().nullish()}),za=(Ra.extend({application:Ea.partial(),workspace:Ts.partial(),user:_s.partial(),agent:wa.partial()}),Ra.extend({agent:wa.partial().optional()})),Pa=(Ea.extend({widgets:di(Ra).optional(),agents:di(wa).optional()}),Ra.partial().extend({application_id:Qo().positive(),agent_id:Qo().positive(),type:rs,settings:mi([Oa,Na]).optional()})),La=Ra.partial(),Da=ss.extend({widget_id:Qo(),url_pattern:Mo(),message:mi([Mo(),di(Mo())]),description:Mo().optional()}),$a=Da.partial().extend({widget_id:Qo().positive(),url_pattern:Mo().min(1),message:mi([Mo().min(1),di(Mo().min(1)).min(1)])}),ja=Da.partial(),Fa=di(pi({step_number:Qo(),action:Mo(),element:Mo(),text:Mo(),description:Mo(),selector:Mo()})),Ua=ss.extend({application_id:Qo(),question:Mo(),answer:Fa}),Ba=(pi({marketrix_id:Mo().optional(),marketrix_key:Mo().optional(),agent_id:Qo().positive().optional(),application_id:Qo().positive().optional(),chat_id:Mo().optional(),content:Mo()}).refine(e=>(e.marketrix_id&&e.marketrix_key)??(e.agent_id&&e.application_id),{message:"Either marketrix_id + marketrix_key or both agent_id + application_id must be provided"}),pi({text:Mo(),task_id:Mo().optional()}),gi("type",[pi({type:_i("registered"),chat_id:Mo(),application_id:Qo().optional()}),pi({type:_i("pong")}),pi({type:_i("heartbeat")}),pi({type:_i("chat/response"),request_id:Mo(),text:Mo(),task_id:Mo().optional()}),pi({type:_i("chat/error"),request_id:Mo(),error:Mo()}),pi({type:_i("task/status"),status:xi(["started","completed","failed","stopped"]),message:Mo().optional(),task_id:Mo().optional(),timestamp:Qo().optional()}),pi({type:_i("tool/call"),call_id:Mo(),tool:Mo(),args:bi(Mo(),ii()),mode:xi(["show","do"]).optional(),explanation:Mo().optional(),state_version:Qo().optional()})])),Wa=gi("type",[pi({type:_i("chat/tell"),request_id:Mo(),content:Mo()}),pi({type:_i("chat/show"),request_id:Mo(),content:Mo()}),pi({type:_i("chat/do"),request_id:Mo(),content:Mo()}),pi({type:_i("chat/stop"),task_id:Mo().optional()}),pi({type:_i("tool/response"),call_id:Mo(),success:ni(),data:Mo().optional(),error:Mo().optional(),state_version:Qo().optional()}),pi({type:_i("ping")}),pi({type:_i("rrweb/metadata"),session_id:Mo(),chat_id:Mo(),application_id:Qo(),url:Mo().optional(),user_agent:Mo().optional(),timestamp:Qo().optional()}),pi({type:_i("rrweb/events"),session_id:Mo(),events:di(ii())})]),Ga=xi(["simulations","agents","qa","user","jobs"]),Ha=gi("type",[pi({type:_i("simulation/updated"),simulation_id:Qo(),application_id:Qo(),status:Mo(),step_label:Mo().optional()}),pi({type:_i("simulation/created"),simulation_id:Qo(),application_id:Qo()}),pi({type:_i("simulation/deleted"),simulation_id:Qo(),application_id:Qo()}),pi({type:_i("agent/updated"),agent_id:Qo(),application_id:Qo(),status:Mo()}),pi({type:_i("agent/created"),agent_id:Qo(),application_id:Qo()}),pi({type:_i("agent/deleted"),agent_id:Qo(),application_id:Qo()}),pi({type:_i("qa-document/updated"),document_id:Qo(),application_id:Qo(),status:Mo(),step_label:Mo().optional()}),pi({type:_i("qa-run/updated"),run_id:Qo(),document_id:Qo(),application_id:Qo(),status:Mo()}),pi({type:_i("qa-test/updated"),test_id:Qo(),run_id:Qo(),document_id:Qo(),application_id:Qo(),status:Mo()}),pi({type:_i("user/updated"),user_id:Qo(),workspace_id:Qo(),status:Mo()}),pi({type:_i("job/progress"),job_id:Mo(),application_id:Qo(),status:Mo(),message:Mo().optional()}),pi({type:_i("job/completed"),job_id:Mo(),application_id:Qo(),result:ii().optional()}),pi({type:_i("job/failed"),job_id:Mo(),application_id:Qo(),error:Mo()})]),Za=pi({details:Mo().optional(),id:Qo().optional(),type:Mo().optional(),name:Mo().optional(),target_user_id:Qo().optional(),target_user_email:Mo().optional(),reason:Mo().optional(),assigned_role:Mo().optional(),new_role:Mo().optional(),previous_role:Mo().optional(),workspace_name:Mo().optional(),workspace_slug:Mo().optional(),ip_address:Mo().optional(),user_agent:Mo().optional(),widget_type:Mo().optional(),created_by:Qo().optional()}).passthrough(),Va=ss.extend({workspace_id:Qo(),user_id:Qo(),type:is,metadata:Za.optional()}),qa=Va.partial().extend({type:is}),Ja=(ss.extend({user_id:Qo(),application_id:Qo(),agent_id:Qo(),chat_id:Mo(),role:es,source:ts,message:Mo()}),ss.extend({workspace_id:Qo(),provider:os,name:Mo().min(1).max(120),identifier:Mo().max(120).nullish(),api_endpoint:Mo().url().nullish(),api_token:Mo().nullish(),metadata:bi(Mo(),ii()).nullish(),is_active:ni().default(!0),status:Hi.default("active")})),Ya=pi({id:Ui().optional(),provider:os,name:Mo().min(1).max(120),identifier:Mo().max(120).nullish(),api_endpoint:Mo().url().nullish(),api_token:Mo().nullish(),metadata:bi(Mo(),ii()).nullish(),is_active:ni().optional(),status:Hi.optional()}),Ka=pi({provider:os.optional(),status:Hi.optional(),is_active:Bi().optional(),limit:Ui().int().positive().max(100).optional(),offset:Ui().int().nonnegative().optional()}),Qa=pi({id:Qo(),full_name:Mo(),name:Mo(),private:ni(),html_url:Mo(),default_branch:Mo().optional()}),Xa=pi({id:Qo(),name:Mo(),status:Mo(),conclusion:Mo().nullable(),created_at:Mo(),updated_at:Mo(),html_url:Mo(),head_branch:Mo(),run_attempt:Qo()}),el=xi(["pending","running","completed","failed","stopped"]),tl=(xi(["connector","condition"]),gi("kind",[pi({kind:_i("connector"),connector_type:Mo().min(1),connector_id:Qo().nullable().optional(),capability:Mo().min(1),role:xi(["trigger","callback"]),config:bi(Mo(),ii()).default({})}),pi({kind:_i("condition"),config:pi({field:Mo().min(1),operator:xi(["equals","not_equals","contains","gt","lt"]),value:ii()})})])),nl=pi({from:Mo().min(1),to:Mo().min(1),when:xi(["true","false"]).optional()}),rl=pi({nodes:bi(Mo(),tl),edges:di(nl)}),ol=xi(["skip","queue","replace"]).default("skip"),il=ss.extend({workspace_id:Qo(),name:Mo(),graph:rl,concurrency:ol,enabled:ni(),last_run_at:Wi().nullable(),next_run_at:Wi().nullable()}),sl=pi({name:Mo().min(1).max(255),graph:rl,concurrency:ol.optional(),enabled:ni().optional()}),al=pi({id:Ui(),name:Mo().min(1).max(255).optional(),graph:rl.optional(),enabled:ni().optional()}),ll=pi({enabled:Bi().optional(),limit:Ui().int().positive().max(100).optional(),offset:Ui().int().nonnegative().optional()}),cl=pi({status:xi(["completed","failed","skipped","stopped"]),output:bi(Mo(),ii()).nullable().optional(),error:Mo().nullable().optional(),duration_ms:Qo().optional()}),dl=pi({id:Qo().optional(),automation_id:Qo(),status:el,trigger_node_id:Mo(),trigger_data:bi(Mo(),ii()).nullable(),node_results:bi(Mo(),cl),started_at:Wi(),completed_at:Wi().nullable()}),ul=pi({status:el.optional(),limit:Ui().int().positive().max(100).optional(),offset:Ui().int().nonnegative().optional()}),pl=pi({connector_type:Mo(),built_in:ni(),triggers:di(pi({capability:Mo(),description:Mo(),config_schema:bi(Mo(),ii())})),callbacks:di(pi({capability:Mo(),description:Mo(),config_schema:bi(Mo(),ii())}))}),hl=pi({migration_type:Mo().optional(),dry_run:ni().default(!0)}),ml=pi({migration_type:Mo().optional(),backup:ni().default(!0)}),fl=pi({url:Mo()}),gl=(pi({user_id:Qo(),file:ji(File)}),pi({user_id:Qo(),application_id:Qo(),source:ts,prompt:Mo(),status:Mo()}),pi({user_id:Qo(),limit:Qo(),used:Qo(),remaining:Qo()})),yl=(pi({user_id:Qo(),workspace_id:Qo(),chat_count:Qo(),prompt_text:Mo(),metadata:bi(Mo(),Mo()).optional()}),pi({to:Mo(),subject:Mo(),template:Mo(),context:bi(Mo(),Mo())}),pi({id:Mo(),object:_i("event"),api_version:Mo().nullish(),created:Qo(),data:pi({object:bi(Mo(),ii()),previous_attributes:bi(Mo(),ii()).optional()}),livemode:ni(),pending_webhooks:Qo(),request:pi({id:Mo().nullable(),idempotency_key:Mo().nullable()}).nullable().optional(),type:Mo()}),pi({priceId:Mo().min(1,"Price ID is required"),successUrl:Mo().url("Success URL must be a valid URL"),cancelUrl:Mo().url("Cancel URL must be a valid URL")})),wl=pi({returnUrl:Mo().url("Return URL must be a valid URL")}),bl=pi({plan:xi(["starter","growth"]).default("starter"),interval:xi(["month","year"]).default("month")}),vl=pi({subscriptionId:Mo().min(1,"Subscription ID is required"),priceId:Mo().min(1,"Price ID is required")}),xl=pi({success:ni(),message:Mo()}),kl=pi({subscriptionId:Mo().nullable(),customerId:Mo().nullable(),status:xi(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]).nullable(),planTier:xi(["free","starter","growth","enterprise"]).nullable(),billingInterval:xi(["month","year"]).nullable(),priceId:Mo().nullable(),trialEndDate:Wi().nullable(),currentPeriodStart:Wi().nullable(),currentPeriodEnd:Wi().nullable(),cancelAtPeriodEnd:ni(),isTrialing:ni(),daysRemainingInTrial:Qo().nullable(),trialProvisioned:ni()}),_l=pi({sessionId:Mo(),url:Mo().url()}),Sl=pi({url:Mo().url()}),Cl=pi({subscriptionId:Mo(),customerId:Mo(),status:_i("trialing"),trialStartDate:Wi(),trialEndDate:Wi(),planTier:xi(["starter","growth"]),daysRemainingInTrial:Qo()}),Il=pi({used:Qo().int().min(0),limit:Qo().int()}),El=pi({applications:Il,simulationsPerMonth:Il,userPrompts:Il}),Tl=pi({amount:Qo().int().min(0),currency:Mo().default("usd"),formatted:Mo()}),Al=pi({planId:xi(["free","starter","growth","enterprise"]),monthly:Tl.nullable(),annual:Tl.nullable(),priceIds:pi({monthly:Mo().nullable(),annual:Mo().nullable()})}),Ml=pi({plans:di(Al),lastUpdated:Mo().datetime()}),Ol=pi({id:xi(["free","starter","growth","enterprise"]),name:Mo(),description:Mo(),features:di(Mo()),cta:Mo(),isPopular:ni(),customPriceDisplay:Mo().optional(),priceSubtext:Mo().optional(),borderColor:Mo(),buttonColor:Mo(),outlineColor:Mo(),checkColor:Mo()}),Nl=pi({plans:di(Ol)}),Rl=pi({publishableKey:Mo(),priceIds:pi({starter:pi({monthly:Mo().nullable(),annual:Mo().nullable()}),growth:pi({monthly:Mo().nullable(),annual:Mo().nullable()})}),trialDays:Qo().int().min(0),calendlyUrl:Mo()}),zl=pi({widgetKey:Mo(),widgetId:Mo(),widgetUrl:Mo()}),Pl=pi({date:Mo().describe("YYYY-MM-DD"),sessions:Qo().int().nonnegative(),events:Qo().int().nonnegative()}),Ll=pi({items:di(Pl)}),Dl=pi({role:xi(["user","assistant","system"]),content:Mo(),timestamp:Mo().optional()}),$l=ss.extend({workspace_id:Qo(),application_id:Qo().nullish(),agent_id:Qo().nullish(),simulation_id:Qo().nullish(),chat_id:Mo(),chat_content:Mo().nullish(),chat_history:di(Dl).nullish(),chat_output:Mo().nullish(),preview_video_url:Mo().nullish(),metadata:bi(Mo(),ii()).nullish()}),jl=pi({application_id:Qo().nullish(),agent_id:Qo().nullish(),simulation_id:Qo().nullish(),chat_id:Mo(),chat_content:Mo().nullish(),chat_history:di(Dl).nullish(),chat_output:Mo().nullish(),preview_video_url:Mo().nullish(),metadata:bi(Mo(),ii()).nullish()}),Fl=pi({chat_id:Mo().optional(),agent_id:Qo().optional(),simulation_id:Qo().optional(),limit:Qo().optional(),offset:Qo().optional()}),Ul=class extends Error{issues;data;constructor(e){super(e.message,e),this.issues=e.issues,this.data=e.data}};function Bl(e,t){return{...e,...t}}var Wl=class{"~orpc";constructor(e){if(e.route?.successStatus&&K(e.route.successStatus))throw new Error("[ContractProcedure] Invalid successStatus.");if(Object.values(e.errorMap).some(e=>e&&e.status&&!K(e.status)))throw new Error("[ContractProcedure] Invalid error status code.");this["~orpc"]=e}};function Gl(e,t){let n=e;return t.prefix&&(n=function(e,t){return e.path?{...e,path:`${t}${e.path}`}:e}(n,t.prefix)),t.tags?.length&&(n=function(e,t){return{...e,tags:[...t,...e.tags??[]]}}(n,t.tags)),n}function Hl(e,t){if((n=e)instanceof Wl||("object"==typeof n||"function"==typeof n)&&null!==n&&"~orpc"in n&&"object"==typeof n["~orpc"]&&null!==n["~orpc"]&&"errorMap"in n["~orpc"]&&"route"in n["~orpc"]&&"meta"in n["~orpc"])return new Wl({...e["~orpc"],errorMap:Bl(t.errorMap,e["~orpc"].errorMap),route:Gl(e["~orpc"].route,t)});var n;const r={};for(const o in e)r[o]=Hl(e[o],t);return r}var Zl=new class e extends Wl{constructor(e){super(e),this["~orpc"].prefix=e.prefix,this["~orpc"].tags=e.tags}$meta(t){return new e({...this["~orpc"],meta:t})}$route(t){return new e({...this["~orpc"],route:t})}$input(t){return new e({...this["~orpc"],inputSchema:t})}errors(t){return new e({...this["~orpc"],errorMap:Bl(this["~orpc"].errorMap,t)})}meta(t){return new e({...this["~orpc"],meta:(n=this["~orpc"].meta,r=t,{...n,...r})});var n,r}route(t){return new e({...this["~orpc"],route:(n=this["~orpc"].route,r=t,{...n,...r})});var n,r}input(t){return new e({...this["~orpc"],inputSchema:t})}output(t){return new e({...this["~orpc"],outputSchema:t})}prefix(t){return new e({...this["~orpc"],prefix:(n=this["~orpc"].prefix,r=t,n?`${n}${r}`:r)});var n,r}tag(...t){return new e({...this["~orpc"],tags:(n=this["~orpc"].tags,r=t,n?[...n,...r]:r)});var n,r}router(e){return Hl(e,this["~orpc"])}}({errorMap:{},route:{},meta:{}}),Vl=Symbol("ORPC_EVENT_ITERATOR_DETAILS");function ql(e,t){return{"~standard":{[Vl]:{yields:e,returns:t},vendor:"orpc",version:1,validate:n=>P(n)?{value:me(n,{async value(n,r){const o=r?t:e;if(!o)return n;const i=await o["~standard"].validate(n);if(i.issues)throw new Y("EVENT_ITERATOR_VALIDATION_FAILED",{message:"Event iterator validation failed",cause:new Ul({issues:i.issues,message:"Event iterator validation failed",data:n})});return i.value},error:async e=>e})}:{issues:[{message:"Expect event iterator",path:[]}]}}}}Zl.route({method:"GET",tags:["Root"],path:"/",summary:"Get API index information and basic system details",description:"Returns general API information, version, and available endpoints"}).output(xs),Zl.route({method:"GET",tags:["Internal"],path:"/health",summary:"Health check endpoint for monitoring system status",description:"Returns current system health, database connectivity, and service status"}).output(vs),Zl.route({method:"GET",tags:["Root"],path:"/validate-url",summary:"Validate URL accessibility and DNS resolution",description:"Validates a URL for format, DNS resolution, and HTTP accessibility"}).input(pi({url:Mo().url(),skip_network:Mo().optional()})).output(pi({valid:ni(),accessible:ni(),dnsResolves:ni(),error:Mo().optional().describe("Error message if URL validation failed"),warnings:di(Mo()).optional().describe("Non-fatal issues found during URL validation")})),Zl.route({method:"GET",tags:["Root"],path:"/config/public",summary:"Get public client configuration",description:"Returns widget key and widget ID. No auth. Values are stored in backend env only."}).output(zl),Zl.route({method:"GET",tags:["Auth"],path:"/auth/me",summary:"Get current authenticated user and workspace information",description:"Returns user profile and workspace data based on session cookie"}).output(pi({user:_s,workspace:Ts.nullable(),workspaces:di(pi({id:Qo(),name:Mo(),slug:Mo(),role:xi(["owner","member"])}))})),Zl.route({method:"GET",tags:["Auth"],path:"/email-action/{token}",summary:"Process email approval/rejection action",description:"Handles approve/reject links from admin emails. Token-in-URL authentication (no session required). Returns an HTML page, not JSON."}).input(pi({token:Mo().min(1)})).output(pi({result:Mo().describe("HTML response page")})),Zl.route({method:"POST",tags:["Onboarding"],path:"/onboard",summary:"Complete user onboarding in one atomic operation",description:"Creates workspace, updates user status, and invites team members"}).input(pi({name:Mo().min(1).max(45),slug:Mo().min(1).max(45).optional(),domain:Mo().min(1).max(200),team_emails:di(Mo().email()).optional().default([]),app_url:Mo().optional(),app_username:Mo().optional(),app_password:Mo().optional()})).output(pi({workspace:Ts})),Zl.route({method:"POST",tags:["Workspace"],path:"/workspaces",summary:"Create a new workspace",description:"Creates new workspace with specified settings and returns workspace entity"}).input(As).output(Ts),Zl.route({method:"GET",tags:["Workspace"],path:"/workspaces",summary:"Search and filter workspaces by various criteria",description:"Returns list of workspaces matching search parameters (name, domain, email, etc.)"}).input(pi({name:Mo().optional(),domain:Mo().optional(),email:Mo().email().optional(),app_id:Ui().optional(),workspace_id:Ui().optional(),user_id:Ui().optional()}).extend(ys.shape)).output(ws(Ts)),Zl.route({method:"GET",tags:["Workspace"],path:"/workspaces/lookup/{slug}",summary:"Look up workspace by slug for onboarding",description:"Returns workspace name and slug for join-workspace flow. Requires onboarding-level auth."}).input(cs).output(pi({name:Mo(),slug:Mo()}).nullable()),Zl.route({method:"GET",tags:["Workspace"],path:"/workspaces/{slug}",summary:"Get specific workspace details by slug",description:"Returns complete workspace information including settings and configuration"}).input(cs).output(Ts),Zl.route({method:"PUT",tags:["Workspace"],path:"/workspaces/{slug}",summary:"Update workspace settings and configuration",description:"Modifies workspace properties like name, domain, or feature settings"}).input(Ms.extend({slug:Mo()})).output(Ts),Zl.route({method:"DELETE",tags:["Workspace"],path:"/workspaces/{slug}",summary:"Delete workspace and all associated data",description:"Permanently deletes a workspace and cleans up all related resources. This action cannot be undone."}).input(cs).output(fs),Zl.route({method:"GET",tags:["Workspace"],path:"/workspaces/{slug}/members",summary:"List workspace members",description:"Returns all members of the workspace with their user profile details and roles."}).input(cs).output(bs(zs.extend({user:_s.pick({id:!0,email:!0,first_name:!0,last_name:!0,image_url:!0})}))),Zl.route({method:"POST",tags:["Workspace"],path:"/workspaces/{slug}/members",summary:"Add member to workspace",description:"Invites a user by email to join the workspace with the specified role. Defaults to member role."}).input(cs.extend({email:Mo().email(),role:Rs.default("member")})).output(zs),Zl.route({method:"DELETE",tags:["Workspace"],path:"/workspaces/{slug}/members/{user_id}",summary:"Remove member from workspace",description:"Removes a user from the workspace by user_id. The user loses access immediately."}).input(cs.extend({user_id:Qo()})).output(fs),Zl.route({method:"PATCH",tags:["Workspace"],path:"/workspaces/{slug}/members/{user_id}",summary:"Update member role",description:"Changes the role of a workspace member. Valid roles: owner, member."}).input(cs.extend({user_id:Qo(),role:Rs})).output(zs),Zl.route({method:"GET",tags:["Workspace"],path:"/users/me/workspaces",summary:"List workspaces for current user",description:"Returns all workspaces the authenticated user belongs to, including their role in each."}).output(bs(Ts.extend({role:Rs}))),Zl.route({method:"POST",path:"/admin/reconcile",tags:["Internal"],summary:"Reconcile Stripe customers and WorkOS users",description:"Backfills missing Stripe customer IDs for workspaces and real WorkOS user IDs for users. Idempotent and safe to run repeatedly. Requires super user role."}).output(pi({workspaces_stripe_created:Qo(),users_workos_created:Qo(),workspace_plans_synced:Qo(),trials_provisioned:Qo(),stripe_plans_refreshed:Qo(),workos_profiles_synced:Qo(),errors:di(pi({type:Mo(),id:Qo(),error:Mo()}))})),Zl.route({method:"POST",path:"/admin/maintenance",tags:["Internal"],summary:"Run periodic maintenance cleanup tasks",description:"Cleans up orphaned CosmosDB containers, QA simulations not linked to existing runs, and orphaned blob storage files. Idempotent and safe to run repeatedly. Requires super user role."}).output(pi({cosmos_containers_deleted:Qo(),orphaned_qa_simulations_deleted:Qo(),orphaned_blob_dirs_deleted:Qo(),errors:di(pi({type:Mo(),detail:Mo()}))})),Zl.route({method:"POST",path:"/admin/rebuild",tags:["Internal"],summary:"Rebuild all agent indexes after cleanup",description:"Removes stale knowledge (missing files), stale simulations (0 steps or missing blobs), then deletes and recreates vector stores and knowledge graphs for every agent. Index creation is async. Requires super user role."}).output(pi({knowledge_removed:Qo(),simulations_removed:Qo(),agents_rebuilt:Qo(),errors:di(pi({type:Mo(),detail:Mo()}))})),Zl.route({method:"POST",tags:["Application"],path:"/applications",summary:"Create a new application",description:"Creates a new application for the authenticated workspace and returns the created entity."}).input(Ta).output(Ea),Zl.route({method:"GET",tags:["Application"],path:"/applications",summary:"Search applications for workspace",description:"Returns applications for the authenticated workspace, optionally filtered by type, always includes widgets"}).input(pi({type:ns.optional(),include:di(xi(["widgets"])).optional()}).extend(ys.shape)).output(ws(Ea.extend({widgets:di(Ra).optional()}))),Zl.route({method:"GET",tags:["Application"],path:"/applications/{application_id}",summary:"Get application by ID",description:"Returns specific application details by ID, always includes widgets"}).input(hs).output(Ea.extend({widgets:di(Ra)})),Zl.route({method:"PUT",tags:["Application"],path:"/applications/{application_id}",summary:"Update application",description:"Updates application details and configuration"}).input(Aa.extend({application_id:Ui()})).output(Ea),Zl.route({method:"DELETE",tags:["Application"],path:"/applications/{application_id}",summary:"Delete application",description:"Permanently deletes an application and all associated widgets. This action cannot be undone."}).input(hs).output(fs),Zl.route({method:"POST",tags:["Widget"],path:"/widgets",summary:"Create a new widget",description:"Creates a new widget for an application and returns the created entity. Requires an application_id."}).input(Pa).output(Ra),Zl.route({method:"GET",tags:["Widget"],path:"/widgets",summary:"Search widgets for workspace",description:"Search widgets by type, application, marketrix_id, or marketrix_key"}).input(pi({type:rs.optional(),application_id:Ui().optional(),marketrix_id:Mo().optional(),marketrix_key:Mo().optional(),include:di(xi(["agent"])).optional()}).extend(ys.shape)).output(ws(za)),Zl.route({method:"GET",tags:["Widget"],path:"/widgets/defaults/{type}",summary:"Get default settings for widget type",description:"Returns default settings for the specified widget type"}).input(pi({type:rs})).output(mi([Oa,Na])),Zl.route({method:"GET",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Get widget by ID",description:"Returns specific widget details by widget ID including snippet code"}).input(us).output(Ra),Zl.route({method:"PUT",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Update widget",description:"Updates widget settings and configuration"}).input(La.extend({widget_id:Ui()})).output(Ra),Zl.route({method:"DELETE",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Delete widget",description:"Permanently deletes a widget from an application. This action cannot be undone."}).input(us).output(fs),Zl.route({method:"POST",tags:["Chat"],path:"/chat",summary:"Create a new chat thread",description:"Initializes new chat thread and returns session ID"}).output(Mo()),Zl.route({method:"GET",tags:["Chat"],path:"/chat",summary:"Search chats by user",description:"Returns chat list and quota for the specified user"}).input(pi({user_id:Ui().optional(),chat_id:Ui().optional()})).output(gl),Zl.route({method:"POST",tags:["Chat"],path:"/preview-video-chat",summary:"Create or update preview video chat record",description:"Persists guide preview chat content, history, output, and related simulation metadata"}).input(jl).output($l),Zl.route({method:"GET",tags:["Chat"],path:"/preview-video-chat",summary:"Search preview video chat records",description:"Returns preview chat records filtered by chat_id, agent_id, or simulation_id for current workspace"}).input(Fl).output(bs($l)),Zl.route({method:"GET",tags:["Chat"],path:"/preview-video-chat/{id}",summary:"Get preview video chat record by ID",description:"Returns a single preview chat record for current workspace"}).input(ls).output($l.nullable()),Zl.route({method:"POST",tags:["Connector"],path:"/connector",summary:"Create or update connector",description:"Stores provider credentials and API endpoint details for workspace connectors"}).input(Ya).output(Ja),Zl.route({method:"GET",tags:["Connector"],path:"/connector",summary:"Search connectors",description:"Returns workspace connectors filtered by provider/status"}).input(Ka).output(ws(Ja)),Zl.route({method:"GET",tags:["Connector"],path:"/connector/{id}",summary:"Get connector by ID",description:"Returns a single workspace connector"}).input(ls).output(Ja.nullable()),Zl.route({method:"DELETE",tags:["Connector"],path:"/connector/{id}",summary:"Delete connector",description:"Permanently deletes a connector for current workspace. This action cannot be undone."}).input(ls).output(fs),Zl.route({method:"GET",tags:["Connector"],path:"/connector/{id}/github/repos",summary:"List GitHub repositories for a GitHub connector",description:"Uses the stored GitHub PAT from the connector to call GitHub /user/repos."}).input(pi({id:Ui(),per_page:Ui().int().min(1).max(100).optional(),page:Ui().int().min(1).optional()})).output(di(Qa)),Zl.route({method:"GET",tags:["Connector"],path:"/connector/{id}/github/repos/{owner}/{repo}/actions/runs",summary:"List GitHub Actions workflow runs",description:"Lists workflow runs for a repository (pass/fail status)."}).input(pi({id:Ui(),owner:Mo().min(1),repo:Mo().min(1),per_page:Ui().int().min(1).max(100).optional(),page:Ui().int().min(1).optional()})).output(di(Xa)),Zl.route({method:"POST",tags:["Automation"],path:"/automation",summary:"Create automation",description:"Creates a DAG-based automation workflow"}).input(sl).output(il),Zl.route({method:"GET",tags:["Automation"],path:"/automation",summary:"List automations",description:"Returns automations for the current workspace"}).input(ll).output(ws(il)),Zl.route({method:"GET",tags:["Automation"],path:"/automation/{id}",summary:"Get automation",description:"Returns a single automation with its graph"}).input(ls).output(il.nullable()),Zl.route({method:"PUT",tags:["Automation"],path:"/automation/{id}",summary:"Update automation",description:"Updates automation graph and settings"}).input(al).output(il),Zl.route({method:"DELETE",tags:["Automation"],path:"/automation/{id}",summary:"Delete automation",description:"Permanently deletes an automation and deregisters its triggers"}).input(ls).output(fs),Zl.route({method:"PATCH",tags:["Automation"],path:"/automation/{id}/toggle",summary:"Toggle automation",description:"Enable or disable an automation"}).input(pi({id:Ui(),enabled:ni()})).output(il),Zl.route({method:"POST",tags:["Automation"],path:"/automation/{id}/run",summary:"Trigger automation run",description:"Manually triggers an automation run"}).input(ls).output(dl.nullable()),Zl.route({method:"GET",tags:["Automation"],path:"/automation/{id}/runs",summary:"List automation runs",description:"Returns execution history for an automation"}).input(pi({id:Ui()}).extend(ul.shape)).output(ws(dl)),Zl.route({method:"GET",tags:["Automation"],path:"/automation/{id}/runs/{run_id}",summary:"Get automation run",description:"Returns a single run with per-node results"}).input(pi({id:Ui(),run_id:Ui()})).output(dl.nullable()),Zl.route({method:"GET",tags:["Connector"],path:"/connector-capabilities",summary:"List connector capabilities",description:"Returns available triggers and callbacks per connector type"}).input(pi({})).output(di(pl)),Zl.route({method:"GET",tags:["User"],path:"/user",summary:"Search and filter users by workspace",description:"Returns list of users associated with specified workspace"}).input(pi({workspace_id:Ui().optional(),status:Hi.optional()}).extend(ys.shape)).output(ws(_s)),Zl.route({method:"POST",tags:["User"],path:"/user/batch",summary:"Create multiple users in batch operation",description:"Processes bulk user creation and returns results for each user"}).input(Is).output(di(Es)),Zl.route({method:"GET",tags:["User"],path:"/user/{user_id}",summary:"Get specific user details by ID",description:"Returns complete user information including profile and settings"}).input(ms).output(_s),Zl.route({method:"PUT",tags:["User"],path:"/user/{user_id}",summary:"Update user profile and settings",description:"Modifies user properties like name, email, or preferences"}).input(Cs.extend({user_id:Ui()})).output(_s),Zl.route({method:"PUT",tags:["User"],path:"/user/{user_id}/image",summary:"Upload and update user profile image",description:"Handles file upload for user avatar and returns upload response"}).input(as.extend({user_id:Ui()})).output(fl),Zl.route({method:"DELETE",tags:["User"],path:"/user/{user_id}",summary:"Delete user account and all associated data",description:"Permanently deletes a user account and cleans up all related resources. This action cannot be undone."}).input(ms).output(fs),Zl.route({method:"POST",tags:["User"],path:"/user/{user_id}/deactivate",summary:"Deactivate user account without deletion",description:"Deactivates user access while preserving data for potential reactivation"}).input(ms.extend({reason:Mo().optional()})).output(fs),Zl.route({method:"POST",tags:["Agent"],path:"/agent",summary:"Create new AI agent with configuration",description:"Creates agent with specified settings, prompts, and returns agent entity"}).input(ka).output(wa),Zl.route({method:"GET",tags:["Agent"],path:"/agent",summary:"Search and filter agents by workspace or user",description:"Returns list of agents matching search parameters. Supports filtering by workspace_id, user_id, and application_id."}).input(pi({workspace_id:Ui().optional(),user_id:Ui().optional(),application_id:Ui().optional(),include:di(xi(["knowledge","simulations"])).optional()}).extend(ys.shape)).output(ws(wa)),Zl.route({method:"GET",tags:["Agent"],path:"/agent/{agent_id}",summary:"Get specific agent details by ID",description:"Returns complete agent information including configuration and settings"}).input(ds.extend({include:di(xi(["knowledge","simulations"])).optional()})).output(wa),Zl.route({method:"GET",tags:["Agent"],path:"/agent/{agent_id}/mindmap",summary:"Get agent mindmap by ID",description:"Returns the mindmap knowledge graph for the specified agent"}).input(ds).output(ya),Zl.route({method:"PUT",tags:["Agent"],path:"/agent/{agent_id}",summary:"Update agent configuration and settings",description:"Updates agent details. For JSON requests, handled by oRPC. Also accepts multipart/form-data for logo file uploads (handled by raw Express route)."}).input(_a.extend({agent_id:Ui(),force_reset_learning:Bi().optional()})).output(wa),Zl.route({method:"DELETE",tags:["Agent"],path:"/agent/{agent_id}",summary:"Delete agent and all associated data",description:"Permanently deletes an agent and cleans up all related resources. This action cannot be undone."}).input(ds).output(fs),Zl.route({method:"POST",tags:["Agent"],path:"/agent/{agent_id}/index",summary:"Index simulation document into agent knowledge base",description:"Adds a simulation document to an agent's knowledge base and refreshes the search index"}).input(Ca.extend({agent_id:Ui()})).output(Ia),Zl.route({method:"POST",tags:["Agent"],path:"/agent/{agent_id}/reset-learning",summary:"Force reset agent from stuck learning state",description:"Resets an agent that is stuck in learning state, setting it to error status with a message explaining the reset"}).input(ds).output(wa),Zl.route({method:"POST",tags:["Activity Log"],path:"/log",summary:"Create new activity log entry",description:"Records user or system action for auditing and tracking purposes"}).input(qa).output(Va),Zl.route({method:"GET",tags:["Activity Log"],path:"/log",summary:"Search and filter activity logs",description:"Returns list of activity logs matching search parameters (workspace, type)"}).input(pi({workspace_id:Ui().optional(),type:is.optional(),application_id:Ui().optional()}).extend(ys.shape)).output(ws(Va)),Zl.route({method:"GET",tags:["Tour"],path:"/tour",summary:"Search and filter tours by workspace",description:"Returns list of available tours for specified workspace"}).input(pi({workspace_id:Ui().optional(),application_id:Ui().optional()}).extend(ys.shape)).output(ws(Ua)),Zl.route({method:"POST",tags:["Tour"],path:"/tour",summary:"Create new interactive tour",description:"Creates tour with specified steps and configuration"}).input(Ua).output(Ua),Zl.route({method:"GET",tags:["URL Guide"],path:"/url-guide",summary:"Search URL guides by widget",description:"Returns list of URL guides for specified widget"}).input(us.extend(ys.shape)).output(ws(Da)),Zl.route({method:"POST",tags:["URL Guide"],path:"/url-guide",summary:"Create new URL guide",description:"Creates URL guide with pattern and message"}).input($a).output(Da),Zl.route({method:"GET",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Get URL guide by ID",description:"Returns URL guide details"}).input(ls).output(Da),Zl.route({method:"PUT",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Update URL guide",description:"Updates URL guide properties"}).input(ja.extend({id:Ui()})).output(Da),Zl.route({method:"DELETE",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Delete URL guide",description:"Permanently deletes a URL guide. This action cannot be undone."}).input(ls).output(fs),Zl.route({method:"GET",tags:["URL Guide"],path:"/url-guide/match",summary:"Find matching URL guide for current URL",description:"Returns matching URL guide for a given URL pattern"}).input(pi({widget_id:Ui(),url:Mo()})).output(Da.nullable()),Zl.route({method:"GET",tags:["Simulation"],path:"/simulation",summary:"Search and filter simulations by workspace",description:"Returns list of simulations associated with specified workspace. Use application_id, agent_id, or pinned to filter."}).input(pi({workspace_id:Ui().optional(),application_id:Ui().optional(),agent_id:Ui().optional(),pinned:mi([ni(),Mo()]).optional().transform(e=>void 0===e?void 0:"boolean"==typeof e?e:"true"===e||"false"!==e&&void 0),source:xi(["direct","qa"]).optional(),include:di(xi(["agent","application"])).optional()}).extend(ys.shape)).output(ws(la)),Zl.route({method:"POST",tags:["Simulation"],path:"/simulation/start",summary:"Start new application simulation",description:"Creates and initializes simulation with specified parameters"}).input(ca).output(la),Zl.route({method:"PUT",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Update simulation configuration and status",description:"Modifies simulation parameters and updates execution state"}).input(da.extend({simulation_id:Ui()})).output(la),Zl.route({method:"PUT",tags:["Simulation"],path:"/simulation/{simulation_id}/agents",summary:"Assign agents to a simulation",description:"Sets which agents use this simulation for their knowledge. Triggers learning on affected agents."}).input(ps.extend({agent_ids:di(Qo())})).output(la),Zl.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/progress",summary:"Get simulation progress history as chat transcript",description:"Returns all progress updates for a simulation ordered chronologically"}).input(ps).output(bs(ma)),Zl.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/live-view",summary:"Get live view URL for simulation session",description:"Returns Browserbase live view URL for embedding in iframe"}).input(ps).output(pi({session_id:Mo(),live_view_url:Mo(),status:Mo()})),Zl.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/history",summary:"Get simulation history by ID",description:"Returns the history array for the specified simulation"}).input(ps).output(bs(ia)),Zl.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/steps",summary:"Get all simulation steps with topic and screenshot link as JSON",description:"Returns each step with step_number, topic, screenshot_url, and optional title/url for the simulation"}).input(ps).output(bs(sa)),Zl.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/mindmap",summary:"Get simulation mindmap by ID",description:"Returns the mindmap knowledge graph for the specified simulation"}).input(ps).output(ya),Zl.route({method:"POST",tags:["Simulation"],path:"/simulation/{simulation_id}/stop",summary:"Stop running simulation",description:"Terminates a running simulation and closes its browser session."}).input(ps).output(gs),Zl.route({method:"POST",tags:["Simulation"],path:"/simulation/{simulation_id}/answer",summary:"Submit answer to simulation question",description:"Submits an answer to a pending question from the simulation agent"}).input(ua.extend({simulation_id:Ui()})).output(gs),Zl.route({method:"DELETE",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Delete simulation",description:"Permanently deletes a simulation and all associated data. Only works on simulations in terminal state."}).input(ps).output(gs),Zl.route({method:"POST",tags:["Session"],path:"/sessions",summary:"Create or update session",description:"Creates a new session or updates an existing one"}).input(ha).output(pa),Zl.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}",summary:"Get session by session ID",description:"Retrieves a session by its session_id"}).input(pi({session_id:Mo().min(1)})).output(pa.nullable()),Zl.route({method:"GET",tags:["Session"],path:"/sessions/chat/{chat_id}",summary:"Get sessions by chat ID",description:"Retrieves all sessions for a given chat_id"}).input(pi({chat_id:Mo().min(1)})).output(bs(pa)),Zl.route({method:"GET",tags:["Session"],path:"/sessions",summary:"Get all sessions",description:"Retrieves all sessions ordered by creation date, optionally filtered by application and date range"}).input(pi({application_id:Ui().optional(),start_date:Mo().optional(),end_date:Mo().optional()}).extend(ys.shape)).output(ws(pa)),Zl.route({method:"GET",tags:["Session"],path:"/sessions/stats",summary:"Get session activity stats",description:"Returns daily aggregated session metrics for charting. Each entry is one calendar day with session count and total event count."}).input(pi({application_id:Ui(),start_date:Mo().describe("YYYY-MM-DD"),end_date:Mo().describe("YYYY-MM-DD")})).output(Ll),Zl.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}/events",summary:"Get session events",description:"Fetches all batches from folder, combines them in correct order, and returns events array"}).input(pi({session_id:Mo().min(1)})).output(bs(pi({type:Qo(),timestamp:Qo(),data:ii().describe("rrweb event payload — shape defined by rrweb library")}))),Zl.route({method:"POST",tags:["Browser Session"],path:"/browser-session/create",summary:"Create browser session for application",description:"Creates a browser session and navigates to the application URL"}).input(pi({application_id:Qo(),agent_id:Qo(),url:Mo().nullish()})).output(pi({session_id:Mo(),live_view_url:Mo()})),Zl.route({method:"POST",tags:["Browser Session"],path:"/browser-session/{session_id}/stop",summary:"Stop browser session",description:"Stops all running tasks and closes the browser session. Set stop_tasks=false to skip task cleanup."}).input(pi({session_id:Mo(),stop_tasks:ni().optional().default(!0)})).output(gs),Zl.route({method:"GET",tags:["Knowledge"],path:"/knowledge",summary:"Search and filter knowledge base documents",description:"Returns list of knowledge documents matching search parameters. Supports filtering by workspace_id, type, and application_id."}).input(pi({workspace_id:Ui().optional(),type:Ki.optional(),application_id:Ui().optional(),include:di(xi(["agents","application"])).optional()}).extend(ys.shape)).output(ws(Ls)),Zl.route({method:"POST",tags:["Knowledge"],path:"/knowledge",summary:"Upload new knowledge base document",description:"Upload a file, document URL, or video URL to create a knowledge entry for AI training"}).input(pi({file:ji(File).optional(),application_id:Ui(),document_url:Mo().url().optional(),document_name:Mo().optional(),video_url:Mo().url().optional(),video_name:Mo().optional()})).output(Ls),Zl.route({method:"GET",tags:["Knowledge"],path:"/knowledge/{id}",summary:"Get specific knowledge document by ID",description:"Returns complete knowledge document information and content"}).input(ls).output(Ls),Zl.route({method:"DELETE",tags:["Knowledge"],path:"/knowledge/{id}",summary:"Delete knowledge document",description:"Permanently deletes a knowledge document from the database. This action cannot be undone."}).input(ls).output(fs),Zl.route({method:"POST",tags:["Knowledge"],path:"/knowledge/{id}/refresh",summary:"Refresh knowledge document",description:"Re-fetches HTML content from source URL and updates the document"}).input(ls).output(Ls),Zl.route({method:"PUT",tags:["Knowledge"],path:"/knowledge/{knowledge_id}/agents",summary:"Assign agents to a knowledge item",description:"Sets which agents use this knowledge item. Triggers learning on affected agents."}).input(pi({knowledge_id:Ui(),agent_ids:di(Qo())})).output(Ls),Zl.route({method:"POST",tags:["QA"],path:"/qa/document",summary:"Upload QA flow (file or text)",description:"Uploads a PDF/text file or text content for QA test generation. Also accepts multipart/form-data for file uploads (handled by raw Express route)."}).input(Fs).output(js),Zl.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/process",summary:"Process QA flow and generate test cases",description:"Starts async processing (returns 202). Poll GET /qa/document/:id for status and processing_step until completed/failed."}).input(ls).output(pi({document:js})),Zl.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/refine",summary:"Refine existing QA test cases",description:"Refines existing test cases with a refinement prompt via AI agent API"}).input(ls.extend({refinementPrompt:Mo().min(5).max(2e3)})).output(Vs),Zl.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/process/stream",summary:"Process QA flow with SSE streaming",description:"Streams processing events as Server-Sent Events. Events: response.created, response.progress, response.clear, response.completed, error."}).input(ls).output(ql(pi({event:Mo().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:ii().describe("Event payload object — shape varies by event type")}))),Zl.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/refine/stream",summary:"Refine QA flow test cases with SSE streaming",description:"Streams refinement events as Server-Sent Events. Requires a refinement prompt (min 5 chars)."}).input(ls.extend({refinementPrompt:Mo().min(5)})).output(ql(pi({event:Mo().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:ii().describe("Event payload object — shape varies by event type")}))),Zl.route({method:"GET",tags:["QA"],path:"/qa/document/{id}",summary:"Get QA flow by ID",description:"Retrieves a QA flow by its ID"}).input(ls).output(js),Zl.route({method:"GET",tags:["QA"],path:"/qa/document",summary:"List QA flows",description:"Returns all QA flows with aggregated metrics (run_count, pass_rate, total_failed) and the last run summary. Supports filtering by application_id."}).input(pi({application_id:Ui().optional()}).extend(ys.shape)).output(ws(js.extend({run_count:Qo(),display_title:Mo(),total_failed:Qo(),pass_rate:Qo().nullable(),last_run:pi({id:Qo(),status:Mo(),total_tests:Qo(),passed_tests:Qo(),failed_tests:Qo(),created_at:Wi().nullable()}).nullable()})).extend({metrics:pi({total_flows:Qo(),total_runs:Qo(),avg_pass_rate:Qo().nullable(),total_failed:Qo(),total_passed:Qo()})})),Zl.route({method:"DELETE",tags:["QA"],path:"/qa/document/{id}",summary:"Delete QA flow",description:"Permanently deletes a QA flow and all its runs and test cases. This action cannot be undone."}).input(ls).output(fs),Zl.route({method:"PUT",tags:["QA"],path:"/qa/document/{id}",summary:"Update QA flow status",description:"Updates the status of a QA flow"}).input(ls.extend({status:Qi})).output(js),Zl.route({method:"GET",tags:["QA"],path:"/qa/document/{id}/runs",summary:"List runs for a QA flow",description:"Returns all runs for a document with total/passed/failed counts"}).input(ls.extend(ys.shape)).output(ws(Us.extend({total_tests:Qo(),passed:Qo(),failed:Qo()}))),Zl.route({method:"GET",tags:["QA"],path:"/qa/run/{id}",summary:"Get a QA run by ID",description:"Returns run details with test cases"}).input(ls).output(Us.extend({test_cases:di(Zs)})),Zl.route({method:"DELETE",tags:["QA"],path:"/qa/run/{id}",summary:"Delete a QA run",description:"Permanently deletes a QA run and all its test case results. This action cannot be undone."}).input(ls).output(fs),Zl.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/run",summary:"Create and start a new QA run",description:"Creates a new run and starts execution. Returns 202; poll test-cases for execution status."}).input(ls).output(pi({run:Us,simulations:di(la)})),Zl.route({method:"GET",tags:["QA"],path:"/qa/document/{id}/test-cases",summary:"Get test cases for a QA flow",description:"Retrieves test cases; optional run_id scopes to that run"}).input(ls.extend({run_id:Ui().optional()})).output(bs(Zs)),Zl.route({method:"PUT",tags:["QA"],path:"/qa/test-case/{id}",summary:"Update test case definition fields",description:"Updates a test case definition (title, objective, steps, etc.)"}).input(ls.extend({test_title:Mo().optional(),test_objective:Mo().optional(),test_steps:di(Mo()).optional(),expected_outcome:Mo().optional(),priority:xi(["Low","Medium","High"]).optional(),is_active:ni().optional()})).output(Zs),Zl.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/execute",summary:"Create a run and execute all pending tests for a QA flow as simulations",description:"Creates a new QA run, then starts a simulation for every active test case. Returns the run and simulation entities."}).input(ls).output(pi({run:Us,simulations:di(la)})),Zl.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/execute",summary:"Execute a single test case as a simulation",description:"Starts a simulation for the specified test case and returns the simulation entity."}).input(ls).output(pi({simulation:la})),Zl.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/simulation",summary:"Get the simulation linked to a test case",description:"Returns the simulation entity associated with the test case, or null if no simulation exists."}).input(ls).output(pi({simulation:la.nullable()})),Zl.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/versions",summary:"Get version history for a test case",description:"Returns all version entries from the test case version_history JSON"}).input(ls).output(bs(Gs)),Zl.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}",summary:"Get specific test case version",description:"Returns a specific version entry from the test case version_history JSON"}).input(ls.extend({version:Ui()})).output(Gs),Zl.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}/rollback",summary:"Rollback to specific version",description:"Restores test case to a previous version and appends new version entry"}).input(ls.extend({version:Ui()})).output(Gs),Zl.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/versions/compare",summary:"Compare two versions",description:"Returns differences between two test case versions"}).input(ls.extend({version1:Ui(),version2:Ui()})).output(pi({version1:Gs,version2:Gs,diff:di(pi({field:Mo(),oldValue:Js,newValue:Js}))})),Zl.route({method:"DELETE",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}",summary:"Delete a specific version",description:"Removes a version from history and reverts test case to previous version if it was the latest"}).input(ls.extend({version:Ui()})).output(fs.extend({current_version:Qo()})),Zl.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}/accept",summary:"Accept a specific version",description:"Marks a version as accepted by the user"}).input(ls.extend({version:Ui()})).output(fs),Zl.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/healing-attempts",summary:"Get healing attempts for a test case",description:"Returns all healing attempt entries from the test case healing_attempts JSON"}).input(ls).output(bs(Hs)),Zl.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/healing-attempts/{attemptIndex}/approve",summary:"Approve a healing attempt",description:"Applies the repair from a validated healing attempt by array index"}).input(ls.extend({attemptIndex:Ui()})).output(fs),Zl.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/healing-attempts/{attemptIndex}/reject",summary:"Reject a healing attempt",description:"Marks a healing attempt as rejected by array index"}).input(ls.extend({attemptIndex:Ui()})).output(fs),Zl.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/heal",summary:"Trigger self-healing for a failed test case",description:"Initiates the self-healing workflow for a test case"}).input(ls.extend({simulation_id:Qo(),config:pi({enabled:ni().optional(),autoApply:ni().optional(),minConfidenceThreshold:Qo().min(0).max(1).optional(),maxHealingAttempts:Qo().int().min(1).max(5).optional()}).optional()})).output(pi({healed:ni(),attemptIndex:Qo().nullable(),analysis:Ks.nullable(),confidence:Qo().nullable()})),Zl.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/run-cross-browser",summary:"Execute cross-browser tests",description:"Runs tests across multiple browsers (chromium, firefox, webkit)"}).input($s.extend({id:Ui()})).output(pi({runs:di(pi({browserType:Ds,runId:Qo(),status:xi(["completed","failed","skipped"]),passedTests:Qo(),failedTests:Qo(),totalTests:Qo()})),summary:pi({totalRuns:Qo(),completedRuns:Qo(),failedRuns:Qo(),overallPassed:Qo(),overallFailed:Qo()})})),Zl.route({method:"GET",tags:["QA"],path:"/qa/document/{id}/cross-browser-comparison",summary:"Get cross-browser comparison",description:"Returns test cases comparison across different browsers"}).input(ls).output(pi({byTest:bi(Mo(),bi(Mo(),pi({status:Mo(),runId:Qo()}))),byBrowser:bi(Mo(),pi({passed:Qo(),failed:Qo(),total:Qo()}))})),Zl.route({method:"PUT",tags:["QA"],path:"/qa/document/{id}/browser-config",summary:"Update browser configuration",description:"Updates the default browser configuration for a QA flow"}).input($s.extend({id:Ui()})).output(fs),Zl.route({method:"POST",tags:["Internal"],path:"/migrate/prepare",summary:"Prepare database migration",description:"Validates migration requirements and prepares system for migration"}).input(hl).output(pi({message:Mo(),status:Mo(),data:hl})),Zl.route({method:"POST",tags:["Internal"],path:"/migrate/run",summary:"Execute database migration",description:"Runs migration scripts and updates database schema"}).input(ml).output(pi({message:Mo(),status:Mo(),data:ml})),Zl.route({method:"POST",tags:["Stripe"],path:"/stripe/trial",summary:"Create a trial subscription",description:"Creates a trial subscription for the authenticated workspace. The trial period is 30 days by default."}).input(bl).output(Cl),Zl.route({method:"POST",tags:["Stripe"],path:"/stripe/checkout",summary:"Create a checkout session for subscription purchase",description:"Creates a Stripe checkout session for purchasing a subscription. Returns a session URL for redirect."}).input(yl).output(_l),Zl.route({method:"POST",tags:["Stripe"],path:"/stripe/portal",summary:"Create a customer portal session",description:"Creates a Stripe billing portal session for managing subscription, payment methods, and invoices."}).input(wl).output(Sl),Zl.route({method:"POST",tags:["Stripe"],path:"/stripe/downgrade",summary:"Confirm and process a subscription downgrade",description:"Processes a confirmed subscription downgrade to a lower tier plan. No payment required."}).input(vl).output(xl),Zl.route({method:"POST",tags:["Stripe"],path:"/stripe/cancel",summary:"Cancel subscription at period end",description:"Cancels the subscription at the end of the current billing period."}).input(pi({subscriptionId:Mo().min(1)})).output(pi({subscriptionId:Mo(),cancelAtPeriodEnd:ni()})),Zl.route({method:"GET",tags:["Stripe"],path:"/stripe/catalog",summary:"Get public Stripe catalog (pricing, plans, config)",description:"Returns pricing from Stripe, plan catalog metadata, and Stripe frontend configuration in a single call."}).output(pi({pricing:Ml,plans:Nl,config:Rl})),Zl.route({method:"GET",tags:["Stripe"],path:"/stripe/subscription",summary:"Get current subscription plan and usage",description:"Returns current subscription plan information and actual usage statistics for the authenticated workspace."}).output(pi({plan:kl,usage:El})),Zl.route({method:"GET",tags:["Widget"],path:"/widget/stream",summary:"SSE stream for real-time widget events",description:"Typed event stream delivering tool calls, task status updates, chat responses, and registration confirmation."}).input(pi({chat_id:Mo(),tab_id:Mo().optional(),marketrix_id:Mo().optional(),marketrix_key:Mo().optional(),agent_id:Ui().optional(),application_id:Ui().optional()})).output(ql(Ba)),Zl.route({method:"POST",tags:["Widget"],path:"/widget/message",summary:"Send a typed command from widget to server",description:"Receives chat commands, tool responses, and keepalive pings from the widget."}).input(pi({chat_id:Mo(),command:Wa})).output(pi({ok:ni()})),Zl.route({method:"GET",tags:["App"],path:"/app/events",summary:"SSE stream for real-time app dashboard events",description:"Typed event stream delivering simulation, agent, QA, and user updates filtered by scope and application."}).input(pi({scopes:di(Ga).min(1),application_id:Ui().optional()})).output(ql(Ha)),Zl.route({method:"POST",tags:["Internal"],path:"/workos/webhook",summary:"WorkOS webhook receiver",description:"Receives webhook events from WorkOS (user management, SSO). Verified via workos-signature header. Not for external use."}).input(pi({event:Mo(),data:bi(Mo(),ii())})).output(pi({received:ni()})),Zl.route({method:"POST",tags:["Internal"],path:"/stripe/webhook",summary:"Stripe webhook receiver",description:"Receives webhook events from Stripe (payments, subscriptions). Verified via stripe-signature header. Not for external use."}).input(pi({id:Mo(),object:Mo(),type:Mo(),data:bi(Mo(),ii())}).passthrough().describe("Stripe event payload")).output(pi({received:ni()}));var Jl,Yl=null,Kl="";function Ql(e){return fe(new Le({url:e,headers:()=>{const e={};return Yl&&(e.Authorization=`Bearer ${Yl}`),e}}))}Jl=Ql("");var Xl=e=>{if(!e||""===e.trim())throw new Error("API URL is required for SDK configuration");e!==Kl&&(Kl=e,Jl=Ql(e))},ec={setAuthToken:e=>{Yl=e},clearAuthToken:()=>{Yl=null},getAuthToken:()=>Yl,configure:Xl},tc=new Proxy({},{get:(e,t)=>t in ec?ec[t]:Jl[t]}),nc=e=>e?.mtxApiHost?e.mtxApiHost:"";function rc(e,t="Unknown error"){return e instanceof Error?e.message:"string"==typeof e?e:t}function oc(e,t="Operation",n){const r=rc(e);return function(e){const t=e instanceof Error?e.message:String(e);return t.includes("Failed to fetch")||t.includes("ERR_CONNECTION_REFUSED")||t.includes("NetworkError")||t.includes("Network request failed")}(e)?{isValid:!1,error:`Cannot connect to API server. Please ensure the API server is running at ${nc(n)||"configured API server"}. Error: ${r}`}:{isValid:!1,error:`${t} failed: ${r}`}}var ic="undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname&&!window.location.hostname.includes("localhost")?"error":"debug",sc={debug:0,info:1,warn:2,error:3};function ac(e){return sc[e]>=sc[ic]}var lc=(e,t,...n)=>{ac("debug")},cc=(e,t,...n)=>{ac("info")},dc=(e,t,...n)=>{ac("warn")},uc=(e,t,...n)=>{ac("error")};function pc(e){return{debug:(t,...n)=>lc(e,t,...n),info:(t,...n)=>cc(e,t,...n),warn:(t,...n)=>dc(e,t,...n),error:(t,...n)=>uc(e,t,...n)}}pc("ErrorUtils");var hc=[{id:"navigate",name:"Navigate",description:"Navigate to a URL",displayAction:"Navigating",category:"navigation",actionType:"navigate"},{id:"search",name:"Search",description:"Search the web using a search engine",displayAction:"Searching",category:"navigation",actionType:"search"},{id:"click_element",name:"Click Element",description:"Click on an element by index or coordinates",displayAction:"Clicking element",category:"interaction",actionType:"click_element"},{id:"type_text",name:"Type Text",description:"Type text into an input field",displayAction:"Typing text",category:"interaction",actionType:"type_text"},{id:"scroll",name:"Scroll",description:"Scroll the page up or down",displayAction:"Scrolling",category:"interaction",actionType:"scroll"},{id:"scroll_to_text",name:"Scroll to Text",description:"Scroll until text is visible",displayAction:"Scrolling to text",category:"interaction",actionType:"scroll_to_text"},{id:"send_keys",name:"Send Keys",description:"Send keyboard keys or shortcuts",displayAction:"Pressing key",category:"interaction",actionType:"send_keys"},{id:"extract",name:"Extract",description:"Extract content from the page",displayAction:"Extracting content",category:"extraction",actionType:"extract"},{id:"get_dropdown_options",name:"Get Dropdown Options",description:"Get available options from a dropdown",displayAction:"Reading dropdown options",category:"extraction",actionType:"get_dropdown_options"},{id:"select_dropdown_option",name:"Select Dropdown Option",description:"Select an option from a dropdown",displayAction:"Selecting option",category:"interaction",actionType:"select_dropdown_option"},{id:"upload_file",name:"Upload File",description:"Upload a file to an input field",displayAction:"Uploading file",category:"interaction",actionType:"upload_file"},{id:"go_back",name:"Go Back",description:"Browser back button",displayAction:"Going back",category:"navigation",actionType:"go_back"},{id:"wait",name:"Wait",description:"Wait for a specified duration",displayAction:"Waiting",category:"utility",actionType:"wait"},{id:"switch_tab",name:"Switch Tab",description:"Switch to a different browser tab",displayAction:"Switching tab",category:"utility",actionType:"switch_tab"},{id:"close_tab",name:"Close Tab",description:"Close the current browser tab",displayAction:"Closing tab",category:"utility",actionType:"close_tab"},{id:"done",name:"Done",description:"Mark task as complete",displayAction:"Done",category:"utility",actionType:"done"},{id:"get_html",name:"Get HTML",description:"Get full page HTML with data-id attributes",displayAction:"Viewed your screen",category:"extraction",actionType:"get_html"},{id:"get_interactable_elements",name:"Get Interactable Elements",description:"Get list of interactable elements",displayAction:"Scanning elements",category:"extraction",actionType:"get_interactable_elements"},{id:"get_screenshot",name:"Get Screenshot",description:"Capture a screenshot of the page",displayAction:"Taking screenshot",category:"extraction",actionType:"get_screenshot"}];function mc(e){return e.includes("__THINKING__")}function fc(e){return mc(e)?e:`${e}\n\n__THINKING__`}function gc(e,t,n,r,o,i){if("agent"!==e.sender||e.isSystemMessage||e.isScreenAccessRequest)return!1;if(i&&t&&("show"===n||"do"===n))if(e.isPlaceholder){if(void 0!==e.mode&&e.mode!==n)return!1}else if(e.mode!==n)return!1;if(o){const t=e.content.trim().length>0,n=e.parts&&e.parts.length>0;if(!t&&!n)return!1}return!0}function yc(e){const{messages:t,isTaskRunning:n,currentMode:r,preferPlaceholder:o,requireContent:i}=e;let s=-1;if(n&&("show"===r||"do"===r)){const e=!0;for(let o=t.length-1;o>=0;o--){const a=t[o],l=gc(a,n,r,0,i,e),c=a.isPlaceholder,d=!i||a.content.trim().length>0||a.parts&&a.parts.length>0;if(l&&c&&d){s=o;break}}if(s<0&&!i)for(let o=t.length-1;o>=0;o--){const a=t[o],l=gc(a,n,r,0,i,e),c=a.isPlaceholder;if(l&&c){s=o;break}}if(s<0)for(let o=t.length-1;o>=0;o--){const a=t[o],l=gc(a,n,r,0,i,e),c=a.isPlaceholder;if(l&&!c){s=o;break}}}if(s<0){for(let e=t.length-1;e>=0;e--){const n=t[e],r="agent"===n.sender,o=n.isPlaceholder,a=!n.isSystemMessage,l=!n.isScreenAccessRequest,c=!i||n.content.trim().length>0||n.parts&&n.parts.length>0;if(r&&o&&a&&l&&c){s=e;break}}if(s<0&&!i)for(let e=t.length-1;e>=0;e--){const n=t[e];if("agent"===n.sender&&n.isPlaceholder&&!n.isSystemMessage&&!n.isScreenAccessRequest){s=e;break}}if(s<0&&(s=function(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if("agent"===n.sender&&!n.isSystemMessage&&!n.isScreenAccessRequest&&!n.isPlaceholder)return t}return-1}(t)),s<0)for(let e=t.length-1;e>=0;e--){const n=t[e];if("agent"===n.sender&&!n.isSystemMessage&&!n.isScreenAccessRequest){s=e;break}}}return s>=0?{index:s,message:t[s]}:null}function wc(e){const t={...e};if(!t.parts){t.parts=[];const e=t.content.replace(/\n\n__THINKING__$/,"").trim();e&&t.parts.push({type:"text",content:e})}return t}var bc=new Set(["click_element","type_text","send_keys","select_dropdown_option","upload_file","scroll"]);function vc(e){return e?e.replace(/\(Cancelled by cleanup\)/gi,"").replace(/\(cancelled by cleanup\)/gi,"").replace(/Cancelled by cleanup/gi,"").replace(/\s+/g," ").trim():e}function xc(e,t,n,r=!1){const o=wc(e);if(!t||"show"!==n&&"do"!==n)return mc(o.content)?{...o,content:o.content.replace(/\n\n__THINKING__$/,"").replace(/__THINKING__/g,""),placeholderState:void 0}:o;const i=r?"waiting-for-user":"thinking";return mc(o.content)?o.placeholderState!==i?{...o,placeholderState:i}:o:{...o,content:fc(o.content),placeholderState:i}}var kc=Object.fromEntries(hc.map(e=>[e.id,e.displayAction]));var _c="marketrix_chat_context",Sc={chat_id:null,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],currentMode:"tell",isOpen:!1,isMinimized:!1,isLoading:!1,config:null,timestamp:Date.now()},Cc=class e{static instance;context=null;constructor(){this.loadContext()}static getInstance(){return e.instance||(e.instance=new e),e.instance}loadContext(){if("undefined"==typeof window)return this.context={...Sc},this.context;try{const e=localStorage.getItem(_c);if(e){const t=JSON.parse(e);return Date.now()-t.timestamp>6048e5?(this.context={...Sc},this.saveContext(),this.context):(this.context=t,this.context)}}catch(e){}return this.context={...Sc},this.context}saveContext(){if("undefined"!=typeof window&&this.context)try{this.context.timestamp=Date.now(),localStorage.setItem(_c,JSON.stringify(this.context))}catch(e){}}getContext(){return this.context?this.context:this.loadContext()}updateContext(e){this.context||this.loadContext(),this.context={...this.context,...e},this.saveContext()}isValidChatId(e){return"string"==typeof e&&""!==e.trim()}getChatId(){if("undefined"!=typeof window&&this.isValidChatId(window.name)){const e=window.name;return e!==this.getContext().chat_id&&this.updateContext({chat_id:e}),e}return this.getContext().chat_id}setChatId(e){this.updateContext({chat_id:e}),"undefined"!=typeof window&&e&&(window.name=e,window.dispatchEvent(new CustomEvent("marketrix:chatid",{detail:{chatId:e}})))}getMessages(){return this.getContext().messages}setMessages(e){this.updateContext({messages:e})}getChatState(){const e=this.getContext();return{isTaskRunning:e.isTaskRunning,activeTaskId:e.activeTaskId,taskProgress:e.taskProgress,currentMode:e.currentMode,isOpen:e.isOpen,isMinimized:e.isMinimized,isLoading:e.isLoading}}setChatState(e){this.updateContext(e)}getConfig(){return this.getContext().config}setConfig(e){this.updateContext({config:e})}clear(){this.context={...Sc},"undefined"!=typeof window&&localStorage.removeItem(_c)}hasValidContext(){const e=this.getContext();return null!==e.chat_id&&e.chat_id.length>0}}.getInstance(),Ic=class e{static instance;messages=[];chatId=null;isTaskRunning=!1;activeTaskId=null;taskProgress=[];currentMode="tell";isOpen=!1;isMinimized=!1;isLoading=!1;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}initialize(e){this.chatId=e,this.restoreState()}createInitialContext(e){try{if(Cc.hasValidContext())return;Cc.updateContext({chat_id:e,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],currentMode:"tell",isOpen:!1,isMinimized:!1,isLoading:!1})}catch(t){}}getMessages(){return this.messages}getIsLoading(){return this.isLoading}getIsTaskRunning(){return this.isTaskRunning}getActiveTaskId(){return this.activeTaskId}getTaskProgress(){return this.taskProgress}getCurrentMode(){return this.currentMode}getIsOpen(){return this.isOpen}getIsMinimized(){return this.isMinimized}addMessage(e){this.messages=[...this.messages,e],this.persistState()}updateMessage(e,t){this.messages=this.messages.map(n=>n.id===e?{...n,...t}:n),this.persistState()}removeMessage(e){this.messages=this.messages.filter(t=>t.id!==e),this.persistState()}setMessages(e){this.messages=e,this.persistState()}clearMessages(){this.messages=[],this.persistState()}setTaskState(e,t,n){this.isTaskRunning=e,this.activeTaskId=t,this.taskProgress=n,this.persistState()}setMode(e){this.currentMode=e,this.persistState()}setWidgetState(e,t){this.isOpen=e,this.isMinimized=t,this.persistState()}setIsLoading(e){this.isLoading=e,this.persistState()}restoreState(){try{const e=Cc.getContext();if(!e.chat_id)return;this.chatId&&(e.chat_id,this.chatId),this.messages=e.messages.map(e=>{if(e.id.startsWith("screenshare-"))return{...e,content:"Screenshare ended",videoStream:void 0,isSystemMessage:!0,timestamp:new Date(e.timestamp),parts:[{type:"text",content:"Screenshare ended"}]};const t={...e,timestamp:new Date(e.timestamp),videoStream:void 0,placeholderState:e.placeholderState,taskStatus:e.taskStatus,parts:e.parts||[]};if(0===t.parts?.length&&t.content){const e=t.content.replace(/\n\n__THINKING__$/,"").trim();e&&t.parts&&t.parts.push({type:"text",content:e})}return t}),this.isTaskRunning=e.isTaskRunning,this.activeTaskId=e.activeTaskId,this.taskProgress=e.taskProgress,this.currentMode=e.currentMode,this.isOpen=e.isOpen,this.isMinimized=e.isMinimized,this.isLoading=e.isLoading??!1}catch(e){}}persistState(){if(this.chatId)try{const e=this.messages.filter(e=>!e.isPlaceholder||("thinking"===e.placeholderState||"waiting-for-user"===e.placeholderState||(e.parts||[]).length>0)).filter(e=>!(e.isSystemMessage&&"Chat context changed"===e.content)).map(e=>{return{id:e.id,content:(t=e.content,t.replace(/__THINKING__/g,"")),sender:e.sender,timestamp:e.timestamp.toISOString(),mode:e.mode,isScreenAccessRequest:e.isScreenAccessRequest,screenShareStatus:e.screenShareStatus,isSystemMessage:e.isSystemMessage,isPlaceholder:e.isPlaceholder,placeholderState:e.placeholderState,taskStatus:e.taskStatus,parts:e.parts};var t});Cc.updateContext({chat_id:this.chatId,messages:e,isTaskRunning:this.isTaskRunning,activeTaskId:this.activeTaskId,taskProgress:this.taskProgress,currentMode:this.currentMode,isOpen:this.isOpen,isMinimized:this.isMinimized,isLoading:this.isLoading})}catch(e){}}}.getInstance();function Ec(e,t,n="user-message"){const r=[],o=e.trim();return o&&r.push({type:"text",content:o}),{id:`${n}-${Date.now()}`,content:o,sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,parts:r}}function Tc(e,t,n,r="agent-message"){const o=[],i=e.trim();return i&&o.push({type:"text",content:i}),{id:n||`${r}-${Date.now()}`,content:e,sender:"agent",timestamp:/* @__PURE__ */new Date,mode:t,parts:o}}function Ac(e,t,n="agent",r="system-message"){const o=[];return e&&o.push({type:"text",content:e}),{id:`${r}-${Date.now()}`,content:e,sender:n,timestamp:/* @__PURE__ */new Date,mode:t,isSystemMessage:!0,parts:o}}function Mc(e="show"){const t="Started screenshare";return{id:`started-screenshare-${Date.now()}`,content:t,sender:"user",timestamp:/* @__PURE__ */new Date,mode:e,isSystemMessage:!0,parts:[{type:"text",content:t}]}}function Oc(e,t="show"){return{id:`screenshare-${Date.now()}`,content:"",sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,videoStream:e,parts:[]}}var Nc=pc("ChatIdManager"),Rc=class e{static instance=null;chatId=null;initializationPromise=null;constructor(){"undefined"!=typeof window&&"undefined"!=typeof document&&(this.chatId=this.getStoredChatId(),this.chatId&&Nc.debug("Loaded existing chat ID from storage:",this.chatId))}static getInstance(){return"undefined"==typeof window||"undefined"==typeof document?(e.instance||(e.instance=Object.create(e.prototype),e.instance.chatId=null,e.instance.initializationPromise=null),e.instance):(e.instance||(e.instance=new e),e.instance)}getChatId(){return this.chatId}async getOrCreateChatId(){if(this.chatId)return Nc.debug("Returning existing chat ID:",this.chatId),this.chatId;if(this.initializationPromise)return Nc.debug("Chat ID initialization in progress, waiting..."),this.initializationPromise;const e=this.getStoredChatId();if(e)return this.chatId=e,Nc.debug("Found chat ID in storage:",this.chatId),this.chatId;this.initializationPromise=this.createChatId();try{return await this.initializationPromise}finally{this.initializationPromise=null}}async createChatId(){try{Nc.info("Creating new chat ID...");const e=await tc.chatCreate(void 0);if(!e)throw new Error("API returned empty chat ID");return this.chatId=e,this.storeChatId(e),Nc.info("Created and stored new chat ID:",this.chatId),Ic.createInitialContext(e),e}catch(e){throw Nc.error("Failed to create chat ID:",e),this.initializationPromise=null,e}}clearChatId(){this.chatId=null,this.initializationPromise=null,Nc.debug("Cleared chat ID")}static resetInstance(){e.instance=null}getStoredChatId(){return Cc.getChatId()}storeChatId(e){Cc.setChatId(e)}}.getInstance(),zc=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;config;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}addCallbacks(e){this.callbacks.add(e)}removeCallbacks(e){this.callbacks.delete(e)}getStatus(){return this.status}isConnected(){return"registered"===this.status}async connect(e,t){if(this.isIntentionallyDisconnected&&(this.isIntentionallyDisconnected=!1),this.isConnected()&&this.chatId===e)return;this.abortController&&(this.abortController.abort(),this.abortController=null),this.chatId=e,t&&(this.config=t),this.setStatus("connecting"),this.abortController=new AbortController;const n=this.abortController.signal;try{const t={chat_id:e};this.config?.mtxId&&this.config?.mtxKey?(t.marketrix_id=this.config.mtxId,t.marketrix_key=this.config.mtxKey):this.config?.mtxAgent&&this.config?.mtxApp&&(t.agent_id=this.config.mtxAgent,t.application_id=this.config.mtxApp);const r=await tc.widgetStream(t,{signal:n});this.setStatus("connected"),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.consumeEvents(r,e)}catch(r){n.aborted||(this.setStatus("error"),this.notifyError(/* @__PURE__ */new Error("Stream connection failed")),this.scheduleReconnect())}}async consumeEvents(e,t){try{for await(const n of e){if(this.chatId!==t)break;this.handleMessage(n)}}catch(n){this.isIntentionallyDisconnected||this.setStatus("error")}finally{this.isIntentionallyDisconnected||this.chatId!==t||(this.setStatus("disconnected"),this.scheduleReconnect())}}disconnect(){this.isIntentionallyDisconnected=!0,this.clearReconnectTimer(),this.abortController&&(this.abortController.abort(),this.abortController=null),this.setStatus("disconnected"),this.chatId=null}send(e){this.chatId&&tc.widgetMessage({chat_id:this.chatId,command:e}).catch(e=>{this.notifyError(/* @__PURE__ */new Error(`Failed to send message: ${String(e)}`))})}setStatus(e){this.status!==e&&(this.status=e,this.callbacks.forEach(t=>t.onStatusChange?.(e)))}notifyError(e){this.callbacks.forEach(t=>t.onError?.(e))}handleMessage(e){"heartbeat"!==e.type&&("registered"===e.type&&e.chat_id===this.chatId&&(this.setStatus("registered"),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.callbacks.forEach(t=>t.onRegistered?.(e.application_id))),"chat/error"===e.type&&"auth"===e.request_id&&(this.isIntentionallyDisconnected=!0),this.callbacks.forEach(t=>t.onMessage?.(e)))}scheduleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return void this.notifyError(/* @__PURE__ */new Error("Max reconnect attempts reached"));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,this.config).catch(console.error)},e)}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}},Pc=class{config;constructor(e){this.config=e}getChatId(){return Rc.getChatId()}async getOrCreateChatId(){return Rc.getOrCreateChatId()}getUserId(){if(this.config.userId&&"number"==typeof this.config.userId)return this.config.userId;try{const e=localStorage.getItem("marketrix_user_id");if(e){const t=Number(e);if(!isNaN(t))return t}}catch(e){}try{const e=sessionStorage.getItem("marketrix_user_id");if(e){const t=Number(e);if(!isNaN(t))return t}}catch(e){}return null}async logWidgetQuestion(e,t){try{const n=this.getUserId(),r={question:e,mode:t,chat_id:this.getChatId(),timestamp:/* @__PURE__ */(new Date).toISOString()};null!==n&&(r.user_id=n),this.config.mtxApp&&(r.application_id=this.config.mtxApp),this.config.mtxId&&this.config.mtxKey&&(r.marketrix_id=this.config.mtxId,r.marketrix_key=this.config.mtxKey),tc.activityLogCreate({type:"widget_question",metadata:r}).catch(e=>{})}catch(n){}}async sendMessage(e){if(!(await Rc.getOrCreateChatId()))throw new Error("Failed to initialize chat session");const t=e.mode||"tell";if(e.message&&await this.logWidgetQuestion(e.message,t),!(this.config.mtxId&&this.config.mtxKey||this.config.mtxApp&&this.config.mtxAgent))throw new Error("Either mtxId + mtxKey or both mtxApp + mtxAgent are required");const n=e.requestId||`req_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,r={type:`chat/${t}`,request_id:n,content:e.message||""};return zc.getInstance().send(r),{messageId:n,response:"",mode:t,timestamp:/* @__PURE__ */new Date}}async checkAgentAvailability(){try{return null!==Rc.getChatId()}catch(e){return!1}}async getAgentInfo(){return{available:!0,status:"online"}}async stopTask(e){return zc.getInstance().send({type:"chat/stop",...e&&{task_id:e}}),{status:"stopping",message:"Stop command sent"}}updateConfig(e){this.config={...this.config,...e}}},Lc=class e{static instance;config=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}loadConfig(){const e=Cc.getConfig();return e?(this.config=e,e):(this.config={},this.config)}saveConfig(e){Cc.setConfig(e),this.config=e}updateConfig(e){this.config||(this.config={}),this.config={...this.config,...e},this.saveConfig(this.config)}getConfig(){return this.config}shouldShowWidget(){return!!this.config&&(this.config.widget_enabled??!1)}}.getInstance();function Dc(e,t={}){return{...t,...e}}function $c(e,t){return"object"==typeof e&&null!==e&&t in e}function jc(e){return null!==e&&e instanceof HTMLElement}function Fc(e){return null!==e&&e instanceof HTMLScriptElement}var Uc=b(()=>{});function Bc(e){if(!(e&&e instanceof Element))return!1;try{const n=e.tagName.toLowerCase(),r="button"===n;if(!(r||"input"===n||"textarea"===n||"select"===n||"a"===n&&e.hasAttribute("href")||"button"===e.getAttribute("role")||"link"===e.getAttribute("role")||"textbox"===e.getAttribute("role")||"checkbox"===e.getAttribute("role")||"radio"===e.getAttribute("role")||"switch"===e.getAttribute("role")||"tab"===e.getAttribute("role")||"menuitem"===e.getAttribute("role")||"true"===e.getAttribute("contenteditable")||e.hasAttribute("onclick")||e.hasAttribute("tabindex")&&parseInt(e.getAttribute("tabindex")||"-1",10)>=0))return!1;const o=(t,n)=>{if(r){e.tagName,e.id,e.className}};if(!0===e.disabled)return o("disabled","button is disabled"),!1;if("true"===e.getAttribute("aria-disabled"))return o("aria-disabled","aria-disabled is true"),!1;try{let t=e;for(;t;){if(t instanceof HTMLElement&&t.inert)return o("inert","ancestor is inert"),!1;const e=t instanceof Element?t.getRootNode():null;t=t instanceof Element?t.parentElement||(e instanceof ShadowRoot?e.host:null):null}}catch(t){}const i=e.hasAttribute("onclick");if(r&&i)return!0;let s,a;try{s=window.getComputedStyle(e)}catch(t){return o("computed-style","failed to get computed style"),!1}if("none"===s.display)return o("display","display is none"),!1;if("none"===s.pointerEvents)return o("pointer-events","pointer-events is none"),!1;try{a=e.getBoundingClientRect()}catch(t){return o("bounding-rect","failed to get bounding rect"),!1}if(a.width<=0||a.height<=0)return o("dimensions",`width=${a.width}, height=${a.height}`),!1;try{let t=e;for(;t&&t!==document.body;){const e=t.getRootNode(),n=t.parentElement||(e instanceof ShadowRoot?e.host:null);if(!n)break;let i,s;try{i=window.getComputedStyle(n),s=n.getBoundingClientRect()}catch{t=n;continue}if("hidden"===i.overflow||"clip"===i.overflow){const e=a.right<s.left||a.left>s.right||a.bottom<s.top||a.top>s.bottom;if(r){if(e)return o("overflow-clipping","completely outside parent bounds"),!1}else if(e)return!1}t=n}}catch(t){}try{let t=e.getRootNode();for(;t instanceof ShadowRoot;){const e=t.host;let n;try{n=e.getBoundingClientRect()}catch{break}if(n.width<=0||n.height<=0)return!1;t=e.getRootNode()}}catch(t){}return!0}catch(t){return!1}}var Wc,Gc,Hc,Zc=b(()=>{Vc()}),Vc=b(()=>{Zc(),Wc=class e{static instance;elementMap=/* @__PURE__ */new Map;elementToSequence=/* @__PURE__ */new WeakMap;selectorMap=/* @__PURE__ */new Map;fingerprintMap=/* @__PURE__ */new Map;isIndexed=!1;indexingInProgress=!1;indexVersion=0;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}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(" > ")}generateFingerprint(e,t){return{tagName:e.tagName,id:e.id||null,textContent:((e,t=100)=>{if(!e)return null;const n=e.trim().replace(/\s+/g," ");return n.length>t?n.slice(0,t):n})(e.textContent),type:e.getAttribute("type"),role:e.getAttribute("role"),ariaLabel:e.getAttribute("aria-label"),name:e.getAttribute("name"),href:e.getAttribute("href"),selector:t,indexVersion:this.indexVersion}}matchesFingerprint(e,t){return e.tagName===t.tagName&&(!(!t.id||e.id!==t.id)||(!t.type||e.getAttribute("type")===t.type)&&((!t.ariaLabel||e.getAttribute("aria-label")===t.ariaLabel)&&((!t.role||e.getAttribute("role")===t.role)&&((!t.href||"A"!==t.tagName||e.getAttribute("href")===t.href)&&(!t.name||e.getAttribute("name")===t.name)))))}validateElementAtIndex(e){const t=this.fingerprintMap.get(e);if(!t)return{isValid:!0};const n=this.elementMap.get(e);return n&&document.contains(n)?n instanceof HTMLElement&&!this.matchesFingerprint(n,t)?{isValid:!1,mismatchReason:"element_changed"}:{isValid:!0}:{isValid:!1,mismatchReason:"element_removed"}}exportState(){return{selectors:Array.from(this.selectorMap.entries()),fingerprints:Array.from(this.fingerprintMap.entries())}}importState(e){if(e)try{e.selectors&&(this.selectorMap=new Map(e.selectors)),e.fingerprints&&(this.fingerprintMap=new Map(e.fingerprints)),(this.selectorMap.size>0||this.fingerprintMap.size>0)&&(this.isIndexed=!0)}catch(t){}}indexInteractableElements(){if(this.indexingInProgress)return[];try{this.indexingInProgress=!0,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;const r=[];for(;t;){if(t instanceof HTMLElement){const e=t.matches('a[href], button, input, textarea, select, [role="button"]'),o=t.classList.contains("cursor-pointer")||t.classList.contains("clickable"),i="onclick"in t&&"function"==typeof t.onclick;if(e||o||i||Bc(t)){this.elementMap.set(n,t),this.elementToSequence.set(t,n);const e=this.generateSelector(t);this.selectorMap.set(n,e);const o=this.generateFingerprint(t,e);this.fingerprintMap.set(n,o),r.push([n,t]),n++}}t=e.nextNode()}return this.isIndexed=!0,this.indexVersion++,r}finally{this.indexingInProgress=!1}}getElementCoordinates(e){const t=e.getBoundingClientRect(),n=this.calculateGlobalZOrder(e);return{x:Math.round(t.left),y:Math.round(t.top),w:Math.round(t.width),h:Math.round(t.height),z:n}}isStackingContext(e){const t=window.getComputedStyle(e),n=t.position;if(("fixed"===n||"absolute"===n||"relative"===n||"sticky"===n)&&"auto"!==t.zIndex)return!0;if("auto"!==t.zIndex&&e.parentElement){const t=window.getComputedStyle(e.parentElement).display;if("flex"===t||"inline-flex"===t||"grid"===t||"inline-grid"===t)return!0}const r=parseFloat(t.opacity);if(!isNaN(r)&&r<1)return!0;if(t.transform&&"none"!==t.transform)return!0;if(t.filter&&"none"!==t.filter)return!0;const o=t.willChange;if(o&&(o.includes("transform")||o.includes("opacity")))return!0;if("isolate"===t.isolation)return!0;const i=t.contain;return!(!i||!(i.includes("layout")||i.includes("style")||i.includes("paint")))}calculateGlobalZOrder(e){let t=e;const n=[];for(;t&&t!==document.body&&t.parentElement;){const e=window.getComputedStyle(t);if(this.isStackingContext(t)){let r=0;if("auto"!==e.zIndex){const t=parseInt(e.zIndex,10);isNaN(t)||(r=t)}let o=0;t.parentElement&&(o=Array.from(t.parentElement.children).indexOf(t)),n.push({element:t,zIndex:r,domOrder:o})}t=t.parentElement}let r=1e6;for(let o=n.length-1;o>=0;o--){const e=n[o];r+=1e4*e.zIndex+e.domOrder}if(e.parentElement){r+=Array.from(e.parentElement.children).indexOf(e)}return r}getSnapshotHtml(){this.indexInteractableElements();const e=document.documentElement.cloneNode(!0);for(const[n,r]of this.elementMap.entries())if(r instanceof HTMLElement){const o=this.selectorMap.get(n);if(o)try{const t=(e.querySelector("body")||e).querySelector(o);if(t)if(t.setAttribute("data-id",n.toString()),"none"===window.getComputedStyle(r).display)t.setAttribute("data-x","0"),t.setAttribute("data-y","0"),t.setAttribute("data-w","0"),t.setAttribute("data-h","0"),t.setAttribute("data-z","0");else{const e=this.getElementCoordinates(r);t.setAttribute("data-x",e.x.toString()),t.setAttribute("data-y",e.y.toString()),t.setAttribute("data-w",e.w.toString()),t.setAttribute("data-h",e.h.toString()),t.setAttribute("data-z",e.z.toString())}}catch(t){}}return e.outerHTML}getInteractableElements(){this.indexInteractableElements();const e=[];for(const[t,n]of this.elementMap.entries())if(n instanceof HTMLElement){const r=this.fingerprintMap.get(t);r&&e.push({index:t,fingerprint:r,coords:this.getElementCoordinates(n),cssClasses:Array.from(n.classList)})}return e}getElementByDataId(e){return this.elementMap.get(e)}getSequenceForElement(e){return this.elementToSequence.get(e)}isIndexActive(){return this.isIndexed}clearIndex(){this.elementMap.clear(),this.elementToSequence=/* @__PURE__ */new WeakMap,this.fingerprintMap.clear(),this.isIndexed=!1}checkInteractability(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}checkElementInteractable(e,t){return this.checkInteractability(e,t)}getElementByIndex(e){let t=null;if(this.elementMap.has(e)){const n=this.elementMap.get(e);n&&n instanceof HTMLElement&&(t=n)}if(!t&&this.selectorMap.has(e)){const n=this.selectorMap.get(e);if(n)try{const e=document.querySelector(n);e&&e instanceof HTMLElement&&(t=e)}catch(r){}}if(!t)return{element:null,error:`Element ${e} not found`};const n=this.checkInteractability(t,e);return n?{element:null,error:n}:{element:t}}getValidatedElement(e){const t=this.validateElementAtIndex(e);if(!t.isValid)return{element:null,validation:t,error:`DOM_CHANGED: Element at index ${e} ${"element_removed"===t.mismatchReason?"no longer exists":"has changed"}. Call get_html to get updated indices.`};const n=this.elementMap.get(e);if(!n)return{element:null,validation:t,error:`Element ${e} not found`};const r=this.checkInteractability(n,e);return r?{element:null,validation:t,error:r}:{element:n,validation:t}}getFingerprint(e){return this.fingerprintMap.get(e)}getAllFingerprints(){return Array.from(this.fingerprintMap.entries())}getIndexVersion(){return this.indexVersion}},Gc=Wc.getInstance()});async function qc(){if(Hc?.active){const e=Hc.getVideoTracks();if(e.length>0&&"live"===e[0].readyState)return Hc}const e=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,preferCurrentTab:!0});if(!e||0===e.getVideoTracks().length)throw new Error("Screen sharing permission denied or no video track available");return Hc=e,e.getVideoTracks()[0].addEventListener("ended",()=>{Hc=null}),e}function Jc(){return null!==function(){if(Hc?.active){const e=Hc.getVideoTracks();if(e.length>0&&"live"===e[0].readyState)return Hc}return Hc=null,null}()}var Yc,Kc,Qc,Xc,ed=b(()=>{Hc=null}),td=b(()=>{Vc(),Yc=class e{static instance;currentPopup=null;currentHighlight=null;currentElement=null;currentOptions=null;currentPromise=null;resolvePromise=null;rejectPromise=null;clickHandler=null;scrollHandler=null;updateHighlightPosition=null;rafId=null;mutationObserver=null;visibilityCheckInterval=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}async showToolAction(e){const{element:t,explanation:n,isClickAction:r=!1,toolName:o}=e;return this.currentOptions?.element===t&&this.currentOptions.explanation===n&&this.currentOptions.toolName===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.setupElementMonitoring(),this.setupVisibilityMonitoring(),r&&this.setupClickHandler(),this.currentPromise=new Promise((e,t)=>{this.resolvePromise=e,this.rejectPromise=t}).finally(()=>{this.cleanup()})),this.currentPromise}cleanup(){this.rejectPromise&&(this.rejectPromise("Cancelled by cleanup"),this.rejectPromise=null),this.resolvePromise=null,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,{capture:!0}),this.clickHandler=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,{capture:!0}),window.removeEventListener("resize",this.scrollHandler),window.removeEventListener("touchmove",this.scrollHandler),window.removeEventListener("wheel",this.scrollHandler),this.scrollHandler=null),null!==this.rafId&&(window.cancelAnimationFrame(this.rafId),this.rafId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.visibilityCheckInterval&&(clearInterval(this.visibilityCheckInterval),this.visibilityCheckInterval=null),this.updateHighlightPosition=null,this.currentPopup&&(this.currentPopup.remove(),this.currentPopup=null),this.currentHighlight&&(this.currentHighlight.remove(),this.currentHighlight=null);const e=document.getElementById("marketrix-show-popup");e&&e.remove();const t=document.getElementById("marketrix-show-highlight");t&&t.remove(),this.currentElement=null,this.currentOptions=null,this.currentPromise=null,this.resolvePromise=null,this.rejectPromise=null}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>`,document.body.appendChild(n),this.currentPopup=n,t||this.setupContinueButton(n),this.updatePopupPosition()}setupPositionUpdates(){this.updateHighlightPosition=()=>{if(!this.currentElement||!this.currentHighlight)return;const e=this.currentElement.getBoundingClientRect();this.currentHighlight.style.top=`${e.top}px`,this.currentHighlight.style.left=`${e.left}px`,this.currentHighlight.style.width=`${e.width}px`,this.currentHighlight.style.height=`${e.height}px`,this.updatePopupPosition()},this.scrollHandler=()=>{null!==this.rafId&&window.cancelAnimationFrame(this.rafId),this.updateHighlightPosition?.()},window.addEventListener("scroll",this.scrollHandler,{capture:!0,passive:!0}),window.addEventListener("resize",this.scrollHandler,{passive:!0}),window.addEventListener("touchmove",this.scrollHandler,{passive:!0}),window.addEventListener("wheel",this.scrollHandler,{passive:!0})}updatePopupPosition(){if(!this.currentPopup||!this.currentElement)return;const e=this.currentElement.getBoundingClientRect(),t=320,n=120,r=10,o=e.left+e.width/2,i=e.top+e.height/2,s=[{left:e.right+20,top:i-60},{left:e.left-t-20,top:i-60},{left:o-160,top:e.top-n-20},{left:o-160,top:e.bottom+20}];let a=s[0];for(const d of s)if(d.left>=r&&d.left+t<=window.innerWidth-r&&d.top>=r&&d.top+n<=window.innerHeight-r){a=d;break}const l=Math.max(r,Math.min(a.left,window.innerWidth-t-r)),c=Math.max(r,Math.min(a.top,window.innerHeight-n-r));this.currentPopup.style.cssText+=`\n position: fixed;\n top: ${c}px;\n left: ${l}px;\n width: 320px;\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n z-index: 2147483646;\n padding: 16px;\n `}setupClickHandler(){this.clickHandler=e=>{if(this.currentElement&&this.resolvePromise&&e.composedPath().includes(this.currentElement)){e.preventDefault(),e.stopPropagation();const t=this.resolvePromise;this.resolvePromise=null,this.rejectPromise=null,t(!0)}},document.addEventListener("click",this.clickHandler,{capture:!0})}setupContinueButton(e){window.requestAnimationFrame(()=>{const t=e.querySelector("#marketrix-show-continue");t&&t.addEventListener("click",e=>{if(e.stopPropagation(),this.resolvePromise){const e=this.resolvePromise;this.resolvePromise=null,this.rejectPromise=null,e(!0)}})})}setupElementMonitoring(){this.currentElement&&(this.mutationObserver=new MutationObserver(()=>{this.currentElement&&!document.body.contains(this.currentElement)&&this.failWithElementGone("Element was removed from DOM")}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0}))}setupVisibilityMonitoring(){this.visibilityCheckInterval=setInterval(()=>{if(!this.currentElement)return;const e=Gc.getSequenceForElement(this.currentElement)??-1,t=Gc.checkElementInteractable(this.currentElement,e);t&&this.failWithElementGone(t)},200)}failWithElementGone(e){if(this.rejectPromise){const t=this.rejectPromise;this.rejectPromise=null,this.resolvePromise=null,t(/* @__PURE__ */new Error(`ELEMENT_GONE: ${e}`))}this.cleanup()}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}},Kc=Yc.getInstance()}),nd=b(()=>{Vc(),ed(),td(),Qc=class e{static instance;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}async executeTool(e,t,n="do",r=""){try{if("show"===n&&this.requiresHighlight(e)){const n=t.index;if(void 0!==n){const{element:t,error:o}=Gc.getElementByIndex(n);if(!t)return{success:!1,data:{text:""},error:o||`Element ${n} not found`};if(!(await Kc.showToolAction({element:t,explanation:r||`Execute ${e}`,toolName:e,isClickAction:"click_element"===e})))return{success:!1,data:{text:""},error:"User cancelled action"}}}switch(e){case"navigate":return this.navigate(t);case"search":return this.search(t);case"click_element":return await this.clickElement(t);case"type_text":return this.typeText(t);case"scroll":return this.scroll(t);case"scroll_to_text":return this.scrollToText(t);case"extract":return this.extract(t);case"go_back":return this.goBack();case"wait":return await this.wait(t);case"select_dropdown_option":return this.selectDropdownOption(t);case"get_dropdown_options":return this.getDropdownOptions(t);case"send_keys":return this.sendKeys(t);case"upload_file":return this.uploadFile(t);case"close_tab":return this.closeTab();case"switch_tab":return this.switchTab(t);case"done":return this.done(t);case"get_html":return this.getHtml();case"get_interactable_elements":return this.getInteractableElements();case"get_screenshot":return await this.getScreenshot();default:return{success:!1,data:{text:""},error:`Unknown tool: ${e}`}}}catch(o){return Kc.cleanup(),{success:!1,data:{text:""},error:o instanceof Error?o.message:String(o)}}}requiresHighlight(e){return["click_element","type_text","select_dropdown_option","send_keys","upload_file"].includes(e)}navigate(e){return e.url?e.new_tab?(window.open(e.url,"_blank"),{success:!0,data:{text:`Opened ${e.url} in new tab`}}):(window.location.href=e.url,{success:!0,data:{text:`Navigating to ${e.url}`}}):{success:!1,data:{text:""},error:"URL is required"}}search(e){if(!e.query)return{success:!1,data:{text:""},error:"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,{success:!0,data:{text:`Searching for "${e.query}" on ${t}`}}}async clickElement(e){if(void 0===e.index)return{success:!1,data:{text:""},error:"Index required"};const{element:t,error:n}=Gc.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),{success:!0,data:{text:`Clicked element ${e.index}`}}):{success:!1,data:{text:""},error:n||`Element ${e.index} not found`}}typeText(e){if(void 0===e.index||void 0===e.text)return{success:!1,data:{text:""},error:"Index and text required"};const t=!1!==e.clear,{element:n,error:r}=Gc.getValidatedElement(e.index);if(!n)return{success:!1,data:{text:""},error: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=!1,a=null;if(!s)try{const e="TEXTAREA"===r.tagName.toUpperCase()?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(e,"value");t?.set&&(t.set.call(r,i),s=!0)}catch(o){a=o}if(!s)try{r.value=i,s=!0}catch(o){a=o}if(!s)try{r.focus(),t&&r.select(),document.execCommand("insertText",!1,e.text)&&(s=!0)}catch(o){a=o}if(!s)try{r.focus(),t&&(r.value="");for(const t of e.text)r.dispatchEvent(new KeyboardEvent("keydown",{key:t,bubbles:!0,cancelable:!0})),r.value+=t,r.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:t})),r.dispatchEvent(new KeyboardEvent("keyup",{key:t,bubbles:!0,cancelable:!0}));s=!0}catch(o){a=o}if(!s)return{success:!1,data:{text:""},error:`Failed to set value: ${a instanceof Error?a.message:String(a)}`};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{success:!1,data:{text:""},error:`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{success:!1,data:{text:""},error:`Failed to set textContent: ${o instanceof Error?o.message:String(o)}`}}return{success:!0,data:{text:`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{success:!1,data:{text:""},error:"Invalid direction"}}return{success:!0,data:{text:`Scrolled ${e.direction}`}}}scrollToText(e){if(!e.text)return{success:!1,data:{text:""},error:"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"}),{success:!0,data:{text:`Scrolled to "${e.text}"`}};return{success:!1,data:{text:""},error:`Text "${e.text}" not found`}}extract(e){const t=e.start_from_char??0,n=!1!==e.extract_links,r=document.body.innerText;return{success:!0,data:{title:document.title,url:window.location.href,text:r.slice(t,t+1e4),links:n?Array.from(document.querySelectorAll("a[href]")).slice(0,100).map(e=>({text:e.textContent?.trim()||"",href:e.getAttribute("href")})):[]}}}goBack(){return window.history.length>1?(window.history.back(),{success:!0,data:{text:"Navigated back"}}):{success:!1,data:{text:""},error:"No history"}}async wait(e){return void 0===e.seconds?{success:!1,data:{text:""},error:"Seconds required"}:(await new Promise(t=>setTimeout(t,1e3*e.seconds)),{success:!0,data:{text:`Waited ${e.seconds}s`}})}selectDropdownOption(e){if(void 0===e.index||!e.option)return{success:!1,data:{text:""},error:"Index/Option required"};const{element:t,error:n}=Gc.getValidatedElement(e.index);if(!t)return{success:!1,data:{text:""},error:n||`Select ${e.index} not found`};if(!(t instanceof HTMLSelectElement))return{success:!1,data:{text:""},error:`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})),{success:!0,data:{text:`Selected ${e.option}`}}):{success:!1,data:{text:""},error:`Option ${e.option} not found`}}getDropdownOptions(e){const t=e.index,{element:n,error:r}=Gc.getValidatedElement(t);return n?n instanceof HTMLSelectElement?{success:!0,data:{options:Array.from(n.options).map(e=>({value:e.value,text:e.text}))}}:{success:!1,data:{options:[]},error:`Element ${t} is not a select element`}:{success:!1,data:{options:[]},error:r||`Select ${t} not found`}}sendKeys(e){if(void 0===e.index||!e.keys)return{success:!1,data:{text:""},error:"Index/Keys required"};const{element:t,error:n}=Gc.getValidatedElement(e.index);return t?(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})),{success:!0,data:{text:this.simulateKeyAction(t,e.keys)||`Sent keys ${e.keys}`}}):{success:!1,data:{text:""},error:n||`Element ${e.index} not found`}}simulateKeyAction(e,t){switch(t){case"Tab":{const t=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),n=t.indexOf(e);if(-1!==n&&n<t.length-1){const e=t[n+1];return e.focus(),`Tab: moved focus to ${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}`}return"Tab: no next focusable element"}case"Shift+Tab":{const t=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),n=t.indexOf(e);if(n>0){const e=t[n-1];return e.focus(),`Shift+Tab: moved focus to ${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}`}return"Shift+Tab: no 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}const s=Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;return s?s.call(e,n):e.value=n,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),e.setSelectionRange(r,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)}const i=Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;return i?i.call(e,o):e.value=o,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),e.setSelectionRange(t,t),`Delete: deleted character, value is now "${o}"`}return"Delete: dispatched event";default:return null}}uploadFile(e){return{success:!1,data:{text:""},error:"File upload not supported via script"}}closeTab(){return window.close(),{success:!0,data:{text:"Attempted close"}}}switchTab(e){return e.tab_id?{success:!1,data:{text:""},error:"Tab switching not supported"}:{success:!1,data:{text:""},error:"tab_id is required"}}done(e){return void 0===e.success?{success:!1,data:{text:""},error:"success parameter is required"}:{success:!0,data:{text:e.message||(e.success?"Task completed":"Task failed")}}}getHtml(){try{return{success:!0,data:{text:Gc.getSnapshotHtml()}}}catch(e){return{success:!1,data:{text:""},error:String(e)}}}getInteractableElements(){try{return{success:!0,data:{elements:Gc.getInteractableElements()}}}catch(e){return{success:!1,data:{elements:[]},error:String(e)}}}async getScreenshot(){try{const e=await qc();if(!e)return{success:!1,data:{text:""},error:"Failed to get stream"};const 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(),{success:!0,data:{text:r}}}catch(e){return{success:!1,data:{text:""},error:String(e)}}}},Xc=Qc.getInstance()});nd();var rd=n(void 0),od=({children:e,previewMode:t=!1})=>{const n=p(0),r=p(/* @__PURE__ */new Set),o=p(!1),i=s(e=>{if(r.current.add(e),r.current.size>1e3){const e=Array.from(r.current).slice(-500);r.current=new Set(e)}},[]),a=p(null),c=p(!1),[d,m]=h({isOpen:!1,isMinimized:!1,isLoading:!1,messages:[],currentMode:"tell",agentAvailable:!1,activeTaskId:null,isTaskRunning:!1,taskProgress:[],activeView:"home"});l(()=>{if(t)return;(async()=>{const e=await Rc.getOrCreateChatId();Ic.createInitialContext(e),Ic.initialize(e);const t=Ic.getIsTaskRunning();if(o.current=t,m(e=>({...e,messages:Ic.getMessages(),isLoading:Ic.getIsLoading(),isTaskRunning:t,activeTaskId:Ic.getActiveTaskId(),taskProgress:Ic.getTaskProgress(),currentMode:Ic.getCurrentMode(),isOpen:Ic.getIsOpen(),isMinimized:Ic.getIsMinimized()})),e){const t=zc.getInstance(),n=Lc.getConfig();t.connect(e,n?{mtxId:n.mtxId,mtxKey:n.mtxKey,mtxAgent:n.mtxAgent,mtxApp:n.mtxApp}:void 0).catch(e=>{})}})()},[t]);const f=s((e,t,n,r)=>{m(o=>{const i=function(e){return kc[e]?kc[e]:e.replace(/([A-Z])/g," $1").replace(/_/g," ").trim().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}(e),s=yc({messages:o.messages,isTaskRunning:o.isTaskRunning,currentMode:o.currentMode,preferPlaceholder:!0,requireContent:"failed"===n});if(!s)return o;let a=s.message;const l=["click_element","type_text","select_dropdown_option","send_keys","upload_file"].includes(e),c=o.isTaskRunning&&"show"===o.currentMode&&l,d="done"===e;"running"===n?(d||(a=function(e,t,n){const r=wc(e),o=r.parts||[],i=[...o],s=o.findIndex(e=>"progress"===e.type&&e.toolName===t&&"running"===e.status),a=!bc.has(t),l="default",c=vc(n);return s>=0?i[s]={...i[s],content:c,hideIcon:a,textStyle:l}:i.push({type:"progress",content:c,status:"running",toolName:t,hideIcon:a,textStyle:l}),{...r,parts:i}}(a,i,t||i)),!o.isTaskRunning||"show"!==o.currentMode&&"do"!==o.currentMode||(a=xc(a,o.isTaskRunning,o.currentMode,c))):"completed"===n?(d||(a=function(e,t){const n=wc(e),r=n.parts||[],o=[...r];let i=-1;if(t)i=r.map(e=>"progress"===e.type?e.toolName:"").lastIndexOf(t);else for(let s=r.length-1;s>=0;s--)if("progress"===r[s].type&&"running"===r[s].status){i=s;break}return i>=0&&(o[i]={...o[i],status:"completed"}),{...n,parts:o}}(a)),!o.isTaskRunning||"show"!==o.currentMode&&"do"!==o.currentMode||(a=xc(a,o.isTaskRunning,o.currentMode,!1))):(a=function(e,t,n){const r=wc(e),o=r.parts||[],i=n.toLowerCase().includes("cancelled by cleanup"),s=[...o];let a=o.map(e=>"progress"===e.type?e.toolName:"").lastIndexOf(t);if(-1===a)for(let l=o.length-1;l>=0;l--)if("progress"===o[l].type&&"running"===o[l].status){a=l;break}if(a>=0)if(i){const e=vc(s[a].content);s[a]={...s[a],status:"completed",content:e}}else{const e=vc(n),t=vc(s[a].content);s[a]={...s[a],status:"failed",content:e?`${t} (${e})`:t}}return{...r,parts:s}}(a,i,r||""),!o.isTaskRunning||"show"!==o.currentMode&&"do"!==o.currentMode||(a=xc(a,o.isTaskRunning,o.currentMode,!1)));const u=[...o.messages];return u[s.index]=a,Ic.setMessages(u),{...o,messages:u}})},[]);l(()=>{if(t)return;const e=zc.getInstance(),s={onStatusChange:e=>{m(t=>({...t,agentAvailable:"registered"===e}))},onMessage:async t=>{if("tool/call"===t.type){const l=t.call_id;if(r.current.has(l))return;if(i(l),!hc.map(e=>e.id).includes(t.tool))return void e.send({type:"tool/response",call_id:l,success:!1,error:`Unknown tool: ${t.tool}`,state_version:n.current});if(!o.current)return void e.send({type:"tool/response",call_id:l,success:!1,error:"widget_task_inactive",state_version:n.current});const u=t.tool,p=t.args,h=t.mode||d.currentMode||"do",g=t.explanation||"",y=t.state_version;if(void 0!==y&&y!==n.current)return void e.send({type:"tool/response",call_id:l,success:!1,error:"State version mismatch",state_version:n.current});f(u,g,"running");const w=await Xc.executeTool(u,p,h,g);if(w.success)try{n.current++,e.send({type:"tool/response",call_id:l,success:!0,data:"string"==typeof w.data?w.data:JSON.stringify(w.data),state_version:n.current}),f(u,g,"completed"),"done"===u&&(a.current=null,c.current=!1,m(e=>{Ic.setTaskState(!1,null,[]),o.current=!1;const t=yc({messages:e.messages,isTaskRunning:e.isTaskRunning,currentMode:e.currentMode,preferPlaceholder:!0,requireContent:!1}),n=[...e.messages];if(t){const e=t.message.parts?.filter(e=>!("progress"===e.type&&"done"===e.toolName))||[];n[t.index]={...t.message,taskStatus:"done",parts:e},Ic.setMessages(n)}return{...e,messages:n,isTaskRunning:!1,activeTaskId:null,taskProgress:[]}}))}catch(s){f(u,g,"failed","Connection error")}else{n.current++;try{e.send({type:"tool/response",call_id:l,success:!1,data:"string"==typeof w.data?w.data:JSON.stringify(w.data),error:w.error??void 0,state_version:n.current})}catch(s){}}}else if("task/status"===t.type){const e=t.status,n=t.message||"";if("started"===e){const e=t.task_id||null;c.current=!0;const n=a.current||e;n&&m(e=>(Ic.setTaskState(!0,n,[]),o.current=!0,{...e,isTaskRunning:!0,activeTaskId:n,taskProgress:[]}))}else"completed"!==e&&"failed"!==e&&"stopped"!==e||(r.current.clear(),a.current=null,c.current=!1,m(t=>{Ic.setTaskState(!1,null,[]);const r=yc({messages:t.messages,isTaskRunning:t.isTaskRunning,currentMode:t.currentMode,preferPlaceholder:!0,requireContent:!1}),i=[...t.messages];if(r){let t="done";"failed"===e?t="failed":"stopped"===e&&(t="stopped"),i[r.index]={...r.message,taskStatus:t,...n&&{content:n}},Ic.setMessages(i)}return o.current=!1,{...t,messages:i,isTaskRunning:!1,activeTaskId:null,taskProgress:[]}}))}else"chat/response"===t.type?m(e=>{const n=e.messages.map(e=>{if(e.id===t.request_id){const n=[...e.parts||[],{type:"text",content:t.text}];return{...e,content:t.text,isPlaceholder:!1,placeholderState:void 0,parts:n,...t.task_id&&{taskId:t.task_id}}}return e});return Ic.setMessages(n),t.task_id&&(a.current=t.task_id,c.current)?(Ic.setTaskState(!0,t.task_id,[]),o.current=!0,{...e,messages:n,isTaskRunning:!0,activeTaskId:t.task_id,taskProgress:[]}):{...e,messages:n,isLoading:!1}}):"chat/error"===t.type&&m(e=>{const n=e.messages.map(e=>{if(e.id===t.request_id){const n=`Error: ${t.error}`,r=[...e.parts||[],{type:"text",content:n}];return{...e,content:n,isPlaceholder:!1,placeholderState:void 0,parts:r}}return e});return Ic.setMessages(n),{...e,messages:n,isLoading:!1}})},onError:e=>{m(t=>({...t,error:e.message}))}};return e.addCallbacks(s),()=>{e.removeCallbacks(s)}},[f,t]);const y=s(e=>{m(t=>(Ic.setTaskState(e.isTaskRunning,e.activeTaskId,e.taskProgress||[]),{...t,...e}))},[]),w=s(()=>{Ic.clearMessages(),a.current=null,c.current=!1,o.current=!1,m(e=>({...e,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],error:void 0}))},[]),b=s(e=>{m(t=>(Ic.addMessage(e),{...t,messages:[...t.messages,e]}))},[]),v=s(async(e,n,r,o,i)=>{if(t)return i||b(Ec(e,n||d.currentMode)),void b(Tc("This is a preview. In production, I'll respond to your messages here."));let s=Lc.getConfig();if(s||(s=Lc.loadConfig()),!s||!s.mtxId&&!s.mtxKey&&!s.mtxAgent)return void b(Tc("Configuration error: Missing API credentials. Please check your widget settings."));i||b(Ec(e,n||d.currentMode));const a=`temp-${Date.now()}`,l={id:a,content:"",sender:"agent",timestamp:/* @__PURE__ */new Date,mode:n||d.currentMode,isPlaceholder:!0,placeholderState:"thinking",parts:[]};l.content=fc(""),b(l),m(e=>({...e,isLoading:!0}));const c=new Pc(s);try{r&&c.updateConfig({mtxApp:r});const t=c.getChatId();if(t){const e=zc.getInstance();if(!e.isConnected()){const n=Lc.getConfig();e.connect(t,n?{mtxId:n.mtxId,mtxKey:n.mtxKey,mtxAgent:n.mtxAgent,mtxApp:n.mtxApp}:void 0).catch(e=>{})}}await c.sendMessage({message:e,mode:n||d.currentMode,question:o,requestId:a})}catch(u){m(e=>{const t=e.messages.map(e=>{if(e.id===a){const t="I'm sorry, I encountered an error processing your request. Please try again.",n=[...e.parts||[],{type:"text",content:t}];return{...e,isPlaceholder:!1,parts:n,content:t}}return e});return Ic.setMessages(t),{...e,messages:t}})}finally{m(e=>({...e,isLoading:!1}))}},[d.currentMode,b,y,d,t]),x=u(()=>({setState:e=>m(t=>({...t,...e})),setActiveView:e=>m(t=>({...t,activeView:e})),toggleWidget:()=>m(e=>{const t={...e,isOpen:!e.isOpen,isMinimized:!!e.isOpen};return Ic.setWidgetState(t.isOpen,t.isMinimized),t}),closeWidget:()=>m(e=>{const t={...e,isOpen:!1,isMinimized:!0};return Ic.setWidgetState(t.isOpen,t.isMinimized),t}),setMode:e=>m(t=>(Ic.setMode(e),{...t,currentMode:e})),setLoading:e=>{Ic.setIsLoading(e),m(t=>({...t,isLoading:e}))},setAgentAvailable:e=>m(t=>({...t,agentAvailable:e})),setError:e=>m(t=>({...t,error:e})),clearError:()=>m(e=>({...e,error:void 0})),setTaskState:y,addMessage:b,updateMessage:(e,t)=>m(n=>(Ic.updateMessage(e,t),{...n,messages:n.messages.map(n=>n.id===e?{...n,...t}:n)})),removeMessage:e=>m(t=>(Ic.removeMessage(e),{...t,messages:t.messages.filter(t=>t.id!==e)})),setMessages:e=>m(t=>(Ic.setMessages(e),{...t,messages:e})),resetState:w,stopTask:async()=>{const e=d.activeTaskId||o.current?d.activeTaskId??void 0:void 0;if(m(e=>{const n=yc({messages:e.messages,isTaskRunning:e.isTaskRunning,currentMode:e.currentMode,preferPlaceholder:!0,requireContent:!1}),r=[...e.messages];return n&&(r[n.index]={...n.message,taskStatus:"stopped"},t||Ic.setMessages(r)),t||Ic.setTaskState(!1,null,[]),o.current=!1,{...e,messages:r,isTaskRunning:!1,activeTaskId:null,taskProgress:[]}}),!t)try{zc.getInstance().send({type:"chat/stop",...e&&{task_id:e}})}catch(n){}},clearChatHistory:w,sendMessage:v}),[d.currentMode,y,w,b,v,t]);/* @__PURE__ */
|
|
3
|
-
return g(rd.Provider,{value:{state:d,actions:x},children:e})};var id=({config:e}={})=>{const{state:t,actions:n}=(()=>{const e=a(rd);if(void 0===e)throw new Error("useWidgetContext must be used within a WidgetProvider");return e})(),r=u(()=>e||{},[e]),o=function(e){return Object.keys(Oa.shape).every(t=>void 0!==e[t])}(r);l(()=>{o&&Lc.saveConfig(r)},[r,o]);const i=s(()=>o&&!0===r.widget_enabled,[r,o]),c=r.isPreviewMode??!1;return{state:t,config:r,actions:n,shouldShow:i(),isPreviewMode:c,configValid:o}};function sd(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 ad(e){return function(e){const t=sd(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 ld(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=sd(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`:(e.includes("gradient")||e.includes("linear-gradient"),e)}function cd(e,t){const n=sd(e);if(!n)return e;const r=1-t;return o=Math.round(n.r*r),i=Math.round(n.g*r),s=Math.round(n.b*r),`#${[o,i,s].map(e=>e.toString(16).padStart(2,"0")).join("")}`;var o,i,s}var dd=e=>e?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):/* @__PURE__ */(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),ud=e=>{switch(e){case"show":return"Show";case"tell":return"Tell";case"do":return"Do";default:return e}},pd="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%3c!--%20Generator:%20Adobe%20Illustrator%2030.1.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%20136)%20--%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",hd=20,md=(e,t,n,r,o)=>{switch(e){case"top_left":return{x:hd,y:hd};case"top_right":return{x:t-hd-r,y:hd};case"bottom_left":return{x:hd,y:n-hd-o};default:return{x:t-hd-r,y:n-hd-o}}},fd=(e,t,n,r,o,i)=>{const s=md(e,n,r,o,i),a=s.x+o/2,l=s.y+i/2;let c,d;switch(t){case"top_left":c=hd+o/2,d=hd+i/2;break;case"top_right":c=n-hd-o/2,d=hd+i/2;break;case"bottom_left":c=hd+o/2,d=r-hd-i/2;break;default:c=n-hd-o/2,d=r-hd-i/2}return{dx:c-a,dy:d-l}};function gd(e){return"undefined"!=typeof window&&(e instanceof HTMLElement||e instanceof function(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}(e).HTMLElement)}var yd={};function wd(t,n){const r=e.useRef(yd);return r.current===yd&&(r.current=t(n)),r}var bd=e[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],vd=bd&&bd!==e.useLayoutEffect?bd:e=>e();function xd(e){const t=wd(kd).current;return t.next=e,vd(t.effect),t.trampoline}function kd(){const e={next:void 0,callback:_d,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function _d(){}var Sd="undefined"!=typeof document?e.useLayoutEffect:()=>{};function Cd(e,t){return e&&!t?e:!e&&t?t:e||t?{...e,...t}:void 0}var Id={};function Ed(e,t,n,r,o){let i={...Od(e,Id)};return t&&(i=Td(i,t)),n&&(i=Td(i,n)),r&&(i=Td(i,r)),o&&(i=Td(i,o)),i}function Td(e,t){return Md(t)?t(e):function(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":e[n]=Cd(e.style,r);break;case"className":e[n]=zd(e.className,r);break;default:Ad(n,r)?e[n]=Nd(e[n],r):e[n]=r}}return e}(e,t)}function Ad(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 Md(e){return"function"==typeof e}function Od(e,t){return Md(e)?e(t):e??Id}function Nd(e,t){return t?e?n=>{if(function(e){return null!=e&&"object"==typeof e&&"nativeEvent"in e}(n)){const r=n;Rd(r);const o=t(r);return r.baseUIHandlerPrevented||e?.(r),o}const r=t(n);return e?.(n),r}:t:e}function Rd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function zd(e,t){return t?e?t+" "+e:t:e}var Pd,Ld,Dd=(Pd="https://base-ui.com/production-error",Ld="Base UI",function(e,...t){const n=new URL(Pd);return n.searchParams.set("code",e.toString()),t.forEach(e=>n.searchParams.append("args[]",e)),`${Ld} error #${e}; visit ${n} for the full message.`}),$d=/* @__PURE__ */e.createContext(void 0);function jd(t={}){const{disabled:n=!1,focusableWhenDisabled:r,tabIndex:o=0,native:i=!0,composite:s}=t,a=e.useRef(null),l=function(t=!1){const n=e.useContext($d);if(void 0===n&&!t)throw new Error(Dd(16));return n}(!0),c=s??void 0!==l,{props:d}=function(t){const{focusableWhenDisabled:n,disabled:r,composite:o=!1,tabIndex:i=0,isNativeButton:s}=t,a=o&&!1!==n,l=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&&!l||(e.disabled=r),e},[o,r,n,a,l,s,i])}}({focusableWhenDisabled:r,disabled:n,composite:c,tabIndex:o,isNativeButton:i}),u=e.useCallback(()=>{const e=a.current;Fd(e)&&c&&n&&void 0===d.disabled&&e.disabled&&(e.disabled=!1)},[n,d.disabled,c]);return Sd(u,[u]),{getButtonProps:e.useCallback((e={})=>{const{onClick:t,onMouseDown:r,onKeyUp:o,onKeyDown:s,onPointerDown:a,...l}=e;return Ed({type:i?"button":void 0,onClick(e){n?e.preventDefault():t?.(e)},onMouseDown(e){n||r?.(e)},onKeyDown(e){if(n)return;if(Rd(e),s?.(e),e.baseUIHandlerPrevented)return;const r=e.target===e.currentTarget,o=e.currentTarget,a=Fd(o),l=!i&&(d=o,Boolean("A"===d?.tagName&&d?.href));var d;const u=r&&(i?a:!l),p="Enter"===e.key,h=" "===e.key,m=o.getAttribute("role"),f=m?.startsWith("menuitem")||"option"===m||"gridcell"===m;if(r&&c&&h){if(e.defaultPrevented&&f)return;return e.preventDefault(),void(l||i&&a?(o.click(),e.preventBaseUIHandler()):u&&(t?.(e),e.preventBaseUIHandler()))}u&&(i||!h&&!p||e.preventDefault(),!i&&p&&t?.(e))},onKeyUp(e){n||(Rd(e),o?.(e),e.target===e.currentTarget&&i&&c&&Fd(e.currentTarget)&&" "===e.key?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||" "!==e.key||t?.(e))},onPointerDown(e){n?e.preventDefault():a?.(e)}},i?void 0:{role:"button"},d,l)},[n,d,c,i]),buttonRef:xd(e=>{a.current=e,u()})}}function Fd(e){return gd(e)&&"BUTTON"===e.tagName}function Ud(e,t,n,r){const o=wd(Bd).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)&&Wd(o,[e,t,n,r]),o.callback}function Bd(){return{callback:null,cleanup:null,refs:[]}}function Wd(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 Gd=parseInt(e.version,10);function Hd(t){if(!/* @__PURE__ */e.isValidElement(t))return null;const n=t,r=n.props;return(Gd>=19?r?.ref:n.ref)??null}Object.freeze([]);var Zd=Object.freeze({});function Vd(t,n,o={}){const i=n.render,s=function(e,t={}){const{className:n,style:r,render:o}=e,{state:i=Zd,ref:s,props:a,stateAttributesMapping:l,enabled:c=!0}=t,d=c?function(e,t){return"function"==typeof e?e(t):e}(n,i):void 0,u=c?function(e,t){return"function"==typeof e?e(t):e}(r,i):void 0,p=c?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,l):Zd,h=c?Cd(p,Array.isArray(a)?function(e){if(0===e.length)return Id;if(1===e.length)return Od(e[0],Id);let t={...Od(e[0],Id)};for(let n=1;n<e.length;n+=1)t=Td(t,e[n]);return t}(a):a)??Zd:Zd;"undefined"!=typeof document&&(c?Array.isArray(s)?h.ref=function(e){const t=wd(Bd).current;return function(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}(t,e)&&Wd(t,e),t.callback}([h.ref,Hd(o),...s]):h.ref=Ud(h.ref,Hd(o),s):Ud(null,null));if(!c)return Zd;void 0!==d&&(h.className=zd(h.className,d));void 0!==u&&(h.style=Cd(h.style,u));return h}(n,o);return!1===o.enabled?null:function(t,n,o,i){if(n){if("function"==typeof n)return n(o,i);const t=Ed(o,n.props);t.ref=o.ref;let r=n;return r?.$$typeof===qd&&(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(Dd(8))}(t,i,s,o.state??Zd)}var qd=Symbol.for("react.lazy");var Jd=/* @__PURE__ */e.forwardRef(function(e,t){const{render:n,className:r,disabled:o=!1,focusableWhenDisabled:i=!1,nativeButton:s=!0,...a}=e,{getButtonProps:l,buttonRef:c}=jd({disabled:o,focusableWhenDisabled:i,native:s});return Vd("button",e,{state:{disabled:o},ref:[t,c],props:[a,l]})}),Yd=(e=/* @__PURE__ */new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Kd="-",Qd=[],Xd=e=>{const t=nu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return tu(e);const n=e.split(Kd);return eu(n,""===n[0]&&n.length>1?1:0,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||Qd}return n[e]||Qd}}},eu=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const r=e[t],o=n.nextPart.get(r);if(o){const n=eu(e,t+1,o);if(n)return n}const i=n.validators;if(null===i)return;const s=0===t?e.join(Kd):e.slice(t).join(Kd),a=i.length;for(let l=0;l<a;l++){const e=i[l];if(e.validator(s))return e.classGroupId}},tu=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})(),nu=e=>{const{theme:t,classGroups:n}=e;return ru(n,t)},ru=(e,t)=>{const n=Yd();for(const r in e){const o=e[r];ou(o,n,r,t)}return n},ou=(e,t,n,r)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];iu(o,t,n,r)}},iu=(e,t,n,r)=>{"string"!=typeof e?"function"!=typeof e?lu(e,t,n,r):au(e,t,n,r):su(e,t,n)},su=(e,t,n)=>{(""===e?t:cu(t,e)).classGroupId=n},au=(e,t,n,r)=>{du(e)?ou(e(r),t,n,r):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(n,e)))},lu=(e,t,n,r)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];ou(i,cu(t,e),n,r)}},cu=(e,t)=>{let n=e;const r=t.split(Kd),o=r.length;for(let i=0;i<o;i++){const e=r[i];let t=n.nextPart.get(e);t||(t=Yd(),n.nextPart.set(e,t)),n=t}return n},du=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,uu=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)}}},pu=[],hu=(e,t,n,r,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:o}),mu=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 l=a,c=!1;a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0);return hu(t,c,l,n&&n>i?n-i:void 0)};if(t){const e=t+":",n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):hu(pu,!1,t,void 0,!0)}if(n){const e=r;r=t=>n({className:t,parseClassName:e})}return r},fu=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}},gu=/\s+/,yu=e=>{if("string"==typeof e)return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=yu(e[r]))&&(n&&(n+=" "),n+=t);return n},wu=(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}=t,s=[],a=e.trim().split(gu);let l="";for(let c=a.length-1;c>=0;c-=1){const e=a[c],{isExternal:t,modifiers:d,hasImportantModifier:u,baseClassName:p,maybePostfixModifierPosition:h}=n(e);if(t){l=e+(l.length>0?" "+l:l);continue}let m=!!h,f=r(m?p.substring(0,h):p);if(!f){if(!m){l=e+(l.length>0?" "+l:l);continue}if(f=r(p),!f){l=e+(l.length>0?" "+l:l);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:i(d).join(":"),y=u?g+"!":g,w=y+f;if(s.indexOf(w)>-1)continue;s.push(w);const b=o(f,m);for(let n=0;n<b.length;++n){const e=b[n];s.push(y+e)}l=e+(l.length>0?" "+l:l)}return l})(e,n);return o(e,i),i};return i=a=>(n=(e=>({cache:uu(e.cacheSize),parseClassName:mu(e),sortModifiers:fu(e),...Xd(e)}))(t.reduce((e,t)=>t(e),e())),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=yu(t))&&(o&&(o+=" "),o+=n);return o})(...e))},bu=[],vu=e=>{const t=t=>t[e]||bu;return t.isThemeGetter=!0,t},xu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ku=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_u=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Su=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cu=/\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$/,Iu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Eu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Au=e=>_u.test(e),Mu=e=>!!e&&!Number.isNaN(Number(e)),Ou=e=>!!e&&Number.isInteger(Number(e)),Nu=e=>e.endsWith("%")&&Mu(e.slice(0,-1)),Ru=e=>Su.test(e),zu=()=>!0,Pu=e=>Cu.test(e)&&!Iu.test(e),Lu=()=>!1,Du=e=>Eu.test(e),$u=e=>Tu.test(e),ju=e=>!Uu(e)&&!Ju(e),Fu=e=>rp(e,ap,Lu),Uu=e=>xu.test(e),Bu=e=>rp(e,lp,Pu),Wu=e=>rp(e,cp,Mu),Gu=e=>rp(e,up,zu),Hu=e=>rp(e,dp,Lu),Zu=e=>rp(e,ip,Lu),Vu=e=>rp(e,sp,$u),qu=e=>rp(e,pp,Du),Ju=e=>ku.test(e),Yu=e=>op(e,lp),Ku=e=>op(e,dp),Qu=e=>op(e,ip),Xu=e=>op(e,ap),ep=e=>op(e,sp),tp=e=>op(e,pp,!0),np=e=>op(e,up,!0),rp=(e,t,n)=>{const r=xu.exec(e);return!!r&&(r[1]?t(r[1]):n(r[2]))},op=(e,t,n=!1)=>{const r=ku.exec(e);return!!r&&(r[1]?t(r[1]):n)},ip=e=>"position"===e||"percentage"===e,sp=e=>"image"===e||"url"===e,ap=e=>"length"===e||"size"===e||"bg-size"===e,lp=e=>"length"===e,cp=e=>"number"===e,dp=e=>"family-name"===e,up=e=>"number"===e||"weight"===e,pp=e=>"shadow"===e,hp=/* @__PURE__ */wu(()=>{const e=vu("color"),t=vu("font"),n=vu("text"),r=vu("font-weight"),o=vu("tracking"),i=vu("leading"),s=vu("breakpoint"),a=vu("container"),l=vu("spacing"),c=vu("radius"),d=vu("shadow"),u=vu("inset-shadow"),p=vu("text-shadow"),h=vu("drop-shadow"),m=vu("blur"),f=vu("perspective"),g=vu("aspect"),y=vu("ease"),w=vu("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ju,Uu],v=()=>[Ju,Uu,l],x=()=>[Au,"full","auto",...v()],k=()=>[Ou,"none","subgrid",Ju,Uu],_=()=>["auto",{span:["full",Ou,Ju,Uu]},Ou,Ju,Uu],S=()=>[Ou,"auto",Ju,Uu],C=()=>["auto","min","max","fr",Ju,Uu],I=()=>["auto",...v()],E=()=>[Au,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...v()],T=()=>[Au,"screen","full","dvw","lvw","svw","min","max","fit",...v()],A=()=>[Au,"screen","full","lh","dvh","lvh","svh","min","max","fit",...v()],M=()=>[e,Ju,Uu],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Qu,Zu,{position:[Ju,Uu]}],N=()=>["auto","cover","contain",Xu,Fu,{size:[Ju,Uu]}],R=()=>[Nu,Yu,Bu],z=()=>["","none","full",c,Ju,Uu],P=()=>["",Mu,Yu,Bu],L=()=>[Mu,Nu,Qu,Zu],D=()=>["","none",m,Ju,Uu],$=()=>["none",Mu,Ju,Uu],j=()=>["none",Mu,Ju,Uu],F=()=>[Mu,Ju,Uu],U=()=>[Au,"full",...v()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ru],breakpoint:[Ru],color:[zu],container:[Ru],"drop-shadow":[Ru],ease:["in","out","in-out"],font:[ju],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ru],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ru],shadow:[Ru],spacing:["px",Mu],text:[Ru],"text-shadow":[Ru],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Au,Uu,Ju,g]}],container:["container"],columns:[{columns:[Mu,Uu,Ju,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:b()}],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:[Ou,"auto",Ju,Uu]}],basis:[{basis:[Au,"full","auto",a,...v()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mu,Au,"auto","initial","none",Uu]}],grow:[{grow:["",Mu,Ju,Uu]}],shrink:[{shrink:["",Mu,Ju,Uu]}],order:[{order:[Ou,"first","last","none",Ju,Uu]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:_()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:_()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":C()}],"auto-rows":[{"auto-rows":C()}],gap:[{gap:v()}],"gap-x":[{"gap-x":v()}],"gap-y":[{"gap-y":v()}],"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:v()}],px:[{px:v()}],py:[{py:v()}],ps:[{ps:v()}],pe:[{pe:v()}],pbs:[{pbs:v()}],pbe:[{pbe:v()}],pt:[{pt:v()}],pr:[{pr:v()}],pb:[{pb:v()}],pl:[{pl:v()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":v()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":v()}],"space-y-reverse":["space-y-reverse"],size:[{size:E()}],"inline-size":[{inline:["auto",...T()]}],"min-inline-size":[{"min-inline":["auto",...T()]}],"max-inline-size":[{"max-inline":["none",...T()]}],"block-size":[{block:["auto",...A()]}],"min-block-size":[{"min-block":["auto",...A()]}],"max-block-size":[{"max-block":["none",...A()]}],w:[{w:[a,"screen",...E()]}],"min-w":[{"min-w":[a,"screen","none",...E()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...E()]}],h:[{h:["screen","lh",...E()]}],"min-h":[{"min-h":["screen","lh","none",...E()]}],"max-h":[{"max-h":["screen","lh",...E()]}],"font-size":[{text:["base",n,Yu,Bu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,np,Gu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Nu,Uu]}],"font-family":[{font:[Ku,Hu,t]}],"font-features":[{"font-features":[Uu]}],"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,Ju,Uu]}],"line-clamp":[{"line-clamp":[Mu,"none",Ju,Wu]}],leading:[{leading:[i,...v()]}],"list-image":[{"list-image":["none",Ju,Uu]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ju,Uu]}],"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:[Mu,"from-font","auto",Ju,Bu]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Mu,"auto",Ju,Uu]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:v()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ju,Uu]}],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",Ju,Uu]}],"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:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ou,Ju,Uu],radial:["",Ju,Uu],conic:[Ou,Ju,Uu]},ep,Vu]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"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":[Mu,Ju,Uu]}],"outline-w":[{outline:["",Mu,Yu,Bu]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,tp,qu]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",u,tp,qu]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Mu,Bu]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,tp,qu]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Mu,Ju,Uu]}],"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":[Mu]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"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":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"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":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"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":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"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":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"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":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"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":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ju,Uu]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"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":[Mu]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"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:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ju,Uu]}],filter:[{filter:["","none",Ju,Uu]}],blur:[{blur:D()}],brightness:[{brightness:[Mu,Ju,Uu]}],contrast:[{contrast:[Mu,Ju,Uu]}],"drop-shadow":[{"drop-shadow":["","none",h,tp,qu]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Mu,Ju,Uu]}],"hue-rotate":[{"hue-rotate":[Mu,Ju,Uu]}],invert:[{invert:["",Mu,Ju,Uu]}],saturate:[{saturate:[Mu,Ju,Uu]}],sepia:[{sepia:["",Mu,Ju,Uu]}],"backdrop-filter":[{"backdrop-filter":["","none",Ju,Uu]}],"backdrop-blur":[{"backdrop-blur":D()}],"backdrop-brightness":[{"backdrop-brightness":[Mu,Ju,Uu]}],"backdrop-contrast":[{"backdrop-contrast":[Mu,Ju,Uu]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mu,Ju,Uu]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mu,Ju,Uu]}],"backdrop-invert":[{"backdrop-invert":["",Mu,Ju,Uu]}],"backdrop-opacity":[{"backdrop-opacity":[Mu,Ju,Uu]}],"backdrop-saturate":[{"backdrop-saturate":[Mu,Ju,Uu]}],"backdrop-sepia":[{"backdrop-sepia":["",Mu,Ju,Uu]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":v()}],"border-spacing-x":[{"border-spacing-x":v()}],"border-spacing-y":[{"border-spacing-y":v()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ju,Uu]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mu,"initial",Ju,Uu]}],ease:[{ease:["linear","initial",y,Ju,Uu]}],delay:[{delay:[Mu,Ju,Uu]}],animate:[{animate:["none",w,Ju,Uu]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,Ju,Uu]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:$()}],"rotate-x":[{"rotate-x":$()}],"rotate-y":[{"rotate-y":$()}],"rotate-z":[{"rotate-z":$()}],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:[Ju,Uu,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"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"],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",Ju,Uu]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":v()}],"scroll-mx":[{"scroll-mx":v()}],"scroll-my":[{"scroll-my":v()}],"scroll-ms":[{"scroll-ms":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-mbs":[{"scroll-mbs":v()}],"scroll-mbe":[{"scroll-mbe":v()}],"scroll-mt":[{"scroll-mt":v()}],"scroll-mr":[{"scroll-mr":v()}],"scroll-mb":[{"scroll-mb":v()}],"scroll-ml":[{"scroll-ml":v()}],"scroll-p":[{"scroll-p":v()}],"scroll-px":[{"scroll-px":v()}],"scroll-py":[{"scroll-py":v()}],"scroll-ps":[{"scroll-ps":v()}],"scroll-pe":[{"scroll-pe":v()}],"scroll-pbs":[{"scroll-pbs":v()}],"scroll-pbe":[{"scroll-pbe":v()}],"scroll-pt":[{"scroll-pt":v()}],"scroll-pr":[{"scroll-pr":v()}],"scroll-pb":[{"scroll-pb":v()}],"scroll-pl":[{"scroll-pl":v()}],"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",Ju,Uu]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Mu,Yu,Bu,Wu]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function mp(...e){return hp(e.filter(Boolean).join(" "))}var fp={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",danger:"bg-destructive text-destructive-foreground border-transparent hover:bg-destructive/90"},gp={sm:"px-2 py-1 text-xs min-h-7",md:"px-4 py-2 text-sm min-h-9",lg:"px-6 py-3 text-base min-h-11"},yp=o(function({className:e,disabled:t,loading:n=!1,size:r="md",type:o="button",variant:i="primary",...s},a){const l=t||n;/* @__PURE__ */
|
|
4
|
-
return g(Jd,{...s,ref:a,"aria-busy":
|
|
5
|
-
return y("div",{ref:_,className:`${
|
|
6
|
-
/* @__PURE__ */g(yp,{type:"button",variant:"primary",onClick:()=>{Date.now()<
|
|
7
|
-
/* @__PURE__ */g("div",{className:"absolute inset-0 flex items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:
|
|
8
|
-
/* @__PURE__ */g("div",{className:"absolute inset-0 flex items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:
|
|
9
|
-
return g(
|
|
10
|
-
return g("
|
|
11
|
-
return g("
|
|
12
|
-
return g("
|
|
13
|
-
return g(
|
|
14
|
-
return y("div",{className:
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import*as e from"react";import t,{createContext as r,createElement as n,forwardRef as o,lazy as i,useCallback as s,useContext as a,useEffect as l,useId as c,useLayoutEffect as d,useMemo as u,useRef as p,useState as h}from"react";import{createRoot as m}from"react-dom/client";import{Fragment as f,jsx as g,jsxs as y}from"react/jsx-runtime";var w=Object.defineProperty,b=(e,t)=>()=>(e&&(t=e(e=0)),t),v=(e,t)=>{let r={};for(var n in e)w(r,n,{get:e[n],enumerable:!0});return t||w(r,Symbol.toStringTag,{value:"Module"}),r},x=2147483002,k=2147483001,_=2147483005;function S(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 C(e){return function(e){const t=S(e);if(!t)return.5;const[r,n,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*r+.7152*n+.0722*o}(e)>.5?"#000000":"#ffffff"}function I(e,t){if(e.startsWith("rgba")||e.startsWith("rgb")){const r=e.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);if(r)return`rgba(${r[1]}, ${r[2]}, ${r[3]}, ${t})`}const r=S(e);return r?`rgba(${r.r}, ${r.g}, ${r.b}, ${t})`:(e.includes("gradient")||e.includes("linear-gradient"),e)}function E(e,t){const r=S(e);if(!r)return e;const n=1-t;return o=Math.round(r.r*n),i=Math.round(r.g*n),s=Math.round(r.b*n),`#${[o,i,s].map(e=>e.toString(16).padStart(2,"0")).join("")}`;var o,i,s}var T=e=>e?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):/* @__PURE__ */(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),A=e=>{switch(e){case"show":return"Show";case"tell":return"Tell";case"do":return"Do";default:return e}},M={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_font_size:"14px",widget_width:"400px",widget_height:"600px",widget_shadow:"0 5px 40px 0 rgba(0, 0, 0, 0.3)",widget_animation_duration:"300ms",widget_fade_duration:"200ms"};function O(e){return{color:{background:e.widget_background_color,foreground:e.widget_text_color,foregroundMuted:I(e.widget_text_color,.6),foregroundFaint:I(e.widget_text_color,.4),border:e.widget_border_color,borderMuted:I(e.widget_border_color,.3),primary:e.widget_accent_color,primaryForeground:C(e.widget_accent_color),primaryHover:I(e.widget_accent_color,.85),primaryMuted:I(e.widget_accent_color,.3),secondary:e.widget_secondary_color,secondaryForeground:"#ffffff",secondaryBg:I(e.widget_secondary_color,.2),secondaryHover:I(e.widget_secondary_color,.3)},radius:e.widget_border_radius,shadow:e.widget_shadow,typography:{fontSizeBase:e.widget_font_size},motion:{durationAnimation:e.widget_animation_duration,durationFade:e.widget_fade_duration},size:{widgetWidth:e.widget_width,widgetHeight:e.widget_height}}}O(M);function N(e){return Array.isArray(e)?e:null==e?[]:[e]}var R="orpc",z=class extends Error{constructor(...e){super(...e),this.name="AbortError"}};function P(e){let t;return()=>{if(t)return t.result;const r=e();return t={result:r},r}}function L(){return globalThis["__@orpc/shared@1.13.9/otel/config__"]}function D(e,t={},r){return(L()?.tracer)?.startSpan(e,t,r)}function $(e,t,r={}){if(!e)return;const n=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(n),r.signal?.aborted&&r.signal.reason===t||e.setStatus({code:2,message:n.message})}async function j({name:e,context:t,...r},n){const o=L()?.tracer;if(!o)return n();const i=async e=>{try{return await n(e)}catch(t){throw $(e,t,r),t}finally{e.end()}};return t?o.startActiveSpan(e,r,t,i):o.startActiveSpan(e,r,i)}async function F(e,t){const r=L();if(!e||!r)return t();const n=r.trace.setSpan(r.context.active(),e);return r.context.with(n,t)}function U(e){return!(!e||"object"!=typeof e)&&("next"in e&&"function"==typeof e.next&&Symbol.asyncIterator in e&&"function"==typeof e[Symbol.asyncIterator])}var B=Symbol.asyncDispose??Symbol.for("asyncDispose"),W=class{#e=!1;#t=!1;#r;#n;constructor(e,t){this.#r=t,this.#n=function(e){let t=Promise.resolve();return(...r)=>t=t.catch(()=>{}).then(()=>e(...r))}(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.#r("next"))}})}next(){return this.#n()}async return(e){return this.#e=!0,this.#t||(this.#t=!0,await this.#r("return")),{done:!0,value:e}}async throw(e){throw this.#e=!0,this.#t||(this.#t=!0,await this.#r("throw")),e}async[B](){this.#e=!0,this.#t||(this.#t=!0,await this.#r("dispose"))}[Symbol.asyncIterator](){return this}};function G({name:e,...t},r){let n;return new W(async()=>{n??=D(e);try{const e=await F(n,()=>r.next());return n?.addEvent(e.done?"completed":"yielded"),e}catch(o){throw $(n,o,t),o}},async e=>{try{"next"!==e&&await F(n,()=>r.return?.())}catch(o){throw $(n,o,t),o}finally{n?.end()}})}function H(e,t,r){const n=(t,o)=>{const i=e[o];return i?i({...t,next:(e=t)=>n(e,o+1)}):r(t)};return n(t,0)}function Z(e){if(e)return JSON.parse(e)}function V(e){return JSON.stringify(e)}function q(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function J(e){return!!e&&("object"==typeof e||"function"==typeof e)}function Y(e,...t){return"function"==typeof e?e(...t):e}function K(e){return new Proxy(e,{get(e,t,r){const n=Reflect.get(e,t,r);return"then"!==t||"function"!=typeof n?n:new Proxy(n,{apply(t,r,n){if(2!==n.length||n.some(e=>{return!("function"==typeof(t=e)&&Q.test(t.toString()));var t}))return Reflect.apply(t,r,n);let o=!0;n[0].call(r,K(new Proxy(e,{get:(e,t,r)=>{if(!o||"then"!==t)return Reflect.get(e,t,r);o=!1}})))}})}})}var Q=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;var X={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 ee=Symbol.for("__@orpc/client@1.13.9/error/ORPC_ERROR_CONSTRUCTORS__");globalThis[ee]??=/* @__PURE__ */new WeakSet;var te=globalThis[ee],re=class extends Error{defined;code;status;data;constructor(e,...t){const r=function(e){return e[0]??{}}(t);if(void 0!==r.status&&!ne(r.status))throw new Error("[ORPCError] Invalid error status code.");const n=function(e,t){return t||X[e]?.message||e}(e,r.message);super(n,r),this.code=e,this.status=function(e,t){return t??X[e]?.status??500}(e,r.status),this.defined=r.defined??!1,this.data=r.data}toJSON(){return{defined:this.defined,code:this.code,status:this.status,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(te.has(this)){const t=function(e){return J(e)?Object.getPrototypeOf(e)?.constructor:null}(e);if(t&&te.has(t))return!0}return super[Symbol.hasInstance](e)}};function ne(e){return e<200||e>=400}function oe(e){if(!q(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&&ne(e.status)&&"message"in e&&"string"==typeof e.message)}function ie(e,t={}){return new re(e.code,{...t,...e})}te.add(re);var se=class extends TypeError{},ae=class extends TypeError{},le=class extends Error{data;constructor(e){super(e?.message??"An error event was received",e),this.data=e?.data}};function ce(e){const t=e.replace(/\n+$/,"").split(/\n/),r={data:void 0,event:void 0,id:void 0,retry:void 0,comments:[]};for(const n of t){const e=n.indexOf(":"),t=-1===e?n:n.slice(0,e),o=-1===e?"":n.slice(e+1).replace(/^\s/,"");if(0===e)r.comments.push(o);else if("data"===t)r.data??="",r.data+=`${o}\n`;else if("event"===t)r.event=o;else if("id"===t)r.id=o;else if("retry"===t){const e=Number.parseInt(o);Number.isInteger(e)&&e>=0&&e.toString()===o&&(r.retry=e)}}return r.data=r.data?.replace(/\n$/,""),r}var de=class{constructor(e={}){this.options=e}incomplete="";feed(e){this.incomplete+=e;const t=this.incomplete.lastIndexOf("\n\n");if(-1===t)return;const r=this.incomplete.slice(0,t).split(/\n\n/);this.incomplete=this.incomplete.slice(t+2);for(const n of r){const e=ce(`${n}\n\n`);this.options.onEvent&&this.options.onEvent(e)}}end(){if(this.incomplete)throw new ae("Event Iterator ended before complete")}},ue=class extends TransformStream{constructor(){let e;super({start(t){e=new de({onEvent:e=>{t.enqueue(e)}})},transform(t){e.feed(t)},flush(){e.end()}})}};function pe(e){if(e.includes("\n"))throw new se("Event's id must not contain a newline character")}function he(e){if(!Number.isInteger(e)||e<0)throw new se("Event's retry must be a integer and >= 0")}function me(e){if(e.includes("\n"))throw new se("Event's comment must not contain a newline character")}function fe(e){let t="";return t+=function(e){let t="";for(const r of e??[])me(r),t+=`: ${r}\n`;return t}(e.comments),void 0!==e.event&&(!function(e){if(e.includes("\n"))throw new se("Event's event must not contain a newline character")}(e.event),t+=`event: ${e.event}\n`),void 0!==e.retry&&(he(e.retry),t+=`retry: ${e.retry}\n`),void 0!==e.id&&(pe(e.id),t+=`id: ${e.id}\n`),t+=function(e){const t=e?.split(/\n/)??[];let r="";for(const n of t)r+=`data: ${n}\n`;return r}(e.data),t+="\n",t}var ge=Symbol("ORPC_EVENT_SOURCE_META");function ye(e,t){if(void 0===t.id&&void 0===t.retry&&!t.comments?.length)return e;if(void 0!==t.id&&pe(t.id),void 0!==t.retry&&he(t.retry),void 0!==t.comments)for(const r of t.comments)me(r);return new Proxy(e,{get:(e,r,n)=>r===ge?t:Reflect.get(e,r,n)})}function we(e){return J(e)?Reflect.get(e,ge):void 0}function be(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 r=e.match(/filename="((?:\\"|[^"])*)"/i);return r&&"string"==typeof r[1]?r[1].replace(/\\"/g,'"'):void 0}function ve(e,t){const r=async e=>{let r=await t.error(e);if(r!==e){const t=we(e);t&&J(r)&&(r=ye(r,t))}return r};return new W(async()=>{const{done:n,value:o}=await(async()=>{try{return await e.next()}catch(t){throw await r(t)}})();let i=await t.value(o,n);if(i!==o){const e=we(o);e&&J(i)&&(i=ye(i,e))}return{done:n,value:i}},async()=>{try{await(e.return?.())}catch(t){throw await r(t)}})}function xe(e,t={}){const r=t.path??[];return K(new Proxy(async(...[t,n={}])=>await e.call(r,t,function(e){return{...e,context:e.context??{}}}(n)),{get:(n,o)=>"string"!=typeof o?Reflect.get(n,o):xe(e,{...t,path:[...r,o]})}))}function ke(e,t={}){return j({name:"parse_standard_body",signal:t.signal},async()=>{const r=e.headers.get("content-disposition");if("string"==typeof r){const t=be(r)??"blob",n=await e.blob();return new File([n],t,{type:n.type})}const n=e.headers.get("content-type");if(!n||n.startsWith("application/json"))return Z(await e.text());if(n.startsWith("multipart/form-data"))return await e.formData();if(n.startsWith("application/x-www-form-urlencoded")){const t=await e.text();return new URLSearchParams(t)}if(n.startsWith("text/event-stream"))return function(e,t={}){const r=(e?.pipeThrough(new TextDecoderStream).pipeThrough(new ue))?.getReader();let n,o=!1;return new W(async()=>{n??=D("consume_event_iterator_stream");try{for(;;){if(void 0===r)return{done:!0,value:void 0};const{done:e,value:t}=await F(n,()=>r.read());if(e){if(o)throw new z("Stream was cancelled");return{done:!0,value:void 0}}switch(t.event){case"message":{let e=Z(t.data);return J(e)&&(e=ye(e,t)),n?.addEvent("message"),{done:!1,value:e}}case"error":{let e=new le({data:Z(t.data)});throw e=ye(e,t),n?.addEvent("error"),e}case"done":{let e=Z(t.data);return J(e)&&(e=ye(e,t)),n?.addEvent("done"),{done:!0,value:e}}default:n?.addEvent("maybe_keepalive")}}}catch(e){throw e instanceof le||$(n,e,t),e}},async e=>{try{"next"!==e&&(o=!0,n?.addEvent("cancelled")),await F(n,()=>r?.cancel())}catch(i){throw $(n,i,t),i}finally{n?.end()}})}(e.body,t);if(n.startsWith("text/plain"))return await e.text();const o=await e.blob();return new File([o],"blob",{type:o.type})})}function _e(e,t,r={}){const n=t.get("content-disposition");var o;if(t.delete("content-type"),t.delete("content-disposition"),void 0!==e)return e instanceof Blob?(t.set("content-type",e.type),t.set("content-length",e.size.toString()),t.set("content-disposition",n??`inline; filename="${(o=e instanceof File?e.name:"blob").replace(/"/g,'\\"')}"; filename*=utf-8''${encodeURIComponent(o).replace(/['()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)))}`),e):e instanceof FormData||e instanceof URLSearchParams?e:U(e)?(t.set("content-type","text/event-stream"),function(e,t={}){const r=t.eventIteratorKeepAliveEnabled??!0,n=t.eventIteratorKeepAliveInterval??5e3,o=t.eventIteratorKeepAliveComment??"",i=t.eventIteratorInitialCommentEnabled??!0,s=t.eventIteratorInitialComment??"";let a,l,c=!1;return new ReadableStream({start(e){l=D("stream_event_iterator"),i&&e.enqueue(fe({comments:[s]}))},async pull(t){try{r&&(a=setInterval(()=>{t.enqueue(fe({comments:[o]})),l?.addEvent("keepalive")},n));const i=await F(l,()=>e.next());if(clearInterval(a),c)return;const s=we(i.value);if(!i.done||void 0!==i.value||void 0!==s){const e=i.done?"done":"message";t.enqueue(fe({...s,event:e,data:V(i.value)})),l?.addEvent(e)}i.done&&(t.close(),l?.end())}catch(i){if(clearInterval(a),c)return;i instanceof le?(t.enqueue(fe({...we(i),event:"error",data:V(i.data)})),l?.addEvent("error"),t.close()):($(l,i),t.error(i)),l?.end()}},async cancel(){try{c=!0,clearInterval(a),l?.addEvent("cancelled"),await F(l,()=>e.return?.())}catch(t){throw $(l,t),t}finally{l?.end()}}}).pipeThrough(new TextEncoderStream)}(e,r)):(t.set("content-type","application/json"),V(e))}function Se(e,t={}){return e.forEach((e,r)=>{Array.isArray(t[r])?t[r].push(e):void 0!==t[r]?t[r]=[t[r],e]:t[r]=e}),t}function Ce(e,t={}){const r=function(e,t=new Headers){for(const[r,n]of Object.entries(e))if(Array.isArray(n))for(const e of n)t.append(r,e);else void 0!==n&&t.append(r,n);return t}(e.headers),n=_e(e.body,r,t);return new Request(e.url,{signal:e.signal,method:e.method,headers:r,body:n})}var Ie=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)}},Ee=class{constructor(e,t,r={}){this.codec=e,this.sender=t,new Ie(r.plugins).init(r),this.interceptors=N(r.interceptors),this.clientInterceptors=N(r.clientInterceptors)}interceptors;clientInterceptors;call(e,t,r){return j({name:`${R}.${e.join("/")}`,signal:r.signal},n=>(n?.setAttribute("rpc.system",R),n?.setAttribute("rpc.method",e.join(".")),U(t)&&(t=G({name:"consume_event_iterator_input",signal:r.signal},t)),H(this.interceptors,{...r,path:e,input:t},async({path:e,input:t,...r})=>{const o=L();let i;const s=o?.trace.getActiveSpan()??n;s&&o&&(i=o?.trace.setSpan(o.context.active(),s));const a=await j({name:"encode_request",context:i},()=>this.codec.encode(e,t,r)),l=await H(this.clientInterceptors,{...r,input:t,path:e,request:a},({input:e,path:t,request:r,...n})=>j({name:"send_request",signal:n.signal,context:i},()=>this.sender.call(r,n,t,e))),c=await j({name:"decode_response",context:i},()=>this.codec.decode(l,r,e,t));return U(c)?G({name:"consume_event_iterator_output",signal:r.signal},c):c})))}},Te=0,Ae=1,Me=2,Oe=3,Ne=4,Re=5,ze=6,Pe=7,Le=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=[],r=[],n=[],o=[]){for(const i of this.customSerializers)if(i.condition(e)){const s=this.serialize(i.serialize(e),t,r,n,o);return r.push([i.type,...t]),s}if(e instanceof Blob)return n.push(t),o.push(e),[e,r,n,o];if("bigint"==typeof e)return r.push([Te,...t]),[e.toString(),r,n,o];if(e instanceof Date)return r.push([Ae,...t]),Number.isNaN(e.getTime())?[null,r,n,o]:[e.toISOString(),r,n,o];if(Number.isNaN(e))return r.push([Me,...t]),[null,r,n,o];if(e instanceof URL)return r.push([Ne,...t]),[e.toString(),r,n,o];if(e instanceof RegExp)return r.push([Re,...t]),[e.toString(),r,n,o];if(e instanceof Set){const i=this.serialize(Array.from(e),t,r,n,o);return r.push([ze,...t]),i}if(e instanceof Map){const i=this.serialize(Array.from(e.entries()),t,r,n,o);return r.push([Pe,...t]),i}if(Array.isArray(e))return[e.map((e,i)=>void 0===e?(r.push([Oe,...t,i]),e):this.serialize(e,[...t,i],r,n,o)[0]),r,n,o];if(q(e)){const i={};for(const s in e)"toJSON"===s&&"function"==typeof e[s]||(i[s]=this.serialize(e[s],[...t,s],r,n,o)[0]);return[i,r,n,o]}return[e,r,n,o]}deserialize(e,t,r,n){const o={data:e};r&&n&&r.forEach((e,t)=>{let r=o,i="data";e.forEach(e=>{if(r=r[i],i=e,!Object.hasOwn(r,i))throw new Error(`Security error: accessing non-existent path during deserialization. Path segment: ${i}`)}),r[i]=n(t)});for(const i of t){const e=i[0];let t=o,r="data";for(let n=1;n<i.length;n++)if(t=t[r],r=i[n],!Object.hasOwn(t,r))throw new Error(`Security error: accessing non-existent path during deserialization. Path segment: ${r}`);for(const n of this.customSerializers)if(n.type===e){t[r]=n.deserialize(t[r]);break}switch(e){case Te:t[r]=BigInt(t[r]);break;case Ae:t[r]=new Date(t[r]??"Invalid Date");break;case Me:t[r]=NaN;break;case Oe:t[r]=void 0;break;case Ne:t[r]=new URL(t[r]);break;case Re:{const[,e,n]=t[r].match(/^\/(.*)\/([a-z]*)$/);t[r]=new RegExp(e,n);break}case ze:t[r]=new Set(t[r]);break;case Pe:t[r]=new Map(t[r])}}return o.data}};var De=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,r){let n=function(e){return"function"==typeof e.forEach?Se(e):e}(await Y(this.headers,r,e,t));void 0!==r.lastEventId&&(n=function(e,t){const r={...e};for(const n in t)Array.isArray(t[n])?r[n]=[...N(r[n]),...t[n]]:void 0!==t[n]&&(Array.isArray(r[n])?r[n]=[...r[n],t[n]]:void 0!==r[n]?r[n]=[r[n],t[n]]:r[n]=t[n]);return r}(n,{"last-event-id":r.lastEventId}));const o=await Y(this.expectedMethod,r,e,t),i=await Y(this.baseUrl,r,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||U(a))){const i=await Y(this.maxUrlLength,r,e,t),l=new URL(s);if(l.searchParams.append("data",V(a)),l.toString().length<=i)return{body:void 0,method:o,headers:n,url:l,signal:r.signal}}return{url:s,method:"GET"===o?this.fallbackMethod:o,headers:n,body:a,signal:r.signal}}async decode(e){const t=!ne(e.status),r=await(async()=>{let t=!1;try{const r=await e.body();return t=!0,this.serializer.deserialize(r)}catch(r){if(!t)throw new Error("Cannot parse response body, please check the response body and content-type.",{cause:r});throw new Error("Invalid RPC response format.",{cause:r})}})();if(!t){if(oe(r))throw ie(r);throw new re((n=e.status,Object.entries(X).find(([,e])=>e.status===n)?.[0]??"MALFORMED_ORPC_ERROR_RESPONSE"),{status:e.status,data:{...e,body:r}})}var n;return r}},$e=class{constructor(e){this.jsonSerializer=e}serialize(e){return U(e)?ve(e,{value:async e=>this.#o(e,!1),error:async e=>{return new le({data:this.#o((t=e,t instanceof re?t:new re("INTERNAL_SERVER_ERROR",{message:"Internal server error",cause:t})).toJSON(),!1),cause:e});var t}}):this.#o(e,!0)}#o(e,t){const[r,n,o,i]=this.jsonSerializer.serialize(e),s=0===n.length?void 0:n;if(!t||0===i.length)return{json:r,meta:s};const a=new FormData;return a.set("data",V({json:r,meta:s,maps:o})),i.forEach((e,t)=>{a.set(t.toString(),e)}),a}deserialize(e){return U(e)?ve(e,{value:async e=>this.#i(e),error:async e=>{if(!(e instanceof le))return e;const t=this.#i(e.data);return oe(t)?ie(t,{cause:e}):new le({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()))}},je=class extends Ee{constructor(e,t){super(new De(new $e(new Le(t)),t),e,t)}},Fe=class extends Ie{initRuntimeAdapter(e){for(const t of this.plugins)t.initRuntimeAdapter?.(e)}},Ue=class{fetch;toFetchRequestOptions;adapterInterceptors;constructor(e){new Fe(e.plugins).initRuntimeAdapter(e),this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=e,this.adapterInterceptors=N(e.adapterInterceptors)}async call(e,t,r,n){const o=Ce(e,this.toFetchRequestOptions);return function(e,t={}){return{body:P(()=>ke(e,t)),status:e.status,get headers(){const t=Se(e.headers);return Object.defineProperty(this,"headers",{value:t,writable:!0}),t},set headers(e){Object.defineProperty(this,"headers",{value:e,writable:!0})}}}(await H(this.adapterInterceptors,{...t,request:o,path:r,input:n,init:{redirect:"manual"}},({request:e,path:t,input:r,init:n,...o})=>this.fetch(e,n,o,t,r)),{signal:o.signal})}},Be=class extends je{constructor(e){super(new Ue(e),e)}};Object.freeze({status:"aborted"});function We(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:s,traits:/* @__PURE__ */new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const o=s.prototype,i=Object.keys(o);for(let e=0;e<i.length;e++){const t=i[e];t in r||(r[t]=o[t].bind(r))}}const o=r?.Parent??Object;class i extends o{}function s(e){var t;const o=r?.Parent?new i:this;n(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const r of o._zod.deferred)r();return o}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(s,"name",{value:e}),s}var Ge=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},He=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Ze={};function Ve(e){return e&&Object.assign(Ze,e),Ze}function qe(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function Je(e,t){return"bigint"==typeof t?t.toString():t}function Ye(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ke(e){return null==e}function Qe(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var Xe=Symbol("evaluating");function et(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Xe)return void 0===n&&(n=Xe,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function tt(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function rt(...e){const t={};for(const r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function nt(e){return JSON.stringify(e)}var ot="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function it(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var st=Ye(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function at(e){if(!1===it(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==it(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function lt(e){return at(e)?{...e}:Array.isArray(e)?[...e]:e}var ct=new Set(["string","number","symbol"]);function dt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ut(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function pt(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 ht={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 mt(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function ft(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function gt(e){return"string"==typeof e?e:e?.message}function yt(e,t,r){const n={...e,path:e.path??[]};return e.message||(n.message=gt(e.inst?._zod.def?.error?.(e))??gt(t?.error?.(e))??gt(r.customError?.(e))??gt(r.localeError?.(e))??"Invalid input"),delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function wt(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function bt(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}var vt=(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,Je,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xt=We("$ZodError",vt),kt=We("$ZodError",vt,{Parent:Error});var _t=e=>(t,r,n,o)=>{const i=n?Object.assign(n,{async:!1}):{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new Ge;if(s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>yt(e,i,Ve())));throw ot(t,o?.callee),t}return s.value},St=e=>async(t,r,n,o)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(o?.Err??e)(s.issues.map(e=>yt(e,i,Ve())));throw ot(t,o?.callee),t}return s.value},Ct=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Ge;return i.issues.length?{success:!1,error:new(e??xt)(i.issues.map(e=>yt(e,o,Ve())))}:{success:!0,data:i.value}},It=/* @__PURE__ */Ct(kt),Et=e=>async(t,r,n)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>yt(e,o,Ve())))}:{success:!0,data:i.value}},Tt=/* @__PURE__ */Et(kt),At=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return _t(e)(t,r,o)},Mt=e=>(t,r,n)=>_t(e)(t,r,n),Ot=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return St(e)(t,r,o)},Nt=e=>async(t,r,n)=>St(e)(t,r,n),Rt=e=>(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Ct(e)(t,r,o)},zt=e=>(t,r,n)=>Ct(e)(t,r,n),Pt=e=>async(t,r,n)=>{const o=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Et(e)(t,r,o)},Lt=e=>async(t,r,n)=>Et(e)(t,r,n),Dt=/^[cC][^\s-]{8,}$/,$t=/^[0-9a-z]+$/,jt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ft=/^[0-9a-vA-V]{20}$/,Ut=/^[A-Za-z0-9]{27}$/,Bt=/^[a-zA-Z0-9_-]{21}$/,Wt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gt=/^([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})$/,Ht=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)$/,Zt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Vt=/^(?:(?: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])$/,qt=/^(([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}|:))$/,Jt=/^((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])$/,Yt=/^(([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])$/,Kt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Qt=/^[A-Za-z0-9_-]*$/,Xt=/^\+[1-9]\d{6,14}$/,er="(?:(?:\\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])))",tr=/* @__PURE__ */new RegExp(`^${er}$`);function rr(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 nr=/^-?\d+$/,or=/^-?\d+(?:\.\d+)?$/,ir=/^(?:true|false)$/i,sr=/^null$/i,ar=/^[^A-Z]*$/,lr=/^[^a-z]*$/,cr=/* @__PURE__ */We("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),dr={number:"number",bigint:"bigint",object:"date"},ur=/* @__PURE__ */We("$ZodCheckLessThan",(e,t)=>{cr.init(e,t);const r=dr[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),pr=/* @__PURE__ */We("$ZodCheckGreaterThan",(e,t)=>{cr.init(e,t);const r=dr[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hr=/* @__PURE__ */We("$ZodCheckMultipleOf",(e,t)=>{cr.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value!==BigInt(0):0!==function(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let o=(n.split(".")[1]||"").length;if(0===o&&/\d?e-\d?/.test(n)){const e=n.match(/\d?e-(\d?)/);e?.[1]&&(o=Number.parseInt(e[1]))}const i=r>o?r:o;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(r.value,t.value))&&r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),mr=/* @__PURE__ */We("$ZodCheckNumberFormat",(e,t)=>{cr.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,i]=ht[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=o,n.maximum=i,r&&(n.pattern=nr)}),e._zod.check=s=>{const a=s.value;if(r){if(!Number.isInteger(a))return void s.issues.push({expected:n,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:n,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:n,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})}}),fr=/* @__PURE__ */We("$ZodCheckMaxLength",(e,t)=>{var r;cr.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Ke(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const o=wt(n);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),gr=/* @__PURE__ */We("$ZodCheckMinLength",(e,t)=>{var r;cr.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Ke(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const o=wt(n);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),yr=/* @__PURE__ */We("$ZodCheckLengthEquals",(e,t)=>{var r;cr.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!Ke(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,o=n.length;if(o===t.length)return;const i=wt(n),s=o>t.length;r.issues.push({origin:i,...s?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),wr=/* @__PURE__ */We("$ZodCheckStringFormat",(e,t)=>{var r,n;cr.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=/* @__PURE__ */new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),br=/* @__PURE__ */We("$ZodCheckRegex",(e,t)=>{wr.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),vr=/* @__PURE__ */We("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ar),wr.init(e,t)}),xr=/* @__PURE__ */We("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=lr),wr.init(e,t)}),kr=/* @__PURE__ */We("$ZodCheckIncludes",(e,t)=>{cr.init(e,t);const r=dt(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);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=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),_r=/* @__PURE__ */We("$ZodCheckStartsWith",(e,t)=>{cr.init(e,t);const r=new RegExp(`^${dt(t.prefix)}.*`);t.pattern??(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=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Sr=/* @__PURE__ */We("$ZodCheckEndsWith",(e,t)=>{cr.init(e,t);const r=new RegExp(`.*${dt(t.suffix)}$`);t.pattern??(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=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Cr=/* @__PURE__ */We("$ZodCheckOverwrite",(e,t)=>{cr.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Ir=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),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const o of n)this.content.push(o)}compile(){const e=Function,t=this?.args,r=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,r.join("\n"))}},Er={major:4,minor:3,patch:6},Tr=/* @__PURE__ */We("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Er;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const t of o._zod.onattach)t(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,o=mt(e);for(const i of t){if(i._zod.def.when){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===r?.async)throw new Ge;if(n||s instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(o||(o=mt(e,t)))});else{if(e.issues.length===t)continue;o||(o=mt(e,t))}}return n?n.then(()=>e):e},r=(r,o,i)=>{if(mt(r))return r.aborted=!0,r;const s=t(o,n,i);if(s instanceof Promise){if(!1===i.async)throw new Ge;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=>r(e,o,i)):r(t,o,i)}const s=e._zod.parse(o,i);if(s instanceof Promise){if(!1===i.async)throw new Ge;return s.then(e=>t(e,n,i))}return t(s,n,i)}}et(e,"~standard",()=>({validate:t=>{try{const r=It(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Tt(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Ar=/* @__PURE__ */We("$ZodString",(e,t)=>{var r;Tr.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(n){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Mr=/* @__PURE__ */We("$ZodStringFormat",(e,t)=>{wr.init(e,t),Ar.init(e,t)}),Or=/* @__PURE__ */We("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Gt),Mr.init(e,t)}),Nr=/* @__PURE__ */We("$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=Ht(e))}else t.pattern??(t.pattern=Ht());Mr.init(e,t)}),Rr=/* @__PURE__ */We("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Zt),Mr.init(e,t)}),zr=/* @__PURE__ */We("$ZodURL",(e,t)=>{Mr.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),o=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.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)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=o.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Pr=/* @__PURE__ */We("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Mr.init(e,t)}),Lr=/* @__PURE__ */We("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Bt),Mr.init(e,t)}),Dr=/* @__PURE__ */We("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Dt),Mr.init(e,t)}),$r=/* @__PURE__ */We("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=$t),Mr.init(e,t)}),jr=/* @__PURE__ */We("$ZodULID",(e,t)=>{t.pattern??(t.pattern=jt),Mr.init(e,t)}),Fr=/* @__PURE__ */We("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ft),Mr.init(e,t)}),Ur=/* @__PURE__ */We("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ut),Mr.init(e,t)}),Br=/* @__PURE__ */We("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=rr({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${er}T(?:${n})$`)}(t)),Mr.init(e,t)}),Wr=/* @__PURE__ */We("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=tr),Mr.init(e,t)}),Gr=/* @__PURE__ */We("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${rr(t)}$`)),Mr.init(e,t)}),Hr=/* @__PURE__ */We("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Wt),Mr.init(e,t)}),Zr=/* @__PURE__ */We("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vt),Mr.init(e,t),e._zod.bag.format="ipv4"}),Vr=/* @__PURE__ */We("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=qt),Mr.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),qr=/* @__PURE__ */We("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Jt),Mr.init(e,t)}),Jr=/* @__PURE__ */We("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Yt),Mr.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Yr(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Kr=/* @__PURE__ */We("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Kt),Mr.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Yr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});var Qr=/* @__PURE__ */We("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Qt),Mr.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!Qt.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Yr(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Xr=/* @__PURE__ */We("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Xt),Mr.init(e,t)});var en=/* @__PURE__ */We("$ZodJWT",(e,t)=>{Mr.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),tn=/* @__PURE__ */We("$ZodNumber",(e,t)=>{Tr.init(e,t),e._zod.pattern=e._zod.bag.pattern??or,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}const o=r.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return r;const i="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),rn=/* @__PURE__ */We("$ZodNumberFormat",(e,t)=>{mr.init(e,t),tn.init(e,t)}),nn=/* @__PURE__ */We("$ZodBoolean",(e,t)=>{Tr.init(e,t),e._zod.pattern=ir,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}const o=r.value;return"boolean"==typeof o||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),on=/* @__PURE__ */We("$ZodNull",(e,t)=>{Tr.init(e,t),e._zod.pattern=sr,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{const n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),sn=/* @__PURE__ */We("$ZodUnknown",(e,t)=>{Tr.init(e,t),e._zod.parse=e=>e}),an=/* @__PURE__ */We("$ZodNever",(e,t)=>{Tr.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),ln=/* @__PURE__ */We("$ZodDate",(e,t)=>{Tr.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(s){}const o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function cn(e,t,r){e.issues.length&&t.issues.push(...ft(r,e.issues)),t.value[r]=e.value}var dn=/* @__PURE__ */We("$ZodArray",(e,t)=>{Tr.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.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:[]},n);a instanceof Promise?i.push(a.then(t=>cn(t,r,e))):cn(a,r,e)}return i.length?Promise.all(i).then(()=>r):r}});function un(e,t,r,n,o){if(e.issues.length){if(o&&!(r in n))return;t.issues.push(...ft(r,e.issues))}void 0===e.value?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function pn(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 r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function hn(e,t,r,n,o,i){const s=[],a=o.keySet,l=o.catchall._zod,c=l.def.type,d="optional"===l.optout;for(const u in t){if(a.has(u))continue;if("never"===c){s.push(u);continue}const o=l.run({value:t[u],issues:[]},n);o instanceof Promise?e.push(o.then(e=>un(e,r,u,t,d))):un(o,r,u,t,d)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i}),e.length?Promise.all(e).then(()=>r):r}var mn=/* @__PURE__ */We("$ZodObject",(e,t)=>{if(Tr.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const r=Ye(()=>pn(t));et(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=/* @__PURE__ */new Set);for(const e of n.values)r[t].add(e)}}return r});const n=it,o=t.catchall;let i;e._zod.parse=(t,s)=>{i??(i=r.value);const a=t.value;if(!n(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const l=[],c=i.shape;for(const e of i.keys){const r=c[e],n="optional"===r._zod.optout,o=r._zod.run({value:a[e],issues:[]},s);o instanceof Promise?l.push(o.then(r=>un(r,t,e,a,n))):un(o,t,e,a,n)}return o?hn(l,a,t,s,r.value,e):l.length?Promise.all(l).then(()=>t):t}}),fn=/* @__PURE__ */We("$ZodObjectJIT",(e,t)=>{mn.init(e,t);const r=e._zod.parse,n=Ye(()=>pn(t));let o;const i=it,s=!Ze.jitless,a=s&&st.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=n.value);const p=d.value;return i(p)?s&&a&&!1===u?.async&&!0!==u.jitless?(o||(o=(e=>{const t=new Ir(["shape","payload","ctx"]),r=n.value,o=e=>{const t=nt(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 n of r.keys)i[n]="key_"+s++;t.write("const newResult = {};");for(const n of r.keys){const r=i[n],s=nt(n),a="optional"===e[n]?._zod?.optout;t.write(`const ${r} = ${o(n)};`),a?t.write(`\n if (${r}.issues.length) {\n if (${s} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `):t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${s}, ...iss.path] : [${s}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${s} in input) {\n newResult[${s}] = undefined;\n }\n } else {\n newResult[${s}] = ${r}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,r)=>a(e,t,r)})(t.shape)),d=o(d,u),l?hn([],p,d,u,c,e):d):r(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function gn(e,t,r,n){for(const i of e)if(0===i.issues.length)return t.value=i.value,t;const o=e.filter(e=>!mt(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>yt(e,n,Ve())))}),t)}var yn=/* @__PURE__ */We("$ZodUnion",(e,t)=>{Tr.init(e,t),et(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),et(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),et(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),et(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 r=1===t.options.length,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:o.value,issues:[]},i);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>gn(t,o,e,i)):gn(a,o,e,i)}}),wn=/* @__PURE__ */We("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,yn.init(e,t);const r=e._zod.parse;et(e._zod,"propValues",()=>{const e={};for(const r of t.options){const n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[t,r]of Object.entries(n)){e[t]||(e[t]=/* @__PURE__ */new Set);for(const n of r)e[t].add(n)}}return e});const n=Ye(()=>{const e=t.options,r=/* @__PURE__ */new Map;for(const n of e){const e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(r.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(o,i)=>{const s=o.value;if(!it(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;const a=n.value.get(s?.[t.discriminator]);return a?a._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),o)}}),bn=/* @__PURE__ */We("$ZodIntersection",(e,t)=>{Tr.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,o=t.left._zod.run({value:n,issues:[]},r),i=t.right._zod.run({value:n,issues:[]},r);return o instanceof Promise||i instanceof Promise?Promise.all([o,i]).then(([t,r])=>xn(e,t,r)):xn(e,o,i)}});function vn(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(at(e)&&at(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),o={...e,...t};for(const i of n){const r=vn(e[i],t[i]);if(!r.valid)return{valid:!1,mergeErrorPath:[i,...r.mergeErrorPath]};o[i]=r.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=vn(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function xn(e,t,r){const n=/* @__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)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(a);for(const a of r.issues)if("unrecognized_keys"===a.code)for(const e of a.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(a);const i=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(i.length&&o&&e.issues.push({...o,keys:i}),mt(e))return e;const s=vn(t.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return e.value=s.data,e}var kn=/* @__PURE__ */We("$ZodRecord",(e,t)=>{Tr.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!at(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const i=[],s=t.keyType._zod.values;if(s){r.value={};const a=/* @__PURE__ */new Set;for(const e of s)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const s=t.valueType._zod.run({value:o[e],issues:[]},n);s instanceof Promise?i.push(s.then(t=>{t.issues.length&&r.issues.push(...ft(e,t.issues)),r.value[e]=t.value})):(s.issues.length&&r.issues.push(...ft(e,s.issues)),r.value[e]=s.value)}let l;for(const e in o)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{r.value={};for(const s of Reflect.ownKeys(o)){if("__proto__"===s)continue;let a=t.keyType._zod.run({value:s,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof s&&or.test(s)&&a.issues.length){const e=t.keyType._zod.run({value:Number(s),issues:[]},n);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?r.value[s]=o[s]:r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>yt(e,n,Ve())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:o[s],issues:[]},n);l instanceof Promise?i.push(l.then(e=>{e.issues.length&&r.issues.push(...ft(s,e.issues)),r.value[a.value]=e.value})):(l.issues.length&&r.issues.push(...ft(s,l.issues)),r.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}}),_n=/* @__PURE__ */We("$ZodEnum",(e,t)=>{Tr.init(e,t);const r=qe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>ct.has(typeof e)).map(e=>"string"==typeof e?dt(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const i=t.value;return n.has(i)||t.issues.push({code:"invalid_value",values:r,input:i,inst:e}),t}}),Sn=/* @__PURE__ */We("$ZodLiteral",(e,t)=>{if(Tr.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?dt(e):e?dt(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),Cn=/* @__PURE__ */We("$ZodTransform",(e,t)=>{Tr.init(e,t),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new He(e.constructor.name);const o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(r.value=e,r));if(o instanceof Promise)throw new Ge;return r.value=o,r}});function In(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}var En=/* @__PURE__ */We("$ZodOptional",(e,t)=>{Tr.init(e,t),e._zod.optin="optional",e._zod.optout="optional",et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),et(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Qe(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(t=>In(t,e.value)):In(n,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Tn=/* @__PURE__ */We("$ZodExactOptional",(e,t)=>{En.init(e,t),et(e._zod,"values",()=>t.innerType._zod.values),et(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),An=/* @__PURE__ */We("$ZodNullable",(e,t)=>{Tr.init(e,t),et(e._zod,"optin",()=>t.innerType._zod.optin),et(e._zod,"optout",()=>t.innerType._zod.optout),et(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${Qe(e.source)}|null)$`):void 0}),et(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Mn=/* @__PURE__ */We("$ZodDefault",(e,t)=>{Tr.init(e,t),e._zod.optin="optional",et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>On(e,t)):On(n,t)}});function On(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var Nn=/* @__PURE__ */We("$ZodPrefault",(e,t)=>{Tr.init(e,t),e._zod.optin="optional",et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Rn=/* @__PURE__ */We("$ZodNonOptional",(e,t)=>{Tr.init(e,t),et(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(t=>zn(t,e)):zn(o,e)}});function zn(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 Pn=/* @__PURE__ */We("$ZodCatch",(e,t)=>{Tr.init(e,t),et(e._zod,"optin",()=>t.innerType._zod.optin),et(e._zod,"optout",()=>t.innerType._zod.optout),et(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>yt(e,r,Ve()))},input:e.value}),e.issues=[]),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>yt(e,r,Ve()))},input:e.value}),e.issues=[]),e)}}),Ln=/* @__PURE__ */We("$ZodPipe",(e,t)=>{Tr.init(e,t),et(e._zod,"values",()=>t.in._zod.values),et(e._zod,"optin",()=>t.in._zod.optin),et(e._zod,"optout",()=>t.out._zod.optout),et(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>Dn(e,t.in,r)):Dn(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>Dn(e,t.out,r)):Dn(n,t.out,r)}});function Dn(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var $n=/* @__PURE__ */We("$ZodReadonly",(e,t)=>{Tr.init(e,t),et(e._zod,"propValues",()=>t.innerType._zod.propValues),et(e._zod,"values",()=>t.innerType._zod.values),et(e._zod,"optin",()=>t.innerType?._zod?.optin),et(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(jn):jn(n)}});function jn(e){return e.value=Object.freeze(e.value),e}var Fn,Un=/* @__PURE__ */We("$ZodCustom",(e,t)=>{cr.init(e,t),Tr.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(t=>Bn(t,r,n,e));Bn(o,r,n,e)}});function Bn(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(bt(e))}}var Wn=class{constructor(){this._map=/* @__PURE__ */new WeakMap,this._idmap=/* @__PURE__ */new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.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 r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};(Fn=globalThis).__zod_globalRegistry??(Fn.__zod_globalRegistry=new Wn);var Gn=globalThis.__zod_globalRegistry;function Hn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...pt(t)})}function Zn(e,t){return new ur({check:"less_than",...pt(t),value:e,inclusive:!1})}function Vn(e,t){return new ur({check:"less_than",...pt(t),value:e,inclusive:!0})}function qn(e,t){return new pr({check:"greater_than",...pt(t),value:e,inclusive:!1})}function Jn(e,t){return new pr({check:"greater_than",...pt(t),value:e,inclusive:!0})}function Yn(e,t){return new hr({check:"multiple_of",...pt(t),value:e})}function Kn(e,t){return new fr({check:"max_length",...pt(t),maximum:e})}function Qn(e,t){return new gr({check:"min_length",...pt(t),minimum:e})}function Xn(e,t){return new yr({check:"length_equals",...pt(t),length:e})}function eo(e){return new Cr({check:"overwrite",tx:e})}function to(e,t){const r=new cr({check:"custom",...pt(t)});return r._zod.check=e,r}function ro(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??Gn,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 no(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s);const a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,n);else{const r=s.schema,i=t.processors[o.type];if(!i)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);i(e,t,r,n)}const i=e._zod.parent;i&&(s.ref||(s.ref=i),no(i,t,n),t.seen.get(i).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&so(e)&&(delete s.schema.examples,delete s.schema.default),"input"===t.io&&s.schema._prefault&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function oo(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=/* @__PURE__ */new Map;for(const i of e.seen.entries()){const t=e.metadataRegistry.get(i[0])?.id;if(t){const e=n.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.`);n.set(t,i[0])}}const o=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:o,defId:i}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,o=e.external.uri??(e=>e);if(r)return{ref:o(r)};const i=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=i,{defId:i,ref:`${o("__shared")}#/${n}/${i}`}}if(t[1]===r)return{ref:"#"};const o=`#/${n}/`,i=t[1].schema.id??"__schema"+e.counter++;return{defId:i,ref:o+i}})(t);n.def={...n.schema},i&&(n.defId=i);const s=n.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 r=i[1];if(t!==i[0]){if(e.external){const r=e.external.registry.get(i[0])?.id;if(t!==i[0]&&r){o(i);continue}}(e.metadataRegistry.get(i[0])?.id||r.cycle||r.count>1&&"ref"===e.reused)&&o(i)}else o(i)}}function io(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const o=r.def??r.schema,i={...o},s=r.ref;if(r.ref=null,s){n(s);const r=e.seen.get(s),a=r.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&&r.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(o[e])===JSON.stringify(r.def[e])&&delete o[e]}const a=t._zod.parent;if(a&&a!==s){n(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:r.path??[]})};for(const a of[...e.seen.entries()].reverse())n(a[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 r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(r)}Object.assign(o,r.def??r.schema);const i=e.external?.defs??{};for(const a of e.seen.entries()){const e=a[1];e.def&&e.defId&&(i[e.defId]=e.def)}e.external||Object.keys(i).length>0&&("draft-2020-12"===e.target?o.$defs=i:o.definitions=i);try{const r=JSON.parse(JSON.stringify(o));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:ao(t,"input",e.processors),output:ao(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(s){throw new Error("Error converting schema to JSON.")}}function so(e,t){const r=t??{seen:/* @__PURE__ */new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return so(n.element,r);if("set"===n.type)return so(n.valueType,r);if("lazy"===n.type)return so(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return so(n.innerType,r);if("intersection"===n.type)return so(n.left,r)||so(n.right,r);if("record"===n.type||"map"===n.type)return so(n.keyType,r)||so(n.valueType,r);if("pipe"===n.type)return so(n.in,r)||so(n.out,r);if("object"===n.type){for(const e in n.shape)if(so(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(so(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(so(e,r))return!0;return!(!n.rest||!so(n.rest,r))}return!1}var ao=(e,t,r={})=>n=>{const{libraryOptions:o,target:i}=n??{},s=ro({...o??{},target:i,io:t,processors:r});return no(e,s),oo(s,e),io(s,e)},lo={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},co=(e,t,r,n)=>{const o=e._zod.def;no(o.innerType,t,n);t.seen.get(e).ref=o.innerType},uo=/* @__PURE__ */We("ZodISODateTime",(e,t)=>{Br.init(e,t),Do.init(e,t)});function po(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...pt(t)})}(uo,e)}var ho=/* @__PURE__ */We("ZodISODate",(e,t)=>{Wr.init(e,t),Do.init(e,t)});function mo(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...pt(t)})}(ho,e)}var fo=/* @__PURE__ */We("ZodISOTime",(e,t)=>{Gr.init(e,t),Do.init(e,t)});function go(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...pt(t)})}(fo,e)}var yo=/* @__PURE__ */We("ZodISODuration",(e,t)=>{Hr.init(e,t),Do.init(e,t)});function wo(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...pt(t)})}(yo,e)}var bo=(e,t)=>{xt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=e=>{for(const o of e.issues)if("invalid_union"===o.code&&o.errors.length)o.errors.map(e=>n({issues:e}));else if("invalid_key"===o.code)n({issues:o.issues});else if("invalid_element"===o.code)n({issues:o.issues});else if(0===o.path.length)r._errors.push(t(o));else{let e=r,n=0;for(;n<o.path.length;){const r=o.path[n];n!==o.path.length-1?e[r]=e[r]||{_errors:[]}:(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(o))),e=e[r],n++}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Je,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Je,2)}},isEmpty:{get:()=>0===e.issues.length}})},vo=(We("ZodError",bo),We("ZodError",bo,{Parent:Error})),xo=/* @__PURE__ */_t(vo),ko=/* @__PURE__ */St(vo),_o=/* @__PURE__ */Ct(vo),So=/* @__PURE__ */Et(vo),Co=/* @__PURE__ */At(vo),Io=/* @__PURE__ */Mt(vo),Eo=/* @__PURE__ */Ot(vo),To=/* @__PURE__ */Nt(vo),Ao=/* @__PURE__ */Rt(vo),Mo=/* @__PURE__ */zt(vo),Oo=/* @__PURE__ */Pt(vo),No=/* @__PURE__ */Lt(vo),Ro=/* @__PURE__ */We("ZodType",(e,t)=>(Tr.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ao(e,"input"),output:ao(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=ro({...r,processors:t});return no(e,n),oo(n,e),io(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(rt(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,r)=>ut(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>xo(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>_o(e,t,r),e.parseAsync=async(t,r)=>ko(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>So(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>Co(e,t,r),e.decode=(t,r)=>Io(e,t,r),e.encodeAsync=async(t,r)=>Eo(e,t,r),e.decodeAsync=async(t,r)=>To(e,t,r),e.safeEncode=(t,r)=>Ao(e,t,r),e.safeDecode=(t,r)=>Mo(e,t,r),e.safeEncodeAsync=async(t,r)=>Oo(e,t,r),e.safeDecodeAsync=async(t,r)=>No(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return function(e,t,r){return new e({type:"custom",check:"custom",fn:t,...pt(r)})}(Gi,e,t)}(t,r)),e.superRefine=t=>e.check(function(e){const t=/* @__PURE__ */to(r=>(r.addIssue=e=>{if("string"==typeof e)r.issues.push(bt(e,r.value,t._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(bt(n))}},e(r.value,r)));return t}(t)),e.overwrite=t=>e.check(eo(t)),e.optional=()=>Ri(e),e.exactOptional=()=>new zi({type:"optional",innerType:e}),e.nullable=()=>Li(e),e.nullish=()=>Ri(Li(e)),e.nonoptional=t=>function(e,t){return new ji({type:"nonoptional",innerType:e,...pt(t)})}(e,t),e.array=()=>gi(e),e.or=t=>vi([e,t]),e.and=t=>new _i({type:"intersection",left:e,right:t}),e.transform=t=>Bi(e,Oi(t)),e.default=t=>{return r=t,new Di({type:"default",innerType:e,get defaultValue(){return"function"==typeof r?r():lt(r)}});var r},e.prefault=t=>{return r=t,new $i({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof r?r():lt(r)}});var r},e.catch=t=>{return new Fi({type:"catch",innerType:e,catchValue:"function"==typeof(r=t)?r:()=>r});var r},e.pipe=t=>Bi(e,t),e.readonly=()=>new Wi({type:"readonly",innerType:e}),e.describe=t=>{const r=e.clone();return Gn.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>Gn.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Gn.get(e);const r=e.clone();return Gn.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),zo=/* @__PURE__ */We("_ZodString",(e,t)=>{Ar.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:o,maximum:i,format:s,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof o&&(n.minLength=o),"number"==typeof i&&(n.maxLength=i),s&&(n.format=lo[s]??s,""===n.format&&delete n.format,"time"===s&&delete n.format),l&&(n.contentEncoding=l),a&&a.size>0){const e=[...a];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new br({check:"string_format",format:"regex",...pt(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new kr({check:"string_format",format:"includes",...pt(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new _r({check:"string_format",format:"starts_with",...pt(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Sr({check:"string_format",format:"ends_with",...pt(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Qn(...t)),e.max=(...t)=>e.check(Kn(...t)),e.length=(...t)=>e.check(Xn(...t)),e.nonempty=(...t)=>e.check(Qn(1,...t)),e.lowercase=t=>e.check(function(e){return new vr({check:"string_format",format:"lowercase",...pt(e)})}(t)),e.uppercase=t=>e.check(function(e){return new xr({check:"string_format",format:"uppercase",...pt(e)})}(t)),e.trim=()=>e.check(/* @__PURE__ */eo(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){/* @__PURE__ */
|
|
2
|
+
return eo(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(/* @__PURE__ */eo(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(/* @__PURE__ */eo(e=>e.toUpperCase())),e.slugify=()=>e.check(/* @__PURE__ */eo(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Po=/* @__PURE__ */We("ZodString",(e,t)=>{Ar.init(e,t),zo.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...pt(t)})}($o,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...pt(t)})}(Uo,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...pt(t)})}(ri,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...pt(t)})}(Bo,t)),e.guid=t=>e.check(Hn(jo,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...pt(t)})}(Fo,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...pt(t)})}(Fo,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...pt(t)})}(Fo,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...pt(t)})}(Fo,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...pt(t)})}(Wo,t)),e.guid=t=>e.check(Hn(jo,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...pt(t)})}(Go,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...pt(t)})}(Ho,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...pt(t)})}(Zo,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...pt(t)})}(Xo,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...pt(t)})}(ei,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...pt(t)})}(Vo,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...pt(t)})}(qo,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...pt(t)})}(Jo,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...pt(t)})}(Yo,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...pt(t)})}(Ko,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...pt(t)})}(Qo,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...pt(t)})}(ti,t)),e.datetime=t=>e.check(po(t)),e.date=t=>e.check(mo(t)),e.time=t=>e.check(go(t)),e.duration=t=>e.check(wo(t))});function Lo(e){return function(e,t){return new e({type:"string",...pt(t)})}(Po,e)}var Do=/* @__PURE__ */We("ZodStringFormat",(e,t)=>{Mr.init(e,t),zo.init(e,t)}),$o=/* @__PURE__ */We("ZodEmail",(e,t)=>{Rr.init(e,t),Do.init(e,t)}),jo=/* @__PURE__ */We("ZodGUID",(e,t)=>{Or.init(e,t),Do.init(e,t)}),Fo=/* @__PURE__ */We("ZodUUID",(e,t)=>{Nr.init(e,t),Do.init(e,t)}),Uo=/* @__PURE__ */We("ZodURL",(e,t)=>{zr.init(e,t),Do.init(e,t)}),Bo=/* @__PURE__ */We("ZodEmoji",(e,t)=>{Pr.init(e,t),Do.init(e,t)}),Wo=/* @__PURE__ */We("ZodNanoID",(e,t)=>{Lr.init(e,t),Do.init(e,t)}),Go=/* @__PURE__ */We("ZodCUID",(e,t)=>{Dr.init(e,t),Do.init(e,t)}),Ho=/* @__PURE__ */We("ZodCUID2",(e,t)=>{$r.init(e,t),Do.init(e,t)}),Zo=/* @__PURE__ */We("ZodULID",(e,t)=>{jr.init(e,t),Do.init(e,t)}),Vo=/* @__PURE__ */We("ZodXID",(e,t)=>{Fr.init(e,t),Do.init(e,t)}),qo=/* @__PURE__ */We("ZodKSUID",(e,t)=>{Ur.init(e,t),Do.init(e,t)}),Jo=/* @__PURE__ */We("ZodIPv4",(e,t)=>{Zr.init(e,t),Do.init(e,t)}),Yo=/* @__PURE__ */We("ZodIPv6",(e,t)=>{Vr.init(e,t),Do.init(e,t)}),Ko=/* @__PURE__ */We("ZodCIDRv4",(e,t)=>{qr.init(e,t),Do.init(e,t)}),Qo=/* @__PURE__ */We("ZodCIDRv6",(e,t)=>{Jr.init(e,t),Do.init(e,t)}),Xo=/* @__PURE__ */We("ZodBase64",(e,t)=>{Kr.init(e,t),Do.init(e,t)}),ei=/* @__PURE__ */We("ZodBase64URL",(e,t)=>{Qr.init(e,t),Do.init(e,t)}),ti=/* @__PURE__ */We("ZodE164",(e,t)=>{Xr.init(e,t),Do.init(e,t)}),ri=/* @__PURE__ */We("ZodJWT",(e,t)=>{en.init(e,t),Do.init(e,t)}),ni=/* @__PURE__ */We("ZodNumber",(e,t)=>{tn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r,{minimum:o,maximum:i,format:s,multipleOf:a,exclusiveMaximum:l,exclusiveMinimum:c}=e._zod.bag;"string"==typeof s&&s.includes("int")?n.type="integer":n.type="number","number"==typeof c&&("draft-04"===t.target||"openapi-3.0"===t.target?(n.minimum=c,n.exclusiveMinimum=!0):n.exclusiveMinimum=c),"number"==typeof o&&(n.minimum=o,"number"==typeof c&&"draft-04"!==t.target&&(c>=o?delete n.minimum:delete n.exclusiveMinimum)),"number"==typeof l&&("draft-04"===t.target||"openapi-3.0"===t.target?(n.maximum=l,n.exclusiveMaximum=!0):n.exclusiveMaximum=l),"number"==typeof i&&(n.maximum=i,"number"==typeof l&&"draft-04"!==t.target&&(l<=i?delete n.maximum:delete n.exclusiveMaximum)),"number"==typeof a&&(n.multipleOf=a)})(e,t,r),e.gt=(t,r)=>e.check(qn(t,r)),e.gte=(t,r)=>e.check(Jn(t,r)),e.min=(t,r)=>e.check(Jn(t,r)),e.lt=(t,r)=>e.check(Zn(t,r)),e.lte=(t,r)=>e.check(Vn(t,r)),e.max=(t,r)=>e.check(Vn(t,r)),e.int=t=>e.check(si(t)),e.safe=t=>e.check(si(t)),e.positive=t=>e.check(qn(0,t)),e.nonnegative=t=>e.check(Jn(0,t)),e.negative=t=>e.check(Zn(0,t)),e.nonpositive=t=>e.check(Vn(0,t)),e.multipleOf=(t,r)=>e.check(Yn(t,r)),e.step=(t,r)=>e.check(Yn(t,r)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function oi(e){return function(e,t){return new e({type:"number",checks:[],...pt(t)})}(ni,e)}var ii=/* @__PURE__ */We("ZodNumberFormat",(e,t)=>{rn.init(e,t),ni.init(e,t)});function si(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...pt(t)})}(ii,e)}var ai=/* @__PURE__ */We("ZodBoolean",(e,t)=>{nn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.type="boolean"})(0,0,t)});function li(e){return function(e,t){return new e({type:"boolean",...pt(t)})}(ai,e)}var ci=/* @__PURE__ */We("ZodNull",(e,t)=>{on.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"})(0,e,t)});var di=/* @__PURE__ */We("ZodUnknown",(e,t)=>{sn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function ui(){return new di({type:"unknown"})}var pi=/* @__PURE__ */We("ZodNever",(e,t)=>{an.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});function hi(e){return function(e,t){return new e({type:"never",...pt(t)})}(pi,e)}var mi=/* @__PURE__ */We("ZodDate",(e,t)=>{ln.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Date cannot be represented in JSON Schema")})(0,e),e.min=(t,r)=>e.check(Jn(t,r)),e.max=(t,r)=>e.check(Vn(t,r));const r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null}),fi=/* @__PURE__ */We("ZodArray",(e,t)=>{dn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=r,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=no(i.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,e.min=(t,r)=>e.check(Qn(t,r)),e.nonempty=t=>e.check(Qn(1,t)),e.max=(t,r)=>e.check(Kn(t,r)),e.length=(t,r)=>e.check(Xn(t,r)),e.unwrap=()=>e.element});function gi(e,t){return function(e,t,r){return new e({type:"array",element:t,...pt(r)})}(fi,e,t)}var yi=/* @__PURE__ */We("ZodObject",(e,t)=>{fn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=r,i=e._zod.def;o.type="object",o.properties={};const s=i.shape;for(const c in s)o.properties[c]=no(s[c],t,{...n,path:[...n.path,"properties",c]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const r=i.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));l.size>0&&(o.required=Array.from(l)),"never"===i.catchall?._zod.def.type?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=no(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(o.additionalProperties=!1)})(e,t,r,n),et(e,"shape",()=>t.shape),e.keyof=()=>Ei(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ui()}),e.loose=()=>e.clone({...e._zod.def,catchall:ui()}),e.strict=()=>e.clone({...e._zod.def,catchall:hi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!at(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ut(e,rt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return tt(this,"shape",r),r}}))}(e,t),e.safeExtend=t=>function(e,t){if(!at(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ut(e,rt(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return tt(this,"shape",r),r}}))}(e,t),e.merge=t=>{return n=t,ut(r=e,rt(r._zod.def,{get shape(){const e={...r._zod.def.shape,...n._zod.def.shape};return tt(this,"shape",e),e},get catchall(){return n._zod.def.catchall},checks:[]}));var r,n},e.pick=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ut(e,rt(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return tt(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return ut(e,rt(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return tt(this,"shape",n),n},checks:[]}))}(e,t),e.partial=(...t)=>function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return ut(t,rt(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)o[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return tt(this,"shape",o),o},checks:[]}))}(Ni,e,t[0]),e.required=(...t)=>{return r=ji,n=e,o=t[0],ut(n,rt(n._zod.def,{get shape(){const e=n._zod.def.shape,t={...e};if(o)for(const n in o){if(!(n in t))throw new Error(`Unrecognized key: "${n}"`);o[n]&&(t[n]=new r({type:"nonoptional",innerType:e[n]}))}else for(const n in e)t[n]=new r({type:"nonoptional",innerType:e[n]});return tt(this,"shape",t),t}}));var r,n,o}});function wi(e,t){return new yi({type:"object",shape:e??{},...pt(t)})}var bi=/* @__PURE__ */We("ZodUnion",(e,t)=>{yn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,i=!1===o.inclusive,s=o.options.map((e,r)=>no(e,t,{...n,path:[...n.path,i?"oneOf":"anyOf",r]}));i?r.oneOf=s:r.anyOf=s})(e,t,r,n),e.options=t.options});function vi(e,t){return new bi({type:"union",options:e,...pt(t)})}var xi=/* @__PURE__ */We("ZodDiscriminatedUnion",(e,t)=>{bi.init(e,t),wn.init(e,t)});function ki(e,t,r){return new xi({type:"union",options:t,discriminator:e,...pt(r)})}var _i=/* @__PURE__ */We("ZodIntersection",(e,t)=>{bn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,i=no(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=no(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length;r.allOf=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]]})(e,t,r,n)});var Si=/* @__PURE__ */We("ZodRecord",(e,t)=>{kn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=r,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=no(i.valueType,t,{...n,path:[...n.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=no(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=no(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const l=s._zod.values;if(l){const e=[...l].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(o.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function Ci(e,t,r){return new Si({type:"record",keyType:e,valueType:t,...pt(r)})}var Ii=/* @__PURE__ */We("ZodEnum",(e,t)=>{_n.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=qe(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const o={};for(const i of e){if(!r.has(i))throw new Error(`Key ${i} not found in enum`);o[i]=t.entries[i]}return new Ii({...t,checks:[],...pt(n),entries:o})},e.exclude=(e,n)=>{const o={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new Ii({...t,checks:[],...pt(n),entries:o})}});function Ei(e,t){return new Ii({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...pt(t)})}var Ti=/* @__PURE__ */We("ZodLiteral",(e,t)=>{Sn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=e._zod.def,o=[];for(const i of n.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];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else o.every(e=>"number"==typeof e)&&(r.type="number"),o.every(e=>"string"==typeof e)&&(r.type="string"),o.every(e=>"boolean"==typeof e)&&(r.type="boolean"),o.every(e=>null===e)&&(r.type="null"),r.enum=o})(e,t,r),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]}})});function Ai(e,t){return new Ti({type:"literal",values:Array.isArray(e)?e:[e],...pt(t)})}var Mi=/* @__PURE__ */We("ZodTransform",(e,t)=>{Cn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new He(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(bt(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(bt(t))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(e=>(r.value=e,r)):(r.value=o,r)}});function Oi(e){return new Mi({type:"transform",transform:e})}var Ni=/* @__PURE__ */We("ZodOptional",(e,t)=>{En.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>co(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Ri(e){return new Ni({type:"optional",innerType:e})}var zi=/* @__PURE__ */We("ZodExactOptional",(e,t)=>{Tn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>co(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});var Pi=/* @__PURE__ */We("ZodNullable",(e,t)=>{An.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,i=no(o.innerType,t,n),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function Li(e){return new Pi({type:"nullable",innerType:e})}var Di=/* @__PURE__ */We("ZodDefault",(e,t)=>{Mn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;no(o.innerType,t,n),t.seen.get(e).ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});var $i=/* @__PURE__ */We("ZodPrefault",(e,t)=>{Nn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;no(o.innerType,t,n),t.seen.get(e).ref=o.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});var ji=/* @__PURE__ */We("ZodNonOptional",(e,t)=>{Rn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;no(o.innerType,t,n),t.seen.get(e).ref=o.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});var Fi=/* @__PURE__ */We("ZodCatch",(e,t)=>{Pn.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;let i;no(o.innerType,t,n),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")}r.default=i})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});var Ui=/* @__PURE__ */We("ZodPipe",(e,t)=>{Ln.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,i="input"===t.io?"transform"===o.in._zod.def.type?o.out:o.in:o.out;no(i,t,n),t.seen.get(e).ref=i})(e,t,0,n),e.in=t.in,e.out=t.out});function Bi(e,t){return new Ui({type:"pipe",in:e,out:t})}var Wi=/* @__PURE__ */We("ZodReadonly",(e,t)=>{$n.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;no(o.innerType,t,n),t.seen.get(e).ref=o.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});var Gi=/* @__PURE__ */We("ZodCustom",(e,t)=>{Un.init(e,t),Ro.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function Hi(e,t={}){const r=new Gi({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...pt(t)});return r._zod.bag.Class=e,r._zod.check=t=>{t.value instanceof e||t.issues.push({code:"invalid_type",expected:e.name,input:t.value,inst:r,path:[...r._zod.def.path??[]]})},r}function Zi(e,t){return Bi(Oi(e),t)}function Vi(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...pt(t)})}(ni,e)}function qi(e){return function(e,t){return new e({type:"boolean",coerce:!0,...pt(t)})}(ai,e)}function Ji(e){return function(e,t){return new e({type:"date",coerce:!0,...pt(t)})}(mi,e)}Ei(["free","starter","growth","enterprise"]);var Yi,Ki=Ei(["created","active","suspended","pending_approval"]),Qi=Ei(["free","starter","growth","enterprise"]),Xi=Ei(["human","ai"]),es=Ei(["male","female"]),ts=Ei(["active","learning","error"]),rs=wi({vector_index_created:li().nullable(),graph_index_created:li().nullable()}),ns=Ei(["document","video"]),os=Ei(["pending","processing","waiting_review","completed","failed"]),is=(Ei(["pending","running","completed","failed"]),Ei(["pending","running","completed","failed","cancelled"])),ss=Ei(["user","agent"]),as=Ei(["widget","app"]),ls=(Ei(["tell","show","do"]),Ei(["app","website"])),cs=Ei(["widget","slack"]),ds=Ei(["timer","github","slack","teams","jira"]),us=Ei(["user_login","url_visit","update_workspace","create_user","update_user","delete_user","create_agent","update_agent","delete_agent","create_application","update_application","delete_application","create_widget","update_widget","delete_widget","create_knowledge","update_knowledge","delete_knowledge","approve_user","deny_user","request_workspace","widget_question","qa_run_started","start_simulation","create_automation","update_automation","delete_automation","toggle_automation"]),ps=wi({id:oi().optional(),created_at:Ji().optional(),updated_at:Ji().optional()}),hs=wi({file:Hi(File),application_id:Vi().optional()}),ms=wi({id:Vi()}),fs=wi({slug:Lo()}),gs=wi({agent_id:Vi()}),ys=wi({widget_id:Vi()}),ws=wi({simulation_id:Vi()}),bs=wi({application_id:Vi()}),vs=wi({user_id:Vi()}),xs=wi({success:Ai(!0)}),ks=xs.extend({message:Lo()}),_s=(wi({workspace_id:Vi().optional()}),wi({application_id:Vi().optional()}),wi({limit:Vi().optional().default(50),offset:Vi().optional().default(0)})),Ss=e=>wi({items:gi(e),total:oi(),limit:oi(),offset:oi()}),Cs=e=>wi({items:gi(e),count:oi()}),Is=wi({status:Lo(),timestamp:Lo(),service:Lo(),version:Lo(),build:Lo()}),Es=wi({name:Lo(),version:Lo(),build:Lo(),status:Lo(),timestamp:Lo()}),Ts=Ei(["password","oauth"]),As=ps.extend({is_super:li(),status:Ki,email:Lo().email(),external_id:Lo().nullish(),first_name:Lo().nullish(),last_name:Lo().nullish(),password:Lo().nullish(),image_url:Lo().nullish(),prompt_limit:oi().nullish(),last_login_at:Ji().nullish(),auth_method:Ts.nullish()}),Ms=As.partial().extend({email:Lo().email(),password:Lo()}),Os=As.partial(),Ns=wi({users:gi(Ms)}),Rs=wi({users:gi(As.partial())}),zs=(wi({token:Lo()}),ps.extend({name:Lo(),slug:Lo(),status:Ki,package:Qi,ending_date:Ji().nullish(),external_workspace_id:Lo().nullish()})),Ps=zs.partial().extend({name:Lo().min(1)}),Ls=zs.partial(),Ds=Ei(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]),$s=ps.extend({workspace_id:oi(),package:Qi,ending_date:Ji(),stripe_subscription_id:Lo().nullable(),stripe_price_id:Lo().nullable(),status:Ds.default("active").optional()}),js=($s.partial().extend({workspace_id:oi(),package:Qi}),$s.partial(),Ei(["owner","member"])),Fs=ps.extend({workspace_id:oi(),user_id:oi(),role:js}),Us=wi({id:oi(),agent_name:Lo(),image_url:Lo().nullish()}),Bs=ps.extend({workspace_id:oi(),application_id:oi().optional(),file_name:Lo().min(1),file_size:Vi(),file_type:ns,file_url:Lo(),source_url:Lo().nullish(),agents:gi(Us).optional()}),Ws=Ei(["chromium","firefox","webkit"]),Gs=wi({browsers:gi(Ws).default(["chromium"]),parallel:li().default(!1),fail_fast:li().default(!1),timeout_per_browser:oi().int().min(60).max(3600).optional()}),Hs=ps.extend({workspace_id:oi(),user_id:oi(),application_id:oi(),file_name:Lo().min(1),file_size:Vi(),file_type:Lo(),file_url:Lo(),file_path:Lo().nullable(),text_content:Lo().nullish(),additional_instructions:Lo().max(1e3).nullish(),status:os,processing_step:Lo().nullish(),ultimate_goal:Lo().nullish(),browser_config:Gs.nullish()}),Zs=wi({application_id:Vi(),file:Hi(File).optional(),text_content:Lo().optional(),file_name:Lo().optional(),additional_instructions:Lo().max(1e3).optional()}),Vs=ps.extend({qa_flow_id:oi(),workspace_id:oi(),triggered_by:oi(),status:is,browser_type:Ws,browser_config:Gs.nullish(),total_tests:oi().int().nonnegative(),passed_tests:oi().int().nonnegative(),failed_tests:oi().int().nonnegative(),started_at:Ji().nullish(),completed_at:Ji().nullish()}),qs=wi({step:oi(),message:Lo(),timestamp:Lo(),status:Ei(["success","error","info"])}),Js=wi({run_id:oi(),status:Ei(["pending","running","passed","failed","skipped"]),browser_type:Ws.nullish(),progress_log:gi(qs).default([]),error_message:Lo().nullish(),screenshot_url:Lo().nullish(),simulation_id:oi().nullish(),duration_ms:oi().nullish(),started_at:Lo().nullish(),completed_at:Lo().nullish()}),Ys=wi({version:oi().int().positive(),test_title:Lo(),test_objective:Lo(),test_steps:gi(Lo()),expected_outcome:Lo(),priority:Ei(["Low","Medium","High"]),change_type:Ei(["created","modified","self_healed","refined","deleted"]),change_reason:Lo().nullish(),changed_by:oi().nullish(),created_at:Lo(),accepted:li().optional()}),Ks=wi({failure_type:Ei(["locator","assertion","timeout","flow_change","environment"]),failure_message:Lo().nullish(),failure_context:Ci(Lo(),ui()).nullish(),repair_strategy:Lo().nullish(),repair_details:Ci(Lo(),ui()).nullish(),confidence_score:oi().min(0).max(1).nullish(),validation_status:Ei(["pending","validated","failed","rejected"]),simulation_id:oi().nullish(),validation_simulation_id:oi().nullish(),healed_version:oi().nullish(),created_at:Lo()}),Qs=ps.extend({qa_flow_id:oi(),workspace_id:oi(),order_index:oi().int().nonnegative(),test_title:Lo(),test_objective:Lo(),test_steps:gi(Lo()),expected_outcome:Lo(),priority:Ei(["Low","Medium","High"]),is_active:Zi(e=>"number"==typeof e?0!==e:e,li()),current_version:oi().int().positive(),version_history:gi(Ys).nullable(),executions:gi(Js).nullable(),healing_attempts:gi(Ks).nullable(),healing_metadata:Ci(Lo(),ui()).nullish(),last_healed_at:Ji().nullish()}),Xs=(wi({qa_flow_id:oi(),test_title:Lo(),test_objective:Lo(),test_steps:gi(Lo()),expected_outcome:Lo(),priority:Ei(["Low","Medium","High"]).optional()}),wi({ultimateGoal:Lo(),document:Hs,testCases:gi(wi({id:oi(),title:Lo(),prompt:Lo(),objective:Lo(),steps:gi(Lo()),expectedOutcome:Lo(),priority:Ei(["Low","Medium","High"])})),summary:wi({total:oi(),estimatedTime:Lo(),complexity:Ei(["Low","Medium","High"])})})),ea=wi({ultimate_goal:Lo(),test_cases:gi(wi({test_title:Lo(),test_objective:Lo(),test_steps:gi(Lo()),expected_outcome:Lo(),priority:Ei(["Low","Medium","High"])})),summary:wi({total_tests:oi(),high_priority:oi(),medium_priority:oi(),low_priority:oi(),estimated_time_minutes:oi()})}),ta=(ki("event",[wi({event:Ai("response.created"),data:wi({message:Lo()})}),wi({event:Ai("response.progress"),data:wi({message:Lo()})}),wi({event:Ai("response.clear"),data:wi({}).optional()}),wi({event:Ai("response.completed"),data:ea}),wi({event:Ai("error"),data:wi({detail:Lo()})})]),vi([Lo(),oi(),li(),gi(Lo()),function(e,t){return new e({type:"null",...pt(t)})}(ci,Yi)])),ra=(Ei(["created","modified","self_healed","refined","deleted"]),Ei(["locator","assertion","timeout","flow_change","environment"])),na=(Ei(["pending","validated","failed","rejected"]),wi({healing_enabled:li().default(!0),auto_apply:li().default(!1),min_confidence_threshold:oi().min(0).max(1).default(.85),max_healing_attempts:oi().int().min(1).max(5).default(2),last_healing_attempt:Lo().datetime().nullable(),total_healing_attempts:oi().int().default(0),successful_heals:oi().int().default(0)}),wi({failure_type:ra,is_healable:li(),is_actual_bug:li(),failure_message:Lo(),failure_context:Ci(Lo(),ui()),suggested_repair:wi({type:Ei(["update_locator","update_assertion","update_steps","skip_test"]),confidence:oi().min(0).max(1),details:Ci(Lo(),ui())}).nullable()})),oa=(wi({go_to_url:wi({url:Lo(),new_tab:li()})}),wi({click_element_by_index:wi({index:oi().int().min(1)})}),wi({input_text:wi({index:oi(),text:Lo(),clear_existing:li()})}),wi({write_file:wi({file_name:Lo(),content:Lo(),append:li(),trailing_newline:li(),leading_newline:li()})}),wi({get_otp:wi({question:Lo()})}),wi({done:wi({success:li(),message:Lo().optional()})}),wi({wait:wi({seconds:oi()})}),wi({reload_page:wi({})}),wi({open_new_tab:wi({url:Lo()})}),wi({navigate_to_url:wi({url:Lo()})}),Ci(Lo(),ui())),ia=wi({evaluation_previous_goal:Lo().optional().nullable(),memory:Lo().optional().nullable(),next_goal:Lo().optional().nullable(),action:gi(oa).optional().nullable(),thinking:Lo().optional().nullable()}).passthrough(),sa=wi({is_done:li(),success:li().optional().nullable(),long_term_memory:Lo().optional().nullable(),extracted_content:Lo().optional().nullable(),include_extracted_content_only_once:li().optional().nullable(),include_in_memory:li().optional().nullable(),error:Lo().optional().nullable(),metadata:wi({click_x:oi().optional(),click_y:oi().optional(),new_tab_opened:li().optional(),input_x:oi().optional(),input_y:oi().optional()}).passthrough().optional().nullable()}).passthrough(),aa=wi({url:Lo(),title:Lo(),tab_id:Lo().optional(),parent_tab_id:Lo().optional().nullable()}).passthrough(),la=wi({node_id:oi().optional(),backend_node_id:oi().optional(),frame_id:Lo().optional().nullable(),node_type:oi().optional(),node_value:Lo().optional(),node_name:Lo().optional(),attributes:Ci(Lo(),Lo()).optional().nullable(),x_path:Lo().optional(),element_hash:oi().optional(),bounds:wi({x:oi(),y:oi(),width:oi(),height:oi()}).passthrough().optional().nullable(),stable_hash:oi().optional(),ax_name:Lo().optional().nullable()}).passthrough(),ca=wi({tabs:gi(aa),screenshot_path:Lo().nullable(),interacted_element:gi(la.nullable()),url:Lo(),title:Lo()}).passthrough(),da=wi({step_start_time:oi().optional().nullable(),step_end_time:oi().optional().nullable(),step_number:oi().optional().nullable(),step_interval:oi().optional().nullable()}).passthrough(),ua=wi({model_output:ia.nullable(),result:gi(sa),state:ca,metadata:da.nullable(),state_message:Lo().optional().nullable()}).passthrough(),pa=(wi({history:gi(ua)}),wi({step_number:oi().int().positive(),topic:Lo(),screenshot_url:Lo().nullable(),title:Lo().optional().nullable(),url:Lo().optional().nullable()})),ha=wi({status:Lo(),status_message:Lo().nullable(),num_steps:oi().int().nonnegative().nullable(),created_at:Ji()}),ma=ps.extend({application_id:oi(),agent_id:oi(),job_id:Lo(),session_id:Lo().nullish(),status:Lo(),status_message:Lo().nullish(),path:Lo().nullish(),instructions:Lo().nullish(),num_steps:oi().int().nonnegative(),pinned:li().optional(),source:Ei(["direct","qa"]).optional(),agent_name:Lo().nullish(),graph_index_id:Lo().nullish(),progress_log:gi(ha).optional(),agents:gi(Us).optional()}),fa=(wi({user_id:oi(),email:Lo(),first_name:Lo().optional().nullable(),last_name:Lo().optional().nullable(),last_simulation_at:Lo().optional()}),ma.partial().extend({application_id:oi(),agent_id:oi(),instructions:Lo(),max_steps:oi().int().positive().max(1e3).optional(),timeout:oi().positive().max(360).optional()})),ga=wi({job_id:Lo().optional(),status:Lo().optional(),status_message:Lo().optional(),num_steps:oi().int().nonnegative().optional(),pinned:li().optional(),graph_index_id:Lo().optional()}),ya=wi({answer:Lo().min(1)}),wa=ps.extend({session_id:Lo(),chat_id:Lo(),application_id:Vi().nullish(),blob_url:Lo().nullable(),event_count:Vi().int().nonnegative(),started_at:Ji(),ended_at:Ji().nullable(),is_active:Zi(e=>"number"==typeof e?0!==e:e,li()),metadata:wi({userAgent:Lo().optional(),url:Lo().optional()}).nullable(),last_batch_index:Vi().int().nullable(),last_event_timestamp:Vi().int().nullable(),last_upload_time:Ji().nullable()}),ba=wi({session_id:Lo().min(1),chat_id:Lo().min(1),application_id:oi().int().nullish(),blob_url:Lo().nullish(),event_count:oi().int().nonnegative().optional(),started_at:Ji().optional(),ended_at:Ji().nullish(),is_active:Zi(e=>"number"==typeof e?0!==e:e,li()).optional(),metadata:wi({userAgent:Lo().optional(),url:Lo().optional(),applicationId:oi().optional()}).nullable().optional(),last_batch_index:oi().int().nonnegative().nullish(),last_event_timestamp:oi().int().nullish(),last_upload_time:Ji().nullish()}),va=wi({id:oi(),simulation_id:oi(),status:Lo(),status_message:Lo().nullable(),num_steps:oi().int().nonnegative().nullable(),created_at:Ji()}),xa=wi({start:Lo(),end:Lo(),action:Lo()}),ka=wi({id:Lo(),screenshots:gi(Lo()),title:Lo(),url:Lo(),state:gi(Lo()),mentions:gi(Lo())}),_a=wi({nodes:gi(ka),edges:gi(xa)}),Sa=ps.extend({workspace_id:oi(),user_id:oi().nullish(),application_id:oi(),agent_name:Lo(),agent_type:Xi,agent_voice:es,agent_description:Lo().nullish(),instructions:Lo().nullish(),image_url:Lo().nullish(),graph_index_id:Lo().nullish(),vector_store_id:Lo().nullish(),status:ts,status_message:Lo().nullish(),learning_progress:rs.nullish(),learning_started_at:Ji().nullish(),workspace:zs.optional(),user:As.optional(),knowledge:gi(Bs).optional(),simulations:gi(ma).optional(),simulation_count:oi().int().nonnegative().optional(),knowledge_count:oi().int().nonnegative().optional()}),Ca=e=>{if(Array.isArray(e))return e.map(e=>Number(e));if("string"==typeof e){const t=JSON.parse(e);return Array.isArray(t)?t.map(e=>Number(e)):[]}return[]},Ia=vi([gi(oi()),Lo()]).transform(Ca),Ea=vi([gi(oi()),Lo()]).transform(Ca),Ta=Sa.partial().extend({application_id:Vi(),agent_name:Lo(),agent_type:Xi,agent_voice:es,agent_description:Lo(),instructions:Lo(),file:Hi(File).optional(),image_url:Lo().optional(),knowledge_ids:Ia,simulation_ids:Ea}),Aa=Sa.partial().extend({file:Hi(File).optional(),knowledge_ids:Ia,simulation_ids:Ea}),Ma=(wi({text:Lo(),task_id:Lo().optional()}),wi({status:Lo(),message:Lo().optional()}),wi({task_id:Lo().optional(),status:Lo().optional(),current_step:Lo().optional(),error:Lo().optional(),message:Lo().optional()}),wi({workflow_id:Lo(),workflow_type:Lo(),status:Lo(),current_step:Lo(),error:Lo().nullable(),created_at:Lo(),updated_at:Lo()}),wi({session_id:Lo().optional(),live_view_url:Lo().nullish(),status:Lo().optional(),message:Lo().nullish(),success:li().optional()}),Ei(["pending","running","completed","failed","cancelled","has_question","in_progress"]),wi({contentType:Ei(["document","video","automation_log","screenshot","all"]).optional(),context:Lo().optional(),previousActions:gi(Lo()).optional(),top:Vi().min(1).max(100).optional(),minConfidence:Vi().min(0).max(1).optional(),entities:gi(Lo()).optional(),useVectorSearch:li().optional(),vectorThreshold:Vi().min(0).max(1).optional()}),wi({id:Lo(),content:Lo(),contentType:Ei(["document","video","automation_log","screenshot"]),sourceFile:Lo(),sourceType:Lo(),metadata:Lo(),confidence:oi(),keyPhrases:gi(Lo()),entities:gi(Lo()),sentiment:Lo(),vectorContent:gi(oi())})),Oa=(wi({document:Ma,score:oi(),highlights:Ci(Lo(),gi(Lo())).optional()}),wi({simulation_id:Vi().positive("Simulation ID must be a positive number")})),Na=wi({agent:Sa,simulation_id:oi(),knowledge_id:oi(),message:Lo()}),Ra=ps.extend({workspace_id:oi(),name:Lo(),type:ls,url:Lo().nullish(),username:Lo().nullish(),password:Lo().nullish(),allowed_domains:gi(Lo()).nullish().default([])}),za=Ra.partial().extend({type:ls,name:Lo().min(1),url:Lo(),allowed_domains:gi(Lo()).optional().default([])}),Pa=Ra.partial().omit({workspace_id:!0}),La=wi({chip_mode:Ei(["show","tell","do"]),chip_text:Lo()}),Da=wi({widget_enabled:li(),widget_appearance:Ei(["default","compact","full"]),widget_position:Ei(["bottom_left","bottom_right","top_left","top_right"]),widget_device:Ei(["desktop","mobile","desktop_mobile"]),widget_header:Lo(),widget_body:Lo(),widget_greeting:Lo(),widget_feature_tell:li(),widget_feature_show:li(),widget_feature_do:li(),widget_feature_human:li(),widget_background_color:Lo(),widget_text_color:Lo(),widget_border_color:Lo(),widget_accent_color:Lo(),widget_secondary_color:Lo(),widget_border_radius:Lo(),widget_font_size:Lo(),widget_width:Lo(),widget_height:Lo(),widget_shadow:Lo(),widget_animation_duration:Lo(),widget_fade_duration:Lo(),widget_bounce_effect:li(),widget_chips:gi(La)}),$a=wi({webhook_url:Lo().url(),channel:Lo(),bot_token:Lo(),notifications_enabled:li()}),ja=ps.extend({application_id:oi(),agent_id:oi(),type:cs,settings:vi([Da,$a]),status:Ki,marketrix_id:Lo(),marketrix_key:Lo(),snippet:Lo().nullish()}),Fa=(ja.extend({application:Ra.partial(),workspace:zs.partial(),user:As.partial(),agent:Sa.partial()}),ja.extend({agent:Sa.partial().optional()})),Ua=(Ra.extend({widgets:gi(ja).optional(),agents:gi(Sa).optional()}),ja.partial().extend({application_id:oi().positive(),agent_id:oi().positive(),type:cs,settings:vi([Da,$a]).optional()})),Ba=ja.partial(),Wa=ps.extend({widget_id:oi(),url_pattern:Lo(),message:vi([Lo(),gi(Lo())]),description:Lo().optional()}),Ga=Wa.partial().extend({widget_id:oi().positive(),url_pattern:Lo().min(1),message:vi([Lo().min(1),gi(Lo().min(1)).min(1)])}),Ha=Wa.partial(),Za=gi(wi({step_number:oi(),action:Lo(),element:Lo(),text:Lo(),description:Lo(),selector:Lo()})),Va=ps.extend({application_id:oi(),question:Lo(),answer:Za}),qa=(wi({marketrix_id:Lo().optional(),marketrix_key:Lo().optional(),agent_id:oi().positive().optional(),application_id:oi().positive().optional(),chat_id:Lo().optional(),content:Lo()}).refine(e=>(e.marketrix_id&&e.marketrix_key)??(e.agent_id&&e.application_id),{message:"Either marketrix_id + marketrix_key or both agent_id + application_id must be provided"}),wi({text:Lo(),task_id:Lo().optional()}),ki("type",[wi({type:Ai("registered"),chat_id:Lo(),application_id:oi().optional()}),wi({type:Ai("pong")}),wi({type:Ai("heartbeat")}),wi({type:Ai("chat/response"),request_id:Lo(),text:Lo(),task_id:Lo().optional()}),wi({type:Ai("chat/error"),request_id:Lo(),error:Lo()}),wi({type:Ai("task/status"),status:Ei(["started","completed","failed","stopped"]),message:Lo().optional(),task_id:Lo().optional(),timestamp:oi().optional()}),wi({type:Ai("tool/call"),call_id:Lo(),tool:Lo(),args:Ci(Lo(),ui()),mode:Ei(["show","do"]).optional(),explanation:Lo().optional(),state_version:oi().optional()})])),Ja=ki("type",[wi({type:Ai("chat/tell"),request_id:Lo(),content:Lo()}),wi({type:Ai("chat/show"),request_id:Lo(),content:Lo()}),wi({type:Ai("chat/do"),request_id:Lo(),content:Lo()}),wi({type:Ai("chat/stop"),task_id:Lo().optional()}),wi({type:Ai("tool/response"),call_id:Lo(),success:li(),data:Lo().optional(),error:Lo().optional(),state_version:oi().optional()}),wi({type:Ai("ping")}),wi({type:Ai("rrweb/metadata"),session_id:Lo(),chat_id:Lo(),application_id:oi(),url:Lo().optional(),user_agent:Lo().optional(),timestamp:oi().optional()}),wi({type:Ai("rrweb/events"),session_id:Lo(),events:gi(ui())})]),Ya=Ei(["simulations","agents","qa","user","jobs"]),Ka=ki("type",[wi({type:Ai("simulation/updated"),simulation_id:oi(),application_id:oi(),status:Lo(),step_label:Lo().optional()}),wi({type:Ai("simulation/created"),simulation_id:oi(),application_id:oi()}),wi({type:Ai("simulation/deleted"),simulation_id:oi(),application_id:oi()}),wi({type:Ai("agent/updated"),agent_id:oi(),application_id:oi(),status:Lo()}),wi({type:Ai("agent/created"),agent_id:oi(),application_id:oi()}),wi({type:Ai("agent/deleted"),agent_id:oi(),application_id:oi()}),wi({type:Ai("qa-document/updated"),document_id:oi(),application_id:oi(),status:Lo(),step_label:Lo().optional()}),wi({type:Ai("qa-run/updated"),run_id:oi(),document_id:oi(),application_id:oi(),status:Lo()}),wi({type:Ai("qa-test/updated"),test_id:oi(),run_id:oi(),document_id:oi(),application_id:oi(),status:Lo()}),wi({type:Ai("user/updated"),user_id:oi(),workspace_id:oi(),status:Lo()}),wi({type:Ai("job/progress"),job_id:Lo(),application_id:oi(),status:Lo(),message:Lo().optional()}),wi({type:Ai("job/completed"),job_id:Lo(),application_id:oi(),result:ui().optional()}),wi({type:Ai("job/failed"),job_id:Lo(),application_id:oi(),error:Lo()})]),Qa=wi({details:Lo().optional(),id:oi().optional(),type:Lo().optional(),name:Lo().optional(),target_user_id:oi().optional(),target_user_email:Lo().optional(),reason:Lo().optional(),assigned_role:Lo().optional(),new_role:Lo().optional(),previous_role:Lo().optional(),workspace_name:Lo().optional(),workspace_slug:Lo().optional(),ip_address:Lo().optional(),user_agent:Lo().optional(),widget_type:Lo().optional(),created_by:oi().optional()}).passthrough(),Xa=ps.extend({workspace_id:oi(),user_id:oi(),type:us,metadata:Qa.optional()}),el=Xa.partial().extend({type:us}),tl=(ps.extend({user_id:oi(),application_id:oi(),agent_id:oi(),chat_id:Lo(),role:ss,source:as,message:Lo()}),ps.extend({workspace_id:oi(),provider:ds,name:Lo().min(1).max(120),identifier:Lo().max(120).nullish(),api_endpoint:Lo().url().nullish(),api_token:Lo().nullish(),metadata:Ci(Lo(),ui()).nullish(),is_active:li().default(!0),status:Ki.default("active")})),rl=wi({id:Vi().optional(),provider:ds,name:Lo().min(1).max(120),identifier:Lo().max(120).nullish(),api_endpoint:Lo().url().nullish(),api_token:Lo().nullish(),metadata:Ci(Lo(),ui()).nullish(),is_active:li().optional(),status:Ki.optional()}),nl=wi({provider:ds.optional(),status:Ki.optional(),is_active:qi().optional(),limit:Vi().int().positive().max(100).optional(),offset:Vi().int().nonnegative().optional()}),ol=wi({id:oi(),full_name:Lo(),name:Lo(),private:li(),html_url:Lo(),default_branch:Lo().optional()}),il=wi({id:oi(),name:Lo(),status:Lo(),conclusion:Lo().nullable(),created_at:Lo(),updated_at:Lo(),html_url:Lo(),head_branch:Lo(),run_attempt:oi()}),sl=Ei(["pending","running","completed","failed","stopped"]),al=(Ei(["connector","condition"]),ki("kind",[wi({kind:Ai("connector"),connector_type:Lo().min(1),connector_id:oi().nullable().optional(),capability:Lo().min(1),role:Ei(["trigger","callback"]),config:Ci(Lo(),ui()).default({})}),wi({kind:Ai("condition"),config:wi({field:Lo().min(1),operator:Ei(["equals","not_equals","contains","gt","lt"]),value:ui()})})])),ll=wi({from:Lo().min(1),to:Lo().min(1),when:Ei(["true","false"]).optional()}),cl=wi({nodes:Ci(Lo(),al),edges:gi(ll)}),dl=Ei(["skip","queue","replace"]).default("skip"),ul=ps.extend({workspace_id:oi(),name:Lo(),graph:cl,concurrency:dl,enabled:li(),last_run_at:Ji().nullable(),next_run_at:Ji().nullable()}),pl=wi({name:Lo().min(1).max(255),graph:cl,concurrency:dl.optional(),enabled:li().optional()}),hl=wi({id:Vi(),name:Lo().min(1).max(255).optional(),graph:cl.optional(),enabled:li().optional()}),ml=wi({enabled:qi().optional(),limit:Vi().int().positive().max(100).optional(),offset:Vi().int().nonnegative().optional()}),fl=wi({status:Ei(["completed","failed","skipped","stopped"]),output:Ci(Lo(),ui()).nullable().optional(),error:Lo().nullable().optional(),duration_ms:oi().optional()}),gl=wi({id:oi().optional(),automation_id:oi(),status:sl,trigger_node_id:Lo(),trigger_data:Ci(Lo(),ui()).nullable(),node_results:Ci(Lo(),fl),started_at:Ji(),completed_at:Ji().nullable()}),yl=wi({status:sl.optional(),limit:Vi().int().positive().max(100).optional(),offset:Vi().int().nonnegative().optional()}),wl=wi({connector_type:Lo(),built_in:li(),triggers:gi(wi({capability:Lo(),description:Lo(),config_schema:Ci(Lo(),ui())})),callbacks:gi(wi({capability:Lo(),description:Lo(),config_schema:Ci(Lo(),ui())}))}),bl=wi({migration_type:Lo().optional(),dry_run:li().default(!0)}),vl=wi({migration_type:Lo().optional(),backup:li().default(!0)}),xl=wi({url:Lo()}),kl=(wi({user_id:oi(),file:Hi(File)}),wi({user_id:oi(),application_id:oi(),source:as,prompt:Lo(),status:Lo()}),wi({user_id:oi(),limit:oi(),used:oi(),remaining:oi()})),_l=(wi({user_id:oi(),workspace_id:oi(),chat_count:oi(),prompt_text:Lo(),metadata:Ci(Lo(),Lo()).optional()}),wi({to:Lo(),subject:Lo(),template:Lo(),context:Ci(Lo(),Lo())}),wi({id:Lo(),object:Ai("event"),api_version:Lo().nullish(),created:oi(),data:wi({object:Ci(Lo(),ui()),previous_attributes:Ci(Lo(),ui()).optional()}),livemode:li(),pending_webhooks:oi(),request:wi({id:Lo().nullable(),idempotency_key:Lo().nullable()}).nullable().optional(),type:Lo()}),wi({priceId:Lo().min(1,"Price ID is required"),successUrl:Lo().url("Success URL must be a valid URL"),cancelUrl:Lo().url("Cancel URL must be a valid URL")})),Sl=wi({returnUrl:Lo().url("Return URL must be a valid URL")}),Cl=wi({plan:Ei(["starter","growth"]).default("starter"),interval:Ei(["month","year"]).default("month")}),Il=wi({subscriptionId:Lo().min(1,"Subscription ID is required"),priceId:Lo().min(1,"Price ID is required")}),El=wi({success:li(),message:Lo()}),Tl=wi({subscriptionId:Lo().nullable(),customerId:Lo().nullable(),status:Ei(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]).nullable(),planTier:Ei(["free","starter","growth","enterprise"]).nullable(),billingInterval:Ei(["month","year"]).nullable(),priceId:Lo().nullable(),trialEndDate:Ji().nullable(),currentPeriodStart:Ji().nullable(),currentPeriodEnd:Ji().nullable(),cancelAtPeriodEnd:li(),isTrialing:li(),daysRemainingInTrial:oi().nullable(),trialProvisioned:li()}),Al=wi({sessionId:Lo(),url:Lo().url()}),Ml=wi({url:Lo().url()}),Ol=wi({subscriptionId:Lo(),customerId:Lo(),status:Ai("trialing"),trialStartDate:Ji(),trialEndDate:Ji(),planTier:Ei(["starter","growth"]),daysRemainingInTrial:oi()}),Nl=wi({used:oi().int().min(0),limit:oi().int()}),Rl=wi({applications:Nl,simulationsPerMonth:Nl,userPrompts:Nl}),zl=wi({amount:oi().int().min(0),currency:Lo().default("usd"),formatted:Lo()}),Pl=wi({planId:Ei(["free","starter","growth","enterprise"]),monthly:zl.nullable(),annual:zl.nullable(),priceIds:wi({monthly:Lo().nullable(),annual:Lo().nullable()})}),Ll=wi({plans:gi(Pl),lastUpdated:Lo().datetime()}),Dl=wi({id:Ei(["free","starter","growth","enterprise"]),name:Lo(),description:Lo(),features:gi(Lo()),cta:Lo(),isPopular:li(),customPriceDisplay:Lo().optional(),priceSubtext:Lo().optional(),borderColor:Lo(),buttonColor:Lo(),outlineColor:Lo(),checkColor:Lo()}),$l=wi({plans:gi(Dl)}),jl=wi({publishableKey:Lo(),priceIds:wi({starter:wi({monthly:Lo().nullable(),annual:Lo().nullable()}),growth:wi({monthly:Lo().nullable(),annual:Lo().nullable()})}),trialDays:oi().int().min(0),calendlyUrl:Lo()}),Fl=wi({widgetKey:Lo(),widgetId:Lo(),widgetUrl:Lo()}),Ul=wi({date:Lo().describe("YYYY-MM-DD"),sessions:oi().int().nonnegative(),events:oi().int().nonnegative()}),Bl=wi({items:gi(Ul)}),Wl=wi({role:Ei(["user","assistant","system"]),content:Lo(),timestamp:Lo().optional()}),Gl=ps.extend({workspace_id:oi(),application_id:oi().nullish(),agent_id:oi().nullish(),simulation_id:oi().nullish(),chat_id:Lo(),chat_content:Lo().nullish(),chat_history:gi(Wl).nullish(),chat_output:Lo().nullish(),preview_video_url:Lo().nullish(),metadata:Ci(Lo(),ui()).nullish()}),Hl=wi({application_id:oi().nullish(),agent_id:oi().nullish(),simulation_id:oi().nullish(),chat_id:Lo(),chat_content:Lo().nullish(),chat_history:gi(Wl).nullish(),chat_output:Lo().nullish(),preview_video_url:Lo().nullish(),metadata:Ci(Lo(),ui()).nullish()}),Zl=wi({chat_id:Lo().optional(),agent_id:oi().optional(),simulation_id:oi().optional(),limit:oi().optional(),offset:oi().optional()}),Vl=class extends Error{issues;data;constructor(e){super(e.message,e),this.issues=e.issues,this.data=e.data}};function ql(e,t){return{...e,...t}}var Jl=class{"~orpc";constructor(e){if(e.route?.successStatus&&ne(e.route.successStatus))throw new Error("[ContractProcedure] Invalid successStatus.");if(Object.values(e.errorMap).some(e=>e&&e.status&&!ne(e.status)))throw new Error("[ContractProcedure] Invalid error status code.");this["~orpc"]=e}};function Yl(e,t){let r=e;return t.prefix&&(r=function(e,t){return e.path?{...e,path:`${t}${e.path}`}:e}(r,t.prefix)),t.tags?.length&&(r=function(e,t){return{...e,tags:[...t,...e.tags??[]]}}(r,t.tags)),r}function Kl(e,t){if((r=e)instanceof Jl||("object"==typeof r||"function"==typeof r)&&null!==r&&"~orpc"in r&&"object"==typeof r["~orpc"]&&null!==r["~orpc"]&&"errorMap"in r["~orpc"]&&"route"in r["~orpc"]&&"meta"in r["~orpc"])return new Jl({...e["~orpc"],errorMap:ql(t.errorMap,e["~orpc"].errorMap),route:Yl(e["~orpc"].route,t)});var r;const n={};for(const o in e)n[o]=Kl(e[o],t);return n}var Ql=new class e extends Jl{constructor(e){super(e),this["~orpc"].prefix=e.prefix,this["~orpc"].tags=e.tags}$meta(t){return new e({...this["~orpc"],meta:t})}$route(t){return new e({...this["~orpc"],route:t})}$input(t){return new e({...this["~orpc"],inputSchema:t})}errors(t){return new e({...this["~orpc"],errorMap:ql(this["~orpc"].errorMap,t)})}meta(t){return new e({...this["~orpc"],meta:(r=this["~orpc"].meta,n=t,{...r,...n})});var r,n}route(t){return new e({...this["~orpc"],route:(r=this["~orpc"].route,n=t,{...r,...n})});var r,n}input(t){return new e({...this["~orpc"],inputSchema:t})}output(t){return new e({...this["~orpc"],outputSchema:t})}prefix(t){return new e({...this["~orpc"],prefix:(r=this["~orpc"].prefix,n=t,r?`${r}${n}`:n)});var r,n}tag(...t){return new e({...this["~orpc"],tags:(r=this["~orpc"].tags,n=t,r?[...r,...n]:n)});var r,n}router(e){return Kl(e,this["~orpc"])}}({errorMap:{},route:{},meta:{}}),Xl=Symbol("ORPC_EVENT_ITERATOR_DETAILS");function ec(e,t){return{"~standard":{[Xl]:{yields:e,returns:t},vendor:"orpc",version:1,validate:r=>U(r)?{value:ve(r,{async value(r,n){const o=n?t:e;if(!o)return r;const i=await o["~standard"].validate(r);if(i.issues)throw new re("EVENT_ITERATOR_VALIDATION_FAILED",{message:"Event iterator validation failed",cause:new Vl({issues:i.issues,message:"Event iterator validation failed",data:r})});return i.value},error:async e=>e})}:{issues:[{message:"Expect event iterator",path:[]}]}}}}Ql.route({method:"GET",tags:["Root"],path:"/",summary:"Get API index information and basic system details",description:"Returns general API information, version, and available endpoints"}).output(Es),Ql.route({method:"GET",tags:["Internal"],path:"/health",summary:"Health check endpoint for monitoring system status",description:"Returns current system health, database connectivity, and service status"}).output(Is),Ql.route({method:"GET",tags:["Root"],path:"/validate-url",summary:"Validate URL accessibility and DNS resolution",description:"Validates a URL for format, DNS resolution, and HTTP accessibility"}).input(wi({url:Lo().url(),skip_network:Lo().optional()})).output(wi({valid:li(),accessible:li(),dnsResolves:li(),error:Lo().optional().describe("Error message if URL validation failed"),warnings:gi(Lo()).optional().describe("Non-fatal issues found during URL validation")})),Ql.route({method:"GET",tags:["Root"],path:"/config/public",summary:"Get public client configuration",description:"Returns widget key and widget ID. No auth. Values are stored in backend env only."}).output(Fl),Ql.route({method:"GET",tags:["Auth"],path:"/auth/me",summary:"Get current authenticated user and workspace information",description:"Returns user profile and workspace data based on session cookie"}).output(wi({user:As,workspace:zs.nullable(),workspaces:gi(wi({id:oi(),name:Lo(),slug:Lo(),role:Ei(["owner","member"])}))})),Ql.route({method:"GET",tags:["Auth"],path:"/email-action/{token}",summary:"Process email approval/rejection action",description:"Handles approve/reject links from admin emails. Token-in-URL authentication (no session required). Returns an HTML page, not JSON."}).input(wi({token:Lo().min(1)})).output(wi({result:Lo().describe("HTML response page")})),Ql.route({method:"POST",tags:["Onboarding"],path:"/onboard",summary:"Complete user onboarding in one atomic operation",description:"Creates workspace, updates user status, and invites team members"}).input(wi({name:Lo().min(1).max(45),slug:Lo().min(1).max(45).optional(),domain:Lo().min(1).max(200),team_emails:gi(Lo().email()).optional().default([]),app_url:Lo().optional(),app_username:Lo().optional(),app_password:Lo().optional()})).output(wi({workspace:zs})),Ql.route({method:"POST",tags:["Workspace"],path:"/workspaces",summary:"Create a new workspace",description:"Creates new workspace with specified settings and returns workspace entity"}).input(Ps).output(zs),Ql.route({method:"GET",tags:["Workspace"],path:"/workspaces",summary:"Search and filter workspaces by various criteria",description:"Returns list of workspaces matching search parameters (name, domain, email, etc.)"}).input(wi({name:Lo().optional(),domain:Lo().optional(),email:Lo().email().optional(),app_id:Vi().optional(),workspace_id:Vi().optional(),user_id:Vi().optional()}).extend(_s.shape)).output(Ss(zs)),Ql.route({method:"GET",tags:["Workspace"],path:"/workspaces/lookup/{slug}",summary:"Look up workspace by slug for onboarding",description:"Returns workspace name and slug for join-workspace flow. Requires onboarding-level auth."}).input(fs).output(wi({name:Lo(),slug:Lo()}).nullable()),Ql.route({method:"GET",tags:["Workspace"],path:"/workspaces/{slug}",summary:"Get specific workspace details by slug",description:"Returns complete workspace information including settings and configuration"}).input(fs).output(zs),Ql.route({method:"PUT",tags:["Workspace"],path:"/workspaces/{slug}",summary:"Update workspace settings and configuration",description:"Modifies workspace properties like name, domain, or feature settings"}).input(Ls.extend({slug:Lo()})).output(zs),Ql.route({method:"DELETE",tags:["Workspace"],path:"/workspaces/{slug}",summary:"Delete workspace and all associated data",description:"Permanently deletes a workspace and cleans up all related resources. This action cannot be undone."}).input(fs).output(xs),Ql.route({method:"GET",tags:["Workspace"],path:"/workspaces/{slug}/members",summary:"List workspace members",description:"Returns all members of the workspace with their user profile details and roles."}).input(fs).output(Cs(Fs.extend({user:As.pick({id:!0,email:!0,first_name:!0,last_name:!0,image_url:!0})}))),Ql.route({method:"POST",tags:["Workspace"],path:"/workspaces/{slug}/members",summary:"Add member to workspace",description:"Invites a user by email to join the workspace with the specified role. Defaults to member role."}).input(fs.extend({email:Lo().email(),role:js.default("member")})).output(Fs),Ql.route({method:"DELETE",tags:["Workspace"],path:"/workspaces/{slug}/members/{user_id}",summary:"Remove member from workspace",description:"Removes a user from the workspace by user_id. The user loses access immediately."}).input(fs.extend({user_id:oi()})).output(xs),Ql.route({method:"PATCH",tags:["Workspace"],path:"/workspaces/{slug}/members/{user_id}",summary:"Update member role",description:"Changes the role of a workspace member. Valid roles: owner, member."}).input(fs.extend({user_id:oi(),role:js})).output(Fs),Ql.route({method:"GET",tags:["Workspace"],path:"/users/me/workspaces",summary:"List workspaces for current user",description:"Returns all workspaces the authenticated user belongs to, including their role in each."}).output(Cs(zs.extend({role:js}))),Ql.route({method:"POST",path:"/admin/reconcile",tags:["Internal"],summary:"Reconcile Stripe customers and WorkOS users",description:"Backfills missing Stripe customer IDs for workspaces and real WorkOS user IDs for users. Idempotent and safe to run repeatedly. Requires super user role."}).output(wi({workspaces_stripe_created:oi(),users_workos_created:oi(),workspace_plans_synced:oi(),trials_provisioned:oi(),stripe_plans_refreshed:oi(),workos_profiles_synced:oi(),errors:gi(wi({type:Lo(),id:oi(),error:Lo()}))})),Ql.route({method:"POST",path:"/admin/maintenance",tags:["Internal"],summary:"Run periodic maintenance cleanup tasks",description:"Cleans up orphaned CosmosDB containers, QA simulations not linked to existing runs, and orphaned blob storage files. Idempotent and safe to run repeatedly. Requires super user role."}).output(wi({cosmos_containers_deleted:oi(),orphaned_qa_simulations_deleted:oi(),orphaned_blob_dirs_deleted:oi(),errors:gi(wi({type:Lo(),detail:Lo()}))})),Ql.route({method:"POST",path:"/admin/rebuild",tags:["Internal"],summary:"Rebuild all agent indexes after cleanup",description:"Removes stale knowledge (missing files), stale simulations (0 steps or missing blobs), then deletes and recreates vector stores and knowledge graphs for every agent. Index creation is async. Requires super user role."}).output(wi({knowledge_removed:oi(),simulations_removed:oi(),agents_rebuilt:oi(),errors:gi(wi({type:Lo(),detail:Lo()}))})),Ql.route({method:"POST",tags:["Application"],path:"/applications",summary:"Create a new application",description:"Creates a new application for the authenticated workspace and returns the created entity."}).input(za).output(Ra),Ql.route({method:"GET",tags:["Application"],path:"/applications",summary:"Search applications for workspace",description:"Returns applications for the authenticated workspace, optionally filtered by type, always includes widgets"}).input(wi({type:ls.optional(),include:gi(Ei(["widgets"])).optional()}).extend(_s.shape)).output(Ss(Ra.extend({widgets:gi(ja).optional()}))),Ql.route({method:"GET",tags:["Application"],path:"/applications/{application_id}",summary:"Get application by ID",description:"Returns specific application details by ID, always includes widgets"}).input(bs).output(Ra.extend({widgets:gi(ja)})),Ql.route({method:"PUT",tags:["Application"],path:"/applications/{application_id}",summary:"Update application",description:"Updates application details and configuration"}).input(Pa.extend({application_id:Vi()})).output(Ra),Ql.route({method:"DELETE",tags:["Application"],path:"/applications/{application_id}",summary:"Delete application",description:"Permanently deletes an application and all associated widgets. This action cannot be undone."}).input(bs).output(xs),Ql.route({method:"POST",tags:["Widget"],path:"/widgets",summary:"Create a new widget",description:"Creates a new widget for an application and returns the created entity. Requires an application_id."}).input(Ua).output(ja),Ql.route({method:"GET",tags:["Widget"],path:"/widgets",summary:"Search widgets for workspace",description:"Search widgets by type, application, marketrix_id, or marketrix_key"}).input(wi({type:cs.optional(),application_id:Vi().optional(),marketrix_id:Lo().optional(),marketrix_key:Lo().optional(),include:gi(Ei(["agent"])).optional()}).extend(_s.shape)).output(Ss(Fa)),Ql.route({method:"GET",tags:["Widget"],path:"/widgets/defaults/{type}",summary:"Get default settings for widget type",description:"Returns default settings for the specified widget type"}).input(wi({type:cs})).output(vi([Da,$a])),Ql.route({method:"GET",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Get widget by ID",description:"Returns specific widget details by widget ID including snippet code"}).input(ys).output(ja),Ql.route({method:"PUT",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Update widget",description:"Updates widget settings and configuration"}).input(Ba.extend({widget_id:Vi()})).output(ja),Ql.route({method:"DELETE",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Delete widget",description:"Permanently deletes a widget from an application. This action cannot be undone."}).input(ys).output(xs),Ql.route({method:"POST",tags:["Chat"],path:"/chat",summary:"Create a new chat thread",description:"Initializes new chat thread and returns session ID"}).output(Lo()),Ql.route({method:"GET",tags:["Chat"],path:"/chat",summary:"Search chats by user",description:"Returns chat list and quota for the specified user"}).input(wi({user_id:Vi().optional(),chat_id:Vi().optional()})).output(kl),Ql.route({method:"POST",tags:["Chat"],path:"/preview-video-chat",summary:"Create or update preview video chat record",description:"Persists guide preview chat content, history, output, and related simulation metadata"}).input(Hl).output(Gl),Ql.route({method:"GET",tags:["Chat"],path:"/preview-video-chat",summary:"Search preview video chat records",description:"Returns preview chat records filtered by chat_id, agent_id, or simulation_id for current workspace"}).input(Zl).output(Cs(Gl)),Ql.route({method:"GET",tags:["Chat"],path:"/preview-video-chat/{id}",summary:"Get preview video chat record by ID",description:"Returns a single preview chat record for current workspace"}).input(ms).output(Gl.nullable()),Ql.route({method:"POST",tags:["Connector"],path:"/connector",summary:"Create or update connector",description:"Stores provider credentials and API endpoint details for workspace connectors"}).input(rl).output(tl),Ql.route({method:"GET",tags:["Connector"],path:"/connector",summary:"Search connectors",description:"Returns workspace connectors filtered by provider/status"}).input(nl).output(Ss(tl)),Ql.route({method:"GET",tags:["Connector"],path:"/connector/{id}",summary:"Get connector by ID",description:"Returns a single workspace connector"}).input(ms).output(tl.nullable()),Ql.route({method:"DELETE",tags:["Connector"],path:"/connector/{id}",summary:"Delete connector",description:"Permanently deletes a connector for current workspace. This action cannot be undone."}).input(ms).output(xs),Ql.route({method:"GET",tags:["Connector"],path:"/connector/{id}/github/repos",summary:"List GitHub repositories for a GitHub connector",description:"Uses the stored GitHub PAT from the connector to call GitHub /user/repos."}).input(wi({id:Vi(),per_page:Vi().int().min(1).max(100).optional(),page:Vi().int().min(1).optional()})).output(gi(ol)),Ql.route({method:"GET",tags:["Connector"],path:"/connector/{id}/github/repos/{owner}/{repo}/actions/runs",summary:"List GitHub Actions workflow runs",description:"Lists workflow runs for a repository (pass/fail status)."}).input(wi({id:Vi(),owner:Lo().min(1),repo:Lo().min(1),per_page:Vi().int().min(1).max(100).optional(),page:Vi().int().min(1).optional()})).output(gi(il)),Ql.route({method:"POST",tags:["Automation"],path:"/automation",summary:"Create automation",description:"Creates a DAG-based automation workflow"}).input(pl).output(ul),Ql.route({method:"GET",tags:["Automation"],path:"/automation",summary:"List automations",description:"Returns automations for the current workspace"}).input(ml).output(Ss(ul)),Ql.route({method:"GET",tags:["Automation"],path:"/automation/{id}",summary:"Get automation",description:"Returns a single automation with its graph"}).input(ms).output(ul.nullable()),Ql.route({method:"PUT",tags:["Automation"],path:"/automation/{id}",summary:"Update automation",description:"Updates automation graph and settings"}).input(hl).output(ul),Ql.route({method:"DELETE",tags:["Automation"],path:"/automation/{id}",summary:"Delete automation",description:"Permanently deletes an automation and deregisters its triggers"}).input(ms).output(xs),Ql.route({method:"PATCH",tags:["Automation"],path:"/automation/{id}/toggle",summary:"Toggle automation",description:"Enable or disable an automation"}).input(wi({id:Vi(),enabled:li()})).output(ul),Ql.route({method:"POST",tags:["Automation"],path:"/automation/{id}/run",summary:"Trigger automation run",description:"Manually triggers an automation run"}).input(ms).output(gl.nullable()),Ql.route({method:"GET",tags:["Automation"],path:"/automation/{id}/runs",summary:"List automation runs",description:"Returns execution history for an automation"}).input(wi({id:Vi()}).extend(yl.shape)).output(Ss(gl)),Ql.route({method:"GET",tags:["Automation"],path:"/automation/{id}/runs/{run_id}",summary:"Get automation run",description:"Returns a single run with per-node results"}).input(wi({id:Vi(),run_id:Vi()})).output(gl.nullable()),Ql.route({method:"GET",tags:["Connector"],path:"/connector-capabilities",summary:"List connector capabilities",description:"Returns available triggers and callbacks per connector type"}).input(wi({})).output(gi(wl)),Ql.route({method:"GET",tags:["User"],path:"/user",summary:"Search and filter users by workspace",description:"Returns list of users associated with specified workspace"}).input(wi({workspace_id:Vi().optional(),status:Ki.optional()}).extend(_s.shape)).output(Ss(As)),Ql.route({method:"POST",tags:["User"],path:"/user/batch",summary:"Create multiple users in batch operation",description:"Processes bulk user creation and returns results for each user"}).input(Ns).output(gi(Rs)),Ql.route({method:"GET",tags:["User"],path:"/user/{user_id}",summary:"Get specific user details by ID",description:"Returns complete user information including profile and settings"}).input(vs).output(As),Ql.route({method:"PUT",tags:["User"],path:"/user/{user_id}",summary:"Update user profile and settings",description:"Modifies user properties like name, email, or preferences"}).input(Os.extend({user_id:Vi()})).output(As),Ql.route({method:"PUT",tags:["User"],path:"/user/{user_id}/image",summary:"Upload and update user profile image",description:"Handles file upload for user avatar and returns upload response"}).input(hs.extend({user_id:Vi()})).output(xl),Ql.route({method:"DELETE",tags:["User"],path:"/user/{user_id}",summary:"Delete user account and all associated data",description:"Permanently deletes a user account and cleans up all related resources. This action cannot be undone."}).input(vs).output(xs),Ql.route({method:"POST",tags:["User"],path:"/user/{user_id}/deactivate",summary:"Deactivate user account without deletion",description:"Deactivates user access while preserving data for potential reactivation"}).input(vs.extend({reason:Lo().optional()})).output(xs),Ql.route({method:"POST",tags:["Agent"],path:"/agent",summary:"Create new AI agent with configuration",description:"Creates agent with specified settings, prompts, and returns agent entity"}).input(Ta).output(Sa),Ql.route({method:"GET",tags:["Agent"],path:"/agent",summary:"Search and filter agents by workspace or user",description:"Returns list of agents matching search parameters. Supports filtering by workspace_id, user_id, and application_id."}).input(wi({workspace_id:Vi().optional(),user_id:Vi().optional(),application_id:Vi().optional(),include:gi(Ei(["knowledge","simulations"])).optional()}).extend(_s.shape)).output(Ss(Sa)),Ql.route({method:"GET",tags:["Agent"],path:"/agent/{agent_id}",summary:"Get specific agent details by ID",description:"Returns complete agent information including configuration and settings"}).input(gs.extend({include:gi(Ei(["knowledge","simulations"])).optional()})).output(Sa),Ql.route({method:"GET",tags:["Agent"],path:"/agent/{agent_id}/mindmap",summary:"Get agent mindmap by ID",description:"Returns the mindmap knowledge graph for the specified agent"}).input(gs).output(_a),Ql.route({method:"PUT",tags:["Agent"],path:"/agent/{agent_id}",summary:"Update agent configuration and settings",description:"Updates agent details. For JSON requests, handled by oRPC. Also accepts multipart/form-data for logo file uploads (handled by raw Express route)."}).input(Aa.extend({agent_id:Vi(),force_reset_learning:qi().optional()})).output(Sa),Ql.route({method:"DELETE",tags:["Agent"],path:"/agent/{agent_id}",summary:"Delete agent and all associated data",description:"Permanently deletes an agent and cleans up all related resources. This action cannot be undone."}).input(gs).output(xs),Ql.route({method:"POST",tags:["Agent"],path:"/agent/{agent_id}/index",summary:"Index simulation document into agent knowledge base",description:"Adds a simulation document to an agent's knowledge base and refreshes the search index"}).input(Oa.extend({agent_id:Vi()})).output(Na),Ql.route({method:"POST",tags:["Agent"],path:"/agent/{agent_id}/reset-learning",summary:"Force reset agent from stuck learning state",description:"Resets an agent that is stuck in learning state, setting it to error status with a message explaining the reset"}).input(gs).output(Sa),Ql.route({method:"POST",tags:["Activity Log"],path:"/log",summary:"Create new activity log entry",description:"Records user or system action for auditing and tracking purposes"}).input(el).output(Xa),Ql.route({method:"GET",tags:["Activity Log"],path:"/log",summary:"Search and filter activity logs",description:"Returns list of activity logs matching search parameters (workspace, type)"}).input(wi({workspace_id:Vi().optional(),type:us.optional(),application_id:Vi().optional()}).extend(_s.shape)).output(Ss(Xa)),Ql.route({method:"GET",tags:["Tour"],path:"/tour",summary:"Search and filter tours by workspace",description:"Returns list of available tours for specified workspace"}).input(wi({workspace_id:Vi().optional(),application_id:Vi().optional()}).extend(_s.shape)).output(Ss(Va)),Ql.route({method:"POST",tags:["Tour"],path:"/tour",summary:"Create new interactive tour",description:"Creates tour with specified steps and configuration"}).input(Va).output(Va),Ql.route({method:"GET",tags:["URL Guide"],path:"/url-guide",summary:"Search URL guides by widget",description:"Returns list of URL guides for specified widget"}).input(ys.extend(_s.shape)).output(Ss(Wa)),Ql.route({method:"POST",tags:["URL Guide"],path:"/url-guide",summary:"Create new URL guide",description:"Creates URL guide with pattern and message"}).input(Ga).output(Wa),Ql.route({method:"GET",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Get URL guide by ID",description:"Returns URL guide details"}).input(ms).output(Wa),Ql.route({method:"PUT",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Update URL guide",description:"Updates URL guide properties"}).input(Ha.extend({id:Vi()})).output(Wa),Ql.route({method:"DELETE",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Delete URL guide",description:"Permanently deletes a URL guide. This action cannot be undone."}).input(ms).output(xs),Ql.route({method:"GET",tags:["URL Guide"],path:"/url-guide/match",summary:"Find matching URL guide for current URL",description:"Returns matching URL guide for a given URL pattern"}).input(wi({widget_id:Vi(),url:Lo()})).output(Wa.nullable()),Ql.route({method:"GET",tags:["Simulation"],path:"/simulation",summary:"Search and filter simulations by workspace",description:"Returns list of simulations associated with specified workspace. Use application_id, agent_id, or pinned to filter."}).input(wi({workspace_id:Vi().optional(),application_id:Vi().optional(),agent_id:Vi().optional(),pinned:vi([li(),Lo()]).optional().transform(e=>void 0===e?void 0:"boolean"==typeof e?e:"true"===e||"false"!==e&&void 0),source:Ei(["direct","qa"]).optional(),include:gi(Ei(["agent","application"])).optional()}).extend(_s.shape)).output(Ss(ma)),Ql.route({method:"POST",tags:["Simulation"],path:"/simulation/start",summary:"Start new application simulation",description:"Creates and initializes simulation with specified parameters"}).input(fa).output(ma),Ql.route({method:"PUT",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Update simulation configuration and status",description:"Modifies simulation parameters and updates execution state"}).input(ga.extend({simulation_id:Vi()})).output(ma),Ql.route({method:"PUT",tags:["Simulation"],path:"/simulation/{simulation_id}/agents",summary:"Assign agents to a simulation",description:"Sets which agents use this simulation for their knowledge. Triggers learning on affected agents."}).input(ws.extend({agent_ids:gi(oi())})).output(ma),Ql.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/progress",summary:"Get simulation progress history as chat transcript",description:"Returns all progress updates for a simulation ordered chronologically"}).input(ws).output(Cs(va)),Ql.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/live-view",summary:"Get live view URL for simulation session",description:"Returns Browserbase live view URL for embedding in iframe"}).input(ws).output(wi({session_id:Lo(),live_view_url:Lo(),status:Lo()})),Ql.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/history",summary:"Get simulation history by ID",description:"Returns the history array for the specified simulation"}).input(ws).output(Cs(ua)),Ql.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/steps",summary:"Get all simulation steps with topic and screenshot link as JSON",description:"Returns each step with step_number, topic, screenshot_url, and optional title/url for the simulation"}).input(ws).output(Cs(pa)),Ql.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/mindmap",summary:"Get simulation mindmap by ID",description:"Returns the mindmap knowledge graph for the specified simulation"}).input(ws).output(_a),Ql.route({method:"POST",tags:["Simulation"],path:"/simulation/{simulation_id}/stop",summary:"Stop running simulation",description:"Terminates a running simulation and closes its browser session."}).input(ws).output(ks),Ql.route({method:"POST",tags:["Simulation"],path:"/simulation/{simulation_id}/answer",summary:"Submit answer to simulation question",description:"Submits an answer to a pending question from the simulation agent"}).input(ya.extend({simulation_id:Vi()})).output(ks),Ql.route({method:"DELETE",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Delete simulation",description:"Permanently deletes a simulation and all associated data. Only works on simulations in terminal state."}).input(ws).output(ks),Ql.route({method:"POST",tags:["Session"],path:"/sessions",summary:"Create or update session",description:"Creates a new session or updates an existing one"}).input(ba).output(wa),Ql.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}",summary:"Get session by session ID",description:"Retrieves a session by its session_id"}).input(wi({session_id:Lo().min(1)})).output(wa.nullable()),Ql.route({method:"GET",tags:["Session"],path:"/sessions/chat/{chat_id}",summary:"Get sessions by chat ID",description:"Retrieves all sessions for a given chat_id"}).input(wi({chat_id:Lo().min(1)})).output(Cs(wa)),Ql.route({method:"GET",tags:["Session"],path:"/sessions",summary:"Get all sessions",description:"Retrieves all sessions ordered by creation date, optionally filtered by application and date range"}).input(wi({application_id:Vi().optional(),start_date:Lo().optional(),end_date:Lo().optional()}).extend(_s.shape)).output(Ss(wa)),Ql.route({method:"GET",tags:["Session"],path:"/sessions/stats",summary:"Get session activity stats",description:"Returns daily aggregated session metrics for charting. Each entry is one calendar day with session count and total event count."}).input(wi({application_id:Vi(),start_date:Lo().describe("YYYY-MM-DD"),end_date:Lo().describe("YYYY-MM-DD")})).output(Bl),Ql.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}/events",summary:"Get session events",description:"Fetches all batches from folder, combines them in correct order, and returns events array"}).input(wi({session_id:Lo().min(1)})).output(Cs(wi({type:oi(),timestamp:oi(),data:ui().describe("rrweb event payload — shape defined by rrweb library")}))),Ql.route({method:"POST",tags:["Browser Session"],path:"/browser-session/create",summary:"Create browser session for application",description:"Creates a browser session and navigates to the application URL"}).input(wi({application_id:oi(),agent_id:oi(),url:Lo().nullish()})).output(wi({session_id:Lo(),live_view_url:Lo()})),Ql.route({method:"POST",tags:["Browser Session"],path:"/browser-session/{session_id}/stop",summary:"Stop browser session",description:"Stops all running tasks and closes the browser session. Set stop_tasks=false to skip task cleanup."}).input(wi({session_id:Lo(),stop_tasks:li().optional().default(!0)})).output(ks),Ql.route({method:"GET",tags:["Knowledge"],path:"/knowledge",summary:"Search and filter knowledge base documents",description:"Returns list of knowledge documents matching search parameters. Supports filtering by workspace_id, type, and application_id."}).input(wi({workspace_id:Vi().optional(),type:ns.optional(),application_id:Vi().optional(),include:gi(Ei(["agents","application"])).optional()}).extend(_s.shape)).output(Ss(Bs)),Ql.route({method:"POST",tags:["Knowledge"],path:"/knowledge",summary:"Upload new knowledge base document",description:"Upload a file, document URL, or video URL to create a knowledge entry for AI training"}).input(wi({file:Hi(File).optional(),application_id:Vi(),document_url:Lo().url().optional(),document_name:Lo().optional(),video_url:Lo().url().optional(),video_name:Lo().optional()})).output(Bs),Ql.route({method:"GET",tags:["Knowledge"],path:"/knowledge/{id}",summary:"Get specific knowledge document by ID",description:"Returns complete knowledge document information and content"}).input(ms).output(Bs),Ql.route({method:"DELETE",tags:["Knowledge"],path:"/knowledge/{id}",summary:"Delete knowledge document",description:"Permanently deletes a knowledge document from the database. This action cannot be undone."}).input(ms).output(xs),Ql.route({method:"POST",tags:["Knowledge"],path:"/knowledge/{id}/refresh",summary:"Refresh knowledge document",description:"Re-fetches HTML content from source URL and updates the document"}).input(ms).output(Bs),Ql.route({method:"PUT",tags:["Knowledge"],path:"/knowledge/{knowledge_id}/agents",summary:"Assign agents to a knowledge item",description:"Sets which agents use this knowledge item. Triggers learning on affected agents."}).input(wi({knowledge_id:Vi(),agent_ids:gi(oi())})).output(Bs),Ql.route({method:"POST",tags:["QA"],path:"/qa/document",summary:"Upload QA flow (file or text)",description:"Uploads a PDF/text file or text content for QA test generation. Also accepts multipart/form-data for file uploads (handled by raw Express route)."}).input(Zs).output(Hs),Ql.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/process",summary:"Process QA flow and generate test cases",description:"Starts async processing (returns 202). Poll GET /qa/document/:id for status and processing_step until completed/failed."}).input(ms).output(wi({document:Hs})),Ql.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/refine",summary:"Refine existing QA test cases",description:"Refines existing test cases with a refinement prompt via AI agent API"}).input(ms.extend({refinementPrompt:Lo().min(5).max(2e3)})).output(Xs),Ql.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/process/stream",summary:"Process QA flow with SSE streaming",description:"Streams processing events as Server-Sent Events. Events: response.created, response.progress, response.clear, response.completed, error."}).input(ms).output(ec(wi({event:Lo().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:ui().describe("Event payload object — shape varies by event type")}))),Ql.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/refine/stream",summary:"Refine QA flow test cases with SSE streaming",description:"Streams refinement events as Server-Sent Events. Requires a refinement prompt (min 5 chars)."}).input(ms.extend({refinementPrompt:Lo().min(5)})).output(ec(wi({event:Lo().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:ui().describe("Event payload object — shape varies by event type")}))),Ql.route({method:"GET",tags:["QA"],path:"/qa/document/{id}",summary:"Get QA flow by ID",description:"Retrieves a QA flow by its ID"}).input(ms).output(Hs),Ql.route({method:"GET",tags:["QA"],path:"/qa/document",summary:"List QA flows",description:"Returns all QA flows with aggregated metrics (run_count, pass_rate, total_failed) and the last run summary. Supports filtering by application_id."}).input(wi({application_id:Vi().optional()}).extend(_s.shape)).output(Ss(Hs.extend({run_count:oi(),display_title:Lo(),total_failed:oi(),pass_rate:oi().nullable(),last_run:wi({id:oi(),status:Lo(),total_tests:oi(),passed_tests:oi(),failed_tests:oi(),created_at:Ji().nullable()}).nullable()})).extend({metrics:wi({total_flows:oi(),total_runs:oi(),avg_pass_rate:oi().nullable(),total_failed:oi(),total_passed:oi()})})),Ql.route({method:"DELETE",tags:["QA"],path:"/qa/document/{id}",summary:"Delete QA flow",description:"Permanently deletes a QA flow and all its runs and test cases. This action cannot be undone."}).input(ms).output(xs),Ql.route({method:"PUT",tags:["QA"],path:"/qa/document/{id}",summary:"Update QA flow status",description:"Updates the status of a QA flow"}).input(ms.extend({status:os})).output(Hs),Ql.route({method:"GET",tags:["QA"],path:"/qa/document/{id}/runs",summary:"List runs for a QA flow",description:"Returns all runs for a document with total/passed/failed counts"}).input(ms.extend(_s.shape)).output(Ss(Vs.extend({total_tests:oi(),passed:oi(),failed:oi()}))),Ql.route({method:"GET",tags:["QA"],path:"/qa/run/{id}",summary:"Get a QA run by ID",description:"Returns run details with test cases"}).input(ms).output(Vs.extend({test_cases:gi(Qs)})),Ql.route({method:"DELETE",tags:["QA"],path:"/qa/run/{id}",summary:"Delete a QA run",description:"Permanently deletes a QA run and all its test case results. This action cannot be undone."}).input(ms).output(xs),Ql.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/run",summary:"Create and start a new QA run",description:"Creates a new run and starts execution. Returns 202; poll test-cases for execution status."}).input(ms).output(wi({run:Vs,simulations:gi(ma)})),Ql.route({method:"GET",tags:["QA"],path:"/qa/document/{id}/test-cases",summary:"Get test cases for a QA flow",description:"Retrieves test cases; optional run_id scopes to that run"}).input(ms.extend({run_id:Vi().optional()})).output(Cs(Qs)),Ql.route({method:"PUT",tags:["QA"],path:"/qa/test-case/{id}",summary:"Update test case definition fields",description:"Updates a test case definition (title, objective, steps, etc.)"}).input(ms.extend({test_title:Lo().optional(),test_objective:Lo().optional(),test_steps:gi(Lo()).optional(),expected_outcome:Lo().optional(),priority:Ei(["Low","Medium","High"]).optional(),is_active:li().optional()})).output(Qs),Ql.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/execute",summary:"Create a run and execute all pending tests for a QA flow as simulations",description:"Creates a new QA run, then starts a simulation for every active test case. Returns the run and simulation entities."}).input(ms).output(wi({run:Vs,simulations:gi(ma)})),Ql.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/execute",summary:"Execute a single test case as a simulation",description:"Starts a simulation for the specified test case and returns the simulation entity."}).input(ms).output(wi({simulation:ma})),Ql.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/simulation",summary:"Get the simulation linked to a test case",description:"Returns the simulation entity associated with the test case, or null if no simulation exists."}).input(ms).output(wi({simulation:ma.nullable()})),Ql.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/versions",summary:"Get version history for a test case",description:"Returns all version entries from the test case version_history JSON"}).input(ms).output(Cs(Ys)),Ql.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}",summary:"Get specific test case version",description:"Returns a specific version entry from the test case version_history JSON"}).input(ms.extend({version:Vi()})).output(Ys),Ql.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}/rollback",summary:"Rollback to specific version",description:"Restores test case to a previous version and appends new version entry"}).input(ms.extend({version:Vi()})).output(Ys),Ql.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/versions/compare",summary:"Compare two versions",description:"Returns differences between two test case versions"}).input(ms.extend({version1:Vi(),version2:Vi()})).output(wi({version1:Ys,version2:Ys,diff:gi(wi({field:Lo(),oldValue:ta,newValue:ta}))})),Ql.route({method:"DELETE",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}",summary:"Delete a specific version",description:"Removes a version from history and reverts test case to previous version if it was the latest"}).input(ms.extend({version:Vi()})).output(xs.extend({current_version:oi()})),Ql.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/versions/{version}/accept",summary:"Accept a specific version",description:"Marks a version as accepted by the user"}).input(ms.extend({version:Vi()})).output(xs),Ql.route({method:"GET",tags:["QA"],path:"/qa/test-case/{id}/healing-attempts",summary:"Get healing attempts for a test case",description:"Returns all healing attempt entries from the test case healing_attempts JSON"}).input(ms).output(Cs(Ks)),Ql.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/healing-attempts/{attemptIndex}/approve",summary:"Approve a healing attempt",description:"Applies the repair from a validated healing attempt by array index"}).input(ms.extend({attemptIndex:Vi()})).output(xs),Ql.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/healing-attempts/{attemptIndex}/reject",summary:"Reject a healing attempt",description:"Marks a healing attempt as rejected by array index"}).input(ms.extend({attemptIndex:Vi()})).output(xs),Ql.route({method:"POST",tags:["QA"],path:"/qa/test-case/{id}/heal",summary:"Trigger self-healing for a failed test case",description:"Initiates the self-healing workflow for a test case"}).input(ms.extend({simulation_id:oi(),config:wi({enabled:li().optional(),autoApply:li().optional(),minConfidenceThreshold:oi().min(0).max(1).optional(),maxHealingAttempts:oi().int().min(1).max(5).optional()}).optional()})).output(wi({healed:li(),attemptIndex:oi().nullable(),analysis:na.nullable(),confidence:oi().nullable()})),Ql.route({method:"POST",tags:["QA"],path:"/qa/document/{id}/run-cross-browser",summary:"Execute cross-browser tests",description:"Runs tests across multiple browsers (chromium, firefox, webkit)"}).input(Gs.extend({id:Vi()})).output(wi({runs:gi(wi({browserType:Ws,runId:oi(),status:Ei(["completed","failed","skipped"]),passedTests:oi(),failedTests:oi(),totalTests:oi()})),summary:wi({totalRuns:oi(),completedRuns:oi(),failedRuns:oi(),overallPassed:oi(),overallFailed:oi()})})),Ql.route({method:"GET",tags:["QA"],path:"/qa/document/{id}/cross-browser-comparison",summary:"Get cross-browser comparison",description:"Returns test cases comparison across different browsers"}).input(ms).output(wi({byTest:Ci(Lo(),Ci(Lo(),wi({status:Lo(),runId:oi()}))),byBrowser:Ci(Lo(),wi({passed:oi(),failed:oi(),total:oi()}))})),Ql.route({method:"PUT",tags:["QA"],path:"/qa/document/{id}/browser-config",summary:"Update browser configuration",description:"Updates the default browser configuration for a QA flow"}).input(Gs.extend({id:Vi()})).output(xs),Ql.route({method:"POST",tags:["Internal"],path:"/migrate/prepare",summary:"Prepare database migration",description:"Validates migration requirements and prepares system for migration"}).input(bl).output(wi({message:Lo(),status:Lo(),data:bl})),Ql.route({method:"POST",tags:["Internal"],path:"/migrate/run",summary:"Execute database migration",description:"Runs migration scripts and updates database schema"}).input(vl).output(wi({message:Lo(),status:Lo(),data:vl})),Ql.route({method:"POST",tags:["Stripe"],path:"/stripe/trial",summary:"Create a trial subscription",description:"Creates a trial subscription for the authenticated workspace. The trial period is 30 days by default."}).input(Cl).output(Ol),Ql.route({method:"POST",tags:["Stripe"],path:"/stripe/checkout",summary:"Create a checkout session for subscription purchase",description:"Creates a Stripe checkout session for purchasing a subscription. Returns a session URL for redirect."}).input(_l).output(Al),Ql.route({method:"POST",tags:["Stripe"],path:"/stripe/portal",summary:"Create a customer portal session",description:"Creates a Stripe billing portal session for managing subscription, payment methods, and invoices."}).input(Sl).output(Ml),Ql.route({method:"POST",tags:["Stripe"],path:"/stripe/downgrade",summary:"Confirm and process a subscription downgrade",description:"Processes a confirmed subscription downgrade to a lower tier plan. No payment required."}).input(Il).output(El),Ql.route({method:"POST",tags:["Stripe"],path:"/stripe/cancel",summary:"Cancel subscription at period end",description:"Cancels the subscription at the end of the current billing period."}).input(wi({subscriptionId:Lo().min(1)})).output(wi({subscriptionId:Lo(),cancelAtPeriodEnd:li()})),Ql.route({method:"GET",tags:["Stripe"],path:"/stripe/catalog",summary:"Get public Stripe catalog (pricing, plans, config)",description:"Returns pricing from Stripe, plan catalog metadata, and Stripe frontend configuration in a single call."}).output(wi({pricing:Ll,plans:$l,config:jl})),Ql.route({method:"GET",tags:["Stripe"],path:"/stripe/subscription",summary:"Get current subscription plan and usage",description:"Returns current subscription plan information and actual usage statistics for the authenticated workspace."}).output(wi({plan:Tl,usage:Rl})),Ql.route({method:"GET",tags:["Widget"],path:"/widget/stream",summary:"SSE stream for real-time widget events",description:"Typed event stream delivering tool calls, task status updates, chat responses, and registration confirmation."}).input(wi({chat_id:Lo(),tab_id:Lo().optional(),marketrix_id:Lo().optional(),marketrix_key:Lo().optional(),agent_id:Vi().optional(),application_id:Vi().optional()})).output(ec(qa)),Ql.route({method:"POST",tags:["Widget"],path:"/widget/message",summary:"Send a typed command from widget to server",description:"Receives chat commands, tool responses, and keepalive pings from the widget."}).input(wi({chat_id:Lo(),command:Ja})).output(wi({ok:li()})),Ql.route({method:"GET",tags:["App"],path:"/app/events",summary:"SSE stream for real-time app dashboard events",description:"Typed event stream delivering simulation, agent, QA, and user updates filtered by scope and application."}).input(wi({scopes:gi(Ya).min(1),application_id:Vi().optional()})).output(ec(Ka)),Ql.route({method:"POST",tags:["Internal"],path:"/workos/webhook",summary:"WorkOS webhook receiver",description:"Receives webhook events from WorkOS (user management, SSO). Verified via workos-signature header. Not for external use."}).input(wi({event:Lo(),data:Ci(Lo(),ui())})).output(wi({received:li()})),Ql.route({method:"POST",tags:["Internal"],path:"/stripe/webhook",summary:"Stripe webhook receiver",description:"Receives webhook events from Stripe (payments, subscriptions). Verified via stripe-signature header. Not for external use."}).input(wi({id:Lo(),object:Lo(),type:Lo(),data:Ci(Lo(),ui())}).passthrough().describe("Stripe event payload")).output(wi({received:li()}));var tc,rc=null,nc="";function oc(e){return xe(new Be({url:e,headers:()=>{const e={};return rc&&(e.Authorization=`Bearer ${rc}`),e}}))}tc=oc("");var ic=e=>{if(!e||""===e.trim())throw new Error("API URL is required for SDK configuration");e!==nc&&(nc=e,tc=oc(e))},sc={setAuthToken:e=>{rc=e},clearAuthToken:()=>{rc=null},getAuthToken:()=>rc,configure:ic},ac=new Proxy({},{get:(e,t)=>t in sc?sc[t]:tc[t]}),lc=e=>e?.mtxApiHost?e.mtxApiHost:"";function cc(e,t="Unknown error"){return e instanceof Error?e.message:"string"==typeof e?e:t}function dc(e,t="Operation",r){const n=cc(e);return function(e){const t=e instanceof Error?e.message:String(e);return t.includes("Failed to fetch")||t.includes("ERR_CONNECTION_REFUSED")||t.includes("NetworkError")||t.includes("Network request failed")}(e)?{isValid:!1,error:`Cannot connect to API server. Please ensure the API server is running at ${lc(r)||"configured API server"}. Error: ${n}`}:{isValid:!1,error:`${t} failed: ${n}`}}var uc="undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname&&!window.location.hostname.includes("localhost")?"error":"debug",pc={debug:0,info:1,warn:2,error:3};function hc(e){return pc[e]>=pc[uc]}var mc=(e,t,...r)=>{hc("debug")},fc=(e,t,...r)=>{hc("info")},gc=(e,t,...r)=>{hc("warn")},yc=(e,t,...r)=>{hc("error")};function wc(e){return{debug:(t,...r)=>mc(e,t,...r),info:(t,...r)=>fc(e,t,...r),warn:(t,...r)=>gc(e,t,...r),error:(t,...r)=>yc(e,t,...r)}}wc("ErrorUtils");var bc=[{id:"navigate",name:"Navigate",description:"Navigate to a URL",displayAction:"Navigating",category:"navigation",actionType:"navigate"},{id:"search",name:"Search",description:"Search the web using a search engine",displayAction:"Searching",category:"navigation",actionType:"search"},{id:"click_element",name:"Click Element",description:"Click on an element by index or coordinates",displayAction:"Clicking element",category:"interaction",actionType:"click_element"},{id:"type_text",name:"Type Text",description:"Type text into an input field",displayAction:"Typing text",category:"interaction",actionType:"type_text"},{id:"scroll",name:"Scroll",description:"Scroll the page up or down",displayAction:"Scrolling",category:"interaction",actionType:"scroll"},{id:"scroll_to_text",name:"Scroll to Text",description:"Scroll until text is visible",displayAction:"Scrolling to text",category:"interaction",actionType:"scroll_to_text"},{id:"send_keys",name:"Send Keys",description:"Send keyboard keys or shortcuts",displayAction:"Pressing key",category:"interaction",actionType:"send_keys"},{id:"extract",name:"Extract",description:"Extract content from the page",displayAction:"Extracting content",category:"extraction",actionType:"extract"},{id:"get_dropdown_options",name:"Get Dropdown Options",description:"Get available options from a dropdown",displayAction:"Reading dropdown options",category:"extraction",actionType:"get_dropdown_options"},{id:"select_dropdown_option",name:"Select Dropdown Option",description:"Select an option from a dropdown",displayAction:"Selecting option",category:"interaction",actionType:"select_dropdown_option"},{id:"upload_file",name:"Upload File",description:"Upload a file to an input field",displayAction:"Uploading file",category:"interaction",actionType:"upload_file"},{id:"go_back",name:"Go Back",description:"Browser back button",displayAction:"Going back",category:"navigation",actionType:"go_back"},{id:"wait",name:"Wait",description:"Wait for a specified duration",displayAction:"Waiting",category:"utility",actionType:"wait"},{id:"switch_tab",name:"Switch Tab",description:"Switch to a different browser tab",displayAction:"Switching tab",category:"utility",actionType:"switch_tab"},{id:"close_tab",name:"Close Tab",description:"Close the current browser tab",displayAction:"Closing tab",category:"utility",actionType:"close_tab"},{id:"done",name:"Done",description:"Mark task as complete",displayAction:"Done",category:"utility",actionType:"done"},{id:"get_html",name:"Get HTML",description:"Get full page HTML with data-id attributes",displayAction:"Viewed your screen",category:"extraction",actionType:"get_html"},{id:"get_interactable_elements",name:"Get Interactable Elements",description:"Get list of interactable elements",displayAction:"Scanning elements",category:"extraction",actionType:"get_interactable_elements"},{id:"get_screenshot",name:"Get Screenshot",description:"Capture a screenshot of the page",displayAction:"Taking screenshot",category:"extraction",actionType:"get_screenshot"}];function vc(e){return e.includes("__THINKING__")}function xc(e){return vc(e)?e:`${e}\n\n__THINKING__`}function kc(e,t,r,n,o,i){if("agent"!==e.sender||e.isSystemMessage||e.isScreenAccessRequest)return!1;if(i&&t&&("show"===r||"do"===r))if(e.isPlaceholder){if(void 0!==e.mode&&e.mode!==r)return!1}else if(e.mode!==r)return!1;if(o){const t=e.content.trim().length>0,r=e.parts&&e.parts.length>0;if(!t&&!r)return!1}return!0}function _c(e){const{messages:t,isTaskRunning:r,currentMode:n,preferPlaceholder:o,requireContent:i}=e;let s=-1;if(r&&("show"===n||"do"===n)){const e=!0;for(let o=t.length-1;o>=0;o--){const a=t[o],l=kc(a,r,n,0,i,e),c=a.isPlaceholder,d=!i||a.content.trim().length>0||a.parts&&a.parts.length>0;if(l&&c&&d){s=o;break}}if(s<0&&!i)for(let o=t.length-1;o>=0;o--){const a=t[o],l=kc(a,r,n,0,i,e),c=a.isPlaceholder;if(l&&c){s=o;break}}if(s<0)for(let o=t.length-1;o>=0;o--){const a=t[o],l=kc(a,r,n,0,i,e),c=a.isPlaceholder;if(l&&!c){s=o;break}}}if(s<0){for(let e=t.length-1;e>=0;e--){const r=t[e],n="agent"===r.sender,o=r.isPlaceholder,a=!r.isSystemMessage,l=!r.isScreenAccessRequest,c=!i||r.content.trim().length>0||r.parts&&r.parts.length>0;if(n&&o&&a&&l&&c){s=e;break}}if(s<0&&!i)for(let e=t.length-1;e>=0;e--){const r=t[e];if("agent"===r.sender&&r.isPlaceholder&&!r.isSystemMessage&&!r.isScreenAccessRequest){s=e;break}}if(s<0&&(s=function(e){for(let t=e.length-1;t>=0;t--){const r=e[t];if("agent"===r.sender&&!r.isSystemMessage&&!r.isScreenAccessRequest&&!r.isPlaceholder)return t}return-1}(t)),s<0)for(let e=t.length-1;e>=0;e--){const r=t[e];if("agent"===r.sender&&!r.isSystemMessage&&!r.isScreenAccessRequest){s=e;break}}}return s>=0?{index:s,message:t[s]}:null}function Sc(e){const t={...e};if(!t.parts){t.parts=[];const e=t.content.replace(/\n\n__THINKING__$/,"").trim();e&&t.parts.push({type:"text",content:e})}return t}var Cc=new Set(["click_element","type_text","send_keys","select_dropdown_option","upload_file","scroll"]);function Ic(e){return e?e.replace(/\(Cancelled by cleanup\)/gi,"").replace(/\(cancelled by cleanup\)/gi,"").replace(/Cancelled by cleanup/gi,"").replace(/\s+/g," ").trim():e}function Ec(e,t,r,n=!1){const o=Sc(e);if(!t||"show"!==r&&"do"!==r)return vc(o.content)?{...o,content:o.content.replace(/\n\n__THINKING__$/,"").replace(/__THINKING__/g,""),placeholderState:void 0}:o;const i=n?"waiting-for-user":"thinking";return vc(o.content)?o.placeholderState!==i?{...o,placeholderState:i}:o:{...o,content:xc(o.content),placeholderState:i}}var Tc=Object.fromEntries(bc.map(e=>[e.id,e.displayAction]));var Ac="marketrix_chat_context",Mc={chat_id:null,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],currentMode:"tell",isOpen:!1,isMinimized:!1,isLoading:!1,config:null,timestamp:Date.now()},Oc=class e{static instance;context=null;constructor(){this.loadContext()}static getInstance(){return e.instance||(e.instance=new e),e.instance}loadContext(){if("undefined"==typeof window)return this.context={...Mc},this.context;try{const e=localStorage.getItem(Ac);if(e){const t=JSON.parse(e);return Date.now()-t.timestamp>6048e5?(this.context={...Mc},this.saveContext(),this.context):(this.context=t,this.context)}}catch(e){}return this.context={...Mc},this.context}saveContext(){if("undefined"!=typeof window&&this.context)try{this.context.timestamp=Date.now(),localStorage.setItem(Ac,JSON.stringify(this.context))}catch(e){}}getContext(){return this.context?this.context:this.loadContext()}updateContext(e){this.context||this.loadContext(),this.context={...this.context,...e},this.saveContext()}isValidChatId(e){return"string"==typeof e&&""!==e.trim()}getChatId(){if("undefined"!=typeof window&&this.isValidChatId(window.name)){const e=window.name;return e!==this.getContext().chat_id&&this.updateContext({chat_id:e}),e}return this.getContext().chat_id}setChatId(e){this.updateContext({chat_id:e}),"undefined"!=typeof window&&e&&(window.name=e,window.dispatchEvent(new CustomEvent("marketrix:chatid",{detail:{chatId:e}})))}getMessages(){return this.getContext().messages}setMessages(e){this.updateContext({messages:e})}getChatState(){const e=this.getContext();return{isTaskRunning:e.isTaskRunning,activeTaskId:e.activeTaskId,taskProgress:e.taskProgress,currentMode:e.currentMode,isOpen:e.isOpen,isMinimized:e.isMinimized,isLoading:e.isLoading}}setChatState(e){this.updateContext(e)}getConfig(){return this.getContext().config}setConfig(e){this.updateContext({config:e})}clear(){this.context={...Mc},"undefined"!=typeof window&&localStorage.removeItem(Ac)}hasValidContext(){const e=this.getContext();return null!==e.chat_id&&e.chat_id.length>0}}.getInstance(),Nc=class e{static instance;messages=[];chatId=null;isTaskRunning=!1;activeTaskId=null;taskProgress=[];currentMode="tell";isOpen=!1;isMinimized=!1;isLoading=!1;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}initialize(e){this.chatId=e,this.restoreState()}createInitialContext(e){try{if(Oc.hasValidContext())return;Oc.updateContext({chat_id:e,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],currentMode:"tell",isOpen:!1,isMinimized:!1,isLoading:!1})}catch(t){}}getMessages(){return this.messages}getIsLoading(){return this.isLoading}getIsTaskRunning(){return this.isTaskRunning}getActiveTaskId(){return this.activeTaskId}getTaskProgress(){return this.taskProgress}getCurrentMode(){return this.currentMode}getIsOpen(){return this.isOpen}getIsMinimized(){return this.isMinimized}addMessage(e){this.messages=[...this.messages,e],this.persistState()}updateMessage(e,t){this.messages=this.messages.map(r=>r.id===e?{...r,...t}:r),this.persistState()}removeMessage(e){this.messages=this.messages.filter(t=>t.id!==e),this.persistState()}setMessages(e){this.messages=e,this.persistState()}clearMessages(){this.messages=[],this.persistState()}setTaskState(e,t,r){this.isTaskRunning=e,this.activeTaskId=t,this.taskProgress=r,this.persistState()}setMode(e){this.currentMode=e,this.persistState()}setWidgetState(e,t){this.isOpen=e,this.isMinimized=t,this.persistState()}setIsLoading(e){this.isLoading=e,this.persistState()}restoreState(){try{const e=Oc.getContext();if(!e.chat_id)return;this.chatId&&(e.chat_id,this.chatId),this.messages=e.messages.map(e=>{if(e.id.startsWith("screenshare-"))return{...e,content:"Screenshare ended",videoStream:void 0,isSystemMessage:!0,timestamp:new Date(e.timestamp),parts:[{type:"text",content:"Screenshare ended"}]};const t={...e,timestamp:new Date(e.timestamp),videoStream:void 0,placeholderState:e.placeholderState,taskStatus:e.taskStatus,parts:e.parts||[]};if(0===t.parts?.length&&t.content){const e=t.content.replace(/\n\n__THINKING__$/,"").trim();e&&t.parts&&t.parts.push({type:"text",content:e})}return t}),this.isTaskRunning=e.isTaskRunning,this.activeTaskId=e.activeTaskId,this.taskProgress=e.taskProgress,this.currentMode=e.currentMode,this.isOpen=e.isOpen,this.isMinimized=e.isMinimized,this.isLoading=e.isLoading??!1}catch(e){}}persistState(){if(this.chatId)try{const e=this.messages.filter(e=>!e.isPlaceholder||("thinking"===e.placeholderState||"waiting-for-user"===e.placeholderState||(e.parts||[]).length>0)).filter(e=>!(e.isSystemMessage&&"Chat context changed"===e.content)).map(e=>{return{id:e.id,content:(t=e.content,t.replace(/__THINKING__/g,"")),sender:e.sender,timestamp:e.timestamp.toISOString(),mode:e.mode,isScreenAccessRequest:e.isScreenAccessRequest,screenShareStatus:e.screenShareStatus,isSystemMessage:e.isSystemMessage,isPlaceholder:e.isPlaceholder,placeholderState:e.placeholderState,taskStatus:e.taskStatus,parts:e.parts};var t});Oc.updateContext({chat_id:this.chatId,messages:e,isTaskRunning:this.isTaskRunning,activeTaskId:this.activeTaskId,taskProgress:this.taskProgress,currentMode:this.currentMode,isOpen:this.isOpen,isMinimized:this.isMinimized,isLoading:this.isLoading})}catch(e){}}}.getInstance();function Rc(e,t,r="user-message"){const n=[],o=e.trim();return o&&n.push({type:"text",content:o}),{id:`${r}-${Date.now()}`,content:o,sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,parts:n}}function zc(e,t,r,n="agent-message"){const o=[],i=e.trim();return i&&o.push({type:"text",content:i}),{id:r||`${n}-${Date.now()}`,content:e,sender:"agent",timestamp:/* @__PURE__ */new Date,mode:t,parts:o}}function Pc(e,t,r="agent",n="system-message"){const o=[];return e&&o.push({type:"text",content:e}),{id:`${n}-${Date.now()}`,content:e,sender:r,timestamp:/* @__PURE__ */new Date,mode:t,isSystemMessage:!0,parts:o}}function Lc(e="show"){const t="Started screenshare";return{id:`started-screenshare-${Date.now()}`,content:t,sender:"user",timestamp:/* @__PURE__ */new Date,mode:e,isSystemMessage:!0,parts:[{type:"text",content:t}]}}function Dc(e,t="show"){return{id:`screenshare-${Date.now()}`,content:"",sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,videoStream:e,parts:[]}}var $c=wc("ChatIdManager"),jc=class e{static instance=null;chatId=null;initializationPromise=null;constructor(){"undefined"!=typeof window&&"undefined"!=typeof document&&(this.chatId=this.getStoredChatId(),this.chatId&&$c.debug("Loaded existing chat ID from storage:",this.chatId))}static getInstance(){return"undefined"==typeof window||"undefined"==typeof document?(e.instance||(e.instance=Object.create(e.prototype),e.instance.chatId=null,e.instance.initializationPromise=null),e.instance):(e.instance||(e.instance=new e),e.instance)}getChatId(){return this.chatId}async getOrCreateChatId(){if(this.chatId)return $c.debug("Returning existing chat ID:",this.chatId),this.chatId;if(this.initializationPromise)return $c.debug("Chat ID initialization in progress, waiting..."),this.initializationPromise;const e=this.getStoredChatId();if(e)return this.chatId=e,$c.debug("Found chat ID in storage:",this.chatId),this.chatId;this.initializationPromise=this.createChatId();try{return await this.initializationPromise}finally{this.initializationPromise=null}}async createChatId(){try{$c.info("Creating new chat ID...");const e=await ac.chatCreate(void 0);if(!e)throw new Error("API returned empty chat ID");return this.chatId=e,this.storeChatId(e),$c.info("Created and stored new chat ID:",this.chatId),Nc.createInitialContext(e),e}catch(e){throw $c.error("Failed to create chat ID:",e),this.initializationPromise=null,e}}clearChatId(){this.chatId=null,this.initializationPromise=null,$c.debug("Cleared chat ID")}static resetInstance(){e.instance=null}getStoredChatId(){return Oc.getChatId()}storeChatId(e){Oc.setChatId(e)}}.getInstance(),Fc=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;config;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}addCallbacks(e){this.callbacks.add(e)}removeCallbacks(e){this.callbacks.delete(e)}getStatus(){return this.status}isConnected(){return"registered"===this.status}async connect(e,t){if(this.isIntentionallyDisconnected&&(this.isIntentionallyDisconnected=!1),this.isConnected()&&this.chatId===e)return;this.abortController&&(this.abortController.abort(),this.abortController=null),this.chatId=e,t&&(this.config=t),this.setStatus("connecting"),this.abortController=new AbortController;const r=this.abortController.signal;try{const t={chat_id:e};this.config?.mtxId&&this.config?.mtxKey?(t.marketrix_id=this.config.mtxId,t.marketrix_key=this.config.mtxKey):this.config?.mtxAgent&&this.config?.mtxApp&&(t.agent_id=this.config.mtxAgent,t.application_id=this.config.mtxApp);const n=await ac.widgetStream(t,{signal:r});this.setStatus("connected"),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.consumeEvents(n,e)}catch(n){r.aborted||(this.setStatus("error"),this.notifyError(/* @__PURE__ */new Error("Stream connection failed")),this.scheduleReconnect())}}async consumeEvents(e,t){try{for await(const r of e){if(this.chatId!==t)break;this.handleMessage(r)}}catch(r){this.isIntentionallyDisconnected||this.setStatus("error")}finally{this.isIntentionallyDisconnected||this.chatId!==t||(this.setStatus("disconnected"),this.scheduleReconnect())}}disconnect(){this.isIntentionallyDisconnected=!0,this.clearReconnectTimer(),this.abortController&&(this.abortController.abort(),this.abortController=null),this.setStatus("disconnected"),this.chatId=null}send(e){this.chatId&&ac.widgetMessage({chat_id:this.chatId,command:e}).catch(e=>{this.notifyError(/* @__PURE__ */new Error(`Failed to send message: ${String(e)}`))})}setStatus(e){this.status!==e&&(this.status=e,this.callbacks.forEach(t=>t.onStatusChange?.(e)))}notifyError(e){this.callbacks.forEach(t=>t.onError?.(e))}handleMessage(e){"heartbeat"!==e.type&&("registered"===e.type&&e.chat_id===this.chatId&&(this.setStatus("registered"),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.callbacks.forEach(t=>t.onRegistered?.(e.application_id))),"chat/error"===e.type&&"auth"===e.request_id&&(this.isIntentionallyDisconnected=!0),this.callbacks.forEach(t=>t.onMessage?.(e)))}scheduleReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return void this.notifyError(/* @__PURE__ */new Error("Max reconnect attempts reached"));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,this.config).catch(console.error)},e)}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null)}},Uc=class{config;constructor(e){this.config=e}getChatId(){return jc.getChatId()}async getOrCreateChatId(){return jc.getOrCreateChatId()}getUserId(){if(this.config.userId&&"number"==typeof this.config.userId)return this.config.userId;try{const e=localStorage.getItem("marketrix_user_id");if(e){const t=Number(e);if(!isNaN(t))return t}}catch(e){}try{const e=sessionStorage.getItem("marketrix_user_id");if(e){const t=Number(e);if(!isNaN(t))return t}}catch(e){}return null}async logWidgetQuestion(e,t){try{const r=this.getUserId(),n={question:e,mode:t,chat_id:this.getChatId(),timestamp:/* @__PURE__ */(new Date).toISOString()};null!==r&&(n.user_id=r),this.config.mtxApp&&(n.application_id=this.config.mtxApp),this.config.mtxId&&this.config.mtxKey&&(n.marketrix_id=this.config.mtxId,n.marketrix_key=this.config.mtxKey),ac.activityLogCreate({type:"widget_question",metadata:n}).catch(e=>{})}catch(r){}}async sendMessage(e){if(!(await jc.getOrCreateChatId()))throw new Error("Failed to initialize chat session");const t=e.mode||"tell";if(e.message&&await this.logWidgetQuestion(e.message,t),!(this.config.mtxId&&this.config.mtxKey||this.config.mtxApp&&this.config.mtxAgent))throw new Error("Either mtxId + mtxKey or both mtxApp + mtxAgent are required");const r=e.requestId||`req_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,n={type:`chat/${t}`,request_id:r,content:e.message||""};return Fc.getInstance().send(n),{messageId:r,response:"",mode:t,timestamp:/* @__PURE__ */new Date}}async checkAgentAvailability(){try{return null!==jc.getChatId()}catch(e){return!1}}async getAgentInfo(){return{available:!0,status:"online"}}async stopTask(e){return Fc.getInstance().send({type:"chat/stop",...e&&{task_id:e}}),{status:"stopping",message:"Stop command sent"}}updateConfig(e){this.config={...this.config,...e}}},Bc=class e{static instance;config=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}loadConfig(){const e=Oc.getConfig();return e?(this.config=e,e):(this.config={},this.config)}saveConfig(e){Oc.setConfig(e),this.config=e}updateConfig(e){this.config||(this.config={}),this.config={...this.config,...e},this.saveConfig(this.config)}getConfig(){return this.config}shouldShowWidget(){return!!this.config&&(this.config.widget_enabled??!1)}}.getInstance();function Wc(e,t={}){return{...t,...e}}function Gc(e,t){return"object"==typeof e&&null!==e&&t in e}function Hc(e){return null!==e&&e instanceof HTMLElement}function Zc(e){return null!==e&&e instanceof HTMLScriptElement}var Vc=b(()=>{});function qc(e){if(!(e&&e instanceof Element))return!1;try{const r=e.tagName.toLowerCase(),n="button"===r;if(!(n||"input"===r||"textarea"===r||"select"===r||"a"===r&&e.hasAttribute("href")||"button"===e.getAttribute("role")||"link"===e.getAttribute("role")||"textbox"===e.getAttribute("role")||"checkbox"===e.getAttribute("role")||"radio"===e.getAttribute("role")||"switch"===e.getAttribute("role")||"tab"===e.getAttribute("role")||"menuitem"===e.getAttribute("role")||"true"===e.getAttribute("contenteditable")||e.hasAttribute("onclick")||e.hasAttribute("tabindex")&&parseInt(e.getAttribute("tabindex")||"-1",10)>=0))return!1;const o=(t,r)=>{if(n){e.tagName,e.id,e.className}};if(!0===e.disabled)return o("disabled","button is disabled"),!1;if("true"===e.getAttribute("aria-disabled"))return o("aria-disabled","aria-disabled is true"),!1;try{let t=e;for(;t;){if(t instanceof HTMLElement&&t.inert)return o("inert","ancestor is inert"),!1;const e=t instanceof Element?t.getRootNode():null;t=t instanceof Element?t.parentElement||(e instanceof ShadowRoot?e.host:null):null}}catch(t){}const i=e.hasAttribute("onclick");if(n&&i)return!0;let s,a;try{s=window.getComputedStyle(e)}catch(t){return o("computed-style","failed to get computed style"),!1}if("none"===s.display)return o("display","display is none"),!1;if("none"===s.pointerEvents)return o("pointer-events","pointer-events is none"),!1;try{a=e.getBoundingClientRect()}catch(t){return o("bounding-rect","failed to get bounding rect"),!1}if(a.width<=0||a.height<=0)return o("dimensions",`width=${a.width}, height=${a.height}`),!1;try{let t=e;for(;t&&t!==document.body;){const e=t.getRootNode(),r=t.parentElement||(e instanceof ShadowRoot?e.host:null);if(!r)break;let i,s;try{i=window.getComputedStyle(r),s=r.getBoundingClientRect()}catch{t=r;continue}if("hidden"===i.overflow||"clip"===i.overflow){const e=a.right<s.left||a.left>s.right||a.bottom<s.top||a.top>s.bottom;if(n){if(e)return o("overflow-clipping","completely outside parent bounds"),!1}else if(e)return!1}t=r}}catch(t){}try{let t=e.getRootNode();for(;t instanceof ShadowRoot;){const e=t.host;let r;try{r=e.getBoundingClientRect()}catch{break}if(r.width<=0||r.height<=0)return!1;t=e.getRootNode()}}catch(t){}return!0}catch(t){return!1}}var Jc,Yc,Kc,Qc=b(()=>{Xc()}),Xc=b(()=>{Qc(),Jc=class e{static instance;elementMap=/* @__PURE__ */new Map;elementToSequence=/* @__PURE__ */new WeakMap;selectorMap=/* @__PURE__ */new Map;fingerprintMap=/* @__PURE__ */new Map;isIndexed=!1;indexingInProgress=!1;indexVersion=0;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}generateSelector(e){if(e.id&&1===document.querySelectorAll(`#${CSS.escape(e.id)}`).length)return`#${CSS.escape(e.id)}`;const t=[];let r=e;for(;r&&r!==document.body&&r.parentElement;){let e=r.tagName.toLowerCase();if(r.id){e+=`#${CSS.escape(r.id)}`,t.unshift(e);break}{const t=r.parentElement;if(!t)break;const n=r.tagName,o=Array.from(t.children).filter(e=>e.tagName===n);if(o.length>1){e+=`:nth-of-type(${o.indexOf(r)+1})`}}t.unshift(e),r=r.parentElement}return t.join(" > ")}generateFingerprint(e,t){return{tagName:e.tagName,id:e.id||null,textContent:((e,t=100)=>{if(!e)return null;const r=e.trim().replace(/\s+/g," ");return r.length>t?r.slice(0,t):r})(e.textContent),type:e.getAttribute("type"),role:e.getAttribute("role"),ariaLabel:e.getAttribute("aria-label"),name:e.getAttribute("name"),href:e.getAttribute("href"),selector:t,indexVersion:this.indexVersion}}matchesFingerprint(e,t){return e.tagName===t.tagName&&(!(!t.id||e.id!==t.id)||(!t.type||e.getAttribute("type")===t.type)&&((!t.ariaLabel||e.getAttribute("aria-label")===t.ariaLabel)&&((!t.role||e.getAttribute("role")===t.role)&&((!t.href||"A"!==t.tagName||e.getAttribute("href")===t.href)&&(!t.name||e.getAttribute("name")===t.name)))))}validateElementAtIndex(e){const t=this.fingerprintMap.get(e);if(!t)return{isValid:!0};const r=this.elementMap.get(e);return r&&document.contains(r)?r instanceof HTMLElement&&!this.matchesFingerprint(r,t)?{isValid:!1,mismatchReason:"element_changed"}:{isValid:!0}:{isValid:!1,mismatchReason:"element_removed"}}exportState(){return{selectors:Array.from(this.selectorMap.entries()),fingerprints:Array.from(this.fingerprintMap.entries())}}importState(e){if(e)try{e.selectors&&(this.selectorMap=new Map(e.selectors)),e.fingerprints&&(this.fingerprintMap=new Map(e.fingerprints)),(this.selectorMap.size>0||this.fingerprintMap.size>0)&&(this.isIndexed=!0)}catch(t){}}indexInteractableElements(){if(this.indexingInProgress)return[];try{this.indexingInProgress=!0,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),r="fixed"===t.position||"sticky"===t.position;if("none"===t.display)return NodeFilter.FILTER_REJECT;if(!r){let t=e.parentElement,r=!1;for(;t&&t!==document.body;){const e=window.getComputedStyle(t);if("fixed"===e.position||"sticky"===e.position){r=!0;break}t=t.parentElement}if(!r)return NodeFilter.FILTER_REJECT}}return NodeFilter.FILTER_ACCEPT}});let t=e.nextNode(),r=0;const n=[];for(;t;){if(t instanceof HTMLElement){const e=t.matches('a[href], button, input, textarea, select, [role="button"]'),o=t.classList.contains("cursor-pointer")||t.classList.contains("clickable"),i="onclick"in t&&"function"==typeof t.onclick;if(e||o||i||qc(t)){this.elementMap.set(r,t),this.elementToSequence.set(t,r);const e=this.generateSelector(t);this.selectorMap.set(r,e);const o=this.generateFingerprint(t,e);this.fingerprintMap.set(r,o),n.push([r,t]),r++}}t=e.nextNode()}return this.isIndexed=!0,this.indexVersion++,n}finally{this.indexingInProgress=!1}}getElementCoordinates(e){const t=e.getBoundingClientRect(),r=this.calculateGlobalZOrder(e);return{x:Math.round(t.left),y:Math.round(t.top),w:Math.round(t.width),h:Math.round(t.height),z:r}}isStackingContext(e){const t=window.getComputedStyle(e),r=t.position;if(("fixed"===r||"absolute"===r||"relative"===r||"sticky"===r)&&"auto"!==t.zIndex)return!0;if("auto"!==t.zIndex&&e.parentElement){const t=window.getComputedStyle(e.parentElement).display;if("flex"===t||"inline-flex"===t||"grid"===t||"inline-grid"===t)return!0}const n=parseFloat(t.opacity);if(!isNaN(n)&&n<1)return!0;if(t.transform&&"none"!==t.transform)return!0;if(t.filter&&"none"!==t.filter)return!0;const o=t.willChange;if(o&&(o.includes("transform")||o.includes("opacity")))return!0;if("isolate"===t.isolation)return!0;const i=t.contain;return!(!i||!(i.includes("layout")||i.includes("style")||i.includes("paint")))}calculateGlobalZOrder(e){let t=e;const r=[];for(;t&&t!==document.body&&t.parentElement;){const e=window.getComputedStyle(t);if(this.isStackingContext(t)){let n=0;if("auto"!==e.zIndex){const t=parseInt(e.zIndex,10);isNaN(t)||(n=t)}let o=0;t.parentElement&&(o=Array.from(t.parentElement.children).indexOf(t)),r.push({element:t,zIndex:n,domOrder:o})}t=t.parentElement}let n=1e6;for(let o=r.length-1;o>=0;o--){const e=r[o];n+=1e4*e.zIndex+e.domOrder}if(e.parentElement){n+=Array.from(e.parentElement.children).indexOf(e)}return n}getSnapshotHtml(){this.indexInteractableElements();const e=document.documentElement.cloneNode(!0);for(const[r,n]of this.elementMap.entries())if(n instanceof HTMLElement){const o=this.selectorMap.get(r);if(o)try{const t=(e.querySelector("body")||e).querySelector(o);if(t)if(t.setAttribute("data-id",r.toString()),"none"===window.getComputedStyle(n).display)t.setAttribute("data-x","0"),t.setAttribute("data-y","0"),t.setAttribute("data-w","0"),t.setAttribute("data-h","0"),t.setAttribute("data-z","0");else{const e=this.getElementCoordinates(n);t.setAttribute("data-x",e.x.toString()),t.setAttribute("data-y",e.y.toString()),t.setAttribute("data-w",e.w.toString()),t.setAttribute("data-h",e.h.toString()),t.setAttribute("data-z",e.z.toString())}}catch(t){}}return e.outerHTML}getInteractableElements(){this.indexInteractableElements();const e=[];for(const[t,r]of this.elementMap.entries())if(r instanceof HTMLElement){const n=this.fingerprintMap.get(t);n&&e.push({index:t,fingerprint:n,coords:this.getElementCoordinates(r),cssClasses:Array.from(r.classList)})}return e}getElementByDataId(e){return this.elementMap.get(e)}getSequenceForElement(e){return this.elementToSequence.get(e)}isIndexActive(){return this.isIndexed}clearIndex(){this.elementMap.clear(),this.elementToSequence=/* @__PURE__ */new WeakMap,this.fingerprintMap.clear(),this.isIndexed=!1}checkInteractability(e,t){if(!document.body.contains(e))return`ELEMENT_NOT_INTERACTABLE: Element ${t} is not in the DOM`;const r=window.getComputedStyle(e);if("none"===r.display)return`ELEMENT_NOT_INTERACTABLE: Element ${t} has display:none`;if("hidden"===r.visibility)return`ELEMENT_NOT_INTERACTABLE: Element ${t} has visibility:hidden`;if(0===parseFloat(r.opacity))return`ELEMENT_NOT_INTERACTABLE: Element ${t} has opacity:0`;const n=e.getBoundingClientRect();if(0===n.width||0===n.height)return`ELEMENT_NOT_INTERACTABLE: Element ${t} has zero dimensions`;if(n.bottom<0||n.top>window.innerHeight||n.right<0||n.left>window.innerWidth)return`ELEMENT_NOT_INTERACTABLE: Element ${t} is off-screen`;const o=n.left+n.width/2,i=n.top+n.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}checkElementInteractable(e,t){return this.checkInteractability(e,t)}getElementByIndex(e){let t=null;if(this.elementMap.has(e)){const r=this.elementMap.get(e);r&&r instanceof HTMLElement&&(t=r)}if(!t&&this.selectorMap.has(e)){const r=this.selectorMap.get(e);if(r)try{const e=document.querySelector(r);e&&e instanceof HTMLElement&&(t=e)}catch(n){}}if(!t)return{element:null,error:`Element ${e} not found`};const r=this.checkInteractability(t,e);return r?{element:null,error:r}:{element:t}}getValidatedElement(e){const t=this.validateElementAtIndex(e);if(!t.isValid)return{element:null,validation:t,error:`DOM_CHANGED: Element at index ${e} ${"element_removed"===t.mismatchReason?"no longer exists":"has changed"}. Call get_html to get updated indices.`};const r=this.elementMap.get(e);if(!r)return{element:null,validation:t,error:`Element ${e} not found`};const n=this.checkInteractability(r,e);return n?{element:null,validation:t,error:n}:{element:r,validation:t}}getFingerprint(e){return this.fingerprintMap.get(e)}getAllFingerprints(){return Array.from(this.fingerprintMap.entries())}getIndexVersion(){return this.indexVersion}},Yc=Jc.getInstance()});async function ed(){if(Kc?.active){const e=Kc.getVideoTracks();if(e.length>0&&"live"===e[0].readyState)return Kc}const e=await navigator.mediaDevices.getDisplayMedia({video:!0,audio:!1,preferCurrentTab:!0});if(!e||0===e.getVideoTracks().length)throw new Error("Screen sharing permission denied or no video track available");return Kc=e,e.getVideoTracks()[0].addEventListener("ended",()=>{Kc=null}),e}function td(){return null!==function(){if(Kc?.active){const e=Kc.getVideoTracks();if(e.length>0&&"live"===e[0].readyState)return Kc}return Kc=null,null}()}var rd,nd,od,id,sd=b(()=>{Kc=null}),ad=b(()=>{Xc(),rd=class e{static instance;currentPopup=null;currentHighlight=null;currentElement=null;currentOptions=null;currentPromise=null;resolvePromise=null;rejectPromise=null;clickHandler=null;scrollHandler=null;updateHighlightPosition=null;rafId=null;mutationObserver=null;visibilityCheckInterval=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}async showToolAction(e){const{element:t,explanation:r,isClickAction:n=!1,toolName:o}=e;return this.currentOptions?.element===t&&this.currentOptions.explanation===r&&this.currentOptions.toolName===o&&this.currentPromise||(this.cleanup(),this.currentOptions=e,this.currentElement=t,t.scrollIntoView({behavior:"smooth",block:"center",inline:"center"}),this.createHighlight(t),this.createPopup(r,n),this.setupPositionUpdates(),this.setupElementMonitoring(),this.setupVisibilityMonitoring(),n&&this.setupClickHandler(),this.currentPromise=new Promise((e,t)=>{this.resolvePromise=e,this.rejectPromise=t}).finally(()=>{this.cleanup()})),this.currentPromise}cleanup(){this.rejectPromise&&(this.rejectPromise("Cancelled by cleanup"),this.rejectPromise=null),this.resolvePromise=null,this.clickHandler&&(document.removeEventListener("click",this.clickHandler,{capture:!0}),this.clickHandler=null),this.scrollHandler&&(window.removeEventListener("scroll",this.scrollHandler,{capture:!0}),window.removeEventListener("resize",this.scrollHandler),window.removeEventListener("touchmove",this.scrollHandler),window.removeEventListener("wheel",this.scrollHandler),this.scrollHandler=null),null!==this.rafId&&(window.cancelAnimationFrame(this.rafId),this.rafId=null),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.visibilityCheckInterval&&(clearInterval(this.visibilityCheckInterval),this.visibilityCheckInterval=null),this.updateHighlightPosition=null,this.currentPopup&&(this.currentPopup.remove(),this.currentPopup=null),this.currentHighlight&&(this.currentHighlight.remove(),this.currentHighlight=null);const e=document.getElementById("marketrix-show-popup");e&&e.remove();const t=document.getElementById("marketrix-show-highlight");t&&t.remove(),this.currentElement=null,this.currentOptions=null,this.currentPromise=null,this.resolvePromise=null,this.rejectPromise=null}createHighlight(e){const t=e.getBoundingClientRect(),r=document.createElement("div");r.id="marketrix-show-highlight",r.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(r),this.currentHighlight=r}createPopup(e,t){const r=document.createElement("div");r.id="marketrix-show-popup",r.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>`,document.body.appendChild(r),this.currentPopup=r,t||this.setupContinueButton(r),this.updatePopupPosition()}setupPositionUpdates(){this.updateHighlightPosition=()=>{if(!this.currentElement||!this.currentHighlight)return;const e=this.currentElement.getBoundingClientRect();this.currentHighlight.style.top=`${e.top}px`,this.currentHighlight.style.left=`${e.left}px`,this.currentHighlight.style.width=`${e.width}px`,this.currentHighlight.style.height=`${e.height}px`,this.updatePopupPosition()},this.scrollHandler=()=>{null!==this.rafId&&window.cancelAnimationFrame(this.rafId),this.updateHighlightPosition?.()},window.addEventListener("scroll",this.scrollHandler,{capture:!0,passive:!0}),window.addEventListener("resize",this.scrollHandler,{passive:!0}),window.addEventListener("touchmove",this.scrollHandler,{passive:!0}),window.addEventListener("wheel",this.scrollHandler,{passive:!0})}updatePopupPosition(){if(!this.currentPopup||!this.currentElement)return;const e=this.currentElement.getBoundingClientRect(),t=320,r=120,n=10,o=e.left+e.width/2,i=e.top+e.height/2,s=[{left:e.right+20,top:i-60},{left:e.left-t-20,top:i-60},{left:o-160,top:e.top-r-20},{left:o-160,top:e.bottom+20}];let a=s[0];for(const d of s)if(d.left>=n&&d.left+t<=window.innerWidth-n&&d.top>=n&&d.top+r<=window.innerHeight-n){a=d;break}const l=Math.max(n,Math.min(a.left,window.innerWidth-t-n)),c=Math.max(n,Math.min(a.top,window.innerHeight-r-n));this.currentPopup.style.cssText+=`\n position: fixed;\n top: ${c}px;\n left: ${l}px;\n width: 320px;\n background: white;\n border-radius: 8px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n z-index: 2147483646;\n padding: 16px;\n `}setupClickHandler(){this.clickHandler=e=>{if(this.currentElement&&this.resolvePromise&&e.composedPath().includes(this.currentElement)){e.preventDefault(),e.stopPropagation();const t=this.resolvePromise;this.resolvePromise=null,this.rejectPromise=null,t(!0)}},document.addEventListener("click",this.clickHandler,{capture:!0})}setupContinueButton(e){window.requestAnimationFrame(()=>{const t=e.querySelector("#marketrix-show-continue");t&&t.addEventListener("click",e=>{if(e.stopPropagation(),this.resolvePromise){const e=this.resolvePromise;this.resolvePromise=null,this.rejectPromise=null,e(!0)}})})}setupElementMonitoring(){this.currentElement&&(this.mutationObserver=new MutationObserver(()=>{this.currentElement&&!document.body.contains(this.currentElement)&&this.failWithElementGone("Element was removed from DOM")}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0}))}setupVisibilityMonitoring(){this.visibilityCheckInterval=setInterval(()=>{if(!this.currentElement)return;const e=Yc.getSequenceForElement(this.currentElement)??-1,t=Yc.checkElementInteractable(this.currentElement,e);t&&this.failWithElementGone(t)},200)}failWithElementGone(e){if(this.rejectPromise){const t=this.rejectPromise;this.rejectPromise=null,this.resolvePromise=null,t(/* @__PURE__ */new Error(`ELEMENT_GONE: ${e}`))}this.cleanup()}escapeHtml(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}},nd=rd.getInstance()}),ld=b(()=>{Xc(),sd(),ad(),od=class e{static instance;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}async executeTool(e,t,r="do",n=""){try{if("show"===r&&this.requiresHighlight(e)){const r=t.index;if(void 0!==r){const{element:t,error:o}=Yc.getElementByIndex(r);if(!t)return{success:!1,data:{text:""},error:o||`Element ${r} not found`};if(!(await nd.showToolAction({element:t,explanation:n||`Execute ${e}`,toolName:e,isClickAction:"click_element"===e})))return{success:!1,data:{text:""},error:"User cancelled action"}}}switch(e){case"navigate":return this.navigate(t);case"search":return this.search(t);case"click_element":return await this.clickElement(t);case"type_text":return this.typeText(t);case"scroll":return this.scroll(t);case"scroll_to_text":return this.scrollToText(t);case"extract":return this.extract(t);case"go_back":return this.goBack();case"wait":return await this.wait(t);case"select_dropdown_option":return this.selectDropdownOption(t);case"get_dropdown_options":return this.getDropdownOptions(t);case"send_keys":return this.sendKeys(t);case"upload_file":return this.uploadFile(t);case"close_tab":return this.closeTab();case"switch_tab":return this.switchTab(t);case"done":return this.done(t);case"get_html":return this.getHtml();case"get_interactable_elements":return this.getInteractableElements();case"get_screenshot":return await this.getScreenshot();default:return{success:!1,data:{text:""},error:`Unknown tool: ${e}`}}}catch(o){return nd.cleanup(),{success:!1,data:{text:""},error:o instanceof Error?o.message:String(o)}}}requiresHighlight(e){return["click_element","type_text","select_dropdown_option","send_keys","upload_file"].includes(e)}navigate(e){return e.url?e.new_tab?(window.open(e.url,"_blank"),{success:!0,data:{text:`Opened ${e.url} in new tab`}}):(window.location.href=e.url,{success:!0,data:{text:`Navigating to ${e.url}`}}):{success:!1,data:{text:""},error:"URL is required"}}search(e){if(!e.query)return{success:!1,data:{text:""},error:"Query is required"};const t=e.engine||"duckduckgo",r=encodeURIComponent(e.query);let n=`https://duckduckgo.com/?q=${r}`;return"google"===t&&(n=`https://www.google.com/search?q=${r}`),"bing"===t&&(n=`https://www.bing.com/search?q=${r}`),window.location.href=n,{success:!0,data:{text:`Searching for "${e.query}" on ${t}`}}}async clickElement(e){if(void 0===e.index)return{success:!1,data:{text:""},error:"Index required"};const{element:t,error:r}=Yc.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(r){}}},50),{success:!0,data:{text:`Clicked element ${e.index}`}}):{success:!1,data:{text:""},error:r||`Element ${e.index} not found`}}typeText(e){if(void 0===e.index||void 0===e.text)return{success:!1,data:{text:""},error:"Index and text required"};const t=!1!==e.clear,{element:r,error:n}=Yc.getValidatedElement(e.index);if(!r)return{success:!1,data:{text:""},error:n||`Element ${e.index} not found`};if(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r.isContentEditable){const n=r;try{n.focus()}catch(o){}const i=t?e.text:n.value+e.text;let s=!1,a=null;if(!s)try{const e="TEXTAREA"===n.tagName.toUpperCase()?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(e,"value");t?.set&&(t.set.call(n,i),s=!0)}catch(o){a=o}if(!s)try{n.value=i,s=!0}catch(o){a=o}if(!s)try{n.focus(),t&&n.select(),document.execCommand("insertText",!1,e.text)&&(s=!0)}catch(o){a=o}if(!s)try{n.focus(),t&&(n.value="");for(const t of e.text)n.dispatchEvent(new KeyboardEvent("keydown",{key:t,bubbles:!0,cancelable:!0})),n.value+=t,n.dispatchEvent(new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:t})),n.dispatchEvent(new KeyboardEvent("keyup",{key:t,bubbles:!0,cancelable:!0}));s=!0}catch(o){a=o}if(!s)return{success:!1,data:{text:""},error:`Failed to set value: ${a instanceof Error?a.message:String(a)}`};try{const t=new InputEvent("input",{bubbles:!0,cancelable:!0,inputType:"insertText",data:e.text});n.dispatchEvent(t),n.dispatchEvent(new Event("change",{bubbles:!0})),n.dispatchEvent(new Event("blur",{bubbles:!0}))}catch(o){}}else if("value"in r)try{r.value=e.text,r.dispatchEvent(new Event("input",{bubbles:!0})),r.dispatchEvent(new Event("change",{bubbles:!0}))}catch(o){return{success:!1,data:{text:""},error:`Failed to set value on element: ${o instanceof Error?o.message:String(o)}`}}else try{r.textContent=e.text,r.dispatchEvent(new Event("input",{bubbles:!0}))}catch(o){return{success:!1,data:{text:""},error:`Failed to set textContent: ${o instanceof Error?o.message:String(o)}`}}return{success:!0,data:{text:`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{success:!1,data:{text:""},error:"Invalid direction"}}return{success:!0,data:{text:`Scrolled ${e.direction}`}}}scrollToText(e){if(!e.text)return{success:!1,data:{text:""},error:"Text required"};const t=document.createTreeWalker(document.body,NodeFilter.SHOW_TEXT);let r;for(;r=t.nextNode();)if(r.textContent?.includes(e.text)&&r.parentElement)return r.parentElement.scrollIntoView({behavior:"smooth",block:"center"}),{success:!0,data:{text:`Scrolled to "${e.text}"`}};return{success:!1,data:{text:""},error:`Text "${e.text}" not found`}}extract(e){const t=e.start_from_char??0,r=!1!==e.extract_links,n=document.body.innerText;return{success:!0,data:{title:document.title,url:window.location.href,text:n.slice(t,t+1e4),links:r?Array.from(document.querySelectorAll("a[href]")).slice(0,100).map(e=>({text:e.textContent?.trim()||"",href:e.getAttribute("href")})):[]}}}goBack(){return window.history.length>1?(window.history.back(),{success:!0,data:{text:"Navigated back"}}):{success:!1,data:{text:""},error:"No history"}}async wait(e){return void 0===e.seconds?{success:!1,data:{text:""},error:"Seconds required"}:(await new Promise(t=>setTimeout(t,1e3*e.seconds)),{success:!0,data:{text:`Waited ${e.seconds}s`}})}selectDropdownOption(e){if(void 0===e.index||!e.option)return{success:!1,data:{text:""},error:"Index/Option required"};const{element:t,error:r}=Yc.getValidatedElement(e.index);if(!t)return{success:!1,data:{text:""},error:r||`Select ${e.index} not found`};if(!(t instanceof HTMLSelectElement))return{success:!1,data:{text:""},error:`Element ${e.index} is not a select element`};const n=Array.from(t.options).find(t=>t.value===e.option||t.text===e.option);return n?(t.value=n.value,t.dispatchEvent(new Event("change",{bubbles:!0})),{success:!0,data:{text:`Selected ${e.option}`}}):{success:!1,data:{text:""},error:`Option ${e.option} not found`}}getDropdownOptions(e){const t=e.index,{element:r,error:n}=Yc.getValidatedElement(t);return r?r instanceof HTMLSelectElement?{success:!0,data:{options:Array.from(r.options).map(e=>({value:e.value,text:e.text}))}}:{success:!1,data:{options:[]},error:`Element ${t} is not a select element`}:{success:!1,data:{options:[]},error:n||`Select ${t} not found`}}sendKeys(e){if(void 0===e.index||!e.keys)return{success:!1,data:{text:""},error:"Index/Keys required"};const{element:t,error:r}=Yc.getValidatedElement(e.index);return t?(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})),{success:!0,data:{text:this.simulateKeyAction(t,e.keys)||`Sent keys ${e.keys}`}}):{success:!1,data:{text:""},error:r||`Element ${e.index} not found`}}simulateKeyAction(e,t){switch(t){case"Tab":{const t=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),r=t.indexOf(e);if(-1!==r&&r<t.length-1){const e=t[r+1];return e.focus(),`Tab: moved focus to ${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}`}return"Tab: no next focusable element"}case"Shift+Tab":{const t=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),r=t.indexOf(e);if(r>0){const e=t[r-1];return e.focus(),`Shift+Tab: moved focus to ${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""}`}return"Shift+Tab: no 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 r,n,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)r=t.slice(0,o-1)+t.slice(i),n=o-1;else{if(o===i)return"Backspace: cursor at start, nothing to delete";r=t.slice(0,o)+t.slice(i),n=o}const s=Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;return s?s.call(e,r):e.value=r,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),e.setSelectionRange(n,n),`Backspace: deleted character, value is now "${r}"`}return"Backspace: dispatched event";case"Delete":if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement){const t=e.selectionStart||0,r=e.selectionEnd||0,n=e.value;let o;if(t===r&&t<n.length)o=n.slice(0,t)+n.slice(r+1);else{if(t===r)return"Delete: cursor at end, nothing to delete";o=n.slice(0,t)+n.slice(r)}const i=Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;return i?i.call(e,o):e.value=o,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),e.setSelectionRange(t,t),`Delete: deleted character, value is now "${o}"`}return"Delete: dispatched event";default:return null}}uploadFile(e){return{success:!1,data:{text:""},error:"File upload not supported via script"}}closeTab(){return window.close(),{success:!0,data:{text:"Attempted close"}}}switchTab(e){return e.tab_id?{success:!1,data:{text:""},error:"Tab switching not supported"}:{success:!1,data:{text:""},error:"tab_id is required"}}done(e){return void 0===e.success?{success:!1,data:{text:""},error:"success parameter is required"}:{success:!0,data:{text:e.message||(e.success?"Task completed":"Task failed")}}}getHtml(){try{return{success:!0,data:{text:Yc.getSnapshotHtml()}}}catch(e){return{success:!1,data:{text:""},error:String(e)}}}getInteractableElements(){try{return{success:!0,data:{elements:Yc.getInteractableElements()}}}catch(e){return{success:!1,data:{elements:[]},error:String(e)}}}async getScreenshot(){try{const e=await ed();if(!e)return{success:!1,data:{text:""},error:"Failed to get stream"};const 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 r=document.createElement("canvas");r.width=t.videoWidth,r.height=t.videoHeight,r.getContext("2d")?.drawImage(t,0,0);const n=r.toDataURL("image/jpeg",.75);return t.remove(),{success:!0,data:{text:n}}}catch(e){return{success:!1,data:{text:""},error:String(e)}}}},id=od.getInstance()});ld();var cd=r(void 0),dd=({children:e,previewMode:t=!1})=>{const r=p(0),n=p(/* @__PURE__ */new Set),o=p(!1),i=s(e=>{if(n.current.add(e),n.current.size>1e3){const e=Array.from(n.current).slice(-500);n.current=new Set(e)}},[]),a=p(null),c=p(!1),[d,m]=h({isOpen:!1,isMinimized:!1,isLoading:!1,messages:[],currentMode:"tell",agentAvailable:!1,activeTaskId:null,isTaskRunning:!1,taskProgress:[],activeView:"home"});l(()=>{if(t)return;(async()=>{const e=await jc.getOrCreateChatId();Nc.createInitialContext(e),Nc.initialize(e);const t=Nc.getIsTaskRunning();if(o.current=t,m(e=>({...e,messages:Nc.getMessages(),isLoading:Nc.getIsLoading(),isTaskRunning:t,activeTaskId:Nc.getActiveTaskId(),taskProgress:Nc.getTaskProgress(),currentMode:Nc.getCurrentMode(),isOpen:Nc.getIsOpen(),isMinimized:Nc.getIsMinimized()})),e){const t=Fc.getInstance(),r=Bc.getConfig();t.connect(e,r?{mtxId:r.mtxId,mtxKey:r.mtxKey,mtxAgent:r.mtxAgent,mtxApp:r.mtxApp}:void 0).catch(e=>{})}})()},[t]);const f=s((e,t,r,n)=>{m(o=>{const i=function(e){return Tc[e]?Tc[e]:e.replace(/([A-Z])/g," $1").replace(/_/g," ").trim().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}(e),s=_c({messages:o.messages,isTaskRunning:o.isTaskRunning,currentMode:o.currentMode,preferPlaceholder:!0,requireContent:"failed"===r});if(!s)return o;let a=s.message;const l=["click_element","type_text","select_dropdown_option","send_keys","upload_file"].includes(e),c=o.isTaskRunning&&"show"===o.currentMode&&l,d="done"===e;"running"===r?(d||(a=function(e,t,r){const n=Sc(e),o=n.parts||[],i=[...o],s=o.findIndex(e=>"progress"===e.type&&e.toolName===t&&"running"===e.status),a=!Cc.has(t),l="default",c=Ic(r);return s>=0?i[s]={...i[s],content:c,hideIcon:a,textStyle:l}:i.push({type:"progress",content:c,status:"running",toolName:t,hideIcon:a,textStyle:l}),{...n,parts:i}}(a,i,t||i)),!o.isTaskRunning||"show"!==o.currentMode&&"do"!==o.currentMode||(a=Ec(a,o.isTaskRunning,o.currentMode,c))):"completed"===r?(d||(a=function(e,t){const r=Sc(e),n=r.parts||[],o=[...n];let i=-1;if(t)i=n.map(e=>"progress"===e.type?e.toolName:"").lastIndexOf(t);else for(let s=n.length-1;s>=0;s--)if("progress"===n[s].type&&"running"===n[s].status){i=s;break}return i>=0&&(o[i]={...o[i],status:"completed"}),{...r,parts:o}}(a)),!o.isTaskRunning||"show"!==o.currentMode&&"do"!==o.currentMode||(a=Ec(a,o.isTaskRunning,o.currentMode,!1))):(a=function(e,t,r){const n=Sc(e),o=n.parts||[],i=r.toLowerCase().includes("cancelled by cleanup"),s=[...o];let a=o.map(e=>"progress"===e.type?e.toolName:"").lastIndexOf(t);if(-1===a)for(let l=o.length-1;l>=0;l--)if("progress"===o[l].type&&"running"===o[l].status){a=l;break}if(a>=0)if(i){const e=Ic(s[a].content);s[a]={...s[a],status:"completed",content:e}}else{const e=Ic(r),t=Ic(s[a].content);s[a]={...s[a],status:"failed",content:e?`${t} (${e})`:t}}return{...n,parts:s}}(a,i,n||""),!o.isTaskRunning||"show"!==o.currentMode&&"do"!==o.currentMode||(a=Ec(a,o.isTaskRunning,o.currentMode,!1)));const u=[...o.messages];return u[s.index]=a,Nc.setMessages(u),{...o,messages:u}})},[]);l(()=>{if(t)return;const e=Fc.getInstance(),s={onStatusChange:e=>{m(t=>({...t,agentAvailable:"registered"===e}))},onMessage:async t=>{if("tool/call"===t.type){const l=t.call_id;if(n.current.has(l))return;if(i(l),!bc.map(e=>e.id).includes(t.tool))return void e.send({type:"tool/response",call_id:l,success:!1,error:`Unknown tool: ${t.tool}`,state_version:r.current});if(!o.current)return void e.send({type:"tool/response",call_id:l,success:!1,error:"widget_task_inactive",state_version:r.current});const u=t.tool,p=t.args,h=t.mode||d.currentMode||"do",g=t.explanation||"",y=t.state_version;if(void 0!==y&&y!==r.current)return void e.send({type:"tool/response",call_id:l,success:!1,error:"State version mismatch",state_version:r.current});f(u,g,"running");const w=await id.executeTool(u,p,h,g);if(w.success)try{r.current++,e.send({type:"tool/response",call_id:l,success:!0,data:"string"==typeof w.data?w.data:JSON.stringify(w.data),state_version:r.current}),f(u,g,"completed"),"done"===u&&(a.current=null,c.current=!1,m(e=>{Nc.setTaskState(!1,null,[]),o.current=!1;const t=_c({messages:e.messages,isTaskRunning:e.isTaskRunning,currentMode:e.currentMode,preferPlaceholder:!0,requireContent:!1}),r=[...e.messages];if(t){const e=t.message.parts?.filter(e=>!("progress"===e.type&&"done"===e.toolName))||[];r[t.index]={...t.message,taskStatus:"done",parts:e},Nc.setMessages(r)}return{...e,messages:r,isTaskRunning:!1,activeTaskId:null,taskProgress:[]}}))}catch(s){f(u,g,"failed","Connection error")}else{r.current++;try{e.send({type:"tool/response",call_id:l,success:!1,data:"string"==typeof w.data?w.data:JSON.stringify(w.data),error:w.error??void 0,state_version:r.current})}catch(s){}}}else if("task/status"===t.type){const e=t.status,r=t.message||"";if("started"===e){const e=t.task_id||null;c.current=!0;const r=a.current||e;r&&m(e=>(Nc.setTaskState(!0,r,[]),o.current=!0,{...e,isTaskRunning:!0,activeTaskId:r,taskProgress:[]}))}else"completed"!==e&&"failed"!==e&&"stopped"!==e||(n.current.clear(),a.current=null,c.current=!1,m(t=>{Nc.setTaskState(!1,null,[]);const n=_c({messages:t.messages,isTaskRunning:t.isTaskRunning,currentMode:t.currentMode,preferPlaceholder:!0,requireContent:!1}),i=[...t.messages];if(n){let t="done";"failed"===e?t="failed":"stopped"===e&&(t="stopped"),i[n.index]={...n.message,taskStatus:t,...r&&{content:r}},Nc.setMessages(i)}return o.current=!1,{...t,messages:i,isTaskRunning:!1,activeTaskId:null,taskProgress:[]}}))}else"chat/response"===t.type?m(e=>{const r=e.messages.map(e=>{if(e.id===t.request_id){const r=[...e.parts||[],{type:"text",content:t.text}];return{...e,content:t.text,isPlaceholder:!1,placeholderState:void 0,parts:r,...t.task_id&&{taskId:t.task_id}}}return e});return Nc.setMessages(r),t.task_id&&(a.current=t.task_id,c.current)?(Nc.setTaskState(!0,t.task_id,[]),o.current=!0,{...e,messages:r,isTaskRunning:!0,activeTaskId:t.task_id,taskProgress:[]}):{...e,messages:r,isLoading:!1}}):"chat/error"===t.type&&m(e=>{const r=e.messages.map(e=>{if(e.id===t.request_id){const r=`Error: ${t.error}`,n=[...e.parts||[],{type:"text",content:r}];return{...e,content:r,isPlaceholder:!1,placeholderState:void 0,parts:n}}return e});return Nc.setMessages(r),{...e,messages:r,isLoading:!1}})},onError:e=>{m(t=>({...t,error:e.message}))}};return e.addCallbacks(s),()=>{e.removeCallbacks(s)}},[f,t]);const y=s(e=>{m(t=>(Nc.setTaskState(e.isTaskRunning,e.activeTaskId,e.taskProgress||[]),{...t,...e}))},[]),w=s(()=>{Nc.clearMessages(),a.current=null,c.current=!1,o.current=!1,m(e=>({...e,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],error:void 0}))},[]),b=s(e=>{m(t=>(Nc.addMessage(e),{...t,messages:[...t.messages,e]}))},[]),v=s(async(e,r,n,o,i)=>{if(t)return i||b(Rc(e,r||d.currentMode)),void b(zc("This is a preview. In production, I'll respond to your messages here."));let s=Bc.getConfig();if(s||(s=Bc.loadConfig()),!s||!s.mtxId&&!s.mtxKey&&!s.mtxAgent)return void b(zc("Configuration error: Missing API credentials. Please check your widget settings."));i||b(Rc(e,r||d.currentMode));const a=`temp-${Date.now()}`,l={id:a,content:"",sender:"agent",timestamp:/* @__PURE__ */new Date,mode:r||d.currentMode,isPlaceholder:!0,placeholderState:"thinking",parts:[]};l.content=xc(""),b(l),m(e=>({...e,isLoading:!0}));const c=new Uc(s);try{n&&c.updateConfig({mtxApp:n});const t=c.getChatId();if(t){const e=Fc.getInstance();if(!e.isConnected()){const r=Bc.getConfig();e.connect(t,r?{mtxId:r.mtxId,mtxKey:r.mtxKey,mtxAgent:r.mtxAgent,mtxApp:r.mtxApp}:void 0).catch(e=>{})}}await c.sendMessage({message:e,mode:r||d.currentMode,question:o,requestId:a})}catch(u){m(e=>{const t=e.messages.map(e=>{if(e.id===a){const t="I'm sorry, I encountered an error processing your request. Please try again.",r=[...e.parts||[],{type:"text",content:t}];return{...e,isPlaceholder:!1,parts:r,content:t}}return e});return Nc.setMessages(t),{...e,messages:t}})}finally{m(e=>({...e,isLoading:!1}))}},[d.currentMode,b,y,d,t]),x=u(()=>({setState:e=>m(t=>({...t,...e})),setActiveView:e=>m(t=>({...t,activeView:e})),toggleWidget:()=>m(e=>{const t={...e,isOpen:!e.isOpen,isMinimized:!!e.isOpen};return Nc.setWidgetState(t.isOpen,t.isMinimized),t}),closeWidget:()=>m(e=>{const t={...e,isOpen:!1,isMinimized:!0};return Nc.setWidgetState(t.isOpen,t.isMinimized),t}),setMode:e=>m(t=>(Nc.setMode(e),{...t,currentMode:e})),setLoading:e=>{Nc.setIsLoading(e),m(t=>({...t,isLoading:e}))},setAgentAvailable:e=>m(t=>({...t,agentAvailable:e})),setError:e=>m(t=>({...t,error:e})),clearError:()=>m(e=>({...e,error:void 0})),setTaskState:y,addMessage:b,updateMessage:(e,t)=>m(r=>(Nc.updateMessage(e,t),{...r,messages:r.messages.map(r=>r.id===e?{...r,...t}:r)})),removeMessage:e=>m(t=>(Nc.removeMessage(e),{...t,messages:t.messages.filter(t=>t.id!==e)})),setMessages:e=>m(t=>(Nc.setMessages(e),{...t,messages:e})),resetState:w,stopTask:async()=>{const e=d.activeTaskId||o.current?d.activeTaskId??void 0:void 0;if(m(e=>{const r=_c({messages:e.messages,isTaskRunning:e.isTaskRunning,currentMode:e.currentMode,preferPlaceholder:!0,requireContent:!1}),n=[...e.messages];return r&&(n[r.index]={...r.message,taskStatus:"stopped"},t||Nc.setMessages(n)),t||Nc.setTaskState(!1,null,[]),o.current=!1,{...e,messages:n,isTaskRunning:!1,activeTaskId:null,taskProgress:[]}}),!t)try{Fc.getInstance().send({type:"chat/stop",...e&&{task_id:e}})}catch(r){}},clearChatHistory:w,sendMessage:v}),[d.currentMode,y,w,b,v,t]);/* @__PURE__ */
|
|
3
|
+
return g(cd.Provider,{value:{state:d,actions:x},children:e})};var ud=({config:e}={})=>{const{state:t,actions:r}=(()=>{const e=a(cd);if(void 0===e)throw new Error("useWidgetContext must be used within a WidgetProvider");return e})(),n=u(()=>e||{},[e]),o=function(e){return Object.keys(Da.shape).every(t=>void 0!==e[t])}(n);l(()=>{o&&Bc.saveConfig(n)},[n,o]);const i=s(()=>o&&!0===n.widget_enabled,[n,o]),c=n.isPreviewMode??!1;return{state:t,config:n,actions:r,shouldShow:i(),isPreviewMode:c,configValid:o}},pd="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%3c!--%20Generator:%20Adobe%20Illustrator%2030.1.0,%20SVG%20Export%20Plug-In%20.%20SVG%20Version:%202.1.1%20Build%20136)%20--%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",hd=20,md=(e,t,r,n,o)=>{switch(e){case"top_left":return{x:hd,y:hd};case"top_right":return{x:t-hd-n,y:hd};case"bottom_left":return{x:hd,y:r-hd-o};default:return{x:t-hd-n,y:r-hd-o}}},fd=(e,t,r,n,o,i)=>{const s=md(e,r,n,o,i),a=s.x+o/2,l=s.y+i/2;let c,d;switch(t){case"top_left":c=hd+o/2,d=hd+i/2;break;case"top_right":c=r-hd-o/2,d=hd+i/2;break;case"bottom_left":c=hd+o/2,d=n-hd-i/2;break;default:c=r-hd-o/2,d=n-hd-i/2}return{dx:c-a,dy:d-l}};function gd(e){return"undefined"!=typeof window&&(e instanceof HTMLElement||e instanceof function(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}(e).HTMLElement)}var yd={};function wd(t,r){const n=e.useRef(yd);return n.current===yd&&(n.current=t(r)),n}var bd=e[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],vd=bd&&bd!==e.useLayoutEffect?bd:e=>e();function xd(e){const t=wd(kd).current;return t.next=e,vd(t.effect),t.trampoline}function kd(){const e={next:void 0,callback:_d,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function _d(){}var Sd="undefined"!=typeof document?e.useLayoutEffect:()=>{};function Cd(e,t){return e&&!t?e:!e&&t?t:e||t?{...e,...t}:void 0}var Id={};function Ed(e,t,r,n,o){let i={...Od(e,Id)};return t&&(i=Td(i,t)),r&&(i=Td(i,r)),n&&(i=Td(i,n)),o&&(i=Td(i,o)),i}function Td(e,t){return Md(t)?t(e):function(e,t){if(!t)return e;for(const r in t){const n=t[r];switch(r){case"style":e[r]=Cd(e.style,n);break;case"className":e[r]=zd(e.className,n);break;default:Ad(r,n)?e[r]=Nd(e[r],n):e[r]=n}}return e}(e,t)}function Ad(e,t){const r=e.charCodeAt(0),n=e.charCodeAt(1),o=e.charCodeAt(2);return 111===r&&110===n&&o>=65&&o<=90&&("function"==typeof t||void 0===t)}function Md(e){return"function"==typeof e}function Od(e,t){return Md(e)?e(t):e??Id}function Nd(e,t){return t?e?r=>{if(function(e){return null!=e&&"object"==typeof e&&"nativeEvent"in e}(r)){const n=r;Rd(n);const o=t(n);return n.baseUIHandlerPrevented||e?.(n),o}const n=t(r);return e?.(r),n}:t:e}function Rd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function zd(e,t){return t?e?t+" "+e:t:e}var Pd,Ld,Dd=(Pd="https://base-ui.com/production-error",Ld="Base UI",function(e,...t){const r=new URL(Pd);return r.searchParams.set("code",e.toString()),t.forEach(e=>r.searchParams.append("args[]",e)),`${Ld} error #${e}; visit ${r} for the full message.`}),$d=/* @__PURE__ */e.createContext(void 0);function jd(t={}){const{disabled:r=!1,focusableWhenDisabled:n,tabIndex:o=0,native:i=!0,composite:s}=t,a=e.useRef(null),l=function(t=!1){const r=e.useContext($d);if(void 0===r&&!t)throw new Error(Dd(16));return r}(!0),c=s??void 0!==l,{props:d}=function(t){const{focusableWhenDisabled:r,disabled:n,composite:o=!1,tabIndex:i=0,isNativeButton:s}=t,a=o&&!1!==r,l=o&&!1===r;return{props:e.useMemo(()=>{const e={onKeyDown(e){n&&r&&"Tab"!==e.key&&e.preventDefault()}};return o||(e.tabIndex=i,!s&&n&&(e.tabIndex=r?i:-1)),(s&&(r||a)||!s&&n)&&(e["aria-disabled"]=n),!s||r&&!l||(e.disabled=n),e},[o,n,r,a,l,s,i])}}({focusableWhenDisabled:n,disabled:r,composite:c,tabIndex:o,isNativeButton:i}),u=e.useCallback(()=>{const e=a.current;Fd(e)&&c&&r&&void 0===d.disabled&&e.disabled&&(e.disabled=!1)},[r,d.disabled,c]);return Sd(u,[u]),{getButtonProps:e.useCallback((e={})=>{const{onClick:t,onMouseDown:n,onKeyUp:o,onKeyDown:s,onPointerDown:a,...l}=e;return Ed({type:i?"button":void 0,onClick(e){r?e.preventDefault():t?.(e)},onMouseDown(e){r||n?.(e)},onKeyDown(e){if(r)return;if(Rd(e),s?.(e),e.baseUIHandlerPrevented)return;const n=e.target===e.currentTarget,o=e.currentTarget,a=Fd(o),l=!i&&(d=o,Boolean("A"===d?.tagName&&d?.href));var d;const u=n&&(i?a:!l),p="Enter"===e.key,h=" "===e.key,m=o.getAttribute("role"),f=m?.startsWith("menuitem")||"option"===m||"gridcell"===m;if(n&&c&&h){if(e.defaultPrevented&&f)return;return e.preventDefault(),void(l||i&&a?(o.click(),e.preventBaseUIHandler()):u&&(t?.(e),e.preventBaseUIHandler()))}u&&(i||!h&&!p||e.preventDefault(),!i&&p&&t?.(e))},onKeyUp(e){r||(Rd(e),o?.(e),e.target===e.currentTarget&&i&&c&&Fd(e.currentTarget)&&" "===e.key?e.preventDefault():e.baseUIHandlerPrevented||e.target!==e.currentTarget||i||c||" "!==e.key||t?.(e))},onPointerDown(e){r?e.preventDefault():a?.(e)}},i?void 0:{role:"button"},d,l)},[r,d,c,i]),buttonRef:xd(e=>{a.current=e,u()})}}function Fd(e){return gd(e)&&"BUTTON"===e.tagName}function Ud(e,t,r,n){const o=wd(Bd).current;return function(e,t,r,n,o){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==n||e.refs[3]!==o}(o,e,t,r,n)&&Wd(o,[e,t,r,n]),o.callback}function Bd(){return{callback:null,cleanup:null,refs:[]}}function Wd(e,t){e.refs=t,t.every(e=>null==e)?e.callback=null:e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),null!=r){const n=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(r);"function"==typeof t&&(n[e]=t);break}case"object":o.current=r}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){const r=t[e];if(null!=r)switch(typeof r){case"function":{const t=n[e];"function"==typeof t?t():r(null);break}case"object":r.current=null}}}}}}var Gd=parseInt(e.version,10);function Hd(t){if(!/* @__PURE__ */e.isValidElement(t))return null;const r=t,n=r.props;return(Gd>=19?n?.ref:r.ref)??null}Object.freeze([]);var Zd=Object.freeze({});function Vd(t,r,o={}){const i=r.render,s=function(e,t={}){const{className:r,style:n,render:o}=e,{state:i=Zd,ref:s,props:a,stateAttributesMapping:l,enabled:c=!0}=t,d=c?function(e,t){return"function"==typeof e?e(t):e}(r,i):void 0,u=c?function(e,t){return"function"==typeof e?e(t):e}(n,i):void 0,p=c?function(e,t){const r={};for(const n in e){const o=e[n];if(t?.hasOwnProperty(n)){const e=t[n](o);null!=e&&Object.assign(r,e);continue}!0===o?r[`data-${n.toLowerCase()}`]="":o&&(r[`data-${n.toLowerCase()}`]=o.toString())}return r}(i,l):Zd,h=c?Cd(p,Array.isArray(a)?function(e){if(0===e.length)return Id;if(1===e.length)return Od(e[0],Id);let t={...Od(e[0],Id)};for(let r=1;r<e.length;r+=1)t=Td(t,e[r]);return t}(a):a)??Zd:Zd;"undefined"!=typeof document&&(c?Array.isArray(s)?h.ref=function(e){const t=wd(Bd).current;return function(e,t){return e.refs.length!==t.length||e.refs.some((e,r)=>e!==t[r])}(t,e)&&Wd(t,e),t.callback}([h.ref,Hd(o),...s]):h.ref=Ud(h.ref,Hd(o),s):Ud(null,null));if(!c)return Zd;void 0!==d&&(h.className=zd(h.className,d));void 0!==u&&(h.style=Cd(h.style,u));return h}(r,o);return!1===o.enabled?null:function(t,r,o,i){if(r){if("function"==typeof r)return r(o,i);const t=Ed(o,r.props);t.ref=o.ref;let n=r;return n?.$$typeof===qd&&(n=e.Children.toArray(r)[0]),/* @__PURE__ */e.cloneElement(n,t)}if(t&&"string"==typeof t)return function(t,r){return"button"===t?/* @__PURE__ */n("button",{type:"button",...r,key:r.key}):"img"===t?/* @__PURE__ */n("img",{alt:"",...r,key:r.key}):/* @__PURE__ */e.createElement(t,r)}(t,o);throw new Error(Dd(8))}(t,i,s,o.state??Zd)}var qd=Symbol.for("react.lazy");var Jd=/* @__PURE__ */e.forwardRef(function(e,t){const{render:r,className:n,disabled:o=!1,focusableWhenDisabled:i=!1,nativeButton:s=!0,...a}=e,{getButtonProps:l,buttonRef:c}=jd({disabled:o,focusableWhenDisabled:i,native:s});return Vd("button",e,{state:{disabled:o},ref:[t,c],props:[a,l]})}),Yd=(e=/* @__PURE__ */new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Kd="-",Qd=[],Xd=e=>{const t=ru(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:e=>{if(e.startsWith("[")&&e.endsWith("]"))return tu(e);const r=e.split(Kd);return eu(r,""===r[0]&&r.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){const t=n[e],o=r[e];return t?o?((e,t)=>{const r=new Array(e.length+t.length);for(let n=0;n<e.length;n++)r[n]=e[n];for(let n=0;n<t.length;n++)r[e.length+n]=t[n];return r})(o,t):t:o||Qd}return r[e]||Qd}}},eu=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],o=r.nextPart.get(n);if(o){const r=eu(e,t+1,o);if(r)return r}const i=r.validators;if(null===i)return;const s=0===t?e.join(Kd):e.slice(t).join(Kd),a=i.length;for(let l=0;l<a;l++){const e=i[l];if(e.validator(s))return e.classGroupId}},tu=e=>-1===e.slice(1,-1).indexOf(":")?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),n=t.slice(0,r);return n?"arbitrary.."+n:void 0})(),ru=e=>{const{theme:t,classGroups:r}=e;return nu(r,t)},nu=(e,t)=>{const r=Yd();for(const n in e){const o=e[n];ou(o,r,n,t)}return r},ou=(e,t,r,n)=>{const o=e.length;for(let i=0;i<o;i++){const o=e[i];iu(o,t,r,n)}},iu=(e,t,r,n)=>{"string"!=typeof e?"function"!=typeof e?lu(e,t,r,n):au(e,t,r,n):su(e,t,r)},su=(e,t,r)=>{(""===e?t:cu(t,e)).classGroupId=r},au=(e,t,r,n)=>{du(e)?ou(e(n),t,r,n):(null===t.validators&&(t.validators=[]),t.validators.push(((e,t)=>({classGroupId:e,validator:t}))(r,e)))},lu=(e,t,r,n)=>{const o=Object.entries(e),i=o.length;for(let s=0;s<i;s++){const[e,i]=o[s];ou(i,cu(t,e),r,n)}},cu=(e,t)=>{let r=e;const n=t.split(Kd),o=n.length;for(let i=0;i<o;i++){const e=n[i];let t=r.nextPart.get(e);t||(t=Yd(),r.nextPart.set(e,t)),r=t}return r},du=e=>"isThemeGetter"in e&&!0===e.isThemeGetter,uu=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),n=Object.create(null);const o=(o,i)=>{r[o]=i,t++,t>e&&(t=0,n=r,r=Object.create(null))};return{get(e){let t=r[e];return void 0!==t?t:void 0!==(t=n[e])?(o(e,t),t):void 0},set(e,t){e in r?r[e]=t:o(e,t)}}},pu=[],hu=(e,t,r,n,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:n,isExternal:o}),mu=e=>{const{prefix:t,experimentalParseClassName:r}=e;let n=e=>{const t=[];let r,n=0,o=0,i=0;const s=e.length;for(let d=0;d<s;d++){const s=e[d];if(0===n&&0===o){if(":"===s){t.push(e.slice(i,d)),i=d+1;continue}if("/"===s){r=d;continue}}"["===s?n++:"]"===s?n--:"("===s?o++:")"===s&&o--}const a=0===t.length?e:e.slice(i);let l=a,c=!1;a.endsWith("!")?(l=a.slice(0,-1),c=!0):a.startsWith("!")&&(l=a.slice(1),c=!0);return hu(t,c,l,r&&r>i?r-i:void 0)};if(t){const e=t+":",r=n;n=t=>t.startsWith(e)?r(t.slice(e.length)):hu(pu,!1,t,void 0,!0)}if(r){const e=n;n=t=>r({className:t,parseClassName:e})}return n},fu=e=>{const t=/* @__PURE__ */new Map;return e.orderSensitiveModifiers.forEach((e,r)=>{t.set(e,1e6+r)}),e=>{const r=[];let n=[];for(let o=0;o<e.length;o++){const i=e[o],s="["===i[0],a=t.has(i);s||a?(n.length>0&&(n.sort(),r.push(...n),n=[]),r.push(i)):n.push(i)}return n.length>0&&(n.sort(),r.push(...n)),r}},gu=/\s+/,yu=e=>{if("string"==typeof e)return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=yu(e[n]))&&(r&&(r+=" "),r+=t);return r},wu=(e,...t)=>{let r,n,o,i;const s=e=>{const t=n(e);if(t)return t;const i=((e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:o,sortModifiers:i}=t,s=[],a=e.trim().split(gu);let l="";for(let c=a.length-1;c>=0;c-=1){const e=a[c],{isExternal:t,modifiers:d,hasImportantModifier:u,baseClassName:p,maybePostfixModifierPosition:h}=r(e);if(t){l=e+(l.length>0?" "+l:l);continue}let m=!!h,f=n(m?p.substring(0,h):p);if(!f){if(!m){l=e+(l.length>0?" "+l:l);continue}if(f=n(p),!f){l=e+(l.length>0?" "+l:l);continue}m=!1}const g=0===d.length?"":1===d.length?d[0]:i(d).join(":"),y=u?g+"!":g,w=y+f;if(s.indexOf(w)>-1)continue;s.push(w);const b=o(f,m);for(let r=0;r<b.length;++r){const e=b[r];s.push(y+e)}l=e+(l.length>0?" "+l:l)}return l})(e,r);return o(e,i),i};return i=a=>(r=(e=>({cache:uu(e.cacheSize),parseClassName:mu(e),sortModifiers:fu(e),...Xd(e)}))(t.reduce((e,t)=>t(e),e())),n=r.cache.get,o=r.cache.set,i=s,s(a)),(...e)=>i(((...e)=>{let t,r,n=0,o="";for(;n<e.length;)(t=e[n++])&&(r=yu(t))&&(o&&(o+=" "),o+=r);return o})(...e))},bu=[],vu=e=>{const t=t=>t[e]||bu;return t.isThemeGetter=!0,t},xu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ku=/^\((?:(\w[\w-]*):)?(.+)\)$/i,_u=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Su=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Cu=/\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$/,Iu=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Eu=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Tu=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Au=e=>_u.test(e),Mu=e=>!!e&&!Number.isNaN(Number(e)),Ou=e=>!!e&&Number.isInteger(Number(e)),Nu=e=>e.endsWith("%")&&Mu(e.slice(0,-1)),Ru=e=>Su.test(e),zu=()=>!0,Pu=e=>Cu.test(e)&&!Iu.test(e),Lu=()=>!1,Du=e=>Eu.test(e),$u=e=>Tu.test(e),ju=e=>!Uu(e)&&!Ju(e),Fu=e=>np(e,ap,Lu),Uu=e=>xu.test(e),Bu=e=>np(e,lp,Pu),Wu=e=>np(e,cp,Mu),Gu=e=>np(e,up,zu),Hu=e=>np(e,dp,Lu),Zu=e=>np(e,ip,Lu),Vu=e=>np(e,sp,$u),qu=e=>np(e,pp,Du),Ju=e=>ku.test(e),Yu=e=>op(e,lp),Ku=e=>op(e,dp),Qu=e=>op(e,ip),Xu=e=>op(e,ap),ep=e=>op(e,sp),tp=e=>op(e,pp,!0),rp=e=>op(e,up,!0),np=(e,t,r)=>{const n=xu.exec(e);return!!n&&(n[1]?t(n[1]):r(n[2]))},op=(e,t,r=!1)=>{const n=ku.exec(e);return!!n&&(n[1]?t(n[1]):r)},ip=e=>"position"===e||"percentage"===e,sp=e=>"image"===e||"url"===e,ap=e=>"length"===e||"size"===e||"bg-size"===e,lp=e=>"length"===e,cp=e=>"number"===e,dp=e=>"family-name"===e,up=e=>"number"===e||"weight"===e,pp=e=>"shadow"===e,hp=/* @__PURE__ */wu(()=>{const e=vu("color"),t=vu("font"),r=vu("text"),n=vu("font-weight"),o=vu("tracking"),i=vu("leading"),s=vu("breakpoint"),a=vu("container"),l=vu("spacing"),c=vu("radius"),d=vu("shadow"),u=vu("inset-shadow"),p=vu("text-shadow"),h=vu("drop-shadow"),m=vu("blur"),f=vu("perspective"),g=vu("aspect"),y=vu("ease"),w=vu("animate"),b=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Ju,Uu],v=()=>[Ju,Uu,l],x=()=>[Au,"full","auto",...v()],k=()=>[Ou,"none","subgrid",Ju,Uu],_=()=>["auto",{span:["full",Ou,Ju,Uu]},Ou,Ju,Uu],S=()=>[Ou,"auto",Ju,Uu],C=()=>["auto","min","max","fr",Ju,Uu],I=()=>["auto",...v()],E=()=>[Au,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...v()],T=()=>[Au,"screen","full","dvw","lvw","svw","min","max","fit",...v()],A=()=>[Au,"screen","full","lh","dvh","lvh","svh","min","max","fit",...v()],M=()=>[e,Ju,Uu],O=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom",Qu,Zu,{position:[Ju,Uu]}],N=()=>["auto","cover","contain",Xu,Fu,{size:[Ju,Uu]}],R=()=>[Nu,Yu,Bu],z=()=>["","none","full",c,Ju,Uu],P=()=>["",Mu,Yu,Bu],L=()=>[Mu,Nu,Qu,Zu],D=()=>["","none",m,Ju,Uu],$=()=>["none",Mu,Ju,Uu],j=()=>["none",Mu,Ju,Uu],F=()=>[Mu,Ju,Uu],U=()=>[Au,"full",...v()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ru],breakpoint:[Ru],color:[zu],container:[Ru],"drop-shadow":[Ru],ease:["in","out","in-out"],font:[ju],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ru],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ru],shadow:[Ru],spacing:["px",Mu],text:[Ru],"text-shadow":[Ru],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Au,Uu,Ju,g]}],container:["container"],columns:[{columns:[Mu,Uu,Ju,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:b()}],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:[Ou,"auto",Ju,Uu]}],basis:[{basis:[Au,"full","auto",a,...v()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Mu,Au,"auto","initial","none",Uu]}],grow:[{grow:["",Mu,Ju,Uu]}],shrink:[{shrink:["",Mu,Ju,Uu]}],order:[{order:[Ou,"first","last","none",Ju,Uu]}],"grid-cols":[{"grid-cols":k()}],"col-start-end":[{col:_()}],"col-start":[{"col-start":S()}],"col-end":[{"col-end":S()}],"grid-rows":[{"grid-rows":k()}],"row-start-end":[{row:_()}],"row-start":[{"row-start":S()}],"row-end":[{"row-end":S()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":C()}],"auto-rows":[{"auto-rows":C()}],gap:[{gap:v()}],"gap-x":[{"gap-x":v()}],"gap-y":[{"gap-y":v()}],"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:v()}],px:[{px:v()}],py:[{py:v()}],ps:[{ps:v()}],pe:[{pe:v()}],pbs:[{pbs:v()}],pbe:[{pbe:v()}],pt:[{pt:v()}],pr:[{pr:v()}],pb:[{pb:v()}],pl:[{pl:v()}],m:[{m:I()}],mx:[{mx:I()}],my:[{my:I()}],ms:[{ms:I()}],me:[{me:I()}],mbs:[{mbs:I()}],mbe:[{mbe:I()}],mt:[{mt:I()}],mr:[{mr:I()}],mb:[{mb:I()}],ml:[{ml:I()}],"space-x":[{"space-x":v()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":v()}],"space-y-reverse":["space-y-reverse"],size:[{size:E()}],"inline-size":[{inline:["auto",...T()]}],"min-inline-size":[{"min-inline":["auto",...T()]}],"max-inline-size":[{"max-inline":["none",...T()]}],"block-size":[{block:["auto",...A()]}],"min-block-size":[{"min-block":["auto",...A()]}],"max-block-size":[{"max-block":["none",...A()]}],w:[{w:[a,"screen",...E()]}],"min-w":[{"min-w":[a,"screen","none",...E()]}],"max-w":[{"max-w":[a,"screen","none","prose",{screen:[s]},...E()]}],h:[{h:["screen","lh",...E()]}],"min-h":[{"min-h":["screen","lh","none",...E()]}],"max-h":[{"max-h":["screen","lh",...E()]}],"font-size":[{text:["base",r,Yu,Bu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,rp,Gu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Nu,Uu]}],"font-family":[{font:[Ku,Hu,t]}],"font-features":[{"font-features":[Uu]}],"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,Ju,Uu]}],"line-clamp":[{"line-clamp":[Mu,"none",Ju,Wu]}],leading:[{leading:[i,...v()]}],"list-image":[{"list-image":["none",Ju,Uu]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ju,Uu]}],"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:[Mu,"from-font","auto",Ju,Bu]}],"text-decoration-color":[{decoration:M()}],"underline-offset":[{"underline-offset":[Mu,"auto",Ju,Uu]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:v()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ju,Uu]}],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",Ju,Uu]}],"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:N()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ou,Ju,Uu],radial:["",Ju,Uu],conic:[Ou,Ju,Uu]},ep,Vu]}],"bg-color":[{bg:M()}],"gradient-from-pos":[{from:R()}],"gradient-via-pos":[{via:R()}],"gradient-to-pos":[{to:R()}],"gradient-from":[{from:M()}],"gradient-via":[{via:M()}],"gradient-to":[{to:M()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"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":[Mu,Ju,Uu]}],"outline-w":[{outline:["",Mu,Yu,Bu]}],"outline-color":[{outline:M()}],shadow:[{shadow:["","none",d,tp,qu]}],"shadow-color":[{shadow:M()}],"inset-shadow":[{"inset-shadow":["none",u,tp,qu]}],"inset-shadow-color":[{"inset-shadow":M()}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:M()}],"ring-offset-w":[{"ring-offset":[Mu,Bu]}],"ring-offset-color":[{"ring-offset":M()}],"inset-ring-w":[{"inset-ring":P()}],"inset-ring-color":[{"inset-ring":M()}],"text-shadow":[{"text-shadow":["none",p,tp,qu]}],"text-shadow-color":[{"text-shadow":M()}],opacity:[{opacity:[Mu,Ju,Uu]}],"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":[Mu]}],"mask-image-linear-from-pos":[{"mask-linear-from":L()}],"mask-image-linear-to-pos":[{"mask-linear-to":L()}],"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":L()}],"mask-image-t-to-pos":[{"mask-t-to":L()}],"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":L()}],"mask-image-r-to-pos":[{"mask-r-to":L()}],"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":L()}],"mask-image-b-to-pos":[{"mask-b-to":L()}],"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":L()}],"mask-image-l-to-pos":[{"mask-l-to":L()}],"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":L()}],"mask-image-x-to-pos":[{"mask-x-to":L()}],"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":L()}],"mask-image-y-to-pos":[{"mask-y-to":L()}],"mask-image-y-from-color":[{"mask-y-from":M()}],"mask-image-y-to-color":[{"mask-y-to":M()}],"mask-image-radial":[{"mask-radial":[Ju,Uu]}],"mask-image-radial-from-pos":[{"mask-radial-from":L()}],"mask-image-radial-to-pos":[{"mask-radial-to":L()}],"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":[Mu]}],"mask-image-conic-from-pos":[{"mask-conic-from":L()}],"mask-image-conic-to-pos":[{"mask-conic-to":L()}],"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:N()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ju,Uu]}],filter:[{filter:["","none",Ju,Uu]}],blur:[{blur:D()}],brightness:[{brightness:[Mu,Ju,Uu]}],contrast:[{contrast:[Mu,Ju,Uu]}],"drop-shadow":[{"drop-shadow":["","none",h,tp,qu]}],"drop-shadow-color":[{"drop-shadow":M()}],grayscale:[{grayscale:["",Mu,Ju,Uu]}],"hue-rotate":[{"hue-rotate":[Mu,Ju,Uu]}],invert:[{invert:["",Mu,Ju,Uu]}],saturate:[{saturate:[Mu,Ju,Uu]}],sepia:[{sepia:["",Mu,Ju,Uu]}],"backdrop-filter":[{"backdrop-filter":["","none",Ju,Uu]}],"backdrop-blur":[{"backdrop-blur":D()}],"backdrop-brightness":[{"backdrop-brightness":[Mu,Ju,Uu]}],"backdrop-contrast":[{"backdrop-contrast":[Mu,Ju,Uu]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Mu,Ju,Uu]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Mu,Ju,Uu]}],"backdrop-invert":[{"backdrop-invert":["",Mu,Ju,Uu]}],"backdrop-opacity":[{"backdrop-opacity":[Mu,Ju,Uu]}],"backdrop-saturate":[{"backdrop-saturate":[Mu,Ju,Uu]}],"backdrop-sepia":[{"backdrop-sepia":["",Mu,Ju,Uu]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":v()}],"border-spacing-x":[{"border-spacing-x":v()}],"border-spacing-y":[{"border-spacing-y":v()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ju,Uu]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Mu,"initial",Ju,Uu]}],ease:[{ease:["linear","initial",y,Ju,Uu]}],delay:[{delay:[Mu,Ju,Uu]}],animate:[{animate:["none",w,Ju,Uu]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,Ju,Uu]}],"perspective-origin":[{"perspective-origin":b()}],rotate:[{rotate:$()}],"rotate-x":[{"rotate-x":$()}],"rotate-y":[{"rotate-y":$()}],"rotate-z":[{"rotate-z":$()}],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:[Ju,Uu,"","none","gpu","cpu"]}],"transform-origin":[{origin:b()}],"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"],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",Ju,Uu]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":v()}],"scroll-mx":[{"scroll-mx":v()}],"scroll-my":[{"scroll-my":v()}],"scroll-ms":[{"scroll-ms":v()}],"scroll-me":[{"scroll-me":v()}],"scroll-mbs":[{"scroll-mbs":v()}],"scroll-mbe":[{"scroll-mbe":v()}],"scroll-mt":[{"scroll-mt":v()}],"scroll-mr":[{"scroll-mr":v()}],"scroll-mb":[{"scroll-mb":v()}],"scroll-ml":[{"scroll-ml":v()}],"scroll-p":[{"scroll-p":v()}],"scroll-px":[{"scroll-px":v()}],"scroll-py":[{"scroll-py":v()}],"scroll-ps":[{"scroll-ps":v()}],"scroll-pe":[{"scroll-pe":v()}],"scroll-pbs":[{"scroll-pbs":v()}],"scroll-pbe":[{"scroll-pbe":v()}],"scroll-pt":[{"scroll-pt":v()}],"scroll-pr":[{"scroll-pr":v()}],"scroll-pb":[{"scroll-pb":v()}],"scroll-pl":[{"scroll-pl":v()}],"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",Ju,Uu]}],fill:[{fill:["none",...M()]}],"stroke-w":[{stroke:[Mu,Yu,Bu,Wu]}],stroke:[{stroke:["none",...M()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function mp(...e){return hp(e.filter(Boolean).join(" "))}var fp={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",danger:"bg-destructive text-destructive-foreground border-transparent hover:bg-destructive/90"},gp={sm:"px-2 py-1 text-xs min-h-7",md:"px-4 py-2 text-sm min-h-9",lg:"px-6 py-3 text-base min-h-11"},yp=o(function({className:e,disabled:t,loading:r=!1,size:n="md",type:o="button",variant:i="primary",...s},a){const l=t||r;/* @__PURE__ */
|
|
4
|
+
return g(Jd,{...s,ref:a,"aria-busy":r||void 0,className:mp("inline-flex items-center justify-center gap-2 font-medium border rounded-lg cursor-pointer transition-all focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2",fp[i],gp[n],l&&!r&&"opacity-50 cursor-not-allowed pointer-events-none",r&&"opacity-70 cursor-wait pointer-events-none",e),"data-disabled":l?"true":"false","data-loading":r?"true":"false","data-size":n,"data-variant":i,disabled:l,type:o})}),wp=({config:e,onClick:t,onStopTask:r,isOpen:n,isMinimized:o=!1,isLoading:i=!1,isTaskRunning:a=!1,hasError:c=!1,position:u,onPositionChange:m})=>{const f=!n&&(i||a),w=!n&&a&&!!r,b=c?"marketrix-widget-button-error-glow":"marketrix-widget-button-processing-glow",v=c?"marketrix-widget-button-error-activity-ring":"marketrix-widget-button-processing-activity-ring",[x,k]=h(!1),_=p(null),[S,I]=h({w:56,h:56}),[,T]=h(0),A=p(null),M=p(null),O=p(null),N=p(0),R=p([]),z=p(0),{config:P,isPreviewMode:L}=ud({config:e}),D=Math.max(6,Math.min(22,Number.parseFloat(P.widget_border_radius)||12));l(()=>()=>{null!==O.current&&window.cancelAnimationFrame(O.current)},[]);const $=s(()=>{if(!_.current||"undefined"==typeof window)return;const e=_.current.getBoundingClientRect();I(t=>t.w===e.width&&t.h===e.height?t:{w:e.width,h:e.height})},[]);d(()=>{$();const e="undefined"!=typeof window&&_.current?new ResizeObserver($):null;return e&&_.current&&e.observe(_.current),()=>e?.disconnect()},[$,u]),l(()=>{if(L)return;const e=()=>T(e=>e+1);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[L]);const j=u,F=P.widget_position_z_index??50,U=(e=>{switch(e){case"bottom_right":default:return"bottom-5 right-5";case"bottom_left":return"bottom-5 left-5";case"top_right":return"top-5 right-5";case"top_left":return"top-5 left-5"}})(j),B=L?"absolute":"fixed",W="undefined"!=typeof window?window.innerWidth:0,G="undefined"!=typeof window?window.innerHeight:0,H=md(j,W,G,S.w,S.h),Z=!L&&W>0&&G>0?{left:H.x,top:H.y}:void 0,V=L?j.includes("top")?{top:"20px",...j.includes("right")?{right:"20px"}:{left:"20px"}}:{bottom:"20px",...j.includes("right")?{right:"20px"}:{left:"20px"}}:{},q=(e,t=.999)=>e/1e3*t/(1-t),J=()=>{null!==O.current&&(window.cancelAnimationFrame(O.current),O.current=null),_.current&&(_.current.style.transform="",_.current.style.willChange="",_.current.style.transition="")},Y="cubic-bezier(0.16, 1, 0.3, 1)",K=s((e,t)=>{if(A.current)return;let r=!1;const n=()=>{r||(r=!0,A.current=null,t.style.transition="none",t.style.willChange="",m(e),k(!1),requestAnimationFrame(()=>{_.current&&(_.current.style.transition="")}))};A.current=n;const o=window.setTimeout(n,650);t.addEventListener("transitionend",function e(r){r.target===t&&"left"===r.propertyName&&(window.clearTimeout(o),t.removeEventListener("transitionend",e),n())})},[m]);/* @__PURE__ */
|
|
5
|
+
return y("div",{ref:_,className:`${B} ${Z?"":U} ${x?"":"transition-transform duration-300 ease-in-out"}`,style:{zIndex:F,pointerEvents:"auto",...V,...Z},children:[/* @__PURE__ */y("div",{className:`\n group relative w-14 h-14 overflow-visible transition-all duration-300 ease-in-out\n ${n?"scale-0 opacity-0 pointer-events-none":"scale-100 opacity-100 hover:scale-110"}\n `,children:[f&&/* @__PURE__ */g("div",{className:b,"aria-hidden":!0}),w&&!x&&/* @__PURE__ */g(yp,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),r?.()},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 "+(j.includes("left")?"left-full ml-2":"right-full mr-2"),style:{border:"1px solid rgba(255,255,255,0.25)"},"aria-label":"Stop running task",children:"Stop"}),
|
|
6
|
+
/* @__PURE__ */g(yp,{type:"button",variant:"primary",onClick:()=>{Date.now()<N.current||t()},onDragStart:e=>e.preventDefault(),onPointerDown:e=>{n||(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 r=e.clientX-t.startX,n=e.clientY-t.startY;if(!t.dragging&&Math.hypot(r,n)>5&&(t.dragging=!0,k(!0),R.current=[],z.current=0,_.current&&(_.current.style.willChange="transform",_.current.style.transition="none")),!t.dragging)return;t.lastX=r,t.lastY=n;const o=Date.now();o-z.current>=10&&(z.current=o,R.current=[...R.current.slice(-5),{x:e.clientX,y:e.clientY,t:o}]),null===O.current&&(O.current=window.requestAnimationFrame(()=>{O.current=null;const e=M.current,t=_.current;t&&e&&(t.style.transform=`translate3d(${e.lastX}px, ${e.lastY}px, 0)`)}))},onPointerUp:e=>{const t=M.current;if(t?.pointerId===e.pointerId){if(t.dragging){const r=(()=>{const e=R.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}})(),n=q(r.x),o=q(r.y),i={dx:t.lastX+n,dy:t.lastY+o};let s;if("undefined"!=typeof window&&_.current){const e=_.current.getBoundingClientRect();s=((e,t,r,n,o,i)=>{const s=["top_left","top_right","bottom_left","bottom_right"];let a=t,l=1/0;for(const c of s){const s=fd(t,c,r,n,o,i),d=Math.hypot(e.dx-s.dx,e.dy-s.dy);d<l&&(l=d,a=c)}return a})(i,u,window.innerWidth,window.innerHeight,e.width,e.height)}else s=u;return((e,t,r)=>{if(!_.current||!Z)return J(),m(e),void k(!1);null!==O.current&&(window.cancelAnimationFrame(O.current),O.current=null);const n=_.current,o=md(u,W,G,S.w,S.h),i=md(e,W,G,S.w,S.h);n.style.transition="none",n.style.transform="none",n.style.willChange="left, top",n.style.left=`${o.x+t}px`,n.style.top=`${o.y+r}px`,requestAnimationFrame(()=>{n.style.transition=`left 600ms ${Y}, top 600ms ${Y}`,n.style.left=`${i.x}px`,n.style.top=`${i.y}px`}),K(e,n)})(s,t.lastX,t.lastY),N.current=Date.now()+600,M.current=null,void e.currentTarget.releasePointerCapture(e.pointerId)}J(),M.current=null,k(!1),e.currentTarget.releasePointerCapture(e.pointerId)}},onPointerCancel:e=>{M.current?.pointerId===e.pointerId&&(J(),M.current=null,k(!1),e.currentTarget.releasePointerCapture(e.pointerId))},className:"relative z-10 w-14 h-14 min-w-14 rounded-[27px] border-0 bg-transparent p-0 text-primary-foreground",style:{touchAction:"none",cursor:x?"grabbing":"grab",userSelect:"none",WebkitUserSelect:"none"},"aria-label":n?"Close":"Open","aria-live":"polite",children:/* @__PURE__ */g("div",{className:"w-full h-full flex items-center justify-center relative",children:/* @__PURE__ */y("div",{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:P.widget_border_radius,backgroundColor:n?P.widget_background_color:P.widget_accent_color},children:[f&&/* @__PURE__ */g("svg",{className:v,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:D+1,ry:D+1})}),
|
|
7
|
+
/* @__PURE__ */g("div",{className:"absolute inset-0 flex items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:n?"rotate(30deg) scale(0)":"rotate(0deg) scale(1)",opacity:n?0:1,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":n,children:/* @__PURE__ */g("img",{src:pd,alt:"",className:"relative z-10 w-full h-full object-contain",draggable:!1,onDragStart:e=>e.preventDefault(),style:{borderRadius:P.widget_border_radius,border:"none",outline:"none",backgroundColor:"transparent",pointerEvents:"none",userSelect:"none"}})}),
|
|
8
|
+
/* @__PURE__ */g("div",{className:"absolute inset-0 flex items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:n?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:n?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!n,children:/* @__PURE__ */g("svg",{className:"w-6 h-6 relative z-10 text-foreground pointer-events-none",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.5,d:"M19 9l-7 7-7-7"})})})]})})})]}),!n&&/* @__PURE__ */y("div",{className:`absolute bottom-16 ${j.includes("left")?"left-0":"right-0"} mb-2 px-3 py-2 text-sm rounded-lg shadow-lg whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity duration-200`,style:{backgroundColor:E(P.widget_accent_color,.3),color:C(E(P.widget_accent_color,.3))},children:["Support Agent",/* @__PURE__ */g("div",{className:`absolute top-full ${j.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:E(P.widget_accent_color,.3)}})]})]})},bp={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},vp=t.createContext&&/* @__PURE__ */t.createContext(bp),xp=["attr","size","title"];function kp(){return kp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},kp.apply(null,arguments)}function _p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Sp(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_p(Object(r),!0).forEach(function(t){Cp(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_p(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Cp(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ip(e){return e&&e.map((e,r)=>/* @__PURE__ */t.createElement(e.tag,Sp({key:r},e.attr),Ip(e.child)))}function Ep(e){return r=>/* @__PURE__ */t.createElement(Tp,kp({attr:Sp({},e.attr)},r),Ip(e.child))}function Tp(e){var r=r=>{var n,{attr:o,size:i,title:s}=e,a=function(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,xp),l=i||r.size||"1em";return r.className&&(n=r.className),e.className&&(n=(n?n+" ":"")+e.className),/* @__PURE__ */t.createElement("svg",kp({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,o,a,{className:n,style:Sp(Sp({color:e.color||r.color},r.style),e.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),s&&/* @__PURE__ */t.createElement("title",null,s),e.children)};return void 0!==vp?/* @__PURE__ */t.createElement(vp.Consumer,null,e=>r(e)):r(bp)}function Ap(e){return Ep({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"18",y1:"6",x2:"6",y2:"18"},child:[]},{tag:"line",attr:{x1:"6",y1:"6",x2:"18",y2:"18"},child:[]}]})(e)}function Mp(e){return Ep({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"3 6 5 6 21 6"},child:[]},{tag:"path",attr:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},child:[]},{tag:"line",attr:{x1:"10",y1:"11",x2:"10",y2:"17"},child:[]},{tag:"line",attr:{x1:"14",y1:"11",x2:"14",y2:"17"},child:[]}]})(e)}function Op(e){return Ep({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12.01",y2:"8"},child:[]}]})(e)}var Np="3.2.172";function Rp(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 zp(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function Pp(e,t,r){return Math.min(Math.max(e,t),r)}function Lp(e,t,r,n,o){const i={"bottom-right":"nwse-resize","bottom-left":"nesw-resize","top-right":"nesw-resize","top-left":"nwse-resize"};switch(e){case"bottom-right":return{dx:n-t,dy:o-r,cursor:i[e]};case"bottom-left":return{dx:t-n,dy:o-r,cursor:i[e]};case"top-right":return{dx:n-t,dy:r-o,cursor:i[e]};case"top-left":return{dx:t-n,dy:r-o,cursor:i[e]}}}var Dp={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"},$p={sm:"w-7 h-7 min-w-7",md:"w-9 h-9 min-w-9"},jp=o(function({variant:e="ghost",size:t="sm",rounded:r=!0,label:n,disabled:o,children:i,...s},a){/* @__PURE__ */
|
|
9
|
+
return g("button",{...s,ref:a,type:"button",disabled:o,"aria-label":n,className:mp("inline-flex items-center justify-center flex-shrink-0 border-none cursor-pointer transition-all",Dp[e],$p[t],r?"rounded-full":"rounded-[var(--radius)]",o&&"opacity-50 cursor-not-allowed pointer-events-none"),children:i})}),Fp=r(null);function Up(e){const t=a(Fp);if(!t)throw new Error(`${e} must be used within Dialog`);return t}function Bp({children:e,defaultOpen:t=!1,onOpenChange:r,open:n}){const[o,i]=h(t),a=void 0!==n,l=a?n:o,d=c(),p=c(),m=c(),f=s(e=>{a||i(e),r?.(e)},[a,r]),y=u(()=>({contentId:d,descriptionId:m,open:l,setOpen:f,titleId:p}),[d,m,l,f,p]);/* @__PURE__ */
|
|
10
|
+
return g(Fp.Provider,{value:y,children:e})}function Wp({children:e,className:t,onKeyDown:r,...n}){const o=Up("DialogContent");return l(()=>{if(!o.open)return;const e=e=>{"Escape"===e.key&&o.setOpen(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[o]),o.open?/* @__PURE__ */g("div",{...n,"aria-describedby":o.descriptionId,"aria-labelledby":o.titleId,"aria-modal":"true",className:mp("fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[calc(var(--layer-dialog)+1)] flex flex-col w-full max-w-[500px] max-h-[85vh] overflow-auto bg-card rounded-lg shadow-xl p-6 animate-dialog-content-in",t),"data-state":"open",id:o.contentId,onKeyDown:e=>{r?.(e),e.defaultPrevented||"Escape"!==e.key||o.setOpen(!1)},role:"dialog",tabIndex:-1,children:e}):null}function Gp({className:e,...t}){const r=Up("DialogTitle");/* @__PURE__ */
|
|
11
|
+
return g("h2",{...t,className:mp("text-lg font-semibold text-card-foreground mb-2",e),id:r.titleId})}function Hp({className:e,...t}){const r=Up("DialogDescription");/* @__PURE__ */
|
|
12
|
+
return g("p",{...t,className:mp("text-sm text-muted-foreground mb-4",e),id:r.descriptionId})}function Zp({children:e,className:t,onClick:r,...n}){const o=Up("DialogClose");/* @__PURE__ */
|
|
13
|
+
return g("button",{...n,className:mp("absolute top-4 right-4 flex items-center justify-center w-8 h-8 p-0 bg-transparent border-none rounded-lg text-muted-foreground cursor-pointer transition-colors hover:bg-muted",t),onClick:e=>{r?.(e),e.defaultPrevented||o.setOpen(!1)},type:"button",children:e})}var Vp=({isOpen:e,onClose:t,diagnosticData:r})=>{const n="registered"===r.connectionStatus?"bg-green-100 text-green-700":"connected"===r.connectionStatus?"bg-blue-100 text-blue-700":"connecting"===r.connectionStatus?"bg-yellow-100 text-yellow-700":"bg-gray-100 text-gray-600",o=[{label:"Chat ID",value:r.chatId,copyable:!0},{label:"Stream Endpoint",value:r.streamEndpoint,copyable:!0},{label:"Application ID",value:r.applicationId?.toString(),copyable:!0},{label:"Agent ID",value:r.agentId?.toString(),copyable:!0}];/* @__PURE__ */
|
|
14
|
+
return g(Bp,{open:e,onOpenChange:e=>{e||t()},children:/* @__PURE__ */y(Wp,{className:"bg-white rounded-md shadow-lg border border-gray-200 w-64 p-0",children:[/* @__PURE__ */y("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-gray-100",children:[/* @__PURE__ */y(Gp,{className:"text-[11px] font-semibold text-gray-700 flex-1 text-center mb-0",children:["Widget v",r.version," (","dev"===r.build?"dev":r.build.slice(0,7),")"]}),/* @__PURE__ */g(Zp,{className:"text-gray-400 hover:text-gray-600 -mr-1 static w-auto h-auto","aria-label":"Close diagnostic",children:/* @__PURE__ */g(Ap,{className:"w-3 h-3"})})]}),/* @__PURE__ */y("div",{className:"px-3 py-1.5",children:[o.map(e=>/* @__PURE__ */y("div",{className:"flex items-center justify-between py-[3px]",children:[/* @__PURE__ */g("span",{className:"text-[10px] text-gray-500",children:e.label}),/* @__PURE__ */y("div",{className:"flex items-center gap-1",children:[/* @__PURE__ */g("code",{className:"text-[9px] text-gray-600 bg-gray-50 px-1 py-0.5 rounded max-w-[120px] truncate",children:e.value||"N/A"}),e.copyable&&e.value&&/* @__PURE__ */g(yp,{type:"button",variant:"ghost",size:"sm",onClick:()=>{var t;(t=e.value)&&navigator.clipboard.writeText(t.toString())},className:"text-[9px] text-blue-500 hover:text-blue-600 min-w-0 p-0 h-auto",children:"Copy"})]})]},e.label)),/* @__PURE__ */y("div",{className:"flex items-center justify-between py-[3px]",children:[/* @__PURE__ */g("span",{className:"text-[10px] text-gray-500",children:"Status"}),/* @__PURE__ */g("span",{className:`text-[9px] font-medium px-1.5 py-0.5 rounded ${n}`,children:r.connectionStatus})]})]})]})})};function qp(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"},child:[]}]})(e)}function Jp(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z"},child:[]}]})(e)}function Yp(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{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"},child:[]}]})(e)}function Kp(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"},child:[]}]})(e)}function Qp(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{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"},child:[]}]})(e)}function Xp(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"},child:[]}]})(e)}function eh(e){return Ep({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{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"},child:[]}]})(e)}function th(e){return Ep({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{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"},child:[]}]})(e)}var rh=({variant:e,message:t,className:r,actionLabel:n,onAction:o})=>{const i="error"===e,s="loading"===e;/* @__PURE__ */
|
|
15
|
+
return y("div",{className:mp("flex flex-col items-center justify-center gap-3 py-6 px-4 text-center",i&&"text-red-600",r),role:s?"status":void 0,"aria-live":i?"assertive":"polite",children:[s&&/* @__PURE__ */g("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-current border-t-transparent","aria-hidden":!0}),
|
|
16
|
+
/* @__PURE__ */g("p",{className:"text-sm",children:t}),n&&o&&/* @__PURE__ */g("button",{type:"button",onClick:o,className:"text-sm font-medium underline focus:outline-none focus:ring-2 focus:ring-offset-2 rounded",children:n})]})},nh=({content:e,status:t="pending",isWaitingForUser:r,accentColor:n,textColor:o,hideIcon:i=!1,textStyle:s="default"})=>/* @__PURE__ */y("div",{className:"flex items-start gap-2",children:[!i&&(()=>{switch(t){case"completed":/* @__PURE__ */return g(Qp,{className:"flex-shrink-0 mt-0.5",style:{color:n},size:16});case"failed":/* @__PURE__ */return g(qp,{className:"flex-shrink-0 mt-0.5",style:{color:I(o,.65)},size:16});case"canceled":/* @__PURE__ */return g(Xp,{className:"flex-shrink-0 mt-0.5",style:{color:I(o,.5)},size:16});case"running":return r?/* @__PURE__ */y("div",{className:"flex-shrink-0 mt-0.5 spinner-container",style:{width:"16px",height:"16px",position:"relative"},children:[/* @__PURE__ */g("div",{className:"spinner",style:{width:"16px",height:"16px",border:`2px solid ${I(o,.2)}`,borderTop:`2px solid ${n}`,borderRadius:"50%",animation:"spin 1s linear infinite"}}),/* @__PURE__ */g("style",{children:"\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n "})]}):/* @__PURE__ */g(Jp,{className:"flex-shrink-0 mt-0.5 animate-spin",style:{color:n},size:16});default:/* @__PURE__ */return g(Kp,{className:"flex-shrink-0 mt-0.5",style:{color:I(o,.5)},size:16})}})(),/* @__PURE__ */g("span",{className:"flex-1 whitespace-pre-wrap text-xs font-inter font-medium leading-tight",style:{color:"muted"===s?I(o,.5):o},children:e})]}),oh=({isWaitingForUser:e,textColor:t,customText:r,accentColor:n})=>/* @__PURE__ */y("div",{className:"flex items-center gap-1.5 py-0.5",children:[/* @__PURE__ */g(Jp,{className:"flex-shrink-0 animate-spin",style:{color:n||I(t,.5)},size:12}),/* @__PURE__ */g("span",{className:"text-[10px] font-inter font-normal",style:{color:I(t,.5)},children:r||(e?"Waiting for you to complete the action":"Thinking")})]}),ih=({message:e,isLastMessage:t,widgetState:r,accentColor:n,textColor:o})=>{const i="waiting-for-user"===(e.placeholderState||"thinking");return e.parts&&e.parts.length>0?/* @__PURE__ */y("div",{className:"flex flex-col gap-1.5",children:[e.parts.map((t,s)=>{if("text"===t.type){let e=(a=t.content,a.replace(/\n\n__THINKING__$/,"").replace(/__THINKING__/g,"")).trim();return e=e.replace(/\(Cancelled by cleanup\)/gi,"").replace(/\s+/g," ").trim(),e?/* @__PURE__ */g("div",{className:"text-xs font-inter font-medium leading-tight break-words whitespace-pre-wrap mb-1",children:e},`part-${s}`):null}if("progress"===t.type){if("done"===t.toolName&&"done"===e.taskStatus)return null;const a="running"===t.status||!t.status,l=i||a&&r.isTaskRunning&&("show"===e.mode||"do"===e.mode);/* @__PURE__ */
|
|
17
|
+
return g(nh,{content:t.content,status:t.status||"running",isWaitingForUser:l,accentColor:n,textColor:o,...void 0!==t.hideIcon?{hideIcon:t.hideIcon}:{},...void 0!==t.textStyle?{textStyle:t.textStyle}:{}},`part-${s}`)}var a;return null}),(e.isPlaceholder&&!e.parts.some(e=>"text"===e.type)||r.isTaskRunning&&t&&("show"===e.mode||"do"===e.mode))&&/* @__PURE__ */g(oh,{isWaitingForUser:i,textColor:o,accentColor:n})]}):e.isPlaceholder||r.isTaskRunning&&t&&("show"===e.mode||"do"===e.mode)?/* @__PURE__ */g(oh,{isWaitingForUser:i,textColor:o,accentColor:n}):/* @__PURE__ */g("div",{})},sh=({status:e,accentColor:t})=>{switch(e){case"done":/* @__PURE__ */return g(Qp,{className:"flex-shrink-0",style:{color:t},size:14});case"failed":/* @__PURE__ */return g(Yp,{className:"flex-shrink-0",style:{color:I(t,.75)},size:14});case"stopped":/* @__PURE__ */return g(Kp,{className:"flex-shrink-0",style:{color:I(t,.5)},size:14});default:/* @__PURE__ */return g(Jp,{className:"flex-shrink-0 animate-spin",style:{color:t},size:14})}},ah=({stream:e,isUserMessage:t=!1})=>{const r=p(null),n=p(null),[o,i]=h(!1),[s,a]=h(!1);if(l(()=>{if(r.current&&e){const t=r.current;i(!1),a(!1),n.current&&(n.current.catch(()=>{}),n.current=null),t.srcObject=e;const o=()=>{i(!0)},s=()=>{a(!0),i(!1)};t.addEventListener("loadedmetadata",o),t.addEventListener("error",s);const l=t.play();return n.current=l,l.then(()=>{i(!0)}).catch(e=>{e instanceof Error&&"AbortError"!==e.name&&a(!0),n.current=null}),()=>{t.removeEventListener("loadedmetadata",o),t.removeEventListener("error",s)}}return()=>{n.current&&(n.current.catch(()=>{}),n.current=null),r.current&&(r.current.srcObject=null),i(!1),a(!1)}},[e]),!e)return null;const c=t?"rounded-tl-lg rounded-tr-lg":"rounded-tr-lg rounded-tl-lg";/* @__PURE__ */
|
|
17
18
|
return y("div",{className:`w-full overflow-hidden mb-1 ${c} relative group`,style:{backgroundColor:"#000000",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06)"},children:[!o&&!s&&/* @__PURE__ */g("div",{className:`absolute inset-0 flex items-center justify-center bg-gray-900 ${c} z-10 transition-opacity duration-300 ${o?"opacity-0":"opacity-100"}`,children:/* @__PURE__ */y("div",{className:"flex flex-col items-center gap-2",children:[/* @__PURE__ */y("div",{className:"relative w-8 h-8",children:[/* @__PURE__ */g("div",{className:"absolute inset-0 border-2 border-white border-t-transparent rounded-full animate-spin"}),/* @__PURE__ */g("div",{className:"absolute inset-0 border-2 border-transparent border-r-white rounded-full animate-spin",style:{animationDirection:"reverse",animationDuration:"0.8s"}})]}),/* @__PURE__ */g("span",{className:"text-xs text-white/70 font-medium",children:"Loading stream..."})]})}),s&&/* @__PURE__ */g("div",{className:`absolute inset-0 flex items-center justify-center bg-gray-900 ${c} z-10`,children:/* @__PURE__ */y("div",{className:"flex flex-col items-center gap-2 text-center px-4",children:[/* @__PURE__ */g("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),/* @__PURE__ */g("span",{className:"text-xs text-white/70 font-medium",children:"Failed to load stream"})]})}),
|
|
18
|
-
/* @__PURE__ */g("video",{ref:
|
|
19
|
-
/* @__PURE__ */g("div",{className:`absolute inset-0 ${c} bg-black/0 group-hover:bg-black/20 transition-all duration-300 flex items-center justify-center opacity-0 group-hover:opacity-100 z-30 pointer-events-none`,children:/* @__PURE__ */g("div",{className:"px-3 py-1.5 rounded-lg bg-black/70 backdrop-blur-sm text-white text-xs font-medium",children:"Screen Sharing Active"})})]})},
|
|
20
|
-
return y("div",{className:"group flex flex-col mt-[10px] "+(
|
|
21
|
-
/* @__PURE__ */y("div",{className:"flex items-start gap-1 w-full flex-row",children:[/* @__PURE__ */g("div",{className:"flex-shrink-0 agent-logo-img-container
|
|
22
|
-
/* @__PURE__ */y("div",{ref:x,onScroll:k,role:"log","aria-relevant":"additions",className:"h-full overflow-y-auto px-2 space-y-0.5 pt-0 scrollbar-thin scrollbar-track-gray-100 scrollbar-thumb-gray-400",style:{backgroundColor:d.widget_background_color.includes("gradient")?"transparent":d.widget_background_color,backgroundImage:d.widget_background_color.includes("gradient")?d.widget_background_color:`linear-gradient(135deg, ${d.widget_background_color} 0%, ${d.widget_background_color} 100%)`,scrollbarColor:`${
|
|
23
|
-
/* @__PURE__ */g(
|
|
24
|
-
/* @__PURE__ */g("div",{ref:t},"scroll-anchor")]},"message-list-container"),f&&/* @__PURE__ */g("div",{className:"absolute top-2 left-0 right-0 flex justify-center z-10 pointer-events-none",children:/* @__PURE__ */g(yp,{type:"button",variant:"secondary",size:"sm",onClick:()=>{x.current?.scrollTo({top:0,behavior:"smooth"})},className:"p-1.5 rounded-full shadow-md bg-white/90 hover:bg-white border border-gray-200 pointer-events-auto",style:{border:"1px solid #e5e7eb"},title:"Scroll to top","aria-label":"Scroll to top",children:/* @__PURE__ */g(
|
|
25
|
-
return
|
|
26
|
-
return y(
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
/* @__PURE__ */g(
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */y("
|
|
19
|
+
/* @__PURE__ */g("video",{ref:r,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-auto max-h-48 object-contain ${c} transition-opacity duration-500 ${o?"opacity-100":"opacity-0"}`,style:{minHeight:"120px",background:"linear-gradient(135deg, #111827 0%, #374151 100%)"}}),o&&!s&&/* @__PURE__ */y("div",{className:"absolute top-2 right-2 flex items-center gap-1.5 px-2 py-1 rounded-full bg-gray-700/90 backdrop-blur-sm z-20 animate-fade-in",style:{boxShadow:"0 2px 8px rgba(31, 41, 55, 0.4)"},children:[/* @__PURE__ */y("div",{className:"relative flex items-center justify-center",children:[/* @__PURE__ */g("div",{className:"absolute w-2 h-2 rounded-full bg-white animate-ping opacity-75"}),/* @__PURE__ */g("div",{className:"relative w-1.5 h-1.5 rounded-full bg-white"})]}),/* @__PURE__ */g("span",{className:"text-[10px] font-semibold text-white uppercase tracking-wide",children:"Live"})]}),
|
|
20
|
+
/* @__PURE__ */g("div",{className:`absolute inset-0 ${c} bg-black/0 group-hover:bg-black/20 transition-all duration-300 flex items-center justify-center opacity-0 group-hover:opacity-100 z-30 pointer-events-none`,children:/* @__PURE__ */g("div",{className:"px-3 py-1.5 rounded-lg bg-black/70 backdrop-blur-sm text-white text-xs font-medium",children:"Screen Sharing Active"})})]})},lh=({message:e,index:t,isLastMessage:r,widgetState:n,settings:o,marketrixIcon:i,onScreenAccessAllow:s,onScreenAccessDeny:a})=>{if(e.isSystemMessage)/* @__PURE__ */return g("div",{className:"flex justify-center items-center py-0",children:/* @__PURE__ */g("span",{className:"text-[10px] font-inter font-normal text-foreground-faint",children:e.content})},`message-${e.id}-${t}`);const l="user"===e.sender;/* @__PURE__ */
|
|
21
|
+
return y("div",{className:"group flex flex-col mt-[10px] "+(r?"animate-message-enter":""),role:"article","aria-roledescription":"message","aria-label":l?"You said…":"Agent says…",children:[
|
|
22
|
+
/* @__PURE__ */y("div",{className:"flex items-start gap-1 w-full flex-row",children:[/* @__PURE__ */g("div",{className:"flex-shrink-0 agent-logo-img-container w-8 h-8 bg-transparent",children:!l&&/* @__PURE__ */g("img",{src:i,alt:"Marketrix AI",className:"agent-logo-img w-8 h-8 shadow-[var(--shadow)] rounded-[var(--radius)] block object-cover bg-transparent",style:{border:"none",outline:"none"}})}),/* @__PURE__ */y("div",{className:`flex flex-col flex-1 relative\n ${e.videoStream?"p-0":"px-2.5 py-2"}\n ${l?"border":"rounded-[var(--radius)] shadow-[0_1px_4px_rgba(0,0,0,0.1)]"}\n ${l?"rounded-l-[var(--radius)] rounded-tr-[var(--radius)] rounded-br-[var(--radius)] bg-primary text-primary-foreground border-primary":"text-foreground border-transparent"}\n `,style:{maxWidth:l?"calc(100% - 40px)":"280px"},children:[e.videoStream&&/* @__PURE__ */g(ah,{stream:e.videoStream,isUserMessage:l}),!e.videoStream&&/* @__PURE__ */g(ih,{message:e,isLastMessage:r,widgetState:n,accentColor:o.widget_accent_color,textColor:"inherit"}),e.isScreenAccessRequest&&!e.screenShareStatus&&/* @__PURE__ */y("div",{className:"mt-1.5 pt-0.5 flex gap-2",children:[/* @__PURE__ */g(yp,{type:"button",variant:"primary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),s?.()},className:"flex items-center justify-center text-sm font-medium h-[26px] min-w-[65px] rounded-[22px]",style:{backgroundColor:"#111827",color:"#fff",border:"none"},children:"Yes"}),/* @__PURE__ */g(yp,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),a?.()},className:"flex items-center justify-center text-sm font-medium h-[26px] min-w-[65px] rounded-[22px] border border-gray-200",style:{backgroundColor:"#f3f4f6",color:"#111827"},children:"No"})]}),e.isScreenAccessRequest&&"allowed"===e.screenShareStatus&&/* @__PURE__ */g("div",{className:"mt-0.5 text-xs font-medium italic text-foreground-faint",children:"Sure"}),e.isScreenAccessRequest&&"denied"===e.screenShareStatus&&/* @__PURE__ */g("div",{className:"mt-0.5 text-xs font-medium italic text-foreground-faint",children:"Check HTML Instead"}),!l&&e.taskStatus&&/* @__PURE__ */g("div",{className:"absolute bottom-1 right-1 flex items-center justify-center",children:/* @__PURE__ */g(sh,{status:e.taskStatus,accentColor:o.widget_accent_color})})]})]}),!l&&!e.isPlaceholder&&/* @__PURE__ */y("div",{className:"text-[11px] mt-1 ml-9 text-foreground-muted",children:["Marketrix • AI Agent • ",T(e.timestamp)]}),!e.isPlaceholder&&l&&/* @__PURE__ */g("div",{className:"flex justify-end mt-0.5 mr-1",children:/* @__PURE__ */g("span",{className:"text-[10px] text-foreground-faint font-inter font-normal",children:T(e.timestamp)})})]},`message-${e.id}-${t}`)},ch=({greeting:e,settings:t})=>/* @__PURE__ */y("div",{className:"group flex flex-col justify-start mt-2",children:[/* @__PURE__ */g("div",{className:"flex items-start flex-row",children:/* @__PURE__ */g("div",{className:"\n flex flex-col flex-1\n px-2.5 py-2 rounded-lg shadow-sm border\n ",style:{backgroundColor:"#ffffff",backgroundImage:"none",color:t.widget_text_color,borderColor:t.widget_border_color},children:/* @__PURE__ */g("div",{className:"text-xs font-inter font-medium leading-tight whitespace-pre-wrap break-words",children:e})})}),/* @__PURE__ */g("div",{className:"flex justify-end mt-0.5",children:/* @__PURE__ */g("span",{className:"text-[10px] font-inter font-normal",style:{color:`${t.widget_text_color}99`},children:T(/* @__PURE__ */new Date)})})]},"welcome-message"),dh=({messages:e,messagesEndRef:t,onSendMessage:r,onSetMode:n,onModeChange:o,onAddMessage:i,config:s,onScreenAccessAllow:a,onScreenAccessDeny:c})=>{const{config:d,state:u,isPreviewMode:m}=ud({config:s}),[f,w]=h(!1),[b,v]=h(!1),x=p(null),k=()=>{if(x.current){const{scrollTop:e,scrollHeight:t,clientHeight:r}=x.current;w(e>200),v(!(Math.abs(t-e-r)<50)&&t>r)}};return l(()=>{window.requestAnimationFrame(()=>{t.current&&(!m&&t.current.scrollIntoView({behavior:"auto"}),!m&&k())})},[e.length,m]),/* @__PURE__ */y("div",{className:"relative h-full",children:[
|
|
23
|
+
/* @__PURE__ */y("div",{ref:x,onScroll:k,role:"log","aria-relevant":"additions",className:"h-full overflow-y-auto px-2 space-y-0.5 pt-0 scrollbar-thin scrollbar-track-gray-100 scrollbar-thumb-gray-400",style:{backgroundColor:d.widget_background_color.includes("gradient")?"transparent":d.widget_background_color,backgroundImage:d.widget_background_color.includes("gradient")?d.widget_background_color:`linear-gradient(135deg, ${d.widget_background_color} 0%, ${d.widget_background_color} 100%)`,scrollbarColor:`${I(d.widget_border_color,.3)} ${I(d.widget_border_color,.1)}`,scrollbarWidth:"thin"},children:[0===e.length&&u.isLoading&&/* @__PURE__ */g(rh,{variant:"loading",message:"Connecting…"}),
|
|
24
|
+
/* @__PURE__ */g(ch,{greeting:d.widget_body??"How can I help you today?",settings:{widget_shadow:d.widget_shadow,widget_border_radius:d.widget_border_radius,widget_text_color:d.widget_text_color,widget_border_color:d.widget_border_color,widget_secondary_color:d.widget_secondary_color}}),e.map((t,r)=>/* @__PURE__ */g(lh,{message:t,index:r,isLastMessage:r===e.length-1,widgetState:u,settings:{widget_accent_color:d.widget_accent_color,widget_text_color:d.widget_text_color,widget_border_color:d.widget_border_color,widget_shadow:d.widget_shadow,widget_border_radius:d.widget_border_radius},marketrixIcon:pd,onScreenAccessAllow:a,onScreenAccessDeny:c},`message-${t.id}-${r}`)),
|
|
25
|
+
/* @__PURE__ */g("div",{ref:t},"scroll-anchor")]},"message-list-container"),f&&/* @__PURE__ */g("div",{className:"absolute top-2 left-0 right-0 flex justify-center z-10 pointer-events-none",children:/* @__PURE__ */g(yp,{type:"button",variant:"secondary",size:"sm",onClick:()=>{x.current?.scrollTo({top:0,behavior:"smooth"})},className:"p-1.5 rounded-full shadow-md bg-white/90 hover:bg-white border border-gray-200 pointer-events-auto",style:{border:"1px solid #e5e7eb"},title:"Scroll to top","aria-label":"Scroll to top",children:/* @__PURE__ */g(eh,{className:"w-2.5 h-2.5",style:{color:d.widget_accent_color}})})}),b&&/* @__PURE__ */g("div",{className:"absolute bottom-2 left-0 right-0 flex justify-center z-10 pointer-events-none",children:/* @__PURE__ */g(yp,{type:"button",variant:"secondary",size:"sm",onClick:()=>{t.current&&!m&&t.current.scrollIntoView({behavior:"smooth"})},className:"p-1.5 rounded-full shadow-md bg-white/90 hover:bg-white border border-gray-200 pointer-events-auto",style:{border:"1px solid #e5e7eb"},title:"Scroll to bottom","aria-label":"Scroll to bottom",children:/* @__PURE__ */g(th,{className:"w-2.5 h-2.5",style:{color:d.widget_accent_color}})})})]})};function uh(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{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"},child:[]}]})(e)}function ph(e){return Ep({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",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"},child:[]},{tag:"circle",attr:{cx:"160",cy:"256",r:"32"},child:[]},{tag:"circle",attr:{cx:"256",cy:"256",r:"32"},child:[]},{tag:"circle",attr:{cx:"352",cy:"256",r:"32"},child:[]}]})(e)}function hh(e){return Ep({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 4.1 12 6"},child:[]},{tag:"path",attr:{d:"m5.1 8-2.9-.8"},child:[]},{tag:"path",attr:{d:"m6 12-1.9 2"},child:[]},{tag:"path",attr:{d:"M7.2 2.2 8 5.1"},child:[]},{tag:"path",attr:{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"},child:[]}]})(e)}function mh(e){return Ep({tag:"svg",attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{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"},child:[]}]})(e)}var fh={sm:"px-2 py-0.5 text-[11px] gap-0.5",md:"px-3 py-1 text-sm gap-1"},gh=o(function({active:e=!1,variant:t="primary",size:r="sm",animated:n=!1,children:o,...i},s){/* @__PURE__ */
|
|
26
|
+
return g("button",{...i,ref:s,type:"button",className:mp("inline-flex items-center font-medium rounded-full border-none cursor-pointer transition-all duration-200",fh[r],e&&"primary"===t&&"bg-primary text-primary-foreground shadow-sm",e&&"secondary"===t&&"bg-secondary text-secondary-foreground shadow-sm",!e&&"bg-secondary-bg text-foreground-muted",n&&e&&"animate-[glow-border-pulse_2s_ease-in-out_infinite]"),children:o})}),yh=o(function({className:e,errorMessage:t,id:r,validationState:n="default",...o},i){const s=c(),a=r??s,l="invalid"===n||Boolean(t),d=l&&t?`${a}-error`:void 0;/* @__PURE__ */
|
|
27
|
+
return y(f,{children:[/* @__PURE__ */g("textarea",{...o,ref:i,"aria-describedby":d,"aria-invalid":l||void 0,className:mp("block w-full px-3 py-2 text-sm leading-normal text-foreground bg-background border border-input rounded-lg transition-colors min-h-20 resize-y hover:border-muted-foreground focus:outline-none focus:border-ring focus:ring-3 focus:ring-ring disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-muted","invalid"===n&&"border-destructive focus:border-destructive focus:ring-destructive","valid"===n&&"border-success focus:border-success focus:ring-success",e),"data-validation-state":n,id:a}),t?/* @__PURE__ */g("span",{className:mp("block mt-1 text-xs text-destructive","valid"===n&&"text-success"),"data-validation-state":n,id:d,children:t}):null]})});function wh(...e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})}}var bh=t.forwardRef(function({value:e,onChange:t,onKeyPress:r,onSend:n,isLoading:o,isTaskRunning:i=!1,onStop:a,currentMode:c,enabledModes:d=[],onModeChange:u,isScreenSharing:h=!1},m){const f=p(null);l(()=>{const e=f.current;if(e){e.style.height="auto";const t=e.scrollHeight,r=Math.min(t,46);e.style.height=`${r}px`,e.style.overflowY=t>46?"auto":"hidden"}},[e]);const w=s(e=>{"Enter"!==e.key||e.shiftKey?r(e):(e.preventDefault(),n())},[n,r]),b=s(e=>{t(e.target.value);const r=e.target;r.style.height="auto";const n=Math.min(r.scrollHeight,46);r.style.height=`${n}px`,r.style.overflowY=r.scrollHeight>46?"auto":"hidden"},[t]),v=Boolean(e.trim())&&!o,x=["tell","show","do"].filter(e=>d.includes(e)),k=e=>{switch(e){case"show":/* @__PURE__ */return g(hh,{className:"w-3 h-3"});case"tell":/* @__PURE__ */return g(ph,{className:"w-3 h-3"});case"do":/* @__PURE__ */return g(mh,{className:"w-3 h-3"});default:return null}};/* @__PURE__ */
|
|
28
|
+
return g("div",{className:"py-1.5 px-2 bg-transparent",children:/* @__PURE__ */y("div",{className:"flex flex-col rounded-xl border border-border overflow-hidden focus-within:border-foreground-faint transition-colors bg-card/70 backdrop-blur-sm",children:[/* @__PURE__ */g(yh,{ref:wh(f,m),value:e,onChange:b,onKeyDown:w,placeholder:"Ask anything",disabled:o,rows:1,className:"message-input-textarea w-full px-3 text-sm text-foreground placeholder:text-foreground-faint resize-none focus:outline-none focus:ring-0 border-none shadow-none disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"transparent",lineHeight:"20px",paddingTop:"4px",paddingBottom:"2px"}}),/* @__PURE__ */y("div",{className:"flex items-center justify-between px-1.5 pb-1.5",children:[/* @__PURE__ */g("div",{className:"flex items-center gap-1",children:x.map(e=>{const t=c===e;/* @__PURE__ */
|
|
29
|
+
return y(gh,{active:t,size:"sm",animated:h&&t,onClick:t=>{t.preventDefault(),t.stopPropagation(),u?.(e)},children:[k(e),/* @__PURE__ */g("span",{children:A(e)})]},e)})}),/* @__PURE__ */g(jp,{variant:i?"secondary":v?"primary":"ghost",size:"sm",disabled:!i&&!v,label:i?"Stop task":"Send message",onClick:e=>{e.preventDefault(),e.stopPropagation(),i&&a?a():n()},children:i?/* @__PURE__ */g(uh,{className:"w-3.5 h-3.5"}):/* @__PURE__ */g("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 12h14m-7-7l7 7-7 7"})})})]})]})})}),vh=({isOpen:e,onAllow:t,onDeny:r,onClose:n})=>/* @__PURE__ */g(Bp,{open:e,onOpenChange:e=>{e||n()},children:/* @__PURE__ */y(Wp,{className:"bg-white rounded-lg p-3 max-w-md mx-4 shadow-xl text-center",children:[
|
|
30
|
+
/* @__PURE__ */g(Gp,{className:"text-lg font-semibold text-gray-900 mb-3",children:"Can I take a look at your screen?"}),
|
|
31
|
+
/* @__PURE__ */g(Hp,{className:"text-gray-600 mb-6 text-sm leading-relaxed",children:"By allowing screen access, Marketrix can understand your current context to guide you better and complete tasks on your behalf."}),
|
|
32
|
+
/* @__PURE__ */y("div",{className:"flex gap-3 justify-center",children:[/* @__PURE__ */g(yp,{type:"button",variant:"primary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),t()},className:"px-5 py-1 rounded-full text-sm font-medium",style:{backgroundColor:"#111827",color:"#fff",border:"none"},children:"Yes"}),/* @__PURE__ */g(yp,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),r()},className:"px-6 py-1 rounded-full text-sm font-medium border border-gray-200",style:{backgroundColor:"#f3f4f6",color:"#1f2937"},children:"No"})]})]})});sd(),ad();var xh=class extends t.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){}render(){return this.state.hasError?/* @__PURE__ */g("div",{className:"p-4 text-center text-xs text-gray-500",children:"Something went wrong displaying messages. Please refresh."}):this.props.children}};function kh(e){return[...e.widget_feature_show?["show"]:[],...e.widget_feature_tell?["tell"]:[],...e.widget_feature_do?["do"]:[]]}var _h=({config:e,messages:t,currentMode:r,isTaskRunning:n=!1,taskProgress:o=[],onSendMessage:i,onSetMode:s,onAddMessage:a,onUpdateMessage:c,onRemoveMessage:d,onStopTask:u,onClearChat:m,onClose:f,onScreenSharingChange:w,onStartScreenShareRef:b,onStopScreenShareRef:v,messageInputRef:x})=>{const[k,_]=h(""),S=p(null),[C,E]=h(!1),[T,A]=h(null),[M,O]=h(null),[N,R]=h(!1),[z,P]=h(null),L=p(C),D=p(T),$=p(a),j=p(d),F=p(w);l(()=>{L.current=C},[C]),l(()=>{D.current=T},[T]),l(()=>{$.current=a},[a]),l(()=>{j.current=d},[d]),l(()=>{F.current=w},[w]),l(()=>{const e=()=>{const e=td(),t=L.current,r=D.current;if(e!==t&&(L.current=e,E(e),F.current?.(e)),t&&!e&&r){j.current?.(r);const e=Pc("Stopped screenshare","show","user","stopped-sharing");$.current(e),A(null)}};e();const t=setInterval(e,1e3);return()=>clearInterval(t)},[]);const U=e=>{if(M)return;const t=function(e){const t="Can I take a look at your screen?";return{id:`screen-access-request-${Date.now()}`,content:t,sender:"agent",timestamp:/* @__PURE__ */new Date,mode:e,isScreenAccessRequest:!0,parts:[{type:"text",content:t}]}}(e);O(t.id),a(t)},B=()=>{const n=t.some(e=>e.isPlaceholder);if(k.trim()&&!n){const t=k.trim();_(""),a(Rc(t,r)),!1===e.use_screenshare||"show"!==r&&"do"!==r||C||M?i(t,r,void 0,void 0,!0):(P({content:t,mode:r,alreadyAdded:!0}),U(r))}},W=e=>{e!==r&&(a(Pc(`Switched to ${{show:"Show",tell:"Tell",do:"Do"}[e]} mode`,e,"agent","mode-change")),s(e))},G=()=>{R(!0)},H=()=>{R(!1)},Z=()=>{Kc&&(Kc.getTracks().forEach(e=>e.stop()),Kc=null),E(!1),w?.(!1),T&&d&&d(T),a(Pc("Stopped screenshare","show","user","stopped-sharing")),A(null)};l(()=>(b&&(b.current=G),v&&(v.current=Z),()=>{b&&(b.current=null),v&&(v.current=null)}));const V=e;/* @__PURE__ */
|
|
33
|
+
return y("div",{className:"flex flex-col h-full",id:"view-chat",role:"tabpanel","aria-labelledby":"tab-chat",children:[N&&/* @__PURE__ */g(vh,{isOpen:N,onAllow:async()=>{R(!1);try{const e=await ed();E(!0),w?.(!0),a(Lc("show"));const t=Dc(e,"show");A(t.id),a(t)}catch(e){E(!1),w?.(!1)}},onDeny:H,onClose:H}),
|
|
34
|
+
/* @__PURE__ */g("div",{className:"flex-1 overflow-hidden py-1 flex flex-col min-h-0",children:/* @__PURE__ */g(xh,{children:/* @__PURE__ */g(dh,{messages:t,messagesEndRef:S,onSendMessage:(t,n,o,s)=>{!1===e.use_screenshare||"show"!==n&&"do"!==n||C||M?i(t,n,o,s,!0):(P({content:t,mode:n,...void 0!==o?{applicationId:o}:{},...void 0!==s?{question:s}:{},alreadyAdded:!0}),U(n||r))},onSetMode:s,onModeChange:W,onAddMessage:a,config:e,onScreenAccessAllow:async()=>{try{const e=await ed();E(!0),w?.(!0),M&&(c(M,{screenShareStatus:"allowed"}),O(null)),a(Lc("show"));const t=Dc(e,"show");if(A(t.id),a(t),z){const e=z;P(null),i(e.content,e.mode,e.applicationId,e.question,e.alreadyAdded)}}catch(e){if(E(!1),w?.(!1),M&&(c(M,{screenShareStatus:"denied"}),O(null)),z){const e=z;P(null),i(e.content,e.mode,e.applicationId,e.question,e.alreadyAdded)}}},onScreenAccessDeny:()=>{if(M&&(c(M,{screenShareStatus:"denied"}),O(null)),z){const e=z;P(null),i(e.content,e.mode,e.applicationId,e.question,e.alreadyAdded)}}})})}),
|
|
35
|
+
/* @__PURE__ */y("div",{className:"flex-shrink-0 rounded-[var(--radius)] m-2 mt-auto",style:{backgroundColor:"#ffffff"},children:[n&&o.length>0&&/* @__PURE__ */y("div",{className:"mx-2 mb-2 p-2 rounded text-xs max-h-32 overflow-y-auto",style:{backgroundColor:I(e.widget_background_color??"#fff",.8),borderColor:e.widget_border_color,borderWidth:"1px",borderStyle:"solid"},children:[/* @__PURE__ */y("div",{className:"font-semibold mb-1",style:{color:e.widget_text_color},children:["Task Progress (",o.length," steps)"]}),/* @__PURE__ */g("div",{className:"space-y-1",children:o.map((t,r)=>/* @__PURE__ */y("div",{className:"text-xs opacity-80",style:{color:e.widget_text_color},children:[
|
|
36
|
+
/* @__PURE__ */y("span",{className:"font-medium",children:["Step ",t.step,":"]})," ",t.tool_name,t.tool_params&&Object.keys(t.tool_params).length>0&&/* @__PURE__ */y("span",{className:"opacity-70 ml-1",children:["(",Object.keys(t.tool_params).join(", "),")"]})]},r))})]}),/* @__PURE__ */g(bh,{ref:x,value:k,onChange:_,onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),B())},onSend:B,isLoading:t.some(e=>e.isPlaceholder),isTaskRunning:n,onStop:()=>{nd.cleanup(),u?.()},currentMode:r,enabledModes:kh(V),onModeChange:W,isScreenSharing:C})]})]})},Sh=[{id:"show-add-product",text:"Show me how to add a new product",icon:/* @__PURE__ */g(hh,{className:"w-6 h-6"}),type:"show",isShow:!0},{id:"show-login",text:"Show me how to login",icon:/* @__PURE__ */g(hh,{className:"w-6 h-6"}),type:"show",isShow:!0},{id:"do-login",text:"Do the login process for me",icon:/* @__PURE__ */g(mh,{className:"w-4 h-4"}),type:"do",isShow:!1},{id:"show-revenue",text:"Show me the revenue metrics",icon:/* @__PURE__ */g(hh,{className:"w-6 h-6"}),type:"show",isShow:!0},{id:"tell-conversion-rate",text:"What does my conversion rate mean and how can I improve it?",icon:/* @__PURE__ */g(ph,{className:"w-5 h-5"}),type:"tell",isShow:!1}];function Ch(e){switch(e){case"do":/* @__PURE__ */return g(mh,{className:"w-3 h-3 text-xs",style:{fontSize:"0.75rem",width:"0.75rem",height:"0.75rem"}});case"show":/* @__PURE__ */return g(hh,{className:"w-3 h-3 text-xs",style:{fontSize:"0.75rem",width:"0.75rem",height:"0.75rem"}});default:/* @__PURE__ */return g(ph,{className:"w-3 h-3 text-xs",style:{fontSize:"0.75rem",width:"0.75rem",height:"0.75rem"}})}}var Ih,Eh,Th,Ah,Mh=({actions:e,hasPendingMessage:t,settings:r,onActionClick:n})=>0===e.length?null:/* @__PURE__ */g("div",{className:"mt-2.5 mb-1.5 p-0 flex flex-col gap-1",children:e.map((e,o)=>/* @__PURE__ */g(yp,{variant:"ghost",size:"sm",onClick:t=>n(e,t),disabled:t,className:`\n w-full flex items-center justify-center gap-1 font-inter font-normal text-xs px-3 py-2 rounded-lg\n transition-[background-color,color,border-color] duration-[250ms] ease-in-out text-left\n border border-solid\n ${t?"cursor-not-allowed opacity-50":"cursor-pointer"}\n `,style:{backgroundColor:"rgba(0,0,0,0.05)",borderColor:"rgba(0,0,0,0.12)",color:t?I(r.widget_text_color,.5):r.widget_text_color},onMouseEnter:e=>{t||(e.currentTarget.style.backgroundColor=r.widget_text_color,e.currentTarget.style.color="#ffffff",e.currentTarget.style.borderColor=r.widget_text_color)},onMouseLeave:e=>{t||(e.currentTarget.style.backgroundColor="rgba(0,0,0,0.05)",e.currentTarget.style.color=r.widget_text_color,e.currentTarget.style.borderColor="rgba(0,0,0,0.12)")},children:/* @__PURE__ */g("span",{className:"font-normal leading-none",children:"show"===e.type?/* @__PURE__ */y(f,{children:["Show me ",e.text.replace(/^Show me\s*/i,"")]}):"do"===e.type?/* @__PURE__ */y(f,{children:["Do ",e.text.replace(/^Do\s*/i,"")]}):e.text})},`welcome-chip-${e.id}-${o}`))}),Oh=({config:e,messages:t,onNavigateToChat:r,onChipClick:n})=>{const o=function(e){const t=e.widget_chips;if(t&&Array.isArray(t)&&t.length>0){const e=/* @__PURE__ */new Set;return t.map((t,r)=>{const n=t.chip_text||t.question||"",o=t.chip_mode||t.type||"tell",i="show"===o||"tell"===o||"do"===o?o:"tell",s=`chip-${n.replace(/\s+/g,"-").toLowerCase()}-${r}`;let a=s,l=0;for(;e.has(a);)l++,a=`${s}-${l}`;return e.add(a),{id:a,text:n,icon:Ch(i),type:i,isShow:"show"===i}})}return Sh}(e);/* @__PURE__ */
|
|
35
37
|
return g("div",{className:"flex flex-col h-full overflow-hidden",id:"view-home",role:"tabpanel","aria-labelledby":"tab-home",children:/* @__PURE__ */y("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:[
|
|
36
|
-
/* @__PURE__ */y("div",{className:"text-center pt-2",children:[/* @__PURE__ */g("h2",{className:"text-lg font-semibold",
|
|
37
|
-
/* @__PURE__ */y("button",{type:"button",onClick:
|
|
38
|
-
/* @__PURE__ */g("div",{children:/* @__PURE__ */g(
|
|
39
|
-
/* @__PURE__ */g("p",{className:"text-sm font-semibold mb-0.5",
|
|
40
|
-
/* @__PURE__ */g("p",{className:"text-xs line-clamp-2
|
|
41
|
-
/* @__PURE__ */g("button",{type:"button",onClick:
|
|
42
|
-
return y("button",{type:"button",role:"tab","aria-selected":
|
|
43
|
-
/* @__PURE__ */g("span",{className:"flex-shrink-0","aria-hidden":!0,children:
|
|
44
|
-
/* @__PURE__ */g("span",{className:"text-xs truncate w-full text-center",children:
|
|
45
|
-
return y("div",{className:`${
|
|
46
|
-
/* @__PURE__ */y("div",{className:"flex justify-between items-center px-3 py-2 border-b flex-shrink-0",
|
|
47
|
-
/* @__PURE__ */y("div",{className:"relative",ref:V,children:[/* @__PURE__ */g(
|
|
48
|
-
/* @__PURE__ */g("div",{className:"flex-1 overflow-hidden flex flex-col min-h-0",children:/* @__PURE__ */y(
|
|
49
|
-
/* @__PURE__ */g(
|
|
38
|
+
/* @__PURE__ */y("div",{className:"text-center pt-2",children:[/* @__PURE__ */g("h2",{className:"text-lg font-semibold text-foreground",children:e.widget_greeting??"Hey There!"}),/* @__PURE__ */g("p",{className:"text-sm text-foreground-muted mt-1",children:e.widget_body??"How can I help you today?"})]}),
|
|
39
|
+
/* @__PURE__ */y("button",{type:"button",onClick:r,className:"w-full flex items-center justify-between gap-2 px-4 py-3 rounded-xl font-medium bg-primary text-primary-foreground transition-opacity hover:opacity-95 shadow-sm","aria-label":"Ask a question",children:[/* @__PURE__ */y("span",{className:"flex items-center gap-2",children:[/* @__PURE__ */g("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,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"})}),"Ask a question"]}),/* @__PURE__ */g("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]}),
|
|
40
|
+
/* @__PURE__ */g("div",{children:/* @__PURE__ */g(Mh,{actions:o,hasPendingMessage:!1,settings:{widget_secondary_color:e.widget_secondary_color??"#f3f4f6",widget_text_color:e.widget_text_color??"#1f2937"},onActionClick:async(e,t)=>{t.preventDefault(),t.stopPropagation(),r(),n(e)}})}),t.length>0&&/* @__PURE__ */y("div",{className:"px-3 py-2 rounded-lg border border-border bg-background/60",children:[
|
|
41
|
+
/* @__PURE__ */g("p",{className:"text-sm font-semibold text-foreground mb-0.5",children:"Recent conversation"}),
|
|
42
|
+
/* @__PURE__ */g("p",{className:"text-xs text-foreground-muted line-clamp-2",children:t[t.length-1].content||"Message"}),
|
|
43
|
+
/* @__PURE__ */g("button",{type:"button",onClick:r,className:"mt-1 text-xs font-medium text-primary",children:"Continue conversation →"})]})]})})},Nh={accent:"bg-primary",success:"bg-green-500",warning:"bg-yellow-500"},Rh={bar:"h-0.5 rounded-full",dot:"w-1.5 h-1.5 rounded-full"},zh=({variant:e="bar",color:t="accent",animated:r=!1})=>/* @__PURE__ */g("span",{className:mp(Rh[e],Nh[t],r&&"animate-pulse")}),Ph=({activeView:e,onViewChange:t,tabs:r})=>/* @__PURE__ */g("div",{role:"tablist",className:"flex items-center justify-around flex-shrink-0 h-12 border-t border-border",style:{boxShadow:"0 -2px 8px rgba(0,0,0,0.06)"},children:r.map(r=>{const n=e===r.id;/* @__PURE__ */
|
|
44
|
+
return y("button",{type:"button",role:"tab","aria-selected":n,"aria-controls":`view-${r.id}`,id:`tab-${r.id}`,onClick:()=>t(r.id),className:"relative flex flex-col items-center justify-center gap-0.5 flex-1 py-2 transition-[color,opacity] duration-150 min-w-0 "+(n?"text-primary font-semibold":"text-foreground-muted font-normal"),children:[n&&/* @__PURE__ */g("span",{className:"absolute top-0 left-1/4 right-1/4",children:/* @__PURE__ */g(zh,{variant:"bar",color:"accent"})}),
|
|
45
|
+
/* @__PURE__ */g("span",{className:"flex-shrink-0","aria-hidden":!0,children:r.icon}),
|
|
46
|
+
/* @__PURE__ */g("span",{className:"text-xs truncate w-full text-center",children:r.label})]},r.id)})}),Lh=({children:e,direction:t})=>/* @__PURE__ */g("div",{className:`view-slide-enter view-slide-enter-active ${t}`,style:{width:"100%",height:"100%"},children:e}),Dh={home:/* @__PURE__ */g("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,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"})}),chat:/* @__PURE__ */g("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,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"})}),help:/* @__PURE__ */g("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":!0,children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})},$h=({config:e,isOpen:t,isMinimized:r,messages:n,currentMode:o,isTaskRunning:i=!1,taskProgress:a=[],activeView:c,onClose:d,onSendMessage:m,onSetMode:w,onAddMessage:b,onUpdateMessage:v,onRemoveMessage:x,onStopTask:k,onClearChat:_,onScreenSharingChange:S,setActiveView:C})=>{const{config:I,isPreviewMode:E}=ud({config:e}),T=u(()=>e.mtxId??(null!=e.mtxApp?String(e.mtxApp):"default"),[e.mtxId,e.mtxApp]),{widthPx:A,heightPx:M,onResizeStart:O,containerRef:N}=function(e,t,r,n,o){const i=u(()=>`marketrix_widget_size_${r}`,[r]),a=p({width:360,height:450}),l=p(null),[c,d]=h(()=>{if("undefined"==typeof localStorage)return{width:zp(e),height:zp(t)};const r=localStorage.getItem(i);if(r)try{const e=JSON.parse(r);if("number"==typeof e.width&&"number"==typeof e.height){const t=Pp(e.width,280,600),r=Pp(e.height,320,Math.floor(.85*window.innerHeight));return a.current={width:t,height:r},{width:t,height:r}}}catch{}const n=zp(e),o=zp(t);return a.current={width:n,height:o},{width:n,height:o}});a.current=c;const m=s(e=>t=>{if(t.preventDefault(),t.stopPropagation(),n||o)return;const r=t.clientX,s=t.clientY,c=a.current.width,u=a.current.height,{cursor:p}=Lp(e,r,s,r,s);l.current&&(l.current.dataset.resizing="true");const h=t=>{const{dx:n,dy:o}=Lp(e,r,s,t.clientX,t.clientY),i=Math.floor(.85*window.innerHeight),d={width:Pp(c+n,280,600),height:Pp(u+o,320,i)};a.current=d,l.current&&(l.current.style.width=`${d.width}px`,l.current.style.height=`${d.height}px`)},m=()=>{if(document.removeEventListener("mousemove",h),document.removeEventListener("mouseup",m),document.body.style.cursor="",document.body.style.userSelect="",l.current&&delete l.current.dataset.resizing,d({...a.current}),!o&&"undefined"!=typeof localStorage){const{width:e,height:t}=a.current;localStorage.setItem(i,JSON.stringify({width:e,height:t}))}};document.body.style.cursor=p,document.body.style.userSelect="none",document.addEventListener("mousemove",h),document.addEventListener("mouseup",m)},[n,o,i]);return{width:c.width,height:c.height,widthPx:`${c.width}px`,heightPx:`${c.height}px`,onResizeStart:m,containerRef:l}}(I.widget_width,I.widget_height,T,r,E),R=p(null),[z,P]=h("forward"),L=p(c);l(()=>{L.current!==c&&(P("chat"===c?"forward":"back"),L.current=c)},[c]),function(e,t,r){const n=p(!1),o=p(null),i=s(()=>{const t=e.current;if(!t)return;const n=r?.focusTargetRef?.current;if(n)return void n.focus({preventScroll:!0});const o=Rp(t);o[0]&&o[0].focus({preventScroll:!0})},[e,r?.focusTargetRef]);l(()=>{if(!t)return n.current&&(o.current?.focus({preventScroll:!0}),o.current=null),void(n.current=!1);n.current||(o.current=document.activeElement||null),n.current=!0;const s=e.current;if(!s)return;i();const a=e=>{if("Escape"===e.key)return void r?.onEscape?.();if("Tab"!==e.key)return;const t=Rp(s);if(0===t.length)return;const n=document.activeElement,o=t.indexOf(n);-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,i,r?.onEscape])}(N,t,{onEscape:d,focusTargetRef:"chat"===c?R:void 0});const D=u(()=>[{id:"home",label:"Home",icon:Dh.home},{id:"chat",label:"Chat",icon:Dh.chat},{id:"help",label:"Help",icon:Dh.help}],[]),$=I.widget_position,j=I.widget_position_z_index??40,F=(e=>{const t="20px",r="20px";switch(e){case"bottom_right":default:return{bottom:t,right:r};case"bottom_left":return{bottom:t,left:r};case"top_right":return{top:t,right:r};case"top_left":return{top:t,left:r}}})($),[U,B]=h(!1),[W,G]=h(!1),[H,Z]=h(!1),V=p(null),q=p(null),J=p(null);l(()=>{if(!U)return;const e=e=>{const t=e.composedPath()[0];V.current&&!V.current.contains(t)&&B(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[U]);const Y=s(e=>{Z(e),S?.(e)},[S]);if(!t)return null;const K=I.widget_background_color.includes("gradient")?I.widget_background_color:`linear-gradient(135deg, ${I.widget_background_color} 0%, ${I.widget_background_color} 100%)`,Q={width:A,height:r?"48px":M,fontSize:I.widget_font_size,backgroundImage:K,zIndex:j},X=E?"absolute":"fixed",ee=E?$.includes("top")?{top:"20px",...$.includes("right")?{right:"20px"}:{left:"20px"}}:{bottom:"20px",...$.includes("right")?{right:"20px"}:{left:"20px"}}:{},te=`${$.includes("top")?"top":"bottom"} ${$.includes("right")?"right":"left"}`;/* @__PURE__ */
|
|
47
|
+
return y("div",{className:`${X} rounded-[var(--radius)] pointer-events-auto bg-background`,style:{zIndex:j,backgroundImage:K,...E?ee:F},children:[/* @__PURE__ */y("div",{ref:N,className:"rounded-[var(--radius)] shadow-[var(--shadow)] border border-border text-foreground flex flex-col relative overflow-hidden animate-messenger-entrance",style:{transformOrigin:te,...Q,scrollbarWidth:"thin"},children:[r?/* @__PURE__ */y("div",{className:"flex items-center justify-between px-3 h-10 border-b border-border",children:[/* @__PURE__ */g("span",{className:"text-sm font-medium text-foreground",children:"Marketrix"}),/* @__PURE__ */g(jp,{variant:"ghost",size:"sm",label:"Close",onClick:d,children:/* @__PURE__ */g("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:/* @__PURE__ */g("path",{fillRule:"evenodd",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",clipRule:"evenodd"})})})]}):/* @__PURE__ */y(f,{children:[
|
|
48
|
+
/* @__PURE__ */y("div",{className:"flex justify-between items-center px-3 py-2 border-b border-border flex-shrink-0",children:[/* @__PURE__ */y("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[/* @__PURE__ */g("img",{src:pd,alt:"",className:"flex-shrink-0 w-8 h-8 rounded-[var(--radius)] object-cover shadow-[var(--shadow)]"}),/* @__PURE__ */y("div",{className:"min-w-0",children:[/* @__PURE__ */g("div",{className:"text-sm font-semibold leading-tight truncate text-foreground",children:e.agent_name??"AI Agent"}),/* @__PURE__ */g("p",{className:"text-xs text-foreground-muted truncate",children:e.agent_description??"How can I help?"})]})]}),/* @__PURE__ */y("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:["chat"===c&&/* @__PURE__ */y(f,{children:[!1!==e.use_screenshare&&!H&&/* @__PURE__ */g(jp,{variant:"ghost",size:"sm",label:"Start screen sharing",onClick:()=>q.current?.(),children:/* @__PURE__ */g("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,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"})})}),H&&/* @__PURE__ */y(jp,{variant:"ghost",size:"sm",label:"Stop screen sharing",onClick:()=>J.current?.(),children:[/* @__PURE__ */g("span",{className:"w-1.5 h-1.5 rounded-full bg-current animate-pulse"}),/* @__PURE__ */g("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:/* @__PURE__ */g("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,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"})})]}),
|
|
49
|
+
/* @__PURE__ */y("div",{className:"relative",ref:V,children:[/* @__PURE__ */g(jp,{variant:"ghost",size:"sm",label:"More options",onClick:()=>B(e=>!e),"aria-haspopup":"true","aria-expanded":U,children:/* @__PURE__ */g("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:/* @__PURE__ */g("path",{d:"M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"})})}),U&&/* @__PURE__ */y("div",{className:"absolute right-0 top-full mt-1 py-1 rounded-lg shadow-lg border border-border bg-card min-w-[140px] z-50",role:"menu",onMouseDown:e=>e.nativeEvent.stopImmediatePropagation(),children:[_&&/* @__PURE__ */y("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-secondary-bg rounded-md transition-colors",onClick:()=>{const e=_();e instanceof Promise&&e.catch(e=>{}),B(!1)},role:"menuitem",children:[/* @__PURE__ */g(Mp,{className:"w-3.5 h-3.5 opacity-60"}),"Clear chat"]}),/* @__PURE__ */y("button",{type:"button",className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-foreground hover:bg-secondary-bg rounded-md transition-colors",onClick:()=>{G(!0),B(!1)},role:"menuitem",children:[/* @__PURE__ */g(Op,{className:"w-3.5 h-3.5 opacity-60"}),"About"]})]})]})]}),/* @__PURE__ */g(jp,{variant:"ghost",size:"sm",label:"Close",onClick:d,children:/* @__PURE__ */g("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:/* @__PURE__ */g("path",{fillRule:"evenodd",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",clipRule:"evenodd"})})})]})]}),
|
|
50
|
+
/* @__PURE__ */g("div",{className:"flex-1 overflow-hidden flex flex-col min-h-0",children:/* @__PURE__ */y(Lh,{direction:z,children:["home"===c&&/* @__PURE__ */g(Oh,{config:e,messages:n,onNavigateToChat:()=>{P("forward"),C("chat")},onChipClick:e=>{b(Rc(e.text,e.type,"chip-message")),w(e.type),m(e.text,e.type,void 0,void 0,!0)}}),"chat"===c&&/* @__PURE__ */g(_h,{config:e,messages:n,currentMode:o,isTaskRunning:i,taskProgress:a,onSendMessage:m,onSetMode:w,onAddMessage:b,onUpdateMessage:v,onRemoveMessage:x,onStopTask:k,onClearChat:_,onClose:d,onScreenSharingChange:Y,onStartScreenShareRef:q,onStopScreenShareRef:J,messageInputRef:R}),"help"===c&&/* @__PURE__ */g("div",{id:"view-help",role:"tabpanel","aria-labelledby":"tab-help",className:"flex items-center justify-center h-full p-3 text-sm text-foreground-muted",children:"Help – coming soon"}),"news"===c&&/* @__PURE__ */g("div",{id:"view-news",role:"tabpanel","aria-labelledby":"tab-news",className:"flex items-center justify-center h-full p-3 text-sm text-foreground-muted",children:"News – coming soon"})]},c)}),
|
|
51
|
+
/* @__PURE__ */g(Ph,{activeView:c,onViewChange:e=>{C(e)},tabs:D})]}),!r&&!E&&["top-left","top-right","bottom-left","bottom-right"].map(e=>/* @__PURE__ */g("div",{role:"separator","aria-label":`Resize widget from ${e.replace("-"," ")}`,title:"Drag to resize",className:`absolute w-5 h-5 flex p-1 touch-none z-10 group ${{"top-left":"top-0 left-0 rounded-tl-[var(--radius)] cursor-nwse-resize items-start justify-start","top-right":"top-0 right-0 rounded-tr-[var(--radius)] cursor-nesw-resize items-start justify-end","bottom-left":"bottom-0 left-0 rounded-bl-[var(--radius)] cursor-nesw-resize items-end justify-start","bottom-right":"bottom-0 right-0 rounded-br-[var(--radius)] cursor-nwse-resize items-end justify-end"}[e]}`,onMouseDown:O(e)},e))]}),/* @__PURE__ */g(Vp,{isOpen:W,onClose:()=>G(!1),diagnosticData:{chatId:jc.getChatId(),streamEndpoint:(()=>{const t=Bc.getConfig()?.mtxApiHost||e.mtxApiHost;return t?`${t.replace(/\/$/,"")}/widget/stream`:null})(),connectionStatus:(()=>{try{return Fc.getInstance().getStatus()}catch{return"disconnected"}})(),applicationId:Bc.getConfig()?.mtxApp,agentId:Bc.getConfig()?.mtxAgent,version:Np,build:"dev"}})]})},jh=({error:e,onClose:t,onRetry:r,position:n="bottom_left"})=>{const o="bottom_left"!==n&&"top_left"!==n&&n?{right:"0"}:{left:"0"},i=n.includes("top")?{top:"20px"}:{bottom:"90px"};/* @__PURE__ */
|
|
50
52
|
return g("div",{className:"fixed",style:{zIndex:_+10,...i,...o,maxWidth:"420px"},children:/* @__PURE__ */y("div",{className:"flex items-center gap-2.5 rounded-full shadow-lg",style:{padding:"8px 12px 8px 8px",backgroundColor:"#fef2f2",border:"1px solid #fecaca"},children:[
|
|
51
53
|
/* @__PURE__ */g("img",{src:pd,alt:"",className:"flex-shrink-0 rounded-full",style:{width:"28px",height:"28px"}}),
|
|
52
|
-
/* @__PURE__ */g("span",{className:"text-red-700 font-medium flex-1 min-w-0",style:{fontSize:"13px",whiteSpace:
|
|
53
|
-
/* @__PURE__ */g("button",{type:"button",onClick:t,className:"flex-shrink-0 text-red-400 hover:text-red-600 flex items-center justify-center rounded-full",style:{width:"20px",height:"20px",padding:"2px"},"aria-label":"Close error",children:/* @__PURE__ */g("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:/* @__PURE__ */g("path",{d:"M9 3L3 9M3 3l6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})})},
|
|
54
|
+
/* @__PURE__ */g("span",{className:"text-red-700 font-medium flex-1 min-w-0",style:{fontSize:"13px",whiteSpace:r?"normal":"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e}),r&&/* @__PURE__ */g("button",{type:"button",onClick:()=>{r(),t()},className:"flex-shrink-0 rounded-full px-3 py-1 text-xs font-semibold text-red-700 transition-colors hover:text-red-800",style:{backgroundColor:"#fee2e2",border:"1px solid #fecaca"},"aria-label":"Retry",children:"Retry"}),
|
|
55
|
+
/* @__PURE__ */g("button",{type:"button",onClick:t,className:"flex-shrink-0 text-red-400 hover:text-red-600 flex items-center justify-center rounded-full",style:{width:"20px",height:"20px",padding:"2px"},"aria-label":"Close error",children:/* @__PURE__ */g("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:/* @__PURE__ */g("path",{d:"M9 3L3 9M3 3l6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})})},Fh=({greeting:e,body:t,onClose:r,autoCloseMs:n=8e3})=>{const[o,i]=h(!1),a=s(()=>{i(!0),setTimeout(r,300)},[r]);return l(()=>{const e=setTimeout(a,n);return()=>clearTimeout(e)},[n,a]),/* @__PURE__ */g("div",{className:"fixed",style:{bottom:"20px",left:"50%",transform:"translateX(-50%)",maxWidth:"420px",zIndex:2147483030,opacity:o?0:1,transition:"opacity 0.3s ease-out",animation:o?"none":"fadeIn 0.3s ease-out"},children:/* @__PURE__ */y("div",{className:"flex items-center gap-2.5 rounded-full shadow-lg cursor-pointer",style:{padding:"8px 12px 8px 8px",backgroundColor:"#f0f9ff",border:"1px solid #bae6fd"},onClick:a,children:[
|
|
54
56
|
/* @__PURE__ */g("img",{src:pd,alt:"",className:"flex-shrink-0 rounded-full",style:{width:"28px",height:"28px"}}),
|
|
55
57
|
/* @__PURE__ */y("div",{className:"flex-1 min-w-0",children:[/* @__PURE__ */g("span",{className:"font-medium block",style:{fontSize:"13px",color:"#0c4a6e",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e}),t&&/* @__PURE__ */g("span",{className:"block",style:{fontSize:"12px",color:"#0369a1",opacity:.7,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:t})]}),
|
|
56
|
-
/* @__PURE__ */g("button",{onClick:e=>{e.stopPropagation(),a()},className:"flex-shrink-0 flex items-center justify-center rounded-full",style:{width:"20px",height:"20px",padding:"2px",color:"#7dd3fc"},"aria-label":"Dismiss",children:/* @__PURE__ */g("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:/* @__PURE__ */g("path",{d:"M9 3L3 9M3 3l6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})})},Rh=b(()=>{Vc(),nd(),xh=class e{static instance;validationLog=[];lastTestResult=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}insertElementBefore(e,t=1){if(!Gc.getAllFingerprints().find(([t])=>t===e))return[];const{element:n}=Gc.getElementByIndex(e);if(!n)return[];const r=[];for(let o=0;o<t;o++){const e=document.createElement("button");e.textContent=`Inserted Button ${o+1}`,e.setAttribute("data-test-inserted","true"),e.style.cssText="padding: 8px 16px; margin: 4px; background: #ff6b6b; color: white; border: none; border-radius: 4px;",n.parentElement?.insertBefore(e,n),r.push(e)}return r}insertElementAfter(e){const{element:t}=Gc.getElementByIndex(e);if(!t)return null;const n=document.createElement("button");return n.textContent="Inserted Button (After)",n.setAttribute("data-test-inserted","true"),n.style.cssText="padding: 8px 16px; margin: 4px; background: #ff6b6b; color: white; border: none; border-radius: 4px;",t.parentElement?.insertBefore(n,t.nextSibling),n}removeElement(e){const{element:t}=Gc.getElementByIndex(e);return!!t&&(t.remove(),!0)}removeMultipleElements(e){let t=0;const n=[...e].sort((e,t)=>t-e);for(const r of n)this.removeElement(r)&&t++;return t}simulateRerender(e){const{element:t}=Gc.getElementByIndex(e);if(!t)return null;const n=t.cloneNode(!0);return n.setAttribute("data-test-rerendered","true"),t.parentElement?.replaceChild(n,t),n}simulateStateChange(e="body"){const t=document.querySelector(e);if(!t)return 0;const n=t.querySelectorAll("button, a, input, select");let r=0;return n.forEach(e=>{if(e instanceof HTMLElement){const t=e.cloneNode(!0);t.setAttribute("data-test-state-changed","true"),e.parentElement?.replaceChild(t,e),r++}}),r}simulateNavigation(){const e=document.querySelector("main")||document.body;e.innerHTML=`\n <div data-test-navigated="true" style="padding: 20px;">\n <h1>Navigated Page</h1>\n <p>This simulates a SPA navigation event.</p>\n <button id="nav-btn-1">Navigation Button 1</button>\n <button id="nav-btn-2">Navigation Button 2</button>\n <input type="text" placeholder="Navigation Input" />\n <button onclick="this.closest('[data-test-navigated]').outerHTML='${e.innerHTML.replace(/'/g,"\\'")}'" style="margin-top: 20px;">\n Restore Original\n </button>\n </div>\n `}reorderList(e){const t=document.querySelector(e);if(!t)return 0;const n=Array.from(t.children);if(n.length<2)return 0;for(let r=n.length-1;r>0;r--){const e=Math.floor(Math.random()*(r+1));[n[r],n[e]]=[n[e],n[r]]}return n.forEach(e=>t.appendChild(e)),n.length}async injectDelayedContent(e=2e3){return new Promise(t=>{setTimeout(()=>{const e=document.createElement("div");e.setAttribute("data-test-delayed","true"),e.style.cssText="padding: 10px; background: #e8f5e9; margin: 10px 0; border-radius: 4px;",e.innerHTML='\n <p>Delayed content loaded!</p>\n <button id="delayed-btn-1">Delayed Button 1</button>\n <button id="delayed-btn-2">Delayed Button 2</button>\n <input type="text" placeholder="Delayed Input" />\n ',document.body.appendChild(e);const n=Array.from(e.querySelectorAll("button, input"));t(n)},e)})}simulateInfiniteScroll(e=5){const t=document.createElement("div");t.setAttribute("data-test-infinite-scroll","true"),t.style.cssText="padding: 10px; background: #fff3e0; margin: 10px 0; border-radius: 4px;";const n=[];for(let r=0;r<e;r++){const e=document.createElement("div");e.innerHTML=`\n <span>Scroll Item ${r+1}</span>\n <button>Action ${r+1}</button>\n `,t.appendChild(e),n.push(e.querySelector("button"))}return document.body.appendChild(t),n}replaceSkeleton(e){const{element:t}=Gc.getElementByIndex(e);if(!t)return null;const n=document.createElement("div");return n.setAttribute("data-test-skeleton-replaced","true"),n.innerHTML='\n <button>Real Content Button</button>\n <input type="text" placeholder="Real Input" />\n ',t.parentElement?.replaceChild(n,t),n.querySelector("button")}insertSameSibling(e){const{element:t}=Gc.getElementByIndex(e);if(!t)return null;const n=document.createElement(t.tagName.toLowerCase());return n.textContent="Same Type Sibling",n.setAttribute("data-test-same-sibling","true"),"BUTTON"===t.tagName&&(n.style.cssText="padding: 8px 16px; margin: 4px;"),t.parentElement?.insertBefore(n,t),n}changeClassName(e,t){const{element:n}=Gc.getElementByIndex(e);return!!n&&(n.className=t,n.setAttribute("data-test-class-changed","true"),!0)}wrapInParent(e){const{element:t}=Gc.getElementByIndex(e);if(!t)return null;const n=document.createElement("div");return n.setAttribute("data-test-wrapper","true"),n.style.cssText="padding: 10px; border: 2px dashed #9c27b0; margin: 5px;",t.parentElement?.insertBefore(n,t),n.appendChild(t),n}addDuplicateId(e){const{element:t}=Gc.getElementByIndex(e);if(!t?.id)return null;const n=document.createElement("div");return n.id=t.id,n.textContent=`Duplicate ID: ${t.id}`,n.setAttribute("data-test-duplicate-id","true"),n.style.cssText="padding: 10px; background: #ffcdd2; margin: 5px;",document.body.insertBefore(n,document.body.firstChild),n}showModal(){const e=document.createElement("div");return e.setAttribute("data-test-modal","true"),e.style.cssText="\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: white;\n padding: 20px;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0,0,0,0.3);\n z-index: 10000;\n ",e.innerHTML='\n <h3>Test Modal</h3>\n <p>These buttons were not indexed initially.</p>\n <button id="modal-btn-1">Modal Button 1</button>\n <button id="modal-btn-2">Modal Button 2</button>\n <button onclick="this.closest(\'[data-test-modal]\').remove()" style="margin-top: 10px;">Close Modal</button>\n ',document.body.appendChild(e),e}expandDropdown(e){const{element:t}=Gc.getElementByIndex(e);if(!t)return null;const n=document.createElement("div");return n.setAttribute("data-test-dropdown","true"),n.style.cssText="\n position: absolute;\n background: white;\n border: 1px solid #ccc;\n border-radius: 4px;\n box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n z-index: 1000;\n ",n.innerHTML='\n <button style="display: block; width: 100%; padding: 8px; border: none; background: none; cursor: pointer;">Option 1</button>\n <button style="display: block; width: 100%; padding: 8px; border: none; background: none; cursor: pointer;">Option 2</button>\n <button style="display: block; width: 100%; padding: 8px; border: none; background: none; cursor: pointer;">Option 3</button>\n ',t.parentElement?.appendChild(n),n}rapidFireChanges(e=5){for(let t=0;t<e;t++)setTimeout(()=>{const e=document.createElement("button");e.textContent=`Rapid ${t+1}`,e.setAttribute("data-test-rapid","true"),document.body.appendChild(e),setTimeout(()=>e.remove(),100)},50*t)}createIframeWithButton(){const e=document.createElement("iframe");e.setAttribute("data-test-iframe","true"),e.style.cssText="width: 300px; height: 100px; border: 2px solid #2196f3;",document.body.appendChild(e);const t=e.contentDocument||e.contentWindow?.document;return t&&(t.body.innerHTML='\n <button id="iframe-button" style="padding: 10px; margin: 10px;">\n Button Inside iFrame\n </button>\n '),e}createShadowDomElement(){window.customElements.get("test-shadow-host")||window.customElements.define("test-shadow-host",class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}).innerHTML='\n <style>\n button { padding: 10px; background: #9c27b0; color: white; border: none; border-radius: 4px; }\n </style>\n <div>\n <button id="shadow-button">Button in Shadow DOM</button>\n </div>\n '}});const e=document.createElement("test-shadow-host");return e.setAttribute("data-test-shadow","true"),document.body.appendChild(e),e}changeElementContent(e,t){const{element:n}=Gc.getElementByIndex(e);return!!n&&(n.textContent=t,n.setAttribute("data-test-content-changed","true"),!0)}hideElement(e){const{element:t}=Gc.getElementByIndex(e);return!!t&&(t.style.display="none",t.setAttribute("data-test-hidden","true"),!0)}async simulateAgentCommand(e,t){const n=t.index,r=await Xc.executeTool(e,t,"do",""),{validation:o}=Gc.getValidatedElement(n);let i,s;r.success?(i="executed",s=r.data?.text||JSON.stringify(r.data)):(i="failed",s=r.error||"Unknown error");const a={command:e,index:n,validation:o,outcome:i,details:s,timestamp:/* @__PURE__ */new Date};return this.lastTestResult=a,this.addToLog({timestamp:/* @__PURE__ */new Date,action:`${e} on index ${n}`,originalIndex:n,validation:o,recoveryAction:void 0}),a}async runScenario(e){const t={"index-shift-insert":async()=>this.runIndexShiftInsertScenario(),"index-shift-remove":async()=>this.runIndexShiftRemoveScenario(),"element-content-change":async()=>this.runContentChangeScenario(),"spa-rerender":async()=>this.runSpaRerenderScenario()}[e];return t?t():{scenarioId:e,scenarioName:"Unknown",steps:[],passed:!1,summary:`Unknown scenario: ${e}`}}async runIndexShiftInsertScenario(){const e=[];Gc.indexInteractableElements();if(!Gc.getFingerprint(3))return{scenarioId:"index-shift-insert",scenarioName:"Index Shift - Insert",steps:[],passed:!1,summary:"No element at target index"};this.insertElementBefore(3,2);const t=await this.simulateAgentCommand("click_element",{index:3});return e.push(t),{scenarioId:"index-shift-insert",scenarioName:"Index Shift - Insert",steps:e,passed:"failed"!==t.outcome,summary:"executed"===t.outcome?"Element found at original index":"Failed to recover element"}}async runIndexShiftRemoveScenario(){const e=[];Gc.indexInteractableElements();this.removeElement(2);const t=await this.simulateAgentCommand("click_element",{index:2});return e.push(t),{scenarioId:"index-shift-remove",scenarioName:"Index Shift - Remove",steps:e,passed:"failed"===t.outcome&&t.details.includes("DOM_CHANGED"),summary:"failed"===t.outcome?"Correctly detected element removal":"Unexpectedly succeeded"}}async runContentChangeScenario(){const e=[];Gc.indexInteractableElements();this.changeElementContent(1,"Modified Button Text");const t=await this.simulateAgentCommand("click_element",{index:1});return e.push(t),{scenarioId:"element-content-change",scenarioName:"Element Content Change",steps:e,passed:"executed"===t.outcome,summary:`Content change handled: ${t.outcome}`}}async runSpaRerenderScenario(){const e=[];Gc.indexInteractableElements();this.simulateRerender(0);const t=await this.simulateAgentCommand("click_element",{index:0});return e.push(t),{scenarioId:"spa-rerender",scenarioName:"SPA Re-render",steps:e,passed:"executed"===t.outcome,summary:`Re-render handled: ${t.outcome}`}}async runAllScenarios(){const e=["index-shift-insert","index-shift-remove","element-content-change","spa-rerender"],t=[];for(const n of e){this.cleanupTestElements();const e=await this.runScenario(n);t.push(e)}return t}getLastTestResult(){return this.lastTestResult}getValidationLog(){return[...this.validationLog]}clearLog(){this.validationLog=[]}addToLog(e){this.validationLog.push(e),this.validationLog.length>100&&(this.validationLog=this.validationLog.slice(-100))}cleanupTestElements(){document.querySelectorAll("[data-test-inserted], [data-test-rerendered], [data-test-state-changed], [data-test-navigated], [data-test-delayed], [data-test-infinite-scroll], [data-test-skeleton-replaced], [data-test-same-sibling], [data-test-class-changed], [data-test-wrapper], [data-test-duplicate-id], [data-test-modal], [data-test-dropdown], [data-test-rapid], [data-test-iframe], [data-test-shadow], [data-test-content-changed], [data-test-hidden]").forEach(e=>e.remove())}getIndexedElements(){return Gc.getAllFingerprints().map(([e,t])=>({index:e,fingerprint:t,element:Gc.getElementByIndex(e).element}))}forceValidation(e){const{validation:t}=Gc.getValidatedElement(e);return t}},kh=xh.getInstance()}),zh=/* @__PURE__ */v({DomTestPanel:()=>_h,default:()=>_h}),Ph=b(()=>{Rh(),Vc(),_h=()=>{const[e,t]=h(!1),[n,r]=h("elements"),[o,i]=h([]),[a,c]=h([]),[d,u]=h(null),[p,m]=h([]),[f,w]=h(0),[b,v]=h("click_element"),x=s(()=>{i(kh.getIndexedElements())},[]),k=s(()=>{c(kh.getValidationLog())},[]);l(()=>{e&&(x(),k())},[e,x,k]);const _=s(()=>{Gc.indexInteractableElements(),x()},[x]),S=s(async()=>{u(await kh.simulateAgentCommand(b,{index:f})),k(),x()},[b,f,k,x]),C=s(async e=>{const t=await kh.runScenario(e);m(e=>[...e,t]),k(),x()},[k,x]),I=s(async()=>{m(await kh.runAllScenarios()),k(),x()},[k,x]),E=s(()=>{kh.insertElementBefore(f),x()},[f,x]),T=s(()=>{kh.removeElement(f),x()},[f,x]),A=s(()=>{kh.simulateRerender(f),x()},[f,x]),M=s(()=>{kh.changeElementContent(f,`Modified Text ${Date.now()}`),x()},[f,x]),O=s(()=>{kh.cleanupTestElements(),x()},[x]),N=s(()=>{kh.showModal()},[]),R=s(()=>{kh.createIframeWithButton()},[]),z=s(()=>{kh.createShadowDomElement()},[]),P=e=>e.isValid?"#4caf50":"#f44336",L=e=>{switch(e){case"executed":return"#4caf50";case"recovered":return"#ff9800";case"failed":return"#f44336";default:return"#9e9e9e"}};return e?/* @__PURE__ */y("div",{style:{position:"fixed",bottom:"20px",left:"20px",width:"500px",maxHeight:"600px",background:"white",border:"1px solid #ccc",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0,0,0,0.2)",zIndex:99999,fontFamily:"monospace",fontSize:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[
|
|
58
|
+
/* @__PURE__ */g("button",{onClick:e=>{e.stopPropagation(),a()},className:"flex-shrink-0 flex items-center justify-center rounded-full",style:{width:"20px",height:"20px",padding:"2px",color:"#7dd3fc"},"aria-label":"Dismiss",children:/* @__PURE__ */g("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:/* @__PURE__ */g("path",{d:"M9 3L3 9M3 3l6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})})},Uh=b(()=>{Xc(),ld(),Ih=class e{static instance;validationLog=[];lastTestResult=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}insertElementBefore(e,t=1){if(!Yc.getAllFingerprints().find(([t])=>t===e))return[];const{element:r}=Yc.getElementByIndex(e);if(!r)return[];const n=[];for(let o=0;o<t;o++){const e=document.createElement("button");e.textContent=`Inserted Button ${o+1}`,e.setAttribute("data-test-inserted","true"),e.style.cssText="padding: 8px 16px; margin: 4px; background: #ff6b6b; color: white; border: none; border-radius: 4px;",r.parentElement?.insertBefore(e,r),n.push(e)}return n}insertElementAfter(e){const{element:t}=Yc.getElementByIndex(e);if(!t)return null;const r=document.createElement("button");return r.textContent="Inserted Button (After)",r.setAttribute("data-test-inserted","true"),r.style.cssText="padding: 8px 16px; margin: 4px; background: #ff6b6b; color: white; border: none; border-radius: 4px;",t.parentElement?.insertBefore(r,t.nextSibling),r}removeElement(e){const{element:t}=Yc.getElementByIndex(e);return!!t&&(t.remove(),!0)}removeMultipleElements(e){let t=0;const r=[...e].sort((e,t)=>t-e);for(const n of r)this.removeElement(n)&&t++;return t}simulateRerender(e){const{element:t}=Yc.getElementByIndex(e);if(!t)return null;const r=t.cloneNode(!0);return r.setAttribute("data-test-rerendered","true"),t.parentElement?.replaceChild(r,t),r}simulateStateChange(e="body"){const t=document.querySelector(e);if(!t)return 0;const r=t.querySelectorAll("button, a, input, select");let n=0;return r.forEach(e=>{if(e instanceof HTMLElement){const t=e.cloneNode(!0);t.setAttribute("data-test-state-changed","true"),e.parentElement?.replaceChild(t,e),n++}}),n}simulateNavigation(){const e=document.querySelector("main")||document.body;e.innerHTML=`\n <div data-test-navigated="true" style="padding: 20px;">\n <h1>Navigated Page</h1>\n <p>This simulates a SPA navigation event.</p>\n <button id="nav-btn-1">Navigation Button 1</button>\n <button id="nav-btn-2">Navigation Button 2</button>\n <input type="text" placeholder="Navigation Input" />\n <button onclick="this.closest('[data-test-navigated]').outerHTML='${e.innerHTML.replace(/'/g,"\\'")}'" style="margin-top: 20px;">\n Restore Original\n </button>\n </div>\n `}reorderList(e){const t=document.querySelector(e);if(!t)return 0;const r=Array.from(t.children);if(r.length<2)return 0;for(let n=r.length-1;n>0;n--){const e=Math.floor(Math.random()*(n+1));[r[n],r[e]]=[r[e],r[n]]}return r.forEach(e=>t.appendChild(e)),r.length}async injectDelayedContent(e=2e3){return new Promise(t=>{setTimeout(()=>{const e=document.createElement("div");e.setAttribute("data-test-delayed","true"),e.style.cssText="padding: 10px; background: #e8f5e9; margin: 10px 0; border-radius: 4px;",e.innerHTML='\n <p>Delayed content loaded!</p>\n <button id="delayed-btn-1">Delayed Button 1</button>\n <button id="delayed-btn-2">Delayed Button 2</button>\n <input type="text" placeholder="Delayed Input" />\n ',document.body.appendChild(e);const r=Array.from(e.querySelectorAll("button, input"));t(r)},e)})}simulateInfiniteScroll(e=5){const t=document.createElement("div");t.setAttribute("data-test-infinite-scroll","true"),t.style.cssText="padding: 10px; background: #fff3e0; margin: 10px 0; border-radius: 4px;";const r=[];for(let n=0;n<e;n++){const e=document.createElement("div");e.innerHTML=`\n <span>Scroll Item ${n+1}</span>\n <button>Action ${n+1}</button>\n `,t.appendChild(e),r.push(e.querySelector("button"))}return document.body.appendChild(t),r}replaceSkeleton(e){const{element:t}=Yc.getElementByIndex(e);if(!t)return null;const r=document.createElement("div");return r.setAttribute("data-test-skeleton-replaced","true"),r.innerHTML='\n <button>Real Content Button</button>\n <input type="text" placeholder="Real Input" />\n ',t.parentElement?.replaceChild(r,t),r.querySelector("button")}insertSameSibling(e){const{element:t}=Yc.getElementByIndex(e);if(!t)return null;const r=document.createElement(t.tagName.toLowerCase());return r.textContent="Same Type Sibling",r.setAttribute("data-test-same-sibling","true"),"BUTTON"===t.tagName&&(r.style.cssText="padding: 8px 16px; margin: 4px;"),t.parentElement?.insertBefore(r,t),r}changeClassName(e,t){const{element:r}=Yc.getElementByIndex(e);return!!r&&(r.className=t,r.setAttribute("data-test-class-changed","true"),!0)}wrapInParent(e){const{element:t}=Yc.getElementByIndex(e);if(!t)return null;const r=document.createElement("div");return r.setAttribute("data-test-wrapper","true"),r.style.cssText="padding: 10px; border: 2px dashed #9c27b0; margin: 5px;",t.parentElement?.insertBefore(r,t),r.appendChild(t),r}addDuplicateId(e){const{element:t}=Yc.getElementByIndex(e);if(!t?.id)return null;const r=document.createElement("div");return r.id=t.id,r.textContent=`Duplicate ID: ${t.id}`,r.setAttribute("data-test-duplicate-id","true"),r.style.cssText="padding: 10px; background: #ffcdd2; margin: 5px;",document.body.insertBefore(r,document.body.firstChild),r}showModal(){const e=document.createElement("div");return e.setAttribute("data-test-modal","true"),e.style.cssText="\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n background: white;\n padding: 20px;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0,0,0,0.3);\n z-index: 10000;\n ",e.innerHTML='\n <h3>Test Modal</h3>\n <p>These buttons were not indexed initially.</p>\n <button id="modal-btn-1">Modal Button 1</button>\n <button id="modal-btn-2">Modal Button 2</button>\n <button onclick="this.closest(\'[data-test-modal]\').remove()" style="margin-top: 10px;">Close Modal</button>\n ',document.body.appendChild(e),e}expandDropdown(e){const{element:t}=Yc.getElementByIndex(e);if(!t)return null;const r=document.createElement("div");return r.setAttribute("data-test-dropdown","true"),r.style.cssText="\n position: absolute;\n background: white;\n border: 1px solid #ccc;\n border-radius: 4px;\n box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n z-index: 1000;\n ",r.innerHTML='\n <button style="display: block; width: 100%; padding: 8px; border: none; background: none; cursor: pointer;">Option 1</button>\n <button style="display: block; width: 100%; padding: 8px; border: none; background: none; cursor: pointer;">Option 2</button>\n <button style="display: block; width: 100%; padding: 8px; border: none; background: none; cursor: pointer;">Option 3</button>\n ',t.parentElement?.appendChild(r),r}rapidFireChanges(e=5){for(let t=0;t<e;t++)setTimeout(()=>{const e=document.createElement("button");e.textContent=`Rapid ${t+1}`,e.setAttribute("data-test-rapid","true"),document.body.appendChild(e),setTimeout(()=>e.remove(),100)},50*t)}createIframeWithButton(){const e=document.createElement("iframe");e.setAttribute("data-test-iframe","true"),e.style.cssText="width: 300px; height: 100px; border: 2px solid #2196f3;",document.body.appendChild(e);const t=e.contentDocument||e.contentWindow?.document;return t&&(t.body.innerHTML='\n <button id="iframe-button" style="padding: 10px; margin: 10px;">\n Button Inside iFrame\n </button>\n '),e}createShadowDomElement(){window.customElements.get("test-shadow-host")||window.customElements.define("test-shadow-host",class extends HTMLElement{constructor(){super();this.attachShadow({mode:"open"}).innerHTML='\n <style>\n button { padding: 10px; background: #9c27b0; color: white; border: none; border-radius: 4px; }\n </style>\n <div>\n <button id="shadow-button">Button in Shadow DOM</button>\n </div>\n '}});const e=document.createElement("test-shadow-host");return e.setAttribute("data-test-shadow","true"),document.body.appendChild(e),e}changeElementContent(e,t){const{element:r}=Yc.getElementByIndex(e);return!!r&&(r.textContent=t,r.setAttribute("data-test-content-changed","true"),!0)}hideElement(e){const{element:t}=Yc.getElementByIndex(e);return!!t&&(t.style.display="none",t.setAttribute("data-test-hidden","true"),!0)}async simulateAgentCommand(e,t){const r=t.index,n=await id.executeTool(e,t,"do",""),{validation:o}=Yc.getValidatedElement(r);let i,s;n.success?(i="executed",s=n.data?.text||JSON.stringify(n.data)):(i="failed",s=n.error||"Unknown error");const a={command:e,index:r,validation:o,outcome:i,details:s,timestamp:/* @__PURE__ */new Date};return this.lastTestResult=a,this.addToLog({timestamp:/* @__PURE__ */new Date,action:`${e} on index ${r}`,originalIndex:r,validation:o,recoveryAction:void 0}),a}async runScenario(e){const t={"index-shift-insert":async()=>this.runIndexShiftInsertScenario(),"index-shift-remove":async()=>this.runIndexShiftRemoveScenario(),"element-content-change":async()=>this.runContentChangeScenario(),"spa-rerender":async()=>this.runSpaRerenderScenario()}[e];return t?t():{scenarioId:e,scenarioName:"Unknown",steps:[],passed:!1,summary:`Unknown scenario: ${e}`}}async runIndexShiftInsertScenario(){const e=[];Yc.indexInteractableElements();if(!Yc.getFingerprint(3))return{scenarioId:"index-shift-insert",scenarioName:"Index Shift - Insert",steps:[],passed:!1,summary:"No element at target index"};this.insertElementBefore(3,2);const t=await this.simulateAgentCommand("click_element",{index:3});return e.push(t),{scenarioId:"index-shift-insert",scenarioName:"Index Shift - Insert",steps:e,passed:"failed"!==t.outcome,summary:"executed"===t.outcome?"Element found at original index":"Failed to recover element"}}async runIndexShiftRemoveScenario(){const e=[];Yc.indexInteractableElements();this.removeElement(2);const t=await this.simulateAgentCommand("click_element",{index:2});return e.push(t),{scenarioId:"index-shift-remove",scenarioName:"Index Shift - Remove",steps:e,passed:"failed"===t.outcome&&t.details.includes("DOM_CHANGED"),summary:"failed"===t.outcome?"Correctly detected element removal":"Unexpectedly succeeded"}}async runContentChangeScenario(){const e=[];Yc.indexInteractableElements();this.changeElementContent(1,"Modified Button Text");const t=await this.simulateAgentCommand("click_element",{index:1});return e.push(t),{scenarioId:"element-content-change",scenarioName:"Element Content Change",steps:e,passed:"executed"===t.outcome,summary:`Content change handled: ${t.outcome}`}}async runSpaRerenderScenario(){const e=[];Yc.indexInteractableElements();this.simulateRerender(0);const t=await this.simulateAgentCommand("click_element",{index:0});return e.push(t),{scenarioId:"spa-rerender",scenarioName:"SPA Re-render",steps:e,passed:"executed"===t.outcome,summary:`Re-render handled: ${t.outcome}`}}async runAllScenarios(){const e=["index-shift-insert","index-shift-remove","element-content-change","spa-rerender"],t=[];for(const r of e){this.cleanupTestElements();const e=await this.runScenario(r);t.push(e)}return t}getLastTestResult(){return this.lastTestResult}getValidationLog(){return[...this.validationLog]}clearLog(){this.validationLog=[]}addToLog(e){this.validationLog.push(e),this.validationLog.length>100&&(this.validationLog=this.validationLog.slice(-100))}cleanupTestElements(){document.querySelectorAll("[data-test-inserted], [data-test-rerendered], [data-test-state-changed], [data-test-navigated], [data-test-delayed], [data-test-infinite-scroll], [data-test-skeleton-replaced], [data-test-same-sibling], [data-test-class-changed], [data-test-wrapper], [data-test-duplicate-id], [data-test-modal], [data-test-dropdown], [data-test-rapid], [data-test-iframe], [data-test-shadow], [data-test-content-changed], [data-test-hidden]").forEach(e=>e.remove())}getIndexedElements(){return Yc.getAllFingerprints().map(([e,t])=>({index:e,fingerprint:t,element:Yc.getElementByIndex(e).element}))}forceValidation(e){const{validation:t}=Yc.getValidatedElement(e);return t}},Eh=Ih.getInstance()}),Bh=/* @__PURE__ */v({DomTestPanel:()=>Th,default:()=>Th}),Wh=b(()=>{Uh(),Xc(),Th=()=>{const[e,t]=h(!1),[r,n]=h("elements"),[o,i]=h([]),[a,c]=h([]),[d,u]=h(null),[p,m]=h([]),[f,w]=h(0),[b,v]=h("click_element"),x=s(()=>{i(Eh.getIndexedElements())},[]),k=s(()=>{c(Eh.getValidationLog())},[]);l(()=>{e&&(x(),k())},[e,x,k]);const _=s(()=>{Yc.indexInteractableElements(),x()},[x]),S=s(async()=>{u(await Eh.simulateAgentCommand(b,{index:f})),k(),x()},[b,f,k,x]),C=s(async e=>{const t=await Eh.runScenario(e);m(e=>[...e,t]),k(),x()},[k,x]),I=s(async()=>{m(await Eh.runAllScenarios()),k(),x()},[k,x]),E=s(()=>{Eh.insertElementBefore(f),x()},[f,x]),T=s(()=>{Eh.removeElement(f),x()},[f,x]),A=s(()=>{Eh.simulateRerender(f),x()},[f,x]),M=s(()=>{Eh.changeElementContent(f,`Modified Text ${Date.now()}`),x()},[f,x]),O=s(()=>{Eh.cleanupTestElements(),x()},[x]),N=s(()=>{Eh.showModal()},[]),R=s(()=>{Eh.createIframeWithButton()},[]),z=s(()=>{Eh.createShadowDomElement()},[]),P=e=>e.isValid?"#4caf50":"#f44336",L=e=>{switch(e){case"executed":return"#4caf50";case"recovered":return"#ff9800";case"failed":return"#f44336";default:return"#9e9e9e"}};return e?/* @__PURE__ */y("div",{style:{position:"fixed",bottom:"20px",left:"20px",width:"500px",maxHeight:"600px",background:"white",border:"1px solid #ccc",borderRadius:"8px",boxShadow:"0 4px 20px rgba(0,0,0,0.2)",zIndex:99999,fontFamily:"monospace",fontSize:"12px",overflow:"hidden",display:"flex",flexDirection:"column"},children:[
|
|
57
59
|
/* @__PURE__ */y("div",{style:{padding:"10px 15px",background:"#2196f3",color:"white",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[/* @__PURE__ */g("span",{style:{fontWeight:"bold"},children:"DOM Test Panel (Dev Only)"}),/* @__PURE__ */g("button",{onClick:()=>t(!1),style:{background:"transparent",border:"none",color:"white",cursor:"pointer",fontSize:"16px"},children:"x"})]}),
|
|
58
|
-
/* @__PURE__ */g("div",{style:{display:"flex",borderBottom:"1px solid #eee"},children:["elements","simulate","scenarios","log"].map(e=>/* @__PURE__ */g("button",{onClick:()=>
|
|
59
|
-
/* @__PURE__ */y("div",{style:{flex:1,overflow:"auto",padding:"10px"},children:["elements"===
|
|
60
|
-
/* @__PURE__ */g("button",{onClick:_,style:
|
|
61
|
-
/* @__PURE__ */g("button",{onClick:x,style:
|
|
62
|
-
/* @__PURE__ */y("span",{style:{marginLeft:"auto",color:"#666"},children:[o.length," elements"]})]}),/* @__PURE__ */g("div",{style:{maxHeight:"300px",overflow:"auto"},children:o.map(({index:e,fingerprint:t})=>{const
|
|
63
|
-
return y("div",{onClick:()=>w(e),style:{padding:"8px",marginBottom:"4px",background:f===e?"#e3f2fd":"#f5f5f5",borderRadius:"4px",cursor:"pointer",borderLeft:`4px solid ${P(
|
|
60
|
+
/* @__PURE__ */g("div",{style:{display:"flex",borderBottom:"1px solid #eee"},children:["elements","simulate","scenarios","log"].map(e=>/* @__PURE__ */g("button",{onClick:()=>n(e),style:{flex:1,padding:"8px",border:"none",background:r===e?"#e3f2fd":"transparent",cursor:"pointer",borderBottom:r===e?"2px solid #2196f3":"none"},children:e.charAt(0).toUpperCase()+e.slice(1)},e))}),
|
|
61
|
+
/* @__PURE__ */y("div",{style:{flex:1,overflow:"auto",padding:"10px"},children:["elements"===r&&/* @__PURE__ */y("div",{children:[/* @__PURE__ */y("div",{style:{marginBottom:"10px",display:"flex",gap:"5px"},children:[
|
|
62
|
+
/* @__PURE__ */g("button",{onClick:_,style:Ah,children:"Re-index DOM"}),
|
|
63
|
+
/* @__PURE__ */g("button",{onClick:x,style:Ah,children:"Refresh"}),
|
|
64
|
+
/* @__PURE__ */y("span",{style:{marginLeft:"auto",color:"#666"},children:[o.length," elements"]})]}),/* @__PURE__ */g("div",{style:{maxHeight:"300px",overflow:"auto"},children:o.map(({index:e,fingerprint:t})=>{const r=Eh.forceValidation(e);/* @__PURE__ */
|
|
65
|
+
return y("div",{onClick:()=>w(e),style:{padding:"8px",marginBottom:"4px",background:f===e?"#e3f2fd":"#f5f5f5",borderRadius:"4px",cursor:"pointer",borderLeft:`4px solid ${P(r)}`},children:[
|
|
64
66
|
/* @__PURE__ */y("div",{style:{fontWeight:"bold"},children:["[",e,"] ",t.tagName,t.id&&` #${t.id}`]}),
|
|
65
67
|
/* @__PURE__ */g("div",{style:{color:"#666",fontSize:"10px"},children:t.textContent?.slice(0,50)||"(no text)"}),
|
|
66
|
-
/* @__PURE__ */y("div",{style:{color:"#999",fontSize:"10px"},children:[t.selector.slice(0,60),"..."]})]},e)})})]}),"simulate"===
|
|
68
|
+
/* @__PURE__ */y("div",{style:{color:"#999",fontSize:"10px"},children:[t.selector.slice(0,60),"..."]})]},e)})})]}),"simulate"===r&&/* @__PURE__ */y("div",{children:[
|
|
67
69
|
/* @__PURE__ */y("div",{style:{marginBottom:"15px"},children:[/* @__PURE__ */g("label",{style:{display:"block",marginBottom:"5px",fontWeight:"bold"},children:"Target Index:"}),/* @__PURE__ */g("input",{type:"number",value:f,onChange:e=>w(parseInt(e.target.value)||0),style:{width:"100px",padding:"5px"}})]}),
|
|
68
70
|
/* @__PURE__ */y("div",{style:{marginBottom:"15px"},children:[
|
|
69
71
|
/* @__PURE__ */g("label",{style:{display:"block",marginBottom:"5px",fontWeight:"bold"},children:"Command:"}),
|
|
@@ -71,40 +73,40 @@ return y("div",{onClick:()=>w(e),style:{padding:"8px",marginBottom:"4px",backgro
|
|
|
71
73
|
/* @__PURE__ */g("option",{value:"click_element",children:"click_element"}),
|
|
72
74
|
/* @__PURE__ */g("option",{value:"type_text",children:"type_text"}),
|
|
73
75
|
/* @__PURE__ */g("option",{value:"send_keys",children:"send_keys"})]}),
|
|
74
|
-
/* @__PURE__ */g("button",{onClick:S,style:{...
|
|
76
|
+
/* @__PURE__ */g("button",{onClick:S,style:{...Ah,background:"#4caf50"},children:"Execute"})]}),
|
|
75
77
|
/* @__PURE__ */y("div",{style:{marginBottom:"15px"},children:[/* @__PURE__ */g("div",{style:{fontWeight:"bold",marginBottom:"5px"},children:"DOM Mutations:"}),/* @__PURE__ */y("div",{style:{display:"flex",flexWrap:"wrap",gap:"5px"},children:[
|
|
76
|
-
/* @__PURE__ */g("button",{onClick:E,style:
|
|
77
|
-
/* @__PURE__ */g("button",{onClick:T,style:{...
|
|
78
|
-
/* @__PURE__ */g("button",{onClick:A,style:
|
|
79
|
-
/* @__PURE__ */g("button",{onClick:M,style:
|
|
78
|
+
/* @__PURE__ */g("button",{onClick:E,style:Ah,children:"Insert Before"}),
|
|
79
|
+
/* @__PURE__ */g("button",{onClick:T,style:{...Ah,background:"#f44336"},children:"Remove"}),
|
|
80
|
+
/* @__PURE__ */g("button",{onClick:A,style:Ah,children:"Rerender"}),
|
|
81
|
+
/* @__PURE__ */g("button",{onClick:M,style:Ah,children:"Change Text"})]})]}),
|
|
80
82
|
/* @__PURE__ */y("div",{style:{marginBottom:"15px"},children:[/* @__PURE__ */g("div",{style:{fontWeight:"bold",marginBottom:"5px"},children:"Special Cases:"}),/* @__PURE__ */y("div",{style:{display:"flex",flexWrap:"wrap",gap:"5px"},children:[
|
|
81
|
-
/* @__PURE__ */g("button",{onClick:N,style:
|
|
82
|
-
/* @__PURE__ */g("button",{onClick:R,style:
|
|
83
|
-
/* @__PURE__ */g("button",{onClick:z,style:
|
|
84
|
-
/* @__PURE__ */g("button",{onClick:O,style:{...
|
|
83
|
+
/* @__PURE__ */g("button",{onClick:N,style:Ah,children:"Show Modal"}),
|
|
84
|
+
/* @__PURE__ */g("button",{onClick:R,style:Ah,children:"Create iFrame"}),
|
|
85
|
+
/* @__PURE__ */g("button",{onClick:z,style:Ah,children:"Shadow DOM"})]})]}),
|
|
86
|
+
/* @__PURE__ */g("button",{onClick:O,style:{...Ah,background:"#ff9800"},children:"Cleanup Test Elements"}),d&&/* @__PURE__ */y("div",{style:{marginTop:"15px",padding:"10px",background:"#f5f5f5",borderRadius:"4px",borderLeft:`4px solid ${L(d.outcome)}`},children:[
|
|
85
87
|
/* @__PURE__ */g("div",{style:{fontWeight:"bold"},children:"Last Result:"}),
|
|
86
88
|
/* @__PURE__ */y("div",{children:["Command: ",d.command]}),
|
|
87
89
|
/* @__PURE__ */y("div",{children:["Index: ",d.index]}),
|
|
88
90
|
/* @__PURE__ */y("div",{style:{color:L(d.outcome)},children:["Outcome: ",d.outcome.toUpperCase()]}),
|
|
89
|
-
/* @__PURE__ */g("div",{style:{fontSize:"10px",color:"#666"},children:d.details})]})]}),"scenarios"===
|
|
90
|
-
/* @__PURE__ */g("div",{style:{marginBottom:"15px"},children:/* @__PURE__ */g("button",{onClick:I,style:{...
|
|
91
|
+
/* @__PURE__ */g("div",{style:{fontSize:"10px",color:"#666"},children:d.details})]})]}),"scenarios"===r&&/* @__PURE__ */y("div",{children:[
|
|
92
|
+
/* @__PURE__ */g("div",{style:{marginBottom:"15px"},children:/* @__PURE__ */g("button",{onClick:I,style:{...Ah,background:"#4caf50"},children:"Run All Scenarios"})}),
|
|
91
93
|
/* @__PURE__ */y("div",{style:{marginBottom:"15px"},children:[/* @__PURE__ */g("div",{style:{fontWeight:"bold",marginBottom:"5px"},children:"Individual Scenarios:"}),/* @__PURE__ */y("div",{style:{display:"flex",flexDirection:"column",gap:"5px"},children:[
|
|
92
|
-
/* @__PURE__ */g("button",{onClick:()=>C("index-shift-insert"),style:
|
|
93
|
-
/* @__PURE__ */g("button",{onClick:()=>C("index-shift-remove"),style:
|
|
94
|
-
/* @__PURE__ */g("button",{onClick:()=>C("element-content-change"),style:
|
|
95
|
-
/* @__PURE__ */g("button",{onClick:()=>C("spa-rerender"),style:
|
|
94
|
+
/* @__PURE__ */g("button",{onClick:()=>C("index-shift-insert"),style:Ah,children:"Index Shift - Insert"}),
|
|
95
|
+
/* @__PURE__ */g("button",{onClick:()=>C("index-shift-remove"),style:Ah,children:"Index Shift - Remove"}),
|
|
96
|
+
/* @__PURE__ */g("button",{onClick:()=>C("element-content-change"),style:Ah,children:"Content Change"}),
|
|
97
|
+
/* @__PURE__ */g("button",{onClick:()=>C("spa-rerender"),style:Ah,children:"SPA Re-render"})]})]}),p.length>0&&/* @__PURE__ */y("div",{children:[
|
|
96
98
|
/* @__PURE__ */g("div",{style:{fontWeight:"bold",marginBottom:"5px"},children:"Results:"}),p.map((e,t)=>/* @__PURE__ */y("div",{style:{padding:"8px",marginBottom:"4px",background:"#f5f5f5",borderRadius:"4px",borderLeft:"4px solid "+(e.passed?"#4caf50":"#f44336")},children:[/* @__PURE__ */y("div",{style:{fontWeight:"bold"},children:[e.passed?"PASS":"FAIL",": ",e.scenarioName]}),/* @__PURE__ */g("div",{style:{fontSize:"10px",color:"#666"},children:e.summary})]},t)),
|
|
97
|
-
/* @__PURE__ */g("button",{onClick:()=>m([]),style:{...
|
|
98
|
-
/* @__PURE__ */g("button",{onClick:k,style:
|
|
99
|
-
/* @__PURE__ */g("button",{onClick:()=>{
|
|
99
|
+
/* @__PURE__ */g("button",{onClick:()=>m([]),style:{...Ah,marginTop:"10px"},children:"Clear Results"})]})]}),"log"===r&&/* @__PURE__ */y("div",{children:[/* @__PURE__ */y("div",{style:{marginBottom:"10px",display:"flex",gap:"5px"},children:[
|
|
100
|
+
/* @__PURE__ */g("button",{onClick:k,style:Ah,children:"Refresh"}),
|
|
101
|
+
/* @__PURE__ */g("button",{onClick:()=>{Eh.clearLog(),k()},style:Ah,children:"Clear"}),
|
|
100
102
|
/* @__PURE__ */y("span",{style:{marginLeft:"auto",color:"#666"},children:[a.length," entries"]})]}),/* @__PURE__ */g("div",{style:{maxHeight:"400px",overflow:"auto"},children:a.slice().reverse().map((e,t)=>/* @__PURE__ */y("div",{style:{padding:"8px",marginBottom:"4px",background:"#f5f5f5",borderRadius:"4px",borderLeft:`4px solid ${P(e.validation)}`,fontSize:"10px"},children:[
|
|
101
103
|
/* @__PURE__ */g("div",{style:{color:"#999"},children:e.timestamp.toLocaleTimeString()}),
|
|
102
104
|
/* @__PURE__ */g("div",{style:{fontWeight:"bold"},children:e.action}),
|
|
103
|
-
/* @__PURE__ */y("div",{children:["Valid: ",e.validation.isValid?"Yes":"No",e.validation.mismatchReason&&` (${e.validation.mismatchReason})`]}),e.recoveryAction&&/* @__PURE__ */y("div",{style:{color:"#ff9800"},children:["Recovery: ",e.recoveryAction]})]},t))})]})]})]}):/* @__PURE__ */g("button",{onClick:()=>t(!0),style:{position:"fixed",bottom:"20px",left:"20px",zIndex:99999,padding:"8px 16px",background:"#2196f3",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontFamily:"monospace",fontSize:"12px"},children:"DOM Test Panel"})},
|
|
104
|
-
return y("div",{className:"marketrix-widget relative",style:{...
|
|
105
|
-
/* @__PURE__ */g(
|
|
106
|
-
/* @__PURE__ */g(wp,{config:M,onClick:d.toggleWidget,onStopTask:d.stopTask,isOpen:c.isOpen,isMinimized:c.isMinimized,isLoading:c.isLoading,isTaskRunning:c.isTaskRunning,hasError:!!c.error,position:v,onPositionChange:e=>{_(e),f||"undefined"==typeof localStorage||localStorage.setItem(I,e)}}),c.error&&/* @__PURE__ */g(Oh,{error:c.error,onClose:()=>d.clearError(),onRetry:()=>d.clearError(),position:v}),s&&!c.error&&p.widget_greeting&&/* @__PURE__ */g(Nh,{greeting:p.widget_greeting,body:p.widget_body,onClose:()=>a(!1)}),i]})},jh=Object.defineProperty,Fh=(e,t,n)=>((e,t,n)=>t in e?jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Uh=Object.defineProperty,Bh=(e,t,n)=>((e,t,n)=>t in e?Uh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),Wh=/* @__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))(Wh||{}),Gh={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Hh={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Zh={};function Vh(e){if(Zh[e])return Zh[e];const t=globalThis[e],n=t.prototype,r=e in Gh?Gh[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 Hh?Hh[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 Zh[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const o=r.contentWindow;if(!o)return t.prototype;const i=o[e].prototype;return document.body.removeChild(r),i?Zh[e]=i:n}catch{return n}}var qh={};function Jh(e,t,n){var r;const o=`${e}.${String(n)}`;if(qh[o])return qh[o].call(t);const i=Vh(e),s=null==(r=Object.getOwnPropertyDescriptor(i,n))?void 0:r.get;return s?(qh[o]=s,s.call(t)):t[n]}var Yh={};function Kh(e,t,n){const r=`${e}.${String(n)}`;if(Yh[r])return Yh[r].bind(t);const o=Vh(e)[n];return"function"!=typeof o?t[n]:(Yh[r]=o,o.bind(t))}var Qh={ownerDocument:function(e){return Jh("Node",e,"ownerDocument")},childNodes:function(e){return Jh("Node",e,"childNodes")},parentNode:function(e){return Jh("Node",e,"parentNode")},parentElement:function(e){return Jh("Node",e,"parentElement")},textContent:function(e){return Jh("Node",e,"textContent")},contains:function(e,t){return Kh("Node",e,"contains")(t)},getRootNode:function(e){return Kh("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?Jh("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?Jh("Element",e,"shadowRoot"):null},querySelector:function(e,t){return Jh("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return Jh("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return Vh("MutationObserver").constructor},patch:function(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()=>{}}}};function Xh(e){return e.nodeType===e.ELEMENT_NODE}function em(e){const t=e&&"host"in e&&"mode"in e&&Qh.host(e)||null;return Boolean(t&&"shadowRoot"in t&&Qh.shadowRoot(t)===e)}function tm(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function nm(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=>rm(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 rm(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=nm(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?mm(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?mm(n,t):n}}var om=class{constructor(){Bh(this,"idNodeMap",/* @__PURE__ */new Map),Bh(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 im({element:e,maskInputOptions:t,tagName:n,type:r,value:o,maskInputFn:i}){let s=o||"";const a=r&&sm(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=i?i(s,e):"*".repeat(s.length)),s}function sm(e){return e.toLowerCase()}var am="__rrweb_original__";function lm(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?sm(t):null}function cm(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 dm=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,um=/^(?:[a-z+]+:)?\/\//i,pm=/^www\..*/i,hm=/^(data:)([^,]*),(.*)/i;function mm(e,t){return(e||"").replace(dm,(e,n,r,o,i,s)=>{const a=r||i||s,l=n||o||"";if(!a)return e;if(um.test(a)||pm.test(a))return`url(${l}${a}${l})`;if(hm.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${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}${l})`;const c=t.split("/"),d=a.split("/");c.pop();for(const t of d){if("."===t)continue;".."===t?c.pop():c.push(t)}return`url(${l}${c.join("/")}${l})`})}function fm(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function gm(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=fm(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 l=fm(r[a].textContent,n),c=100;let d=3;for(;d<l.length&&(l[d].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,d),1));d++);for(;d<l.length;d++){let u=l.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=c+1}else d===l.length-1&&(h=t.indexOf(u));if(p.length>=2&&d>c){const e=r[a-1].textContent;if(e&&"string"==typeof e){const n=fm(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 l=fm(e.substring(0,a),n);if(l.length===h){o.push(e.substring(0,a)),e=e.substring(a),t=t.substring(h);break}l.length<h?a+=Math.max(1,Math.floor((h-l.length)/s)):a-=Math.max(1,Math.floor((l.length-h)*s))}break}}}}return o.push(e),o}(e,t).join("/* rr_split */")}var ym,wm,bm=1,vm=/* @__PURE__ */new RegExp("[^a-z0-9-_:]");function xm(){return bm++}var km=/^[^ \t\n\r\u000c]+/,_m=/^[, \t\n\r\u000c]+/;var Sm=/* @__PURE__ */new WeakMap;function Cm(e,t){return t&&""!==t.trim()?Em(e,t):t}function Im(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Em(e,t){let n=Sm.get(e);if(n||(n=e.createElement("a"),Sm.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function Tm(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)?Cm(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(_m),!(n>=t.length);){let i=r(km);if(","===i.slice(-1))i=Cm(e,i.substring(0,i.length-1)),o.push(i);else{let r="";i=Cm(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?mm(r,Em(e)):"object"===t&&"data"===n?Cm(e,r):r:r}function Am(e,t,n){return["video","audio"].includes(e)&&"autoplay"===t}function Mm(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Mm(Qh.parentNode(e),t,n);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!n&&Mm(Qh.parentNode(e),t,n)}function Om(e,t,n,r){let o;if(Xh(e)){if(o=e,!Qh.childNodes(o).length)return!1}else{if(null===Qh.parentElement(e))return!1;o=Qh.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(Mm(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 Nm(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:d,dataURLOptions:u={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:f=!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:Wh.Document,childNodes:[],compatMode:e.compatMode}:{type:Wh.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Wh.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:l={},inlineImages:c,recordCanvas:d,keepIframeSrcFn:u,newlyAddedElement:p=!1,rootId:h}=t,m=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),f=function(e){if(e instanceof HTMLFormElement)return"form";const t=sm(e.tagName);return vm.test(t)?"div":t}(e);let g={};const y=e.attributes.length;for(let v=0;v<y;v++){const t=e.attributes[v];Am(f,t.name,t.value)||(g[t.name]=Tm(n,f,sm(t.name),t.value))}if("link"===f&&i){const t=Array.from(n.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=nm(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if("style"===f&&e.sheet){let t=nm(e.sheet);t&&(e.childNodes.length>1&&(t=gm(t,e)),g._cssText=t)}if(["input","textarea","select"].includes(f)){const t=e.value,n=e.checked;"radio"!==g.type&&"checkbox"!==g.type&&"submit"!==g.type&&"button"!==g.type&&t?g.value=im({element:e,type:lm(e),tagName:f,value:t,maskInputOptions:s,maskInputFn:a}):n&&(g.checked=n)}"option"===f&&(e.selected&&!s.select?g.selected=!0:delete g.selected);"dialog"===f&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===f&&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=am in o?o[am]: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(l.type,l.quality));else if(!("__context"in e)){const t=e.toDataURL(l.type,l.quality),r=n.createElement("canvas");r.width=e.width,r.height=e.height,t!==r.toDataURL(l.type,l.quality)&&(g.rr_dataURL=t)}if("img"===f&&c){ym||(ym=n.createElement("canvas"),wm=ym.getContext("2d"));const t=e,r=(t.currentSrc||t.getAttribute("src"),t.crossOrigin),o=()=>{t.removeEventListener("load",o);try{ym.width=t.naturalWidth,ym.height=t.naturalHeight,wm.drawImage(t,0,0),g.rr_dataURL=ym.toDataURL(l.type,l.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(f)){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(m){const{width:t,height:n}=e.getBoundingClientRect();g={class:g.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==f||u(g.src)||(e.contentDocument||(g.rr_src=g.src),delete g.src);let w;try{customElements.get(f)&&(w=!0)}catch(b){}return{type:Wh.Element,tagName:f,attributes:g,childNodes:[],isSVG:Im(e)||void 0,needBlock:m,rootId:h,isCustom:w}}(e,{doc:n,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:d,dataURLOptions:u,inlineImages:p,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:f,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:n,maskTextFn:r,rootId:o,cssCaptured:i}=t,s=Qh.parentNode(e),a=s&&s.tagName;let l="";const c="STYLE"===a||void 0,d="SCRIPT"===a||void 0;d?l="SCRIPT_PLACEHOLDER":i||(l=Qh.textContent(e),c&&l&&(l=mm(l,Em(t.doc))));!c&&!d&&l&&n&&(l=r?r(l,Qh.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:Wh.Text,textContent:l||"",rootId:o}}(e,{doc:n,needsMask:s,maskTextFn:c,rootId:y,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:Wh.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Wh.Comment,textContent:Qh.textContent(e)||"",rootId:y};default:return!1}}function Rm(e){return null==e?"":e.toLowerCase()}function zm(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 Pm(e,t){const{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:d={},maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m={},inlineImages:f=!1,recordCanvas:g=!1,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:_=!1,cssCaptured:S=!1}=t;let{needsMask:C}=t,{preserveWhiteSpace:I=!0}=t;C||(C=Om(e,s,a,void 0===C));const E=Nm(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:C,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,dataURLOptions:m,inlineImages:f,recordCanvas:g,keepIframeSrcFn:k,newlyAddedElement:_,cssCaptured:S});if(!E)return null;let T;T=r.hasNode(e)?r.getId(e):function(e,t){if(t.comment&&e.type===Wh.Comment)return!0;if(e.type===Wh.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"===cm(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Rm(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Rm(e.attributes.name)||"icon"===Rm(e.attributes.rel)||"apple-touch-icon"===Rm(e.attributes.rel)||"shortcut icon"===Rm(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Rm(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Rm(e.attributes.property).match(/^(og|twitter|fb):/)||Rm(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Rm(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===Rm(e.attributes.name)||"googlebot"===Rm(e.attributes.name)||"bingbot"===Rm(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===Rm(e.attributes.name)||"generator"===Rm(e.attributes.name)||"framework"===Rm(e.attributes.name)||"publisher"===Rm(e.attributes.name)||"progid"===Rm(e.attributes.name)||Rm(e.attributes.property).match(/^article:/)||Rm(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===Rm(e.attributes.name)||"yandex-verification"===Rm(e.attributes.name)||"csrf-token"===Rm(e.attributes.name)||"p:domain_verify"===Rm(e.attributes.name)||"verify-v1"===Rm(e.attributes.name)||"verification"===Rm(e.attributes.name)||"shopify-checkout-api-token"===Rm(e.attributes.name)))return!0}}return!1}(E,h)||!I&&E.type===Wh.Text&&!E.textContent.replace(/^\s+|\s+$/gm,"").length?-2:xm();const A=Object.assign(E,{id:T});if(r.add(e,A),-2===T)return null;y&&y(e);let M=!l;if(A.type===Wh.Element){M=M&&!A.needBlock,delete A.needBlock;const t=Qh.shadowRoot(e);t&&tm(t)&&(A.isShadowHost=!0)}if((A.type===Wh.Document||A.type===Wh.Element)&&M){h.headWhitespace&&A.type===Wh.Element&&"head"===A.tagName&&(I=!1);const t={doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:C,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:f,recordCanvas:g,preserveWhiteSpace:I,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:k,cssCaptured:!1};if(A.type===Wh.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else{A.type===Wh.Element&&void 0!==A.attributes._cssText&&"string"==typeof A.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(Qh.childNodes(e))){const e=Pm(n,t);e&&A.childNodes.push(e)}}let _=null;if(Xh(e)&&(_=Qh.shadowRoot(e)))for(const e of Array.from(Qh.childNodes(_))){const n=Pm(e,t);n&&(tm(_)&&(n.isShadow=!0),A.childNodes.push(n))}}const O=Qh.parentNode(e);return O&&em(O)&&tm(O)&&(A.isShadow=!0),A.type===Wh.Element&&"iframe"===A.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&&w){const n=Pm(t,{doc:t,mirror:r,blockClass:o,blockSelector:i,needsMask:C,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:f,recordCanvas:g,preserveWhiteSpace:I,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:k});n&&w(e,n)}},b),A.type===Wh.Element&&"link"===A.tagName&&"string"==typeof A.attributes.rel&&("stylesheet"===A.attributes.rel||"preload"===A.attributes.rel&&"string"==typeof A.attributes.href&&"css"===cm(A.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(v){const t=Pm(e,{doc:n,mirror:r,blockClass:o,blockSelector:i,needsMask:C,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:f,recordCanvas:g,preserveWhiteSpace:I,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:k});t&&v(e,t)}},x),A}function Lm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Dm(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var $m={exports:{}},jm=String,Fm=function(){return{isColorSupported:!1,reset:jm,bold:jm,dim:jm,italic:jm,underline:jm,inverse:jm,hidden:jm,strikethrough:jm,black:jm,red:jm,green:jm,yellow:jm,blue:jm,magenta:jm,cyan:jm,white:jm,gray:jm,bgBlack:jm,bgRed:jm,bgGreen:jm,bgYellow:jm,bgBlue:jm,bgMagenta:jm,bgCyan:jm,bgWhite:jm}};$m.exports=Fm(),$m.exports.createColors=Fm;var Um=$m.exports,Bm=/* @__PURE__ */Dm(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),Wm=Um,Gm=Bm,Hm=class e extends Error{constructor(t,n,r,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),void 0!==n&&void 0!==r&&("number"==typeof n?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=Wm.isColorSupported),Gm&&e&&(t=Gm(t));let n,r,o=t.split(/\r?\n/),i=Math.max(this.line-3,0),s=Math.min(this.line+2,o.length),a=String(s).length;if(e){let{bold:e,gray:t,red:o}=Wm.createColors(!0);n=t=>e(o(t)),r=e=>t(e)}else n=r=e=>e;return o.slice(i,s).map((e,t)=>{let o=i+1+t,s=" "+(" "+o).slice(-a)+" | ";if(o===this.line){let t=r(s.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return n(">")+r(s)+e+"\n "+t+n("^")}return" "+r(s)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}},Zm=Hm;Hm.default=Hm;var Vm={};Vm.isClean=Symbol("isClean"),Vm.my=Symbol("my");var qm={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var Jm=class{constructor(e){this.builder=e}atrule(e,t){let n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let o=(e.raws.between||"")+(t?";":"");this.builder(n+r+o,e)}}beforeAfter(e,t){let n;n="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,o=0;for(;r&&"root"!==r.type;)o+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<o;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let o=e.nodes[r],i=this.raw(o,"before");i&&this.builder(i),this.stringify(o,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,n){let r;if(n||(n=t),t&&(r=e.raws[t],void 0!==r))return r;let o=e.parent;if("before"===n){if(!o||"root"===o.type&&o.first===e)return"";if(o&&"document"===o.type)return""}if(!o)return qm[n];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[n])return i.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let o="raw"+((s=n)[0].toUpperCase()+s.slice(1));this[o]?r=this[o](i,e):i.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var s;return void 0===r&&(r=qm[n]),i.rawCache[n]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},Ym=Jm;Jm.default=Jm;var Km=Ym;function Qm(e,t){new Km(t).stringify(e)}var Xm=Qm;Qm.default=Qm;var{isClean:ef,my:tf}=Vm,nf=Zm,rf=Ym,of=Xm;function sf(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let o=e[r],i=typeof o;"parent"===r&&"object"===i?t&&(n[r]=t):"source"===r?n[r]=o:Array.isArray(o)?n[r]=o.map(e=>sf(e,n)):("object"===i&&null!==o&&(o=sf(o)),n[r]=o)}return n}var af=class{constructor(e={}){this.raws={},this[ef]=!1,this[tf]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=sf(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new nf(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[ef]){this[ef]=!1;let e=this;for(;e=e.parent;)e[ef]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,o=this.source.start.line;for(let i=0;i<e;i++)"\n"===n[i]?(r=1,o+=1):r+=1;return{column:r,line:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),o=r.indexOf(e.word);-1!==o&&(t=this.positionInside(o,r),n=this.positionInside(o+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new rf).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=null==t;t=t||/* @__PURE__ */new Map;let o=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i))continue;if("parent"===i||"proxyCache"===i)continue;let e=this[i];if(Array.isArray(e))n[i]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)n[i]=e.toJSON(null,t);else if("source"===i){let r=t.get(e.input);null==r&&(r=o,t.set(e.input,o),o++),n[i]={end:e.end,inputId:r,start:e.start}}else n[i]=e}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=of){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let o in n)r[o]=n[o];return e.warn(t,r)}get proxyOf(){return this}},lf=af;af.default=af;var cf=lf,df=class extends cf{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}},uf=df;df.default=df;var pf={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r}},{SourceMapConsumer:hf,SourceMapGenerator:mf}=Bm,{existsSync:ff,readFileSync:gf}=Bm,{dirname:yf,join:wf}=Bm;var bf=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=yf(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new hf(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=yf(e),ff(e))return this.mapFile=e,gf(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof hf)return mf.fromSourceMap(t).toString();if(t instanceof mf)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=wf(yf(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},vf=bf;bf.default=bf;var{SourceMapConsumer:xf,SourceMapGenerator:kf}=Bm,{fileURLToPath:_f,pathToFileURL:Sf}=Bm,{isAbsolute:Cf,resolve:If}=Bm,{nanoid:Ef}=pf,Tf=Bm,Af=Zm,Mf=vf,Of=Symbol("fromOffsetCache"),Nf=Boolean(xf&&kf),Rf=Boolean(If&&Cf),zf=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Rf||/^\w+:\/\//.test(t.from)||Cf(t.from)?this.file=t.from:this.file=If(t.from)),Rf&&Nf){let e=new Mf(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+Ef(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let o,i,s;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);i=e.line,s=e.col}else i=r.line,s=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let a=this.origin(t,n,i,s);return o=a?new Af(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,r.plugin):new Af(e,void 0===i?t:{column:n,line:t},void 0===i?n:{column:s,line:i},this.css,this.file,r.plugin),o.input={column:n,endColumn:s,endLine:i,line:t,source:this.css},this.file&&(Sf&&(o.input.url=Sf(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[Of])n=this[Of];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,o=e.length;r<o;r++)n[r]=t,t+=e[r].length+1;this[Of]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,o=n.length-2;for(;r<o;)if(t=r+(o-r>>1),e<n[t])o=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:If(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let o,i,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof n&&(o=s.originalPositionFor({column:r,line:n})),i=Cf(a.source)?Sf(a.source):new URL(a.source,this.map.consumer().sourceRoot||Sf(this.map.mapFile));let l={column:a.column,endColumn:o&&o.column,endLine:o&&o.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!_f)throw new Error("file: protocol is not available in this PostCSS build");l.file=_f(i)}let c=s.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},Pf=zf;zf.default=zf,Tf&&Tf.registerInput&&Tf.registerInput(zf);var{SourceMapConsumer:Lf,SourceMapGenerator:Df}=Bm,{dirname:$f,relative:jf,resolve:Ff,sep:Uf}=Bm,{pathToFileURL:Bf}=Bm,Wf=Pf,Gf=Boolean(Lf&&Df),Hf=Boolean($f&&Ff&&jf&&Uf),Zf=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=/* @__PURE__ */new Map,this.memoizedPaths=/* @__PURE__ */new Map,this.memoizedURLs=/* @__PURE__ */new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,n=this.toUrl(this.path(e.file)),r=e.root||$f(e.file);!1===this.mapOpts.sourcesContent?(t=new Lf(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Hf&&Gf&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Df.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Df({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Df({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,o="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(s,a,l)=>{if(this.css+=s,a&&"end"!==l&&(i.generated.line=n,i.generated.column=r-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=s.match(/\n/g),e?(n+=e.length,t=s.lastIndexOf("\n"),r=s.length-t):r+=s.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"!==a.type&&("atrule"!==a.type||a.nodes)||a!==e.last||e.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=n,i.generated.column=r-2,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,i.generated.line=n,i.generated.column=r-1,this.map.addMapping(i)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?$f(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=$f(Ff(n,this.mapOpts.annotation)));let r=jf(n,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Wf(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Bf){let t=Bf(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===Uf&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Vf=lf,qf=class extends Vf{constructor(e){super(e),this.type="comment"}},Jf=qf;qf.default=qf;var Yf,Kf,Qf,Xf,{isClean:eg,my:tg}=Vm,ng=uf,rg=Jf,og=lf;function ig(e){return e.map(e=>(e.nodes&&(e.nodes=ig(e.nodes)),delete e.source,e))}function sg(e){if(e[eg]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)sg(t)}var ag=class e extends og{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n,r=this.index(e),o=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let i of o)this.proxyOf.nodes.splice(r+1,0,i);for(let i in this.indexes)n=this.indexes[i],r<n&&(this.indexes[i]=n+o.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),o=0===r&&"prepend",i=this.normalize(t,this.proxyOf.nodes[r],o).reverse();r=this.index(e);for(let s of i)this.proxyOf.nodes.splice(r,0,s);for(let s in this.indexes)n=this.indexes[s],r<=n&&(this.indexes[s]=n+i.length);return this.markDirty(),this}normalize(t,n){if("string"==typeof t)t=ig(Yf(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new ng(t)]}else if(t.selector)t=[new Kf(t)];else if(t.name)t=[new Qf(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new rg(t)]}return t.map(t=>(t[tg]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[eg]&&sg(t),void 0===t.raws.before&&n&&void 0!==n.raws.before&&(t.raws.before=n.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(o){throw t.addToError(o)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};ag.registerParse=e=>{Yf=e},ag.registerRule=e=>{Kf=e},ag.registerAtRule=e=>{Qf=e},ag.registerRoot=e=>{Xf=e};var lg=ag;ag.default=ag,ag.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,Qf.prototype):"rule"===e.type?Object.setPrototypeOf(e,Kf.prototype):"decl"===e.type?Object.setPrototypeOf(e,ng.prototype):"comment"===e.type?Object.setPrototypeOf(e,rg.prototype):"root"===e.type&&Object.setPrototypeOf(e,Xf.prototype),e[tg]=!0,e.nodes&&e.nodes.forEach(e=>{ag.rebuild(e)})};var cg,dg,ug=lg,pg=class extends ug{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new cg(new dg,this,e).stringify()}};pg.registerLazyResult=e=>{cg=e},pg.registerProcessor=e=>{dg=e};var hg=pg;pg.default=pg;var mg=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let n in t)this[n]=t[n]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},fg=mg;mg.default=mg;var gg=fg,yg=class{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new gg(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},wg=yg;yg.default=yg;var bg="'".charCodeAt(0),vg='"'.charCodeAt(0),xg="\\".charCodeAt(0),kg="/".charCodeAt(0),_g="\n".charCodeAt(0),Sg=" ".charCodeAt(0),Cg="\f".charCodeAt(0),Ig="\t".charCodeAt(0),Eg="\r".charCodeAt(0),Tg="[".charCodeAt(0),Ag="]".charCodeAt(0),Mg="(".charCodeAt(0),Og=")".charCodeAt(0),Ng="{".charCodeAt(0),Rg="}".charCodeAt(0),zg=";".charCodeAt(0),Pg="*".charCodeAt(0),Lg=":".charCodeAt(0),Dg="@".charCodeAt(0),$g=/[\t\n\f\r "#'()/;[\\\]{}]/g,jg=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Fg=/.[\r\n"'(/\\]/,Ug=/[\da-f]/i,Bg=lg,Wg=class extends Bg{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Gg=Wg;Wg.default=Wg,Bg.registerAtRule(Wg);var Hg,Zg,Vg=lg,qg=class extends Vg{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of r)o.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new Hg(new Zg,this,e).stringify()}};qg.registerLazyResult=e=>{Hg=e},qg.registerProcessor=e=>{Zg=e};var Jg=qg;qg.default=qg,Vg.registerRoot(qg);var Yg={comma:e=>Yg.split(e,[","],!0),space:e=>Yg.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let d of e)c?c=!1:"\\"===d?c=!0:a?d===l&&(a=!1):'"'===d||"'"===d?(a=!0,l=d):"("===d?s+=1:")"===d?s>0&&(s-=1):0===s&&t.includes(d)&&(i=!0),i?(""!==o&&r.push(o.trim()),o="",i=!1):o+=d;return(n||""!==o)&&r.push(o.trim()),r}},Kg=Yg;Yg.default=Yg;var Qg=lg,Xg=Kg,ey=class extends Qg{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Xg.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}},ty=ey;ey.default=ey,Qg.registerRule(ey);var ny=uf,ry=function(e,t={}){let n,r,o,i,s,a,l,c,d,u,p=e.css.valueOf(),h=t.ignoreErrors,m=p.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(n=p.charCodeAt(f),n){case _g:case Sg:case Ig:case Eg:case Cg:r=f;do{r+=1,n=p.charCodeAt(r)}while(n===Sg||n===_g||n===Ig||n===Eg||n===Cg);u=["space",p.slice(f,r)],f=r-1;break;case Tg:case Ag:case Ng:case Rg:case Lg:case zg:case Og:{let e=String.fromCharCode(n);u=[e,e,f];break}case Mg:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==bg&&d!==vg&&d!==Sg&&d!==_g&&d!==Ig&&d!==Cg&&d!==Eg){r=f;do{if(a=!1,r=p.indexOf(")",r+1),-1===r){if(h||t){r=f;break}w("bracket")}for(l=r;p.charCodeAt(l-1)===xg;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,r+1),f,r],f=r}else r=p.indexOf(")",f+1),i=p.slice(f,r+1),-1===r||Fg.test(i)?u=["(","(",f]:(u=["brackets",i,f,r],f=r);break;case bg:case vg:o=n===bg?"'":'"',r=f;do{if(a=!1,r=p.indexOf(o,r+1),-1===r){if(h||t){r=f+1;break}w("string")}for(l=r;p.charCodeAt(l-1)===xg;)l-=1,a=!a}while(a);u=["string",p.slice(f,r+1),f,r],f=r;break;case Dg:$g.lastIndex=f+1,$g.test(p),r=0===$g.lastIndex?p.length-1:$g.lastIndex-2,u=["at-word",p.slice(f,r+1),f,r],f=r;break;case xg:for(r=f,s=!0;p.charCodeAt(r+1)===xg;)r+=1,s=!s;if(n=p.charCodeAt(r+1),s&&n!==kg&&n!==Sg&&n!==_g&&n!==Ig&&n!==Eg&&n!==Cg&&(r+=1,Ug.test(p.charAt(r)))){for(;Ug.test(p.charAt(r+1));)r+=1;p.charCodeAt(r+1)===Sg&&(r+=1)}u=["word",p.slice(f,r+1),f,r],f=r;break;default:n===kg&&p.charCodeAt(f+1)===Pg?(r=p.indexOf("*/",f+2)+1,0===r&&(h||t?r=p.length:w("comment")),u=["comment",p.slice(f,r+1),f,r],f=r):(jg.lastIndex=f+1,jg.test(p),r=0===jg.lastIndex?p.length-1:jg.lastIndex-2,u=["word",p.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},oy=Jf,iy=Gg,sy=Jg,ay=ty,ly={empty:!0,space:!0};var cy=lg,dy=class{constructor(e){this.input=e,this.root=new sy,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,n,r,o=new iy;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let i=!1,s=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(r=a.length-1,n=a[r];n&&"space"===n[0];)n=a[--r];n&&(o.source.end=this.getPosition(n[3]||n[2]),o.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(o.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(o,"params",a),i&&(e=a[a.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),s&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let o=t-1;o>=0&&(n=e[o],"space"===n[0]||(r+=1,2!==r));o--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,o=0;for(let[i,s]of e.entries()){if(t=s,n=t[0],"("===n&&(o+=1),")"===n&&(o-=1),0===o&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return i}this.doubleColon(t)}r=t}return!1}comment(e){let t=new oy;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=ry(this.input)}decl(e,t){let n=new ny;this.init(n,e[0][2]);let r,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),n.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;n.prop+=e.shift()[1]}for(n.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){n.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),n.raws.between+=r[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let i,s=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)s.push(e.shift());this.precheckMissedSemicolon(e);for(let a=e.length-1;a>=0;a--){if(r=e[a],"!important"===r[1].toLowerCase()){n.important=!0;let t=this.stringFrom(e,a);t=this.spacesFromEnd(e)+t," !important"!==t&&(n.raws.important=t);break}if("important"===r[1].toLowerCase()){let t=e.slice(0),r="";for(let e=a;e>0;e--){let n=t[e][0];if(0===r.trim().indexOf("!")&&"space"!==n)break;r=t.pop()[1]+r}0===r.trim().indexOf("!")&&(n.important=!0,n.raws.important=r,e=t)}if("space"!==r[0]&&"comment"!==r[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=s.map(e=>e[1]).join(""),s=[]),this.raw(n,"value",s.concat(e),t),n.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new ay;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,n=null,r=!1,o=null,i=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)o||(o=l),i.push("("===n?")":"]");else if(s&&r&&"{"===n)o||(o=l),i.push("}");else if(0===i.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===i[i.length-1]&&(i.pop(),0===i.length&&(o=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(o),t&&r){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,r){let o,i,s,a,l=n.length,c="",d=!0;for(let u=0;u<l;u+=1)o=n[u],i=o[0],"space"!==i||u!==l-1||r?"comment"===i?(a=n[u-1]?n[u-1][0]:"empty",s=n[u+1]?n[u+1][0]:"empty",ly[a]||ly[s]||","===c.slice(-1)?d=!1:c+=o[1]):c+=o[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new ay;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},uy=Pf;function py(e,t){let n=new dy(new uy(e,t));try{n.parse()}catch(r){throw r}return n.root}var hy=py;py.default=py,cy.registerParse(py);var{isClean:my,my:fy}=Vm,gy=Zf,yy=Xm,wy=lg,by=hg,vy=wg,xy=hy,ky=Jg,_y={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Sy={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Cy={Once:!0,postcssPlugin:!0,prepare:!0};function Iy(e){return"object"==typeof e&&"function"==typeof e.then}function Ey(e){let t=!1,n=_y[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function Ty(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Ey(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Ay(e){return e[my]=!1,e.nodes&&e.nodes.forEach(e=>Ay(e)),e}var My={},Oy=class e{constructor(t,n,r){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof e||n instanceof vy)o=Ay(n.root),n.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=xy;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{o=e(n,r)}catch(i){this.processed=!0,this.error=i}o&&!o[fy]&&wy.rebuild(o)}else o=Ay(n);this.result=new vy(t,o,r),this.helpers={...My,postcss:My,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let n=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin?n.postcssVersion:(e.plugin=n.postcssPlugin,e.setMessage())}catch(r){console&&console.error}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!Sy[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Cy[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let n=0;n<this.plugins.length;n++){let t=this.plugins[n],r=this.runOnRoot(t);if(Iy(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[my];){e[my]=!0;let n=[Ty(e)];for(;n.length>0;){let e=this.visitTick(n);if(Iy(e))try{await e}catch(t){let e=n[n.length-1].node;throw this.handleError(t,e)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if("document"===e.type){let t=e.nodes.map(e=>r(e,this.helpers));await Promise.all(t)}else await r(e,this.helpers)}catch(t){throw this.handleError(t)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return Iy(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=yy;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new gy(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins)if(Iy(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[my];)e[my]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,o]of e){let e;this.result.lastPlugin=r;try{e=o(t,this.helpers)}catch(n){throw this.handleError(n,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Iy(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,o]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return o(n.toProxy(),this.helpers)}catch(i){throw this.handleError(i,n)}}if(0!==t.iterator){let r,o=t.iterator;for(;r=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!r[my])return r[my]=!0,void e.push(Ty(r));t.iterator=0,delete n.indexes[o]}let o=t.events;for(;t.eventIndex<o.length;){let e=o[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[my]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[my]=!0;let t=Ey(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[my]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Oy.registerPostcss=e=>{My=e};var Ny=Oy;Oy.default=Oy,ky.registerLazyResult(Oy),by.registerLazyResult(Oy);var Ry=Zf,zy=Xm,Py=hy,Ly=wg,Dy=class{constructor(e,t,n){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let o=zy;this.result=new Ly(this._processor,r,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let s=new Ry(o,r,this._opts,t);if(s.isMap()){let[e,t]=s.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else s.clearAnnotation(),this.result.css=s.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Py;try{e=t(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},$y=Dy;Dy.default=Dy;var jy=$y,Fy=Ny,Uy=hg,By=Jg,Wy=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" is not a PostCSS plugin");return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new Fy(this,e,t):new jy(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Gy=Wy;Wy.default=Wy,By.registerProcessor(Wy),Uy.registerProcessor(Wy);var Hy=uf,Zy=vf,Vy=Jf,qy=Gg,Jy=Pf,Yy=Jg,Ky=ty;function Qy(e,t){if(Array.isArray(e))return e.map(e=>Qy(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:Jy.prototype};n.map&&(n.map={...n.map,__proto__:Zy.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>Qy(e,t))),r.source){let{inputId:e,...n}=r.source;r.source=n,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new Yy(r);if("decl"===r.type)return new Hy(r);if("rule"===r.type)return new Ky(r);if("comment"===r.type)return new Vy(r);if("atrule"===r.type)return new qy(r);throw new Error("Unknown node type: "+e.type)}var Xy=Qy;Qy.default=Qy;var ew=Zm,tw=uf,nw=Ny,rw=lg,ow=Gy,iw=Xm,sw=Xy,aw=hg,lw=fg,cw=Jf,dw=Gg,uw=wg,pw=Pf,hw=hy,mw=Kg,fw=ty,gw=Jg,yw=lf;function ww(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new ow(e)}ww.plugin=function(e,t){let n,r=!1;function o(...n){console&&console.warn&&!r&&(r=!0,{}.LANG&&{}.LANG.startsWith("cn"));let o=t(...n);return o.postcssPlugin=e,o.postcssVersion=(new ow).version,o}return Object.defineProperty(o,"postcss",{get:()=>(n||(n=o()),n)}),o.process=function(e,t,n){return ww([o(n)]).process(e,t)},o},ww.stringify=iw,ww.parse=hw,ww.fromJSON=sw,ww.list=mw,ww.comment=e=>new cw(e),ww.atRule=e=>new dw(e),ww.decl=e=>new tw(e),ww.rule=e=>new fw(e),ww.root=e=>new gw(e),ww.document=e=>new aw(e),ww.CssSyntaxError=ew,ww.Declaration=tw,ww.Container=rw,ww.Processor=ow,ww.Document=aw,ww.Comment=cw,ww.Warning=lw,ww.AtRule=dw,ww.Result=uw,ww.Input=pw,ww.Rule=fw,ww.Root=gw,ww.Node=yw,nw.registerPostcss(ww);var bw=ww;ww.default=ww;var vw=/* @__PURE__ */Lm(bw);vw.stringify,vw.fromJSON,vw.plugin,vw.parse,vw.list,vw.document,vw.comment,vw.atRule,vw.rule,vw.decl,vw.root,vw.CssSyntaxError,vw.Declaration,vw.Container,vw.Processor,vw.Document,vw.Comment,vw.Warning,vw.AtRule,vw.Result,vw.Input,vw.Rule,vw.Root,vw.Node;var xw=Object.defineProperty,kw=(e,t,n)=>((e,t,n)=>t in e?xw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function _w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Sw(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Cw={exports:{}},Iw=String,Ew=function(){return{isColorSupported:!1,reset:Iw,bold:Iw,dim:Iw,italic:Iw,underline:Iw,inverse:Iw,hidden:Iw,strikethrough:Iw,black:Iw,red:Iw,green:Iw,yellow:Iw,blue:Iw,magenta:Iw,cyan:Iw,white:Iw,gray:Iw,bgBlack:Iw,bgRed:Iw,bgGreen:Iw,bgYellow:Iw,bgBlue:Iw,bgMagenta:Iw,bgCyan:Iw,bgWhite:Iw}};Cw.exports=Ew(),Cw.exports.createColors=Ew;var Tw=Cw.exports,Aw=/* @__PURE__ */Sw(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),Mw=Tw,Ow=Aw,Nw=class e extends Error{constructor(t,n,r,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),void 0!==n&&void 0!==r&&("number"==typeof n?(this.line=n,this.column=r):(this.line=n.line,this.column=n.column,this.endLine=r.line,this.endColumn=r.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=Mw.isColorSupported),Ow&&e&&(t=Ow(t));let n,r,o=t.split(/\r?\n/),i=Math.max(this.line-3,0),s=Math.min(this.line+2,o.length),a=String(s).length;if(e){let{bold:e,gray:t,red:o}=Mw.createColors(!0);n=t=>e(o(t)),r=e=>t(e)}else n=r=e=>e;return o.slice(i,s).map((e,t)=>{let o=i+1+t,s=" "+(" "+o).slice(-a)+" | ";if(o===this.line){let t=r(s.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return n(">")+r(s)+e+"\n "+t+n("^")}return" "+r(s)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}},Rw=Nw;Nw.default=Nw;var zw={};zw.isClean=Symbol("isClean"),zw.my=Symbol("my");var Pw={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var Lw=class{constructor(e){this.builder=e}atrule(e,t){let n="@"+e.name,r=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?n+=e.raws.afterName:r&&(n+=" "),e.nodes)this.block(e,n+r);else{let o=(e.raws.between||"")+(t?";":"");this.builder(n+r+o,e)}}beforeAfter(e,t){let n;n="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let r=e.parent,o=0;for(;r&&"root"!==r.type;)o+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<o;e++)n+=t}return n}block(e,t){let n,r=this.raw(e,"between","beforeOpen");this.builder(t+r+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),n=this.raw(e,"after")):n=this.raw(e,"after","emptyBody"),n&&this.builder(n),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let n=this.raw(e,"semicolon");for(let r=0;r<e.nodes.length;r++){let o=e.nodes[r],i=this.raw(o,"before");i&&this.builder(i),this.stringify(o,t!==r||n)}}comment(e){let t=this.raw(e,"left","commentLeft"),n=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+n+"*/",e)}decl(e,t){let n=this.raw(e,"between","colon"),r=e.prop+n+this.rawValue(e,"value");e.important&&(r+=e.raws.important||" !important"),t&&(r+=";"),this.builder(r,e)}document(e){this.body(e)}raw(e,t,n){let r;if(n||(n=t),t&&(r=e.raws[t],void 0!==r))return r;let o=e.parent;if("before"===n){if(!o||"root"===o.type&&o.first===e)return"";if(o&&"document"===o.type)return""}if(!o)return Pw[n];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[n])return i.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let o="raw"+((s=n)[0].toUpperCase()+s.slice(1));this[o]?r=this[o](i,e):i.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var s;return void 0===r&&(r=Pw[n]),i.rawCache[n]=r,r}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let n;return e.walkComments(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(e,t){let n;return e.walkDecls(e=>{if(void 0!==e.raws.before)return n=e.raws.before,n.includes("\n")&&(n=n.replace(/[^\n]+$/,"")),!1}),void 0===n?n=this.raw(t,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(n=>{if(n.nodes&&(n.parent!==e||e.first!==n)&&void 0!==n.raws.before)return t=n.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(n=>{let r=n.parent;if(r&&r!==e&&r.parent&&r.parent===e&&void 0!==n.raws.before){let e=n.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let n=e[t],r=e.raws[t];return r&&r.value===n?r.raw:n}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},Dw=Lw;Lw.default=Lw;var $w=Dw;function jw(e,t){new $w(t).stringify(e)}var Fw=jw;jw.default=jw;var{isClean:Uw,my:Bw}=zw,Ww=Rw,Gw=Dw,Hw=Fw;function Zw(e,t){let n=new e.constructor;for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;if("proxyCache"===r)continue;let o=e[r],i=typeof o;"parent"===r&&"object"===i?t&&(n[r]=t):"source"===r?n[r]=o:Array.isArray(o)?n[r]=o.map(e=>Zw(e,n)):("object"===i&&null!==o&&(o=Zw(o)),n[r]=o)}return n}var Vw=class{constructor(e={}){this.raws={},this[Uw]=!1,this[Bw]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let n of e[t])"function"==typeof n.clone?this.append(n.clone()):this.append(n)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=Zw(this);for(let n in e)t[n]=e[n];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:n,start:r}=this.rangeBy(t);return this.source.input.error(e,{column:r.column,line:r.line},{column:n.column,line:n.line},t)}return new Ww(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[Uw]){this[Uw]=!1;let e=this;for(;e=e.parent;)e[Uw]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let n=this.source.start;if(e.index)n=this.positionInside(e.index,t);else if(e.word){let r=(t=this.toString()).indexOf(e.word);-1!==r&&(n=this.positionInside(r,t))}return n}positionInside(e,t){let n=t||this.toString(),r=this.source.start.column,o=this.source.start.line;for(let i=0;i<e;i++)"\n"===n[i]?(r=1,o+=1):r+=1;return{column:r,line:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let r=this.toString(),o=r.indexOf(e.word);-1!==o&&(t=this.positionInside(o,r),n=this.positionInside(o+e.word.length,r))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?n={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?n=this.positionInside(e.endIndex):e.index&&(n=this.positionInside(e.index+1));return(n.line<t.line||n.line===t.line&&n.column<=t.column)&&(n={column:t.column+1,line:t.line}),{end:n,start:t}}raw(e,t){return(new Gw).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,n=!1;for(let r of e)r===this?n=!0:n?(this.parent.insertAfter(t,r),t=r):this.parent.insertBefore(t,r);n||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let n={},r=null==t;t=t||/* @__PURE__ */new Map;let o=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i))continue;if("parent"===i||"proxyCache"===i)continue;let e=this[i];if(Array.isArray(e))n[i]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)n[i]=e.toJSON(null,t);else if("source"===i){let r=t.get(e.input);null==r&&(r=o,t.set(e.input,o),o++),n[i]={end:e.end,inputId:r,start:e.start}}else n[i]=e}return r&&(n.inputs=[...t.keys()].map(e=>e.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Hw){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let o in n)r[o]=n[o];return e.warn(t,r)}get proxyOf(){return this}},qw=Vw;Vw.default=Vw;var Jw=qw,Yw=class extends Jw{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}},Kw=Yw;Yw.default=Yw;var Qw={nanoid:(e=21)=>{let t="",n=e;for(;n--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(n=t)=>{let r="",o=n;for(;o--;)r+=e[Math.random()*e.length|0];return r}},{SourceMapConsumer:Xw,SourceMapGenerator:eb}=Aw,{existsSync:tb,readFileSync:nb}=Aw,{dirname:rb,join:ob}=Aw;var ib=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let n=t.map?t.map.prev:void 0,r=this.loadMap(t.from,n);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=rb(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new Xw(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let n=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+n)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let n=e.lastIndexOf(t.pop()),r=e.indexOf("*/",n);n>-1&&r>-1&&(this.annotation=this.getAnnotationURL(e.substring(n,r)))}loadFile(e){if(this.root=rb(e),tb(e))return this.mapFile=e,nb(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof Xw)return eb.fromSourceMap(t).toString();if(t instanceof eb)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let n=t(e);if(n){let e=this.loadFile(n);if(!e)throw new Error("Unable to load previous source map: "+n.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=ob(rb(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},sb=ib;ib.default=ib;var{SourceMapConsumer:ab,SourceMapGenerator:lb}=Aw,{fileURLToPath:cb,pathToFileURL:db}=Aw,{isAbsolute:ub,resolve:pb}=Aw,{nanoid:hb}=Qw,mb=Aw,fb=Rw,gb=sb,yb=Symbol("fromOffsetCache"),wb=Boolean(ab&&lb),bb=Boolean(pb&&ub),vb=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!bb||/^\w+:\/\//.test(t.from)||ub(t.from)?this.file=t.from:this.file=pb(t.from)),bb&&wb){let e=new gb(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+hb(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let o,i,s;if(t&&"object"==typeof t){let e=t,r=n;if("number"==typeof e.offset){let r=this.fromOffset(e.offset);t=r.line,n=r.col}else t=e.line,n=e.column;if("number"==typeof r.offset){let e=this.fromOffset(r.offset);i=e.line,s=e.col}else i=r.line,s=r.column}else if(!n){let e=this.fromOffset(t);t=e.line,n=e.col}let a=this.origin(t,n,i,s);return o=a?new fb(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,r.plugin):new fb(e,void 0===i?t:{column:n,line:t},void 0===i?n:{column:s,line:i},this.css,this.file,r.plugin),o.input={column:n,endColumn:s,endLine:i,line:t,source:this.css},this.file&&(db&&(o.input.url=db(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,n;if(this[yb])n=this[yb];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,o=e.length;r<o;r++)n[r]=t,t+=e[r].length+1;this[yb]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,o=n.length-2;for(;r<o;)if(t=r+(o-r>>1),e<n[t])o=t-1;else{if(!(e>=n[t+1])){r=t;break}r=t+1}}return{col:e-n[r]+1,line:r+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:pb(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let o,i,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof n&&(o=s.originalPositionFor({column:r,line:n})),i=ub(a.source)?db(a.source):new URL(a.source,this.map.consumer().sourceRoot||db(this.map.mapFile));let l={column:a.column,endColumn:o&&o.column,endLine:o&&o.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!cb)throw new Error("file: protocol is not available in this PostCSS build");l.file=cb(i)}let c=s.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},xb=vb;vb.default=vb,mb&&mb.registerInput&&mb.registerInput(vb);var{SourceMapConsumer:kb,SourceMapGenerator:_b}=Aw,{dirname:Sb,relative:Cb,resolve:Ib,sep:Eb}=Aw,{pathToFileURL:Tb}=Aw,Ab=xb,Mb=Boolean(kb&&_b),Ob=Boolean(Sb&&Ib&&Cb&&Eb),Nb=class{constructor(e,t,n,r){this.stringify=e,this.mapOpts=n.map||{},this.root=t,this.opts=n,this.css=r,this.originalCSS=r,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=/* @__PURE__ */new Map,this.memoizedPaths=/* @__PURE__ */new Map,this.memoizedURLs=/* @__PURE__ */new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,n=this.toUrl(this.path(e.file)),r=e.root||Sb(e.file);!1===this.mapOpts.sourcesContent?(t=new kb(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,n,this.toUrl(this.path(r)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Ob&&Mb&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=_b.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new _b({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new _b({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,o="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(s,a,l)=>{if(this.css+=s,a&&"end"!==l&&(i.generated.line=n,i.generated.column=r-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=s.match(/\n/g),e?(n+=e.length,t=s.lastIndexOf("\n"),r=s.length-t):r+=s.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"!==a.type&&("atrule"!==a.type||a.nodes)||a!==e.last||e.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=n,i.generated.column=r-2,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,i.generated.line=n,i.generated.column=r-1,this.map.addMapping(i)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let n=this.opts.to?Sb(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=Sb(Ib(n,this.mapOpts.annotation)));let r=Cb(n,e);return this.memoizedPaths.set(e,r),r}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Ab(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let n=t.source.input.from;if(n&&!e[n]){e[n]=!0;let r=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(r,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Tb){let t=Tb(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===Eb&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Rb=qw,zb=class extends Rb{constructor(e){super(e),this.type="comment"}},Pb=zb;zb.default=zb;var Lb,Db,$b,jb,{isClean:Fb,my:Ub}=zw,Bb=Kw,Wb=Pb,Gb=qw;function Hb(e){return e.map(e=>(e.nodes&&(e.nodes=Hb(e.nodes)),delete e.source,e))}function Zb(e){if(e[Fb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Zb(t)}var Vb=class e extends Gb{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,n,r=this.getIterator();for(;this.indexes[r]<this.proxyOf.nodes.length&&(t=this.indexes[r],n=e(this.proxyOf.nodes[t],t),!1!==n);)this.indexes[r]+=1;return delete this.indexes[r],n}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...n)=>e[t](...n.map(e=>"function"==typeof e?(t,n)=>e(t.toProxy(),n):e)):"every"===t||"some"===t?n=>e[t]((e,...t)=>n(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,n)=>(e[t]===n||(e[t]=n,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let n,r=this.index(e),o=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let i of o)this.proxyOf.nodes.splice(r+1,0,i);for(let i in this.indexes)n=this.indexes[i],r<n&&(this.indexes[i]=n+o.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),o=0===r&&"prepend",i=this.normalize(t,this.proxyOf.nodes[r],o).reverse();r=this.index(e);for(let s of i)this.proxyOf.nodes.splice(r,0,s);for(let s in this.indexes)n=this.indexes[s],r<=n&&(this.indexes[s]=n+i.length);return this.markDirty(),this}normalize(t,n){if("string"==typeof t)t=Hb(Lb(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new Bb(t)]}else if(t.selector)t=[new Db(t)];else if(t.name)t=[new $b(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new Wb(t)]}return t.map(t=>(t[Ub]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[Fb]&&Zb(t),void 0===t.raws.before&&n&&void 0!==n.raws.before&&(t.raws.before=n.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let n in this.indexes)t=this.indexes[n],t>=e&&(this.indexes[n]=t-1);return this.markDirty(),this}replaceValues(e,t,n){return n||(n=t,t={}),this.walkDecls(r=>{t.props&&!t.props.includes(r.prop)||t.fast&&!r.value.includes(t.fast)||(r.value=r.value.replace(e,n))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,n)=>{let r;try{r=e(t,n)}catch(o){throw t.addToError(o)}return!1!==r&&t.walk&&(r=t.walk(e)),r})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("atrule"===n.type&&e.test(n.name))return t(n,r)}):this.walk((n,r)=>{if("atrule"===n.type&&n.name===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("atrule"===e.type)return t(e,n)}))}walkComments(e){return this.walk((t,n)=>{if("comment"===t.type)return e(t,n)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("decl"===n.type&&e.test(n.prop))return t(n,r)}):this.walk((n,r)=>{if("decl"===n.type&&n.prop===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("decl"===e.type)return t(e,n)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((n,r)=>{if("rule"===n.type&&e.test(n.selector))return t(n,r)}):this.walk((n,r)=>{if("rule"===n.type&&n.selector===e)return t(n,r)}):(t=e,this.walk((e,n)=>{if("rule"===e.type)return t(e,n)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};Vb.registerParse=e=>{Lb=e},Vb.registerRule=e=>{Db=e},Vb.registerAtRule=e=>{$b=e},Vb.registerRoot=e=>{jb=e};var qb=Vb;Vb.default=Vb,Vb.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,$b.prototype):"rule"===e.type?Object.setPrototypeOf(e,Db.prototype):"decl"===e.type?Object.setPrototypeOf(e,Bb.prototype):"comment"===e.type?Object.setPrototypeOf(e,Wb.prototype):"root"===e.type&&Object.setPrototypeOf(e,jb.prototype),e[Ub]=!0,e.nodes&&e.nodes.forEach(e=>{Vb.rebuild(e)})};var Jb,Yb,Kb=qb,Qb=class extends Kb{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new Jb(new Yb,this,e).stringify()}};Qb.registerLazyResult=e=>{Jb=e},Qb.registerProcessor=e=>{Yb=e};var Xb=Qb;Qb.default=Qb;var ev=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let n in t)this[n]=t[n]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},tv=ev;ev.default=ev;var nv=tv,rv=class{constructor(e,t,n){this.processor=e,this.messages=[],this.root=t,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let n=new nv(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},ov=rv;rv.default=rv;var iv="'".charCodeAt(0),sv='"'.charCodeAt(0),av="\\".charCodeAt(0),lv="/".charCodeAt(0),cv="\n".charCodeAt(0),dv=" ".charCodeAt(0),uv="\f".charCodeAt(0),pv="\t".charCodeAt(0),hv="\r".charCodeAt(0),mv="[".charCodeAt(0),fv="]".charCodeAt(0),gv="(".charCodeAt(0),yv=")".charCodeAt(0),wv="{".charCodeAt(0),bv="}".charCodeAt(0),vv=";".charCodeAt(0),xv="*".charCodeAt(0),kv=":".charCodeAt(0),_v="@".charCodeAt(0),Sv=/[\t\n\f\r "#'()/;[\\\]{}]/g,Cv=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Iv=/.[\r\n"'(/\\]/,Ev=/[\da-f]/i,Tv=qb,Av=class extends Tv{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Mv=Av;Av.default=Av,Tv.registerAtRule(Av);var Ov,Nv,Rv=qb,zv=class extends Rv{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,n){let r=super.normalize(e);if(t)if("prepend"===n)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of r)o.raws.before=t.raws.before;return r}removeChild(e,t){let n=this.index(e);return!t&&0===n&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(e)}toResult(e={}){return new Ov(new Nv,this,e).stringify()}};zv.registerLazyResult=e=>{Ov=e},zv.registerProcessor=e=>{Nv=e};var Pv=zv;zv.default=zv,Rv.registerRoot(zv);var Lv={comma:e=>Lv.split(e,[","],!0),space:e=>Lv.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let d of e)c?c=!1:"\\"===d?c=!0:a?d===l&&(a=!1):'"'===d||"'"===d?(a=!0,l=d):"("===d?s+=1:")"===d?s>0&&(s-=1):0===s&&t.includes(d)&&(i=!0),i?(""!==o&&r.push(o.trim()),o="",i=!1):o+=d;return(n||""!==o)&&r.push(o.trim()),r}},Dv=Lv;Lv.default=Lv;var $v=qb,jv=Dv,Fv=class extends $v{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return jv.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,n=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(n)}},Uv=Fv;Fv.default=Fv,$v.registerRule(Fv);var Bv=Kw,Wv=function(e,t={}){let n,r,o,i,s,a,l,c,d,u,p=e.css.valueOf(),h=t.ignoreErrors,m=p.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(n=p.charCodeAt(f),n){case cv:case dv:case pv:case hv:case uv:r=f;do{r+=1,n=p.charCodeAt(r)}while(n===dv||n===cv||n===pv||n===hv||n===uv);u=["space",p.slice(f,r)],f=r-1;break;case mv:case fv:case wv:case bv:case kv:case vv:case yv:{let e=String.fromCharCode(n);u=[e,e,f];break}case gv:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==iv&&d!==sv&&d!==dv&&d!==cv&&d!==pv&&d!==uv&&d!==hv){r=f;do{if(a=!1,r=p.indexOf(")",r+1),-1===r){if(h||t){r=f;break}w("bracket")}for(l=r;p.charCodeAt(l-1)===av;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,r+1),f,r],f=r}else r=p.indexOf(")",f+1),i=p.slice(f,r+1),-1===r||Iv.test(i)?u=["(","(",f]:(u=["brackets",i,f,r],f=r);break;case iv:case sv:o=n===iv?"'":'"',r=f;do{if(a=!1,r=p.indexOf(o,r+1),-1===r){if(h||t){r=f+1;break}w("string")}for(l=r;p.charCodeAt(l-1)===av;)l-=1,a=!a}while(a);u=["string",p.slice(f,r+1),f,r],f=r;break;case _v:Sv.lastIndex=f+1,Sv.test(p),r=0===Sv.lastIndex?p.length-1:Sv.lastIndex-2,u=["at-word",p.slice(f,r+1),f,r],f=r;break;case av:for(r=f,s=!0;p.charCodeAt(r+1)===av;)r+=1,s=!s;if(n=p.charCodeAt(r+1),s&&n!==lv&&n!==dv&&n!==cv&&n!==pv&&n!==hv&&n!==uv&&(r+=1,Ev.test(p.charAt(r)))){for(;Ev.test(p.charAt(r+1));)r+=1;p.charCodeAt(r+1)===dv&&(r+=1)}u=["word",p.slice(f,r+1),f,r],f=r;break;default:n===lv&&p.charCodeAt(f+1)===xv?(r=p.indexOf("*/",f+2)+1,0===r&&(h||t?r=p.length:w("comment")),u=["comment",p.slice(f,r+1),f,r],f=r):(Cv.lastIndex=f+1,Cv.test(p),r=0===Cv.lastIndex?p.length-1:Cv.lastIndex-2,u=["word",p.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},Gv=Pb,Hv=Mv,Zv=Pv,Vv=Uv,qv={empty:!0,space:!0};var Jv=qb,Yv=class{constructor(e){this.input=e,this.root=new Zv,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,n,r,o=new Hv;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let i=!1,s=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(r=a.length-1,n=a[r];n&&"space"===n[0];)n=a[--r];n&&(o.source.end=this.getPosition(n[3]||n[2]),o.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(o.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(o,"params",a),i&&(e=a[a.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),s&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let o=t-1;o>=0&&(n=e[o],"space"===n[0]||(r+=1,2!==r));o--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,o=0;for(let[i,s]of e.entries()){if(t=s,n=t[0],"("===n&&(o+=1),")"===n&&(o-=1),0===o&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return i}this.doubleColon(t)}r=t}return!1}comment(e){let t=new Gv;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let n=e[1].slice(2,-2);if(/^\s*$/.test(n))t.text="",t.raws.left=n,t.raws.right="";else{let e=n.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=Wv(this.input)}decl(e,t){let n=new Bv;this.init(n,e[0][2]);let r,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let n=e[t],r=n[3]||n[2];if(r)return r}}(e)),n.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),n.raws.before+=e.shift()[1];for(n.source.start=this.getPosition(e[0][2]),n.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;n.prop+=e.shift()[1]}for(n.raws.between="";e.length;){if(r=e.shift(),":"===r[0]){n.raws.between+=r[1];break}"word"===r[0]&&/\w/.test(r[1])&&this.unknownWord([r]),n.raws.between+=r[1]}"_"!==n.prop[0]&&"*"!==n.prop[0]||(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let i,s=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)s.push(e.shift());this.precheckMissedSemicolon(e);for(let a=e.length-1;a>=0;a--){if(r=e[a],"!important"===r[1].toLowerCase()){n.important=!0;let t=this.stringFrom(e,a);t=this.spacesFromEnd(e)+t," !important"!==t&&(n.raws.important=t);break}if("important"===r[1].toLowerCase()){let t=e.slice(0),r="";for(let e=a;e>0;e--){let n=t[e][0];if(0===r.trim().indexOf("!")&&"space"!==n)break;r=t.pop()[1]+r}0===r.trim().indexOf("!")&&(n.important=!0,n.raws.important=r,e=t)}if("space"!==r[0]&&"comment"!==r[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(n.raws.between+=s.map(e=>e[1]).join(""),s=[]),this.raw(n,"value",s.concat(e),t),n.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new Vv;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,n=null,r=!1,o=null,i=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)o||(o=l),i.push("("===n?")":"]");else if(s&&r&&"{"===n)o||(o=l),i.push("}");else if(0===i.length){if(";"===n){if(r)return void this.decl(a,s);break}if("{"===n)return void this.rule(a);if("}"===n){this.tokenizer.back(a.pop()),t=!0;break}":"===n&&(r=!0)}else n===i[i.length-1]&&(i.pop(),0===i.length&&(o=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(o),t&&r){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,n,r){let o,i,s,a,l=n.length,c="",d=!0;for(let u=0;u<l;u+=1)o=n[u],i=o[0],"space"!==i||u!==l-1||r?"comment"===i?(a=n[u-1]?n[u-1][0]:"empty",s=n[u+1]?n[u+1][0]:"empty",qv[a]||qv[s]||","===c.slice(-1)?d=!1:c+=o[1]):c+=o[1]:d=!1;if(!d){let r=n.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:r,value:c}}e[t]=c}rule(e){e.pop();let t=new Vv;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)n=e.pop()[1]+n;return n}spacesAndCommentsFromStart(e){let t,n="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)n+=e.shift()[1];return n}spacesFromEnd(e){let t,n="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)n=e.pop()[1]+n;return n}stringFrom(e,t){let n="";for(let r=t;r<e.length;r++)n+=e[r][1];return e.splice(t,e.length-t),n}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},Kv=xb;function Qv(e,t){let n=new Yv(new Kv(e,t));try{n.parse()}catch(r){throw r}return n.root}var Xv=Qv;Qv.default=Qv,Jv.registerParse(Qv);var{isClean:ex,my:tx}=zw,nx=Nb,rx=Fw,ox=qb,ix=Xb,sx=ov,ax=Xv,lx=Pv,cx={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},dx={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},ux={Once:!0,postcssPlugin:!0,prepare:!0};function px(e){return"object"==typeof e&&"function"==typeof e.then}function hx(e){let t=!1,n=cx[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[n,n+"-"+t,0,n+"Exit",n+"Exit-"+t]:t?[n,n+"-"+t,n+"Exit",n+"Exit-"+t]:e.append?[n,0,n+"Exit"]:[n,n+"Exit"]}function mx(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:hx(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function fx(e){return e[ex]=!1,e.nodes&&e.nodes.forEach(e=>fx(e)),e}var gx={},yx=class e{constructor(t,n,r){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof e||n instanceof sx)o=fx(n.root),n.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=n.map);else{let e=ax;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{o=e(n,r)}catch(i){this.processed=!0,this.error=i}o&&!o[tx]&&ox.rebuild(o)}else o=fx(n);this.result=new sx(t,o,r),this.helpers={...gx,postcss:gx,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let n=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin?n.postcssVersion:(e.plugin=n.postcssPlugin,e.setMessage())}catch(r){console&&console.error}return e}prepareVisitors(){this.listeners={};let e=(e,t,n)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,n])};for(let t of this.plugins)if("object"==typeof t)for(let n in t){if(!dx[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!ux[n])if("object"==typeof t[n])for(let r in t[n])e(t,"*"===r?n:n+"-"+r.toLowerCase(),t[n][r]);else"function"==typeof t[n]&&e(t,n,t[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let n=0;n<this.plugins.length;n++){let t=this.plugins[n],r=this.runOnRoot(t);if(px(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ex];){e[ex]=!0;let n=[mx(e)];for(;n.length>0;){let e=this.visitTick(n);if(px(e))try{await e}catch(t){let e=n[n.length-1].node;throw this.handleError(t,e)}}}if(this.listeners.OnceExit)for(let[n,r]of this.listeners.OnceExit){this.result.lastPlugin=n;try{if("document"===e.type){let t=e.nodes.map(e=>r(e,this.helpers));await Promise.all(t)}else await r(e,this.helpers)}catch(t){throw this.handleError(t)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return px(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=rx;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new nx(t,this.result.root,this.result.opts).generate();return this.result.css=n[0],this.result.map=n[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins)if(px(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ex];)e[ex]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[r,o]of e){let e;this.result.lastPlugin=r;try{e=o(t,this.helpers)}catch(n){throw this.handleError(n,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(px(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:n,visitors:r}=t;if("root"!==n.type&&"document"!==n.type&&!n.parent)return void e.pop();if(r.length>0&&t.visitorIndex<r.length){let[e,o]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return o(n.toProxy(),this.helpers)}catch(i){throw this.handleError(i,n)}}if(0!==t.iterator){let r,o=t.iterator;for(;r=n.nodes[n.indexes[o]];)if(n.indexes[o]+=1,!r[ex])return r[ex]=!0,void e.push(mx(r));t.iterator=0,delete n.indexes[o]}let o=t.events;for(;t.eventIndex<o.length;){let e=o[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[ex]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[ex]=!0;let t=hx(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[ex]||this.walkSync(e)});else{let t=this.listeners[n];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};yx.registerPostcss=e=>{gx=e};var wx=yx;yx.default=yx,lx.registerLazyResult(yx),ix.registerLazyResult(yx);var bx=Nb,vx=Fw,xx=Xv,kx=ov,_x=class{constructor(e,t,n){let r;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=n,this._map=void 0;let o=vx;this.result=new kx(this._processor,r,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let s=new bx(o,r,this._opts,t);if(s.isMap()){let[e,t]=s.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else s.clearAnnotation(),this.result.css=s.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=xx;try{e=t(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},Sx=_x;_x.default=_x;var Cx=Sx,Ix=wx,Ex=Xb,Tx=Pv,Ax=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let n of e)if(!0===n.postcss?n=n():n.postcss&&(n=n.postcss),"object"==typeof n&&Array.isArray(n.plugins))t=t.concat(n.plugins);else if("object"==typeof n&&n.postcssPlugin)t.push(n);else if("function"==typeof n)t.push(n);else if("object"!=typeof n||!n.parse&&!n.stringify)throw new Error(n+" is not a PostCSS plugin");return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new Ix(this,e,t):new Cx(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Mx=Ax;Ax.default=Ax,Tx.registerProcessor(Ax),Ex.registerProcessor(Ax);var Ox=Kw,Nx=sb,Rx=Pb,zx=Mv,Px=xb,Lx=Pv,Dx=Uv;function $x(e,t){if(Array.isArray(e))return e.map(e=>$x(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:Px.prototype};n.map&&(n.map={...n.map,__proto__:Nx.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>$x(e,t))),r.source){let{inputId:e,...n}=r.source;r.source=n,null!=e&&(r.source.input=t[e])}if("root"===r.type)return new Lx(r);if("decl"===r.type)return new Ox(r);if("rule"===r.type)return new Dx(r);if("comment"===r.type)return new Rx(r);if("atrule"===r.type)return new zx(r);throw new Error("Unknown node type: "+e.type)}var jx=$x;$x.default=$x;var Fx=Rw,Ux=Kw,Bx=wx,Wx=qb,Gx=Mx,Hx=Fw,Zx=jx,Vx=Xb,qx=tv,Jx=Pb,Yx=Mv,Kx=ov,Qx=xb,Xx=Xv,ek=Dv,tk=Uv,nk=Pv,rk=qw;function ok(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Gx(e)}ok.plugin=function(e,t){let n,r=!1;function o(...n){console&&console.warn&&!r&&(r=!0,{}.LANG&&{}.LANG.startsWith("cn"));let o=t(...n);return o.postcssPlugin=e,o.postcssVersion=(new Gx).version,o}return Object.defineProperty(o,"postcss",{get:()=>(n||(n=o()),n)}),o.process=function(e,t,n){return ok([o(n)]).process(e,t)},o},ok.stringify=Hx,ok.parse=Xx,ok.fromJSON=Zx,ok.list=ek,ok.comment=e=>new Jx(e),ok.atRule=e=>new Yx(e),ok.decl=e=>new Ux(e),ok.rule=e=>new tk(e),ok.root=e=>new nk(e),ok.document=e=>new Vx(e),ok.CssSyntaxError=Fx,ok.Declaration=Ux,ok.Container=Wx,ok.Processor=Gx,ok.Document=Vx,ok.Comment=Jx,ok.Warning=qx,ok.AtRule=Yx,ok.Result=Kx,ok.Input=Qx,ok.Rule=tk,ok.Root=nk,ok.Node=rk,Bx.registerPostcss(ok);var ik=ok;ok.default=ok;var sk=/* @__PURE__ */_w(ik);sk.stringify,sk.fromJSON,sk.plugin,sk.parse,sk.list,sk.document,sk.comment,sk.atRule,sk.rule,sk.decl,sk.root,sk.CssSyntaxError,sk.Declaration,sk.Container,sk.Processor,sk.Document,sk.Comment,sk.Warning,sk.AtRule,sk.Result,sk.Input,sk.Rule,sk.Root,sk.Node;var ak=class e{constructor(...e){kw(this,"parentElement",null),kw(this,"parentNode",null),kw(this,"ownerDocument"),kw(this,"firstChild",null),kw(this,"lastChild",null),kw(this,"previousSibling",null),kw(this,"nextSibling",null),kw(this,"ELEMENT_NODE",1),kw(this,"TEXT_NODE",3),kw(this,"nodeType"),kw(this,"nodeName"),kw(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"}},lk={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},ck={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},dk={};function uk(e){if(dk[e])return dk[e];const t=globalThis[e],n=t.prototype,r=e in lk?lk[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 ck?ck[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 dk[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const o=r.contentWindow;if(!o)return t.prototype;const i=o[e].prototype;return document.body.removeChild(r),i?dk[e]=i:n}catch{return n}}var pk={};function hk(e,t,n){var r;const o=`${e}.${String(n)}`;if(pk[o])return pk[o].call(t);const i=uk(e),s=null==(r=Object.getOwnPropertyDescriptor(i,n))?void 0:r.get;return s?(pk[o]=s,s.call(t)):t[n]}var mk={};function fk(e,t,n){const r=`${e}.${String(n)}`;if(mk[r])return mk[r].bind(t);const o=uk(e)[n];return"function"!=typeof o?t[n]:(mk[r]=o,o.bind(t))}function gk(){return uk("MutationObserver").constructor}function yk(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()=>{}}}var wk={ownerDocument:function(e){return hk("Node",e,"ownerDocument")},childNodes:function(e){return hk("Node",e,"childNodes")},parentNode:function(e){return hk("Node",e,"parentNode")},parentElement:function(e){return hk("Node",e,"parentElement")},textContent:function(e){return hk("Node",e,"textContent")},contains:function(e,t){return fk("Node",e,"contains")(t)},getRootNode:function(e){return fk("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?hk("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?hk("Element",e,"shadowRoot"):null},querySelector:function(e,t){return hk("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return hk("Element",e,"querySelectorAll")(t)},mutationObserver:gk,patch:yk};function bk(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var vk={map:{},getId:()=>-1,getNode:()=>null,removeNodeFromMap(){},has:()=>!1,reset(){}};function xk(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),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),o=s,e.apply(l,i)):r||!1===n.trailing||(r=setTimeout(()=>{o=!1===n.leading?0:Date.now(),r=null,e.apply(l,i)},a))}}function kk(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)}}),()=>kk(e,t,i||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(vk=new Proxy(vk,{get:(e,t,n)=>Reflect.get(e,t,n)}));var _k=Date.now;function Sk(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=wk.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=wk.parentElement(i.body))?void 0:r.scrollTop)||(null==(o=null==i?void 0:i.body)?void 0:o.scrollTop)||0}}function Ck(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Ik(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Ek(e){return e?e.nodeType===e.ELEMENT_NODE?e:wk.parentElement(e):null}function Tk(e,t,n,r){if(!e)return!1;const o=Ek(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(Mm(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 Ak(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function Mk(e,t){if(em(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=wk.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||Mk(r,t))}function Ok(e){return Boolean(e.changedTouches)}function Nk(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Rk(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function zk(e){return!!e&&(e instanceof ak&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(wk.shadowRoot(e)))}/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())||(_k=()=>/* @__PURE__ */(new Date).getTime());var Pk=class{constructor(){Fh(this,"id",1),Fh(this,"styleIDMap",/* @__PURE__ */new WeakMap),Fh(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 Lk(e){var t;let n=null;return"getRootNode"in e&&(null==(t=wk.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&wk.host(wk.getRootNode(e))&&(n=wk.host(wk.getRootNode(e))),n}function Dk(e){const t=wk.ownerDocument(e);if(!t)return!1;const n=function(e){let t,n=e;for(;t=Lk(n);)n=t;return n}(e);return wk.contains(t,n)}function $k(e){const t=wk.ownerDocument(e);return!!t&&(wk.contains(t,e)||Dk(e))}var jk=/* @__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))(jk||{}),Fk=/* @__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))(Fk||{}),Uk=/* @__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))(Uk||{}),Bk=/* @__PURE__ */(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Bk||{}),Wk=/* @__PURE__ */(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Wk||{}),Gk=/* @__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))(Gk||{}),Hk=/* @__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))(Hk||{});function Zk(e){return"__ln"in e}var Vk,qk=class{constructor(){Fh(this,"length",0),Fh(this,"head",null),Fh(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&&Zk(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&&Zk(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--)}},Jk=(e,t)=>`${e}@${t}`,Yk=class{constructor(){Fh(this,"frozen",!1),Fh(this,"locked",!1),Fh(this,"texts",[]),Fh(this,"attributes",[]),Fh(this,"attributeMap",/* @__PURE__ */new WeakMap),Fh(this,"removes",[]),Fh(this,"mapRemoves",[]),Fh(this,"movedMap",{}),Fh(this,"addedSet",/* @__PURE__ */new Set),Fh(this,"movedSet",/* @__PURE__ */new Set),Fh(this,"droppedSet",/* @__PURE__ */new Set),Fh(this,"removesSubTreeCache",/* @__PURE__ */new Set),Fh(this,"mutationCb"),Fh(this,"blockClass"),Fh(this,"blockSelector"),Fh(this,"maskTextClass"),Fh(this,"maskTextSelector"),Fh(this,"inlineStylesheet"),Fh(this,"maskInputOptions"),Fh(this,"maskTextFn"),Fh(this,"maskInputFn"),Fh(this,"keepIframeSrcFn"),Fh(this,"recordCanvas"),Fh(this,"inlineImages"),Fh(this,"slimDOMOptions"),Fh(this,"dataURLOptions"),Fh(this,"doc"),Fh(this,"mirror"),Fh(this,"iframeManager"),Fh(this,"stylesheetManager"),Fh(this,"shadowDomManager"),Fh(this,"canvasManager"),Fh(this,"processedNodeManager"),Fh(this,"unattachedDoc"),Fh(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Fh(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=/* @__PURE__ */new Set,n=new qk,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=wk.parentNode(o);if(!i||!$k(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=em(i)?this.mirror.getId(Lk(o)):this.mirror.getId(i),l=r(o);if(-1===a||-1===l)return n.addNode(o);const c=Pm(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=>{Nk(e,this.mirror)&&this.iframeManager.addIframe(e),Rk(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),zk(o)&&this.shadowDomManager.addShadowRoot(wk.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});c&&(e.push({parentId:a,nextId:l,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)Qk(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(wk.parentNode(a))||o(a);for(const a of this.addedSet)Xk(this.droppedSet,a)||Qk(this.removesSubTreeCache,a,this.mirror)?Xk(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(wk.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(wk.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=wk.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=wk.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=wk.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))}),Fh(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(wk.childNodes(e),e=>wk.textContent(e)||"").join("");t.attributes.value=im({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:lm(e),value:n,maskInputFn:this.maskInputFn})}),Fh(this,"processMutation",e=>{if(!Ak(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=wk.textContent(e.target);Tk(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Om(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Ek(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=lm(n);o=im({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(Tk(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"),!Am(n.tagName,r))if(i.attributes[r]=Tm(this.doc,sm(n.tagName),sm(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(Tk(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=em(e.target)?this.mirror.getId(wk.host(e.target)):this.mirror.getId(e.target);Tk(e.target,this.blockClass,this.blockSelector,!1)||Ak(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(Kk(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||Mk(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[Jk(n,r)]?Kk(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!em(e.target)||!tm(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),wk.childNodes(e).forEach(e=>n.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),Fh(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Ak(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[Jk(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Tk(e,this.blockClass,this.blockSelector,!1)||(wk.childNodes(e).forEach(e=>this.genAdds(e)),zk(e)&&wk.childNodes(wk.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 Kk(e,t){e.delete(t),wk.childNodes(t).forEach(t=>Kk(e,t))}function Qk(e,t,n){return 0!==e.size&&function(e,t){const n=wk.parentNode(t);return!!n&&e.has(n)}(e,t)}function Xk(e,t){return 0!==e.size&&e_(e,t)}function e_(e,t){const n=wk.parentNode(t);return!!n&&(!!e.has(n)||e_(e,n))}var t_=e=>{if(!Vk)return e;return(...t)=>{try{return e(...t)}catch(n){if(Vk&&!0===Vk(n))return;throw n}}},n_=[];function r_(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 o_(e,t){const n=new Yk;n_.push(n),n.init(e);const r=new(gk())(t_(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function i_({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 l=null;return Object.keys(Uk).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(i=>{let s=sm(i);const c=(t=>i=>{const s=r_(i);if(Tk(s,r,o,!0))return;let a=null,c=t;if("pointerType"in i){switch(i.pointerType){case"mouse":a=Bk.Mouse;break;case"touch":a=Bk.Touch;break;case"pen":a=Bk.Pen}a===Bk.Touch?Uk[t]===Uk.MouseDown?c="TouchStart":Uk[t]===Uk.MouseUp&&(c="TouchEnd"):Bk.Pen}else Ok(i)&&(a=Bk.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===Bk.Touch||c.startsWith("Mouse")&&a===Bk.Mouse)&&(a=null)):Uk[t]===Uk.Click&&(a=l,l=null);const d=Ok(i)?i.changedTouches[0]:i;if(!d)return;const u=n.getId(s),{clientX:p,clientY:h}=d;t_(e)({type:Uk[c],id:u,x:p,y:h,...null!==a&&{pointerType:a}})})(i);if(window.PointerEvent)switch(Uk[i]){case Uk.MouseDown:case Uk.MouseUp:s=s.replace("mouse","pointer");break;case Uk.TouchStart:case Uk.TouchEnd:return}a.push(bk(s,c,t))}),t_(()=>{a.forEach(e=>e())})}function s_({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:o,sampling:i}){return bk("scroll",t_(xk(t_(i=>{const s=r_(i);if(!s||Tk(s,r,o,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=Sk(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 a_=["INPUT","TEXTAREA","SELECT"],l_=/* @__PURE__ */new WeakMap;function c_(e){return function(e,t){if(h_("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||h_("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||h_("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||h_("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function d_(e,t,n){let r,o;return e?(e.ownerNode?r=t.getId(e.ownerNode):o=n.getId(e),{styleId:o,id:r}):{}}function u_({mirror:e,stylesheetManager:t},n){var r,o,i;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(wk.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,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var n;const r=null==(n=l.set)?void 0:n.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(o){}return r}}),t_(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function p_(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:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:h,customElementCb:m}=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),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...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),m(...e)}}(e,t),e.recordDOM&&(r=o_(e,e.doc));const o=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 l=xk(t_(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),i),c=t_(xk(t_(e=>{const t=r_(e),{clientX:n,clientY:o}=Ok(e)?e.changedTouches[0]:e;s||(s=_k()),a.push({x:n,y:o,id:r.getId(t),timeOffset:_k()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?Fk.Drag:e instanceof MouseEvent?Fk.MouseMove:Fk.TouchMove)}),o,{trailing:!1})),d=[bk("mousemove",c,n),bk("touchmove",c,n),bk("drag",c,n)];return t_(()=>{d.forEach(e=>e())})}(e),i=i_(e),s=s_(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return bk("resize",t_(xk(t_(()=>{const t=Ck(),o=Ik();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:l,sampling:c,userTriggeredOnInput:d}){function u(e){let n=r_(e);const c=e.isTrusted,u=n&&n.tagName;if(n&&"OPTION"===u&&(n=wk.parentElement(n)),!n||!u||a_.indexOf(u)<0||Tk(n,r,o,!0))return;if(n.classList.contains(i)||s&&n.matches(s))return;let h=n.value,m=!1;const f=lm(n)||"";"radio"===f||"checkbox"===f?m=n.checked:(a[u.toLowerCase()]||a[f])&&(h=im({element:n,maskInputOptions:a,tagName:u,type:f,value:h,maskInputFn:l})),p(n,d?{text:h,isChecked:m,userTriggered:c}:{text:h,isChecked:m});const g=n.name;"radio"===f&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==n){const t=e.value;p(e,d?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}})}function p(t,r){const o=l_.get(t);if(!o||o.text!==r.text||o.isChecked!==r.isChecked){l_.set(t,r);const o=n.getId(t);t_(e)({...r,id:o})}}const h=("last"===c.input?["change"]:["input","change"]).map(e=>bk(e,t_(u),t)),m=t.defaultView;if(!m)return()=>{h.forEach(e=>e())};const f=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),g=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&h.push(...g.map(e=>kk(e[0],e[1],{set(){t_(u)({target:this,isTrusted:!1})}},!1,m))),t_(()=>{h.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:o,doc:i}){const s=t_(i=>xk(t_(o=>{const s=r_(o);if(!s||Tk(s,t,n,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:d,loop:u}=s;e({type:i,id:r.getId(s),currentTime:a,volume:l,muted:c,playbackRate:d,loop:u})}),o.media||500)),a=[bk("play",s(Gk.Play),i),bk("pause",s(Gk.Pause),i),bk("seeked",s(Gk.Seeked),i),bk("volumechange",s(Gk.VolumeChange),i),bk("ratechange",s(Gk.RateChange),i)];return t_(()=>{a.forEach(e=>e())})}(e);let d=()=>{},u=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(d=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:t_((r,o,i)=>{const[s,a]=i,{id:l,styleId:c}=d_(o,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,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:t_((r,o,i)=>{const[s]=i,{id:a,styleId:l}=d_(o,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,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:t_((r,o,i)=>{const[s]=i,{id:a,styleId:l}=d_(o,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),r.apply(o,i)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:t_((r,o,i)=>{const[s]=i,{id:a,styleId:l}=d_(o,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),r.apply(o,i)})}));const l={};m_("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(m_("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),m_("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),m_("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([r,o])=>{c[r]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(c[r].insertRule,{apply:t_((r,o,i)=>{const[s,a]=i,{id:l,styleId:c}=d_(o.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:s,index:[...c_(o),a||0]}]}),r.apply(o,i)})}),o.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:t_((r,o,i)=>{const[s]=i,{id:a,styleId:l}=d_(o.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...c_(o),s]}]}),r.apply(o,i)})})}),t_(()=>{r.CSSStyleSheet.prototype.insertRule=o,r.CSSStyleSheet.prototype.deleteRule=i,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule})})}(e,{win:n}),u=u_(e,e.doc),p=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:t_((o,s,a)=>{var l;const[c,d,u]=a;if(n.has(c))return i.apply(s,[c,d,u]);const{id:p,styleId:h}=d_(null==(l=s.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,set:{property:c,value:d,priority:u},index:c_(s.parentRule)}),o.apply(s,a)})});const s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:t_((o,i,a)=>{var l;const[c]=a;if(n.has(c))return s.apply(i,[c]);const{id:d,styleId:u}=d_(null==(l=i.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:c},index:c_(i.parentRule)}),o.apply(i,a)})}),t_(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(h=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=yk(t.fonts,"add",function(t){return function(n){return setTimeout(t_(()=>{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),t_(()=>{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=t_(()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const{startContainer:i,startOffset:s,endContainer:l,endOffset:c}=e.getRangeAt(t);Tk(i,r,o,!0)||Tk(l,r,o,!0)||a.push({start:n.getId(i),startOffset:s,end:n.getId(l),endOffset:c})}i({ranges:a})});return a(),bk("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?yk(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),g=[];for(const y of e.plugins)g.push(y.observer(y.callback,n,y.options));return t_(()=>{n_.forEach(e=>e.reset()),r?.disconnect(),o(),i(),s(),a(),l(),c(),d(),u(),p(),h(),m(),f(),g.forEach(e=>e())})}function h_(e){return void 0!==window[e]}function m_(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var f_=class{constructor(e){Fh(this,"iframeIdToRemoteIdMap",/* @__PURE__ */new WeakMap),Fh(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}},g_=class{constructor(e){Fh(this,"iframes",/* @__PURE__ */new WeakMap),Fh(this,"crossOriginIframeMap",/* @__PURE__ */new WeakMap),Fh(this,"crossOriginIframeMirror",new f_(xm)),Fh(this,"crossOriginIframeStyleMirror"),Fh(this,"crossOriginIframeRootIdMap",/* @__PURE__ */new WeakMap),Fh(this,"mirror"),Fh(this,"mutationCb"),Fh(this,"wrappedEmit"),Fh(this,"loadListener"),Fh(this,"stylesheetManager"),Fh(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new f_(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 jk.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:jk.IncrementalSnapshot,data:{source:Fk.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case jk.Meta:case jk.Load:case jk.DomContentLoaded:return!1;case jk.Plugin:return t;case jk.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case jk.IncrementalSnapshot:switch(t.data.source){case Fk.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 Fk.Drag:case Fk.TouchMove:case Fk.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case Fk.ViewportResize:return!1;case Fk.MediaInteraction:case Fk.MouseInteraction:case Fk.Scroll:case Fk.CanvasMutation:case Fk.Input:return this.replaceIds(t.data,e,["id"]),t;case Fk.StyleSheetRule:case Fk.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case Fk.Font:return t;case Fk.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case Fk.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===Hk.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},y_=class{constructor(e){Fh(this,"shadowDoms",/* @__PURE__ */new WeakSet),Fh(this,"mutationCb"),Fh(this,"scrollCb"),Fh(this,"bypassOptions"),Fh(this,"mirror"),Fh(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(!tm(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=o_({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(s_({...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(wk.host(e))),this.restoreHandlers.push(u_({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(yk(e.prototype,"attachShadow",function(e){return function(r){const o=e.call(this,r),i=wk.shadowRoot(this);return i&&$k(this)&&n.addShadowRoot(i,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=/* @__PURE__ */new WeakSet}},w_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b_="undefined"==typeof Uint8Array?[]:new Uint8Array(256),v_=0;v_<64;v_++)b_[w_.charCodeAt(v_)]=v_;var x_=function(e){var t,n=new Uint8Array(e),r=n.length,o="";for(t=0;t<r;t+=3)o+=w_[n[t]>>2],o+=w_[(3&n[t])<<4|n[t+1]>>4],o+=w_[(15&n[t+1])<<2|n[t+2]>>6],o+=w_[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},k_=/* @__PURE__ */new Map;var __=(e,t,n)=>{if(!e||!I_(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=k_.get(e);return n||(n=/* @__PURE__ */new Map,k_.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 S_(e,t,n){if(e instanceof Array)return e.map(e=>S_(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:x_(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[S_(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:[S_(e.data,t,n),e.width,e.height]}:I_(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:__(e,t,n)}:e}var C_=(e,t,n)=>e.map(e=>S_(e,t,n)),I_=(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 E_(e,t,n,r){const o=[];try{const i=yk(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(o,...i){if(!Tk(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 T_(e,t,n,r,o,i){const s=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=yk(e,l,function(e){return function(...s){const a=e.apply(this,s);if(__(a,i,this),"tagName"in this.canvas&&!Tk(this.canvas,r,o,!0)){const e={type:t,property:l,args:C_(s,i,this)};n(this.canvas,e)}return a}});s.push(a)}catch{const r=kk(e,l,{set(e){n(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(r)}return s}var A_="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",M_="undefined"!=typeof window&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(A_)],{type:"text/javascript;charset=utf-8"});function O_(e){let t;try{if(t=M_&&(window.URL||window.webkitURL).createObjectURL(M_),!t)throw"";const n=new Worker(t,{name:null==e?void 0:e.name});return n.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),n}catch(n){return new Worker("data:text/javascript;base64,"+A_,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var N_,R_,z_,P_=class{constructor(e){Fh(this,"pendingCanvasMutations",/* @__PURE__ */new Map),Fh(this,"rafStamps",{latestId:0,invokeId:null}),Fh(this,"mirror"),Fh(this,"mutationCb"),Fh(this,"resetObservers"),Fh(this,"frozen",!1),Fh(this,"locked",!1),Fh(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=E_(t,n,r,!0),s=/* @__PURE__ */new Map,a=new O_;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:Wk["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 l=1e3/e;let c,d=0;const u=e=>{d&&e-d<l||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{Tk(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])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{i(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=E_(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=yk(t.CanvasRenderingContext2D.prototype,s,function(o){return function(...i){return Tk(this.canvas,n,r,!0)||setTimeout(()=>{const n=C_(i,t,this);e(this.canvas,{type:Wk["2D"],property:s,args:n})},0),o.apply(this,i)}});o.push(i)}catch{const n=kk(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:Wk["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 o.push(...T_(t.WebGLRenderingContext.prototype,Wk.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&o.push(...T_(t.WebGL2RenderingContext.prototype,Wk.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)}},L_=class{constructor(e){Fh(this,"trackedLinkElements",/* @__PURE__ */new WeakSet),Fh(this,"mutationCb"),Fh(this,"adoptedStyleSheetCb"),Fh(this,"styleMirror",new Pk),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:rm(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){}},D_=class{constructor(){Fh(this,"nodeMap",/* @__PURE__ */new WeakMap),Fh(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(){}},$_=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(Lh=e.contentWindow)?void 0:Lh.Array.from)||Array.from,document.body.removeChild(e)}}catch(DS){}var j_,F_,U_=new om;function B_(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:p,slimDOMOptions:h,maskInputFn:m,maskTextFn:f,hooks:g,packFn:y,sampling:w={},dataURLOptions:b={},mousemoveWait:v,recordDOM:x=!0,recordCanvas:k=!1,recordCrossOriginIframes:_=!1,recordAfter:S=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:C=!1,collectFonts:I=!1,inlineImages:E=!1,plugins:T,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:M=/* @__PURE__ */new Set([]),errorHandler:O}=e;Vk=O;const N=!_||window.parent===window;let R=!1;if(!N)try{window.parent.document&&(R=!1)}catch(Z){R=!0}if(N&&!t)throw new Error("emit function is required");if(!N&&!R)return()=>{};void 0!==v&&void 0===w.mousemove&&(w.mousemove=v),U_.reset();const z=!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=zm(h);let L;!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 D=0;const $=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!R&&(e=y(e)),e};N_=(e,o)=>{var i;const s=e;if(s.timestamp=_k(),!(null==(i=n_[0])?void 0:i.isFrozen())||s.type===jk.FullSnapshot||s.type===jk.IncrementalSnapshot&&s.data.source===Fk.Mutation||n_.forEach(e=>e.unfreeze()),N)t?.($(s),o);else if(R){const e={type:"rrweb",event:$(s),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,"*")}if(s.type===jk.FullSnapshot)L=s,D=0;else if(s.type===jk.IncrementalSnapshot){if(s.data.source===Fk.Mutation&&s.data.isAttachIframe)return;D++;const e=r&&D>=r,t=n&&s.timestamp-L.timestamp>n;(e||t)&&R_(!0)}};const j=e=>{N_({type:jk.IncrementalSnapshot,data:{source:Fk.Mutation,...e}})},F=e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.Scroll,...e}}),U=e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.CanvasMutation,...e}}),B=new L_({mutationCb:j,adoptedStyleSheetCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.AdoptedStyleSheet,...e}})}),W=new g_({mirror:U_,mutationCb:j,stylesheetManager:B,recordCrossOriginIframes:_,wrappedEmit:N_});for(const q of T||[])q.getMirror&&q.getMirror({nodeMirror:U_,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const G=new D_;z_=new P_({recordCanvas:k,mutationCb:U,win:window,blockClass:o,blockSelector:i,mirror:U_,sampling:w.canvas,dataURLOptions:b});const H=new y_({mutationCb:j,scrollCb:F,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:z,dataURLOptions:b,maskTextFn:f,maskInputFn:m,recordCanvas:k,inlineImages:E,sampling:w,slimDOMOptions:P,iframeManager:W,stylesheetManager:B,canvasManager:z_,keepIframeSrcFn:A,processedNodeManager:G},mirror:U_});R_=(e=!1)=>{if(!x)return;N_({type:jk.Meta,data:{href:window.location.href,width:Ik(),height:Ck()}},e),B.reset(),H.init(),n_.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new om,blockClass:r="rr-block",blockSelector:o=null,maskTextClass:i="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:d=!1,maskTextFn:u,maskInputFn:p,slimDOM:h=!1,dataURLOptions:m,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:b,stylesheetLoadTimeout:v,keepIframeSrcFn:x=()=>!1}=t||{};return Pm(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:zm(h),dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:b,stylesheetLoadTimeout:v,keepIframeSrcFn:x,newlyAddedElement:!1})}(document,{mirror:U_,blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:z,maskTextFn:f,maskInputFn:m,slimDOM:P,dataURLOptions:b,recordCanvas:k,inlineImages:E,onSerialize:e=>{Nk(e,U_)&&W.addIframe(e),Rk(e,U_)&&B.trackLinkElement(e),zk(e)&&H.addShadowRoot(wk.shadowRoot(e),document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{B.attachLinkElement(e,t)},keepIframeSrcFn:A});t&&(N_({type:jk.FullSnapshot,data:{node:t,initialOffset:Sk(window)}},e),n_.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&B.adoptStyleSheets(document.adoptedStyleSheets,U_.getId(document)))};try{const e=[],t=e=>{var t;return t_(p_)({mutationCb:j,mousemoveCb:(e,t)=>N_({type:jk.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.MouseInteraction,...e}}),scrollCb:F,viewportResizeCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.ViewportResize,...e}}),inputCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.Input,...e}}),mediaInteractionCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.MediaInteraction,...e}}),styleSheetRuleCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.StyleSheetRule,...e}}),styleDeclarationCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.StyleDeclaration,...e}}),canvasMutationCb:U,fontCb:e=>N_({type:jk.IncrementalSnapshot,data:{source:Fk.Font,...e}}),selectionCb:e=>{N_({type:jk.IncrementalSnapshot,data:{source:Fk.Selection,...e}})},customElementCb:e=>{N_({type:jk.IncrementalSnapshot,data:{source:Fk.CustomElement,...e}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:z,inlineStylesheet:d,sampling:w,recordDOM:x,recordCanvas:k,inlineImages:E,userTriggeredOnInput:C,collectFonts:I,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:A,blockSelector:i,slimDOMOptions:P,dataURLOptions:b,mirror:U_,iframeManager:W,stylesheetManager:B,shadowDomManager:H,processedNodeManager:G,canvasManager:z_,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=>N_({type:jk.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};W.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(r){}});const n=()=>{R_(),e.push(t(document)),$_=!0};return["interactive","complete"].includes(document.readyState)?n():(e.push(bk("DOMContentLoaded",()=>{N_({type:jk.DomContentLoaded,data:{}}),"DOMContentLoaded"===S&&n()})),e.push(bk("load",()=>{N_({type:jk.Load,data:{}}),"load"===S&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(t){String(t).toLowerCase().includes("cross-origin")}}),G.destroy(),$_=!1,Vk=void 0}}catch(V){}}B_.addCustomEvent=(e,t)=>{if(!$_)throw new Error("please add custom event after start recording");N_({type:jk.Custom,data:{tag:e,payload:t}})},B_.freezePage=()=>{n_.forEach(e=>e.freeze())},B_.takeFullSnapshot=e=>{if(!$_)throw new Error("please take full snapshot after start recording");R_(e)},B_.mirror=U_,(F_=j_||(j_={}))[F_.NotStarted=0]="NotStarted",F_[F_.Running=1]="Running",F_[F_.Stopped=2]="Stopped";var W_=pc("SessionRecorder"),G_=500,H_=5e5,Z_=class{eventQueue=[];estimatedQueueBytes=0;sessionId;stopRecording=null;isRecording=!1;chatId;applicationId;metadataSent=!1;startPromise=null;stopRequested=!1;flushTimer=null;consecutiveFailures=0;constructor(e,t){if(!e||""===e.trim())throw new Error("chatId is required for SessionRecorder");if(!t||t<=0)throw new Error("applicationId (mtxApp) is required for SessionRecorder");W_.info("Constructor called with chatId:",e,"applicationId:",t),this.chatId=e,this.applicationId=t,this.sessionId=e,W_.info("Initialized with sessionId:",this.sessionId)}async sendMetadata(){this.metadataSent?W_.warn("Metadata already sent, skipping"):(W_.info("Sending rrweb/metadata via POST"),await tc.widgetMessage({chat_id:this.chatId,command:{type:"rrweb/metadata",session_id:this.sessionId,chat_id:this.chatId,application_id:this.applicationId,url:window.location.href,user_agent:navigator.userAgent,timestamp:Date.now()}}),this.metadataSent=!0,W_.info("✅ rrweb/metadata sent successfully"))}bufferEvent(e){if(this.eventQueue.push(e),this.estimatedQueueBytes+=JSON.stringify(e).length,this.eventQueue.length>G_){const e=this.eventQueue.length-G_,t=this.eventQueue.splice(0,e);for(const n of t)this.estimatedQueueBytes-=JSON.stringify(n).length;W_.warn(`⚠️ Event queue exceeded 500, dropped ${e} oldest events`)}this.estimatedQueueBytes>=5e4?this.flush():this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},500))}flush(){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),0===this.eventQueue.length)return;let e,t;if(this.estimatedQueueBytes<=H_)e=this.eventQueue,t=this.estimatedQueueBytes,this.eventQueue=[],this.estimatedQueueBytes=0;else{for(e=[],t=0;this.eventQueue.length>0;){const n=this.eventQueue[0];if(void 0===n)break;const r=JSON.stringify(n).length;if(t+r>H_&&e.length>0)break;const o=this.eventQueue.shift();void 0!==o&&e.push(o),t+=r,this.estimatedQueueBytes-=r}this.eventQueue.length>0&&!this.flushTimer&&(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},0))}W_.debug(`Flushing ${e.length} events (~${t} bytes)`),tc.widgetMessage({chat_id:this.chatId,command:{type:"rrweb/events",session_id:this.sessionId,events:e}}).then(()=>{this.consecutiveFailures=0}).catch(n=>{const r=null!=n&&"object"==typeof n&&"status"in n?n.status:null;if("number"==typeof r&&r>=400&&r<500)return W_.error(`Dropping ${e.length} events after permanent ${String(r)} error:`,n),void(this.consecutiveFailures=0);if(this.consecutiveFailures++,this.consecutiveFailures>5)return W_.error(`Dropping ${e.length} events after 5 consecutive failures:`,n),void(this.consecutiveFailures=0);if(W_.error(`Failed to flush events (attempt ${this.consecutiveFailures}/5), re-queuing:`,n),this.eventQueue=e.concat(this.eventQueue),this.estimatedQueueBytes+=t,this.eventQueue.length>G_){const e=this.eventQueue.length-G_,t=this.eventQueue.splice(0,e);for(const n of t)this.estimatedQueueBytes-=JSON.stringify(n).length;W_.warn(`⚠️ Event queue exceeded 500 after re-queue, dropped ${e} oldest events`)}})}async start(){if(this.isRecording)W_.warn("Recording already started");else{if(this.startPromise)return this.startPromise;this.startPromise=this.doStart();try{await this.startPromise}finally{this.startPromise=null}}}async doStart(){this.stopRequested=!1;try{if(W_.info("🚀 start() called"),await this.sendMetadata(),this.stopRequested)throw new Error("Recording stopped during startup");this.stopRecording=B_({emit:e=>{this.bufferEvent(e)},recordCanvas:!1,recordCrossOriginIframes:!1,maskAllInputs:!1,collectFonts:!1,inlineStylesheet:!0,blockClass:"rr-block",ignoreClass:"rr-ignore"}),this.isRecording=!0,W_.info("Recording started with chatId:",this.sessionId)}catch(e){throw W_.error("Failed to start recording:",e),e}}stop(){this.stopRequested=!0,this.stopRecording&&(this.stopRecording(),this.stopRecording=null),(this.isRecording||this.eventQueue.length>0)&&this.flush(),this.isRecording=!1,this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.metadataSent=!1,W_.info("Recording stopped")}getSessionId(){return this.sessionId}isActive(){return this.isRecording}},V_=class{config;async validateConfig(e){return this.config=e,e.mtxId&&e.mtxKey?this.validateByMarketrixId(e.mtxId,e.mtxKey):e.mtxApp&&e.mtxAgent?this.validateByAgentAndApplication(e.mtxApp,e.mtxAgent):{isValid:!1,error:"Please provide either (mtxId + mtxKey) OR (mtxApp + mtxAgent)"}}async validateByMarketrixId(e,t){try{const{items:r}=await tc.widgetSearch({marketrix_id:e,marketrix_key:t});if(!r||0===r.length)return{isValid:!1,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);return e.length>0?{isValid:!1,error:`Found widget(s) but none are active. Current status(es): ${e.map(e=>e.status).join(", ")}. Please activate the widget in the dashboard.`}:0===r.length?{isValid:!1,error:"No widgets found for the provided marketrix_id and marketrix_key. Please verify your credentials."}:{isValid:!1,error:`No widget found. Found widget type(s): ${r.map(e=>e.type).join(", ")}. Please create a widget.`}}if(!o.agent_id)return{isValid:!1,error:"Widget missing agent_id",widget:o};try{const e=await tc.agentGet({agent_id:o.agent_id});if(!o.application_id)return{isValid:!1,error:"Widget missing application_id",widget:o,agent:e};return{isValid:!0,widget:o,agent:e,application:await tc.applicationGet({application_id:o.application_id})}}catch(n){return{isValid:!1,error:`Failed to validate agent: ${rc(n)}`,widget:o}}}catch(r){return oc(r,"Widget validation",this.config)}}async validateByAgentAndApplication(e,t){try{const n=await tc.applicationGet({application_id:e}),r=await tc.agentGet({agent_id:t});return r.application_id!==e?{isValid:!1,error:`Agent ID ${t} belongs to application ID ${r.application_id}, but provided application ID is ${e}. Please verify the application ID matches the agent's application_id.`,application:n,agent:r}:{isValid:!0,application:n,agent:r}}catch(n){return oc(n,"Agent and application validation",this.config)}}};Uc();var q_=null,J_=class{mtxId;mtxKey;mtxApp;constructor(e,t,n){this.mtxId=e,this.mtxKey=t,this.mtxApp=n}async fetchWidgetSettings(){if(!this.mtxId&&!this.mtxKey&&!this.mtxApp)return null;try{q_||(q_=await tc.widgetGetDefaults({type:"widget"}));const e=q_;if(!e){throw new Error("Failed to fetch default widget settings from API. The API must return widget settings.")}let t=null;if(this.mtxId&&this.mtxKey)t=(await tc.widgetSearch({type:"widget",marketrix_id:this.mtxId,marketrix_key:this.mtxKey})).items;else{if(!this.mtxApp)return null;t=(await tc.widgetSearch({type:"widget",application_id:this.mtxApp})).items}const n=t?.find(e=>"active"===e.status&&"widget"===e.type)||null;if(n?.settings){const t=this.getWidgetSettings(n);if(t){const r={...e,...t};return{...n,settings:r}}}const r=/* @__PURE__ */new Date;return{id:0,application_id:this.mtxApp||0,agent_id:0,type:"widget",settings:e,status:"active",marketrix_id:this.mtxId||"",marketrix_key:this.mtxKey||"",created_at:r,updated_at:r}}catch(e){const t=e instanceof Error?e.message:"Unknown error",n=/* @__PURE__ */new Error(`Failed to fetch widget settings from API: ${t}`);throw n.cause=e,n}}getWidgetSettings(e){if(!e?.settings)return null;const t=e.settings;return function(e){return"object"==typeof e&&null!==e}(n=t)&&$c(n,"widget_enabled")&&"boolean"==typeof n.widget_enabled&&$c(n,"widget_appearance")&&"string"==typeof n.widget_appearance&&$c(n,"widget_position")&&"string"==typeof n.widget_position?t:null;var n}},Y_="#6b7280",K_="#1f2937",Q_="rgba(255, 255, 255, 0.95)",X_="rgba(255, 255, 255, 0.2)",eS="rgba(0, 0, 0, 0.15)",tS=({message:e="Loading widget settings..."})=>{const[t,n]=h(!1),r=e?.includes("marketrix_id")||e?.includes("marketrix_key");return t?null:/* @__PURE__ */y("div",{className:"marketrix-widget-loader",style:{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",maxWidth:"420px",backgroundColor:Q_,borderRadius:r?"18px":"999px",boxShadow:`0 2px 12px ${eS}`,display:"flex",flexDirection:"column",alignItems:"stretch",gap:"8px",padding:"10px 12px",border:`1px solid ${X_}`,zIndex:9999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[/* @__PURE__ */y("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[
|
|
105
|
+
/* @__PURE__ */y("div",{children:["Valid: ",e.validation.isValid?"Yes":"No",e.validation.mismatchReason&&` (${e.validation.mismatchReason})`]}),e.recoveryAction&&/* @__PURE__ */y("div",{style:{color:"#ff9800"},children:["Recovery: ",e.recoveryAction]})]},t))})]})]})]}):/* @__PURE__ */g("button",{onClick:()=>t(!0),style:{position:"fixed",bottom:"20px",left:"20px",zIndex:99999,padding:"8px 16px",background:"#2196f3",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontFamily:"monospace",fontSize:"12px"},children:"DOM Test Panel"})},Ah={padding:"6px 12px",background:"#2196f3",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"11px"}});i(()=>Promise.resolve().then(()=>(Wh(),Bh)));var Gh,Hh=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}},Zh=({config:e})=>{const[t,r]=h(!1),[n,o]=h(!1),i=!1,[s,a]=h(!1),{state:c,actions:d,config:p,shouldShow:m,isPreviewMode:f,configValid:w}=ud({config:e});var b;b=c.isOpen,l(()=>{if(!b)return;if(!window.matchMedia("(max-width: 767px)").matches)return;const e=document.documentElement,t=document.body,r=e.style.overflow,n=t.style.overflow;return e.style.overflow="hidden",t.style.overflow="hidden",()=>{e.style.overflow=r,t.style.overflow=n}},[b]);const[v,_]=h(e.widget_position??"bottom_right"),S=u(()=>`marketrix_widget_position_${e.mtxId??(null!=e.mtxApp?String(e.mtxApp):"default")}`,[e.mtxApp,e.mtxId]);l(()=>{},[i]),l(()=>{_(p.widget_position??"bottom_right")},[p.widget_position]),l(()=>{if(f||"undefined"==typeof localStorage)return;const e=p.widget_position??"bottom_right",t=localStorage.getItem(S);"bottom_left"!==t&&"bottom_right"!==t&&"top_left"!==t&&"top_right"!==t?(localStorage.setItem(S,e),_(e)):_(t)},[f,S,p.widget_position]),l(()=>{if(c.isOpen||f||"default"!==p.widget_appearance)return void a(!1);const e=setTimeout(()=>a(!0),2e3);return()=>clearTimeout(e)},[c.isOpen,f,p.widget_appearance]);if(!w)return null;if(!(f?e.widget_enabled??p.widget_enabled:m&&p.widget_enabled&&!1!==e.show_widget))return null;const C=(E=function(e={}){return O({...M,widget_background_color:e.widget_background_color??M.widget_background_color,widget_text_color:e.widget_text_color??M.widget_text_color,widget_border_color:e.widget_border_color??M.widget_border_color,widget_accent_color:e.widget_accent_color??M.widget_accent_color,widget_secondary_color:e.widget_secondary_color??M.widget_secondary_color,widget_border_radius:e.widget_border_radius??M.widget_border_radius,widget_font_size:e.widget_font_size??M.widget_font_size,widget_width:e.widget_width??M.widget_width,widget_height:e.widget_height??M.widget_height,widget_shadow:e.widget_shadow??M.widget_shadow,widget_animation_duration:e.widget_animation_duration??M.widget_animation_duration,widget_fade_duration:e.widget_fade_duration??M.widget_fade_duration})}(p),{"--background":E.color.background,"--foreground":E.color.foreground,"--card":E.color.background,"--card-foreground":E.color.foreground,"--popover":E.color.background,"--popover-foreground":E.color.foreground,"--primary":E.color.primary,"--foreground-muted":E.color.foregroundMuted,"--foreground-faint":E.color.foregroundFaint,"--border-muted":E.color.borderMuted,"--primary-foreground":E.color.primaryForeground,"--primary-hover":E.color.primaryHover,"--primary-muted":E.color.primaryMuted,"--secondary":E.color.secondary,"--secondary-foreground":E.color.secondaryForeground,"--secondary-bg":E.color.secondaryBg,"--secondary-hover":E.color.secondaryHover,"--muted":E.color.border,"--muted-foreground":E.color.secondary,"--accent":E.color.background,"--accent-foreground":E.color.foreground,"--border":E.color.border,"--input":E.color.border,"--ring":E.color.primary,"--radius":E.radius,"--shadow":E.shadow,"--duration-animation":E.motion.durationAnimation,"--duration-fade":E.motion.durationFade,"--widget-width":E.size.widgetWidth,"--widget-height":E.size.widgetHeight});var E;const T=Math.max(p.widget_position_z_index??0,x),A={...p,widget_position:v,widget_position_z_index:T,show_widget:e.show_widget,use_screenshare:e.use_screenshare},N=c.isLoading||c.isTaskRunning,R={...C,"--widget-z-index":T},z=(()=>{const e={position:"fixed",width:"500px",height:"500px",pointerEvents:"none",zIndex:x-1,background:`radial-gradient(circle at ${v.includes("right")?"100%":"0%"} ${v.includes("bottom")?"100%":"0%"}, ${I(p.widget_accent_color,.08)} 0%, transparent 70%)`};return v.includes("top")?e.top=0:e.bottom=0,v.includes("right")?e.right=0:e.left=0,e})();/* @__PURE__ */
|
|
106
|
+
return y("div",{className:"marketrix-widget relative",style:{...R,...f&&{width:"100%",height:"100%"}},"data-widget-mode":p?.widget_feature_human?"hybrid":"ai",children:[c.isOpen&&/* @__PURE__ */g("div",{className:"animate-fade-in",style:z,"aria-hidden":!0}),N&&/* @__PURE__ */g("div",{className:"marketrix-screen-edge-glow fixed inset-0",style:{boxShadow:`inset 0 0 22px 2px ${I(p.widget_accent_color,.72)}, inset 0 0 46px 10px ${I(p.widget_accent_color,.28)}`,pointerEvents:"none",zIndex:k}}),
|
|
107
|
+
/* @__PURE__ */g(Hh,{children:/* @__PURE__ */g($h,{config:A,isOpen:c.isOpen,isMinimized:c.isMinimized,messages:c.messages,currentMode:c.currentMode,isTaskRunning:c.isTaskRunning,taskProgress:c.taskProgress,activeView:c.activeView,onClose:d.closeWidget,onSendMessage:d.sendMessage,onSetMode:d.setMode,onAddMessage:d.addMessage,onUpdateMessage:d.updateMessage,onRemoveMessage:d.removeMessage,onStopTask:d.stopTask,onClearChat:d.clearChatHistory,onScreenSharingChange:r,setActiveView:d.setActiveView})}),
|
|
108
|
+
/* @__PURE__ */g(wp,{config:A,onClick:d.toggleWidget,onStopTask:d.stopTask,isOpen:c.isOpen,isMinimized:c.isMinimized,isLoading:c.isLoading,isTaskRunning:c.isTaskRunning,hasError:!!c.error,position:v,onPositionChange:e=>{_(e),f||"undefined"==typeof localStorage||localStorage.setItem(S,e)}}),c.error&&/* @__PURE__ */g(jh,{error:c.error,onClose:()=>d.clearError(),onRetry:()=>d.clearError(),position:v}),s&&!c.error&&p.widget_greeting&&/* @__PURE__ */g(Fh,{greeting:p.widget_greeting,body:p.widget_body,onClose:()=>a(!1)}),i]})},Vh=Object.defineProperty,qh=(e,t,r)=>((e,t,r)=>t in e?Vh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Jh=Object.defineProperty,Yh=(e,t,r)=>((e,t,r)=>t in e?Jh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r),Kh=/* @__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))(Kh||{}),Qh={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Xh={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},em={};function tm(e){if(em[e])return em[e];const t=globalThis[e],r=t.prototype,n=e in Qh?Qh[e]:void 0,o=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),i=e in Xh?Xh[e]:void 0,s=Boolean(i&&i.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(o&&s&&!globalThis.Zone)return em[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const o=n.contentWindow;if(!o)return t.prototype;const i=o[e].prototype;return document.body.removeChild(n),i?em[e]=i:r}catch{return r}}var rm={};function nm(e,t,r){var n;const o=`${e}.${String(r)}`;if(rm[o])return rm[o].call(t);const i=tm(e),s=null==(n=Object.getOwnPropertyDescriptor(i,r))?void 0:n.get;return s?(rm[o]=s,s.call(t)):t[r]}var om={};function im(e,t,r){const n=`${e}.${String(r)}`;if(om[n])return om[n].bind(t);const o=tm(e)[r];return"function"!=typeof o?t[r]:(om[n]=o,o.bind(t))}var sm={ownerDocument:function(e){return nm("Node",e,"ownerDocument")},childNodes:function(e){return nm("Node",e,"childNodes")},parentNode:function(e){return nm("Node",e,"parentNode")},parentElement:function(e){return nm("Node",e,"parentElement")},textContent:function(e){return nm("Node",e,"textContent")},contains:function(e,t){return im("Node",e,"contains")(t)},getRootNode:function(e){return im("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?nm("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?nm("Element",e,"shadowRoot"):null},querySelector:function(e,t){return nm("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return nm("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return tm("MutationObserver").constructor},patch:function(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],o=r(n);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}};function am(e){return e.nodeType===e.ELEMENT_NODE}function lm(e){const t=e&&"host"in e&&"mode"in e&&sm.host(e)||null;return Boolean(t&&"shadowRoot"in t&&sm.shadowRoot(t)===e)}function cm(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function dm(e){try{const r=e.rules||e.cssRules;if(!r)return null;let n=e.href;return!n&&e.ownerNode&&(n=e.ownerNode.baseURI),(t=Array.from(r,e=>um(e,n)).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(r){return null}var t}function um(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=dm(e.styleSheet)||function(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const r=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}(e)}catch(r){t=e.cssText}return e.styleSheet.href?km(t,e.styleSheet.href):t}{let r=e.cssText;return function(e){return"selectorText"in e}(e)&&e.selectorText.includes(":")&&(r=r.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")),t?km(r,t):r}}var pm=class{constructor(){Yh(this,"idNodeMap",/* @__PURE__ */new Map),Yh(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 r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){const r=this.getNode(e);if(r){const e=this.nodeMetaMap.get(r);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=/* @__PURE__ */new Map,this.nodeMetaMap=/* @__PURE__ */new WeakMap}};function hm({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:i}){let s=o||"";const a=n&&mm(n);return(t[r.toLowerCase()]||a&&t[a])&&(s=i?i(s,e):"*".repeat(s.length)),s}function mm(e){return e.toLowerCase()}var fm="__rrweb_original__";function gm(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?mm(t):null}function ym(e,t){let r;try{r=new URL(e,t??window.location.href)}catch(o){return null}const n=r.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==n?void 0:n[1])??null}var wm=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,bm=/^(?:[a-z+]+:)?\/\//i,vm=/^www\..*/i,xm=/^(data:)([^,]*),(.*)/i;function km(e,t){return(e||"").replace(wm,(e,r,n,o,i,s)=>{const a=n||i||s,l=r||o||"";if(!a)return e;if(bm.test(a)||vm.test(a))return`url(${l}${a}${l})`;if(xm.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${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}${l})`;const c=t.split("/"),d=a.split("/");c.pop();for(const t of d){if("."===t)continue;".."===t?c.pop():c.push(t)}return`url(${l}${c.join("/")}${l})`})}function _m(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Sm(e,t){return function(e,t,r=!1){const n=Array.from(t.childNodes),o=[];let i=0;if(n.length>1&&e&&"string"==typeof e){let t=_m(e,r);const s=t.length/e.length;for(let a=1;a<n.length;a++)if(n[a].textContent&&"string"==typeof n[a].textContent){const l=_m(n[a].textContent,r),c=100;let d=3;for(;d<l.length&&(l[d].match(/[a-zA-Z0-9]/)||-1!==l.indexOf(l.substring(0,d),1));d++);for(;d<l.length;d++){let u=l.substring(0,d),p=t.split(u),h=-1;if(2===p.length)h=p[0].length;else if(p.length>2&&""===p[0]&&""!==n[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=c+1}else d===l.length-1&&(h=t.indexOf(u));if(p.length>=2&&d>c){const e=n[a-1].textContent;if(e&&"string"==typeof e){const r=_m(e).length;h=t.indexOf(u,r)}-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*n.length)return o.push(e),o;const l=_m(e.substring(0,a),r);if(l.length===h){o.push(e.substring(0,a)),e=e.substring(a),t=t.substring(h);break}l.length<h?a+=Math.max(1,Math.floor((h-l.length)/s)):a-=Math.max(1,Math.floor((l.length-h)*s))}break}}}}return o.push(e),o}(e,t).join("/* rr_split */")}var Cm,Im,Em=1,Tm=/* @__PURE__ */new RegExp("[^a-z0-9-_:]");function Am(){return Em++}var Mm=/^[^ \t\n\r\u000c]+/,Om=/^[, \t\n\r\u000c]+/;var Nm=/* @__PURE__ */new WeakMap;function Rm(e,t){return t&&""!==t.trim()?Pm(e,t):t}function zm(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Pm(e,t){let r=Nm.get(e);if(r||(r=e.createElement("a"),Nm.set(e,r)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return r.setAttribute("href",t),r.href}function Lm(e,t,r,n){return n?"src"===r||"href"===r&&("use"!==t||"#"!==n[0])||"xlink:href"===r&&"#"!==n[0]||"background"===r&&["table","td","th"].includes(t)?Rm(e,n):"srcset"===r?function(e,t){if(""===t.trim())return t;let r=0;function n(e){let n;const o=e.exec(t.substring(r));return o?(n=o[0],r+=n.length,n):""}const o=[];for(;n(Om),!(r>=t.length);){let i=n(Mm);if(","===i.slice(-1))i=Rm(e,i.substring(0,i.length-1)),o.push(i);else{let n="";i=Rm(e,i);let s=!1;for(;;){const e=t.charAt(r);if(""===e){o.push((i+n).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){r+=1,o.push((i+n).trim());break}"("===e&&(s=!0)}n+=e,r+=1}}}return o.join(", ")}(e,n):"style"===r?km(n,Pm(e)):"object"===t&&"data"===r?Rm(e,n):n:n}function Dm(e,t,r){return["video","audio"].includes(e)&&"autoplay"===t}function $m(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!r&&$m(sm.parentNode(e),t,r);for(let n=e.classList.length;n--;){const r=e.classList[n];if(t.test(r))return!0}return!!r&&$m(sm.parentNode(e),t,r)}function jm(e,t,r,n){let o;if(am(e)){if(o=e,!sm.childNodes(o).length)return!1}else{if(null===sm.parentElement(e))return!1;o=sm.parentElement(e)}try{if("string"==typeof t){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if($m(o,t,n))return!0;if(r)if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}catch(i){}return!1}function Fm(e,t){const{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:d,dataURLOptions:u={},inlineImages:p,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:f=!1,cssCaptured:g=!1}=t,y=function(e,t){if(!t.hasNode(e))return;const r=t.getId(e);return 1===r?void 0:r}(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Kh.Document,childNodes:[],compatMode:e.compatMode}:{type:Kh.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Kh.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function(e,t){const{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:i,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:d,keepIframeSrcFn:u,newlyAddedElement:p=!1,rootId:h}=t,m=function(e,t,r){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}if(r)return e.matches(r)}catch(n){}return!1}(e,n,o),f=function(e){if(e instanceof HTMLFormElement)return"form";const t=mm(e.tagName);return Tm.test(t)?"div":t}(e);let g={};const y=e.attributes.length;for(let v=0;v<y;v++){const t=e.attributes[v];Dm(f,t.name,t.value)||(g[t.name]=Lm(r,f,mm(t.name),t.value))}if("link"===f&&i){const t=Array.from(r.styleSheets).find(t=>t.href===e.href);let n=null;t&&(n=dm(t)),n&&(delete g.rel,delete g.href,g._cssText=n)}if("style"===f&&e.sheet){let t=dm(e.sheet);t&&(e.childNodes.length>1&&(t=Sm(t,e)),g._cssText=t)}if(["input","textarea","select"].includes(f)){const t=e.value,r=e.checked;"radio"!==g.type&&"checkbox"!==g.type&&"submit"!==g.type&&"button"!==g.type&&t?g.value=hm({element:e,type:gm(e),tagName:f,value:t,maskInputOptions:s,maskInputFn:a}):r&&(g.checked=r)}"option"===f&&(e.selected&&!s.select?g.selected=!0:delete g.selected);"dialog"===f&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal");if("canvas"===f&&d)if("2d"===e.__context)(function(e){const t=e.getContext("2d");if(!t)return!0;for(let r=0;r<e.width;r+=50)for(let n=0;n<e.height;n+=50){const o=t.getImageData,i=fm in o?o[fm]:o;if(new Uint32Array(i.call(t,r,n,Math.min(50,e.width-r),Math.min(50,e.height-n)).data.buffer).some(e=>0!==e))return!1}return!0})(e)||(g.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){const t=e.toDataURL(l.type,l.quality),n=r.createElement("canvas");n.width=e.width,n.height=e.height,t!==n.toDataURL(l.type,l.quality)&&(g.rr_dataURL=t)}if("img"===f&&c){Cm||(Cm=r.createElement("canvas"),Im=Cm.getContext("2d"));const t=e,n=(t.currentSrc||t.getAttribute("src"),t.crossOrigin),o=()=>{t.removeEventListener("load",o);try{Cm.width=t.naturalWidth,Cm.height=t.naturalHeight,Im.drawImage(t,0,0),g.rr_dataURL=Cm.toDataURL(l.type,l.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&&(n?g.crossOrigin=n:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?o():t.addEventListener("load",o)}if(["audio","video"].includes(f)){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(m){const{width:t,height:r}=e.getBoundingClientRect();g={class:g.class,rr_width:`${t}px`,rr_height:`${r}px`}}"iframe"!==f||u(g.src)||(e.contentDocument||(g.rr_src=g.src),delete g.src);let w;try{customElements.get(f)&&(w=!0)}catch(b){}return{type:Kh.Element,tagName:f,attributes:g,childNodes:[],isSVG:zm(e)||void 0,needBlock:m,rootId:h,isCustom:w}}(e,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:d,dataURLOptions:u,inlineImages:p,recordCanvas:h,keepIframeSrcFn:m,newlyAddedElement:f,rootId:y});case e.TEXT_NODE:return function(e,t){const{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:i}=t,s=sm.parentNode(e),a=s&&s.tagName;let l="";const c="STYLE"===a||void 0,d="SCRIPT"===a||void 0;d?l="SCRIPT_PLACEHOLDER":i||(l=sm.textContent(e),c&&l&&(l=km(l,Pm(t.doc))));!c&&!d&&l&&r&&(l=n?n(l,sm.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:Kh.Text,textContent:l||"",rootId:o}}(e,{doc:r,needsMask:s,maskTextFn:c,rootId:y,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:Kh.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:Kh.Comment,textContent:sm.textContent(e)||"",rootId:y};default:return!1}}function Um(e){return null==e?"":e.toLowerCase()}function Bm(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 Wm(e,t){const{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:d={},maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m={},inlineImages:f=!1,recordCanvas:g=!1,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b=5e3,onStylesheetLoad:v,stylesheetLoadTimeout:x=5e3,keepIframeSrcFn:k=()=>!1,newlyAddedElement:_=!1,cssCaptured:S=!1}=t;let{needsMask:C}=t,{preserveWhiteSpace:I=!0}=t;C||(C=jm(e,s,a,void 0===C));const E=Fm(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:C,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,dataURLOptions:m,inlineImages:f,recordCanvas:g,keepIframeSrcFn:k,newlyAddedElement:_,cssCaptured:S});if(!E)return null;let T;T=n.hasNode(e)?n.getId(e):function(e,t){if(t.comment&&e.type===Kh.Comment)return!0;if(e.type===Kh.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"===ym(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Um(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Um(e.attributes.name)||"icon"===Um(e.attributes.rel)||"apple-touch-icon"===Um(e.attributes.rel)||"shortcut icon"===Um(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Um(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Um(e.attributes.property).match(/^(og|twitter|fb):/)||Um(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Um(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===Um(e.attributes.name)||"googlebot"===Um(e.attributes.name)||"bingbot"===Um(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===Um(e.attributes.name)||"generator"===Um(e.attributes.name)||"framework"===Um(e.attributes.name)||"publisher"===Um(e.attributes.name)||"progid"===Um(e.attributes.name)||Um(e.attributes.property).match(/^article:/)||Um(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===Um(e.attributes.name)||"yandex-verification"===Um(e.attributes.name)||"csrf-token"===Um(e.attributes.name)||"p:domain_verify"===Um(e.attributes.name)||"verify-v1"===Um(e.attributes.name)||"verification"===Um(e.attributes.name)||"shopify-checkout-api-token"===Um(e.attributes.name)))return!0}}return!1}(E,h)||!I&&E.type===Kh.Text&&!E.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Am();const A=Object.assign(E,{id:T});if(n.add(e,A),-2===T)return null;y&&y(e);let M=!l;if(A.type===Kh.Element){M=M&&!A.needBlock,delete A.needBlock;const t=sm.shadowRoot(e);t&&cm(t)&&(A.isShadowHost=!0)}if((A.type===Kh.Document||A.type===Kh.Element)&&M){h.headWhitespace&&A.type===Kh.Element&&"head"===A.tagName&&(I=!1);const t={doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:C,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:f,recordCanvas:g,preserveWhiteSpace:I,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:k,cssCaptured:!1};if(A.type===Kh.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else{A.type===Kh.Element&&void 0!==A.attributes._cssText&&"string"==typeof A.attributes._cssText&&(t.cssCaptured=!0);for(const r of Array.from(sm.childNodes(e))){const e=Wm(r,t);e&&A.childNodes.push(e)}}let _=null;if(am(e)&&(_=sm.shadowRoot(e)))for(const e of Array.from(sm.childNodes(_))){const r=Wm(e,t);r&&(cm(_)&&(r.isShadow=!0),A.childNodes.push(r))}}const O=sm.parentNode(e);return O&&lm(O)&&cm(O)&&(A.isShadow=!0),A.type===Kh.Element&&"iframe"===A.tagName&&function(e,t,r){const n=e.contentWindow;if(!n)return;let o,i=!1;try{o=n.document.readyState}catch(a){return}if("complete"!==o){const n=setTimeout(()=>{i||(t(),i=!0)},r);return void e.addEventListener("load",()=>{clearTimeout(n),i=!0,t()})}const s="about:blank";if(n.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&&w){const r=Wm(t,{doc:t,mirror:n,blockClass:o,blockSelector:i,needsMask:C,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:f,recordCanvas:g,preserveWhiteSpace:I,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:k});r&&w(e,r)}},b),A.type===Kh.Element&&"link"===A.tagName&&"string"==typeof A.attributes.rel&&("stylesheet"===A.attributes.rel||"preload"===A.attributes.rel&&"string"==typeof A.attributes.href&&"css"===ym(A.attributes.href))&&function(e,t,r){let n,o=!1;try{n=e.sheet}catch(s){return}if(n)return;const i=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(i),o=!0,t()})}(e,()=>{if(v){const t=Wm(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:C,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:h,dataURLOptions:m,inlineImages:f,recordCanvas:g,preserveWhiteSpace:I,onSerialize:y,onIframeLoad:w,iframeLoadTimeout:b,onStylesheetLoad:v,stylesheetLoadTimeout:x,keepIframeSrcFn:k});t&&v(e,t)}},x),A}function Gm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Hm(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var Zm={exports:{}},Vm=String,qm=function(){return{isColorSupported:!1,reset:Vm,bold:Vm,dim:Vm,italic:Vm,underline:Vm,inverse:Vm,hidden:Vm,strikethrough:Vm,black:Vm,red:Vm,green:Vm,yellow:Vm,blue:Vm,magenta:Vm,cyan:Vm,white:Vm,gray:Vm,bgBlack:Vm,bgRed:Vm,bgGreen:Vm,bgYellow:Vm,bgBlue:Vm,bgMagenta:Vm,bgCyan:Vm,bgWhite:Vm}};Zm.exports=qm(),Zm.exports.createColors=qm;var Jm=Zm.exports,Ym=/* @__PURE__ */Hm(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),Km=Jm,Qm=Ym,Xm=class e extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),void 0!==r&&void 0!==n&&("number"==typeof r?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=Km.isColorSupported),Qm&&e&&(t=Qm(t));let r,n,o=t.split(/\r?\n/),i=Math.max(this.line-3,0),s=Math.min(this.line+2,o.length),a=String(s).length;if(e){let{bold:e,gray:t,red:o}=Km.createColors(!0);r=t=>e(o(t)),n=e=>t(e)}else r=n=e=>e;return o.slice(i,s).map((e,t)=>{let o=i+1+t,s=" "+(" "+o).slice(-a)+" | ";if(o===this.line){let t=n(s.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return r(">")+n(s)+e+"\n "+t+r("^")}return" "+n(s)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}},ef=Xm;Xm.default=Xm;var tf={};tf.isClean=Symbol("isClean"),tf.my=Symbol("my");var rf={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var nf=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let o=(e.raws.between||"")+(t?";":"");this.builder(r+n+o,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,o=0;for(;n&&"root"!==n.type;)o+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<o;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let o=e.nodes[n],i=this.raw(o,"before");i&&this.builder(i),this.stringify(o,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(e,t,r){let n;if(r||(r=t),t&&(n=e.raws[t],void 0!==n))return n;let o=e.parent;if("before"===r){if(!o||"root"===o.type&&o.first===e)return"";if(o&&"document"===o.type)return""}if(!o)return rf[r];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[r])return i.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(e,r);{let o="raw"+((s=r)[0].toUpperCase()+s.slice(1));this[o]?n=this[o](i,e):i.walk(e=>{if(n=e.raws[t],void 0!==n)return!1})}var s;return void 0===n&&(n=rf[r]),i.rawCache[r]=n,n}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},of=nf;nf.default=nf;var sf=of;function af(e,t){new sf(t).stringify(e)}var lf=af;af.default=af;var{isClean:cf,my:df}=tf,uf=ef,pf=of,hf=lf;function mf(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let o=e[n],i=typeof o;"parent"===n&&"object"===i?t&&(r[n]=t):"source"===n?r[n]=o:Array.isArray(o)?r[n]=o.map(e=>mf(e,r)):("object"===i&&null!==o&&(o=mf(o)),r[n]=o)}return r}var ff=class{constructor(e={}){this.raws={},this[cf]=!1,this[df]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let r of e[t])"function"==typeof r.clone?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=mf(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new uf(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[cf]){this[cf]=!1;let e=this;for(;e=e.parent;)e[cf]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,o=this.source.start.line;for(let i=0;i<e;i++)"\n"===r[i]?(n=1,o+=1):n+=1;return{column:n,line:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),o=n.indexOf(e.word);-1!==o&&(t=this.positionInside(o,n),r=this.positionInside(o+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new pf).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||/* @__PURE__ */new Map;let o=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i))continue;if("parent"===i||"proxyCache"===i)continue;let e=this[i];if(Array.isArray(e))r[i]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)r[i]=e.toJSON(null,t);else if("source"===i){let n=t.get(e.input);null==n&&(n=o,t.set(e.input,o),o++),r[i]={end:e.end,inputId:n,start:e.start}}else r[i]=e}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=hf){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let o in r)n[o]=r[o];return e.warn(t,n)}get proxyOf(){return this}},gf=ff;ff.default=ff;var yf=gf,wf=class extends yf{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}},bf=wf;wf.default=wf;var vf={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n}},{SourceMapConsumer:xf,SourceMapGenerator:kf}=Ym,{existsSync:_f,readFileSync:Sf}=Ym,{dirname:Cf,join:If}=Ym;var Ef=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=Cf(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new xf(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=Cf(e),_f(e))return this.mapFile=e,Sf(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof xf)return kf.fromSourceMap(t).toString();if(t instanceof kf)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let r=t(e);if(r){let e=this.loadFile(r);if(!e)throw new Error("Unable to load previous source map: "+r.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=If(Cf(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Tf=Ef;Ef.default=Ef;var{SourceMapConsumer:Af,SourceMapGenerator:Mf}=Ym,{fileURLToPath:Of,pathToFileURL:Nf}=Ym,{isAbsolute:Rf,resolve:zf}=Ym,{nanoid:Pf}=vf,Lf=Ym,Df=ef,$f=Tf,jf=Symbol("fromOffsetCache"),Ff=Boolean(Af&&Mf),Uf=Boolean(zf&&Rf),Bf=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Uf||/^\w+:\/\//.test(t.from)||Rf(t.from)?this.file=t.from:this.file=zf(t.from)),Uf&&Ff){let e=new $f(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+Pf(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,n={}){let o,i,s;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);i=e.line,s=e.col}else i=n.line,s=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let a=this.origin(t,r,i,s);return o=a?new Df(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,n.plugin):new Df(e,void 0===i?t:{column:r,line:t},void 0===i?r:{column:s,line:i},this.css,this.file,n.plugin),o.input={column:r,endColumn:s,endLine:i,line:t,source:this.css},this.file&&(Nf&&(o.input.url=Nf(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[jf])r=this[jf];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,o=e.length;n<o;n++)r[n]=t,t+=e[n].length+1;this[jf]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,o=r.length-2;for(;n<o;)if(t=n+(o-n>>1),e<r[t])o=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:zf(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,n){if(!this.map)return!1;let o,i,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof r&&(o=s.originalPositionFor({column:n,line:r})),i=Rf(a.source)?Nf(a.source):new URL(a.source,this.map.consumer().sourceRoot||Nf(this.map.mapFile));let l={column:a.column,endColumn:o&&o.column,endLine:o&&o.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!Of)throw new Error("file: protocol is not available in this PostCSS build");l.file=Of(i)}let c=s.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},Wf=Bf;Bf.default=Bf,Lf&&Lf.registerInput&&Lf.registerInput(Bf);var{SourceMapConsumer:Gf,SourceMapGenerator:Hf}=Ym,{dirname:Zf,relative:Vf,resolve:qf,sep:Jf}=Ym,{pathToFileURL:Yf}=Ym,Kf=Wf,Qf=Boolean(Gf&&Hf),Xf=Boolean(Zf&&qf&&Vf&&Jf),eg=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=/* @__PURE__ */new Map,this.memoizedPaths=/* @__PURE__ */new Map,this.memoizedURLs=/* @__PURE__ */new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,r=this.toUrl(this.path(e.file)),n=e.root||Zf(e.file);!1===this.mapOpts.sourcesContent?(t=new Gf(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),Xf&&Qf&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Hf.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Hf({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Hf({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,r=1,n=1,o="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(s,a,l)=>{if(this.css+=s,a&&"end"!==l&&(i.generated.line=r,i.generated.column=n-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=s.match(/\n/g),e?(r+=e.length,t=s.lastIndexOf("\n"),n=s.length-t):n+=s.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"!==a.type&&("atrule"!==a.type||a.nodes)||a!==e.last||e.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=r,i.generated.column=n-2,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,i.generated.line=r,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Zf(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(r=Zf(qf(r,this.mapOpts.annotation)));let n=Vf(r,e);return this.memoizedPaths.set(e,n),n}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Kf(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Yf){let t=Yf(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===Jf&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},tg=gf,rg=class extends tg{constructor(e){super(e),this.type="comment"}},ng=rg;rg.default=rg;var og,ig,sg,ag,{isClean:lg,my:cg}=tf,dg=bf,ug=ng,pg=gf;function hg(e){return e.map(e=>(e.nodes&&(e.nodes=hg(e.nodes)),delete e.source,e))}function mg(e){if(e[lg]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)mg(t)}var fg=class e extends pg{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),o=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let i of o)this.proxyOf.nodes.splice(n+1,0,i);for(let i in this.indexes)r=this.indexes[i],n<r&&(this.indexes[i]=r+o.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),o=0===n&&"prepend",i=this.normalize(t,this.proxyOf.nodes[n],o).reverse();n=this.index(e);for(let s of i)this.proxyOf.nodes.splice(n,0,s);for(let s in this.indexes)r=this.indexes[s],n<=r&&(this.indexes[s]=r+i.length);return this.markDirty(),this}normalize(t,r){if("string"==typeof t)t=hg(og(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new dg(t)]}else if(t.selector)t=[new ig(t)];else if(t.name)t=[new sg(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new ug(t)]}return t.map(t=>(t[cg]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[lg]&&mg(t),void 0===t.raws.before&&r&&void 0!==r.raws.before&&(t.raws.before=r.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(o){throw t.addToError(o)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};fg.registerParse=e=>{og=e},fg.registerRule=e=>{ig=e},fg.registerAtRule=e=>{sg=e},fg.registerRoot=e=>{ag=e};var gg=fg;fg.default=fg,fg.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,sg.prototype):"rule"===e.type?Object.setPrototypeOf(e,ig.prototype):"decl"===e.type?Object.setPrototypeOf(e,dg.prototype):"comment"===e.type?Object.setPrototypeOf(e,ug.prototype):"root"===e.type&&Object.setPrototypeOf(e,ag.prototype),e[cg]=!0,e.nodes&&e.nodes.forEach(e=>{fg.rebuild(e)})};var yg,wg,bg=gg,vg=class extends bg{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new yg(new wg,this,e).stringify()}};vg.registerLazyResult=e=>{yg=e},vg.registerProcessor=e=>{wg=e};var xg=vg;vg.default=vg;var kg=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},_g=kg;kg.default=kg;var Sg=_g,Cg=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new Sg(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},Ig=Cg;Cg.default=Cg;var Eg="'".charCodeAt(0),Tg='"'.charCodeAt(0),Ag="\\".charCodeAt(0),Mg="/".charCodeAt(0),Og="\n".charCodeAt(0),Ng=" ".charCodeAt(0),Rg="\f".charCodeAt(0),zg="\t".charCodeAt(0),Pg="\r".charCodeAt(0),Lg="[".charCodeAt(0),Dg="]".charCodeAt(0),$g="(".charCodeAt(0),jg=")".charCodeAt(0),Fg="{".charCodeAt(0),Ug="}".charCodeAt(0),Bg=";".charCodeAt(0),Wg="*".charCodeAt(0),Gg=":".charCodeAt(0),Hg="@".charCodeAt(0),Zg=/[\t\n\f\r "#'()/;[\\\]{}]/g,Vg=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,qg=/.[\r\n"'(/\\]/,Jg=/[\da-f]/i,Yg=gg,Kg=class extends Yg{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},Qg=Kg;Kg.default=Kg,Yg.registerAtRule(Kg);var Xg,ey,ty=gg,ry=class extends ty{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of n)o.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new Xg(new ey,this,e).stringify()}};ry.registerLazyResult=e=>{Xg=e},ry.registerProcessor=e=>{ey=e};var ny=ry;ry.default=ry,ty.registerRoot(ry);var oy={comma:e=>oy.split(e,[","],!0),space:e=>oy.split(e,[" ","\n","\t"]),split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let d of e)c?c=!1:"\\"===d?c=!0:a?d===l&&(a=!1):'"'===d||"'"===d?(a=!0,l=d):"("===d?s+=1:")"===d?s>0&&(s-=1):0===s&&t.includes(d)&&(i=!0),i?(""!==o&&n.push(o.trim()),o="",i=!1):o+=d;return(r||""!==o)&&n.push(o.trim()),n}},iy=oy;oy.default=oy;var sy=gg,ay=iy,ly=class extends sy{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return ay.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},cy=ly;ly.default=ly,sy.registerRule(ly);var dy=bf,uy=function(e,t={}){let r,n,o,i,s,a,l,c,d,u,p=e.css.valueOf(),h=t.ignoreErrors,m=p.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(r=p.charCodeAt(f),r){case Og:case Ng:case zg:case Pg:case Rg:n=f;do{n+=1,r=p.charCodeAt(n)}while(r===Ng||r===Og||r===zg||r===Pg||r===Rg);u=["space",p.slice(f,n)],f=n-1;break;case Lg:case Dg:case Fg:case Ug:case Gg:case Bg:case jg:{let e=String.fromCharCode(r);u=[e,e,f];break}case $g:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==Eg&&d!==Tg&&d!==Ng&&d!==Og&&d!==zg&&d!==Rg&&d!==Pg){n=f;do{if(a=!1,n=p.indexOf(")",n+1),-1===n){if(h||t){n=f;break}w("bracket")}for(l=n;p.charCodeAt(l-1)===Ag;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,n+1),f,n],f=n}else n=p.indexOf(")",f+1),i=p.slice(f,n+1),-1===n||qg.test(i)?u=["(","(",f]:(u=["brackets",i,f,n],f=n);break;case Eg:case Tg:o=r===Eg?"'":'"',n=f;do{if(a=!1,n=p.indexOf(o,n+1),-1===n){if(h||t){n=f+1;break}w("string")}for(l=n;p.charCodeAt(l-1)===Ag;)l-=1,a=!a}while(a);u=["string",p.slice(f,n+1),f,n],f=n;break;case Hg:Zg.lastIndex=f+1,Zg.test(p),n=0===Zg.lastIndex?p.length-1:Zg.lastIndex-2,u=["at-word",p.slice(f,n+1),f,n],f=n;break;case Ag:for(n=f,s=!0;p.charCodeAt(n+1)===Ag;)n+=1,s=!s;if(r=p.charCodeAt(n+1),s&&r!==Mg&&r!==Ng&&r!==Og&&r!==zg&&r!==Pg&&r!==Rg&&(n+=1,Jg.test(p.charAt(n)))){for(;Jg.test(p.charAt(n+1));)n+=1;p.charCodeAt(n+1)===Ng&&(n+=1)}u=["word",p.slice(f,n+1),f,n],f=n;break;default:r===Mg&&p.charCodeAt(f+1)===Wg?(n=p.indexOf("*/",f+2)+1,0===n&&(h||t?n=p.length:w("comment")),u=["comment",p.slice(f,n+1),f,n],f=n):(Vg.lastIndex=f+1,Vg.test(p),n=0===Vg.lastIndex?p.length-1:Vg.lastIndex-2,u=["word",p.slice(f,n+1),f,n],g.push(u),f=n)}return f++,u},position:function(){return f}}},py=ng,hy=Qg,my=ny,fy=cy,gy={empty:!0,space:!0};var yy=gg,wy=class{constructor(e){this.input=e,this.root=new my,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,n,o=new hy;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let i=!1,s=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(n=a.length-1,r=a[n];r&&"space"===r[0];)r=a[--n];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(o.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(o,"params",a),i&&(e=a[a.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),s&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let o=t-1;o>=0&&(r=e[o],"space"===r[0]||(n+=1,2!==n));o--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,o=0;for(let[i,s]of e.entries()){if(t=s,r=t[0],"("===r&&(o+=1),")"===r&&(o-=1),0===o&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return i}this.doubleColon(t)}n=t}return!1}comment(e){let t=new py;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let e=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=uy(this.input)}decl(e,t){let r=new dy;this.init(r,e[0][2]);let n,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(n=e.shift(),":"===n[0]){r.raws.between+=n[1];break}"word"===n[0]&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let i,s=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)s.push(e.shift());this.precheckMissedSemicolon(e);for(let a=e.length-1;a>=0;a--){if(n=e[a],"!important"===n[1].toLowerCase()){r.important=!0;let t=this.stringFrom(e,a);t=this.spacesFromEnd(e)+t," !important"!==t&&(r.raws.important=t);break}if("important"===n[1].toLowerCase()){let t=e.slice(0),n="";for(let e=a;e>0;e--){let r=t[e][0];if(0===n.trim().indexOf("!")&&"space"!==r)break;n=t.pop()[1]+n}0===n.trim().indexOf("!")&&(r.important=!0,r.raws.important=n,e=t)}if("space"!==n[0]&&"comment"!==n[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=s.map(e=>e[1]).join(""),s=[]),this.raw(r,"value",s.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new fy;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,o=null,i=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)o||(o=l),i.push("("===r?")":"]");else if(s&&n&&"{"===r)o||(o=l),i.push("}");else if(0===i.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===i[i.length-1]&&(i.pop(),0===i.length&&(o=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(o),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let o,i,s,a,l=r.length,c="",d=!0;for(let u=0;u<l;u+=1)o=r[u],i=o[0],"space"!==i||u!==l-1||n?"comment"===i?(a=r[u-1]?r[u-1][0]:"empty",s=r[u+1]?r[u+1][0]:"empty",gy[a]||gy[s]||","===c.slice(-1)?d=!1:c+=o[1]):c+=o[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new fy;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},by=Wf;function vy(e,t){let r=new wy(new by(e,t));try{r.parse()}catch(n){throw n}return r.root}var xy=vy;vy.default=vy,yy.registerParse(vy);var{isClean:ky,my:_y}=tf,Sy=eg,Cy=lf,Iy=gg,Ey=xg,Ty=Ig,Ay=xy,My=ny,Oy={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Ny={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},Ry={Once:!0,postcssPlugin:!0,prepare:!0};function zy(e){return"object"==typeof e&&"function"==typeof e.then}function Py(e){let t=!1,r=Oy[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function Ly(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Py(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Dy(e){return e[ky]=!1,e.nodes&&e.nodes.forEach(e=>Dy(e)),e}var $y={},jy=class e{constructor(t,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof e||r instanceof Ty)o=Dy(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=Ay;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(i){this.processed=!0,this.error=i}o&&!o[_y]&&Iy.rebuild(o)}else o=Dy(r);this.result=new Ty(t,o,n),this.helpers={...$y,postcss:$y,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin?r.postcssVersion:(e.plugin=r.postcssPlugin,e.setMessage())}catch(n){console&&console.error}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!Ny[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Ry[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let r=0;r<this.plugins.length;r++){let t=this.plugins[r],n=this.runOnRoot(t);if(zy(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ky];){e[ky]=!0;let r=[Ly(e)];for(;r.length>0;){let e=this.visitTick(r);if(zy(e))try{await e}catch(t){let e=r[r.length-1].node;throw this.handleError(t,e)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if("document"===e.type){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,this.helpers)}catch(t){throw this.handleError(t)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return zy(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=Cy;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new Sy(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins)if(zy(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[ky];)e[ky]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,o]of e){let e;this.result.lastPlugin=n;try{e=o(t,this.helpers)}catch(r){throw this.handleError(r,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(zy(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:n}=t;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void e.pop();if(n.length>0&&t.visitorIndex<n.length){let[e,o]=n[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===n.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return o(r.toProxy(),this.helpers)}catch(i){throw this.handleError(i,r)}}if(0!==t.iterator){let n,o=t.iterator;for(;n=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!n[ky])return n[ky]=!0,void e.push(Ly(n));t.iterator=0,delete r.indexes[o]}let o=t.events;for(;t.eventIndex<o.length;){let e=o[t.eventIndex];if(t.eventIndex+=1,0===e)return void(r.nodes&&r.nodes.length&&(r[ky]=!0,t.iterator=r.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[ky]=!0;let t=Py(e);for(let r of t)if(0===r)e.nodes&&e.each(e=>{e[ky]||this.walkSync(e)});else{let t=this.listeners[r];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};jy.registerPostcss=e=>{$y=e};var Fy=jy;jy.default=jy,My.registerLazyResult(jy),Ey.registerLazyResult(jy);var Uy=eg,By=lf,Wy=xy,Gy=Ig,Hy=class{constructor(e,t,r){let n;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let o=By;this.result=new Gy(this._processor,n,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let s=new Uy(o,n,this._opts,t);if(s.isMap()){let[e,t]=s.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else s.clearAnnotation(),this.result.css=s.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Wy;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},Zy=Hy;Hy.default=Hy;var Vy=Zy,qy=Fy,Jy=xg,Yy=ny,Ky=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new qy(this,e,t):new Vy(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Qy=Ky;Ky.default=Ky,Yy.registerProcessor(Ky),Jy.registerProcessor(Ky);var Xy=bf,ew=Tf,tw=ng,rw=Qg,nw=Wf,ow=ny,iw=cy;function sw(e,t){if(Array.isArray(e))return e.map(e=>sw(e));let{inputs:r,...n}=e;if(r){t=[];for(let e of r){let r={...e,__proto__:nw.prototype};r.map&&(r.map={...r.map,__proto__:ew.prototype}),t.push(r)}}if(n.nodes&&(n.nodes=e.nodes.map(e=>sw(e,t))),n.source){let{inputId:e,...r}=n.source;n.source=r,null!=e&&(n.source.input=t[e])}if("root"===n.type)return new ow(n);if("decl"===n.type)return new Xy(n);if("rule"===n.type)return new iw(n);if("comment"===n.type)return new tw(n);if("atrule"===n.type)return new rw(n);throw new Error("Unknown node type: "+e.type)}var aw=sw;sw.default=sw;var lw=ef,cw=bf,dw=Fy,uw=gg,pw=Qy,hw=lf,mw=aw,fw=xg,gw=_g,yw=ng,ww=Qg,bw=Ig,vw=Wf,xw=xy,kw=iy,_w=cy,Sw=ny,Cw=gf;function Iw(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new pw(e)}Iw.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,{}.LANG&&{}.LANG.startsWith("cn"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new pw).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return Iw([o(r)]).process(e,t)},o},Iw.stringify=hw,Iw.parse=xw,Iw.fromJSON=mw,Iw.list=kw,Iw.comment=e=>new yw(e),Iw.atRule=e=>new ww(e),Iw.decl=e=>new cw(e),Iw.rule=e=>new _w(e),Iw.root=e=>new Sw(e),Iw.document=e=>new fw(e),Iw.CssSyntaxError=lw,Iw.Declaration=cw,Iw.Container=uw,Iw.Processor=pw,Iw.Document=fw,Iw.Comment=yw,Iw.Warning=gw,Iw.AtRule=ww,Iw.Result=bw,Iw.Input=vw,Iw.Rule=_w,Iw.Root=Sw,Iw.Node=Cw,dw.registerPostcss(Iw);var Ew=Iw;Iw.default=Iw;var Tw=/* @__PURE__ */Gm(Ew);Tw.stringify,Tw.fromJSON,Tw.plugin,Tw.parse,Tw.list,Tw.document,Tw.comment,Tw.atRule,Tw.rule,Tw.decl,Tw.root,Tw.CssSyntaxError,Tw.Declaration,Tw.Container,Tw.Processor,Tw.Document,Tw.Comment,Tw.Warning,Tw.AtRule,Tw.Result,Tw.Input,Tw.Rule,Tw.Root,Tw.Node;var Aw=Object.defineProperty,Mw=(e,t,r)=>((e,t,r)=>t in e?Aw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);function Ow(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Nw(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}),r}var Rw={exports:{}},zw=String,Pw=function(){return{isColorSupported:!1,reset:zw,bold:zw,dim:zw,italic:zw,underline:zw,inverse:zw,hidden:zw,strikethrough:zw,black:zw,red:zw,green:zw,yellow:zw,blue:zw,magenta:zw,cyan:zw,white:zw,gray:zw,bgBlack:zw,bgRed:zw,bgGreen:zw,bgYellow:zw,bgBlue:zw,bgMagenta:zw,bgCyan:zw,bgWhite:zw}};Rw.exports=Pw(),Rw.exports.createColors=Pw;var Lw=Rw.exports,Dw=/* @__PURE__ */Nw(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),$w=Lw,jw=Dw,Fw=class e extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),void 0!==r&&void 0!==n&&("number"==typeof r?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,e)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=$w.isColorSupported),jw&&e&&(t=jw(t));let r,n,o=t.split(/\r?\n/),i=Math.max(this.line-3,0),s=Math.min(this.line+2,o.length),a=String(s).length;if(e){let{bold:e,gray:t,red:o}=$w.createColors(!0);r=t=>e(o(t)),n=e=>t(e)}else r=n=e=>e;return o.slice(i,s).map((e,t)=>{let o=i+1+t,s=" "+(" "+o).slice(-a)+" | ";if(o===this.line){let t=n(s.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return r(">")+n(s)+e+"\n "+t+r("^")}return" "+n(s)+e}).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}},Uw=Fw;Fw.default=Fw;var Bw={};Bw.isClean=Symbol("isClean"),Bw.my=Symbol("my");var Ww={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var Gw=class{constructor(e){this.builder=e}atrule(e,t){let r="@"+e.name,n=e.params?this.rawValue(e,"params"):"";if(void 0!==e.raws.afterName?r+=e.raws.afterName:n&&(r+=" "),e.nodes)this.block(e,r+n);else{let o=(e.raws.between||"")+(t?";":"");this.builder(r+n+o,e)}}beforeAfter(e,t){let r;r="decl"===e.type?this.raw(e,null,"beforeDecl"):"comment"===e.type?this.raw(e,null,"beforeComment"):"before"===t?this.raw(e,null,"beforeRule"):this.raw(e,null,"beforeClose");let n=e.parent,o=0;for(;n&&"root"!==n.type;)o+=1,n=n.parent;if(r.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<o;e++)r+=t}return r}block(e,t){let r,n=this.raw(e,"between","beforeOpen");this.builder(t+n+"{",e,"start"),e.nodes&&e.nodes.length?(this.body(e),r=this.raw(e,"after")):r=this.raw(e,"after","emptyBody"),r&&this.builder(r),this.builder("}",e,"end")}body(e){let t=e.nodes.length-1;for(;t>0&&"comment"===e.nodes[t].type;)t-=1;let r=this.raw(e,"semicolon");for(let n=0;n<e.nodes.length;n++){let o=e.nodes[n],i=this.raw(o,"before");i&&this.builder(i),this.stringify(o,t!==n||r)}}comment(e){let t=this.raw(e,"left","commentLeft"),r=this.raw(e,"right","commentRight");this.builder("/*"+t+e.text+r+"*/",e)}decl(e,t){let r=this.raw(e,"between","colon"),n=e.prop+r+this.rawValue(e,"value");e.important&&(n+=e.raws.important||" !important"),t&&(n+=";"),this.builder(n,e)}document(e){this.body(e)}raw(e,t,r){let n;if(r||(r=t),t&&(n=e.raws[t],void 0!==n))return n;let o=e.parent;if("before"===r){if(!o||"root"===o.type&&o.first===e)return"";if(o&&"document"===o.type)return""}if(!o)return Ww[r];let i=e.root();if(i.rawCache||(i.rawCache={}),void 0!==i.rawCache[r])return i.rawCache[r];if("before"===r||"after"===r)return this.beforeAfter(e,r);{let o="raw"+((s=r)[0].toUpperCase()+s.slice(1));this[o]?n=this[o](i,e):i.walk(e=>{if(n=e.raws[t],void 0!==n)return!1})}var s;return void 0===n&&(n=Ww[r]),i.rawCache[r]=n,n}rawBeforeClose(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length>0&&void 0!==e.raws.after)return t=e.raws.after,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawBeforeComment(e,t){let r;return e.walkComments(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeDecl"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeDecl(e,t){let r;return e.walkDecls(e=>{if(void 0!==e.raws.before)return r=e.raws.before,r.includes("\n")&&(r=r.replace(/[^\n]+$/,"")),!1}),void 0===r?r=this.raw(t,null,"beforeRule"):r&&(r=r.replace(/\S/g,"")),r}rawBeforeOpen(e){let t;return e.walk(e=>{if("decl"!==e.type&&(t=e.raws.between,void 0!==t))return!1}),t}rawBeforeRule(e){let t;return e.walk(r=>{if(r.nodes&&(r.parent!==e||e.first!==r)&&void 0!==r.raws.before)return t=r.raws.before,t.includes("\n")&&(t=t.replace(/[^\n]+$/,"")),!1}),t&&(t=t.replace(/\S/g,"")),t}rawColon(e){let t;return e.walkDecls(e=>{if(void 0!==e.raws.between)return t=e.raws.between.replace(/[^\s:]/g,""),!1}),t}rawEmptyBody(e){let t;return e.walk(e=>{if(e.nodes&&0===e.nodes.length&&(t=e.raws.after,void 0!==t))return!1}),t}rawIndent(e){if(e.raws.indent)return e.raws.indent;let t;return e.walk(r=>{let n=r.parent;if(n&&n!==e&&n.parent&&n.parent===e&&void 0!==r.raws.before){let e=r.raws.before.split("\n");return t=e[e.length-1],t=t.replace(/\S/g,""),!1}}),t}rawSemicolon(e){let t;return e.walk(e=>{if(e.nodes&&e.nodes.length&&"decl"===e.last.type&&(t=e.raws.semicolon,void 0!==t))return!1}),t}rawValue(e,t){let r=e[t],n=e.raws[t];return n&&n.value===r?n.raw:r}root(e){this.body(e),e.raws.after&&this.builder(e.raws.after)}rule(e){this.block(e,this.rawValue(e,"selector")),e.raws.ownSemicolon&&this.builder(e.raws.ownSemicolon,e,"end")}stringify(e,t){if(!this[e.type])throw new Error("Unknown AST node type "+e.type+". Maybe you need to change PostCSS stringifier.");this[e.type](e,t)}},Hw=Gw;Gw.default=Gw;var Zw=Hw;function Vw(e,t){new Zw(t).stringify(e)}var qw=Vw;Vw.default=Vw;var{isClean:Jw,my:Yw}=Bw,Kw=Uw,Qw=Hw,Xw=qw;function eb(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if("proxyCache"===n)continue;let o=e[n],i=typeof o;"parent"===n&&"object"===i?t&&(r[n]=t):"source"===n?r[n]=o:Array.isArray(o)?r[n]=o.map(e=>eb(e,r)):("object"===i&&null!==o&&(o=eb(o)),r[n]=o)}return r}var tb=class{constructor(e={}){this.raws={},this[Jw]=!1,this[Yw]=!0;for(let t in e)if("nodes"===t){this.nodes=[];for(let r of e[t])"function"==typeof r.clone?this.append(r.clone()):this.append(r)}else this[t]=e[t]}addToError(e){if(e.postcssNode=this,e.stack&&this.source&&/\n\s{4}at /.test(e.stack)){let t=this.source;e.stack=e.stack.replace(/\n\s{4}at /,`$&${t.input.from}:${t.start.line}:${t.start.column}$&`)}return e}after(e){return this.parent.insertAfter(this,e),this}assign(e={}){for(let t in e)this[t]=e[t];return this}before(e){return this.parent.insertBefore(this,e),this}cleanRaws(e){delete this.raws.before,delete this.raws.after,e||delete this.raws.between}clone(e={}){let t=eb(this);for(let r in e)t[r]=e[r];return t}cloneAfter(e={}){let t=this.clone(e);return this.parent.insertAfter(this,t),t}cloneBefore(e={}){let t=this.clone(e);return this.parent.insertBefore(this,t),t}error(e,t={}){if(this.source){let{end:r,start:n}=this.rangeBy(t);return this.source.input.error(e,{column:n.column,line:n.line},{column:r.column,line:r.line},t)}return new Kw(e)}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:"root"===t?()=>e.root().toProxy():e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"prop"!==t&&"value"!==t&&"name"!==t&&"params"!==t&&"important"!==t&&"text"!==t||e.markDirty()),!0)}}markDirty(){if(this[Jw]){this[Jw]=!1;let e=this;for(;e=e.parent;)e[Jw]=!1}}next(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e+1]}positionBy(e,t){let r=this.source.start;if(e.index)r=this.positionInside(e.index,t);else if(e.word){let n=(t=this.toString()).indexOf(e.word);-1!==n&&(r=this.positionInside(n,t))}return r}positionInside(e,t){let r=t||this.toString(),n=this.source.start.column,o=this.source.start.line;for(let i=0;i<e;i++)"\n"===r[i]?(n=1,o+=1):n+=1;return{column:n,line:o}}prev(){if(!this.parent)return;let e=this.parent.index(this);return this.parent.nodes[e-1]}rangeBy(e){let t={column:this.source.start.column,line:this.source.start.line},r=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:t.column+1,line:t.line};if(e.word){let n=this.toString(),o=n.indexOf(e.word);-1!==o&&(t=this.positionInside(o,n),r=this.positionInside(o+e.word.length,n))}else e.start?t={column:e.start.column,line:e.start.line}:e.index&&(t=this.positionInside(e.index)),e.end?r={column:e.end.column,line:e.end.line}:"number"==typeof e.endIndex?r=this.positionInside(e.endIndex):e.index&&(r=this.positionInside(e.index+1));return(r.line<t.line||r.line===t.line&&r.column<=t.column)&&(r={column:t.column+1,line:t.line}),{end:r,start:t}}raw(e,t){return(new Qw).raw(this,e,t)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...e){if(this.parent){let t=this,r=!1;for(let n of e)n===this?r=!0:r?(this.parent.insertAfter(t,n),t=n):this.parent.insertBefore(t,n);r||this.remove()}return this}root(){let e=this;for(;e.parent&&"document"!==e.parent.type;)e=e.parent;return e}toJSON(e,t){let r={},n=null==t;t=t||/* @__PURE__ */new Map;let o=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i))continue;if("parent"===i||"proxyCache"===i)continue;let e=this[i];if(Array.isArray(e))r[i]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)r[i]=e.toJSON(null,t);else if("source"===i){let n=t.get(e.input);null==n&&(n=o,t.set(e.input,o),o++),r[i]={end:e.end,inputId:n,start:e.start}}else r[i]=e}return n&&(r.inputs=[...t.keys()].map(e=>e.toJSON())),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(e=Xw){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,r){let n={node:this};for(let o in r)n[o]=r[o];return e.warn(t,n)}get proxyOf(){return this}},rb=tb;tb.default=tb;var nb=rb,ob=class extends nb{constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}},ib=ob;ob.default=ob;var sb={nanoid:(e=21)=>{let t="",r=e;for(;r--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n}},{SourceMapConsumer:ab,SourceMapGenerator:lb}=Dw,{existsSync:cb,readFileSync:db}=Dw,{dirname:ub,join:pb}=Dw;var hb=class{constructor(e,t){if(!1===t.map)return;this.loadAnnotation(e),this.inline=this.startWith(this.annotation,"data:");let r=t.map?t.map.prev:void 0,n=this.loadMap(t.from,r);!this.mapFile&&t.from&&(this.mapFile=t.from),this.mapFile&&(this.root=ub(this.mapFile)),n&&(this.text=n)}consumer(){return this.consumerCache||(this.consumerCache=new ab(this.text)),this.consumerCache}decodeInline(e){if(/^data:application\/json;charset=utf-?8,/.test(e)||/^data:application\/json,/.test(e))return decodeURIComponent(e.substr(RegExp.lastMatch.length));if(/^data:application\/json;charset=utf-?8;base64,/.test(e)||/^data:application\/json;base64,/.test(e))return t=e.substr(RegExp.lastMatch.length),Buffer?Buffer.from(t,"base64").toString():window.atob(t);var t;let r=e.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+r)}getAnnotationURL(e){return e.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(e){return"object"==typeof e&&("string"==typeof e.mappings||"string"==typeof e._mappings||Array.isArray(e.sections))}loadAnnotation(e){let t=e.match(/\/\*\s*# sourceMappingURL=/gm);if(!t)return;let r=e.lastIndexOf(t.pop()),n=e.indexOf("*/",r);r>-1&&n>-1&&(this.annotation=this.getAnnotationURL(e.substring(r,n)))}loadFile(e){if(this.root=ub(e),cb(e))return this.mapFile=e,db(e,"utf-8").toString().trim()}loadMap(e,t){if(!1===t)return!1;if(t){if("string"==typeof t)return t;if("function"!=typeof t){if(t instanceof ab)return lb.fromSourceMap(t).toString();if(t instanceof lb)return t.toString();if(this.isMap(t))return JSON.stringify(t);throw new Error("Unsupported previous source map format: "+t.toString())}{let r=t(e);if(r){let e=this.loadFile(r);if(!e)throw new Error("Unable to load previous source map: "+r.toString());return e}}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let t=this.annotation;return e&&(t=pb(ub(e),t)),this.loadFile(t)}}}startWith(e,t){return!!e&&e.substr(0,t.length)===t}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},mb=hb;hb.default=hb;var{SourceMapConsumer:fb,SourceMapGenerator:gb}=Dw,{fileURLToPath:yb,pathToFileURL:wb}=Dw,{isAbsolute:bb,resolve:vb}=Dw,{nanoid:xb}=sb,kb=Dw,_b=Uw,Sb=mb,Cb=Symbol("fromOffsetCache"),Ib=Boolean(fb&&gb),Eb=Boolean(vb&&bb),Tb=class{constructor(e,t={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,t.from&&(!Eb||/^\w+:\/\//.test(t.from)||bb(t.from)?this.file=t.from:this.file=vb(t.from)),Eb&&Ib){let e=new Sb(this.css,t);if(e.text){this.map=e;let t=e.consumer().file;!this.file&&t&&(this.file=this.mapResolve(t))}}this.file||(this.id="<input css "+xb(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,r,n={}){let o,i,s;if(t&&"object"==typeof t){let e=t,n=r;if("number"==typeof e.offset){let n=this.fromOffset(e.offset);t=n.line,r=n.col}else t=e.line,r=e.column;if("number"==typeof n.offset){let e=this.fromOffset(n.offset);i=e.line,s=e.col}else i=n.line,s=n.column}else if(!r){let e=this.fromOffset(t);t=e.line,r=e.col}let a=this.origin(t,r,i,s);return o=a?new _b(e,void 0===a.endLine?a.line:{column:a.column,line:a.line},void 0===a.endLine?a.column:{column:a.endColumn,line:a.endLine},a.source,a.file,n.plugin):new _b(e,void 0===i?t:{column:r,line:t},void 0===i?r:{column:s,line:i},this.css,this.file,n.plugin),o.input={column:r,endColumn:s,endLine:i,line:t,source:this.css},this.file&&(wb&&(o.input.url=wb(this.file).toString()),o.input.file=this.file),o}fromOffset(e){let t,r;if(this[Cb])r=this[Cb];else{let e=this.css.split("\n");r=new Array(e.length);let t=0;for(let n=0,o=e.length;n<o;n++)r[n]=t,t+=e[n].length+1;this[Cb]=r}t=r[r.length-1];let n=0;if(e>=t)n=r.length-1;else{let t,o=r.length-2;for(;n<o;)if(t=n+(o-n>>1),e<r[t])o=t-1;else{if(!(e>=r[t+1])){n=t;break}n=t+1}}return{col:e-r[n]+1,line:n+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:vb(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,r,n){if(!this.map)return!1;let o,i,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof r&&(o=s.originalPositionFor({column:n,line:r})),i=bb(a.source)?wb(a.source):new URL(a.source,this.map.consumer().sourceRoot||wb(this.map.mapFile));let l={column:a.column,endColumn:o&&o.column,endLine:o&&o.line,line:a.line,url:i.toString()};if("file:"===i.protocol){if(!yb)throw new Error("file: protocol is not available in this PostCSS build");l.file=yb(i)}let c=s.sourceContentFor(a.source);return c&&(l.source=c),l}toJSON(){let e={};for(let t of["hasBOM","css","file","id"])null!=this[t]&&(e[t]=this[t]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}get from(){return this.file||this.id}},Ab=Tb;Tb.default=Tb,kb&&kb.registerInput&&kb.registerInput(Tb);var{SourceMapConsumer:Mb,SourceMapGenerator:Ob}=Dw,{dirname:Nb,relative:Rb,resolve:zb,sep:Pb}=Dw,{pathToFileURL:Lb}=Dw,Db=Ab,$b=Boolean(Mb&&Ob),jb=Boolean(Nb&&zb&&Rb&&Pb),Fb=class{constructor(e,t,r,n){this.stringify=e,this.mapOpts=r.map||{},this.root=t,this.opts=r,this.css=n,this.originalCSS=n,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=/* @__PURE__ */new Map,this.memoizedPaths=/* @__PURE__ */new Map,this.memoizedURLs=/* @__PURE__ */new Map}addAnnotation(){let e;e=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let t="\n";this.css.includes("\r\n")&&(t="\r\n"),this.css+=t+"/*# sourceMappingURL="+e+" */"}applyPrevMaps(){for(let e of this.previous()){let t,r=this.toUrl(this.path(e.file)),n=e.root||Nb(e.file);!1===this.mapOpts.sourcesContent?(t=new Mb(e.text),t.sourcesContent&&(t.sourcesContent=null)):t=e.consumer(),this.map.applySourceMap(t,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let e;for(let t=this.root.nodes.length-1;t>=0;t--)e=this.root.nodes[t],"comment"===e.type&&0===e.text.indexOf("# sourceMappingURL=")&&this.root.removeChild(t)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),jb&&$b&&this.isMap())return this.generateMap();{let e="";return this.stringify(this.root,t=>{e+=t}),[e]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let e=this.previous()[0].consumer();e.file=this.outputFile(),this.map=Ob.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Ob({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new Ob({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,r=1,n=1,o="<no source>",i={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,(s,a,l)=>{if(this.css+=s,a&&"end"!==l&&(i.generated.line=r,i.generated.column=n-1,a.source&&a.source.start?(i.source=this.sourcePath(a),i.original.line=a.source.start.line,i.original.column=a.source.start.column-1,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,this.map.addMapping(i))),e=s.match(/\n/g),e?(r+=e.length,t=s.lastIndexOf("\n"),n=s.length-t):n+=s.length,a&&"start"!==l){let e=a.parent||{raws:{}};("decl"!==a.type&&("atrule"!==a.type||a.nodes)||a!==e.last||e.raws.semicolon)&&(a.source&&a.source.end?(i.source=this.sourcePath(a),i.original.line=a.source.end.line,i.original.column=a.source.end.column-1,i.generated.line=r,i.generated.column=n-2,this.map.addMapping(i)):(i.source=o,i.original.line=1,i.original.column=0,i.generated.line=r,i.generated.column=n-1,this.map.addMapping(i)))}})}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some(e=>e.annotation))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let e=this.mapOpts.annotation;return(void 0===e||!0===e)&&(!this.previous().length||this.previous().some(e=>e.inline))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some(e=>e.withContent())}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(e){if(this.mapOpts.absolute)return e;if(60===e.charCodeAt(0))return e;if(/^\w+:\/\//.test(e))return e;let t=this.memoizedPaths.get(e);if(t)return t;let r=this.opts.to?Nb(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(r=Nb(zb(r,this.mapOpts.annotation)));let n=Rb(r,e);return this.memoizedPaths.set(e,n),n}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(e=>{if(e.source&&e.source.input.map){let t=e.source.input.map;this.previousMaps.includes(t)||this.previousMaps.push(t)}});else{let e=new Db(this.originalCSS,this.opts);e.map&&this.previousMaps.push(e.map)}return this.previousMaps}setSourcesContent(){let e={};if(this.root)this.root.walk(t=>{if(t.source){let r=t.source.input.from;if(r&&!e[r]){e[r]=!0;let n=this.usesFileUrls?this.toFileUrl(r):this.toUrl(this.path(r));this.map.setSourceContent(n,t.source.input.css)}}});else if(this.css){let e=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(e,this.css)}}sourcePath(e){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(e.source.input.from):this.toUrl(this.path(e.source.input.from))}toBase64(e){return Buffer?Buffer.from(e).toString("base64"):window.btoa(unescape(encodeURIComponent(e)))}toFileUrl(e){let t=this.memoizedFileURLs.get(e);if(t)return t;if(Lb){let t=Lb(e).toString();return this.memoizedFileURLs.set(e,t),t}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(e){let t=this.memoizedURLs.get(e);if(t)return t;"\\"===Pb&&(e=e.replace(/\\/g,"/"));let r=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,r),r}},Ub=rb,Bb=class extends Ub{constructor(e){super(e),this.type="comment"}},Wb=Bb;Bb.default=Bb;var Gb,Hb,Zb,Vb,{isClean:qb,my:Jb}=Bw,Yb=ib,Kb=Wb,Qb=rb;function Xb(e){return e.map(e=>(e.nodes&&(e.nodes=Xb(e.nodes)),delete e.source,e))}function ev(e){if(e[qb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)ev(t)}var tv=class e extends Qb{append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,n=this.getIterator();for(;this.indexes[n]<this.proxyOf.nodes.length&&(t=this.indexes[n],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[n]+=1;return delete this.indexes[n],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map(e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e)):"every"===t||"some"===t?r=>e[t]((e,...t)=>r(e.toProxy(),...t)):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map(e=>e.toProxy()):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,n=this.index(e),o=this.normalize(t,this.proxyOf.nodes[n]).reverse();n=this.index(e);for(let i of o)this.proxyOf.nodes.splice(n+1,0,i);for(let i in this.indexes)r=this.indexes[i],n<r&&(this.indexes[i]=r+o.length);return this.markDirty(),this}insertBefore(e,t){let r,n=this.index(e),o=0===n&&"prepend",i=this.normalize(t,this.proxyOf.nodes[n],o).reverse();n=this.index(e);for(let s of i)this.proxyOf.nodes.splice(n,0,s);for(let s in this.indexes)r=this.indexes[s],n<=r&&(this.indexes[s]=r+i.length);return this.markDirty(),this}normalize(t,r){if("string"==typeof t)t=Xb(Gb(t).nodes);else if(void 0===t)t=[];else if(Array.isArray(t)){t=t.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if("root"===t.type&&"document"!==this.type){t=t.nodes.slice(0);for(let e of t)e.parent&&e.parent.removeChild(e,"ignore")}else if(t.type)t=[t];else if(t.prop){if(void 0===t.value)throw new Error("Value field is missed in node creation");"string"!=typeof t.value&&(t.value=String(t.value)),t=[new Yb(t)]}else if(t.selector)t=[new Hb(t)];else if(t.name)t=[new Zb(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new Kb(t)]}return t.map(t=>(t[Jb]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[qb]&&ev(t),void 0===t.raws.before&&r&&void 0!==r.raws.before&&(t.raws.before=r.raws.before.replace(/\S/g,"")),t.parent=this.proxyOf,t))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls(n=>{t.props&&!t.props.includes(n.prop)||t.fast&&!n.value.includes(t.fast)||(n.value=n.value.replace(e,r))}),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each((t,r)=>{let n;try{n=e(t,r)}catch(o){throw t.addToError(o)}return!1!==n&&t.walk&&(n=t.walk(e)),n})}walkAtRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("atrule"===r.type&&e.test(r.name))return t(r,n)}):this.walk((r,n)=>{if("atrule"===r.type&&r.name===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("atrule"===e.type)return t(e,r)}))}walkComments(e){return this.walk((t,r)=>{if("comment"===t.type)return e(t,r)})}walkDecls(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("decl"===r.type&&e.test(r.prop))return t(r,n)}):this.walk((r,n)=>{if("decl"===r.type&&r.prop===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("decl"===e.type)return t(e,r)}))}walkRules(e,t){return t?e instanceof RegExp?this.walk((r,n)=>{if("rule"===r.type&&e.test(r.selector))return t(r,n)}):this.walk((r,n)=>{if("rule"===r.type&&r.selector===e)return t(r,n)}):(t=e,this.walk((e,r)=>{if("rule"===e.type)return t(e,r)}))}get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}};tv.registerParse=e=>{Gb=e},tv.registerRule=e=>{Hb=e},tv.registerAtRule=e=>{Zb=e},tv.registerRoot=e=>{Vb=e};var rv=tv;tv.default=tv,tv.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,Zb.prototype):"rule"===e.type?Object.setPrototypeOf(e,Hb.prototype):"decl"===e.type?Object.setPrototypeOf(e,Yb.prototype):"comment"===e.type?Object.setPrototypeOf(e,Kb.prototype):"root"===e.type&&Object.setPrototypeOf(e,Vb.prototype),e[Jb]=!0,e.nodes&&e.nodes.forEach(e=>{tv.rebuild(e)})};var nv,ov,iv=rv,sv=class extends iv{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new nv(new ov,this,e).stringify()}};sv.registerLazyResult=e=>{nv=e},sv.registerProcessor=e=>{ov=e};var av=sv;sv.default=sv;var lv=class{constructor(e,t={}){if(this.type="warning",this.text=e,t.node&&t.node.source){let e=t.node.rangeBy(t);this.line=e.start.line,this.column=e.start.column,this.endLine=e.end.line,this.endColumn=e.end.column}for(let r in t)this[r]=t[r]}toString(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text}},cv=lv;lv.default=lv;var dv=cv,uv=class{constructor(e,t,r){this.processor=e,this.messages=[],this.root=t,this.opts=r,this.css=void 0,this.map=void 0}toString(){return this.css}warn(e,t={}){t.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(t.plugin=this.lastPlugin.postcssPlugin);let r=new dv(e,t);return this.messages.push(r),r}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},pv=uv;uv.default=uv;var hv="'".charCodeAt(0),mv='"'.charCodeAt(0),fv="\\".charCodeAt(0),gv="/".charCodeAt(0),yv="\n".charCodeAt(0),wv=" ".charCodeAt(0),bv="\f".charCodeAt(0),vv="\t".charCodeAt(0),xv="\r".charCodeAt(0),kv="[".charCodeAt(0),_v="]".charCodeAt(0),Sv="(".charCodeAt(0),Cv=")".charCodeAt(0),Iv="{".charCodeAt(0),Ev="}".charCodeAt(0),Tv=";".charCodeAt(0),Av="*".charCodeAt(0),Mv=":".charCodeAt(0),Ov="@".charCodeAt(0),Nv=/[\t\n\f\r "#'()/;[\\\]{}]/g,Rv=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,zv=/.[\r\n"'(/\\]/,Pv=/[\da-f]/i,Lv=rv,Dv=class extends Lv{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}},$v=Dv;Dv.default=Dv,Lv.registerAtRule(Dv);var jv,Fv,Uv=rv,Bv=class extends Uv{constructor(e){super(e),this.type="root",this.nodes||(this.nodes=[])}normalize(e,t,r){let n=super.normalize(e);if(t)if("prepend"===r)this.nodes.length>1?t.raws.before=this.nodes[1].raws.before:delete t.raws.before;else if(this.first!==t)for(let o of n)o.raws.before=t.raws.before;return n}removeChild(e,t){let r=this.index(e);return!t&&0===r&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[r].raws.before),super.removeChild(e)}toResult(e={}){return new jv(new Fv,this,e).stringify()}};Bv.registerLazyResult=e=>{jv=e},Bv.registerProcessor=e=>{Fv=e};var Wv=Bv;Bv.default=Bv,Uv.registerRoot(Bv);var Gv={comma:e=>Gv.split(e,[","],!0),space:e=>Gv.split(e,[" ","\n","\t"]),split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let d of e)c?c=!1:"\\"===d?c=!0:a?d===l&&(a=!1):'"'===d||"'"===d?(a=!0,l=d):"("===d?s+=1:")"===d?s>0&&(s-=1):0===s&&t.includes(d)&&(i=!0),i?(""!==o&&n.push(o.trim()),o="",i=!1):o+=d;return(r||""!==o)&&n.push(o.trim()),n}},Hv=Gv;Gv.default=Gv;var Zv=rv,Vv=Hv,qv=class extends Zv{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Vv.comma(this.selector)}set selectors(e){let t=this.selector?this.selector.match(/,\s*/):null,r=t?t[0]:","+this.raw("between","beforeOpen");this.selector=e.join(r)}},Jv=qv;qv.default=qv,Zv.registerRule(qv);var Yv=ib,Kv=function(e,t={}){let r,n,o,i,s,a,l,c,d,u,p=e.css.valueOf(),h=t.ignoreErrors,m=p.length,f=0,g=[],y=[];function w(t){throw e.error("Unclosed "+t,f)}return{back:function(e){y.push(e)},endOfFile:function(){return 0===y.length&&f>=m},nextToken:function(e){if(y.length)return y.pop();if(f>=m)return;let t=!!e&&e.ignoreUnclosed;switch(r=p.charCodeAt(f),r){case yv:case wv:case vv:case xv:case bv:n=f;do{n+=1,r=p.charCodeAt(n)}while(r===wv||r===yv||r===vv||r===xv||r===bv);u=["space",p.slice(f,n)],f=n-1;break;case kv:case _v:case Iv:case Ev:case Mv:case Tv:case Cv:{let e=String.fromCharCode(r);u=[e,e,f];break}case Sv:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==hv&&d!==mv&&d!==wv&&d!==yv&&d!==vv&&d!==bv&&d!==xv){n=f;do{if(a=!1,n=p.indexOf(")",n+1),-1===n){if(h||t){n=f;break}w("bracket")}for(l=n;p.charCodeAt(l-1)===fv;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,n+1),f,n],f=n}else n=p.indexOf(")",f+1),i=p.slice(f,n+1),-1===n||zv.test(i)?u=["(","(",f]:(u=["brackets",i,f,n],f=n);break;case hv:case mv:o=r===hv?"'":'"',n=f;do{if(a=!1,n=p.indexOf(o,n+1),-1===n){if(h||t){n=f+1;break}w("string")}for(l=n;p.charCodeAt(l-1)===fv;)l-=1,a=!a}while(a);u=["string",p.slice(f,n+1),f,n],f=n;break;case Ov:Nv.lastIndex=f+1,Nv.test(p),n=0===Nv.lastIndex?p.length-1:Nv.lastIndex-2,u=["at-word",p.slice(f,n+1),f,n],f=n;break;case fv:for(n=f,s=!0;p.charCodeAt(n+1)===fv;)n+=1,s=!s;if(r=p.charCodeAt(n+1),s&&r!==gv&&r!==wv&&r!==yv&&r!==vv&&r!==xv&&r!==bv&&(n+=1,Pv.test(p.charAt(n)))){for(;Pv.test(p.charAt(n+1));)n+=1;p.charCodeAt(n+1)===wv&&(n+=1)}u=["word",p.slice(f,n+1),f,n],f=n;break;default:r===gv&&p.charCodeAt(f+1)===Av?(n=p.indexOf("*/",f+2)+1,0===n&&(h||t?n=p.length:w("comment")),u=["comment",p.slice(f,n+1),f,n],f=n):(Rv.lastIndex=f+1,Rv.test(p),n=0===Rv.lastIndex?p.length-1:Rv.lastIndex-2,u=["word",p.slice(f,n+1),f,n],g.push(u),f=n)}return f++,u},position:function(){return f}}},Qv=Wb,Xv=$v,ex=Wv,tx=Jv,rx={empty:!0,space:!0};var nx=rv,ox=class{constructor(e){this.input=e,this.root=new ex,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:e,start:{column:1,line:1,offset:0}}}atrule(e){let t,r,n,o=new Xv;o.name=e[1].slice(1),""===o.name&&this.unnamedAtrule(o,e),this.init(o,e[2]);let i=!1,s=!1,a=[],l=[];for(;!this.tokenizer.endOfFile();){if(t=(e=this.tokenizer.nextToken())[0],"("===t||"["===t?l.push("("===t?")":"]"):"{"===t&&l.length>0?l.push("}"):t===l[l.length-1]&&l.pop(),0===l.length){if(";"===t){o.source.end=this.getPosition(e[2]),o.source.end.offset++,this.semicolon=!0;break}if("{"===t){s=!0;break}if("}"===t){if(a.length>0){for(n=a.length-1,r=a[n];r&&"space"===r[0];)r=a[--n];r&&(o.source.end=this.getPosition(r[3]||r[2]),o.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){i=!0;break}}o.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(o.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(o,"params",a),i&&(e=a[a.length-1],o.source.end=this.getPosition(e[3]||e[2]),o.source.end.offset++,this.spaces=o.raws.between,o.raws.between="")):(o.raws.afterName="",o.params=""),s&&(o.nodes=[],this.current=o)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let r,n=0;for(let o=t-1;o>=0&&(r=e[o],"space"===r[0]||(n+=1,2!==n));o--);throw this.input.error("Missed semicolon","word"===r[0]?r[3]+1:r[2])}colon(e){let t,r,n,o=0;for(let[i,s]of e.entries()){if(t=s,r=t[0],"("===r&&(o+=1),")"===r&&(o-=1),0===o&&":"===r){if(n){if("word"===n[0]&&"progid"===n[1])continue;return i}this.doubleColon(t)}n=t}return!1}comment(e){let t=new Qv;this.init(t,e[2]),t.source.end=this.getPosition(e[3]||e[2]),t.source.end.offset++;let r=e[1].slice(2,-2);if(/^\s*$/.test(r))t.text="",t.raws.left=r,t.raws.right="";else{let e=r.match(/^(\s*)([^]*\S)(\s*)$/);t.text=e[2],t.raws.left=e[1],t.raws.right=e[3]}}createTokenizer(){this.tokenizer=Kv(this.input)}decl(e,t){let r=new Yv;this.init(r,e[0][2]);let n,o=e[e.length-1];for(";"===o[0]&&(this.semicolon=!0,e.pop()),r.source.end=this.getPosition(o[3]||o[2]||function(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}(e)),r.source.end.offset++;"word"!==e[0][0];)1===e.length&&this.unknownWord(e),r.raws.before+=e.shift()[1];for(r.source.start=this.getPosition(e[0][2]),r.prop="";e.length;){let t=e[0][0];if(":"===t||"space"===t||"comment"===t)break;r.prop+=e.shift()[1]}for(r.raws.between="";e.length;){if(n=e.shift(),":"===n[0]){r.raws.between+=n[1];break}"word"===n[0]&&/\w/.test(n[1])&&this.unknownWord([n]),r.raws.between+=n[1]}"_"!==r.prop[0]&&"*"!==r.prop[0]||(r.raws.before+=r.prop[0],r.prop=r.prop.slice(1));let i,s=[];for(;e.length&&(i=e[0][0],"space"===i||"comment"===i);)s.push(e.shift());this.precheckMissedSemicolon(e);for(let a=e.length-1;a>=0;a--){if(n=e[a],"!important"===n[1].toLowerCase()){r.important=!0;let t=this.stringFrom(e,a);t=this.spacesFromEnd(e)+t," !important"!==t&&(r.raws.important=t);break}if("important"===n[1].toLowerCase()){let t=e.slice(0),n="";for(let e=a;e>0;e--){let r=t[e][0];if(0===n.trim().indexOf("!")&&"space"!==r)break;n=t.pop()[1]+n}0===n.trim().indexOf("!")&&(r.important=!0,r.raws.important=n,e=t)}if("space"!==n[0]&&"comment"!==n[0])break}e.some(e=>"space"!==e[0]&&"comment"!==e[0])&&(r.raws.between+=s.map(e=>e[1]).join(""),s=[]),this.raw(r,"value",s.concat(e),t),r.value.includes(":")&&!t&&this.checkMissedSemicolon(e)}doubleColon(e){throw this.input.error("Double colon",{offset:e[2]},{offset:e[2]+e[1].length})}emptyRule(e){let t=new tx;this.init(t,e[2]),t.selector="",t.raws.between="",this.current=t}end(e){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(e[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(e)}endFile(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())}freeSemicolon(e){if(this.spaces+=e[1],this.current.nodes){let e=this.current.nodes[this.current.nodes.length-1];e&&"rule"===e.type&&!e.raws.ownSemicolon&&(e.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(e){let t=this.input.fromOffset(e);return{column:t.col,line:t.line,offset:e}}init(e,t){this.current.push(e),e.source={input:this.input,start:this.getPosition(t)},e.raws.before=this.spaces,this.spaces="","comment"!==e.type&&(this.semicolon=!1)}other(e){let t=!1,r=null,n=!1,o=null,i=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(r=l[0],a.push(l),"("===r||"["===r)o||(o=l),i.push("("===r?")":"]");else if(s&&n&&"{"===r)o||(o=l),i.push("}");else if(0===i.length){if(";"===r){if(n)return void this.decl(a,s);break}if("{"===r)return void this.rule(a);if("}"===r){this.tokenizer.back(a.pop()),t=!0;break}":"===r&&(n=!0)}else r===i[i.length-1]&&(i.pop(),0===i.length&&(o=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),i.length>0&&this.unclosedBracket(o),t&&n){if(!s)for(;a.length&&(l=a[a.length-1][0],"space"===l||"comment"===l);)this.tokenizer.back(a.pop());this.decl(a,s)}else this.unknownWord(a)}parse(){let e;for(;!this.tokenizer.endOfFile();)switch(e=this.tokenizer.nextToken(),e[0]){case"space":this.spaces+=e[1];break;case";":this.freeSemicolon(e);break;case"}":this.end(e);break;case"comment":this.comment(e);break;case"at-word":this.atrule(e);break;case"{":this.emptyRule(e);break;default:this.other(e)}this.endFile()}precheckMissedSemicolon(){}raw(e,t,r,n){let o,i,s,a,l=r.length,c="",d=!0;for(let u=0;u<l;u+=1)o=r[u],i=o[0],"space"!==i||u!==l-1||n?"comment"===i?(a=r[u-1]?r[u-1][0]:"empty",s=r[u+1]?r[u+1][0]:"empty",rx[a]||rx[s]||","===c.slice(-1)?d=!1:c+=o[1]):c+=o[1]:d=!1;if(!d){let n=r.reduce((e,t)=>e+t[1],"");e.raws[t]={raw:n,value:c}}e[t]=c}rule(e){e.pop();let t=new tx;this.init(t,e[0][2]),t.raws.between=this.spacesAndCommentsFromEnd(e),this.raw(t,"selector",e),this.current=t}spacesAndCommentsFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t||"comment"===t);)r=e.pop()[1]+r;return r}spacesAndCommentsFromStart(e){let t,r="";for(;e.length&&(t=e[0][0],"space"===t||"comment"===t);)r+=e.shift()[1];return r}spacesFromEnd(e){let t,r="";for(;e.length&&(t=e[e.length-1][0],"space"===t);)r=e.pop()[1]+r;return r}stringFrom(e,t){let r="";for(let n=t;n<e.length;n++)r+=e[n][1];return e.splice(t,e.length-t),r}unclosedBlock(){let e=this.current.source.start;throw this.input.error("Unclosed block",e.line,e.column)}unclosedBracket(e){throw this.input.error("Unclosed bracket",{offset:e[2]},{offset:e[2]+1})}unexpectedClose(e){throw this.input.error("Unexpected }",{offset:e[2]},{offset:e[2]+1})}unknownWord(e){throw this.input.error("Unknown word",{offset:e[0][2]},{offset:e[0][2]+e[0][1].length})}unnamedAtrule(e,t){throw this.input.error("At-rule without name",{offset:t[2]},{offset:t[2]+t[1].length})}},ix=Ab;function sx(e,t){let r=new ox(new ix(e,t));try{r.parse()}catch(n){throw n}return r.root}var ax=sx;sx.default=sx,nx.registerParse(sx);var{isClean:lx,my:cx}=Bw,dx=Fb,ux=qw,px=rv,hx=av,mx=pv,fx=ax,gx=Wv,yx={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},wx={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},bx={Once:!0,postcssPlugin:!0,prepare:!0};function vx(e){return"object"==typeof e&&"function"==typeof e.then}function xx(e){let t=!1,r=yx[e.type];return"decl"===e.type?t=e.prop.toLowerCase():"atrule"===e.type&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,0,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function kx(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:xx(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function _x(e){return e[lx]=!1,e.nodes&&e.nodes.forEach(e=>_x(e)),e}var Sx={},Cx=class e{constructor(t,r,n){let o;if(this.stringified=!1,this.processed=!1,"object"!=typeof r||null===r||"root"!==r.type&&"document"!==r.type)if(r instanceof e||r instanceof mx)o=_x(r.root),r.map&&(void 0===n.map&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let e=fx;n.syntax&&(e=n.syntax.parse),n.parser&&(e=n.parser),e.parse&&(e=e.parse);try{o=e(r,n)}catch(i){this.processed=!0,this.error=i}o&&!o[cx]&&px.rebuild(o)}else o=_x(r);this.result=new mx(t,o,n),this.helpers={...Sx,postcss:Sx,result:this.result},this.plugins=this.processor.plugins.map(e=>"object"==typeof e&&e.prepare?{...e,...e.prepare(this.result)}:e)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(e,t){let r=this.result.lastPlugin;try{t&&t.addToError(e),this.error=e,"CssSyntaxError"!==e.name||e.plugin?r.postcssVersion:(e.plugin=r.postcssPlugin,e.setMessage())}catch(n){console&&console.error}return e}prepareVisitors(){this.listeners={};let e=(e,t,r)=>{this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push([e,r])};for(let t of this.plugins)if("object"==typeof t)for(let r in t){if(!wx[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!bx[r])if("object"==typeof t[r])for(let n in t[r])e(t,"*"===n?r:r+"-"+n.toLowerCase(),t[r][n]);else"function"==typeof t[r]&&e(t,r,t[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let r=0;r<this.plugins.length;r++){let t=this.plugins[r],n=this.runOnRoot(t);if(vx(n))try{await n}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[lx];){e[lx]=!0;let r=[kx(e)];for(;r.length>0;){let e=this.visitTick(r);if(vx(e))try{await e}catch(t){let e=r[r.length-1].node;throw this.handleError(t,e)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if("document"===e.type){let t=e.nodes.map(e=>n(e,this.helpers));await Promise.all(t)}else await n(e,this.helpers)}catch(t){throw this.handleError(t)}}}return this.processed=!0,this.stringify()}runOnRoot(e){this.result.lastPlugin=e;try{if("object"==typeof e&&e.Once){if("document"===this.result.root.type){let t=this.result.root.nodes.map(t=>e.Once(t,this.helpers));return vx(t[0])?Promise.all(t):t}return e.Once(this.result.root,this.helpers)}if("function"==typeof e)return e(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let e=this.result.opts,t=ux;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let r=new dx(t,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let e of this.plugins)if(vx(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[lx];)e[lx]=!0,this.walkSync(e);if(this.listeners.OnceExit)if("document"===e.type)for(let t of e.nodes)this.visitSync(this.listeners.OnceExit,t);else this.visitSync(this.listeners.OnceExit,e)}return this.result}then(e,t){return this.async().then(e,t)}toString(){return this.css}visitSync(e,t){for(let[n,o]of e){let e;this.result.lastPlugin=n;try{e=o(t,this.helpers)}catch(r){throw this.handleError(r,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(vx(e))throw this.getAsyncError()}}visitTick(e){let t=e[e.length-1],{node:r,visitors:n}=t;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void e.pop();if(n.length>0&&t.visitorIndex<n.length){let[e,o]=n[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===n.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return o(r.toProxy(),this.helpers)}catch(i){throw this.handleError(i,r)}}if(0!==t.iterator){let n,o=t.iterator;for(;n=r.nodes[r.indexes[o]];)if(r.indexes[o]+=1,!n[lx])return n[lx]=!0,void e.push(kx(n));t.iterator=0,delete r.indexes[o]}let o=t.events;for(;t.eventIndex<o.length;){let e=o[t.eventIndex];if(t.eventIndex+=1,0===e)return void(r.nodes&&r.nodes.length&&(r[lx]=!0,t.iterator=r.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[lx]=!0;let t=xx(e);for(let r of t)if(0===r)e.nodes&&e.each(e=>{e[lx]||this.walkSync(e)});else{let t=this.listeners[r];if(t&&this.visitSync(t,e.toProxy()))return}}warnings(){return this.sync().warnings()}get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}};Cx.registerPostcss=e=>{Sx=e};var Ix=Cx;Cx.default=Cx,gx.registerLazyResult(Cx),hx.registerLazyResult(Cx);var Ex=Fb,Tx=qw,Ax=ax,Mx=pv,Ox=class{constructor(e,t,r){let n;t=t.toString(),this.stringified=!1,this._processor=e,this._css=t,this._opts=r,this._map=void 0;let o=Tx;this.result=new Mx(this._processor,n,this._opts),this.result.css=t;let i=this;Object.defineProperty(this.result,"root",{get:()=>i.root});let s=new Ex(o,n,this._opts,t);if(s.isMap()){let[e,t]=s.generate();e&&(this.result.css=e),t&&(this.result.map=t)}else s.clearAnnotation(),this.result.css=s.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(e){return this.async().catch(e)}finally(e){return this.async().then(e,e)}sync(){if(this.error)throw this.error;return this.result}then(e,t){return this.async().then(e,t)}toString(){return this._css}warnings(){return[]}get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let e,t=Ax;try{e=t(this._css,this._opts)}catch(r){this.error=r}if(this.error)throw this.error;return this._root=e,e}get[Symbol.toStringTag](){return"NoWorkResult"}},Nx=Ox;Ox.default=Ox;var Rx=Nx,zx=Ix,Px=av,Lx=Wv,Dx=class{constructor(e=[]){this.version="8.4.38",this.plugins=this.normalize(e)}normalize(e){let t=[];for(let r of e)if(!0===r.postcss?r=r():r.postcss&&(r=r.postcss),"object"==typeof r&&Array.isArray(r.plugins))t=t.concat(r.plugins);else if("object"==typeof r&&r.postcssPlugin)t.push(r);else if("function"==typeof r)t.push(r);else if("object"!=typeof r||!r.parse&&!r.stringify)throw new Error(r+" is not a PostCSS plugin");return t}process(e,t={}){return this.plugins.length||t.parser||t.stringifier||t.syntax?new zx(this,e,t):new Rx(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},$x=Dx;Dx.default=Dx,Lx.registerProcessor(Dx),Px.registerProcessor(Dx);var jx=ib,Fx=mb,Ux=Wb,Bx=$v,Wx=Ab,Gx=Wv,Hx=Jv;function Zx(e,t){if(Array.isArray(e))return e.map(e=>Zx(e));let{inputs:r,...n}=e;if(r){t=[];for(let e of r){let r={...e,__proto__:Wx.prototype};r.map&&(r.map={...r.map,__proto__:Fx.prototype}),t.push(r)}}if(n.nodes&&(n.nodes=e.nodes.map(e=>Zx(e,t))),n.source){let{inputId:e,...r}=n.source;n.source=r,null!=e&&(n.source.input=t[e])}if("root"===n.type)return new Gx(n);if("decl"===n.type)return new jx(n);if("rule"===n.type)return new Hx(n);if("comment"===n.type)return new Ux(n);if("atrule"===n.type)return new Bx(n);throw new Error("Unknown node type: "+e.type)}var Vx=Zx;Zx.default=Zx;var qx=Uw,Jx=ib,Yx=Ix,Kx=rv,Qx=$x,Xx=qw,ek=Vx,tk=av,rk=cv,nk=Wb,ok=$v,ik=pv,sk=Ab,ak=ax,lk=Hv,ck=Jv,dk=Wv,uk=rb;function pk(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new Qx(e)}pk.plugin=function(e,t){let r,n=!1;function o(...r){console&&console.warn&&!n&&(n=!0,{}.LANG&&{}.LANG.startsWith("cn"));let o=t(...r);return o.postcssPlugin=e,o.postcssVersion=(new Qx).version,o}return Object.defineProperty(o,"postcss",{get:()=>(r||(r=o()),r)}),o.process=function(e,t,r){return pk([o(r)]).process(e,t)},o},pk.stringify=Xx,pk.parse=ak,pk.fromJSON=ek,pk.list=lk,pk.comment=e=>new nk(e),pk.atRule=e=>new ok(e),pk.decl=e=>new Jx(e),pk.rule=e=>new ck(e),pk.root=e=>new dk(e),pk.document=e=>new tk(e),pk.CssSyntaxError=qx,pk.Declaration=Jx,pk.Container=Kx,pk.Processor=Qx,pk.Document=tk,pk.Comment=nk,pk.Warning=rk,pk.AtRule=ok,pk.Result=ik,pk.Input=sk,pk.Rule=ck,pk.Root=dk,pk.Node=uk,Yx.registerPostcss(pk);var hk=pk;pk.default=pk;var mk=/* @__PURE__ */Ow(hk);mk.stringify,mk.fromJSON,mk.plugin,mk.parse,mk.list,mk.document,mk.comment,mk.atRule,mk.rule,mk.decl,mk.root,mk.CssSyntaxError,mk.Declaration,mk.Container,mk.Processor,mk.Document,mk.Comment,mk.Warning,mk.AtRule,mk.Result,mk.Input,mk.Rule,mk.Root,mk.Node;var fk=class e{constructor(...e){Mw(this,"parentElement",null),Mw(this,"parentNode",null),Mw(this,"ownerDocument"),Mw(this,"firstChild",null),Mw(this,"lastChild",null),Mw(this,"previousSibling",null),Mw(this,"nextSibling",null),Mw(this,"ELEMENT_NODE",1),Mw(this,"TEXT_NODE",3),Mw(this,"nodeType"),Mw(this,"nodeName"),Mw(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"}},gk={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},yk={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},wk={};function bk(e){if(wk[e])return wk[e];const t=globalThis[e],r=t.prototype,n=e in gk?gk[e]:void 0,o=Boolean(n&&n.every(e=>{var t,n;return Boolean(null==(n=null==(t=Object.getOwnPropertyDescriptor(r,e))?void 0:t.get)?void 0:n.toString().includes("[native code]"))})),i=e in yk?yk[e]:void 0,s=Boolean(i&&i.every(e=>{var t;return"function"==typeof r[e]&&(null==(t=r[e])?void 0:t.toString().includes("[native code]"))}));if(o&&s&&!globalThis.Zone)return wk[e]=t.prototype,t.prototype;try{const n=document.createElement("iframe");document.body.appendChild(n);const o=n.contentWindow;if(!o)return t.prototype;const i=o[e].prototype;return document.body.removeChild(n),i?wk[e]=i:r}catch{return r}}var vk={};function xk(e,t,r){var n;const o=`${e}.${String(r)}`;if(vk[o])return vk[o].call(t);const i=bk(e),s=null==(n=Object.getOwnPropertyDescriptor(i,r))?void 0:n.get;return s?(vk[o]=s,s.call(t)):t[r]}var kk={};function _k(e,t,r){const n=`${e}.${String(r)}`;if(kk[n])return kk[n].bind(t);const o=bk(e)[r];return"function"!=typeof o?t[r]:(kk[n]=o,o.bind(t))}function Sk(){return bk("MutationObserver").constructor}function Ck(e,t,r){try{if(!(t in e))return()=>{};const n=e[t],o=r(n);return"function"==typeof o&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var Ik={ownerDocument:function(e){return xk("Node",e,"ownerDocument")},childNodes:function(e){return xk("Node",e,"childNodes")},parentNode:function(e){return xk("Node",e,"parentNode")},parentElement:function(e){return xk("Node",e,"parentElement")},textContent:function(e){return xk("Node",e,"textContent")},contains:function(e,t){return _k("Node",e,"contains")(t)},getRootNode:function(e){return _k("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?xk("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?xk("Element",e,"shadowRoot"):null},querySelector:function(e,t){return xk("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return xk("Element",e,"querySelectorAll")(t)},mutationObserver:Sk,patch:Ck};function Ek(e,t,r=document){const n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var Tk={map:{},getId:()=>-1,getNode:()=>null,removeNodeFromMap(){},has:()=>!1,reset(){}};function Ak(e,t,r={}){let n=null,o=0;return function(...i){const s=Date.now();o||!1!==r.leading||(o=s);const a=t-(s-o),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),o=s,e.apply(l,i)):n||!1===r.trailing||(n=setTimeout(()=>{o=!1===r.leading?0:Date.now(),n=null,e.apply(l,i)},a))}}function Mk(e,t,r,n,o=window){const i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(e){setTimeout(()=>{r.set.call(this,e)},0),i&&i.set&&i.set.call(this,e)}}),()=>Mk(e,t,i||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Tk=new Proxy(Tk,{get:(e,t,r)=>Reflect.get(e,t,r)}));var Ok=Date.now;function Nk(e){var t,r,n,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=Ik.parentElement(i.body))?void 0:t.scrollLeft)||(null==(r=null==i?void 0:i.body)?void 0:r.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==(n=Ik.parentElement(i.body))?void 0:n.scrollTop)||(null==(o=null==i?void 0:i.body)?void 0:o.scrollTop)||0}}function Rk(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function zk(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Pk(e){return e?e.nodeType===e.ELEMENT_NODE?e:Ik.parentElement(e):null}function Lk(e,t,r,n){if(!e)return!1;const o=Pk(e);if(!o)return!1;try{if("string"==typeof t){if(o.classList.contains(t))return!0;if(n&&null!==o.closest("."+t))return!0}else if($m(o,t,n))return!0}catch(i){}if(r){if(o.matches(r))return!0;if(n&&null!==o.closest(r))return!0}return!1}function Dk(e,t,r){return!("TITLE"!==e.tagName||!r.headTitleMutations)||-2===t.getId(e)}function $k(e,t){if(lm(e))return!1;const r=t.getId(e);if(!t.has(r))return!0;const n=Ik.parentNode(e);return(!n||n.nodeType!==e.DOCUMENT_NODE)&&(!n||$k(n,t))}function jk(e){return Boolean(e.changedTouches)}function Fk(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Uk(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function Bk(e){return!!e&&(e instanceof fk&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(Ik.shadowRoot(e)))}/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())||(Ok=()=>/* @__PURE__ */(new Date).getTime());var Wk=class{constructor(){qh(this,"id",1),qh(this,"styleIDMap",/* @__PURE__ */new WeakMap),qh(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 r;return r=void 0===t?this.id++:t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}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 Gk(e){var t;let r=null;return"getRootNode"in e&&(null==(t=Ik.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&Ik.host(Ik.getRootNode(e))&&(r=Ik.host(Ik.getRootNode(e))),r}function Hk(e){const t=Ik.ownerDocument(e);if(!t)return!1;const r=function(e){let t,r=e;for(;t=Gk(r);)r=t;return r}(e);return Ik.contains(t,r)}function Zk(e){const t=Ik.ownerDocument(e);return!!t&&(Ik.contains(t,e)||Hk(e))}var Vk=/* @__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))(Vk||{}),qk=/* @__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))(qk||{}),Jk=/* @__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))(Jk||{}),Yk=/* @__PURE__ */(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Yk||{}),Kk=/* @__PURE__ */(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Kk||{}),Qk=/* @__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))(Qk||{}),Xk=/* @__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))(Xk||{});function e_(e){return"__ln"in e}var t_,r_=class{constructor(){qh(this,"length",0),qh(this,"head",null),qh(this,"tail",null)}get(e){if(e>=this.length)throw new Error("Position outside of list range");let t=this.head;for(let r=0;r<e;r++)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&&e_(e.previousSibling)){const r=e.previousSibling.__ln.next;t.next=r,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,r&&(r.previous=t)}else if(e.nextSibling&&e_(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;t.previous=r,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,r&&(r.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--)}},n_=(e,t)=>`${e}@${t}`,o_=class{constructor(){qh(this,"frozen",!1),qh(this,"locked",!1),qh(this,"texts",[]),qh(this,"attributes",[]),qh(this,"attributeMap",/* @__PURE__ */new WeakMap),qh(this,"removes",[]),qh(this,"mapRemoves",[]),qh(this,"movedMap",{}),qh(this,"addedSet",/* @__PURE__ */new Set),qh(this,"movedSet",/* @__PURE__ */new Set),qh(this,"droppedSet",/* @__PURE__ */new Set),qh(this,"removesSubTreeCache",/* @__PURE__ */new Set),qh(this,"mutationCb"),qh(this,"blockClass"),qh(this,"blockSelector"),qh(this,"maskTextClass"),qh(this,"maskTextSelector"),qh(this,"inlineStylesheet"),qh(this,"maskInputOptions"),qh(this,"maskTextFn"),qh(this,"maskInputFn"),qh(this,"keepIframeSrcFn"),qh(this,"recordCanvas"),qh(this,"inlineImages"),qh(this,"slimDOMOptions"),qh(this,"dataURLOptions"),qh(this,"doc"),qh(this,"mirror"),qh(this,"iframeManager"),qh(this,"stylesheetManager"),qh(this,"shadowDomManager"),qh(this,"canvasManager"),qh(this,"processedNodeManager"),qh(this,"unattachedDoc"),qh(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),qh(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=/* @__PURE__ */new Set,r=new r_,n=e=>{let t=e,r=-2;for(;-2===r;)t=t&&t.nextSibling,r=t&&this.mirror.getId(t);return r},o=o=>{const i=Ik.parentNode(o);if(!i||!Zk(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=lm(i)?this.mirror.getId(Gk(o)):this.mirror.getId(i),l=n(o);if(-1===a||-1===l)return r.addNode(o);const c=Wm(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=>{Fk(e,this.mirror)&&this.iframeManager.addIframe(e),Uk(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),Bk(o)&&this.shadowDomManager.addShadowRoot(Ik.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});c&&(e.push({parentId:a,nextId:l,node:c}),t.add(c.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)s_(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(Ik.parentNode(a))||o(a);for(const a of this.addedSet)a_(this.droppedSet,a)||s_(this.removesSubTreeCache,a,this.mirror)?a_(this.movedSet,a)?o(a):this.droppedSet.add(a):o(a);let i=null;for(;r.length;){let e=null;if(i){const t=this.mirror.getId(Ik.parentNode(i.value)),r=n(i.value);-1!==t&&-1!==r&&(e=i)}if(!e){let t=r.tail;for(;t;){const r=t;if(t=t.previous,r){const t=this.mirror.getId(Ik.parentNode(r.value));if(-1===n(r.value))continue;if(-1!==t){e=r;break}{const t=r.value,n=Ik.parentNode(t);if(n&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=Ik.host(n);if(-1!==this.mirror.getId(t)){e=r;break}}}}}}if(!e){for(;r.head;)r.removeNode(r.head.value);break}i=e.previous,r.removeNode(e.value),o(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,r=Ik.parentNode(t);return r&&"TEXTAREA"===r.tagName&&this.genTextAreaValueMutation(r),{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 r=JSON.stringify(e.styleDiff),n=JSON.stringify(e._unchangedStyles);r.length<t.style.length&&(r+n).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))}),qh(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 r=Array.from(Ik.childNodes(e),e=>Ik.textContent(e)||"").join("");t.attributes.value=hm({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:gm(e),value:r,maskInputFn:this.maskInputFn})}),qh(this,"processMutation",e=>{if(!Dk(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=Ik.textContent(e.target);Lk(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:jm(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,Pk(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const r=e.target;let n=e.attributeName,o=e.target.getAttribute(n);if("value"===n){const e=gm(r);o=hm({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:e,value:o,maskInputFn:this.maskInputFn})}if(Lk(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let i=this.attributeMap.get(e.target);if("IFRAME"===r.tagName&&"src"===n&&!this.keepIframeSrcFn(o)){if(r.contentDocument)return;n="rr_src"}if(i||(i={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e.target,i)),"type"===n&&"INPUT"===r.tagName&&"password"===(e.oldValue||"").toLowerCase()&&r.setAttribute("data-rr-is-password","true"),!Dm(r.tagName,n))if(i.attributes[n]=Lm(this.doc,mm(r.tagName),mm(n),o),"style"===n){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const n=this.unattachedDoc.createElement("span");e.oldValue&&n.setAttribute("style",e.oldValue);for(const e of Array.from(r.style)){const t=r.style.getPropertyValue(e),o=r.style.getPropertyPriority(e);t!==n.style.getPropertyValue(e)||o!==n.style.getPropertyPriority(e)?i.styleDiff[e]=""===o?t:[t,o]:i._unchangedStyles[e]=[t,o]}for(const e of Array.from(n.style))""===r.style.getPropertyValue(e)&&(i.styleDiff[e]=!1)}else"open"===n&&"DIALOG"===r.tagName&&(r.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":if(Lk(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 r=this.mirror.getId(t),n=lm(e.target)?this.mirror.getId(Ik.host(e.target)):this.mirror.getId(e.target);Lk(e.target,this.blockClass,this.blockSelector,!1)||Dk(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(i_(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===r||$k(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[n_(r,n)]?i_(this.movedSet,t):(this.removes.push({parentId:n,id:r,isShadow:!(!lm(e.target)||!cm(e.target))||void 0}),function(e,t){const r=[e];for(;r.length;){const e=r.pop();t.has(e)||(t.add(e),Ik.childNodes(e).forEach(e=>r.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),qh(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(Dk(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&-1!==r&&(this.movedMap[n_(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);Lk(e,this.blockClass,this.blockSelector,!1)||(Ik.childNodes(e).forEach(e=>this.genAdds(e)),Bk(e)&&Ik.childNodes(Ik.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 i_(e,t){e.delete(t),Ik.childNodes(t).forEach(t=>i_(e,t))}function s_(e,t,r){return 0!==e.size&&function(e,t){const r=Ik.parentNode(t);return!!r&&e.has(r)}(e,t)}function a_(e,t){return 0!==e.size&&l_(e,t)}function l_(e,t){const r=Ik.parentNode(t);return!!r&&(!!e.has(r)||l_(e,r))}var c_=e=>{if(!t_)return e;return(...t)=>{try{return e(...t)}catch(r){if(t_&&!0===t_(r))return;throw r}}},d_=[];function u_(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 p_(e,t){const r=new o_;d_.push(r),r.init(e);const n=new(Sk())(c_(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function h_({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){if(!1===i.mouseInteraction)return()=>{};const s=!0===i.mouseInteraction||void 0===i.mouseInteraction?{}:i.mouseInteraction,a=[];let l=null;return Object.keys(Jk).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(i=>{let s=mm(i);const c=(t=>i=>{const s=u_(i);if(Lk(s,n,o,!0))return;let a=null,c=t;if("pointerType"in i){switch(i.pointerType){case"mouse":a=Yk.Mouse;break;case"touch":a=Yk.Touch;break;case"pen":a=Yk.Pen}a===Yk.Touch?Jk[t]===Jk.MouseDown?c="TouchStart":Jk[t]===Jk.MouseUp&&(c="TouchEnd"):Yk.Pen}else jk(i)&&(a=Yk.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===Yk.Touch||c.startsWith("Mouse")&&a===Yk.Mouse)&&(a=null)):Jk[t]===Jk.Click&&(a=l,l=null);const d=jk(i)?i.changedTouches[0]:i;if(!d)return;const u=r.getId(s),{clientX:p,clientY:h}=d;c_(e)({type:Jk[c],id:u,x:p,y:h,...null!==a&&{pointerType:a}})})(i);if(window.PointerEvent)switch(Jk[i]){case Jk.MouseDown:case Jk.MouseUp:s=s.replace("mouse","pointer");break;case Jk.TouchStart:case Jk.TouchEnd:return}a.push(Ek(s,c,t))}),c_(()=>{a.forEach(e=>e())})}function m_({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){return Ek("scroll",c_(Ak(c_(i=>{const s=u_(i);if(!s||Lk(s,n,o,!0))return;const a=r.getId(s);if(s===t&&t.defaultView){const r=Nk(t.defaultView);e({id:a,x:r.left,y:r.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),i.scroll||100)),t)}var f_=["INPUT","TEXTAREA","SELECT"],g_=/* @__PURE__ */new WeakMap;function y_(e){return function(e,t){if(x_("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||x_("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||x_("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||x_("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const r=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(r)}else if(e.parentStyleSheet){const r=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(r)}return t}(e,[])}function w_(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function b_({mirror:e,stylesheetManager:t},r){var n,o,i;let s=null;s="#document"===r.nodeName?e.getId(r):e.getId(Ik.host(r));const a="#document"===r.nodeName?null==(n=r.defaultView)?void 0:n.Document:null==(i=null==(o=r.ownerDocument)?void 0:o.defaultView)?void 0:i.ShadowRoot,l=(null==a?void 0:a.prototype)?Object.getOwnPropertyDescriptor(null==a?void 0:a.prototype,"adoptedStyleSheets"):void 0;return null!==s&&-1!==s&&a&&l?(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var e;return null==(e=l.get)?void 0:e.call(this)},set(e){var r;const n=null==(r=l.set)?void 0:r.call(this,e);if(null!==s&&-1!==s)try{t.adoptStyleSheets(e,s)}catch(o){}return n}}),c_(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function v_(e,t={}){const r=e.doc.defaultView;if(!r)return()=>{};let n;!function(e,t){const{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:h,customElementCb:m}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),r(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),n(...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),l(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),c(...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),m(...e)}}(e,t),e.recordDOM&&(n=p_(e,e.doc));const o=function({mousemoveCb:e,sampling:t,doc:r,mirror:n}){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 l=Ak(c_(t=>{const r=Date.now()-s;e(a.map(e=>(e.timeOffset-=r,e)),t),a=[],s=null}),i),c=c_(Ak(c_(e=>{const t=u_(e),{clientX:r,clientY:o}=jk(e)?e.changedTouches[0]:e;s||(s=Ok()),a.push({x:r,y:o,id:n.getId(t),timeOffset:Ok()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?qk.Drag:e instanceof MouseEvent?qk.MouseMove:qk.TouchMove)}),o,{trailing:!1})),d=[Ek("mousemove",c,r),Ek("touchmove",c,r),Ek("drag",c,r)];return c_(()=>{d.forEach(e=>e())})}(e),i=h_(e),s=m_(e),a=function({viewportResizeCb:e},{win:t}){let r=-1,n=-1;return Ek("resize",c_(Ak(c_(()=>{const t=Rk(),o=zk();r===t&&n===o||(e({width:Number(o),height:Number(t)}),r=t,n=o)}),200)),t)}(e,{win:r}),l=function({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:d}){function u(e){let r=u_(e);const c=e.isTrusted,u=r&&r.tagName;if(r&&"OPTION"===u&&(r=Ik.parentElement(r)),!r||!u||f_.indexOf(u)<0||Lk(r,n,o,!0))return;if(r.classList.contains(i)||s&&r.matches(s))return;let h=r.value,m=!1;const f=gm(r)||"";"radio"===f||"checkbox"===f?m=r.checked:(a[u.toLowerCase()]||a[f])&&(h=hm({element:r,maskInputOptions:a,tagName:u,type:f,value:h,maskInputFn:l})),p(r,d?{text:h,isChecked:m,userTriggered:c}:{text:h,isChecked:m});const g=r.name;"radio"===f&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach(e=>{if(e!==r){const t=e.value;p(e,d?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}})}function p(t,n){const o=g_.get(t);if(!o||o.text!==n.text||o.isChecked!==n.isChecked){g_.set(t,n);const o=r.getId(t);c_(e)({...n,id:o})}}const h=("last"===c.input?["change"]:["input","change"]).map(e=>Ek(e,c_(u),t)),m=t.defaultView;if(!m)return()=>{h.forEach(e=>e())};const f=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),g=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&h.push(...g.map(e=>Mk(e[0],e[1],{set(){c_(u)({target:this,isTrusted:!1})}},!1,m))),c_(()=>{h.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:i}){const s=c_(i=>Ak(c_(o=>{const s=u_(o);if(!s||Lk(s,t,r,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:d,loop:u}=s;e({type:i,id:n.getId(s),currentTime:a,volume:l,muted:c,playbackRate:d,loop:u})}),o.media||500)),a=[Ek("play",s(Qk.Play),i),Ek("pause",s(Qk.Pause),i),Ek("seeked",s(Qk.Seeked),i),Ek("volumechange",s(Qk.VolumeChange),i),Ek("ratechange",s(Qk.RateChange),i)];return c_(()=>{a.forEach(e=>e())})}(e);let d=()=>{},u=()=>{},p=()=>{},h=()=>{};e.recordDOM&&(d=function({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:c_((n,o,i)=>{const[s,a]=i,{id:l,styleId:c}=w_(o,t,r.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:s,index:a}]}),n.apply(o,i)})}),n.CSSStyleSheet.prototype.addRule=function(e,t,r=this.cssRules.length){const o=`${e} { ${t} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[o,r])};const i=n.CSSStyleSheet.prototype.deleteRule;let s,a;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:c_((n,o,i)=>{const[s]=i,{id:a,styleId:l}=w_(o,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:s}]}),n.apply(o,i)})}),n.CSSStyleSheet.prototype.removeRule=function(e){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[e])},n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:c_((n,o,i)=>{const[s]=i,{id:a,styleId:l}=w_(o,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),n.apply(o,i)})})),n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:c_((n,o,i)=>{const[s]=i,{id:a,styleId:l}=w_(o,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),n.apply(o,i)})}));const l={};k_("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(k_("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),k_("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),k_("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(l).forEach(([n,o])=>{c[n]={insertRule:o.prototype.insertRule,deleteRule:o.prototype.deleteRule},o.prototype.insertRule=new Proxy(c[n].insertRule,{apply:c_((n,o,i)=>{const[s,a]=i,{id:l,styleId:c}=w_(o.parentStyleSheet,t,r.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:s,index:[...y_(o),a||0]}]}),n.apply(o,i)})}),o.prototype.deleteRule=new Proxy(c[n].deleteRule,{apply:c_((n,o,i)=>{const[s]=i,{id:a,styleId:l}=w_(o.parentStyleSheet,t,r.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...y_(o),s]}]}),n.apply(o,i)})})}),c_(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([e,t])=>{t.prototype.insertRule=c[e].insertRule,t.prototype.deleteRule=c[e].deleteRule})})}(e,{win:r}),u=b_(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){const i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:c_((o,s,a)=>{var l;const[c,d,u]=a;if(r.has(c))return i.apply(s,[c,d,u]);const{id:p,styleId:h}=w_(null==(l=s.parentRule)?void 0:l.parentStyleSheet,t,n.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,set:{property:c,value:d,priority:u},index:y_(s.parentRule)}),o.apply(s,a)})});const s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:c_((o,i,a)=>{var l;const[c]=a;if(r.has(c))return s.apply(i,[c]);const{id:d,styleId:u}=w_(null==(l=i.parentRule)?void 0:l.parentStyleSheet,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:c},index:y_(i.parentRule)}),o.apply(i,a)})}),c_(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:r}),e.collectFonts&&(h=function({fontCb:e,doc:t}){const r=t.defaultView;if(!r)return()=>{};const n=[],o=/* @__PURE__ */new WeakMap,i=r.FontFace;r.FontFace=function(e,t,r){const n=new i(e,t,r);return o.set(n,{family:e,buffer:"string"!=typeof t,descriptors:r,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),n};const s=Ck(t.fonts,"add",function(t){return function(r){return setTimeout(c_(()=>{const t=o.get(r);t&&(e(t),o.delete(r))}),0),t.apply(this,[r])}});return n.push(()=>{r.FontFace=i}),n.push(s),c_(()=>{n.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=e;let s=!0;const a=c_(()=>{const e=t.getSelection();if(!e||s&&(null==e?void 0:e.isCollapsed))return;s=e.isCollapsed||!1;const a=[],l=e.rangeCount||0;for(let t=0;t<l;t++){const{startContainer:i,startOffset:s,endContainer:l,endOffset:c}=e.getRangeAt(t);Lk(i,n,o,!0)||Lk(l,n,o,!0)||a.push({start:r.getId(i),startOffset:s,end:r.getId(l),endOffset:c})}i({ranges:a})});return a(),Ek("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const r=e.defaultView;return r&&r.customElements?Ck(r.customElements,"define",function(e){return function(r,n,o){try{t({define:{name:r}})}catch(i){}return e.apply(this,[r,n,o])}}):()=>{}}(e),g=[];for(const y of e.plugins)g.push(y.observer(y.callback,r,y.options));return c_(()=>{d_.forEach(e=>e.reset()),n?.disconnect(),o(),i(),s(),a(),l(),c(),d(),u(),p(),h(),m(),f(),g.forEach(e=>e())})}function x_(e){return void 0!==window[e]}function k_(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var __=class{constructor(e){qh(this,"iframeIdToRemoteIdMap",/* @__PURE__ */new WeakMap),qh(this,"iframeRemoteIdToIdMap",/* @__PURE__ */new WeakMap),this.generateIdFn=e}getId(e,t,r,n){const o=r||this.getIdToRemoteIdMap(e),i=n||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 r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(t=>this.getId(e,t,r,n))}getRemoteId(e,t,r){const n=r||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const o=n.get(t);return o||-1}getRemoteIds(e,t){const r=this.getRemoteIdToIdMap(e);return t.map(t=>this.getRemoteId(e,t,r))}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}},S_=class{constructor(e){qh(this,"iframes",/* @__PURE__ */new WeakMap),qh(this,"crossOriginIframeMap",/* @__PURE__ */new WeakMap),qh(this,"crossOriginIframeMirror",new __(Am)),qh(this,"crossOriginIframeStyleMirror"),qh(this,"crossOriginIframeRootIdMap",/* @__PURE__ */new WeakMap),qh(this,"mirror"),qh(this,"mutationCb"),qh(this,"wrappedEmit"),qh(this,"loadListener"),qh(this,"stylesheetManager"),qh(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new __(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 r,n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&(null==(r=e.contentWindow)||r.addEventListener("message",this.handleMessage.bind(this))),null==(n=this.loadListener)||n.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 r=this.crossOriginIframeMap.get(e.source);if(!r)return;const n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){var r;switch(t.type){case Vk.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),{timestamp:t.timestamp,type:Vk.IncrementalSnapshot,data:{source:qk.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Vk.Meta:case Vk.Load:case Vk.DomContentLoaded:return!1;case Vk.Plugin:return t;case Vk.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Vk.IncrementalSnapshot:switch(t.data.source){case qk.Mutation:return t.data.adds.forEach(t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const r=this.crossOriginIframeRootIdMap.get(e);r&&this.patchRootIdOnNode(t.node,r)}),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 qk.Drag:case qk.TouchMove:case qk.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case qk.ViewportResize:return!1;case qk.MediaInteraction:case qk.MouseInteraction:case qk.Scroll:case qk.CanvasMutation:case qk.Input:return this.replaceIds(t.data,e,["id"]),t;case qk.StyleSheetRule:case qk.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case qk.Font:return t;case qk.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case qk.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null==(r=t.data.styles)||r.forEach(t=>{this.replaceStyleIds(t,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(const o of n)(Array.isArray(t[o])||"number"==typeof t[o])&&(Array.isArray(t[o])?t[o]=e.getIds(r,t[o]):t[o]=e.getId(r,t[o]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}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===Xk.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},C_=class{constructor(e){qh(this,"shadowDoms",/* @__PURE__ */new WeakSet),qh(this,"mutationCb"),qh(this,"scrollCb"),qh(this,"bypassOptions"),qh(this,"mirror"),qh(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(!cm(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const r=p_({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(m_({...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(Ik.host(e))),this.restoreHandlers.push(b_({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 r=this;this.restoreHandlers.push(Ck(e.prototype,"attachShadow",function(e){return function(n){const o=e.call(this,n),i=Ik.shadowRoot(this);return i&&Zk(this)&&r.addShadowRoot(i,t),o}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=/* @__PURE__ */new WeakSet}},I_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E_="undefined"==typeof Uint8Array?[]:new Uint8Array(256),T_=0;T_<64;T_++)E_[I_.charCodeAt(T_)]=T_;var A_=function(e){var t,r=new Uint8Array(e),n=r.length,o="";for(t=0;t<n;t+=3)o+=I_[r[t]>>2],o+=I_[(3&r[t])<<4|r[t+1]>>4],o+=I_[(15&r[t+1])<<2|r[t+2]>>6],o+=I_[63&r[t+2]];return n%3==2?o=o.substring(0,o.length-1)+"=":n%3==1&&(o=o.substring(0,o.length-2)+"=="),o},M_=/* @__PURE__ */new Map;var O_=(e,t,r)=>{if(!e||!z_(e,t)&&"object"!=typeof e)return;const n=function(e,t){let r=M_.get(e);return r||(r=/* @__PURE__ */new Map,M_.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}(r,e.constructor.name);let o=n.indexOf(e);return-1===o&&(o=n.length,n.push(e)),o};function N_(e,t,r){if(e instanceof Array)return e.map(e=>N_(e,t,r));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:A_(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[N_(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:r}=e;return{rr_type:t,src:r}}return e instanceof HTMLCanvasElement?{rr_type:"HTMLImageElement",src:e.toDataURL()}:e instanceof ImageData?{rr_type:e.constructor.name,args:[N_(e.data,t,r),e.width,e.height]}:z_(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:O_(e,t,r)}:e}var R_=(e,t,r)=>e.map(e=>N_(e,t,r)),z_=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(e=>"function"==typeof t[e]);return Boolean(r.find(r=>e instanceof t[r]))};function P_(e,t,r,n){const o=[];try{const i=Ck(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(o,...i){if(!Lk(this,t,r,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(o);if("__context"in this||(this.__context=e),n&&["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 L_(e,t,r,n,o,i){const s=[],a=Object.getOwnPropertyNames(e);for(const l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if("function"!=typeof e[l])continue;const a=Ck(e,l,function(e){return function(...s){const a=e.apply(this,s);if(O_(a,i,this),"tagName"in this.canvas&&!Lk(this.canvas,n,o,!0)){const e={type:t,property:l,args:R_(s,i,this)};r(this.canvas,e)}return a}});s.push(a)}catch{const n=Mk(e,l,{set(e){r(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(n)}return s}var D_="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",$_="undefined"!=typeof window&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(D_)],{type:"text/javascript;charset=utf-8"});function j_(e){let t;try{if(t=$_&&(window.URL||window.webkitURL).createObjectURL($_),!t)throw"";const r=new Worker(t,{name:null==e?void 0:e.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch(r){return new Worker("data:text/javascript;base64,"+D_,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var F_,U_,B_,W_=class{constructor(e){qh(this,"pendingCanvasMutations",/* @__PURE__ */new Map),qh(this,"rafStamps",{latestId:0,invokeId:null}),qh(this,"mirror"),qh(this,"mutationCb"),qh(this,"resetObservers"),qh(this,"frozen",!1),qh(this,"locked",!1),qh(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:r,blockClass:n,blockSelector:o,recordCanvas:i,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&"all"===t&&this.initCanvasMutationObserver(r,n,o),i&&"number"==typeof t&&this.initCanvasFPSObserver(t,r,n,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,r,n,o){const i=P_(t,r,n,!0),s=/* @__PURE__ */new Map,a=new j_;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:r,type:n,width:o,height:i}=e.data;this.mutationCb({id:t,type:Kk["2D"],commands:[{property:"clearRect",args:[0,0,o,i]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:r}],type:n}]},0,0]}]})};const l=1e3/e;let c,d=0;const u=e=>{d&&e-d<l||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach(t=>{Lk(t,r,n,!0)||e.push(t)}),e})().forEach(async e=>{var t;const r=this.mirror.getId(e);if(s.get(r))return;if(0===e.width||0===e.height)return;if(s.set(r,!0),["webgl","webgl2"].includes(e.__context)){const r=e.getContext(e.__context);!1===(null==(t=null==r?void 0:r.getContextAttributes())?void 0:t.preserveDrawingBuffer)&&r.clear(r.COLOR_BUFFER_BIT)}const n=await createImageBitmap(e);a.postMessage({id:r,bitmap:n,width:e.width,height:e.height,dataURLOptions:o.dataURLOptions},[n])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{i(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const n=P_(e,t,r,!1),o=function(e,t,r,n){const o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of i)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const i=Ck(t.CanvasRenderingContext2D.prototype,s,function(o){return function(...i){return Lk(this.canvas,r,n,!0)||setTimeout(()=>{const r=R_(i,t,this);e(this.canvas,{type:Kk["2D"],property:s,args:r})},0),o.apply(this,i)}});o.push(i)}catch{const r=Mk(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:Kk["2D"],property:s,args:[t],setter:!0})}});o.push(r)}return()=>{o.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r),i=function(e,t,r,n){const o=[];return o.push(...L_(t.WebGLRenderingContext.prototype,Kk.WebGL,e,r,n,t)),void 0!==t.WebGL2RenderingContext&&o.push(...L_(t.WebGL2RenderingContext.prototype,Kk.WebGL2,e,r,n,t)),()=>{o.forEach(e=>e())}}(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{n(),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 r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||-1===t)return;const n=r.map(e=>{const{type:t,...r}=e;return r}),{type:o}=r[0];this.mutationCb({id:t,type:o,commands:n}),this.pendingCanvasMutations.delete(e)}},G_=class{constructor(e){qh(this,"trackedLinkElements",/* @__PURE__ */new WeakSet),qh(this,"mutationCb"),qh(this,"adoptedStyleSheetCb"),qh(this,"styleMirror",new Wk),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 r={id:t,styleIds:[]},n=[];for(const o of e){let e;this.styleMirror.has(o)?e=this.styleMirror.getId(o):(e=this.styleMirror.add(o),n.push({styleId:e,rules:Array.from(o.rules||CSSRule,(e,t)=>({rule:um(e,o.href),index:t}))})),r.styleIds.push(e)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=/* @__PURE__ */new WeakSet}trackStylesheetInLinkElement(e){}},H_=class{constructor(){qh(this,"nodeMap",/* @__PURE__ */new WeakMap),qh(this,"active",!1)}inOtherBuffer(e,t){const r=this.nodeMap.get(e);return r&&Array.from(r).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(){}},Z_=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(Gh=e.contentWindow)?void 0:Gh.Array.from)||Array.from,document.body.removeChild(e)}}catch(HS){}var V_,q_,J_=new pm;function Y_(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:p,slimDOMOptions:h,maskInputFn:m,maskTextFn:f,hooks:g,packFn:y,sampling:w={},dataURLOptions:b={},mousemoveWait:v,recordDOM:x=!0,recordCanvas:k=!1,recordCrossOriginIframes:_=!1,recordAfter:S=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:C=!1,collectFonts:I=!1,inlineImages:E=!1,plugins:T,keepIframeSrcFn:A=()=>!1,ignoreCSSAttributes:M=/* @__PURE__ */new Set([]),errorHandler:O}=e;t_=O;const N=!_||window.parent===window;let R=!1;if(!N)try{window.parent.document&&(R=!1)}catch(Z){R=!0}if(N&&!t)throw new Error("emit function is required");if(!N&&!R)return()=>{};void 0!==v&&void 0===w.mousemove&&(w.mousemove=v),J_.reset();const z=!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=Bm(h);let L;!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 D=0;const $=e=>{for(const t of T||[])t.eventProcessor&&(e=t.eventProcessor(e));return y&&!R&&(e=y(e)),e};F_=(e,o)=>{var i;const s=e;if(s.timestamp=Ok(),!(null==(i=d_[0])?void 0:i.isFrozen())||s.type===Vk.FullSnapshot||s.type===Vk.IncrementalSnapshot&&s.data.source===qk.Mutation||d_.forEach(e=>e.unfreeze()),N)t?.($(s),o);else if(R){const e={type:"rrweb",event:$(s),origin:window.location.origin,isCheckout:o};window.parent.postMessage(e,"*")}if(s.type===Vk.FullSnapshot)L=s,D=0;else if(s.type===Vk.IncrementalSnapshot){if(s.data.source===qk.Mutation&&s.data.isAttachIframe)return;D++;const e=n&&D>=n,t=r&&s.timestamp-L.timestamp>r;(e||t)&&U_(!0)}};const j=e=>{F_({type:Vk.IncrementalSnapshot,data:{source:qk.Mutation,...e}})},F=e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.Scroll,...e}}),U=e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.CanvasMutation,...e}}),B=new G_({mutationCb:j,adoptedStyleSheetCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.AdoptedStyleSheet,...e}})}),W=new S_({mirror:J_,mutationCb:j,stylesheetManager:B,recordCrossOriginIframes:_,wrappedEmit:F_});for(const q of T||[])q.getMirror&&q.getMirror({nodeMirror:J_,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const G=new H_;B_=new W_({recordCanvas:k,mutationCb:U,win:window,blockClass:o,blockSelector:i,mirror:J_,sampling:w.canvas,dataURLOptions:b});const H=new C_({mutationCb:j,scrollCb:F,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:z,dataURLOptions:b,maskTextFn:f,maskInputFn:m,recordCanvas:k,inlineImages:E,sampling:w,slimDOMOptions:P,iframeManager:W,stylesheetManager:B,canvasManager:B_,keepIframeSrcFn:A,processedNodeManager:G},mirror:J_});U_=(e=!1)=>{if(!x)return;F_({type:Vk.Meta,data:{href:window.location.href,width:zk(),height:Rk()}},e),B.reset(),H.init(),d_.forEach(e=>e.lock());const t=function(e,t){const{mirror:r=new pm,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:i="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:d=!1,maskTextFn:u,maskInputFn:p,slimDOM:h=!1,dataURLOptions:m,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:b,stylesheetLoadTimeout:v,keepIframeSrcFn:x=()=>!1}=t||{};return Wm(e,{doc:e,mirror:r,blockClass:n,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:Bm(h),dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:g,onIframeLoad:y,iframeLoadTimeout:w,onStylesheetLoad:b,stylesheetLoadTimeout:v,keepIframeSrcFn:x,newlyAddedElement:!1})}(document,{mirror:J_,blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:z,maskTextFn:f,maskInputFn:m,slimDOM:P,dataURLOptions:b,recordCanvas:k,inlineImages:E,onSerialize:e=>{Fk(e,J_)&&W.addIframe(e),Uk(e,J_)&&B.trackLinkElement(e),Bk(e)&&H.addShadowRoot(Ik.shadowRoot(e),document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{B.attachLinkElement(e,t)},keepIframeSrcFn:A});t&&(F_({type:Vk.FullSnapshot,data:{node:t,initialOffset:Nk(window)}},e),d_.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&B.adoptStyleSheets(document.adoptedStyleSheets,J_.getId(document)))};try{const e=[],t=e=>{var t;return c_(v_)({mutationCb:j,mousemoveCb:(e,t)=>F_({type:Vk.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.MouseInteraction,...e}}),scrollCb:F,viewportResizeCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.ViewportResize,...e}}),inputCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.Input,...e}}),mediaInteractionCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.MediaInteraction,...e}}),styleSheetRuleCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.StyleSheetRule,...e}}),styleDeclarationCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.StyleDeclaration,...e}}),canvasMutationCb:U,fontCb:e=>F_({type:Vk.IncrementalSnapshot,data:{source:qk.Font,...e}}),selectionCb:e=>{F_({type:Vk.IncrementalSnapshot,data:{source:qk.Selection,...e}})},customElementCb:e=>{F_({type:Vk.IncrementalSnapshot,data:{source:qk.CustomElement,...e}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:z,inlineStylesheet:d,sampling:w,recordDOM:x,recordCanvas:k,inlineImages:E,userTriggeredOnInput:C,collectFonts:I,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:A,blockSelector:i,slimDOMOptions:P,dataURLOptions:b,mirror:J_,iframeManager:W,stylesheetManager:B,shadowDomManager:H,processedNodeManager:G,canvasManager:B_,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=>F_({type:Vk.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};W.addLoadListener(r=>{try{e.push(t(r.contentDocument))}catch(n){}});const r=()=>{U_(),e.push(t(document)),Z_=!0};return["interactive","complete"].includes(document.readyState)?r():(e.push(Ek("DOMContentLoaded",()=>{F_({type:Vk.DomContentLoaded,data:{}}),"DOMContentLoaded"===S&&r()})),e.push(Ek("load",()=>{F_({type:Vk.Load,data:{}}),"load"===S&&r()},window))),()=>{e.forEach(e=>{try{e()}catch(t){String(t).toLowerCase().includes("cross-origin")}}),G.destroy(),Z_=!1,t_=void 0}}catch(V){}}Y_.addCustomEvent=(e,t)=>{if(!Z_)throw new Error("please add custom event after start recording");F_({type:Vk.Custom,data:{tag:e,payload:t}})},Y_.freezePage=()=>{d_.forEach(e=>e.freeze())},Y_.takeFullSnapshot=e=>{if(!Z_)throw new Error("please take full snapshot after start recording");U_(e)},Y_.mirror=J_,(q_=V_||(V_={}))[q_.NotStarted=0]="NotStarted",q_[q_.Running=1]="Running",q_[q_.Stopped=2]="Stopped";var K_=wc("SessionRecorder"),Q_=500,X_=5e5,eS=class{eventQueue=[];estimatedQueueBytes=0;sessionId;stopRecording=null;isRecording=!1;chatId;applicationId;metadataSent=!1;startPromise=null;stopRequested=!1;flushTimer=null;consecutiveFailures=0;constructor(e,t){if(!e||""===e.trim())throw new Error("chatId is required for SessionRecorder");if(!t||t<=0)throw new Error("applicationId (mtxApp) is required for SessionRecorder");K_.info("Constructor called with chatId:",e,"applicationId:",t),this.chatId=e,this.applicationId=t,this.sessionId=e,K_.info("Initialized with sessionId:",this.sessionId)}async sendMetadata(){this.metadataSent?K_.warn("Metadata already sent, skipping"):(K_.info("Sending rrweb/metadata via POST"),await ac.widgetMessage({chat_id:this.chatId,command:{type:"rrweb/metadata",session_id:this.sessionId,chat_id:this.chatId,application_id:this.applicationId,url:window.location.href,user_agent:navigator.userAgent,timestamp:Date.now()}}),this.metadataSent=!0,K_.info("✅ rrweb/metadata sent successfully"))}bufferEvent(e){if(this.eventQueue.push(e),this.estimatedQueueBytes+=JSON.stringify(e).length,this.eventQueue.length>Q_){const e=this.eventQueue.length-Q_,t=this.eventQueue.splice(0,e);for(const r of t)this.estimatedQueueBytes-=JSON.stringify(r).length;K_.warn(`⚠️ Event queue exceeded 500, dropped ${e} oldest events`)}this.estimatedQueueBytes>=5e4?this.flush():this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},500))}flush(){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),0===this.eventQueue.length)return;let e,t;if(this.estimatedQueueBytes<=X_)e=this.eventQueue,t=this.estimatedQueueBytes,this.eventQueue=[],this.estimatedQueueBytes=0;else{for(e=[],t=0;this.eventQueue.length>0;){const r=this.eventQueue[0];if(void 0===r)break;const n=JSON.stringify(r).length;if(t+n>X_&&e.length>0)break;const o=this.eventQueue.shift();void 0!==o&&e.push(o),t+=n,this.estimatedQueueBytes-=n}this.eventQueue.length>0&&!this.flushTimer&&(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},0))}K_.debug(`Flushing ${e.length} events (~${t} bytes)`),ac.widgetMessage({chat_id:this.chatId,command:{type:"rrweb/events",session_id:this.sessionId,events:e}}).then(()=>{this.consecutiveFailures=0}).catch(r=>{const n=null!=r&&"object"==typeof r&&"status"in r?r.status:null;if("number"==typeof n&&n>=400&&n<500)return K_.error(`Dropping ${e.length} events after permanent ${String(n)} error:`,r),void(this.consecutiveFailures=0);if(this.consecutiveFailures++,this.consecutiveFailures>5)return K_.error(`Dropping ${e.length} events after 5 consecutive failures:`,r),void(this.consecutiveFailures=0);if(K_.error(`Failed to flush events (attempt ${this.consecutiveFailures}/5), re-queuing:`,r),this.eventQueue=e.concat(this.eventQueue),this.estimatedQueueBytes+=t,this.eventQueue.length>Q_){const e=this.eventQueue.length-Q_,t=this.eventQueue.splice(0,e);for(const r of t)this.estimatedQueueBytes-=JSON.stringify(r).length;K_.warn(`⚠️ Event queue exceeded 500 after re-queue, dropped ${e} oldest events`)}})}async start(){if(this.isRecording)K_.warn("Recording already started");else{if(this.startPromise)return this.startPromise;this.startPromise=this.doStart();try{await this.startPromise}finally{this.startPromise=null}}}async doStart(){this.stopRequested=!1;try{if(K_.info("🚀 start() called"),await this.sendMetadata(),this.stopRequested)throw new Error("Recording stopped during startup");this.stopRecording=Y_({emit:e=>{this.bufferEvent(e)},recordCanvas:!1,recordCrossOriginIframes:!1,maskAllInputs:!1,collectFonts:!1,inlineStylesheet:!0,blockClass:"rr-block",ignoreClass:"rr-ignore"}),this.isRecording=!0,K_.info("Recording started with chatId:",this.sessionId)}catch(e){throw K_.error("Failed to start recording:",e),e}}stop(){this.stopRequested=!0,this.stopRecording&&(this.stopRecording(),this.stopRecording=null),(this.isRecording||this.eventQueue.length>0)&&this.flush(),this.isRecording=!1,this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.metadataSent=!1,K_.info("Recording stopped")}getSessionId(){return this.sessionId}isActive(){return this.isRecording}},tS=class{config;async validateConfig(e){return this.config=e,e.mtxId&&e.mtxKey?this.validateByMarketrixId(e.mtxId,e.mtxKey):e.mtxApp&&e.mtxAgent?this.validateByAgentAndApplication(e.mtxApp,e.mtxAgent):{isValid:!1,error:"Please provide either (mtxId + mtxKey) OR (mtxApp + mtxAgent)"}}async validateByMarketrixId(e,t){try{const{items:n}=await ac.widgetSearch({marketrix_id:e,marketrix_key:t});if(!n||0===n.length)return{isValid:!1,error:"Widget not found or invalid credentials"};const o=n.find(e=>"widget"===e.type&&"active"===e.status);if(!o){const e=n.filter(e=>"widget"===e.type);return e.length>0?{isValid:!1,error:`Found widget(s) but none are active. Current status(es): ${e.map(e=>e.status).join(", ")}. Please activate the widget in the dashboard.`}:0===n.length?{isValid:!1,error:"No widgets found for the provided marketrix_id and marketrix_key. Please verify your credentials."}:{isValid:!1,error:`No widget found. Found widget type(s): ${n.map(e=>e.type).join(", ")}. Please create a widget.`}}if(!o.agent_id)return{isValid:!1,error:"Widget missing agent_id",widget:o};try{const e=await ac.agentGet({agent_id:o.agent_id});if(!o.application_id)return{isValid:!1,error:"Widget missing application_id",widget:o,agent:e};return{isValid:!0,widget:o,agent:e,application:await ac.applicationGet({application_id:o.application_id})}}catch(r){return{isValid:!1,error:`Failed to validate agent: ${cc(r)}`,widget:o}}}catch(n){return dc(n,"Widget validation",this.config)}}async validateByAgentAndApplication(e,t){try{const r=await ac.applicationGet({application_id:e}),n=await ac.agentGet({agent_id:t});return n.application_id!==e?{isValid:!1,error:`Agent ID ${t} belongs to application ID ${n.application_id}, but provided application ID is ${e}. Please verify the application ID matches the agent's application_id.`,application:r,agent:n}:{isValid:!0,application:r,agent:n}}catch(r){return dc(r,"Agent and application validation",this.config)}}};Vc();var rS=null,nS=class{mtxId;mtxKey;mtxApp;constructor(e,t,r){this.mtxId=e,this.mtxKey=t,this.mtxApp=r}async fetchWidgetSettings(){if(!this.mtxId&&!this.mtxKey&&!this.mtxApp)return null;try{rS||(rS=await ac.widgetGetDefaults({type:"widget"}));const e=rS;if(!e){throw new Error("Failed to fetch default widget settings from API. The API must return widget settings.")}let t=null;if(this.mtxId&&this.mtxKey)t=(await ac.widgetSearch({type:"widget",marketrix_id:this.mtxId,marketrix_key:this.mtxKey})).items;else{if(!this.mtxApp)return null;t=(await ac.widgetSearch({type:"widget",application_id:this.mtxApp})).items}const r=t?.find(e=>"active"===e.status&&"widget"===e.type)||null;if(r?.settings){const t=this.getWidgetSettings(r);if(t){const n={...e,...t};return{...r,settings:n}}}const n=/* @__PURE__ */new Date;return{id:0,application_id:this.mtxApp||0,agent_id:0,type:"widget",settings:e,status:"active",marketrix_id:this.mtxId||"",marketrix_key:this.mtxKey||"",created_at:n,updated_at:n}}catch(e){const t=e instanceof Error?e.message:"Unknown error",r=/* @__PURE__ */new Error(`Failed to fetch widget settings from API: ${t}`);throw r.cause=e,r}}getWidgetSettings(e){if(!e?.settings)return null;const t=e.settings;return function(e){return"object"==typeof e&&null!==e}(r=t)&&Gc(r,"widget_enabled")&&"boolean"==typeof r.widget_enabled&&Gc(r,"widget_appearance")&&"string"==typeof r.widget_appearance&&Gc(r,"widget_position")&&"string"==typeof r.widget_position?t:null;var r}},oS="#6b7280",iS="#1f2937",sS="rgba(255, 255, 255, 0.95)",aS="rgba(255, 255, 255, 0.2)",lS="rgba(0, 0, 0, 0.15)",cS=({message:e="Loading widget settings..."})=>{const[t,r]=h(!1),n=e?.includes("marketrix_id")||e?.includes("marketrix_key");return t?null:/* @__PURE__ */y("div",{className:"marketrix-widget-loader",style:{position:"fixed",bottom:"20px",left:"50%",transform:"translateX(-50%)",maxWidth:"420px",backgroundColor:sS,borderRadius:n?"18px":"999px",boxShadow:`0 2px 12px ${lS}`,display:"flex",flexDirection:"column",alignItems:"stretch",gap:"8px",padding:"10px 12px",border:`1px solid ${aS}`,zIndex:9999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[/* @__PURE__ */y("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[
|
|
107
109
|
/* @__PURE__ */g("img",{src:pd,alt:"",style:{width:"28px",height:"28px",borderRadius:"50%",overflow:"hidden",flexShrink:0}}),
|
|
108
|
-
/* @__PURE__ */g("span",{style:{fontSize:"13px",color:
|
|
109
|
-
/* @__PURE__ */g("button",{type:"button",onClick:()=>n(!0),"aria-label":"Dismiss",style:{background:"none",border:"none",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:Y_,borderRadius:"50%",width:"20px",height:"20px"},children:/* @__PURE__ */g("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:/* @__PURE__ */g("path",{d:"M9 3L3 9M3 3l6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),r?/* @__PURE__ */g("p",{style:{fontSize:"12px",color:Y_,textAlign:"left",margin:0},children:"Please configure marketrix_id and marketrix_key"}):null]})},nS='/*! tailwindcss v4.2.2 | 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-space-y-reverse:0;--tw-space-x-reverse:0;--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-serif:var(--font-serif);--font-mono:var(--font-mono);--color-red-400:oklch(70.4% .191 22.216);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-700:oklch(55.4% .135 66.442);--color-green-100:oklch(96.2% .044 156.743);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--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:var(--shadow-2xs);--shadow-xs:var(--shadow-xs);--shadow-sm:var(--shadow-sm);--shadow-md:var(--shadow-md);--shadow-lg:var(--shadow-lg);--shadow-xl:var(--shadow-xl);--shadow-2xl:var(--shadow-2xl);--ease-in:cubic-bezier(.4, 0, 1, 1);--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;--blur-sm:8px;--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);--shadow:var(--shadow)}}@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,ui-sans-serif, system-ui, 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{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-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-4{top:calc(var(--spacing) * 4)}.top-5{top:calc(var(--spacing) * 5)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-1\\/4{right:25%}.right-2{right:calc(var(--spacing) * 2)}.right-4{right:calc(var(--spacing) * 4)}.right-5{right:calc(var(--spacing) * 5)}.right-full{right:100%}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-1{bottom:calc(var(--spacing) * 1)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-5{bottom:calc(var(--spacing) * 5)}.bottom-16{bottom:calc(var(--spacing) * 16)}.left-0{left:calc(var(--spacing) * 0)}.left-1\\/2{left:50%}.left-1\\/4{left:25%}.left-4{left:calc(var(--spacing) * 4)}.left-5{left:calc(var(--spacing) * 5)}.left-full{left:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\\[calc\\(var\\(--layer-dialog\\)\\+1\\)\\]{z-index:calc(var(--layer-dialog) + 1)}.z-\\[var\\(--layer-dialog\\)\\]{z-index:var(--layer-dialog)}.z-\\[var\\(--layer-popover\\)\\]{z-index:var(--layer-popover)}.z-\\[var\\(--layer-toast\\)\\]{z-index:var(--layer-toast)}.z-\\[var\\(--layer-tooltip\\)\\]{z-index:var(--layer-tooltip)}.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-2{margin:calc(var(--spacing) * 2)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-\\[10px\\]{margin-top:10px}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-2{margin-right:calc(var(--spacing) * 2)}.-mb-1{margin-bottom:calc(var(--spacing) * -1)}.mb-0{margin-bottom:calc(var(--spacing) * 0)}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-9{margin-left:calc(var(--spacing) * 9)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.table{display:table}.h-0{height:calc(var(--spacing) * 0)}.h-0\\.5{height:calc(var(--spacing) * .5)}.h-1\\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.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-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-\\[26px\\]{height:26px}.h-auto{height:auto}.h-full{height:100%}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-\\[85vh\\]{max-height:85vh}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-7{min-height:calc(var(--spacing) * 7)}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-20{min-height:calc(var(--spacing) * 20)}.w-0{width:calc(var(--spacing) * 0)}.w-1\\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.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-64{width:calc(var(--spacing) * 64)}.w-\\[65px\\]{width:65px}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[120px\\]{max-width:120px}.max-w-\\[250px\\]{max-width:250px}.max-w-\\[300px\\]{max-width:300px}.max-w-\\[400px\\]{max-width:400px}.max-w-\\[420px\\]{max-width:420px}.max-w-\\[500px\\]{max-width:500px}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-7{min-width:calc(var(--spacing) * 7)}.min-w-14{min-width:calc(var(--spacing) * 14)}.min-w-\\[65px\\]{min-width:65px}.min-w-\\[140px\\]{min-width:140px}.min-w-\\[180px\\]{min-width:180px}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.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-menu-in{animation:menu-in var(--duration-fade) ease-out}.animate-ping{animation:var(--animate-ping)}.animate-popover-in{animation:popover-in var(--duration-fade) ease-out}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.animate-toast-in{animation:toast-in var(--duration-animation) ease-out}.animate-tooltip-in{animation:tooltip-in var(--duration-fade) ease-out}.cursor-help{cursor:help}.cursor-nesw-resize{cursor:nesw-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-nwse-resize{cursor:nwse-resize}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.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\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[22px\\]{border-radius:22px}.rounded-\\[27px\\]{border-radius:27px}.rounded-\\[var\\(--radius\\)\\]{border-radius:var(--radius)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-l-\\[var\\(--radius\\)\\],.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-tl-\\[var\\(--radius\\)\\],.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tr-\\[var\\(--radius\\)\\],.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-br-\\[var\\(--radius\\)\\],.rounded-br-lg{border-bottom-right-radius:var(--radius)}.rounded-bl-\\[var\\(--radius\\)\\]{border-bottom-left-radius:var(--radius)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.border-r-4{border-right-style:var(--tw-border-style);border-right-width:4px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-border{border-color:var(--border)}.border-current{border-color:currentColor}.border-destructive{border-color:var(--destructive)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-input{border-color:var(--input)}.border-success{border-color:var(--success)}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.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}.border-r-white{border-right-color:var(--color-white)}.border-l-destructive{border-left-color:var(--destructive)}.border-l-primary{border-left-color:var(--primary)}.border-l-success{border-left-color:var(--success)}.border-l-warning{border-left-color:var(--warning)}.bg-background{background-color:var(--background)}.bg-black\\/0{background-color:#0000}@supports (color:color-mix(in lab, red, red)){.bg-black\\/0{background-color:color-mix(in oklab, var(--color-black) 0%, transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-black\\/70{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.bg-black\\/70{background-color:color-mix(in oklab, var(--color-black) 70%, transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-card{background-color:var(--card)}.bg-current{background-color:currentColor}.bg-destructive{background-color:var(--destructive)}.bg-foreground{background-color:var(--foreground)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-700\\/90{background-color:#364153e6}@supports (color:color-mix(in lab, red, red)){.bg-gray-700\\/90{background-color:color-mix(in oklab, var(--color-gray-700) 90%, transparent)}}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-100{background-color:var(--color-green-100)}.bg-popover{background-color:var(--popover)}.bg-primary{background-color:var(--primary)}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.bg-white\\/90{background-color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-\\[right_8px_center\\]{background-position:right 8px center}.bg-\\[right_12px_center\\]{background-position:right 12px center}.bg-\\[right_16px_center\\]{background-position:right 16px center}.bg-no-repeat{background-repeat:no-repeat}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.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-1{padding-inline:calc(var(--spacing) * 1)}.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-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.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-6{padding-block:calc(var(--spacing) * 6)}.py-\\[3px\\]{padding-block:3px}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pr-7{padding-right:calc(var(--spacing) * 7)}.pr-9{padding-right:calc(var(--spacing) * 9)}.pr-11{padding-right:calc(var(--spacing) * 11)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-left{text-align:left}.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-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.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)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-background{color:var(--background)}.text-blue-500{color:var(--color-blue-500)}.text-blue-700{color:var(--color-blue-700)}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-foreground{color:var(--foreground)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-muted-foreground{color:var(--muted-foreground)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-400{color:var(--color-red-400)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-success{color:var(--success)}.text-white{color:var(--color-white)}.text-white\\/70{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.text-white\\/70{color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.text-yellow-700{color:var(--color-yellow-700)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-100{opacity:1}.shadow{--tw-shadow:var(--shadow);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-2xl{--tw-shadow:var(--shadow-2xl);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_1px_4px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{--tw-shadow:0 1px 4px 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-md{--tw-shadow:var(--shadow-md);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;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)}.shadow-xl{--tw-shadow:var(--shadow-xl);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-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));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,)}.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,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-\\[background-color\\,color\\,border-color\\]{transition-property:background-color,color,border-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[color\\,opacity\\]{transition-property:color,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[max-height\\,opacity\\]{transition-property:max-height,opacity;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-500{--tw-duration:.5s;transition-duration:.5s}.duration-\\[160ms\\]{--tw-duration:.16s;transition-duration:.16s}.duration-\\[167ms\\]{--tw-duration:.167s;transition-duration:.167s}.duration-\\[250ms\\]{--tw-duration:.25s;transition-duration:.25s}.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{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.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\\:bg-black\\/20:is(:where(.group):hover *){background-color:#0003}@supports (color:color-mix(in lab, red, red)){.group-hover\\:bg-black\\/20:is(:where(.group):hover *){background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.focus-within\\:border-gray-300:focus-within{border-color:var(--color-gray-300)}@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-muted-foreground:hover{border-color:var(--muted-foreground)}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-destructive\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-destructive\\/90:hover{background-color:color-mix(in oklab, var(--destructive) 90%, transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\\:bg-muted:hover{background-color:var(--muted)}.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\\/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-white:hover{background-color:var(--color-white)}.hover\\:text-blue-600:hover{color:var(--color-blue-600)}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:text-red-800:hover{color:var(--color-red-800)}.hover\\:opacity-80:hover{opacity:.8}.hover\\:opacity-95:hover{opacity:.95}.hover\\:opacity-100:hover{opacity:1}.hover\\:shadow-md:hover{--tw-shadow:var(--shadow-md);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\\:duration-\\[250ms\\]:hover{--tw-duration:.25s;transition-duration:.25s}}.focus\\:border-destructive:focus{border-color:var(--destructive)}.focus\\:border-ring:focus{border-color:var(--ring)}.focus\\:border-success:focus{border-color:var(--success)}.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\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + 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\\:ring-3:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + 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\\:ring-destructive:focus{--tw-ring-color:var(--destructive)}.focus\\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\\:ring-success:focus{--tw-ring-color:var(--success)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.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\\:bg-muted:disabled{background-color:var(--muted)}.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);--popover:oklch(100% 0 0);--popover-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);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--destructive-foreground:oklch(100% 0 0);--success:oklch(60% .2 145);--success-foreground:oklch(100% 0 0);--warning:oklch(75% .18 85);--warning-foreground:oklch(20% 0 0);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--chart-1:oklch(81% .1 252);--chart-2:oklch(62% .19 260);--chart-3:oklch(55% .22 263);--chart-4:oklch(49% .22 264);--chart-5:oklch(42% .18 266);--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0);--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";--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--radius:.625rem;--shadow-x:0;--shadow-y:1px;--shadow-blur:3px;--shadow-spread:0px;--shadow-opacity:.1;--shadow-color:oklch(0% 0 0);--shadow-2xs:0 1px 3px 0px #0000000d;--shadow-xs:0 1px 3px 0px #0000000d;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-md:0 1px 3px 0px #0000001a, 0 2px 4px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--shadow-xl:0 1px 3px 0px #0000001a, 0 8px 10px -1px #0000001a;--shadow-2xl:0 1px 3px 0px #00000040;--tracking-normal:0em;--spacing:.25rem;--duration-animation:.3s;--duration-fade:.2s;--widget-width:400px;--widget-height:520px;--layer-tooltip:1000;--layer-popover:1050;--layer-dialog:1100;--layer-toast:1200}.dark,:host(.dark){--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(26.9% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(37.1% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--destructive-foreground:oklch(98.5% 0 0);--success:oklch(55% .2 145);--success-foreground:oklch(100% 0 0);--warning:oklch(70% .18 85);--warning-foreground:oklch(20% 0 0);--border:oklch(27.5% 0 0);--input:oklch(32.5% 0 0);--ring:oklch(55.6% 0 0);--chart-1:oklch(81% .1 252);--chart-2:oklch(62% .19 260);--chart-3:oklch(55% .22 263);--chart-4:oklch(49% .22 264);--chart-5:oklch(42% .18 266);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(27.5% 0 0);--sidebar-ring:oklch(43.9% 0 0);--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";--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--radius:.625rem;--shadow-x:0;--shadow-y:1px;--shadow-blur:3px;--shadow-spread:0px;--shadow-opacity:.1;--shadow-color:oklch(0% 0 0);--shadow-2xs:0 1px 3px 0px #0000000d;--shadow-xs:0 1px 3px 0px #0000000d;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-md:0 1px 3px 0px #0000001a, 0 2px 4px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--shadow-xl:0 1px 3px 0px #0000001a, 0 8px 10px -1px #0000001a;--shadow-2xl:0 1px 3px 0px #00000040}@media (prefers-reduced-motion:reduce){:root{--duration-animation:0s;--duration-fade:0s}}@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 menu-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes popover-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes tooltip-in{0%{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}}@keyframes toast-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}@keyframes fade-in{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-in-left{0%{opacity:0;transform:translate(-30px)}to{opacity:1;transform:translate(0)}}@keyframes slide-in-right{0%{opacity:0;transform:translate(30px)}to{opacity:1;transform:translate(0)}}.marketrix-widget{font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.marketrix-widget-container{z-index:var(--widget-z-index,1210);pointer-events:auto;position:fixed}.marketrix-widget,.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}.marketrix-widget button,.marketrix-widget input,.marketrix-widget textarea,.marketrix-widget select{font:inherit}[data-resizing=true],[data-resizing=true] *{transition:none!important}.gradient-border{border:2px solid;border-image:linear-gradient(to right, var(--foreground), var(--foreground)) 1}.marketrix-widget ::-webkit-scrollbar{width:6px;height:6px}.marketrix-widget * ::-webkit-scrollbar{width:6px;height:6px}.marketrix-widget ::-webkit-scrollbar-track{background:var(--muted);border-radius:3px}.marketrix-widget * ::-webkit-scrollbar-track{background:var(--muted);border-radius:3px}.marketrix-widget ::-webkit-scrollbar-thumb{background:var(--muted-foreground);border-radius:3px}.marketrix-widget * ::-webkit-scrollbar-thumb{background:var(--muted-foreground);border-radius:3px}.marketrix-widget ::-webkit-scrollbar-thumb:hover{background:var(--foreground)}.marketrix-widget * ::-webkit-scrollbar-thumb:hover{background:var(--foreground)}.marketrix-widget{scrollbar-color:var(--muted) var(--muted-foreground);scrollbar-width:thin}.marketrix-widget ::-webkit-scrollbar-button{width:0;height:0;display:none!important}.marketrix-widget * ::-webkit-scrollbar-button{width:0;height:0;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:start:decrement{display:none!important}.marketrix-widget ::-webkit-scrollbar-button:end:increment{display:none!important}.marketrix-widget * ::-webkit-scrollbar-button:start:decrement{display:none!important}.marketrix-widget * ::-webkit-scrollbar-button:end:increment{display:none!important}.marketrix-widget ::-webkit-scrollbar-corner{display:none!important}.marketrix-widget * ::-webkit-scrollbar-corner{display:none!important}.marketrix-widget ::-webkit-scrollbar-button:vertical:start:decrement{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:vertical:end:increment{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:horizontal:start:decrement{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:horizontal:end:increment{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button{background:0 0!important;border:none!important;width:0!important;height:0!important;display:none!important}@keyframes glow-border-pulse{0%,to{border-color:#fff9;box-shadow:0 0 #ffffff4d,0 0 #1f293766}50%{border-color:#fff;box-shadow:0 0 0 2px #fff9,0 0 0 4px #1f29374d}}@keyframes marketrix-screen-edge-pulse{0%,to{opacity:.55}50%{opacity:1}}.marketrix-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)}}@keyframes messenger-exit{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)translateY(8px)}}.animate-messenger-entrance{animation:.3s cubic-bezier(0,1.2,1,1) messenger-entrance}.animate-messenger-exit{animation:.2s cubic-bezier(.4,0,.2,1) forwards messenger-exit}@keyframes message-enter{0%{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}.animate-message-enter{animation:.2s ease-out message-enter}.view-slide-enter.forward{opacity:0;transform:translate(20px)}.view-slide-enter.back{opacity:0;transform:translate(-20px)}.view-slide-enter-active{opacity:1;transition:transform .15s .15s,opacity .15s .15s;transform:translate(0)}.view-slide-enter-active.forward,.view-slide-enter-active.back{opacity:1;transform:translate(0)}.view-slide-exit-active.forward{opacity:0;transition:transform .15s,opacity .15s;transform:translate(-20px)}.view-slide-exit-active.back{opacity:0;transition:transform .15s,opacity .15s;transform:translate(20px)}@media print{.marketrix-widget{display:none!important}}@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-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@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}}';Uc();var rS=null,oS=null,iS=null,sS=!1,aS=!1,lS=0,cS=(e,t)=>{const n=t||"marketrix-widget-container-"+ ++lS;let r;if(e){if(e.querySelector(`#${n}`))throw new Error(`Widget container with ID ${n} already exists`);r=document.createElement("div"),r.id=n,r.className="marketrix-widget-container",r.style.width="100%",r.style.height="100%",r.style.position="relative",r.style.overflow="visible",e.appendChild(r)}else{if(document.getElementById(n))throw new Error(`Widget container with ID ${n} already exists`);r=document.createElement("div"),r.id=n,r.className="marketrix-widget-container",document.body.appendChild(r)}if(r.style.pointerEvents="auto",!jc(r))throw new Error("Container is not an HTMLElement");if(r.shadowRoot)throw new Error("Container already has a shadow root");const o=r.attachShadow({mode:"closed"}),i=document.createElement("style");if(i.textContent=nS,o.appendChild(i),o.querySelector("#marketrix-widget-root"))throw new Error("Mount element already exists in shadow root");const s=document.createElement("div");return s.id="marketrix-widget-root",s.style.pointerEvents="auto",s.style.width="100%",s.style.height="100%",s.style.position="relative",o.appendChild(s),{container:r,shadowRoot:o,mountEl:s}},dS=(e,n,r=!1)=>{const o=m(e);return o.render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g(od,{previewMode:r,children:/* @__PURE__ */g($h,{config:n})})})),o},uS=e=>{if(!e)throw new Error("Container is required");e.remove()},pS=()=>oS,hS=()=>null!==rS,mS=e=>{sS=e},fS=()=>sS,gS=()=>aS,yS=e=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(iS){const e=document.getElementById("marketrix-widget-loader-container");e&&e.remove(),iS.unmount(),iS=null}if(document.getElementById("marketrix-widget-loader-container"))throw new Error("Widget loader container already exists");const n=document.createElement("div");n.id="marketrix-widget-loader-container",n.className="marketrix-widget-loader-container",document.body.appendChild(n);const r=n.attachShadow({mode:"closed"}),o=document.createElement("style");o.textContent=nS,r.appendChild(o);const i=document.createElement("div");i.id="marketrix-widget-loader-root",r.appendChild(i);const s=m(i);iS=s,s.render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g(tS,{message:e})}))},wS=()=>{if(iS){iS.unmount(),iS=null;const e=document.getElementById("marketrix-widget-loader-container");e&&e.remove()}},bS=null,vS=(e=0)=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(window.__mtx?.state)return;const t=[0,100,500,1e3,2e3];if(!bS)return;const n=document.querySelectorAll("script[mtx-id], script[mtx-app], script[marketrix-id]"),r=(void 0!==document.currentScript&&null!=document.currentScript&&Fc(document.currentScript)&&(document.currentScript.hasAttribute("mtx-id")||document.currentScript.hasAttribute("mtx-app")||document.currentScript.hasAttribute("marketrix-id"))?document.currentScript:null)??n[n.length-1];if(!r||!Fc(r)){if(0===n.length)return void(hS()||fS());if(e<5){return void setTimeout(()=>vS(e+1),t[e]||2e3)}if(hS()||fS())return;return void yS("Please configure mtx-id and mtx-key, or mtx-app and mtx-agent")}const o=r,i=o.getAttribute("mtx-id")||o.getAttribute("marketrix-id"),s=o.getAttribute("mtx-key")||o.getAttribute("marketrix-key"),a=o.getAttribute("mtx-api-host"),l=o.getAttribute("mtx-app"),c=o.getAttribute("mtx-agent"),d=o.getAttribute("mtx-use-screenshare");if(i&&s){const e={mtxId:i,mtxKey:s};a&&(e.mtxApiHost=a),"false"===d&&(e.use_screenshare=!1),bS(e).catch(e=>{})}else if(l&&c){const e=Number.parseInt(l),t=Number.parseInt(c);if(isNaN(e)||isNaN(t))return void yS("Invalid mtx-app or mtx-agent values");const n={mtxApp:e,mtxAgent:t};a&&(n.mtxApiHost=a),"false"===d&&(n.use_screenshare=!1),bS(n).catch(e=>{})}else{if(hS()||fS())return;yS("Please configure mtx-id and mtx-key, or mtx-app and mtx-agent")}};Uc();var xS=null,kS=!1,_S=null,SS=null,CS=null;async function IS(e,t){if(mS(!0),hS())return void mS(!1);if(gS())return void mS(!1);window.__mtx={state:"initializing"},e.mtxApiHost&&Xl(e.mtxApiHost),yS("Validating widget configuration...");const n=await(new V_).validateConfig(e);if(!n.isValid)return yS(n.error||"Widget validation failed. Please check your configuration."),mS(!1),void(window.__mtx=void 0);let r;try{r=await async function(e,t){if(!t.isValid)throw new Error(t.error||"Widget validation failed");yS("Loading widget settings...");try{const t=new J_(e.mtxId,e.mtxKey,e.mtxApp),n=await t.fetchWidgetSettings(),r=n?t.getWidgetSettings(n):null;if(!r)throw new Error("WidgetService did not return widget settings");const o=["widget_enabled","widget_appearance","widget_position","widget_device","widget_header","widget_body","widget_greeting","widget_feature_tell","widget_feature_show","widget_feature_do","widget_feature_human","widget_background_color","widget_text_color","widget_border_color","widget_accent_color","widget_secondary_color","widget_border_radius","widget_font_size","widget_width","widget_height","widget_shadow","widget_animation_duration","widget_fade_duration","widget_bounce_effect","widget_chips"].filter(e=>void 0===r[e]);if(o.length>0)throw new Error(`Widget settings are incomplete. Missing required fields: ${o.join(", ")}. The API must return all widget settings.`);return Dc(r,e)}catch(DS){throw DS}finally{wS()}}(e,n)}catch(s){return yS(s instanceof Error?s.message:"Failed to initialize widget"),mS(!1),void(window.__mtx=void 0)}(e=>{oS=e})(r);const{mountEl:o}=cS(t,`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);var i;i=dS(o,r),rS=i,aS=!0,mS(!1),window.__mtx={state:"active"};try{if(xS&&kS)return;xS&&(xS.stop(),xS=null,kS=!1),CS=new AbortController;const t=(e,t)=>{if(xS&&kS)return;xS=new Z_(t,e),kS=!0;const n=xS;_S=n.start().catch(e=>{xS===n&&(kS=!1)}).finally(()=>{xS===n&&(_S=null)})},n=e=>{const n=Cc.getChatId();n?t(e,n):window.addEventListener("marketrix:chatid",()=>{const n=Cc.getChatId();n&&t(e,n)},{once:!0,signal:CS?.signal})},o=r.mtxApp??e.mtxApp;if(o)n(o);else{const e=zc.getInstance(),t={onRegistered:r=>{r&&n(r),e.removeCallbacks(t)}};e.addCallbacks(t)}}catch(s){kS=!1}}var ES=!1,TS=async(e,t)=>{if(!window.__mtx?.state){if(SS)return SS;if(ES&&SS)return SS;if(ES)return Promise.resolve();if(!hS()&&!gS()){SS=IS(e,t),ES=!0;try{await SS}finally{SS=null,ES=!1}}}},AS=()=>{if(rS){rS.unmount(),rS=null,oS=null,aS=!1;const e=document.querySelector(".marketrix-widget-container");e&&uS(e)}CS?.abort(),CS=null,xS&&(xS.stop(),xS=null,kS=!1,_S=null),SS=null,window.__mtx=void 0,wS()},MS=()=>{xS&&xS.stop()},OS=async()=>{if(!xS)throw new Error("Session recording not available. Ensure the widget is initialized with mtxApiHost and mtxApp.");if(_S&&(await _S.catch(()=>{}),xS?.isActive()))return;if(xS.isActive())return;const e=xS.start();_S=e;try{await e}finally{_S===e&&(_S=null)}},NS=()=>xS?.isActive()??!1,RS=async e=>{if(hS()){const t=pS();if(!t)throw new Error("Widget not initialized");const n={...t,...e};AS(),await TS(n)}},zS=({settings:e,container:t,mtxId:n,mtxKey:r,mtxApiHost:o})=>{const i=p(null),s=p(null),a=p(null),c=p(null);return l(()=>{const l=t??i?.current?.parentElement??document.body;if(!l||!jc(l))return;c.current||(c.current=`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);const{container:d,mountEl:u}=cS(l,c.current);a.current=d;const p={...Dc(e,{mtxId:n,mtxKey:r,mtxApiHost:o}),isPreviewMode:!0,widget_enabled:e.widget_enabled??!0};s.current&&(s.current.unmount(),s.current=null);const h=m(u);return s.current=h,h.render(/* @__PURE__ */g(od,{previewMode:!0,children:/* @__PURE__ */g($h,{config:p})})),()=>{s.current&&(s.current.unmount(),s.current=null),a.current&&(uS(a.current),a.current=null,c.current=null)}},[e,t]),t?null:/* @__PURE__ */g("div",{ref:i,style:{width:"100%",height:"100%",position:"relative"}})},PS=async e=>{mS(!0);const t=e.container;if("settings"in e&&void 0!==e.settings){const{settings:n,container:r,...o}=e,i={...Dc(n,o),isPreviewMode:!0},{mountEl:s}=cS(t,`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);dS(s,i,!0),mS(!1)}else if("mtxId"in e&&void 0!==e.mtxId&&void 0!==e.mtxKey){const{mtxId:n,mtxKey:r,container:o,...i}=e;await TS({mtxId:n,mtxKey:r,...i},t)}else{if(!("mtxApp"in e)||void 0===e.mtxApp||void 0===e.mtxAgent)throw mS(!1),new Error("Invalid configuration: provide either settings (preview), mtxId+mtxKey (production), or mtxApp+mtxAgent (dev)");{const{mtxApp:n,mtxAgent:r,container:o,...i}=e;await TS({mtxApp:n,mtxAgent:r,...i},t)}}};"undefined"!=typeof window&&setTimeout(()=>{try{(e=>{"function"==typeof e&&(bS=e,vS())})(TS)}catch(e){}},0);var LS={MarketrixWidget:zS,mountWidget:PS,initWidget:TS,unmountWidget:AS,updateMarketrixConfig:RS,getCurrentConfig:pS,startRecording:OS,stopRecording:MS,getRecordingState:NS};export{zS as MarketrixWidget,LS as default,pS as getCurrentConfig,NS as getRecordingState,TS as initWidget,PS as mountWidget,OS as startRecording,MS as stopRecording,AS as unmountWidget,RS as updateMarketrixConfig};
|
|
110
|
+
/* @__PURE__ */g("span",{style:{fontSize:"13px",color:iS,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:e}),
|
|
111
|
+
/* @__PURE__ */g("button",{type:"button",onClick:()=>r(!0),"aria-label":"Dismiss",style:{background:"none",border:"none",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:oS,borderRadius:"50%",width:"20px",height:"20px"},children:/* @__PURE__ */g("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:/* @__PURE__ */g("path",{d:"M9 3L3 9M3 3l6 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),n?/* @__PURE__ */g("p",{style:{fontSize:"12px",color:oS,textAlign:"left",margin:0},children:"Please configure marketrix_id and marketrix_key"}):null]})},dS='/*! tailwindcss v4.2.2 | 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-space-y-reverse:0;--tw-space-x-reverse:0;--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-serif:var(--font-serif);--font-mono:var(--font-mono);--color-red-400:oklch(70.4% .191 22.216);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-700:oklch(55.4% .135 66.442);--color-green-100:oklch(96.2% .044 156.743);--color-green-500:oklch(72.3% .219 149.579);--color-green-700:oklch(52.7% .154 150.069);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--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;--font-weight-bold:700;--tracking-normal:0em;--tracking-wide:.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--shadow-2xs:var(--shadow-2xs);--shadow-xs:var(--shadow-xs);--shadow-sm:var(--shadow-sm);--shadow-md:var(--shadow-md);--shadow-lg:var(--shadow-lg);--shadow-xl:var(--shadow-xl);--shadow-2xl:var(--shadow-2xl);--ease-in:cubic-bezier(.4, 0, 1, 1);--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;--blur-sm:8px;--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);--shadow:var(--shadow)}}@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,ui-sans-serif, system-ui, 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{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-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-1\\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-4{top:calc(var(--spacing) * 4)}.top-5{top:calc(var(--spacing) * 5)}.top-full{top:100%}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-1\\/4{right:25%}.right-2{right:calc(var(--spacing) * 2)}.right-4{right:calc(var(--spacing) * 4)}.right-5{right:calc(var(--spacing) * 5)}.right-full{right:100%}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-1{bottom:calc(var(--spacing) * 1)}.bottom-2{bottom:calc(var(--spacing) * 2)}.bottom-5{bottom:calc(var(--spacing) * 5)}.bottom-16{bottom:calc(var(--spacing) * 16)}.left-0{left:calc(var(--spacing) * 0)}.left-1\\/2{left:50%}.left-1\\/4{left:25%}.left-4{left:calc(var(--spacing) * 4)}.left-5{left:calc(var(--spacing) * 5)}.left-full{left:100%}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\\[calc\\(var\\(--layer-dialog\\)\\+1\\)\\]{z-index:calc(var(--layer-dialog) + 1)}.z-\\[var\\(--layer-dialog\\)\\]{z-index:var(--layer-dialog)}.z-\\[var\\(--layer-popover\\)\\]{z-index:var(--layer-popover)}.z-\\[var\\(--layer-toast\\)\\]{z-index:var(--layer-toast)}.z-\\[var\\(--layer-tooltip\\)\\]{z-index:var(--layer-tooltip)}.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-2{margin:calc(var(--spacing) * 2)}.mx-2{margin-inline:calc(var(--spacing) * 2)}.mx-4{margin-inline:calc(var(--spacing) * 4)}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-1\\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-\\[10px\\]{margin-top:10px}.mt-auto{margin-top:auto}.-mr-1{margin-right:calc(var(--spacing) * -1)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-2{margin-right:calc(var(--spacing) * 2)}.-mb-1{margin-bottom:calc(var(--spacing) * -1)}.mb-0{margin-bottom:calc(var(--spacing) * 0)}.mb-0\\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-1\\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-6{margin-bottom:calc(var(--spacing) * 6)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-9{margin-left:calc(var(--spacing) * 9)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.table{display:table}.h-0{height:calc(var(--spacing) * 0)}.h-0\\.5{height:calc(var(--spacing) * .5)}.h-1\\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.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-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-\\[26px\\]{height:26px}.h-auto{height:auto}.h-full{height:100%}.max-h-32{max-height:calc(var(--spacing) * 32)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-\\[85vh\\]{max-height:85vh}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-7{min-height:calc(var(--spacing) * 7)}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-11{min-height:calc(var(--spacing) * 11)}.min-h-20{min-height:calc(var(--spacing) * 20)}.w-0{width:calc(var(--spacing) * 0)}.w-1\\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.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-9{width:calc(var(--spacing) * 9)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-64{width:calc(var(--spacing) * 64)}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[120px\\]{max-width:120px}.max-w-\\[250px\\]{max-width:250px}.max-w-\\[300px\\]{max-width:300px}.max-w-\\[400px\\]{max-width:400px}.max-w-\\[420px\\]{max-width:420px}.max-w-\\[500px\\]{max-width:500px}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-7{min-width:calc(var(--spacing) * 7)}.min-w-9{min-width:calc(var(--spacing) * 9)}.min-w-14{min-width:calc(var(--spacing) * 14)}.min-w-\\[65px\\]{min-width:65px}.min-w-\\[140px\\]{min-width:140px}.min-w-\\[180px\\]{min-width:180px}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.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-\\[glow-border-pulse_2s_ease-in-out_infinite\\]{animation:2s ease-in-out infinite glow-border-pulse}.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-menu-in{animation:menu-in var(--duration-fade) ease-out}.animate-ping{animation:var(--animate-ping)}.animate-popover-in{animation:popover-in var(--duration-fade) ease-out}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.animate-toast-in{animation:toast-in var(--duration-animation) ease-out}.animate-tooltip-in{animation:tooltip-in var(--duration-fade) ease-out}.cursor-help{cursor:help}.cursor-nesw-resize{cursor:nesw-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-nwse-resize{cursor:nwse-resize}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.appearance-none{appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.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\\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-0\\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing) * 2) * var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-x-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-\\[22px\\]{border-radius:22px}.rounded-\\[27px\\]{border-radius:27px}.rounded-\\[var\\(--radius\\)\\]{border-radius:var(--radius)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-l-\\[var\\(--radius\\)\\],.rounded-l-lg{border-top-left-radius:var(--radius);border-bottom-left-radius:var(--radius)}.rounded-tl-\\[var\\(--radius\\)\\],.rounded-tl-lg{border-top-left-radius:var(--radius)}.rounded-tr-\\[var\\(--radius\\)\\],.rounded-tr-lg{border-top-right-radius:var(--radius)}.rounded-br-\\[var\\(--radius\\)\\],.rounded-br-lg{border-bottom-right-radius:var(--radius)}.rounded-bl-\\[var\\(--radius\\)\\]{border-bottom-left-radius:var(--radius)}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.border-r-4{border-right-style:var(--tw-border-style);border-right-width:4px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-border{border-color:var(--border)}.border-current{border-color:currentColor}.border-destructive{border-color:var(--destructive)}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-input{border-color:var(--input)}.border-primary{border-color:var(--primary)}.border-success{border-color:var(--success)}.border-transparent{border-color:#0000}.border-white{border-color:var(--color-white)}.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}.border-r-white{border-right-color:var(--color-white)}.border-l-destructive{border-left-color:var(--destructive)}.border-l-primary{border-left-color:var(--primary)}.border-l-success{border-left-color:var(--success)}.border-l-warning{border-left-color:var(--warning)}.bg-background,.bg-background\\/60{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\/60{background-color:color-mix(in oklab, var(--background) 60%, transparent)}}.bg-background\\/70{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\/70{background-color:color-mix(in oklab, var(--background) 70%, transparent)}}.bg-black\\/0{background-color:#0000}@supports (color:color-mix(in lab, red, red)){.bg-black\\/0{background-color:color-mix(in oklab, var(--color-black) 0%, transparent)}}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-black\\/70{background-color:#000000b3}@supports (color:color-mix(in lab, red, red)){.bg-black\\/70{background-color:color-mix(in oklab, var(--color-black) 70%, transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-card,.bg-card\\/70{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\\/70{background-color:color-mix(in oklab, var(--card) 70%, transparent)}}.bg-current{background-color:currentColor}.bg-destructive{background-color:var(--destructive)}.bg-foreground{background-color:var(--foreground)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-700\\/90{background-color:#364153e6}@supports (color:color-mix(in lab, red, red)){.bg-gray-700\\/90{background-color:color-mix(in oklab, var(--color-gray-700) 90%, transparent)}}.bg-gray-900{background-color:var(--color-gray-900)}.bg-green-100{background-color:var(--color-green-100)}.bg-green-500{background-color:var(--color-green-500)}.bg-popover{background-color:var(--popover)}.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}.bg-white{background-color:var(--color-white)}.bg-white\\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.bg-white\\/90{background-color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-yellow-500{background-color:var(--color-yellow-500)}.bg-\\[right_8px_center\\]{background-position:right 8px center}.bg-\\[right_12px_center\\]{background-position:right 12px center}.bg-\\[right_16px_center\\]{background-position:right 16px center}.bg-no-repeat{background-repeat:no-repeat}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.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-1{padding-inline:calc(var(--spacing) * 1)}.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-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0{padding-block:calc(var(--spacing) * 0)}.py-0\\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.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-6{padding-block:calc(var(--spacing) * 6)}.py-\\[3px\\]{padding-block:3px}.pt-0{padding-top:calc(var(--spacing) * 0)}.pt-0\\.5{padding-top:calc(var(--spacing) * .5)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pr-7{padding-right:calc(var(--spacing) * 7)}.pr-9{padding-right:calc(var(--spacing) * 9)}.pr-11{padding-right:calc(var(--spacing) * 11)}.pb-1\\.5{padding-bottom:calc(var(--spacing) * 1.5)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-left{text-align:left}.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-\\[9px\\]{font-size:9px}.text-\\[10px\\]{font-size:10px}.text-\\[11px\\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.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-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.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)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-background{color:var(--background)}.text-blue-500{color:var(--color-blue-500)}.text-blue-700{color:var(--color-blue-700)}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-foreground{color:var(--foreground)}.text-foreground-faint{color:var(--foreground-faint)}.text-foreground-muted{color:var(--foreground-muted)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-green-700{color:var(--color-green-700)}.text-muted-foreground{color:var(--muted-foreground)}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-400{color:var(--color-red-400)}.text-red-600{color:var(--color-red-600)}.text-red-700{color:var(--color-red-700)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-success{color:var(--success)}.text-white{color:var(--color-white)}.text-white\\/70{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.text-white\\/70{color:color-mix(in oklab, var(--color-white) 70%, transparent)}}.text-yellow-700{color:var(--color-yellow-700)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-100{opacity:1}.shadow{--tw-shadow:var(--shadow);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\\[0_1px_4px_rgba\\(0\\,0\\,0\\,0\\.1\\)\\]{--tw-shadow:0 1px 4px 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-\\[var\\(--shadow\\)\\]{--tw-shadow:var(--shadow);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-md{--tw-shadow:var(--shadow-md);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-none{--tw-shadow:0 0 #0000;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)}.shadow-xl{--tw-shadow:var(--shadow-xl);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-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));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,)}.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,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-\\[background-color\\,color\\,border-color\\]{transition-property:background-color,color,border-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[color\\,opacity\\]{transition-property:color,opacity;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-500{--tw-duration:.5s;transition-duration:.5s}.duration-\\[160ms\\]{--tw-duration:.16s;transition-duration:.16s}.duration-\\[167ms\\]{--tw-duration:.167s;transition-duration:.167s}.duration-\\[250ms\\]{--tw-duration:.25s;transition-duration:.25s}.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{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.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\\:bg-black\\/20:is(:where(.group):hover *){background-color:#0003}@supports (color:color-mix(in lab, red, red)){.group-hover\\:bg-black\\/20:is(:where(.group):hover *){background-color:color-mix(in oklab, var(--color-black) 20%, transparent)}}.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-muted-foreground:hover{border-color:var(--muted-foreground)}.hover\\:bg-accent:hover{background-color:var(--accent)}.hover\\:bg-destructive\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-destructive\\/90:hover{background-color:color-mix(in oklab, var(--destructive) 90%, transparent)}}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-gray-800:hover{background-color:var(--color-gray-800)}.hover\\:bg-muted:hover{background-color:var(--muted)}.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-bg:hover{background-color:var(--secondary-bg)}.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-white:hover{background-color:var(--color-white)}.hover\\:text-blue-600:hover{color:var(--color-blue-600)}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:text-red-800:hover{color:var(--color-red-800)}.hover\\:opacity-80:hover{opacity:.8}.hover\\:opacity-95:hover{opacity:.95}.hover\\:opacity-100:hover{opacity:1}.hover\\:shadow-md:hover{--tw-shadow:var(--shadow-md);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.hover\\:duration-\\[250ms\\]:hover{--tw-duration:.25s;transition-duration:.25s}}.focus\\:border-destructive:focus{border-color:var(--destructive)}.focus\\:border-ring:focus{border-color:var(--ring)}.focus\\:border-success:focus{border-color:var(--success)}.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\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + 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\\:ring-3:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + 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\\:ring-destructive:focus{--tw-ring-color:var(--destructive)}.focus\\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\\:ring-success:focus{--tw-ring-color:var(--success)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.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\\:bg-muted:disabled{background-color:var(--muted)}.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);--popover:oklch(100% 0 0);--popover-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);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--destructive:oklch(57.7% .245 27.325);--destructive-foreground:oklch(100% 0 0);--success:oklch(60% .2 145);--success-foreground:oklch(100% 0 0);--warning:oklch(75% .18 85);--warning-foreground:oklch(20% 0 0);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--chart-1:oklch(81% .1 252);--chart-2:oklch(62% .19 260);--chart-3:oklch(55% .22 263);--chart-4:oklch(49% .22 264);--chart-5:oklch(42% .18 266);--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0);--foreground-muted:#1f293799;--foreground-faint:#1f293766;--border-muted:#e5e7eb4d;--primary-hover:#3b82f6d9;--primary-muted:#3b82f64d;--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";--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--radius:.625rem;--shadow-x:0;--shadow-y:1px;--shadow-blur:3px;--shadow-spread:0px;--shadow-opacity:.1;--shadow-color:oklch(0% 0 0);--shadow-2xs:0 1px 3px 0px #0000000d;--shadow-xs:0 1px 3px 0px #0000000d;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-md:0 1px 3px 0px #0000001a, 0 2px 4px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--shadow-xl:0 1px 3px 0px #0000001a, 0 8px 10px -1px #0000001a;--shadow-2xl:0 1px 3px 0px #00000040;--tracking-normal:0em;--spacing:.25rem;--duration-animation:.3s;--duration-fade:.2s;--widget-width:400px;--widget-height:520px;--layer-tooltip:1000;--layer-popover:1050;--layer-dialog:1100;--layer-toast:1200}.dark,:host(.dark){--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(26.9% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--accent:oklch(37.1% 0 0);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--destructive-foreground:oklch(98.5% 0 0);--success:oklch(55% .2 145);--success-foreground:oklch(100% 0 0);--warning:oklch(70% .18 85);--warning-foreground:oklch(20% 0 0);--border:oklch(27.5% 0 0);--input:oklch(32.5% 0 0);--ring:oklch(55.6% 0 0);--chart-1:oklch(81% .1 252);--chart-2:oklch(62% .19 260);--chart-3:oklch(55% .22 263);--chart-4:oklch(49% .22 264);--chart-5:oklch(42% .18 266);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(27.5% 0 0);--sidebar-ring:oklch(43.9% 0 0);--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";--font-serif:ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--radius:.625rem;--shadow-x:0;--shadow-y:1px;--shadow-blur:3px;--shadow-spread:0px;--shadow-opacity:.1;--shadow-color:oklch(0% 0 0);--shadow-2xs:0 1px 3px 0px #0000000d;--shadow-xs:0 1px 3px 0px #0000000d;--shadow-sm:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow:0 1px 3px 0px #0000001a, 0 1px 2px -1px #0000001a;--shadow-md:0 1px 3px 0px #0000001a, 0 2px 4px -1px #0000001a;--shadow-lg:0 1px 3px 0px #0000001a, 0 4px 6px -1px #0000001a;--shadow-xl:0 1px 3px 0px #0000001a, 0 8px 10px -1px #0000001a;--shadow-2xl:0 1px 3px 0px #00000040}@media (prefers-reduced-motion:reduce){:root{--duration-animation:0s;--duration-fade:0s}}@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 menu-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes popover-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}@keyframes tooltip-in{0%{opacity:0;transform:scale(.96)}to{opacity:1;transform:scale(1)}}@keyframes toast-in{0%{opacity:0;transform:translate(100%)}to{opacity:1;transform:translate(0)}}@keyframes fade-in{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes slide-in-left{0%{opacity:0;transform:translate(-30px)}to{opacity:1;transform:translate(0)}}@keyframes slide-in-right{0%{opacity:0;transform:translate(30px)}to{opacity:1;transform:translate(0)}}.marketrix-widget{font-family:var(--font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.marketrix-widget-container{z-index:var(--widget-z-index,1210);pointer-events:auto;position:fixed}.marketrix-widget,.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}.marketrix-widget button,.marketrix-widget input,.marketrix-widget textarea,.marketrix-widget select{font:inherit}[data-resizing=true],[data-resizing=true] *{transition:none!important}.gradient-border{border:2px solid;border-image:linear-gradient(to right, var(--foreground), var(--foreground)) 1}.marketrix-widget ::-webkit-scrollbar{width:6px;height:6px}.marketrix-widget * ::-webkit-scrollbar{width:6px;height:6px}.marketrix-widget ::-webkit-scrollbar-track{background:var(--muted);border-radius:3px}.marketrix-widget * ::-webkit-scrollbar-track{background:var(--muted);border-radius:3px}.marketrix-widget ::-webkit-scrollbar-thumb{background:var(--muted-foreground);border-radius:3px}.marketrix-widget * ::-webkit-scrollbar-thumb{background:var(--muted-foreground);border-radius:3px}.marketrix-widget ::-webkit-scrollbar-thumb:hover{background:var(--foreground)}.marketrix-widget * ::-webkit-scrollbar-thumb:hover{background:var(--foreground)}.marketrix-widget{scrollbar-color:var(--muted) var(--muted-foreground);scrollbar-width:thin}.marketrix-widget ::-webkit-scrollbar-button{width:0;height:0;display:none!important}.marketrix-widget * ::-webkit-scrollbar-button{width:0;height:0;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:start:decrement{display:none!important}.marketrix-widget ::-webkit-scrollbar-button:end:increment{display:none!important}.marketrix-widget * ::-webkit-scrollbar-button:start:decrement{display:none!important}.marketrix-widget * ::-webkit-scrollbar-button:end:increment{display:none!important}.marketrix-widget ::-webkit-scrollbar-corner{display:none!important}.marketrix-widget * ::-webkit-scrollbar-corner{display:none!important}.marketrix-widget ::-webkit-scrollbar-button:vertical:start:decrement{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:vertical:end:increment{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:horizontal:start:decrement{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button:horizontal:end:increment{width:0!important;height:0!important;display:none!important}.marketrix-widget ::-webkit-scrollbar-button{background:0 0!important;border:none!important;width:0!important;height:0!important;display:none!important}@keyframes glow-border-pulse{0%,to{border-color:#fff9;box-shadow:0 0 #ffffff4d,0 0 #1f293766}50%{border-color:#fff;box-shadow:0 0 0 2px #fff9,0 0 0 4px #1f29374d}}@keyframes marketrix-screen-edge-pulse{0%,to{opacity:.55}50%{opacity:1}}.marketrix-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)}}@keyframes messenger-exit{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.95)translateY(8px)}}.animate-messenger-entrance{animation:.3s cubic-bezier(0,1.2,1,1) messenger-entrance}.animate-messenger-exit{animation:.2s cubic-bezier(.4,0,.2,1) forwards messenger-exit}@keyframes message-enter{0%{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}.animate-message-enter{animation:.2s ease-out message-enter}.view-slide-enter.forward{opacity:0;transform:translate(20px)}.view-slide-enter.back{opacity:0;transform:translate(-20px)}.view-slide-enter-active{opacity:1;transition:transform .15s .15s,opacity .15s .15s;transform:translate(0)}.view-slide-enter-active.forward,.view-slide-enter-active.back{opacity:1;transform:translate(0)}.view-slide-exit-active.forward{opacity:0;transition:transform .15s,opacity .15s;transform:translate(-20px)}.view-slide-exit-active.back{opacity:0;transition:transform .15s,opacity .15s;transform:translate(20px)}@media print{.marketrix-widget{display:none!important}}@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-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@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}}';Vc();var uS=null,pS=null,hS=null,mS=!1,fS=!1,gS=0,yS=(e,t)=>{const r=t||"marketrix-widget-container-"+ ++gS;let n;if(e){if(e.querySelector(`#${r}`))throw new Error(`Widget container with ID ${r} already exists`);n=document.createElement("div"),n.id=r,n.className="marketrix-widget-container",n.style.width="100%",n.style.height="100%",n.style.position="relative",n.style.overflow="visible",e.appendChild(n)}else{if(document.getElementById(r))throw new Error(`Widget container with ID ${r} already exists`);n=document.createElement("div"),n.id=r,n.className="marketrix-widget-container",document.body.appendChild(n)}if(n.style.pointerEvents="auto",!Hc(n))throw new Error("Container is not an HTMLElement");if(n.shadowRoot)throw new Error("Container already has a shadow root");const o=n.attachShadow({mode:"closed"}),i=document.createElement("style");if(i.textContent=dS,o.appendChild(i),o.querySelector("#marketrix-widget-root"))throw new Error("Mount element already exists in shadow root");const s=document.createElement("div");return s.id="marketrix-widget-root",s.style.pointerEvents="auto",s.style.width="100%",s.style.height="100%",s.style.position="relative",o.appendChild(s),{container:n,shadowRoot:o,mountEl:s}},wS=(e,r,n=!1)=>{const o=m(e);return o.render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g(dd,{previewMode:n,children:/* @__PURE__ */g(Zh,{config:r})})})),o},bS=e=>{if(!e)throw new Error("Container is required");e.remove()},vS=()=>pS,xS=()=>null!==uS,kS=e=>{mS=e},_S=()=>mS,SS=()=>fS,CS=e=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(hS){const e=document.getElementById("marketrix-widget-loader-container");e&&e.remove(),hS.unmount(),hS=null}if(document.getElementById("marketrix-widget-loader-container"))throw new Error("Widget loader container already exists");const r=document.createElement("div");r.id="marketrix-widget-loader-container",r.className="marketrix-widget-loader-container",document.body.appendChild(r);const n=r.attachShadow({mode:"closed"}),o=document.createElement("style");o.textContent=dS,n.appendChild(o);const i=document.createElement("div");i.id="marketrix-widget-loader-root",n.appendChild(i);const s=m(i);hS=s,s.render(/* @__PURE__ */g(t.StrictMode,{children:/* @__PURE__ */g(cS,{message:e})}))},IS=()=>{if(hS){hS.unmount(),hS=null;const e=document.getElementById("marketrix-widget-loader-container");e&&e.remove()}},ES=null,TS=(e=0)=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(window.__mtx?.state)return;const t=[0,100,500,1e3,2e3];if(!ES)return;const r=document.querySelectorAll("script[mtx-id], script[mtx-app], script[marketrix-id]"),n=(void 0!==document.currentScript&&null!=document.currentScript&&Zc(document.currentScript)&&(document.currentScript.hasAttribute("mtx-id")||document.currentScript.hasAttribute("mtx-app")||document.currentScript.hasAttribute("marketrix-id"))?document.currentScript:null)??r[r.length-1];if(!n||!Zc(n)){if(0===r.length)return void(xS()||_S());if(e<5){return void setTimeout(()=>TS(e+1),t[e]||2e3)}if(xS()||_S())return;return void CS("Please configure mtx-id and mtx-key, or mtx-app and mtx-agent")}const o=n,i=o.getAttribute("mtx-id")||o.getAttribute("marketrix-id"),s=o.getAttribute("mtx-key")||o.getAttribute("marketrix-key"),a=o.getAttribute("mtx-api-host"),l=o.getAttribute("mtx-app"),c=o.getAttribute("mtx-agent"),d=o.getAttribute("mtx-use-screenshare");if(i&&s){const e={mtxId:i,mtxKey:s};a&&(e.mtxApiHost=a),"false"===d&&(e.use_screenshare=!1),ES(e).catch(e=>{})}else if(l&&c){const e=Number.parseInt(l),t=Number.parseInt(c);if(isNaN(e)||isNaN(t))return void CS("Invalid mtx-app or mtx-agent values");const r={mtxApp:e,mtxAgent:t};a&&(r.mtxApiHost=a),"false"===d&&(r.use_screenshare=!1),ES(r).catch(e=>{})}else{if(xS()||_S())return;CS("Please configure mtx-id and mtx-key, or mtx-app and mtx-agent")}};Vc();var AS=null,MS=!1,OS=null,NS=null,RS=null;async function zS(e,t){if(kS(!0),xS())return void kS(!1);if(SS())return void kS(!1);window.__mtx={state:"initializing"},e.mtxApiHost&&ic(e.mtxApiHost),CS("Validating widget configuration...");const r=await(new tS).validateConfig(e);if(!r.isValid)return CS(r.error||"Widget validation failed. Please check your configuration."),kS(!1),void(window.__mtx=void 0);let n;try{n=await async function(e,t){if(!t.isValid)throw new Error(t.error||"Widget validation failed");CS("Loading widget settings...");try{const t=new nS(e.mtxId,e.mtxKey,e.mtxApp),r=await t.fetchWidgetSettings(),n=r?t.getWidgetSettings(r):null;if(!n)throw new Error("WidgetService did not return widget settings");const o=["widget_enabled","widget_appearance","widget_position","widget_device","widget_header","widget_body","widget_greeting","widget_feature_tell","widget_feature_show","widget_feature_do","widget_feature_human","widget_background_color","widget_text_color","widget_border_color","widget_accent_color","widget_secondary_color","widget_border_radius","widget_font_size","widget_width","widget_height","widget_shadow","widget_animation_duration","widget_fade_duration","widget_bounce_effect","widget_chips"].filter(e=>void 0===n[e]);if(o.length>0)throw new Error(`Widget settings are incomplete. Missing required fields: ${o.join(", ")}. The API must return all widget settings.`);return Wc(n,e)}catch(HS){throw HS}finally{IS()}}(e,r)}catch(s){return CS(s instanceof Error?s.message:"Failed to initialize widget"),kS(!1),void(window.__mtx=void 0)}(e=>{pS=e})(n);const{mountEl:o}=yS(t,`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);var i;i=wS(o,n),uS=i,fS=!0,kS(!1),window.__mtx={state:"active"};try{if(AS&&MS)return;AS&&(AS.stop(),AS=null,MS=!1),RS=new AbortController;const t=(e,t)=>{if(AS&&MS)return;AS=new eS(t,e),MS=!0;const r=AS;OS=r.start().catch(e=>{AS===r&&(MS=!1)}).finally(()=>{AS===r&&(OS=null)})},r=e=>{const r=Oc.getChatId();r?t(e,r):window.addEventListener("marketrix:chatid",()=>{const r=Oc.getChatId();r&&t(e,r)},{once:!0,signal:RS?.signal})},o=n.mtxApp??e.mtxApp;if(o)r(o);else{const e=Fc.getInstance(),t={onRegistered:n=>{n&&r(n),e.removeCallbacks(t)}};e.addCallbacks(t)}}catch(s){MS=!1}}var PS=!1,LS=async(e,t)=>{if(!window.__mtx?.state){if(NS)return NS;if(PS&&NS)return NS;if(PS)return Promise.resolve();if(!xS()&&!SS()){NS=zS(e,t),PS=!0;try{await NS}finally{NS=null,PS=!1}}}},DS=()=>{if(uS){uS.unmount(),uS=null,pS=null,fS=!1;const e=document.querySelector(".marketrix-widget-container");e&&bS(e)}RS?.abort(),RS=null,AS&&(AS.stop(),AS=null,MS=!1,OS=null),NS=null,window.__mtx=void 0,IS()},$S=()=>{AS&&AS.stop()},jS=async()=>{if(!AS)throw new Error("Session recording not available. Ensure the widget is initialized with mtxApiHost and mtxApp.");if(OS&&(await OS.catch(()=>{}),AS?.isActive()))return;if(AS.isActive())return;const e=AS.start();OS=e;try{await e}finally{OS===e&&(OS=null)}},FS=()=>AS?.isActive()??!1,US=async e=>{if(xS()){const t=vS();if(!t)throw new Error("Widget not initialized");const r={...t,...e};DS(),await LS(r)}},BS=({settings:e,container:t,mtxId:r,mtxKey:n,mtxApiHost:o})=>{const i=p(null),s=p(null),a=p(null),c=p(null);return l(()=>{const l=t??i?.current?.parentElement??document.body;if(!l||!Hc(l))return;c.current||(c.current=`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);const{container:d,mountEl:u}=yS(l,c.current);a.current=d;const p={...Wc(e,{mtxId:r,mtxKey:n,mtxApiHost:o}),isPreviewMode:!0,widget_enabled:e.widget_enabled??!0};s.current&&(s.current.unmount(),s.current=null);const h=m(u);return s.current=h,h.render(/* @__PURE__ */g(dd,{previewMode:!0,children:/* @__PURE__ */g(Zh,{config:p})})),()=>{s.current&&(s.current.unmount(),s.current=null),a.current&&(bS(a.current),a.current=null,c.current=null)}},[e,t]),t?null:/* @__PURE__ */g("div",{ref:i,style:{width:"100%",height:"100%",position:"relative"}})},WS=async e=>{kS(!0);const t=e.container;if("settings"in e&&void 0!==e.settings){const{settings:r,container:n,...o}=e,i={...Wc(r,o),isPreviewMode:!0},{mountEl:s}=yS(t,`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);wS(s,i,!0),kS(!1)}else if("mtxId"in e&&void 0!==e.mtxId&&void 0!==e.mtxKey){const{mtxId:r,mtxKey:n,container:o,...i}=e;await LS({mtxId:r,mtxKey:n,...i},t)}else{if(!("mtxApp"in e)||void 0===e.mtxApp||void 0===e.mtxAgent)throw kS(!1),new Error("Invalid configuration: provide either settings (preview), mtxId+mtxKey (production), or mtxApp+mtxAgent (dev)");{const{mtxApp:r,mtxAgent:n,container:o,...i}=e;await LS({mtxApp:r,mtxAgent:n,...i},t)}}};"undefined"!=typeof window&&setTimeout(()=>{try{(e=>{"function"==typeof e&&(ES=e,TS())})(LS)}catch(e){}},0);var GS={MarketrixWidget:BS,mountWidget:WS,initWidget:LS,unmountWidget:DS,updateMarketrixConfig:US,getCurrentConfig:vS,startRecording:jS,stopRecording:$S,getRecordingState:FS};export{BS as MarketrixWidget,GS as default,vS as getCurrentConfig,FS as getRecordingState,LS as initWidget,WS as mountWidget,jS as startRecording,$S as stopRecording,DS as unmountWidget,US as updateMarketrixConfig};
|
|
110
112
|
//# sourceMappingURL=widget.mjs.map
|