@marketrix.ai/widget 3.3.79 → 3.3.81
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/sdk/index.d.ts +23 -0
- package/dist/src/sdk/index.d.ts.map +1 -1
- package/dist/src/sdk/routes.d.ts +23 -0
- package/dist/src/sdk/routes.d.ts.map +1 -1
- package/dist/src/sdk/schema.d.ts +14 -0
- package/dist/src/sdk/schema.d.ts.map +1 -1
- package/dist/src/services/SessionRecorder.d.ts.map +1 -1
- package/dist/widget.mjs +3 -3
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/dist/widget.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import*as e from"react";import t,{createContext as n,createElement as r,forwardRef as i,useCallback as o,useContext as s,useEffect as a,useId as l,useLayoutEffect as c,useMemo as d,useRef as u,useState as p}from"react";import{createRoot as h}from"react-dom/client";import{Fragment as m,jsx as f,jsxs as g}from"react/jsx-runtime";var y=2147483002,w=2147483001,b=2147483005;function v(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 x(e){return function(e){const t=v(e);if(!t)return.5;const[n,r,i]=[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*i}(e)>.5?"#000000":"#ffffff"}function k(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=v(e);return n?`rgba(${n.r}, ${n.g}, ${n.b}, ${t})`:(e.includes("gradient")||e.includes("linear-gradient"),e)}function _(e,t){const n=v(e);if(!n)return e;const r=1-t;return i=Math.round(n.r*r),o=Math.round(n.g*r),s=Math.round(n.b*r),`#${[i,o,s].map(e=>e.toString(16).padStart(2,"0")).join("")}`;var i,o,s}var S=e=>e?e.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):/* @__PURE__ */(new Date).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),C=e=>{switch(e){case"show":return"Show";case"tell":return"Tell";case"do":return"Do";default:return e}},I={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 E(e){return{color:{background:e.widget_background_color,foreground:e.widget_text_color,foregroundMuted:k(e.widget_text_color,.6),foregroundFaint:k(e.widget_text_color,.4),border:e.widget_border_color,borderMuted:k(e.widget_border_color,.3),primary:e.widget_accent_color,primaryForeground:x(e.widget_accent_color),primaryHover:k(e.widget_accent_color,.85),primaryMuted:k(e.widget_accent_color,.3),secondary:e.widget_secondary_color,secondaryForeground:"#ffffff",secondaryBg:k(e.widget_secondary_color,.2),secondaryHover:k(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}}}E(I);function T(e){return Array.isArray(e)?e:null==e?[]:[e]}var A="orpc",M=class extends Error{constructor(...e){super(...e),this.name="AbortError"}};function z(e){let t;return()=>{if(t)return t.result;const n=e();return t={result:n},n}}function O(){return globalThis["__@orpc/shared@1.13.14/otel/config__"]}function R(e,t={},n){return(O()?.tracer)?.startSpan(e,t,n)}function P(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 N({name:e,context:t,...n},r){const i=O()?.tracer;if(!i)return r();const o=async e=>{try{return await r(e)}catch(t){throw P(e,t,n),t}finally{e.end()}};return t?i.startActiveSpan(e,n,t,o):i.startActiveSpan(e,n,o)}async function L(e,t){const n=O();if(!e||!n)return t();const r=n.trace.setSpan(n.context.active(),e);return n.context.with(r,t)}function D(e){return!(!e||"object"!=typeof e)&&("next"in e&&"function"==typeof e.next&&Symbol.asyncIterator in e&&"function"==typeof e[Symbol.asyncIterator])}var $=Symbol.asyncDispose??Symbol.for("asyncDispose"),j=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[$](){this.#e=!0,this.#t||(this.#t=!0,await this.#n("dispose"))}[Symbol.asyncIterator](){return this}};function F({name:e,...t},n){let r;return new j(async()=>{r??=R(e);try{const e=await L(r,()=>n.next());return r?.addEvent(e.done?"completed":"yielded"),e}catch(i){throw P(r,i,t),i}},async e=>{try{"next"!==e&&await L(r,()=>n.return?.())}catch(i){throw P(r,i,t),i}finally{r?.end()}})}function U(e,t,n){const r=(t,i)=>{const o=e[i];return o?o({...t,next:(e=t)=>r(e,i+1)}):n(t)};return r(t,0)}function B(e){if(e)return JSON.parse(e)}function W(e){return JSON.stringify(e)}function G(e){if(!e||"object"!=typeof e)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||!t||!t.constructor}function H(e){return!!e&&("object"==typeof e||"function"==typeof e)}function Z(e,...t){return"function"==typeof e?e(...t):e}function V(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)&&q.test(t.toString()));var t}))return Reflect.apply(t,n,r);let i=!0;r[0].call(n,V(new Proxy(e,{get:(e,t,n)=>{if(!i||"then"!==t)return Reflect.get(e,t,n);i=!1}})))}})}})}var q=/^\s*function\s*\(\)\s*\{\s*\[native code\]\s*\}\s*$/;var Y={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 J=Symbol.for("__@orpc/client@1.13.14/error/ORPC_ERROR_CONSTRUCTORS__");globalThis[J]??=/* @__PURE__ */new WeakSet;var K=globalThis[J],Q=class extends Error{defined;code;status;data;constructor(e,...t){const n=function(e){return e[0]??{}}(t);if(void 0!==n.status&&!X(n.status))throw new Error("[ORPCError] Invalid error status code.");const r=function(e,t){return t||Y[e]?.message||e}(e,n.message);super(r,n),this.code=e,this.status=function(e,t){return t??Y[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(K.has(this)){const t=function(e){return H(e)?Object.getPrototypeOf(e)?.constructor:null}(e);if(t&&K.has(t))return!0}return super[Symbol.hasInstance](e)}};function X(e){return e<200||e>=400}function ee(e){if(!G(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&&X(e.status)&&"message"in e&&"string"==typeof e.message)}function te(e,t={}){return new Q(e.code,{...t,...e})}K.add(Q);var ne=class extends TypeError{},re=class extends TypeError{},ie=class extends Error{data;constructor(e){super(e?.message??"An error event was received",e),this.data=e?.data}};function oe(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),i=-1===e?"":r.slice(e+1).replace(/^\s/,"");if(0===e)n.comments.push(i);else if("data"===t)n.data??="",n.data+=`${i}\n`;else if("event"===t)n.event=i;else if("id"===t)n.id=i;else if("retry"===t){const e=Number.parseInt(i);Number.isInteger(e)&&e>=0&&e.toString()===i&&(n.retry=e)}}return n.data=n.data?.replace(/\n$/,""),n}var se=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=oe(`${r}\n\n`);this.options.onEvent&&this.options.onEvent(e)}}end(){if(this.incomplete)throw new re("Event Iterator ended before complete")}},ae=class extends TransformStream{constructor(){let e;super({start(t){e=new se({onEvent:e=>{t.enqueue(e)}})},transform(t){e.feed(t)},flush(){e.end()}})}};function le(e){if(e.includes("\n"))throw new ne("Event's id must not contain a newline character")}function ce(e){if(!Number.isInteger(e)||e<0)throw new ne("Event's retry must be a integer and >= 0")}function de(e){if(e.includes("\n"))throw new ne("Event's comment must not contain a newline character")}function ue(e){let t="";return t+=function(e){let t="";for(const n of e??[])de(n),t+=`: ${n}\n`;return t}(e.comments),void 0!==e.event&&(!function(e){if(e.includes("\n"))throw new ne("Event's event must not contain a newline character")}(e.event),t+=`event: ${e.event}\n`),void 0!==e.retry&&(ce(e.retry),t+=`retry: ${e.retry}\n`),void 0!==e.id&&(le(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 pe=Symbol("ORPC_EVENT_SOURCE_META");function he(e,t){if(void 0===t.id&&void 0===t.retry&&!t.comments?.length)return e;if(void 0!==t.id&&le(t.id),void 0!==t.retry&&ce(t.retry),void 0!==t.comments)for(const n of t.comments)de(n);return new Proxy(e,{get:(e,n,r)=>n===pe?t:Reflect.get(e,n,r)})}function me(e){return H(e)?Reflect.get(e,pe):void 0}function fe(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 ge(e,t){const n=async e=>{let n=await t.error(e);if(n!==e){const t=me(e);t&&H(n)&&(n=he(n,t))}return n};return new j(async()=>{const{done:r,value:i}=await(async()=>{try{return await e.next()}catch(t){throw await n(t)}})();let o=await t.value(i,r);if(o!==i){const e=me(i);e&&H(o)&&(o=he(o,e))}return{done:r,value:o}},async()=>{try{await(e.return?.())}catch(t){throw await n(t)}})}function ye(e,t={}){const n=t.path??[];return V(new Proxy(async(...[t,r={}])=>await e.call(n,t,function(e){return{...e,context:e.context??{}}}(r)),{get:(r,i)=>"string"!=typeof i?Reflect.get(r,i):ye(e,{...t,path:[...n,i]})}))}function we(e,t={}){return N({name:"parse_standard_body",signal:t.signal},async()=>{const n=e.headers.get("content-disposition");if("string"==typeof n){const t=fe(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 B(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 ae))?.getReader();let r,i=!1;return new j(async()=>{r??=R("consume_event_iterator_stream");try{for(;;){if(void 0===n)return{done:!0,value:void 0};const{done:e,value:t}=await L(r,()=>n.read());if(e){if(i)throw new M("Stream was cancelled");return{done:!0,value:void 0}}switch(t.event){case"message":{let e=B(t.data);return H(e)&&(e=he(e,t)),r?.addEvent("message"),{done:!1,value:e}}case"error":{let e=new ie({data:B(t.data)});throw e=he(e,t),r?.addEvent("error"),e}case"done":{let e=B(t.data);return H(e)&&(e=he(e,t)),r?.addEvent("done"),{done:!0,value:e}}default:r?.addEvent("maybe_keepalive")}}}catch(e){throw e instanceof ie||P(r,e,t),e}},async e=>{try{"next"!==e&&(i=!0,r?.addEvent("cancelled")),await L(r,()=>n?.cancel())}catch(o){throw P(r,o,t),o}finally{r?.end()}})}(e.body,t);if(r.startsWith("text/plain"))return await e.text();const i=await e.blob();return new File([i],"blob",{type:i.type})})}function be(e,t,n={}){const r=t.get("content-disposition");var i;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="${(i=e instanceof File?e.name:"blob").replace(/[^\x20-\x7E]/g,"_").replace(/"/g,'\\"')}"; filename*=utf-8''${encodeURIComponent(i).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:D(e)?(t.set("content-type","text/event-stream"),function(e,t={}){const n=t.eventIteratorKeepAliveEnabled??!0,r=t.eventIteratorKeepAliveInterval??5e3,i=t.eventIteratorKeepAliveComment??"",o=t.eventIteratorInitialCommentEnabled??!0,s=t.eventIteratorInitialComment??"";let a,l,c=!1;return new ReadableStream({start(e){l=R("stream_event_iterator"),o&&e.enqueue(ue({comments:[s]}))},async pull(t){try{n&&(a=setInterval(()=>{t.enqueue(ue({comments:[i]})),l?.addEvent("keepalive")},r));const o=await L(l,()=>e.next());if(clearInterval(a),c)return;const s=me(o.value);if(!o.done||void 0!==o.value||void 0!==s){const e=o.done?"done":"message";t.enqueue(ue({...s,event:e,data:W(o.value)})),l?.addEvent(e)}o.done&&(t.close(),l?.end())}catch(o){if(clearInterval(a),c)return;o instanceof ie?(t.enqueue(ue({...me(o),event:"error",data:W(o.data)})),l?.addEvent("error"),t.close()):(P(l,o),t.error(o)),l?.end()}},async cancel(){try{c=!0,clearInterval(a),l?.addEvent("cancelled"),await L(l,()=>e.return?.())}catch(t){throw P(l,t),t}finally{l?.end()}}}).pipeThrough(new TextEncoderStream)}(e,n)):(t.set("content-type","application/json"),W(e))}function ve(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 xe(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=be(e.body,n,t);return new Request(e.url,{signal:e.signal,method:e.method,headers:n,body:r})}var ke=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)}},_e=class{constructor(e,t,n={}){this.codec=e,this.sender=t,new ke(n.plugins).init(n),this.interceptors=T(n.interceptors),this.clientInterceptors=T(n.clientInterceptors)}interceptors;clientInterceptors;call(e,t,n){return N({name:`${A}.${e.join("/")}`,signal:n.signal},r=>(r?.setAttribute("rpc.system",A),r?.setAttribute("rpc.method",e.join(".")),D(t)&&(t=F({name:"consume_event_iterator_input",signal:n.signal},t)),U(this.interceptors,{...n,path:e,input:t},async({path:e,input:t,...n})=>{const i=O();let o;const s=i?.trace.getActiveSpan()??r;s&&i&&(o=i?.trace.setSpan(i.context.active(),s));const a=await N({name:"encode_request",context:o},()=>this.codec.encode(e,t,n)),l=await U(this.clientInterceptors,{...n,input:t,path:e,request:a},({input:e,path:t,request:n,...r})=>N({name:"send_request",signal:r.signal,context:o},()=>this.sender.call(n,r,t,e))),c=await N({name:"decode_response",context:o},()=>this.codec.decode(l,n,e,t));return D(c)?F({name:"consume_event_iterator_output",signal:n.signal},c):c})))}},Se=0,Ce=1,Ie=2,Ee=3,Te=4,Ae=5,Me=6,ze=7,Oe=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=[],i=[]){for(const o of this.customSerializers)if(o.condition(e)){const s=this.serialize(o.serialize(e),t,n,r,i);return n.push([o.type,...t]),s}if(e instanceof Blob)return r.push(t),i.push(e),[e,n,r,i];if("bigint"==typeof e)return n.push([Se,...t]),[e.toString(),n,r,i];if(e instanceof Date)return n.push([Ce,...t]),Number.isNaN(e.getTime())?[null,n,r,i]:[e.toISOString(),n,r,i];if(Number.isNaN(e))return n.push([Ie,...t]),[null,n,r,i];if(e instanceof URL)return n.push([Te,...t]),[e.toString(),n,r,i];if(e instanceof RegExp)return n.push([Ae,...t]),[e.toString(),n,r,i];if(e instanceof Set){const o=this.serialize(Array.from(e),t,n,r,i);return n.push([Me,...t]),o}if(e instanceof Map){const o=this.serialize(Array.from(e.entries()),t,n,r,i);return n.push([ze,...t]),o}if(Array.isArray(e))return[e.map((e,o)=>void 0===e?(n.push([Ee,...t,o]),null):this.serialize(e,[...t,o],n,r,i)[0]),n,r,i];if(G(e)){const o={};for(const s in e)"toJSON"===s&&"function"==typeof e[s]||(o[s]=this.serialize(e[s],[...t,s],n,r,i)[0]);return[o,n,r,i]}return[e,n,r,i]}deserialize(e,t,n,r){const i={data:e};n&&r&&n.forEach((e,t)=>{let n=i,o="data";e.forEach(e=>{if(n=n[o],o=e,!Object.hasOwn(n,o))throw new Error(`Security error: accessing non-existent path during deserialization. Path segment: ${o}`)}),n[o]=r(t)});for(const o of t){const e=o[0];let t=i,n="data";for(let r=1;r<o.length;r++)if(t=t[n],n=o[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 Se:t[n]=BigInt(t[n]);break;case Ce:t[n]=new Date(t[n]??"Invalid Date");break;case Ie:t[n]=NaN;break;case Ee:t[n]=void 0;break;case Te:t[n]=new URL(t[n]);break;case Ae:{const[,e,r]=t[n].match(/^\/(.*)\/([a-z]*)$/);t[n]=new RegExp(e,r);break}case Me:t[n]=new Set(t[n]);break;case ze:t[n]=new Map(t[n])}}return i.data}};var Re=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?ve(e):e}(await Z(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]=[...T(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 i=await Z(this.expectedMethod,n,e,t),o=await Z(this.baseUrl,n,e,t),s=new URL(o);s.pathname=`${s.pathname.replace(/\/$/,"")}${function(e){return`/${e.map(encodeURIComponent).join("/")}`}(e)}`;const a=this.serializer.serialize(t);if(!("GET"!==i||a instanceof FormData||D(a))){const o=await Z(this.maxUrlLength,n,e,t),l=new URL(s);if(l.searchParams.append("data",W(a)),l.toString().length<=o)return{body:void 0,method:i,headers:r,url:l,signal:n.signal}}return{url:s,method:"GET"===i?this.fallbackMethod:i,headers:r,body:a,signal:n.signal}}async decode(e){const t=!X(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(ee(n))throw te(n);throw new Q((r=e.status,Object.entries(Y).find(([,e])=>e.status===r)?.[0]??"MALFORMED_ORPC_ERROR_RESPONSE"),{status:e.status,data:{...e,body:n}})}var r;return n}},Pe=class{constructor(e){this.jsonSerializer=e}serialize(e){return D(e)?ge(e,{value:async e=>this.#i(e,!1),error:async e=>{return new ie({data:this.#i((t=e,t instanceof Q?t:new Q("INTERNAL_SERVER_ERROR",{message:"Internal server error",cause:t})).toJSON(),!1),cause:e});var t}}):this.#i(e,!0)}#i(e,t){const[n,r,i,o]=this.jsonSerializer.serialize(e),s=0===r.length?void 0:r;if(!t||0===o.length)return{json:n,meta:s};const a=new FormData;return a.set("data",W({json:n,meta:s,maps:i})),o.forEach((e,t)=>{a.set(t.toString(),e)}),a}deserialize(e){return D(e)?ge(e,{value:async e=>this.#o(e),error:async e=>{if(!(e instanceof ie))return e;const t=this.#o(e.data);return ee(t)?te(t,{cause:e}):new ie({data:t,cause:e})}}):this.#o(e)}#o(e){if(void 0===e)return;if(!(e instanceof FormData))return this.jsonSerializer.deserialize(e.json,e.meta??[]);const t=JSON.parse(e.get("data"));return this.jsonSerializer.deserialize(t.json,t.meta??[],t.maps,t=>e.get(t.toString()))}},Ne=class extends _e{constructor(e,t){super(new Re(new Pe(new Oe(t)),t),e,t)}},Le=class extends ke{initRuntimeAdapter(e){for(const t of this.plugins)t.initRuntimeAdapter?.(e)}},De=class{fetch;toFetchRequestOptions;adapterInterceptors;constructor(e){new Le(e.plugins).initRuntimeAdapter(e),this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=e,this.adapterInterceptors=T(e.adapterInterceptors)}async call(e,t,n,r){const i=xe(e,this.toFetchRequestOptions);return function(e,t={}){return{body:z(()=>we(e,t)),status:e.status,get headers(){const t=ve(e.headers);return Object.defineProperty(this,"headers",{value:t,writable:!0}),t},set headers(e){Object.defineProperty(this,"headers",{value:e,writable:!0})}}}(await U(this.adapterInterceptors,{...t,request:i,path:n,input:r,init:{redirect:"manual"}},({request:e,path:t,input:n,init:r,...i})=>this.fetch(e,r,i,t,n)),{signal:i.signal})}},$e=class extends Ne{constructor(e){super(new De(e),e)}};Object.freeze({status:"aborted"});function je(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 i=s.prototype,o=Object.keys(i);for(let e=0;e<o.length;e++){const t=o[e];t in n||(n[t]=i[t].bind(n))}}const i=n?.Parent??Object;class o extends i{}function s(e){var t;const i=n?.Parent?new o:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(o,"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 Fe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ue=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Be={};function We(e){return e&&Object.assign(Be,e),Be}function Ge(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 He(e,t){return"bigint"==typeof t?t.toString():t}function Ze(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Ve(e){return null==e}function qe(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var Ye=Symbol("evaluating");function Je(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ye)return void 0===r&&(r=Ye,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ke(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Qe(...e){const t={};for(const n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Xe(e){return JSON.stringify(e)}var et="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function tt(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}var nt=Ze(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function rt(e){if(!1===tt(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!==tt(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function it(e){return rt(e)?{...e}:Array.isArray(e)?[...e]:e}var ot=new Set(["string","number","symbol"]);function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function at(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function lt(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 ct={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 dt(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 ut(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function pt(e){return"string"==typeof e?e:e?.message}function ht(e,t,n){const r={...e,path:e.path??[]};return e.message||(r.message=pt(e.inst?._zod.def?.error?.(e))??pt(t?.error?.(e))??pt(n.customError?.(e))??pt(n.localeError?.(e))??"Invalid input"),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function mt(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function ft(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function gt(...e){const[t,n,r]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:r}:{...t}}var yt=(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,He,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wt=je("$ZodError",yt),bt=je("$ZodError",yt,{Parent:Error});var vt=e=>(t,n,r,i)=>{const o=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Fe;if(s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>ht(e,o,We())));throw et(t,i?.callee),t}return s.value},xt=e=>async(t,n,r,i)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const t=new(i?.Err??e)(s.issues.map(e=>ht(e,o,We())));throw et(t,i?.callee),t}return s.value},kt=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},i);if(o instanceof Promise)throw new Fe;return o.issues.length?{success:!1,error:new(e??wt)(o.issues.map(e=>ht(e,i,We())))}:{success:!0,data:o.value}},_t=/* @__PURE__ */kt(bt),St=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(e=>ht(e,i,We())))}:{success:!0,data:o.value}},Ct=/* @__PURE__ */St(bt),It=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return vt(e)(t,n,i)},Et=e=>(t,n,r)=>vt(e)(t,n,r),Tt=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return xt(e)(t,n,i)},At=e=>async(t,n,r)=>xt(e)(t,n,r),Mt=e=>(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return kt(e)(t,n,i)},zt=e=>(t,n,r)=>kt(e)(t,n,r),Ot=e=>async(t,n,r)=>{const i=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return St(e)(t,n,i)},Rt=e=>async(t,n,r)=>St(e)(t,n,r),Pt=/^[cC][^\s-]{8,}$/,Nt=/^[0-9a-z]+$/,Lt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Dt=/^[0-9a-vA-V]{20}$/,$t=/^[A-Za-z0-9]{27}$/,jt=/^[a-zA-Z0-9_-]{21}$/,Ft=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ut=/^([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})$/,Bt=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)$/,Wt=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Gt=/^(?:(?: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])$/,Ht=/^(([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}|:))$/,Zt=/^((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])$/,Vt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Yt=/^[A-Za-z0-9_-]*$/,Jt=/^\+[1-9]\d{6,14}$/,Kt="(?:(?:\\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])))",Qt=/* @__PURE__ */new RegExp(`^${Kt}$`);function Xt(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 en=/^-?\d+$/,tn=/^-?\d+(?:\.\d+)?$/,nn=/^(?:true|false)$/i,rn=/^null$/i,on=/^[^A-Z]*$/,sn=/^[^a-z]*$/,an=/* @__PURE__ */je("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ln={number:"number",bigint:"bigint",object:"date"},cn=/* @__PURE__ */je("$ZodCheckLessThan",(e,t)=>{an.init(e,t);const n=ln[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})}}),dn=/* @__PURE__ */je("$ZodCheckGreaterThan",(e,t)=>{an.init(e,t);const n=ln[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})}}),un=/* @__PURE__ */je("$ZodCheckMultipleOf",(e,t)=>{an.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 i=(r.split(".")[1]||"").length;if(0===i&&/\d?e-\d?/.test(r)){const e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}const o=n>i?n:i;return Number.parseInt(e.toFixed(o).replace(".",""))%Number.parseInt(t.toFixed(o).replace(".",""))/10**o}(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})}}),pn=/* @__PURE__ */je("$ZodCheckNumberFormat",(e,t)=>{an.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[i,o]=ct[t.format];e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=o,n&&(r.pattern=en)}),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<i&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>o&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),hn=/* @__PURE__ */je("$ZodCheckMaxSize",(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ve(t)&&void 0!==t.size}),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;r.size<=t.maximum||n.issues.push({origin:mt(r),code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),mn=/* @__PURE__ */je("$ZodCheckMinSize",(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ve(t)&&void 0!==t.size}),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;r.size>=t.minimum||n.issues.push({origin:mt(r),code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),fn=/* @__PURE__ */je("$ZodCheckMaxLength",(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ve(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 i=ft(r);n.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),gn=/* @__PURE__ */je("$ZodCheckMinLength",(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ve(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 i=ft(r);n.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yn=/* @__PURE__ */je("$ZodCheckLengthEquals",(e,t)=>{var n;an.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!Ve(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,i=r.length;if(i===t.length)return;const o=ft(r),s=i>t.length;n.issues.push({origin:o,...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})}}),wn=/* @__PURE__ */je("$ZodCheckStringFormat",(e,t)=>{var n,r;an.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=()=>{})}),bn=/* @__PURE__ */je("$ZodCheckRegex",(e,t)=>{wn.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})}}),vn=/* @__PURE__ */je("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=on),wn.init(e,t)}),xn=/* @__PURE__ */je("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=sn),wn.init(e,t)}),kn=/* @__PURE__ */je("$ZodCheckIncludes",(e,t)=>{an.init(e,t);const n=st(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})}}),_n=/* @__PURE__ */je("$ZodCheckStartsWith",(e,t)=>{an.init(e,t);const n=new RegExp(`^${st(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})}}),Sn=/* @__PURE__ */je("$ZodCheckEndsWith",(e,t)=>{an.init(e,t);const n=new RegExp(`.*${st(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})}}),Cn=/* @__PURE__ */je("$ZodCheckMimeType",(e,t)=>{an.init(e,t);const n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),In=/* @__PURE__ */je("$ZodCheckOverwrite",(e,t)=>{an.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),En=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 i of r)this.content.push(i)}compile(){const e=Function,t=this?.args,n=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,n.join("\n"))}},Tn={major:4,minor:3,patch:6},An=/* @__PURE__ */je("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Tn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._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,i=dt(e);for(const o of t){if(o._zod.def.when){if(!o._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&!1===n?.async)throw new Fe;if(r||s instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(i||(i=dt(e,t)))});else{if(e.issues.length===t)continue;i||(i=dt(e,t))}}return r?r.then(()=>e):e},n=(n,i,o)=>{if(dt(n))return n.aborted=!0,n;const s=t(i,r,o);if(s instanceof Promise){if(!1===o.async)throw new Fe;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(i,o)=>{if(o.skipChecks)return e._zod.parse(i,o);if("backward"===o.direction){const t=e._zod.parse({value:i.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,o)):n(t,i,o)}const s=e._zod.parse(i,o);if(s instanceof Promise){if(!1===o.async)throw new Fe;return s.then(e=>t(e,r,o))}return t(s,r,o)}}Je(e,"~standard",()=>({validate:t=>{try{const n=_t(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Ct(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Mn=/* @__PURE__ */je("$ZodString",(e,t)=>{var n;An.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}}),zn=/* @__PURE__ */je("$ZodStringFormat",(e,t)=>{wn.init(e,t),Mn.init(e,t)}),On=/* @__PURE__ */je("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ut),zn.init(e,t)}),Rn=/* @__PURE__ */je("$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=Bt(e))}else t.pattern??(t.pattern=Bt());zn.init(e,t)}),Pn=/* @__PURE__ */je("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Wt),zn.init(e,t)}),Nn=/* @__PURE__ */je("$ZodURL",(e,t)=>{zn.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),i=new URL(r);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.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(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.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=i.href:n.value=r)}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ln=/* @__PURE__ */je("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),zn.init(e,t)}),Dn=/* @__PURE__ */je("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=jt),zn.init(e,t)}),$n=/* @__PURE__ */je("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Pt),zn.init(e,t)}),jn=/* @__PURE__ */je("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Nt),zn.init(e,t)}),Fn=/* @__PURE__ */je("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Lt),zn.init(e,t)}),Un=/* @__PURE__ */je("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Dt),zn.init(e,t)}),Bn=/* @__PURE__ */je("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=$t),zn.init(e,t)}),Wn=/* @__PURE__ */je("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=Xt({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(`^${Kt}T(?:${r})$`)}(t)),zn.init(e,t)}),Gn=/* @__PURE__ */je("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Qt),zn.init(e,t)}),Hn=/* @__PURE__ */je("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${Xt(t)}$`)),zn.init(e,t)}),Zn=/* @__PURE__ */je("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ft),zn.init(e,t)}),Vn=/* @__PURE__ */je("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Gt),zn.init(e,t),e._zod.bag.format="ipv4"}),qn=/* @__PURE__ */je("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ht),zn.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})}}}),Yn=/* @__PURE__ */je("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Zt),zn.init(e,t)}),Jn=/* @__PURE__ */je("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Vt),zn.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 Kn(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Qn=/* @__PURE__ */je("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=qt),zn.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Kn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});var Xn=/* @__PURE__ */je("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Yt),zn.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!Yt.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Kn(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})}}),er=/* @__PURE__ */je("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Jt),zn.init(e,t)});var tr=/* @__PURE__ */je("$ZodJWT",(e,t)=>{zn.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 i=JSON.parse(atob(r));return!("typ"in i&&"JWT"!==i?.typ||!i.alg||t&&(!("alg"in i)||i.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})}}),nr=/* @__PURE__ */je("$ZodNumber",(e,t)=>{An.init(e,t),e._zod.pattern=e._zod.bag.pattern??tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}const i=n.value;if("number"==typeof i&&!Number.isNaN(i)&&Number.isFinite(i))return n;const o="number"==typeof i?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),n}}),rr=/* @__PURE__ */je("$ZodNumberFormat",(e,t)=>{pn.init(e,t),nr.init(e,t)}),ir=/* @__PURE__ */je("$ZodBoolean",(e,t)=>{An.init(e,t),e._zod.pattern=nn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(o){}const i=n.value;return"boolean"==typeof i||n.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),n}}),or=/* @__PURE__ */je("$ZodNull",(e,t)=>{An.init(e,t),e._zod.pattern=rn,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}}),sr=/* @__PURE__ */je("$ZodUnknown",(e,t)=>{An.init(e,t),e._zod.parse=e=>e}),ar=/* @__PURE__ */je("$ZodNever",(e,t)=>{An.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),lr=/* @__PURE__ */je("$ZodDate",(e,t)=>{An.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(s){}const i=n.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),n}});function cr(e,t,n){e.issues.length&&t.issues.push(...ut(n,e.issues)),t.value[n]=e.value}var dr=/* @__PURE__ */je("$ZodArray",(e,t)=>{An.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=Array(i.length);const o=[];for(let e=0;e<i.length;e++){const s=i[e],a=t.element._zod.run({value:s,issues:[]},r);a instanceof Promise?o.push(a.then(t=>cr(t,n,e))):cr(a,n,e)}return o.length?Promise.all(o).then(()=>n):n}});function ur(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...ut(n,e.issues))}void 0===e.value?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function pr(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": 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 hr(e,t,n,r,i,o){const s=[],a=i.keySet,l=i.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 i=l.run({value:t[u],issues:[]},r);i instanceof Promise?e.push(i.then(e=>ur(e,n,u,t,d))):ur(i,n,u,t,d)}return s.length&&n.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:o}),e.length?Promise.all(e).then(()=>n):n}var mr=/* @__PURE__ */je("$ZodObject",(e,t)=>{if(An.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=Ze(()=>pr(t));Je(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=tt,i=t.catchall;let o;e._zod.parse=(t,s)=>{o??(o=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=o.shape;for(const e of o.keys){const n=c[e],r="optional"===n._zod.optout,i=n._zod.run({value:a[e],issues:[]},s);i instanceof Promise?l.push(i.then(n=>ur(n,t,e,a,r))):ur(i,t,e,a,r)}return i?hr(l,a,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),fr=/* @__PURE__ */je("$ZodObjectJIT",(e,t)=>{mr.init(e,t);const n=e._zod.parse,r=Ze(()=>pr(t));let i;const o=tt,s=!Be.jitless,a=s&&nt.value,l=t.catchall;let c;e._zod.parse=(d,u)=>{c??(c=r.value);const p=d.value;return o(p)?s&&a&&!1===u?.async&&!0!==u.jitless?(i||(i=(e=>{const t=new En(["shape","payload","ctx"]),n=r.value,i=e=>{const t=Xe(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const o=Object.create(null);let s=0;for(const r of n.keys)o[r]="key_"+s++;t.write("const newResult = {};");for(const r of n.keys){const n=o[r],s=Xe(r),a="optional"===e[r]?._zod?.optout;t.write(`const ${n} = ${i(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=i(d,u),l?hr([],p,d,u,c,e):d):n(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function gr(e,t,n,r){for(const o of e)if(0===o.issues.length)return t.value=o.value,t;const i=e.filter(e=>!dt(e));return 1===i.length?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ht(e,r,We())))}),t)}var yr=/* @__PURE__ */je("$ZodUnion",(e,t)=>{An.init(e,t),Je(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),Je(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),Je(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Je(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>qe(e.source)).join("|")})$`)}});const n=1===t.options.length,r=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(n)return r(i,o);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:i.value,issues:[]},o);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=>gr(t,i,e,o)):gr(a,i,e,o)}}),wr=/* @__PURE__ */je("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,yr.init(e,t);const n=e._zod.parse;Je(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=Ze(()=>{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=(i,o)=>{const s=i.value;if(!tt(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),i;const a=r.value.get(s?.[t.discriminator]);return a?a._zod.run(i,o):t.unionFallback?n(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:s,path:[t.discriminator],inst:e}),i)}}),br=/* @__PURE__ */je("$ZodIntersection",(e,t)=>{An.init(e,t),e._zod.parse=(e,n)=>{const r=e.value,i=t.left._zod.run({value:r,issues:[]},n),o=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||o instanceof Promise?Promise.all([i,o]).then(([t,n])=>xr(e,t,n)):xr(e,i,o)}});function vr(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(rt(e)&&rt(t)){const n=Object.keys(t),r=Object.keys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const o of r){const n=vr(e[o],t[o]);if(!n.valid)return{valid:!1,mergeErrorPath:[o,...n.mergeErrorPath]};i[o]=n.data}return{valid:!0,data:i}}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 i=vr(e[r],t[r]);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function xr(e,t,n){const r=/* @__PURE__ */new Map;let i;for(const a of t.issues)if("unrecognized_keys"===a.code){i??(i=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 o=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(o.length&&i&&e.issues.push({...i,keys:o}),dt(e))return e;const s=vr(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 kr=/* @__PURE__ */je("$ZodRecord",(e,t)=>{An.init(e,t),e._zod.parse=(n,r)=>{const i=n.value;if(!rt(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;const o=[],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:i[e],issues:[]},r);s instanceof Promise?o.push(s.then(t=>{t.issues.length&&n.issues.push(...ut(e,t.issues)),n.value[e]=t.value})):(s.issues.length&&n.issues.push(...ut(e,s.issues)),n.value[e]=s.value)}let l;for(const e in i)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{n.value={};for(const s of Reflect.ownKeys(i)){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&&tn.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]=i[s]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>ht(e,r,We())),input:s,path:[s],inst:e});continue}const l=t.valueType._zod.run({value:i[s],issues:[]},r);l instanceof Promise?o.push(l.then(e=>{e.issues.length&&n.issues.push(...ut(s,e.issues)),n.value[a.value]=e.value})):(l.issues.length&&n.issues.push(...ut(s,l.issues)),n.value[a.value]=l.value)}}return o.length?Promise.all(o).then(()=>n):n}}),_r=/* @__PURE__ */je("$ZodEnum",(e,t)=>{An.init(e,t);const n=Ge(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(e=>ot.has(typeof e)).map(e=>"string"==typeof e?st(e):e.toString()).join("|")})$`),e._zod.parse=(t,i)=>{const o=t.value;return r.has(o)||t.issues.push({code:"invalid_value",values:n,input:o,inst:e}),t}}),Sr=/* @__PURE__ */je("$ZodLiteral",(e,t)=>{if(An.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?st(e):e?st(e.toString()):String(e)).join("|")})$`),e._zod.parse=(r,i)=>{const o=r.value;return n.has(o)||r.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),r}}),Cr=/* @__PURE__ */je("$ZodFile",(e,t)=>{An.init(e,t),e._zod.parse=(t,n)=>{const r=t.value;return r instanceof File||t.issues.push({expected:"file",code:"invalid_type",input:r,inst:e}),t}}),Ir=/* @__PURE__ */je("$ZodTransform",(e,t)=>{An.init(e,t),e._zod.parse=(n,r)=>{if("backward"===r.direction)throw new Ue(e.constructor.name);const i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Fe;return n.value=i,n}});function Er(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}var Tr=/* @__PURE__ */je("$ZodOptional",(e,t)=>{An.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Je(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Je(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${qe(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>Er(t,e.value)):Er(r,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),Ar=/* @__PURE__ */je("$ZodExactOptional",(e,t)=>{Tr.init(e,t),Je(e._zod,"values",()=>t.innerType._zod.values),Je(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Mr=/* @__PURE__ */je("$ZodNullable",(e,t)=>{An.init(e,t),Je(e._zod,"optin",()=>t.innerType._zod.optin),Je(e._zod,"optout",()=>t.innerType._zod.optout),Je(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${qe(e.source)}|null)$`):void 0}),Je(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)}),zr=/* @__PURE__ */je("$ZodDefault",(e,t)=>{An.init(e,t),e._zod.optin="optional",Je(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=>Or(e,t)):Or(r,t)}});function Or(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}var Rr=/* @__PURE__ */je("$ZodPrefault",(e,t)=>{An.init(e,t),e._zod.optin="optional",Je(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))}),Pr=/* @__PURE__ */je("$ZodNonOptional",(e,t)=>{An.init(e,t),Je(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 i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Nr(t,e)):Nr(i,e)}});function Nr(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 Lr=/* @__PURE__ */je("$ZodCatch",(e,t)=>{An.init(e,t),Je(e._zod,"optin",()=>t.innerType._zod.optin),Je(e._zod,"optout",()=>t.innerType._zod.optout),Je(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=>ht(e,n,We()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>ht(e,n,We()))},input:e.value}),e.issues=[]),e)}}),Dr=/* @__PURE__ */je("$ZodPipe",(e,t)=>{An.init(e,t),Je(e._zod,"values",()=>t.in._zod.values),Je(e._zod,"optin",()=>t.in._zod.optin),Je(e._zod,"optout",()=>t.out._zod.optout),Je(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=>$r(e,t.in,n)):$r(r,t.in,n)}const r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$r(e,t.out,n)):$r(r,t.out,n)}});function $r(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var jr=/* @__PURE__ */je("$ZodReadonly",(e,t)=>{An.init(e,t),Je(e._zod,"propValues",()=>t.innerType._zod.propValues),Je(e._zod,"values",()=>t.innerType._zod.values),Je(e._zod,"optin",()=>t.innerType?._zod?.optin),Je(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(Fr):Fr(r)}});function Fr(e){return e.value=Object.freeze(e.value),e}var Ur,Br=/* @__PURE__ */je("$ZodCustom",(e,t)=>{an.init(e,t),An.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Wr(t,n,r,e));Wr(i,n,r,e)}});function Wr(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(gt(e))}}var Gr=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)}};(Ur=globalThis).__zod_globalRegistry??(Ur.__zod_globalRegistry=new Gr);var Hr=globalThis.__zod_globalRegistry;function Zr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...lt(t)})}function Vr(e,t){return new cn({check:"less_than",...lt(t),value:e,inclusive:!1})}function qr(e,t){return new cn({check:"less_than",...lt(t),value:e,inclusive:!0})}function Yr(e,t){return new dn({check:"greater_than",...lt(t),value:e,inclusive:!1})}function Jr(e,t){return new dn({check:"greater_than",...lt(t),value:e,inclusive:!0})}function Kr(e,t){return new un({check:"multiple_of",...lt(t),value:e})}function Qr(e,t){return new fn({check:"max_length",...lt(t),maximum:e})}function Xr(e,t){return new gn({check:"min_length",...lt(t),minimum:e})}function ei(e,t){return new yn({check:"length_equals",...lt(t),length:e})}function ti(e){return new In({check:"overwrite",tx:e})}function ni(e,t){const n=new an({check:"custom",...lt(t)});return n._zod.check=e,n}function ri(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??Hr,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 ii(e,t,n={path:[],schemaPath:[]}){var r;const i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,n.schemaPath.includes(e)&&(o.cycle=n.path),o.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,o=t.processors[i.type];if(!o)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);o(e,t,n,r)}const o=e._zod.parent;o&&(s.ref||(s.ref=o),ii(o,t,r),t.seen.get(o).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(s.schema,l),"input"===t.io&&ai(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 oi(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 o of e.seen.entries()){const t=e.metadataRegistry.get(o[0])?.id;if(t){const e=r.get(t);if(e&&e!==o[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,o[0])}}const i=t=>{if(t[1].schema.$ref)return;const r=t[1],{ref:i,defId:o}=(t=>{const r="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};const o=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=o,{defId:o,ref:`${i("__shared")}#/${r}/${o}`}}if(t[1]===n)return{ref:"#"};const i=`#/${r}/`,o=t[1].schema.id??"__schema"+e.counter++;return{defId:o,ref:i+o}})(t);r.def={...r.schema},o&&(r.defId=o);const s=r.schema;for(const e in s)delete s[e];s.$ref=i};if("throw"===e.cycles)for(const o of e.seen.entries()){const e=o[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 o of e.seen.entries()){const n=o[1];if(t!==o[0]){if(e.external){const n=e.external.registry.get(o[0])?.id;if(t!==o[0]&&n){i(o);continue}}(e.metadataRegistry.get(o[0])?.id||n.cycle||n.count>1&&"ref"===e.reused)&&i(o)}else i(o)}}function si(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 i=n.def??n.schema,o={...i},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(i,a):(i.allOf=i.allOf??[],i.allOf.push(a)),Object.assign(i,o),t._zod.parent===s)for(const e in i)"$ref"!==e&&"allOf"!==e&&(e in o||delete i[e]);if(a.$ref&&n.def)for(const e in i)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}const a=t._zod.parent;if(a&&a!==s){r(a);const t=e.seen.get(a);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(const e in i)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const i={};if("draft-2020-12"===e.target?i.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?i.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?i.$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");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);const o=e.external?.defs??{};for(const a of e.seen.entries()){const e=a[1];e.def&&e.defId&&(o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&("draft-2020-12"===e.target?i.$defs=o:i.definitions=o);try{const n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:li(t,"input",e.processors),output:li(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(s){throw new Error("Error converting schema to JSON.")}}function ai(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 ai(r.element,n);if("set"===r.type)return ai(r.valueType,n);if("lazy"===r.type)return ai(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 ai(r.innerType,n);if("intersection"===r.type)return ai(r.left,n)||ai(r.right,n);if("record"===r.type||"map"===r.type)return ai(r.keyType,n)||ai(r.valueType,n);if("pipe"===r.type)return ai(r.in,n)||ai(r.out,n);if("object"===r.type){for(const e in r.shape)if(ai(r.shape[e],n))return!0;return!1}if("union"===r.type){for(const e of r.options)if(ai(e,n))return!0;return!1}if("tuple"===r.type){for(const e of r.items)if(ai(e,n))return!0;return!(!r.rest||!ai(r.rest,n))}return!1}var li=(e,t,n={})=>r=>{const{libraryOptions:i,target:o}=r??{},s=ri({...i??{},target:o,io:t,processors:n});return ii(e,s),oi(s,e),si(s,e)},ci={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},di=(e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r);t.seen.get(e).ref=i.innerType},ui=/* @__PURE__ */je("ZodISODateTime",(e,t)=>{Wn.init(e,t),Di.init(e,t)});function pi(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...lt(t)})}(ui,e)}var hi=/* @__PURE__ */je("ZodISODate",(e,t)=>{Gn.init(e,t),Di.init(e,t)});function mi(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...lt(t)})}(hi,e)}var fi=/* @__PURE__ */je("ZodISOTime",(e,t)=>{Hn.init(e,t),Di.init(e,t)});function gi(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...lt(t)})}(fi,e)}var yi=/* @__PURE__ */je("ZodISODuration",(e,t)=>{Zn.init(e,t),Di.init(e,t)});function wi(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...lt(t)})}(yi,e)}var bi=(e,t)=>{wt.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 i of e.issues)if("invalid_union"===i.code&&i.errors.length)i.errors.map(e=>r({issues:e}));else if("invalid_key"===i.code)r({issues:i.issues});else if("invalid_element"===i.code)r({issues:i.issues});else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r!==i.path.length-1?e[n]=e[n]||{_errors:[]}:(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))),e=e[n],r++}}};return r(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},r=[];for(const i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,He,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,He,2)}},isEmpty:{get:()=>0===e.issues.length}})},vi=(je("ZodError",bi),je("ZodError",bi,{Parent:Error})),xi=/* @__PURE__ */vt(vi),ki=/* @__PURE__ */xt(vi),_i=/* @__PURE__ */kt(vi),Si=/* @__PURE__ */St(vi),Ci=/* @__PURE__ */It(vi),Ii=/* @__PURE__ */Et(vi),Ei=/* @__PURE__ */Tt(vi),Ti=/* @__PURE__ */At(vi),Ai=/* @__PURE__ */Mt(vi),Mi=/* @__PURE__ */zt(vi),zi=/* @__PURE__ */Ot(vi),Oi=/* @__PURE__ */Rt(vi),Ri=/* @__PURE__ */je("ZodType",(e,t)=>(An.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:li(e,"input"),output:li(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const r=ri({...n,processors:t});return ii(e,r),oi(r,e),si(r,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Qe(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)=>at(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>xi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>_i(e,t,n),e.parseAsync=async(t,n)=>ki(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Si(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ci(e,t,n),e.decode=(t,n)=>Ii(e,t,n),e.encodeAsync=async(t,n)=>Ei(e,t,n),e.decodeAsync=async(t,n)=>Ti(e,t,n),e.safeEncode=(t,n)=>Ai(e,t,n),e.safeDecode=(t,n)=>Mi(e,t,n),e.safeEncodeAsync=async(t,n)=>zi(e,t,n),e.safeDecodeAsync=async(t,n)=>Oi(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,...lt(n)})}(Zo,e,t)}(t,n)),e.superRefine=t=>e.check(function(e){const t=/* @__PURE__ */ni(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(gt(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(gt(r))}},e(n.value,n)));return t}(t)),e.overwrite=t=>e.check(ti(t)),e.optional=()=>No(e),e.exactOptional=()=>new Lo({type:"optional",innerType:e}),e.nullable=()=>$o(e),e.nullish=()=>No($o(e)),e.nonoptional=t=>function(e,t){return new Uo({type:"nonoptional",innerType:e,...lt(t)})}(e,t),e.array=()=>yo(e),e.or=t=>xo([e,t]),e.and=t=>new So({type:"intersection",left:e,right:t}),e.transform=t=>Go(e,Ro(t)),e.default=t=>{return n=t,new jo({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():it(n)}});var n},e.prefault=t=>{return n=t,new Fo({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():it(n)}});var n},e.catch=t=>{return new Bo({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>Go(e,t),e.readonly=()=>new Ho({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Hr.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Hr.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Hr.get(e);const n=e.clone();return Hr.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),Pi=/* @__PURE__ */je("_ZodString",(e,t)=>{Mn.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n;r.type="string";const{minimum:i,maximum:o,format:s,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof i&&(r.minLength=i),"number"==typeof o&&(r.maxLength=o),s&&(r.format=ci[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 bn({check:"string_format",format:"regex",...lt(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new kn({check:"string_format",format:"includes",...lt(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new _n({check:"string_format",format:"starts_with",...lt(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Sn({check:"string_format",format:"ends_with",...lt(t),suffix:e})}(...t)),e.min=(...t)=>e.check(Xr(...t)),e.max=(...t)=>e.check(Qr(...t)),e.length=(...t)=>e.check(ei(...t)),e.nonempty=(...t)=>e.check(Xr(1,...t)),e.lowercase=t=>e.check(function(e){return new vn({check:"string_format",format:"lowercase",...lt(e)})}(t)),e.uppercase=t=>e.check(function(e){return new xn({check:"string_format",format:"uppercase",...lt(e)})}(t)),e.trim=()=>e.check(/* @__PURE__ */ti(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){/* @__PURE__ */
|
|
2
|
-
return ti(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(/* @__PURE__ */ti(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(/* @__PURE__ */ti(e=>e.toUpperCase())),e.slugify=()=>e.check(/* @__PURE__ */ti(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Ni=/* @__PURE__ */je("ZodString",(e,t)=>{Mn.init(e,t),Pi.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...lt(t)})}($i,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...lt(t)})}(Ui,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...lt(t)})}(no,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...lt(t)})}(Bi,t)),e.guid=t=>e.check(Zr(ji,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...lt(t)})}(Fi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...lt(t)})}(Fi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...lt(t)})}(Fi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...lt(t)})}(Fi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...lt(t)})}(Wi,t)),e.guid=t=>e.check(Zr(ji,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...lt(t)})}(Gi,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...lt(t)})}(Hi,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...lt(t)})}(Zi,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...lt(t)})}(Xi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...lt(t)})}(eo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...lt(t)})}(Vi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...lt(t)})}(qi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...lt(t)})}(Yi,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...lt(t)})}(Ji,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...lt(t)})}(Ki,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...lt(t)})}(Qi,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...lt(t)})}(to,t)),e.datetime=t=>e.check(pi(t)),e.date=t=>e.check(mi(t)),e.time=t=>e.check(gi(t)),e.duration=t=>e.check(wi(t))});function Li(e){return function(e,t){return new e({type:"string",...lt(t)})}(Ni,e)}var Di=/* @__PURE__ */je("ZodStringFormat",(e,t)=>{zn.init(e,t),Pi.init(e,t)}),$i=/* @__PURE__ */je("ZodEmail",(e,t)=>{Pn.init(e,t),Di.init(e,t)}),ji=/* @__PURE__ */je("ZodGUID",(e,t)=>{On.init(e,t),Di.init(e,t)}),Fi=/* @__PURE__ */je("ZodUUID",(e,t)=>{Rn.init(e,t),Di.init(e,t)}),Ui=/* @__PURE__ */je("ZodURL",(e,t)=>{Nn.init(e,t),Di.init(e,t)}),Bi=/* @__PURE__ */je("ZodEmoji",(e,t)=>{Ln.init(e,t),Di.init(e,t)}),Wi=/* @__PURE__ */je("ZodNanoID",(e,t)=>{Dn.init(e,t),Di.init(e,t)}),Gi=/* @__PURE__ */je("ZodCUID",(e,t)=>{$n.init(e,t),Di.init(e,t)}),Hi=/* @__PURE__ */je("ZodCUID2",(e,t)=>{jn.init(e,t),Di.init(e,t)}),Zi=/* @__PURE__ */je("ZodULID",(e,t)=>{Fn.init(e,t),Di.init(e,t)}),Vi=/* @__PURE__ */je("ZodXID",(e,t)=>{Un.init(e,t),Di.init(e,t)}),qi=/* @__PURE__ */je("ZodKSUID",(e,t)=>{Bn.init(e,t),Di.init(e,t)}),Yi=/* @__PURE__ */je("ZodIPv4",(e,t)=>{Vn.init(e,t),Di.init(e,t)}),Ji=/* @__PURE__ */je("ZodIPv6",(e,t)=>{qn.init(e,t),Di.init(e,t)}),Ki=/* @__PURE__ */je("ZodCIDRv4",(e,t)=>{Yn.init(e,t),Di.init(e,t)}),Qi=/* @__PURE__ */je("ZodCIDRv6",(e,t)=>{Jn.init(e,t),Di.init(e,t)}),Xi=/* @__PURE__ */je("ZodBase64",(e,t)=>{Qn.init(e,t),Di.init(e,t)}),eo=/* @__PURE__ */je("ZodBase64URL",(e,t)=>{Xn.init(e,t),Di.init(e,t)}),to=/* @__PURE__ */je("ZodE164",(e,t)=>{er.init(e,t),Di.init(e,t)}),no=/* @__PURE__ */je("ZodJWT",(e,t)=>{tr.init(e,t),Di.init(e,t)}),ro=/* @__PURE__ */je("ZodNumber",(e,t)=>{nr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:o,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 i&&(r.minimum=i,"number"==typeof c&&"draft-04"!==t.target&&(c>=i?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 o&&(r.maximum=o,"number"==typeof l&&"draft-04"!==t.target&&(l<=o?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(Yr(t,n)),e.gte=(t,n)=>e.check(Jr(t,n)),e.min=(t,n)=>e.check(Jr(t,n)),e.lt=(t,n)=>e.check(Vr(t,n)),e.lte=(t,n)=>e.check(qr(t,n)),e.max=(t,n)=>e.check(qr(t,n)),e.int=t=>e.check(so(t)),e.safe=t=>e.check(so(t)),e.positive=t=>e.check(Yr(0,t)),e.nonnegative=t=>e.check(Jr(0,t)),e.negative=t=>e.check(Vr(0,t)),e.nonpositive=t=>e.check(qr(0,t)),e.multipleOf=(t,n)=>e.check(Kr(t,n)),e.step=(t,n)=>e.check(Kr(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 io(e){return function(e,t){return new e({type:"number",checks:[],...lt(t)})}(ro,e)}var oo=/* @__PURE__ */je("ZodNumberFormat",(e,t)=>{rr.init(e,t),ro.init(e,t)});function so(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...lt(t)})}(oo,e)}var ao=/* @__PURE__ */je("ZodBoolean",(e,t)=>{ir.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function lo(e){return function(e,t){return new e({type:"boolean",...lt(t)})}(ao,e)}var co=/* @__PURE__ */je("ZodNull",(e,t)=>{or.init(e,t),Ri.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 uo=/* @__PURE__ */je("ZodUnknown",(e,t)=>{sr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function po(){return new uo({type:"unknown"})}var ho=/* @__PURE__ */je("ZodNever",(e,t)=>{ar.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function mo(e){return function(e,t){return new e({type:"never",...lt(t)})}(ho,e)}var fo=/* @__PURE__ */je("ZodDate",(e,t)=>{lr.init(e,t),Ri.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(Jr(t,n)),e.max=(t,n)=>e.check(qr(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}),go=/* @__PURE__ */je("ZodArray",(e,t)=>{dr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=ii(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Xr(t,n)),e.nonempty=t=>e.check(Xr(1,t)),e.max=(t,n)=>e.check(Qr(t,n)),e.length=(t,n)=>e.check(ei(t,n)),e.unwrap=()=>e.element});function yo(e,t){return function(e,t,n){return new e({type:"array",element:t,...lt(n)})}(go,e,t)}var wo=/* @__PURE__ */je("ZodObject",(e,t)=>{fr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const c in s)i.properties[c]=ii(s[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(i.required=Array.from(l)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=ii(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),Je(e,"shape",()=>t.shape),e.keyof=()=>To(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:po()}),e.loose=()=>e.clone({...e._zod.def,catchall:po()}),e.strict=()=>e.clone({...e._zod.def,catchall:mo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!rt(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 at(e,Qe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ke(this,"shape",n),n}}))}(e,t),e.safeExtend=t=>function(e,t){if(!rt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return at(e,Qe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ke(this,"shape",n),n}}))}(e,t),e.merge=t=>{return r=t,at(n=e,Qe(n._zod.def,{get shape(){const e={...n._zod.def.shape,...r._zod.def.shape};return Ke(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 at(e,Qe(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 Ke(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 at(e,Qe(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 Ke(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 at(t,Qe(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Ke(this,"shape",i),i},checks:[]}))}(Po,e,t[0]),e.required=(...t)=>{return n=Uo,r=e,i=t[0],at(r,Qe(r._zod.def,{get shape(){const e=r._zod.def.shape,t={...e};if(i)for(const r in i){if(!(r in t))throw new Error(`Unrecognized key: "${r}"`);i[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 Ke(this,"shape",t),t}}));var n,r,i}});function bo(e,t){return new wo({type:"object",shape:e??{},...lt(t)})}var vo=/* @__PURE__ */je("ZodUnion",(e,t)=>{yr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>ii(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});function xo(e,t){return new vo({type:"union",options:e,...lt(t)})}var ko=/* @__PURE__ */je("ZodDiscriminatedUnion",(e,t)=>{vo.init(e,t),wr.init(e,t)});function _o(e,t,n){return new ko({type:"union",options:t,discriminator:e,...lt(n)})}var So=/* @__PURE__ */je("ZodIntersection",(e,t)=>{br.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=ii(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=ii(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length;n.allOf=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]]})(e,t,n,r)});var Co=/* @__PURE__ */je("ZodRecord",(e,t)=>{kr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object";const s=o.keyType,a=s._zod.bag?.patterns;if("loose"===o.mode&&a&&a.size>0){const e=ii(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const t of a)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=ii(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=ii(o.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&&(i.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Io(e,t,n){return new Co({type:"record",keyType:e,valueType:t,...lt(n)})}var Eo=/* @__PURE__ */je("ZodEnum",(e,t)=>{_r.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=Ge(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 i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new Eo({...t,checks:[],...lt(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Eo({...t,checks:[],...lt(r),entries:i})}});function To(e,t){return new Eo({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...lt(t)})}var Ao=/* @__PURE__ */je("ZodLiteral",(e,t)=>{Sr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,i=[];for(const o of r.values)if(void 0===o){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof o){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(0===i.length);else if(1===i.length){const e=i[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),i.every(e=>"boolean"==typeof e)&&(n.type="boolean"),i.every(e=>null===e)&&(n.type="null"),n.enum=i})(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 Mo(e,t){return new Ao({type:"literal",values:Array.isArray(e)?e:[e],...lt(t)})}var zo=/* @__PURE__ */je("ZodFile",(e,t)=>{Cr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:a}=e._zod.bag;void 0!==o&&(i.minLength=o),void 0!==s&&(i.maxLength=s),a?1===a.length?(i.contentMediaType=a[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=a.map(e=>({contentMediaType:e}))):Object.assign(r,i)})(e,0,n),e.min=(t,n)=>e.check(function(e,t){return new mn({check:"min_size",...lt(t),minimum:e})}(t,n)),e.max=(t,n)=>e.check(function(e,t){return new hn({check:"max_size",...lt(t),maximum:e})}(t,n)),e.mime=(t,n)=>e.check(function(e,t){return new Cn({check:"mime_type",mime:e,...lt(t)})}(Array.isArray(t)?t:[t],n))});var Oo=/* @__PURE__ */je("ZodTransform",(e,t)=>{Ir.init(e,t),Ri.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 Ue(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(gt(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(gt(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ro(e){return new Oo({type:"transform",transform:e})}var Po=/* @__PURE__ */je("ZodOptional",(e,t)=>{Tr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function No(e){return new Po({type:"optional",innerType:e})}var Lo=/* @__PURE__ */je("ZodExactOptional",(e,t)=>{Ar.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Do=/* @__PURE__ */je("ZodNullable",(e,t)=>{Mr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=ii(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $o(e){return new Do({type:"nullable",innerType:e})}var jo=/* @__PURE__ */je("ZodDefault",(e,t)=>{zr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});var Fo=/* @__PURE__ */je("ZodPrefault",(e,t)=>{Rr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Uo=/* @__PURE__ */je("ZodNonOptional",(e,t)=>{Pr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Bo=/* @__PURE__ */je("ZodCatch",(e,t)=>{Lr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});var Wo=/* @__PURE__ */je("ZodPipe",(e,t)=>{Dr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out;ii(o,t,r),t.seen.get(e).ref=o})(e,t,0,r),e.in=t.in,e.out=t.out});function Go(e,t){return new Wo({type:"pipe",in:e,out:t})}var Ho=/* @__PURE__ */je("ZodReadonly",(e,t)=>{jr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Zo=/* @__PURE__ */je("ZodCustom",(e,t)=>{Br.init(e,t),Ri.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 Vo(e,t={}){const n=new Zo({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...lt(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 qo(e,t){return Go(Ro(e),t)}function Yo(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...lt(t)})}(ro,e)}function Jo(e){return function(e,t){return new e({type:"boolean",coerce:!0,...lt(t)})}(ao,e)}function Ko(e){return function(e,t){return new e({type:"date",coerce:!0,...lt(t)})}(fo,e)}To(["free","starter","growth","enterprise"]);var Qo,Xo=To(["created","active","suspended","pending_approval"]),es=To(["free","starter","growth","enterprise"]),ts=To(["human","ai"]),ns=To(["male","female"]),rs=To(["active","learning","error"]),is=bo({vector_index_created:lo().nullable(),graph_index_created:lo().nullable()}),os=To(["document","video"]),ss=To(["pending","processing","waiting_review","completed","failed"]),as=(To(["pending","in_progress","completed","failed"]),To(["pending","in_progress","completed","failed","stopped"]),To(["user","agent"]),To(["widget","app"])),ls=(To(["tell","show","do"]),To(["app","website"])),cs=To(["widget"]),ds=To(["timer","github","slack","teams","jira","mcp"]),us=To(["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","slack_command"]),ps=bo({id:io().optional(),created_at:Ko().optional(),updated_at:Ko().optional()}),hs=bo({file:Vo(File),application_id:Yo().optional()}),ms=bo({id:Yo()}),fs=bo({slug:Li()}),gs=bo({agent_id:Yo()}),ys=bo({widget_id:Yo()}),ws=bo({simulation_id:Yo()}),bs=bo({application_id:Yo()}),vs=bo({user_id:Yo()}),xs=bo({success:Mo(!0)}),ks=xs.extend({message:Li()}),_s=(bo({workspace_id:Yo().optional()}),bo({application_id:Yo().optional()}),bo({limit:Yo().optional().default(50),offset:Yo().optional().default(0)})),Ss=e=>bo({items:yo(e),total:io(),limit:io(),offset:io()}),Cs=e=>bo({items:yo(e),count:io()}),Is=bo({status:Li(),timestamp:Li(),service:Li(),version:Li(),build:Li()}),Es=bo({name:Li(),version:Li(),build:Li(),status:Li(),timestamp:Li()}),Ts=To(["password","oauth"]),As=ps.extend({is_super:lo(),status:Xo,email:Li().email(),external_id:Li().nullish(),first_name:Li().nullish(),last_name:Li().nullish(),password:Li().nullish(),image_url:Li().nullish(),prompt_limit:io().nullish(),last_login_at:Ko().nullish(),auth_method:Ts.nullish()}),Ms=As.partial().extend({email:Li().email(),password:Li()}),zs=As.partial(),Os=bo({users:yo(Ms)}),Rs=bo({users:yo(As.partial())}),Ps=(bo({token:Li()}),ps.extend({name:Li(),slug:Li(),status:Xo,package:es,ending_date:Ko().nullish(),external_workspace_id:Li().nullish()})),Ns=Ps.partial().extend({name:Li().min(1)}),Ls=Ps.partial(),Ds=To(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]),$s=ps.extend({workspace_id:io(),package:es,ending_date:Ko(),stripe_subscription_id:Li().nullable(),stripe_price_id:Li().nullable(),status:Ds.default("active").optional()}),js=($s.partial().extend({workspace_id:io(),package:es}),$s.partial(),To(["owner","member"])),Fs=ps.extend({workspace_id:io(),user_id:io(),role:js}),Us=bo({id:io(),agent_name:Li(),image_url:Li().nullish()}),Bs=ps.extend({workspace_id:io(),application_id:io().optional(),file_name:Li().min(1),file_size:Yo(),file_type:os,file_url:Li(),source_url:Li().nullish(),agents:yo(Us).optional()}),Ws=To(["chromium","firefox","webkit"]),Gs=bo({browsers:yo(Ws).default(["chromium"]),parallel:lo().default(!1),fail_fast:lo().default(!1),timeout_per_browser:io().int().min(60).max(3600).optional()}),Hs=ps.extend({workspace_id:io(),user_id:io(),application_id:io(),file_name:Li().min(1),file_size:Yo(),file_type:Li(),file_url:Li(),file_path:Li().nullable(),text_content:Li().nullish(),additional_instructions:Li().max(1e3).nullish(),status:ss,processing_step:Li().nullish(),ultimate_goal:Li().nullish(),browser_config:Gs.nullish()}),Zs=bo({application_id:Yo(),file:Vo(File).optional(),text_content:Li().optional(),file_name:Li().optional(),additional_instructions:Li().max(1e3).optional()}),Vs=ps.extend({qa_flow_id:io(),workspace_id:io(),triggered_by:io(),browser_type:Ws,browser_config:Gs.nullish(),simulation_id:io().nullish(),source:To(["manual","automation","github_pr","slack_command"]).nullish(),source_metadata:Io(Li(),po()).nullish(),auto_heal:lo().default(!1)}),qs=To(["passed","needs_healing","failed"]),Ys=bo({outcome_reached:lo(),steps_aligned:lo(),healing_recommended:lo(),is_actual_bug:lo(),confidence:io().min(0).max(1),reasoning:Li(),evaluated_at:Li()}),Js=(ps.extend({qa_run_id:io(),qa_test_case_id:io(),simulation_task_id:Li().nullable(),verdict:qs,evaluation:Ys.nullable()}),bo({version:io().int().positive(),test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"]),change_type:To(["created","modified","self_healed","refined","deleted"]),change_reason:Li().nullish(),changed_by:io().nullish(),created_at:Li(),accepted:lo().optional()})),Ks=bo({failure_type:To(["locator","assertion","timeout","flow_change","environment"]),failure_message:Li().nullish(),failure_context:Io(Li(),po()).nullish(),repair_strategy:Li().nullish(),repair_details:Io(Li(),po()).nullish(),confidence_score:io().min(0).max(1).nullish(),validation_status:To(["pending","validated","failed","rejected"]),simulation_id:io().nullish(),validation_simulation_id:io().nullish(),healed_version:io().nullish(),created_at:Li()}),Qs=ps.extend({qa_flow_id:io(),workspace_id:io(),order_index:io().int().nonnegative(),test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"]),is_active:qo(e=>"number"==typeof e?0!==e:e,lo()),current_version:io().int().positive(),version_history:yo(Js).nullable(),healing_attempts:yo(Ks).nullable(),healing_metadata:Io(Li(),po()).nullish(),last_healed_at:Ko().nullish(),blocked_by:yo(bo({index:io().int().nonnegative(),condition:To(["pass"]).optional()})).default([])}),Xs=(bo({qa_flow_id:io(),test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"]).optional()}),bo({ultimateGoal:Li(),document:Hs,testCases:yo(bo({id:io(),title:Li(),prompt:Li(),objective:Li(),steps:yo(Li()),expectedOutcome:Li(),priority:To(["Low","Medium","High"])})),summary:bo({total:io(),estimatedTime:Li(),complexity:To(["Low","Medium","High"])})})),ea=bo({ultimate_goal:Li(),test_cases:yo(bo({test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"])})),summary:bo({total_tests:io(),high_priority:io(),medium_priority:io(),low_priority:io(),estimated_time_minutes:io()})}),ta=(_o("event",[bo({event:Mo("response.created"),data:bo({message:Li()})}),bo({event:Mo("response.progress"),data:bo({message:Li()})}),bo({event:Mo("response.clear"),data:bo({}).optional()}),bo({event:Mo("response.completed"),data:ea}),bo({event:Mo("error"),data:bo({detail:Li()})})]),xo([Li(),io(),lo(),yo(Li()),function(e,t){return new e({type:"null",...lt(t)})}(co,Qo)])),na=(To(["created","modified","self_healed","refined","deleted"]),To(["locator","assertion","timeout","flow_change","environment"])),ra=(To(["pending","validated","failed","rejected"]),bo({healing_enabled:lo().default(!0),auto_apply:lo().default(!1),min_confidence_threshold:io().min(0).max(1).default(.85),max_healing_attempts:io().int().min(1).max(5).default(2),last_healing_attempt:Li().datetime().nullable(),total_healing_attempts:io().int().default(0),successful_heals:io().int().default(0)}),bo({failure_type:na,is_healable:lo(),is_actual_bug:lo(),failure_message:Li(),failure_context:Io(Li(),po()),suggested_repair:bo({type:To(["update_locator","update_assertion","update_steps","skip_test"]),confidence:io().min(0).max(1),details:Io(Li(),po())}).nullable()})),ia=(bo({go_to_url:bo({url:Li(),new_tab:lo()})}),bo({click_element_by_index:bo({index:io().int().min(1)})}),bo({input_text:bo({index:io(),text:Li(),clear_existing:lo()})}),bo({write_file:bo({file_name:Li(),content:Li(),append:lo(),trailing_newline:lo(),leading_newline:lo()})}),bo({get_otp:bo({question:Li()})}),bo({done:bo({success:lo(),message:Li().optional()})}),bo({wait:bo({seconds:io()})}),bo({reload_page:bo({})}),bo({open_new_tab:bo({url:Li()})}),bo({navigate_to_url:bo({url:Li()})}),Io(Li(),po())),oa=bo({evaluation_previous_goal:Li().optional().nullable(),memory:Li().optional().nullable(),next_goal:Li().optional().nullable(),action:yo(ia).optional().nullable(),thinking:Li().optional().nullable()}).passthrough(),sa=bo({is_done:lo(),success:lo().optional().nullable(),long_term_memory:Li().optional().nullable(),extracted_content:Li().optional().nullable(),include_extracted_content_only_once:lo().optional().nullable(),include_in_memory:lo().optional().nullable(),error:Li().optional().nullable(),metadata:bo({click_x:io().optional(),click_y:io().optional(),new_tab_opened:lo().optional(),input_x:io().optional(),input_y:io().optional()}).passthrough().optional().nullable()}).passthrough(),aa=bo({url:Li(),title:Li(),tab_id:Li().optional(),parent_tab_id:Li().optional().nullable()}).passthrough(),la=bo({node_id:io().optional(),backend_node_id:io().optional(),frame_id:Li().optional().nullable(),node_type:io().optional(),node_value:Li().optional(),node_name:Li().optional(),attributes:Io(Li(),Li()).optional().nullable(),x_path:Li().optional(),element_hash:io().optional(),bounds:bo({x:io(),y:io(),width:io(),height:io()}).passthrough().optional().nullable(),stable_hash:io().optional(),ax_name:Li().optional().nullable()}).passthrough(),ca=bo({tabs:yo(aa),screenshot_path:Li().nullable(),interacted_element:yo(la.nullable()),url:Li(),title:Li()}).passthrough(),da=bo({step_start_time:io().optional().nullable(),step_end_time:io().optional().nullable(),step_number:io().optional().nullable(),step_interval:io().optional().nullable()}).passthrough(),ua=bo({model_output:oa.nullable(),result:yo(sa),state:ca,metadata:da.nullable(),state_message:Li().optional().nullable()}).passthrough(),pa=(bo({history:yo(ua)}),bo({step_number:io().int().positive(),topic:Li(),screenshot_url:Li().nullable(),title:Li().optional().nullable(),url:Li().optional().nullable()})),ha=(bo({status:Li(),status_message:Li().nullable(),task_id:Li().nullish(),created_at:Ko()}),bo({task_id:Li(),condition:To(["pass"]).optional()})),ma=bo({task_id:Li(),title:Li(),instructions:Li(),status:To(["pending","in_progress","passed","failed","skipped","stopped"]),error_message:Li().nullish(),started_at:Li().nullish(),completed_at:Li().nullish(),order_index:io().int().nonnegative().default(0),tab_id:Li().nullish(),step_count:io().int().nonnegative().default(0),blocked_by:yo(ha).default([])}),fa=ps.extend({application_id:io(),agent_id:io(),job_id:Li(),browser_session_id:Li().nullish(),status:Li(),status_message:Li().nullish(),path:Li().nullish(),instructions:Li().nullish(),pinned:lo().optional(),source:To(["direct","qa"]).optional(),agent_name:Li().nullish(),graph_index_id:Li().nullish(),source_metadata:Io(Li(),po()).nullish(),tasks:yo(ma).optional(),agents:yo(Us).optional(),mindmap_status:Li().optional(),mindmap_steps_processed:io().int().nonnegative().optional(),mindmap_steps_total:io().int().nonnegative().optional(),mindmap_error:Li().nullish()}),ga=(bo({user_id:io(),email:Li(),first_name:Li().optional().nullable(),last_name:Li().optional().nullable(),last_simulation_at:Li().optional()}),fa.partial().extend({application_id:io(),agent_id:io(),instructions:Li(),max_steps:io().int().positive().max(1e3).optional(),timeout:io().positive().max(360).optional()})),ya=bo({job_id:Li().optional(),status:Li().optional(),status_message:Li().optional(),pinned:lo().optional(),graph_index_id:Li().optional()}),wa=bo({answer:Li().min(1)}),ba=ps.extend({session_id:Li(),chat_id:Li(),application_id:Yo().nullish(),blob_url:Li().nullable(),event_count:Yo().int().nonnegative(),started_at:Ko(),ended_at:Ko().nullable(),is_active:qo(e=>"number"==typeof e?0!==e:e,lo()),metadata:bo({userAgent:Li().optional(),url:Li().optional()}).nullable(),last_batch_index:Yo().int().nullable(),last_event_timestamp:Yo().int().nullable(),last_upload_time:Ko().nullable()}),va=bo({session_id:Li().min(1),chat_id:Li().min(1),application_id:io().int().nullish(),blob_url:Li().nullish(),event_count:io().int().nonnegative().optional(),started_at:Ko().optional(),ended_at:Ko().nullish(),is_active:qo(e=>"number"==typeof e?0!==e:e,lo()).optional(),metadata:bo({userAgent:Li().optional(),url:Li().optional(),applicationId:io().optional()}).nullable().optional(),last_batch_index:io().int().nonnegative().nullish(),last_event_timestamp:io().int().nullish(),last_upload_time:Ko().nullish()}),xa=bo({id:io(),simulation_id:io(),status:Li(),status_message:Li().nullable(),created_at:Ko()}),ka=bo({start:Li(),end:Li(),action:Li()}).passthrough(),_a=bo({id:Li(),label:Li(),purpose:Li(),elements:yo(Io(Li(),po())).default([]),bbox:Io(Li(),po()).default({}),screenshot:Li().default(""),embedding:yo(io()).nullish()}).passthrough(),Sa=bo({id:Li(),title:Li(),url:Li(),summary:Li().default(""),screenshot:Li().default(""),sections:yo(_a).default([]),sequence_ids:yo(io()).default([]),embedding:yo(io()).nullish()}).passthrough(),Ca=bo({nodes:yo(Sa),edges:yo(ka)}),Ia=ps.extend({workspace_id:io(),user_id:io().nullish(),application_id:io(),agent_name:Li(),agent_type:ts,agent_voice:ns,agent_description:Li().nullish(),instructions:Li().nullish(),image_url:Li().nullish(),graph_index_id:Li().nullish(),vector_store_id:Li().nullish(),status:rs,status_message:Li().nullish(),learning_progress:is.nullish(),learning_started_at:Ko().nullish(),workspace:Ps.optional(),user:As.optional(),knowledge:yo(Bs).optional(),simulations:yo(fa).optional(),simulation_count:io().int().nonnegative().optional(),knowledge_count:io().int().nonnegative().optional()}),Ea=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[]},Ta=xo([yo(io()),Li()]).transform(Ea),Aa=xo([yo(io()),Li()]).transform(Ea),Ma=Ia.partial().extend({application_id:Yo(),agent_name:Li(),agent_type:ts,agent_voice:ns,agent_description:Li(),instructions:Li(),file:Vo(File).optional(),image_url:Li().optional(),knowledge_ids:Ta,simulation_ids:Aa}),za=Ia.partial().extend({file:Vo(File).optional(),knowledge_ids:Ta,simulation_ids:Aa}),Oa=(bo({text:Li(),task_id:Li().optional()}),bo({status:Li(),message:Li().optional()}),bo({task_id:Li().optional(),status:Li().optional(),current_step:Li().optional(),error:Li().optional(),message:Li().optional()}),bo({workflow_id:Li(),workflow_type:Li(),status:Li(),current_step:Li(),error:Li().nullable(),created_at:Li(),updated_at:Li()}),bo({browser_session_id:Li().optional(),live_view_url:Li().nullish(),status:Li().optional(),message:Li().nullish(),success:lo().optional()}),To(["pending","in_progress","completed","failed","stopped","has_question"]),bo({contentType:To(["document","video","automation_log","screenshot","all"]).optional(),context:Li().optional(),previousActions:yo(Li()).optional(),top:Yo().min(1).max(100).optional(),minConfidence:Yo().min(0).max(1).optional(),entities:yo(Li()).optional(),useVectorSearch:lo().optional(),vectorThreshold:Yo().min(0).max(1).optional()}),bo({id:Li(),content:Li(),contentType:To(["document","video","automation_log","screenshot"]),sourceFile:Li(),sourceType:Li(),metadata:Li(),confidence:io(),keyPhrases:yo(Li()),entities:yo(Li()),sentiment:Li(),vectorContent:yo(io())})),Ra=(bo({document:Oa,score:io(),highlights:Io(Li(),yo(Li())).optional()}),bo({simulation_id:Yo().positive("Simulation ID must be a positive number")})),Pa=bo({agent:Ia,simulation_id:io(),knowledge_id:io(),message:Li()}),Na=ps.extend({workspace_id:io(),name:Li(),type:ls,url:Li().nullish(),username:Li().nullish(),password:Li().nullish(),allowed_domains:yo(Li()).nullish().default([])}),La=Na.partial().extend({type:ls,name:Li().min(1),url:Li(),allowed_domains:yo(Li()).optional().default([])}),Da=Na.partial().omit({workspace_id:!0}),$a=bo({chip_mode:To(["show","tell","do"]),chip_text:Li()}),ja=bo({widget_enabled:lo(),widget_appearance:To(["default","compact","full"]),widget_position:To(["bottom_left","bottom_right","top_left","top_right"]),widget_device:To(["desktop","mobile","desktop_mobile"]),widget_header:Li(),widget_body:Li(),widget_greeting:Li(),widget_feature_tell:lo(),widget_feature_show:lo(),widget_feature_do:lo(),widget_feature_human:lo(),widget_background_color:Li(),widget_text_color:Li(),widget_border_color:Li(),widget_accent_color:Li(),widget_secondary_color:Li(),widget_border_radius:Li(),widget_font_size:Li(),widget_width:Li(),widget_height:Li(),widget_shadow:Li(),widget_animation_duration:Li(),widget_fade_duration:Li(),widget_bounce_effect:lo(),widget_chips:yo($a)}),Fa=bo({webhook_url:Li().url(),channel:Li(),bot_token:Li(),notifications_enabled:lo()}),Ua=ps.extend({application_id:io(),agent_id:io(),type:cs,settings:xo([ja,Fa]),status:Xo,marketrix_id:Li(),marketrix_key:Li(),snippet:Li().nullish()}),Ba=(Ua.extend({application:Na.partial(),workspace:Ps.partial(),user:As.partial(),agent:Ia.partial()}),Ua.extend({agent:Ia.partial().optional()})),Wa=(Na.extend({widgets:yo(Ua).optional(),agents:yo(Ia).optional()}),Ua.partial().extend({application_id:io().positive(),agent_id:io().positive(),type:cs,settings:xo([ja,Fa]).optional()})),Ga=Ua.partial(),Ha=ps.extend({widget_id:io(),url_pattern:Li(),message:xo([Li(),yo(Li())]),description:Li().optional()}),Za=Ha.partial().extend({widget_id:io().positive(),url_pattern:Li().min(1),message:xo([Li().min(1),yo(Li().min(1)).min(1)])}),Va=Ha.partial(),qa=(bo({marketrix_id:Li().optional(),marketrix_key:Li().optional(),agent_id:io().positive().optional(),application_id:io().positive().optional(),chat_id:Li().optional(),content:Li()}).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"}),bo({text:Li(),task_id:Li().optional()}),_o("type",[bo({type:Mo("registered"),chat_id:Li(),application_id:io().optional()}),bo({type:Mo("pong")}),bo({type:Mo("heartbeat")}),bo({type:Mo("chat/response"),request_id:Li(),text:Li(),task_id:Li().optional()}),bo({type:Mo("chat/error"),request_id:Li(),error:Li()}),bo({type:Mo("task/status"),status:To(["started","completed","failed","stopped","in_progress","has_question"]),message:Li().optional(),task_id:Li().optional(),timestamp:io().optional()}),bo({type:Mo("tool/call"),call_id:Li(),tool:Li(),args:Io(Li(),po()),mode:To(["show","do"]).optional(),explanation:Li().optional(),state_version:io().optional()})])),Ya=_o("type",[bo({type:Mo("chat/tell"),request_id:Li(),content:Li()}),bo({type:Mo("chat/show"),request_id:Li(),content:Li()}),bo({type:Mo("chat/do"),request_id:Li(),content:Li()}),bo({type:Mo("chat/stop"),task_id:Li().optional()}),bo({type:Mo("tool/response"),call_id:Li(),success:lo(),data:Li().optional(),error:Li().optional(),state_version:io().optional()}),bo({type:Mo("ping")}),bo({type:Mo("rrweb/metadata"),session_id:Li(),chat_id:Li(),application_id:io(),url:Li().optional(),user_agent:Li().optional(),timestamp:io().optional()}),bo({type:Mo("rrweb/events"),session_id:Li(),events:yo(po())})]),Ja=To(["simulations","agents","qa","user","jobs","triggers","automations"]),Ka=_o("type",[bo({type:Mo("simulation/updated"),simulation_id:io(),application_id:io(),status:Li(),step_label:Li().optional(),step_pending:lo().optional(),task_id:Li().nullish()}),bo({type:Mo("simulation/created"),simulation_id:io(),application_id:io()}),bo({type:Mo("simulation/deleted"),simulation_id:io(),application_id:io()}),bo({type:Mo("simulation/queued"),simulation_id:io(),job_id:Li()}),bo({type:Mo("simulation/started"),simulation_id:io(),job_id:Li()}),bo({type:Mo("simulation/step"),simulation_id:io(),job_id:Li(),step_count:io().optional(),message:Li().optional()}),bo({type:Mo("simulation/question"),simulation_id:io(),job_id:Li(),question:Li().optional()}),bo({type:Mo("simulation/completed"),simulation_id:io(),job_id:Li(),step_count:io().optional()}),bo({type:Mo("simulation/failed"),simulation_id:io(),job_id:Li(),error:Li().optional()}),bo({type:Mo("simulation/stopped"),simulation_id:io(),job_id:Li()}),bo({type:Mo("simulation/mindmap-updated"),simulation_id:io(),application_id:io(),mindmap_status:Li(),steps_processed:io(),steps_total:io()}),bo({type:Mo("qa-run/completed"),run_id:io(),status:Li()}),bo({type:Mo("agent/updated"),agent_id:io().optional(),context_id:Li().optional(),task_id:Li().optional(),application_id:io().optional(),status:Li()}),bo({type:Mo("agent/created"),agent_id:io(),application_id:io()}),bo({type:Mo("agent/deleted"),agent_id:io(),application_id:io()}),bo({type:Mo("qa-document/updated"),document_id:io(),application_id:io(),status:Li(),step_label:Li().optional()}),bo({type:Mo("qa-run/updated"),run_id:io(),document_id:io(),application_id:io(),status:Li(),simulation_id:io().optional()}),bo({type:Mo("qa-test/updated"),test_id:io(),run_id:io(),document_id:io(),application_id:io(),status:Li()}),bo({type:Mo("user/updated"),user_id:io(),workspace_id:io(),status:Li()}),bo({type:Mo("job/progress"),job_id:Li(),application_id:io(),status:Li(),message:Li().optional()}),bo({type:Mo("job/completed"),job_id:Li(),application_id:io(),result:po().optional()}),bo({type:Mo("job/failed"),job_id:Li(),application_id:io(),error:Li()}),bo({type:Mo("trigger/fired"),trigger_id:io(),workspace_id:io(),provider:Li(),name:Li(),payload:po().optional(),timestamp:Li()}),bo({type:Mo("automation-run/completed"),automation_id:io(),run_id:io(),status:Mo("completed")}),bo({type:Mo("automation-run/failed"),automation_id:io(),run_id:io(),status:Mo("failed"),error:Li().optional()})]),Qa=bo({details:Li().optional(),id:io().optional(),type:Li().optional(),name:Li().optional(),target_user_id:io().optional(),target_user_email:Li().optional(),reason:Li().optional(),assigned_role:Li().optional(),new_role:Li().optional(),previous_role:Li().optional(),workspace_name:Li().optional(),workspace_slug:Li().optional(),ip_address:Li().optional(),user_agent:Li().optional(),widget_type:Li().optional(),created_by:io().optional()}).passthrough(),Xa=ps.extend({workspace_id:io(),user_id:io(),type:us,metadata:Qa.optional()}),el=Xa.partial().extend({type:us}),tl=To(["widget_chat","app_chat","guide_preview","slack"]),nl=To(["user","agent","assistant","system","tool"]),rl=(ps.extend({context_id:Li(),workspace_id:io(),application_id:io().nullish(),agent_id:io().nullish(),user_id:io().nullish(),simulation_id:io().nullish(),session_id:io().nullish(),persona_id:io().nullish(),type:tl,channel_id:Li().nullish(),preview_video_url:Li().nullish(),metadata:Io(Li(),po()).nullish()}),ps.extend({conversation_id:io(),role:nl,content:Li(),tool_call_id:Li().nullish()}),ps.extend({workspace_id:io(),application_id:io().nullish(),provider:ds,name:Li().min(1).max(120),identifier:Li().max(120).nullish(),api_endpoint:Li().url().nullish(),api_token:Li().nullish(),metadata:Io(Li(),po()).nullish(),is_active:lo().default(!0),status:Xo.default("active")})),il=bo({id:Yo().optional(),application_id:io().nullish(),provider:ds,name:Li().min(1).max(120),identifier:Li().max(120).nullish(),api_endpoint:Li().url().nullish(),api_token:Li().nullish(),metadata:Io(Li(),po()).nullish(),is_active:lo().optional(),status:Xo.optional()}),ol=bo({application_id:io().nullish(),provider:ds.optional(),status:Xo.optional(),is_active:Jo().optional(),limit:Yo().int().positive().max(100).optional(),offset:Yo().int().nonnegative().optional()}),sl=bo({id:io(),application_id:io(),identifier:Li(),api_token:Li(),is_active:lo(),created_at:Ko().optional()}),al=bo({name:Li(),category:Li(),description:Li(),inputSchema:Io(Li(),po()),enabled:lo()}),ll=bo({id:io(),full_name:Li(),name:Li(),private:lo(),html_url:Li(),default_branch:Li().optional()}),cl=bo({id:io(),name:Li(),status:Li(),conclusion:Li().nullable(),created_at:Li(),updated_at:Li(),html_url:Li(),head_branch:Li(),run_attempt:io()}),dl=To(["pending","in_progress","completed","failed","stopped"]),ul=(To(["connector","condition"]),_o("kind",[bo({kind:Mo("connector"),connector_type:Li().min(1),connector_id:io().nullable().optional(),connection_id:io().nullable().optional(),trigger_id:io().nullable().optional(),action_id:io().nullable().optional(),capability:Li().min(1),role:To(["trigger","callback"]),config:Io(Li(),po()).default({})}),bo({kind:Mo("condition"),config:bo({field:Li().min(1),operator:To(["equals","not_equals","contains","gt","lt"]),value:po()})})])),pl=bo({from:Li().min(1),to:Li().min(1),when:To(["true","false"]).optional()}),hl=bo({nodes:Io(Li(),ul),edges:yo(pl)}),ml=To(["skip","queue","replace"]).default("skip"),fl=ps.extend({workspace_id:io(),created_by_user_id:io().nullable(),name:Li(),graph:hl,concurrency:ml,enabled:lo(),last_run_at:Ko().nullable(),next_run_at:Ko().nullable()}),gl=bo({name:Li().min(1).max(255),graph:hl,concurrency:ml.optional(),enabled:lo().optional()}),yl=bo({id:Yo(),name:Li().min(1).max(255).optional(),graph:hl.optional(),enabled:lo().optional()}),wl=bo({enabled:Jo().optional(),limit:Yo().int().positive().max(100).optional(),offset:Yo().int().nonnegative().optional()}),bl=bo({status:To(["in_progress","completed","failed","skipped","stopped"]),output:Io(Li(),po()).nullable().optional(),error:Li().nullable().optional(),duration_ms:io().optional()}),vl=bo({id:io().optional(),automation_id:io(),status:dl,trigger_node_id:Li(),trigger_data:Io(Li(),po()).nullable(),node_results:Io(Li(),bl),started_at:Ko(),completed_at:Ko().nullable()}),xl=bo({status:dl.optional(),limit:Yo().int().positive().max(100).optional(),offset:Yo().int().nonnegative().optional()}),kl=bo({connector_type:Li(),built_in:lo(),triggers:yo(bo({capability:Li(),description:Li(),config_schema:Io(Li(),po())})),callbacks:yo(bo({capability:Li(),description:Li(),config_schema:Io(Li(),po())}))}),_l=bo({filename:Li(),status:Li(),additions:io(),deletions:io(),patch:Li().optional()}),Sl=(bo({event:Li(),action:Li(),pull_request:bo({number:io(),title:Li(),html_url:Li(),head:bo({sha:Li(),ref:Li()}),base:bo({ref:Li()})}),repository:bo({full_name:Li(),name:Li(),owner:bo({login:Li()})}),sender:bo({login:Li()}),files:yo(_l).optional()}),bo({name:Li(),head_sha:Li(),status:To(["queued","in_progress","completed"]).optional(),conclusion:To(["success","failure","neutral","cancelled","timed_out","action_required"]).optional(),started_at:Li().optional(),completed_at:Li().optional(),output:bo({title:Li(),summary:Li(),text:Li().optional()}).optional()}),bo({migration_type:Li().optional(),dry_run:lo().default(!0)})),Cl=bo({migration_type:Li().optional(),backup:lo().default(!0)}),Il=bo({url:Li()}),El=(bo({user_id:io(),file:Vo(File)}),bo({user_id:io(),application_id:io(),source:as,prompt:Li(),status:Li()}),bo({user_id:io(),limit:io(),used:io(),remaining:io()})),Tl=(bo({user_id:io(),workspace_id:io(),chat_count:io(),prompt_text:Li(),metadata:Io(Li(),Li()).optional()}),bo({to:Li(),subject:Li(),template:Li(),context:Io(Li(),Li())}),bo({id:Li(),object:Mo("event"),api_version:Li().nullish(),created:io(),data:bo({object:Io(Li(),po()),previous_attributes:Io(Li(),po()).optional()}),livemode:lo(),pending_webhooks:io(),request:bo({id:Li().nullable(),idempotency_key:Li().nullable()}).nullable().optional(),type:Li()}),bo({priceId:Li().min(1,"Price ID is required"),successUrl:Li().url("Success URL must be a valid URL"),cancelUrl:Li().url("Cancel URL must be a valid URL")})),Al=bo({returnUrl:Li().url("Return URL must be a valid URL")}),Ml=bo({plan:To(["starter","growth"]).default("starter"),interval:To(["month","year"]).default("month")}),zl=bo({subscriptionId:Li().min(1,"Subscription ID is required"),priceId:Li().min(1,"Price ID is required")}),Ol=bo({success:lo(),message:Li()}),Rl=bo({subscriptionId:Li().nullable(),customerId:Li().nullable(),status:To(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]).nullable(),planTier:To(["free","starter","growth","enterprise"]).nullable(),billingInterval:To(["month","year"]).nullable(),priceId:Li().nullable(),trialEndDate:Ko().nullable(),currentPeriodStart:Ko().nullable(),currentPeriodEnd:Ko().nullable(),cancelAtPeriodEnd:lo(),isTrialing:lo(),daysRemainingInTrial:io().nullable(),trialProvisioned:lo()}),Pl=bo({sessionId:Li(),url:Li().url()}),Nl=bo({url:Li().url()}),Ll=bo({subscriptionId:Li(),customerId:Li(),status:Mo("trialing"),trialStartDate:Ko(),trialEndDate:Ko(),planTier:To(["starter","growth"]),daysRemainingInTrial:io()}),Dl=bo({used:io().int().min(0),limit:io().int()}),$l=bo({applications:Dl,simulationsPerMonth:Dl,userPrompts:Dl}),jl=bo({amount:io().int().min(0),currency:Li().default("usd"),formatted:Li()}),Fl=bo({planId:To(["free","starter","growth","enterprise"]),monthly:jl.nullable(),annual:jl.nullable(),priceIds:bo({monthly:Li().nullable(),annual:Li().nullable()})}),Ul=bo({plans:yo(Fl),lastUpdated:Li().datetime()}),Bl=bo({id:To(["free","starter","growth","enterprise"]),name:Li(),description:Li(),features:yo(Li()),cta:Li(),isPopular:lo(),customPriceDisplay:Li().optional(),priceSubtext:Li().optional(),borderColor:Li(),buttonColor:Li(),outlineColor:Li(),checkColor:Li()}),Wl=bo({plans:yo(Bl)}),Gl=bo({publishableKey:Li(),priceIds:bo({starter:bo({monthly:Li().nullable(),annual:Li().nullable()}),growth:bo({monthly:Li().nullable(),annual:Li().nullable()})}),trialDays:io().int().min(0),calendlyUrl:Li()}),Hl=bo({widgetKey:Li(),widgetId:Li(),widgetUrl:Li()}),Zl=bo({date:Li().describe("YYYY-MM-DD"),sessions:io().int().nonnegative(),events:io().int().nonnegative()}),Vl=bo({items:yo(Zl)}),ql=bo({role:To(["user","assistant","system"]),content:Li(),timestamp:Li().optional()}),Yl=ps.extend({workspace_id:io(),application_id:io().nullish(),agent_id:io().nullish(),simulation_id:io().nullish(),chat_id:Li(),chat_content:Li().nullish(),chat_history:yo(ql).nullish(),chat_output:Li().nullish(),preview_video_url:Li().nullish(),metadata:Io(Li(),po()).nullish()}),Jl=bo({application_id:io().nullish(),agent_id:io().nullish(),simulation_id:io().nullish(),chat_id:Li(),chat_content:Li().nullish(),chat_history:yo(ql).nullish(),chat_output:Li().nullish(),preview_video_url:Li().nullish(),metadata:Io(Li(),po()).nullish()}),Kl=bo({chat_id:Li().optional(),agent_id:io().optional(),simulation_id:io().optional(),limit:io().optional(),offset:io().optional()}),Ql=To(["github","slack","teams","jira"]),Xl=To(["github","slack","teams","jira","timer","mcp"]),ec=To(["github","slack","teams","jira","internal"]),tc=To(["connected","disconnected"]),nc=ps.extend({workspace_id:io(),provider:Ql,status:tc.default("disconnected"),credentials:Io(Li(),po()).nullish(),provider_data:Io(Li(),po()).nullish(),connected_at:Ko().nullish()}),rc=ps.extend({workspace_id:io(),connection_id:io().nullish(),connector_id:io().nullish(),provider:Xl,name:Li().min(1).max(255),source_config:Io(Li(),po()).default({}),webhook_id:Li(),webhook_secret:Li(),enabled:lo().default(!0),last_triggered_at:Ko().nullish()}),ic=bo({connection_id:io().nullish(),connector_id:io().nullish(),provider:Xl,name:Li().min(1).max(255),source_config:Io(Li(),po()).default({})}),oc=bo({trigger_id:Yo(),name:Li().min(1).max(255).optional(),source_config:Io(Li(),po()).optional(),enabled:lo().optional()}),sc=bo({provider:Xl.optional(),connection_id:Yo().optional(),connector_id:Yo().optional()}).extend(_s.shape),ac=ps.extend({workspace_id:io(),connection_id:io().nullish(),provider:ec,name:Li().min(1).max(255),type:Li().min(1).max(60),target_config:Io(Li(),po()).default({}),is_default:lo().default(!1),enabled:lo().default(!0),last_executed_at:Ko().nullish()}),lc=bo({connection_id:io().nullish(),provider:ec,name:Li().min(1).max(255),type:Li().min(1).max(60),target_config:Io(Li(),po()).default({})}),cc=bo({action_id:Yo(),name:Li().min(1).max(255).optional(),target_config:Io(Li(),po()).optional(),enabled:lo().optional()}),dc=bo({provider:ec.optional(),type:Li().optional()}).extend(_s.shape),uc=To(["connected","not_connected"]),pc=bo({key:Li(),label:Li(),color:Li(),status:uc,session_count:io().nullable()}),hc=bo({id:io(),application_id:io(),name:Li(),percentage:io(),description:Li(),avg_sessions_per_week:io(),mobile_percentage:io(),created_at:Ko().optional(),updated_at:Ko().optional()}),mc=bo({id:io(),application_id:io(),segment_id:io().nullable(),segment_name:Li().optional(),name:Li(),initials:Li(),description:Li(),traits:yo(Li()),created_at:Ko().optional(),updated_at:Ko().optional()}),fc=bo({connectors:yo(pc),segments:yo(hc),personas:yo(mc)}),gc=To(["clicks","scroll","attention"]),yc=To(["desktop","tablet","mobile"]),wc=bo({x:io(),y:io(),radius:io(),intensity:io()}),bc=bo({total_interactions:io(),unique_users:io(),hottest_zone:Li(),dead_zones:io()}),vc=bo({id:io(),application_id:io(),path:Li(),session_count:io(),variation_count:io()}),xc=bo({id:io(),heatmap_page_id:io(),variation:yc,type:gc,spots:yo(wc),stats:bc}),kc=bo({score:io().min(1).max(10),justification:Li()}),_c=bo({id:io(),run_id:io(),persona_id:io().nullable(),persona_name:Li().optional(),persona_initials:Li().optional(),ad_hoc_persona:bo({name:Li(),description:Li(),traits:yo(Li())}).nullable().optional(),overall_reactions:Io(Li(),kc),dimension_scores:Io(Li(),kc),created_at:Ko().optional()}),Sc=bo({type:To(["doc","sim","session"]),id:Li(),label:Li()}),Cc=bo({description:Li(),selected:lo()}),Ic=bo({id:io(),reaction_id:io(),run_number:io().optional(),context_refs:yo(Sc),simulations:yo(Cc),persona_ids:yo(io()).optional(),results:yo(_c).optional(),created_at:Ko().optional()}),Ec=bo({id:io(),application_id:io(),question:Li(),run_count:io().optional(),last_run_at:Ko().optional(),runs:yo(Ic).optional(),created_at:Ko().optional()}),Tc=bo({contextRefs:yo(Sc),suggestedSimulations:yo(Cc)}),Ac=To(["received","classifying","dispatched","completed","failed"]),Mc=bo({id:io(),workspace_id:io(),slack_user_id:Li(),slack_channel_id:Li().nullable(),raw_text:Li(),detected_intent:Li(),extracted_params:Io(Li(),po()),status:Ac,response_text:Li().nullable(),error_message:Li().nullable(),duration_ms:io().nullable(),created_at:Ko().optional(),updated_at:Ko().optional()}),zc=bo({intent:Li().optional(),limit:Yo().optional().default(20),offset:Yo().optional().default(0)}),Oc=bo({intent:Li(),name:Li(),description:Li(),example:Li(),execution_count:io(),last_used:Li().nullable()}),Rc=class extends Error{issues;data;constructor(e){super(e.message,e),this.issues=e.issues,this.data=e.data}};function Pc(e,t){return{...e,...t}}var Nc=class{"~orpc";constructor(e){if(e.route?.successStatus&&X(e.route.successStatus))throw new Error("[ContractProcedure] Invalid successStatus.");if(Object.values(e.errorMap).some(e=>e&&e.status&&!X(e.status)))throw new Error("[ContractProcedure] Invalid error status code.");this["~orpc"]=e}};function Lc(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 Dc(e,t){if((n=e)instanceof Nc||("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 Nc({...e["~orpc"],errorMap:Pc(t.errorMap,e["~orpc"].errorMap),route:Lc(e["~orpc"].route,t)});var n;if("object"!=typeof e||null===e)return e;const r={};for(const i in e)r[i]=Dc(e[i],t);return r}var $c=new class e extends Nc{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:Pc(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 Dc(e,this["~orpc"])}}({errorMap:{},route:{},meta:{}}),jc=Symbol("ORPC_EVENT_ITERATOR_DETAILS");function Fc(e,t){return{"~standard":{[jc]:{yields:e,returns:t},vendor:"orpc",version:1,validate:n=>D(n)?{value:ge(n,{async value(n,r){const i=r?t:e;if(!i)return n;const o=await i["~standard"].validate(n);if(o.issues)throw new Q("EVENT_ITERATOR_VALIDATION_FAILED",{message:"Event iterator validation failed",cause:new Rc({issues:o.issues,message:"Event iterator validation failed",data:n})});return o.value},error:async e=>e})}:{issues:[{message:"Expect event iterator",path:[]}]}}}}$c.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),$c.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),$c.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(bo({url:Li().url(),skip_network:Li().optional()})).output(bo({valid:lo(),accessible:lo(),dnsResolves:lo(),error:Li().optional().describe("Error message if URL validation failed"),warnings:yo(Li()).optional().describe("Non-fatal issues found during URL validation")})),$c.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(Hl),$c.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(bo({user:As,workspace:Ps.nullable(),workspaces:yo(bo({id:io(),name:Li(),slug:Li(),role:To(["owner","member"])}))})),$c.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(bo({token:Li().min(1)})).output(bo({result:Li().describe("HTML response page")})),$c.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(bo({name:Li().min(1).max(45),slug:Li().min(1).max(45).optional(),domain:Li().min(1).max(200),team_emails:yo(Li().email()).optional().default([]),app_url:Li().optional(),app_username:Li().optional(),app_password:Li().optional()})).output(bo({workspace:Ps})),$c.route({method:"POST",tags:["Workspace"],path:"/workspaces",summary:"Create a new workspace",description:"Creates new workspace with specified settings and returns workspace entity"}).input(Ns).output(Ps),$c.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(bo({name:Li().optional(),domain:Li().optional(),email:Li().email().optional(),app_id:Yo().optional(),workspace_id:Yo().optional(),user_id:Yo().optional()}).extend(_s.shape)).output(Ss(Ps)),$c.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(bo({name:Li(),slug:Li()}).nullable()),$c.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(Ps),$c.route({method:"POST",tags:["Workspace"],path:"/workspaces/{slug}/select",summary:"Select the active workspace for the current session",description:"Updates the server-side session workspace context to match the selected workspace slug."}).input(fs).output(Ps),$c.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:Li()})).output(Ps),$c.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),$c.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})}))),$c.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:Li().email(),role:js.default("member")})).output(Fs),$c.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:io()})).output(xs),$c.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:io(),role:js})).output(Fs),$c.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(Ps.extend({role:js}))),$c.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(bo({workspaces_stripe_created:io(),users_workos_created:io(),workspace_plans_synced:io(),trials_provisioned:io(),stripe_plans_refreshed:io(),workos_profiles_synced:io(),errors:yo(bo({type:Li(),id:io(),error:Li()}))})),$c.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(bo({cosmos_containers_deleted:io(),orphaned_qa_simulations_deleted:io(),orphaned_blob_dirs_deleted:io(),errors:yo(bo({type:Li(),detail:Li()}))})),$c.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(bo({knowledge_removed:io(),simulations_removed:io(),agents_rebuilt:io(),errors:yo(bo({type:Li(),detail:Li()}))})),$c.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(La).output(Na),$c.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(bo({type:ls.optional(),include:yo(To(["widgets"])).optional()}).extend(_s.shape)).output(Ss(Na.extend({widgets:yo(Ua).optional()}))),$c.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(Na.extend({widgets:yo(Ua)})),$c.route({method:"PUT",tags:["Application"],path:"/applications/{application_id}",summary:"Update application",description:"Updates application details and configuration"}).input(Da.extend({application_id:Yo()})).output(Na),$c.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),$c.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(Wa).output(Ua),$c.route({method:"GET",tags:["Widget"],path:"/widgets",summary:"Search widgets for workspace",description:"Search widgets by type, application, marketrix_id, or marketrix_key"}).input(bo({type:cs.optional(),application_id:Yo().optional(),marketrix_id:Li().optional(),marketrix_key:Li().optional(),include:yo(To(["agent"])).optional()}).extend(_s.shape)).output(Ss(Ba)),$c.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(bo({type:cs})).output(xo([ja,Fa])),$c.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(Ua),$c.route({method:"PUT",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Update widget",description:"Updates widget settings and configuration"}).input(Ga.extend({widget_id:Yo()})).output(Ua),$c.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),$c.route({method:"POST",tags:["Chat"],path:"/chat",summary:"Create a new chat thread",description:"Initializes new chat thread and returns session ID"}).output(Li()),$c.route({method:"GET",tags:["Chat"],path:"/chat",summary:"Search chats by user",description:"Returns chat list and quota for the specified user"}).input(bo({user_id:Yo().optional(),chat_id:Yo().optional()})).output(El),$c.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(Yl),$c.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(Kl).output(Cs(Yl)),$c.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(Yl.nullable()),$c.route({method:"POST",tags:["Connector"],path:"/connector",summary:"Create or update connector",description:"Stores provider credentials and API endpoint details for workspace connectors"}).input(il).output(rl),$c.route({method:"GET",tags:["Connector"],path:"/connector",summary:"Search connectors",description:"Returns workspace connectors filtered by provider/status"}).input(ol).output(Ss(rl)),$c.route({method:"GET",tags:["Connector"],path:"/connector/{id}",summary:"Get connector by ID",description:"Returns a single workspace connector"}).input(ms).output(rl.nullable()),$c.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),$c.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(bo({id:Yo(),per_page:Yo().int().min(1).max(100).optional(),page:Yo().int().min(1).optional()})).output(yo(ll)),$c.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(bo({id:Yo(),owner:Li().min(1),repo:Li().min(1),per_page:Yo().int().min(1).max(100).optional(),page:Yo().int().min(1).optional()})).output(yo(cl)),$c.route({method:"POST",tags:["MCP"],path:"/mcp/activate",summary:"Activate MCP for an application",description:"Creates or reactivates an MCP connector with auto-generated credentials."}).input(bo({application_id:Yo()})).output(sl),$c.route({method:"POST",tags:["MCP"],path:"/mcp/deactivate",summary:"Deactivate MCP for an application",description:"Deactivates the MCP connector. Credentials are preserved but access is revoked."}).input(bo({application_id:Yo()})).output(sl),$c.route({method:"POST",tags:["MCP"],path:"/mcp/regenerate",summary:"Regenerate MCP API key",description:"Generates a new API key for the MCP connector. Existing integrations will break."}).input(bo({application_id:Yo()})).output(sl),$c.route({method:"GET",tags:["MCP"],path:"/mcp/status/{application_id}",summary:"Get MCP activation status",description:"Returns the MCP connector status for an application, or null if not activated."}).input(bo({application_id:Yo()})).output(sl.nullable()),$c.route({method:"GET",tags:["MCP"],path:"/mcp/tools/{application_id}",summary:"List MCP platform tools",description:"Returns all platform tools with their enabled/disabled state."}).input(bo({application_id:Yo()})).output(yo(al)),$c.route({method:"PATCH",tags:["MCP"],path:"/mcp/tools/toggle",summary:"Toggle a platform tool",description:"Enable or disable a specific platform tool for the MCP server."}).input(bo({application_id:Yo(),tool_name:Li(),enabled:lo()})).output(yo(al)),$c.route({method:"POST",tags:["Automation"],path:"/automation",summary:"Create automation",description:"Creates a DAG-based automation workflow"}).input(gl).output(fl),$c.route({method:"GET",tags:["Automation"],path:"/automation",summary:"List automations",description:"Returns automations for the current workspace"}).input(wl).output(Ss(fl)),$c.route({method:"GET",tags:["Automation"],path:"/automation/{id}",summary:"Get automation",description:"Returns a single automation with its graph"}).input(ms).output(fl.nullable()),$c.route({method:"PUT",tags:["Automation"],path:"/automation/{id}",summary:"Update automation",description:"Updates automation graph and settings"}).input(yl).output(fl),$c.route({method:"DELETE",tags:["Automation"],path:"/automation/{id}",summary:"Delete automation",description:"Permanently deletes an automation and deregisters its triggers"}).input(ms).output(xs),$c.route({method:"PATCH",tags:["Automation"],path:"/automation/{id}/toggle",summary:"Toggle automation",description:"Enable or disable an automation"}).input(bo({id:Yo(),enabled:lo()})).output(fl),$c.route({method:"POST",tags:["Automation"],path:"/automation/{id}/run",summary:"Trigger automation run",description:"Manually triggers an automation run"}).input(ms).output(vl.nullable()),$c.route({method:"GET",tags:["Automation"],path:"/automation/{id}/runs",summary:"List automation runs",description:"Returns execution history for an automation"}).input(bo({id:Yo()}).extend(xl.shape)).output(Ss(vl)),$c.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(bo({id:Yo(),run_id:Yo()})).output(vl.nullable()),$c.route({method:"GET",tags:["Connection"],path:"/connection/{provider}",summary:"Get connection for a provider"}).input(bo({provider:Ql})).output(nc.nullable()),$c.route({method:"DELETE",tags:["Connection"],path:"/connection/{provider}",summary:"Disconnect a provider"}).input(bo({provider:Ql})).output(bo({success:lo()})),$c.route({method:"POST",tags:["Connection"],path:"/connection/{provider}/refresh",summary:"Re-fetch provider data using stored credentials"}).input(bo({provider:Ql})).output(nc),$c.route({method:"POST",tags:["Trigger"],path:"/trigger",summary:"Create a new trigger"}).input(ic).output(rc),$c.route({method:"GET",tags:["Trigger"],path:"/trigger/{trigger_id}",summary:"Get a single trigger"}).input(bo({trigger_id:Yo()})).output(rc),$c.route({method:"GET",tags:["Trigger"],path:"/trigger",summary:"List triggers"}).input(sc).output(Ss(rc)),$c.route({method:"PUT",tags:["Trigger"],path:"/trigger/{trigger_id}",summary:"Update trigger"}).input(oc).output(rc),$c.route({method:"DELETE",tags:["Trigger"],path:"/trigger/{trigger_id}",summary:"Delete a trigger"}).input(bo({trigger_id:Yo()})).output(bo({success:lo()})),$c.route({method:"PATCH",tags:["Trigger"],path:"/trigger/{trigger_id}/toggle",summary:"Toggle trigger enabled state"}).input(bo({trigger_id:Yo()})).output(rc),$c.route({method:"POST",tags:["Trigger"],path:"/trigger/{trigger_id}/install",summary:"Auto-install trigger configuration on the provider"}).input(bo({trigger_id:Yo()})).output(bo({success:lo(),message:Li()})),$c.route({method:"GET",tags:["Slack"],path:"/slack/command-log",summary:"Search slash command logs"}).input(zc).output(Ss(Mc)),$c.route({method:"GET",tags:["Slack"],path:"/slack/capabilities",summary:"Get Slack capability stats"}).output(yo(Oc)),$c.route({method:"POST",tags:["Action"],path:"/action",summary:"Create a custom action"}).input(lc).output(ac),$c.route({method:"GET",tags:["Action"],path:"/action/{action_id}",summary:"Get a single action"}).input(bo({action_id:Yo()})).output(ac),$c.route({method:"GET",tags:["Action"],path:"/action",summary:"List actions"}).input(dc).output(Ss(ac)),$c.route({method:"PUT",tags:["Action"],path:"/action/{action_id}",summary:"Update action"}).input(cc).output(ac),$c.route({method:"DELETE",tags:["Action"],path:"/action/{action_id}",summary:"Delete an action"}).input(bo({action_id:Yo()})).output(bo({success:lo()})),$c.route({method:"PATCH",tags:["Action"],path:"/action/{action_id}/toggle",summary:"Toggle action enabled state"}).input(bo({action_id:Yo()})).output(ac),$c.route({method:"GET",tags:["Connector"],path:"/connector-capabilities",summary:"List connector capabilities",description:"Returns available triggers and callbacks per connector type"}).input(bo({})).output(yo(kl)),$c.route({method:"GET",tags:["User"],path:"/user",summary:"Search and filter users by workspace",description:"Returns list of users associated with specified workspace"}).input(bo({workspace_id:Yo().optional(),status:Xo.optional()}).extend(_s.shape)).output(Ss(As)),$c.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(Os).output(yo(Rs)),$c.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),$c.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(zs.extend({user_id:Yo()})).output(As),$c.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:Yo()})).output(Il),$c.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),$c.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:Li().optional()})).output(xs),$c.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(Ma).output(Ia),$c.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(bo({workspace_id:Yo().optional(),user_id:Yo().optional(),application_id:Yo().optional(),include:yo(To(["knowledge","simulations"])).optional()}).extend(_s.shape)).output(Ss(Ia)),$c.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:yo(To(["knowledge","simulations"])).optional()})).output(Ia),$c.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(Ca),$c.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(za.extend({agent_id:Yo(),force_reset_learning:Jo().optional()})).output(Ia),$c.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),$c.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(Ra.extend({agent_id:Yo()})).output(Pa),$c.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(Ia),$c.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),$c.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(bo({workspace_id:Yo().optional(),type:us.optional(),application_id:Yo().optional()}).extend(_s.shape)).output(Ss(Xa)),$c.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(Ha)),$c.route({method:"POST",tags:["URL Guide"],path:"/url-guide",summary:"Create new URL guide",description:"Creates URL guide with pattern and message"}).input(Za).output(Ha),$c.route({method:"GET",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Get URL guide by ID",description:"Returns URL guide details"}).input(ms).output(Ha),$c.route({method:"PUT",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Update URL guide",description:"Updates URL guide properties"}).input(Va.extend({id:Yo()})).output(Ha),$c.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),$c.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(bo({widget_id:Yo(),url:Li()})).output(Ha.nullable()),$c.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Get a single simulation by ID"}).input(bo({simulation_id:Yo()})).output(fa),$c.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(bo({workspace_id:Yo().optional(),application_id:Yo().optional(),agent_id:Yo().optional(),pinned:xo([lo(),Li()]).optional().transform(e=>void 0===e?void 0:"boolean"==typeof e?e:"true"===e||"false"!==e&&void 0),source:To(["direct","qa"]).optional(),include:yo(To(["agent","application"])).optional()}).extend(_s.shape)).output(Ss(fa)),$c.route({method:"POST",tags:["Simulation"],path:"/simulation/start",summary:"Start new application simulation",description:"Creates and initializes simulation with specified parameters"}).input(ga).output(fa),$c.route({method:"PUT",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Update simulation configuration and status",description:"Modifies simulation parameters and updates execution state"}).input(ya.extend({simulation_id:Yo()})).output(fa),$c.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:yo(io())})).output(fa),$c.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.extend({task_id:Li().optional()})).output(Cs(xa)),$c.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/task/{task_id}/live-view",summary:"Get per-task live view URL",description:"Returns Browserbase per-tab live view URL for a specific task within a simulation."}).input(bo({simulation_id:Yo().int().positive(),task_id:Li()})).output(bo({live_view_url:Li(),status:Li()})),$c.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.extend({task_id:Li()})).output(Cs(ua)),$c.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)),$c.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(Ca),$c.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),$c.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(wa.extend({simulation_id:Yo()})).output(ks),$c.route({method:"POST",tags:["Simulation"],path:"/simulation/{simulation_id}/retry-mindmap",summary:"Retry mindmap generation",description:"Restarts mindmap generation from stored history for a simulation."}).input(bo({simulation_id:Yo()})).output(ks),$c.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),$c.route({method:"POST",tags:["Session"],path:"/sessions",summary:"Create or update session",description:"Creates a new session or updates an existing one"}).input(va).output(ba),$c.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}",summary:"Get session by session ID",description:"Retrieves a session by its session_id"}).input(bo({session_id:Li().min(1)})).output(ba.nullable()),$c.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(bo({chat_id:Li().min(1)})).output(Cs(ba)),$c.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(bo({application_id:Yo().optional(),start_date:Li().optional(),end_date:Li().optional()}).extend(_s.shape)).output(Ss(ba)),$c.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(bo({application_id:Yo(),start_date:Li().describe("YYYY-MM-DD"),end_date:Li().describe("YYYY-MM-DD")})).output(Vl),$c.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}/events",summary:"Get session events (paginated by batch)",description:"Fetches batches from storage in pages. Use batch_offset/batch_limit to paginate."}).input(bo({session_id:Li().min(1),batch_offset:Yo().int().nonnegative().default(0),batch_limit:Yo().int().positive().max(50).default(20)})).output(bo({items:yo(bo({type:io(),timestamp:io(),data:po().describe("rrweb event payload — shape defined by rrweb library")})),count:io(),total_batches:io(),batch_offset:io(),batch_limit:io()})),$c.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(bo({application_id:io(),agent_id:io(),url:Li().nullish()})).output(bo({browser_session_id:Li(),live_view_url:Li()})),$c.route({method:"POST",tags:["Browser Session"],path:"/browser-session/{browser_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(bo({browser_session_id:Li(),stop_tasks:lo().optional().default(!0)})).output(ks),$c.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(bo({workspace_id:Yo().optional(),type:os.optional(),application_id:Yo().optional(),include:yo(To(["agents","application"])).optional()}).extend(_s.shape)).output(Ss(Bs)),$c.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(bo({file:function(e){return function(e,t){return new e({type:"file",...lt(t)})}(zo,e)}().optional(),application_id:Yo(),document_url:Li().url().optional(),document_name:Li().optional(),video_url:Li().url().optional(),video_name:Li().optional()})).output(Bs),$c.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),$c.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),$c.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),$c.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(bo({knowledge_id:Yo(),agent_ids:yo(io())})).output(Bs),$c.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),$c.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(bo({document:Hs})),$c.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:Li().min(5).max(2e3)})).output(Xs),$c.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(Fc(bo({event:Li().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:po().describe("Event payload object — shape varies by event type")}))),$c.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:Li().min(5)})).output(Fc(bo({event:Li().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:po().describe("Event payload object — shape varies by event type")}))),$c.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),$c.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(bo({application_id:Yo().optional()}).extend(_s.shape)).output(Ss(Hs.extend({run_count:io(),display_title:Li(),total_failed:io(),pass_rate:io().nullable(),last_run:bo({id:io(),status:Li(),total_tests:io(),passed_tests:io(),failed_tests:io(),created_at:Ko().nullable()}).nullable()})).extend({metrics:bo({total_flows:io(),total_runs:io(),avg_pass_rate:io().nullable(),total_failed:io(),total_passed:io()})})),$c.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),$c.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:ss})).output(Hs),$c.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:io(),passed:io(),failed:io()}))),$c.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:yo(Qs)})),$c.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),$c.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(bo({run:Vs,simulations:yo(fa)})),$c.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:Yo().optional()})).output(Cs(Qs)),$c.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:Li().optional(),test_objective:Li().optional(),test_steps:yo(Li()).optional(),expected_outcome:Li().optional(),priority:To(["Low","Medium","High"]).optional(),is_active:lo().optional()})).output(Qs),$c.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(bo({run:Vs,simulations:yo(fa)})),$c.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(bo({simulation:fa})),$c.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 for a specific run, or null if no simulation exists."}).input(ms.extend({run_id:Yo().int().positive().optional()})).output(bo({simulation:fa.nullable()})),$c.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(Js)),$c.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:Yo()})).output(Js),$c.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:Yo()})).output(Js),$c.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:Yo(),version2:Yo()})).output(bo({version1:Js,version2:Js,diff:yo(bo({field:Li(),oldValue:ta,newValue:ta}))})),$c.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:Yo()})).output(xs.extend({current_version:io()})),$c.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:Yo()})).output(xs),$c.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)),$c.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:Yo()})).output(xs),$c.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:Yo()})).output(xs),$c.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:io(),config:bo({enabled:lo().optional(),autoApply:lo().optional(),minConfidenceThreshold:io().min(0).max(1).optional(),maxHealingAttempts:io().int().min(1).max(5).optional()}).optional()})).output(bo({healed:lo(),attemptIndex:io().nullable(),analysis:ra.nullable(),confidence:io().nullable()})),$c.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:Yo()})).output(bo({runs:yo(bo({browserType:Ws,runId:io(),status:To(["completed","failed","skipped"]),passedTests:io(),failedTests:io(),totalTests:io()})),summary:bo({totalRuns:io(),completedRuns:io(),failedRuns:io(),overallPassed:io(),overallFailed:io()})})),$c.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(bo({byTest:Io(Li(),Io(Li(),bo({status:Li(),runId:io()}))),byBrowser:Io(Li(),bo({passed:io(),failed:io(),total:io()}))})),$c.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:Yo()})).output(xs),$c.route({method:"POST",tags:["Internal"],path:"/migrate/prepare",summary:"Prepare database migration",description:"Validates migration requirements and prepares system for migration"}).input(Sl).output(bo({message:Li(),status:Li(),data:Sl})),$c.route({method:"POST",tags:["Internal"],path:"/migrate/run",summary:"Execute database migration",description:"Runs migration scripts and updates database schema"}).input(Cl).output(bo({message:Li(),status:Li(),data:Cl})),$c.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(Ml).output(Ll),$c.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(Tl).output(Pl),$c.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(Al).output(Nl),$c.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(zl).output(Ol),$c.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(bo({subscriptionId:Li().min(1)})).output(bo({subscriptionId:Li(),cancelAtPeriodEnd:lo()})),$c.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(bo({pricing:Ul,plans:Wl,config:Gl})),$c.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(bo({plan:Rl,usage:$l})),$c.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(bo({chat_id:Li(),tab_id:Li().optional(),marketrix_id:Li().optional(),marketrix_key:Li().optional(),agent_id:Yo().optional(),application_id:Yo().optional()})).output(Fc(qa)),$c.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(bo({chat_id:Li(),command:Ya})).output(bo({ok:lo()})),$c.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(bo({scopes:yo(Ja).min(1),application_id:Yo().optional()})).output(Fc(Ka)),$c.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(bo({event:Li(),data:Io(Li(),po())})).output(bo({received:lo()})),$c.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(bo({id:Li(),object:Li(),type:Li(),data:Io(Li(),po())}).passthrough().describe("Stripe event payload")).output(bo({received:lo()})),$c.route({method:"GET",tags:["Insight"],path:"/insights/personas",summary:"Get personas overview (connectors + segments + personas)"}).input(bs).output(fc),$c.route({method:"POST",tags:["Insight"],path:"/insights/segments/generate",summary:"Generate segments from session data (mocked)"}).input(bs).output(bo({items:yo(hc)})),$c.route({method:"DELETE",tags:["Insight"],path:"/insights/segments/{id}",summary:"Delete a segment"}).input(bo({id:Yo()})).output(xs),$c.route({method:"POST",tags:["Insight"],path:"/insights/personas/generate",summary:"Generate personas from segments (mocked)"}).input(bs).output(bo({items:yo(mc)})),$c.route({method:"DELETE",tags:["Insight"],path:"/insights/personas/{id}",summary:"Delete a persona"}).input(bo({id:Yo()})).output(xs),$c.route({method:"GET",tags:["Insight"],path:"/insights/heatmaps/pages",summary:"Get all tracked heatmap pages"}).input(bs).output(bo({items:yo(vc)})),$c.route({method:"GET",tags:["Insight"],path:"/insights/heatmaps/snapshot",summary:"Get heatmap snapshot for a page/variation/type"}).input(bo({page_id:Yo(),variation:yc,type:gc})).output(xc.nullable()),$c.route({method:"POST",tags:["Insight"],path:"/insights/heatmaps/generate",summary:"Generate heatmap data from sessions (mocked)"}).input(bs).output(xs),$c.route({method:"GET",tags:["Insight"],path:"/insights/reactions",summary:"Get all reactions with runs and results"}).input(bs).output(bo({reactions:yo(Ec),personas:yo(mc)})),$c.route({method:"POST",tags:["Insight"],path:"/insights/reactions",summary:"Create a new reaction (question)"}).input(bo({application_id:Yo(),question:Li()})).output(Ec),$c.route({method:"DELETE",tags:["Insight"],path:"/insights/reactions/{id}",summary:"Delete a reaction and all its runs"}).input(bo({id:Yo()})).output(xs),$c.route({method:"POST",tags:["Insight"],path:"/insights/reactions/context",summary:"Get context for a reaction question (mocked)"}).input(bo({application_id:Yo(),question:Li()})).output(Tc),$c.route({method:"POST",tags:["Insight"],path:"/insights/reactions/{reaction_id}/run",summary:"Run reaction scoring for selected personas (mocked scoring)"}).input(bo({reaction_id:Yo(),persona_ids:yo(Yo()),context_refs:yo(Sc),simulations:yo(Cc)})).output(Ic);var Uc,Bc=null,Wc="";function Gc(e){return ye(new $e({url:e,headers:()=>{const e={};return Bc&&(e.Authorization=`Bearer ${Bc}`),e}}))}Uc=Gc("");var Hc=e=>{if(!e?.trim())throw new Error("API URL is required for SDK configuration");e!==Wc&&(Wc=e,Uc=Gc(e))},Zc={setAuthToken:e=>{Bc=e},clearAuthToken:()=>{Bc=null},getAuthToken:()=>Bc,configure:Hc},Vc=new Proxy({},{get:(e,t)=>t in Zc?Zc[t]:Uc[t]}),qc=e=>e?.mtxApiHost?e.mtxApiHost:"";function Yc(e,t="Unknown error"){return e instanceof Error?e.message:"string"==typeof e?e:t}function Jc(e,t="Operation",n){const r=Yc(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 ${qc(n)||"configured API server"}. Error: ${r}`}:{isValid:!1,error:`${t} failed: ${r}`}}var Kc="undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname&&!window.location.hostname.includes("localhost")?"error":"debug",Qc={debug:0,info:1,warn:2,error:3};function Xc(e){return Qc[e]>=Qc[Kc]}var ed=(e,t,...n)=>{Xc("debug")},td=(e,t,...n)=>{Xc("info")},nd=(e,t,...n)=>{Xc("warn")},rd=(e,t,...n)=>{Xc("error")};function id(e){return{debug:(t,...n)=>ed(e,t,...n),info:(t,...n)=>td(e,t,...n),warn:(t,...n)=>nd(e,t,...n),error:(t,...n)=>rd(e,t,...n)}}id("ErrorUtils");var od=[{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 sd(e){return e.includes("__THINKING__")}function ad(e){return sd(e)?e:`${e}\n\n__THINKING__`}function ld(e,t,n,r,i,o){if("agent"!==e.sender||e.isSystemMessage||e.isScreenAccessRequest)return!1;if(o&&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(i){const t=e.content.trim().length>0,n=e.parts&&e.parts.length>0;if(!t&&!n)return!1}return!0}function cd(e){const{messages:t,isTaskRunning:n,currentMode:r,preferPlaceholder:i,requireContent:o}=e;let s=-1;if(n&&("show"===r||"do"===r)){const e=!0;for(let i=t.length-1;i>=0;i--){const a=t[i],l=ld(a,n,r,0,o,e),c=a.isPlaceholder,d=!o||a.content.trim().length>0||a.parts&&a.parts.length>0;if(l&&c&&d){s=i;break}}if(s<0&&!o)for(let i=t.length-1;i>=0;i--){const a=t[i],l=ld(a,n,r,0,o,e),c=a.isPlaceholder;if(l&&c){s=i;break}}if(s<0)for(let i=t.length-1;i>=0;i--){const a=t[i],l=ld(a,n,r,0,o,e),c=a.isPlaceholder;if(l&&!c){s=i;break}}}if(s<0){for(let e=t.length-1;e>=0;e--){const n=t[e],r="agent"===n.sender,i=n.isPlaceholder,a=!n.isSystemMessage,l=!n.isScreenAccessRequest,c=!o||n.content.trim().length>0||n.parts&&n.parts.length>0;if(r&&i&&a&&l&&c){s=e;break}}if(s<0&&!o)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 dd(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 ud=new Set(["click_element","type_text","send_keys","select_dropdown_option","upload_file","scroll"]);function pd(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 hd(e,t,n,r=!1){const i=dd(e);if(!t||"show"!==n&&"do"!==n)return sd(i.content)?{...i,content:i.content.replace(/\n\n__THINKING__$/,"").replace(/__THINKING__/g,""),placeholderState:void 0}:i;const o=r?"waiting-for-user":"thinking";return sd(i.content)?i.placeholderState!==o?{...i,placeholderState:o}:i:{...i,content:ad(i.content),placeholderState:o}}var md=Object.fromEntries(od.map(e=>[e.id,e.displayAction]));var fd="marketrix_chat_context",gd={chat_id:null,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],currentMode:"tell",isOpen:!1,isMinimized:!1,isLoading:!1,config:null,timestamp:Date.now()},yd=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={...gd},this.context;try{const e=localStorage.getItem(fd);if(e){const t=JSON.parse(e);return Date.now()-t.timestamp>6048e5?(this.context={...gd},this.saveContext(),this.context):(this.context=t,this.context)}}catch(e){}return this.context={...gd},this.context}saveContext(){if("undefined"!=typeof window&&this.context)try{this.context.timestamp=Date.now(),localStorage.setItem(fd,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={...gd},"undefined"!=typeof window&&localStorage.removeItem(fd)}hasValidContext(){const e=this.getContext();return null!==e.chat_id&&e.chat_id.length>0}}.getInstance(),wd=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(yd.hasValidContext())return;yd.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=yd.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});yd.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 bd(e,t,n="user-message"){const r=[],i=e.trim();return i&&r.push({type:"text",content:i}),{id:`${n}-${Date.now()}`,content:i,sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,parts:r}}function vd(e,t,n,r="agent-message"){const i=[],o=e.trim();return o&&i.push({type:"text",content:o}),{id:n||`${r}-${Date.now()}`,content:e,sender:"agent",timestamp:/* @__PURE__ */new Date,mode:t,parts:i}}function xd(e,t,n="agent",r="system-message"){const i=[];return e&&i.push({type:"text",content:e}),{id:`${r}-${Date.now()}`,content:e,sender:n,timestamp:/* @__PURE__ */new Date,mode:t,isSystemMessage:!0,parts:i}}function kd(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 _d(e,t="show"){return{id:`screenshare-${Date.now()}`,content:"",sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,videoStream:e,parts:[]}}var Sd=id("ChatIdManager"),Cd=class e{static instance=null;chatId=null;initializationPromise=null;constructor(){"undefined"!=typeof window&&"undefined"!=typeof document&&(this.chatId=this.getStoredChatId(),this.chatId&&Sd.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 Sd.debug("Returning existing chat ID:",this.chatId),this.chatId;if(this.initializationPromise)return Sd.debug("Chat ID initialization in progress, waiting..."),this.initializationPromise;const e=this.getStoredChatId();if(e)return this.chatId=e,Sd.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{Sd.info("Creating new chat ID...");const e=await Vc.chatCreate(void 0);if(!e)throw new Error("API returned empty chat ID");return this.chatId=e,this.storeChatId(e),Sd.info("Created and stored new chat ID:",this.chatId),wd.createInitialContext(e),e}catch(e){throw Sd.error("Failed to create chat ID:",e),this.initializationPromise=null,e}}clearChatId(){this.chatId=null,this.initializationPromise=null,Sd.debug("Cleared chat ID")}static resetInstance(){e.instance=null}getStoredChatId(){return yd.getChatId()}storeChatId(e){yd.setChatId(e)}}.getInstance(),Id=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;connectionId=0;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");const n=++this.connectionId;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 i=await Vc.widgetStream(t,{signal:r});this.setStatus("connected"),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.consumeEvents(i,n)}catch(i){r.aborted||(this.setStatus("error"),this.notifyError(/* @__PURE__ */new Error("Stream connection failed")),this.scheduleReconnect())}}async consumeEvents(e,t){let n=!1;try{for await(const r of e){if(this.connectionId!==t){n=!0;break}this.handleMessage(r)}}catch(r){this.connectionId!==t?n=!0:this.isIntentionallyDisconnected||this.setStatus("error")}finally{n||this.connectionId!==t||this.isIntentionallyDisconnected||(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){return this.chatId?Vc.widgetMessage({chat_id:this.chatId,command:e}).then(()=>{}).catch(e=>{throw this.notifyError(/* @__PURE__ */new Error(`Failed to send message: ${String(e)}`)),e}):Promise.reject(/* @__PURE__ */new Error("No active chat"))}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){this.isIntentionallyDisconnected||"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)}},Ed=class{config;constructor(e){this.config=e}getChatId(){return Cd.getChatId()}async getOrCreateChatId(){return Cd.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),Vc.activityLogCreate({type:"widget_question",metadata:r}).catch(e=>{})}catch(n){}}async sendMessage(e){if(!(await Cd.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 Id.getInstance().send(r),{messageId:n,response:"",mode:t,timestamp:/* @__PURE__ */new Date}}async checkAgentAvailability(){try{return null!==Cd.getChatId()}catch(e){return!1}}async getAgentInfo(){return{available:!0,status:"online"}}async stopTask(e){return Id.getInstance().send({type:"chat/stop",...e&&{task_id:e}}),{status:"stopping",message:"Stop command sent"}}updateConfig(e){this.config={...this.config,...e}}},Td=class e{static instance;config=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}loadConfig(){const e=yd.getConfig();return e?(this.config=e,e):(this.config={},this.config)}saveConfig(e){yd.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 Ad(e,t={}){return{...t,...e}}var Md=n(void 0),zd=({children:e,previewMode:t=!1,uiActions:n,currentMode:r})=>{const[i,s]=p({messages:[]}),a=u(r);a.current=r;const l=o(e=>{s(t=>(wd.addMessage(e),{messages:[...t.messages,e]}))},[]),c=o((e,t)=>{s(n=>(wd.updateMessage(e,t),{messages:n.messages.map(n=>n.id===e?{...n,...t}:n)}))},[]),h=o(e=>{s(t=>(wd.removeMessage(e),{messages:t.messages.filter(t=>t.id!==e)}))},[]),m=o(e=>{s(()=>(wd.setMessages(e),{messages:e}))},[]),g=o(()=>{wd.clearMessages(),s({messages:[]})},[]),y=o(async(e,r,i,o,c)=>{const d=r??a.current;if(t)return c||l(bd(e,d)),void l(vd("This is a preview. In production, I'll respond to your messages here."));let u=Td.getConfig();if(u||(u=Td.loadConfig()),!u||!u.mtxId&&!u.mtxKey&&!u.mtxAgent)return void l(vd("Configuration error: Missing API credentials. Please check your widget settings."));c||l(bd(e,d));const p=`temp-${globalThis.crypto.randomUUID()}`;l({id:p,content:ad(""),sender:"agent",timestamp:/* @__PURE__ */new Date,mode:d,isPlaceholder:!0,placeholderState:"thinking",parts:[]}),n.setLoading(!0);const h=new Ed(u);try{i&&h.updateConfig({mtxApp:i});const t=h.getChatId();if(t){const e=Id.getInstance();if(!e.isConnected()){const n=Td.getConfig();try{await e.connect(t,n?{mtxId:n.mtxId,mtxKey:n.mtxKey,mtxAgent:n.mtxAgent,mtxApp:n.mtxApp}:void 0)}catch(m){}}}await h.sendMessage({message:e,mode:d,question:o,requestId:p})}catch(f){s(e=>{const t="I'm sorry, I encountered an error processing your request. Please try again.",n=e.messages.map(e=>{if(e.id!==p)return e;const n=[...e.parts??[],{type:"text",content:t}];return{...e,isPlaceholder:!1,parts:n,content:t}});return wd.setMessages(n),{messages:n}})}finally{n.setLoading(!1)}},[t,l,n]),w=d(()=>({addMessage:l,updateMessage:c,removeMessage:h,setMessages:m,clearMessages:g,sendMessage:y}),[l,c,h,m,g,y]);/* @__PURE__ */
|
|
2
|
+
return ti(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(/* @__PURE__ */ti(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(/* @__PURE__ */ti(e=>e.toUpperCase())),e.slugify=()=>e.check(/* @__PURE__ */ti(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),Ni=/* @__PURE__ */je("ZodString",(e,t)=>{Mn.init(e,t),Pi.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...lt(t)})}($i,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...lt(t)})}(Ui,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...lt(t)})}(no,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...lt(t)})}(Bi,t)),e.guid=t=>e.check(Zr(ji,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...lt(t)})}(Fi,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...lt(t)})}(Fi,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...lt(t)})}(Fi,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...lt(t)})}(Fi,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...lt(t)})}(Wi,t)),e.guid=t=>e.check(Zr(ji,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...lt(t)})}(Gi,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...lt(t)})}(Hi,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...lt(t)})}(Zi,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...lt(t)})}(Xi,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...lt(t)})}(eo,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...lt(t)})}(Vi,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...lt(t)})}(qi,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...lt(t)})}(Yi,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...lt(t)})}(Ji,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...lt(t)})}(Ki,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...lt(t)})}(Qi,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...lt(t)})}(to,t)),e.datetime=t=>e.check(pi(t)),e.date=t=>e.check(mi(t)),e.time=t=>e.check(gi(t)),e.duration=t=>e.check(wi(t))});function Li(e){return function(e,t){return new e({type:"string",...lt(t)})}(Ni,e)}var Di=/* @__PURE__ */je("ZodStringFormat",(e,t)=>{zn.init(e,t),Pi.init(e,t)}),$i=/* @__PURE__ */je("ZodEmail",(e,t)=>{Pn.init(e,t),Di.init(e,t)}),ji=/* @__PURE__ */je("ZodGUID",(e,t)=>{On.init(e,t),Di.init(e,t)}),Fi=/* @__PURE__ */je("ZodUUID",(e,t)=>{Rn.init(e,t),Di.init(e,t)}),Ui=/* @__PURE__ */je("ZodURL",(e,t)=>{Nn.init(e,t),Di.init(e,t)}),Bi=/* @__PURE__ */je("ZodEmoji",(e,t)=>{Ln.init(e,t),Di.init(e,t)}),Wi=/* @__PURE__ */je("ZodNanoID",(e,t)=>{Dn.init(e,t),Di.init(e,t)}),Gi=/* @__PURE__ */je("ZodCUID",(e,t)=>{$n.init(e,t),Di.init(e,t)}),Hi=/* @__PURE__ */je("ZodCUID2",(e,t)=>{jn.init(e,t),Di.init(e,t)}),Zi=/* @__PURE__ */je("ZodULID",(e,t)=>{Fn.init(e,t),Di.init(e,t)}),Vi=/* @__PURE__ */je("ZodXID",(e,t)=>{Un.init(e,t),Di.init(e,t)}),qi=/* @__PURE__ */je("ZodKSUID",(e,t)=>{Bn.init(e,t),Di.init(e,t)}),Yi=/* @__PURE__ */je("ZodIPv4",(e,t)=>{Vn.init(e,t),Di.init(e,t)}),Ji=/* @__PURE__ */je("ZodIPv6",(e,t)=>{qn.init(e,t),Di.init(e,t)}),Ki=/* @__PURE__ */je("ZodCIDRv4",(e,t)=>{Yn.init(e,t),Di.init(e,t)}),Qi=/* @__PURE__ */je("ZodCIDRv6",(e,t)=>{Jn.init(e,t),Di.init(e,t)}),Xi=/* @__PURE__ */je("ZodBase64",(e,t)=>{Qn.init(e,t),Di.init(e,t)}),eo=/* @__PURE__ */je("ZodBase64URL",(e,t)=>{Xn.init(e,t),Di.init(e,t)}),to=/* @__PURE__ */je("ZodE164",(e,t)=>{er.init(e,t),Di.init(e,t)}),no=/* @__PURE__ */je("ZodJWT",(e,t)=>{tr.init(e,t),Di.init(e,t)}),ro=/* @__PURE__ */je("ZodNumber",(e,t)=>{nr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,{minimum:i,maximum:o,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 i&&(r.minimum=i,"number"==typeof c&&"draft-04"!==t.target&&(c>=i?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 o&&(r.maximum=o,"number"==typeof l&&"draft-04"!==t.target&&(l<=o?delete r.maximum:delete r.exclusiveMaximum)),"number"==typeof a&&(r.multipleOf=a)})(e,t,n),e.gt=(t,n)=>e.check(Yr(t,n)),e.gte=(t,n)=>e.check(Jr(t,n)),e.min=(t,n)=>e.check(Jr(t,n)),e.lt=(t,n)=>e.check(Vr(t,n)),e.lte=(t,n)=>e.check(qr(t,n)),e.max=(t,n)=>e.check(qr(t,n)),e.int=t=>e.check(so(t)),e.safe=t=>e.check(so(t)),e.positive=t=>e.check(Yr(0,t)),e.nonnegative=t=>e.check(Jr(0,t)),e.negative=t=>e.check(Vr(0,t)),e.nonpositive=t=>e.check(qr(0,t)),e.multipleOf=(t,n)=>e.check(Kr(t,n)),e.step=(t,n)=>e.check(Kr(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 io(e){return function(e,t){return new e({type:"number",checks:[],...lt(t)})}(ro,e)}var oo=/* @__PURE__ */je("ZodNumberFormat",(e,t)=>{rr.init(e,t),ro.init(e,t)});function so(e){return function(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...lt(t)})}(oo,e)}var ao=/* @__PURE__ */je("ZodBoolean",(e,t)=>{ir.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.type="boolean"})(0,0,t)});function lo(e){return function(e,t){return new e({type:"boolean",...lt(t)})}(ao,e)}var co=/* @__PURE__ */je("ZodNull",(e,t)=>{or.init(e,t),Ri.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 uo=/* @__PURE__ */je("ZodUnknown",(e,t)=>{sr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function po(){return new uo({type:"unknown"})}var ho=/* @__PURE__ */je("ZodNever",(e,t)=>{ar.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function mo(e){return function(e,t){return new e({type:"never",...lt(t)})}(ho,e)}var fo=/* @__PURE__ */je("ZodDate",(e,t)=>{lr.init(e,t),Ri.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(Jr(t,n)),e.max=(t,n)=>e.check(qr(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}),go=/* @__PURE__ */je("ZodArray",(e,t)=>{dr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;"number"==typeof s&&(i.minItems=s),"number"==typeof a&&(i.maxItems=a),i.type="array",i.items=ii(o.element,t,{...r,path:[...r.path,"items"]})})(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(Xr(t,n)),e.nonempty=t=>e.check(Xr(1,t)),e.max=(t,n)=>e.check(Qr(t,n)),e.length=(t,n)=>e.check(ei(t,n)),e.unwrap=()=>e.element});function yo(e,t){return function(e,t,n){return new e({type:"array",element:t,...lt(n)})}(go,e,t)}var wo=/* @__PURE__ */je("ZodObject",(e,t)=>{fr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object",i.properties={};const s=o.shape;for(const c in s)i.properties[c]=ii(s[c],t,{...r,path:[...r.path,"properties",c]});const a=new Set(Object.keys(s)),l=new Set([...a].filter(e=>{const n=o.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(i.required=Array.from(l)),"never"===o.catchall?._zod.def.type?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=ii(o.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):"output"===t.io&&(i.additionalProperties=!1)})(e,t,n,r),Je(e,"shape",()=>t.shape),e.keyof=()=>To(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:po()}),e.loose=()=>e.clone({...e._zod.def,catchall:po()}),e.strict=()=>e.clone({...e._zod.def,catchall:mo()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!rt(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 at(e,Qe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ke(this,"shape",n),n}}))}(e,t),e.safeExtend=t=>function(e,t){if(!rt(t))throw new Error("Invalid input to safeExtend: expected a plain object");return at(e,Qe(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return Ke(this,"shape",n),n}}))}(e,t),e.merge=t=>{return r=t,at(n=e,Qe(n._zod.def,{get shape(){const e={...n._zod.def.shape,...r._zod.def.shape};return Ke(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 at(e,Qe(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 Ke(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 at(e,Qe(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 Ke(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 at(t,Qe(t._zod.def,{get shape(){const r=t._zod.def.shape,i={...r};if(n)for(const t in n){if(!(t in r))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:"optional",innerType:r[t]}):r[t])}else for(const t in r)i[t]=e?new e({type:"optional",innerType:r[t]}):r[t];return Ke(this,"shape",i),i},checks:[]}))}(Po,e,t[0]),e.required=(...t)=>{return n=Uo,r=e,i=t[0],at(r,Qe(r._zod.def,{get shape(){const e=r._zod.def.shape,t={...e};if(i)for(const r in i){if(!(r in t))throw new Error(`Unrecognized key: "${r}"`);i[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 Ke(this,"shape",t),t}}));var n,r,i}});function bo(e,t){return new wo({type:"object",shape:e??{},...lt(t)})}var vo=/* @__PURE__ */je("ZodUnion",(e,t)=>{yr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=!1===i.inclusive,s=i.options.map((e,n)=>ii(e,t,{...r,path:[...r.path,o?"oneOf":"anyOf",n]}));o?n.oneOf=s:n.anyOf=s})(e,t,n,r),e.options=t.options});function xo(e,t){return new vo({type:"union",options:e,...lt(t)})}var ko=/* @__PURE__ */je("ZodDiscriminatedUnion",(e,t)=>{vo.init(e,t),wr.init(e,t)});function _o(e,t,n){return new ko({type:"union",options:t,discriminator:e,...lt(n)})}var So=/* @__PURE__ */je("ZodIntersection",(e,t)=>{br.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=ii(i.left,t,{...r,path:[...r.path,"allOf",0]}),s=ii(i.right,t,{...r,path:[...r.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length;n.allOf=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]]})(e,t,n,r)});var Co=/* @__PURE__ */je("ZodRecord",(e,t)=>{kr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=n,o=e._zod.def;i.type="object";const s=o.keyType,a=s._zod.bag?.patterns;if("loose"===o.mode&&a&&a.size>0){const e=ii(o.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});i.patternProperties={};for(const t of a)i.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(i.propertyNames=ii(o.keyType,t,{...r,path:[...r.path,"propertyNames"]})),i.additionalProperties=ii(o.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&&(i.required=e)}})(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Io(e,t,n){return new Co({type:"record",keyType:e,valueType:t,...lt(n)})}var Eo=/* @__PURE__ */je("ZodEnum",(e,t)=>{_r.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=Ge(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 i={};for(const o of e){if(!n.has(o))throw new Error(`Key ${o} not found in enum`);i[o]=t.entries[o]}return new Eo({...t,checks:[],...lt(r),entries:i})},e.exclude=(e,r)=>{const i={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete i[t]}return new Eo({...t,checks:[],...lt(r),entries:i})}});function To(e,t){return new Eo({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...lt(t)})}var Ao=/* @__PURE__ */je("ZodLiteral",(e,t)=>{Sr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=e._zod.def,i=[];for(const o of r.values)if(void 0===o){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof o){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(o))}else i.push(o);if(0===i.length);else if(1===i.length){const e=i[0];n.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?n.enum=[e]:n.const=e}else i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),i.every(e=>"boolean"==typeof e)&&(n.type="boolean"),i.every(e=>null===e)&&(n.type="null"),n.enum=i})(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 Mo(e,t){return new Ao({type:"literal",values:Array.isArray(e)?e:[e],...lt(t)})}var zo=/* @__PURE__ */je("ZodFile",(e,t)=>{Cr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n)=>{const r=n,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:o,maximum:s,mime:a}=e._zod.bag;void 0!==o&&(i.minLength=o),void 0!==s&&(i.maxLength=s),a?1===a.length?(i.contentMediaType=a[0],Object.assign(r,i)):(Object.assign(r,i),r.anyOf=a.map(e=>({contentMediaType:e}))):Object.assign(r,i)})(e,0,n),e.min=(t,n)=>e.check(function(e,t){return new mn({check:"min_size",...lt(t),minimum:e})}(t,n)),e.max=(t,n)=>e.check(function(e,t){return new hn({check:"max_size",...lt(t),maximum:e})}(t,n)),e.mime=(t,n)=>e.check(function(e,t){return new Cn({check:"mime_type",mime:e,...lt(t)})}(Array.isArray(t)?t:[t],n))});var Oo=/* @__PURE__ */je("ZodTransform",(e,t)=>{Ir.init(e,t),Ri.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 Ue(e.constructor.name);n.addIssue=r=>{if("string"==typeof r)n.issues.push(gt(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(gt(t))}};const i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ro(e){return new Oo({type:"transform",transform:e})}var Po=/* @__PURE__ */je("ZodOptional",(e,t)=>{Tr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});function No(e){return new Po({type:"optional",innerType:e})}var Lo=/* @__PURE__ */je("ZodExactOptional",(e,t)=>{Ar.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Do=/* @__PURE__ */je("ZodNullable",(e,t)=>{Mr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o=ii(i.innerType,t,r),s=t.seen.get(e);"openapi-3.0"===t.target?(s.ref=i.innerType,n.nullable=!0):n.anyOf=[o,{type:"null"}]})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $o(e){return new Do({type:"nullable",innerType:e})}var jo=/* @__PURE__ */je("ZodDefault",(e,t)=>{zr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});var Fo=/* @__PURE__ */je("ZodPrefault",(e,t)=>{Rr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Uo=/* @__PURE__ */je("ZodNonOptional",(e,t)=>{Pr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType})(e,t,0,r),e.unwrap=()=>e._zod.def.innerType});var Bo=/* @__PURE__ */je("ZodCatch",(e,t)=>{Lr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;let o;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType;try{o=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=o})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});var Wo=/* @__PURE__ */je("ZodPipe",(e,t)=>{Dr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def,o="input"===t.io?"transform"===i.in._zod.def.type?i.out:i.in:i.out;ii(o,t,r),t.seen.get(e).ref=o})(e,t,0,r),e.in=t.in,e.out=t.out});function Go(e,t){return new Wo({type:"pipe",in:e,out:t})}var Ho=/* @__PURE__ */je("ZodReadonly",(e,t)=>{jr.init(e,t),Ri.init(e,t),e._zod.processJSONSchema=(t,n,r)=>((e,t,n,r)=>{const i=e._zod.def;ii(i.innerType,t,r),t.seen.get(e).ref=i.innerType,n.readOnly=!0})(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});var Zo=/* @__PURE__ */je("ZodCustom",(e,t)=>{Br.init(e,t),Ri.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 Vo(e,t={}){const n=new Zo({type:"custom",check:"custom",fn:t=>t instanceof e,abort:!0,...lt(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 qo(e,t){return Go(Ro(e),t)}function Yo(e){return function(e,t){return new e({type:"number",coerce:!0,checks:[],...lt(t)})}(ro,e)}function Jo(e){return function(e,t){return new e({type:"boolean",coerce:!0,...lt(t)})}(ao,e)}function Ko(e){return function(e,t){return new e({type:"date",coerce:!0,...lt(t)})}(fo,e)}To(["free","starter","growth","enterprise"]);var Qo,Xo=To(["created","active","suspended","pending_approval"]),es=To(["free","starter","growth","enterprise"]),ts=To(["human","ai"]),ns=To(["male","female"]),rs=To(["active","learning","error"]),is=bo({vector_index_created:lo().nullable(),graph_index_created:lo().nullable()}),os=To(["document","video"]),ss=To(["pending","processing","waiting_review","completed","failed"]),as=(To(["pending","in_progress","completed","failed"]),To(["pending","in_progress","completed","failed","stopped"]),To(["user","agent"]),To(["widget","app"])),ls=(To(["tell","show","do"]),To(["app","website"])),cs=To(["widget"]),ds=To(["timer","github","slack","teams","jira","mcp"]),us=To(["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","slack_command"]),ps=bo({id:io().optional(),created_at:Ko().optional(),updated_at:Ko().optional()}),hs=bo({file:Vo(File),application_id:Yo().optional()}),ms=bo({id:Yo()}),fs=bo({slug:Li()}),gs=bo({agent_id:Yo()}),ys=bo({widget_id:Yo()}),ws=bo({simulation_id:Yo()}),bs=bo({application_id:Yo()}),vs=bo({user_id:Yo()}),xs=bo({success:Mo(!0)}),ks=xs.extend({message:Li()}),_s=(bo({workspace_id:Yo().optional()}),bo({application_id:Yo().optional()}),bo({limit:Yo().optional().default(50),offset:Yo().optional().default(0)})),Ss=e=>bo({items:yo(e),total:io(),limit:io(),offset:io()}),Cs=e=>bo({items:yo(e),count:io()}),Is=bo({status:Li(),timestamp:Li(),service:Li(),version:Li(),build:Li()}),Es=bo({name:Li(),version:Li(),build:Li(),status:Li(),timestamp:Li()}),Ts=To(["password","oauth"]),As=ps.extend({is_super:lo(),status:Xo,email:Li().email(),external_id:Li().nullish(),first_name:Li().nullish(),last_name:Li().nullish(),password:Li().nullish(),image_url:Li().nullish(),prompt_limit:io().nullish(),last_login_at:Ko().nullish(),auth_method:Ts.nullish()}),Ms=As.partial().extend({email:Li().email(),password:Li()}),zs=As.partial(),Os=bo({users:yo(Ms)}),Rs=bo({users:yo(As.partial())}),Ps=(bo({token:Li()}),ps.extend({name:Li(),slug:Li(),status:Xo,package:es,ending_date:Ko().nullish(),external_workspace_id:Li().nullish()})),Ns=Ps.partial().extend({name:Li().min(1)}),Ls=Ps.partial(),Ds=To(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]),$s=ps.extend({workspace_id:io(),package:es,ending_date:Ko(),stripe_subscription_id:Li().nullable(),stripe_price_id:Li().nullable(),status:Ds.default("active").optional()}),js=($s.partial().extend({workspace_id:io(),package:es}),$s.partial(),To(["owner","member"])),Fs=ps.extend({workspace_id:io(),user_id:io(),role:js}),Us=bo({id:io(),agent_name:Li(),image_url:Li().nullish()}),Bs=ps.extend({workspace_id:io(),application_id:io().optional(),file_name:Li().min(1),file_size:Yo(),file_type:os,file_url:Li(),source_url:Li().nullish(),agents:yo(Us).optional()}),Ws=To(["chromium","firefox","webkit"]),Gs=bo({browsers:yo(Ws).default(["chromium"]),parallel:lo().default(!1),fail_fast:lo().default(!1),timeout_per_browser:io().int().min(60).max(3600).optional()}),Hs=ps.extend({workspace_id:io(),user_id:io(),application_id:io(),file_name:Li().min(1),file_size:Yo(),file_type:Li(),file_url:Li(),file_path:Li().nullable(),text_content:Li().nullish(),additional_instructions:Li().max(1e3).nullish(),status:ss,processing_step:Li().nullish(),ultimate_goal:Li().nullish(),browser_config:Gs.nullish()}),Zs=bo({application_id:Yo(),file:Vo(File).optional(),text_content:Li().optional(),file_name:Li().optional(),additional_instructions:Li().max(1e3).optional()}),Vs=ps.extend({qa_flow_id:io(),workspace_id:io(),triggered_by:io(),browser_type:Ws,browser_config:Gs.nullish(),simulation_id:io().nullish(),source:To(["manual","automation","github_pr","slack_command"]).nullish(),source_metadata:Io(Li(),po()).nullish(),auto_heal:lo().default(!1)}),qs=To(["passed","needs_healing","failed"]),Ys=bo({outcome_reached:lo(),steps_aligned:lo(),healing_recommended:lo(),is_actual_bug:lo(),confidence:io().min(0).max(1),reasoning:Li(),evaluated_at:Li()}),Js=(ps.extend({qa_run_id:io(),qa_test_case_id:io(),simulation_task_id:Li().nullable(),verdict:qs,evaluation:Ys.nullable()}),bo({version:io().int().positive(),test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"]),change_type:To(["created","modified","self_healed","refined","deleted"]),change_reason:Li().nullish(),changed_by:io().nullish(),created_at:Li(),accepted:lo().optional()})),Ks=bo({failure_type:To(["locator","assertion","timeout","flow_change","environment"]),failure_message:Li().nullish(),failure_context:Io(Li(),po()).nullish(),repair_strategy:Li().nullish(),repair_details:Io(Li(),po()).nullish(),confidence_score:io().min(0).max(1).nullish(),validation_status:To(["pending","validated","failed","rejected"]),simulation_id:io().nullish(),validation_simulation_id:io().nullish(),healed_version:io().nullish(),created_at:Li()}),Qs=ps.extend({qa_flow_id:io(),workspace_id:io(),order_index:io().int().nonnegative(),test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"]),is_active:qo(e=>"number"==typeof e?0!==e:e,lo()),current_version:io().int().positive(),version_history:yo(Js).nullable(),healing_attempts:yo(Ks).nullable(),healing_metadata:Io(Li(),po()).nullish(),last_healed_at:Ko().nullish(),blocked_by:yo(bo({index:io().int().nonnegative(),condition:To(["pass"]).optional()})).default([])}),Xs=(bo({qa_flow_id:io(),test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"]).optional()}),bo({ultimateGoal:Li(),document:Hs,testCases:yo(bo({id:io(),title:Li(),prompt:Li(),objective:Li(),steps:yo(Li()),expectedOutcome:Li(),priority:To(["Low","Medium","High"])})),summary:bo({total:io(),estimatedTime:Li(),complexity:To(["Low","Medium","High"])})})),ea=bo({ultimate_goal:Li(),test_cases:yo(bo({test_title:Li(),test_objective:Li(),test_steps:yo(Li()),expected_outcome:Li(),priority:To(["Low","Medium","High"])})),summary:bo({total_tests:io(),high_priority:io(),medium_priority:io(),low_priority:io(),estimated_time_minutes:io()})}),ta=(_o("event",[bo({event:Mo("response.created"),data:bo({message:Li()})}),bo({event:Mo("response.progress"),data:bo({message:Li()})}),bo({event:Mo("response.clear"),data:bo({}).optional()}),bo({event:Mo("response.completed"),data:ea}),bo({event:Mo("error"),data:bo({detail:Li()})})]),xo([Li(),io(),lo(),yo(Li()),function(e,t){return new e({type:"null",...lt(t)})}(co,Qo)])),na=(To(["created","modified","self_healed","refined","deleted"]),To(["locator","assertion","timeout","flow_change","environment"])),ra=(To(["pending","validated","failed","rejected"]),bo({healing_enabled:lo().default(!0),auto_apply:lo().default(!1),min_confidence_threshold:io().min(0).max(1).default(.85),max_healing_attempts:io().int().min(1).max(5).default(2),last_healing_attempt:Li().datetime().nullable(),total_healing_attempts:io().int().default(0),successful_heals:io().int().default(0)}),bo({failure_type:na,is_healable:lo(),is_actual_bug:lo(),failure_message:Li(),failure_context:Io(Li(),po()),suggested_repair:bo({type:To(["update_locator","update_assertion","update_steps","skip_test"]),confidence:io().min(0).max(1),details:Io(Li(),po())}).nullable()})),ia=(bo({go_to_url:bo({url:Li(),new_tab:lo()})}),bo({click_element_by_index:bo({index:io().int().min(1)})}),bo({input_text:bo({index:io(),text:Li(),clear_existing:lo()})}),bo({write_file:bo({file_name:Li(),content:Li(),append:lo(),trailing_newline:lo(),leading_newline:lo()})}),bo({get_otp:bo({question:Li()})}),bo({done:bo({success:lo(),message:Li().optional()})}),bo({wait:bo({seconds:io()})}),bo({reload_page:bo({})}),bo({open_new_tab:bo({url:Li()})}),bo({navigate_to_url:bo({url:Li()})}),Io(Li(),po())),oa=bo({evaluation_previous_goal:Li().optional().nullable(),memory:Li().optional().nullable(),next_goal:Li().optional().nullable(),action:yo(ia).optional().nullable(),thinking:Li().optional().nullable()}).passthrough(),sa=bo({is_done:lo(),success:lo().optional().nullable(),long_term_memory:Li().optional().nullable(),extracted_content:Li().optional().nullable(),include_extracted_content_only_once:lo().optional().nullable(),include_in_memory:lo().optional().nullable(),error:Li().optional().nullable(),metadata:bo({click_x:io().optional(),click_y:io().optional(),new_tab_opened:lo().optional(),input_x:io().optional(),input_y:io().optional()}).passthrough().optional().nullable()}).passthrough(),aa=bo({url:Li(),title:Li(),tab_id:Li().optional(),parent_tab_id:Li().optional().nullable()}).passthrough(),la=bo({node_id:io().optional(),backend_node_id:io().optional(),frame_id:Li().optional().nullable(),node_type:io().optional(),node_value:Li().optional(),node_name:Li().optional(),attributes:Io(Li(),Li()).optional().nullable(),x_path:Li().optional(),element_hash:io().optional(),bounds:bo({x:io(),y:io(),width:io(),height:io()}).passthrough().optional().nullable(),stable_hash:io().optional(),ax_name:Li().optional().nullable()}).passthrough(),ca=bo({tabs:yo(aa),screenshot_path:Li().nullable(),interacted_element:yo(la.nullable()),url:Li(),title:Li()}).passthrough(),da=bo({step_start_time:io().optional().nullable(),step_end_time:io().optional().nullable(),step_number:io().optional().nullable(),step_interval:io().optional().nullable()}).passthrough(),ua=bo({model_output:oa.nullable(),result:yo(sa),state:ca,metadata:da.nullable(),state_message:Li().optional().nullable()}).passthrough(),pa=(bo({history:yo(ua)}),bo({step_number:io().int().positive(),topic:Li(),screenshot_url:Li().nullable(),title:Li().optional().nullable(),url:Li().optional().nullable()})),ha=(bo({status:Li(),status_message:Li().nullable(),task_id:Li().nullish(),created_at:Ko()}),bo({task_id:Li(),condition:To(["pass"]).optional()})),ma=bo({task_id:Li(),title:Li(),instructions:Li(),status:To(["pending","in_progress","has_question","passed","failed","skipped","stopped"]),error_message:Li().nullish(),started_at:Li().nullish(),completed_at:Li().nullish(),order_index:io().int().nonnegative().default(0),tab_id:Li().nullish(),step_count:io().int().nonnegative().default(0),blocked_by:yo(ha).default([])}),fa=ps.extend({application_id:io(),agent_id:io(),job_id:Li(),browser_session_id:Li().nullish(),status:Li(),status_message:Li().nullish(),path:Li().nullish(),instructions:Li().nullish(),pinned:lo().optional(),source:To(["direct","qa"]).optional(),agent_name:Li().nullish(),graph_index_id:Li().nullish(),source_metadata:Io(Li(),po()).nullish(),tasks:yo(ma).optional(),agents:yo(Us).optional(),mindmap_status:Li().optional(),mindmap_steps_processed:io().int().nonnegative().optional(),mindmap_steps_total:io().int().nonnegative().optional(),mindmap_error:Li().nullish()}),ga=(bo({user_id:io(),email:Li(),first_name:Li().optional().nullable(),last_name:Li().optional().nullable(),last_simulation_at:Li().optional()}),fa.partial().extend({application_id:io(),agent_id:io(),instructions:Li(),max_steps:io().int().positive().max(1e3).optional(),timeout:io().positive().max(360).optional()})),ya=bo({job_id:Li().optional(),status:Li().optional(),status_message:Li().optional(),pinned:lo().optional(),graph_index_id:Li().optional()}),wa=bo({answer:Li().min(1)}),ba=ps.extend({session_id:Li(),chat_id:Li(),application_id:Yo().nullish(),blob_url:Li().nullable(),event_count:Yo().int().nonnegative(),started_at:Ko(),ended_at:Ko().nullable(),is_active:qo(e=>"number"==typeof e?0!==e:e,lo()),metadata:bo({userAgent:Li().optional(),url:Li().optional()}).nullable(),last_batch_index:Yo().int().nullable(),last_event_timestamp:Yo().int().nullable(),last_upload_time:Ko().nullable()}),va=bo({session_id:Li().min(1),chat_id:Li().min(1),application_id:io().int().nullish(),blob_url:Li().nullish(),event_count:io().int().nonnegative().optional(),started_at:Ko().optional(),ended_at:Ko().nullish(),is_active:qo(e=>"number"==typeof e?0!==e:e,lo()).optional(),metadata:bo({userAgent:Li().optional(),url:Li().optional(),applicationId:io().optional()}).nullable().optional(),last_batch_index:io().int().nonnegative().nullish(),last_event_timestamp:io().int().nullish(),last_upload_time:Ko().nullish()}),xa=bo({id:io(),simulation_id:io(),status:Li(),status_message:Li().nullable(),created_at:Ko()}),ka=bo({start:Li(),end:Li(),action:Li()}).passthrough(),_a=bo({id:Li(),label:Li(),purpose:Li(),elements:yo(Io(Li(),po())).default([]),bbox:Io(Li(),po()).default({}),screenshot:Li().default(""),embedding:yo(io()).nullish()}).passthrough(),Sa=bo({id:Li(),title:Li(),url:Li(),summary:Li().default(""),screenshot:Li().default(""),sections:yo(_a).default([]),sequence_ids:yo(io()).default([]),embedding:yo(io()).nullish()}).passthrough(),Ca=bo({nodes:yo(Sa),edges:yo(ka)}),Ia=ps.extend({workspace_id:io(),user_id:io().nullish(),application_id:io(),agent_name:Li(),agent_type:ts,agent_voice:ns,agent_description:Li().nullish(),instructions:Li().nullish(),image_url:Li().nullish(),graph_index_id:Li().nullish(),vector_store_id:Li().nullish(),status:rs,status_message:Li().nullish(),learning_progress:is.nullish(),learning_started_at:Ko().nullish(),workspace:Ps.optional(),user:As.optional(),knowledge:yo(Bs).optional(),simulations:yo(fa).optional(),simulation_count:io().int().nonnegative().optional(),knowledge_count:io().int().nonnegative().optional()}),Ea=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[]},Ta=xo([yo(io()),Li()]).transform(Ea),Aa=xo([yo(io()),Li()]).transform(Ea),Ma=Ia.partial().extend({application_id:Yo(),agent_name:Li(),agent_type:ts,agent_voice:ns,agent_description:Li(),instructions:Li(),file:Vo(File).optional(),image_url:Li().optional(),knowledge_ids:Ta,simulation_ids:Aa}),za=Ia.partial().extend({file:Vo(File).optional(),knowledge_ids:Ta,simulation_ids:Aa}),Oa=(bo({text:Li(),task_id:Li().optional()}),bo({status:Li(),message:Li().optional()}),bo({task_id:Li().optional(),status:Li().optional(),current_step:Li().optional(),error:Li().optional(),message:Li().optional()}),bo({workflow_id:Li(),workflow_type:Li(),status:Li(),current_step:Li(),error:Li().nullable(),created_at:Li(),updated_at:Li()}),bo({browser_session_id:Li().optional(),live_view_url:Li().nullish(),status:Li().optional(),message:Li().nullish(),success:lo().optional()}),To(["pending","in_progress","completed","failed","stopped","has_question"]),bo({contentType:To(["document","video","automation_log","screenshot","all"]).optional(),context:Li().optional(),previousActions:yo(Li()).optional(),top:Yo().min(1).max(100).optional(),minConfidence:Yo().min(0).max(1).optional(),entities:yo(Li()).optional(),useVectorSearch:lo().optional(),vectorThreshold:Yo().min(0).max(1).optional()}),bo({id:Li(),content:Li(),contentType:To(["document","video","automation_log","screenshot"]),sourceFile:Li(),sourceType:Li(),metadata:Li(),confidence:io(),keyPhrases:yo(Li()),entities:yo(Li()),sentiment:Li(),vectorContent:yo(io())})),Ra=(bo({document:Oa,score:io(),highlights:Io(Li(),yo(Li())).optional()}),bo({simulation_id:Yo().positive("Simulation ID must be a positive number")})),Pa=bo({agent:Ia,simulation_id:io(),knowledge_id:io(),message:Li()}),Na=ps.extend({workspace_id:io(),name:Li(),type:ls,url:Li().nullish(),username:Li().nullish(),password:Li().nullish(),allowed_domains:yo(Li()).nullish().default([])}),La=Na.partial().extend({type:ls,name:Li().min(1),url:Li(),allowed_domains:yo(Li()).optional().default([])}),Da=Na.partial().omit({workspace_id:!0}),$a=bo({chip_mode:To(["show","tell","do"]),chip_text:Li()}),ja=bo({widget_enabled:lo(),widget_appearance:To(["default","compact","full"]),widget_position:To(["bottom_left","bottom_right","top_left","top_right"]),widget_device:To(["desktop","mobile","desktop_mobile"]),widget_header:Li(),widget_body:Li(),widget_greeting:Li(),widget_feature_tell:lo(),widget_feature_show:lo(),widget_feature_do:lo(),widget_feature_human:lo(),widget_background_color:Li(),widget_text_color:Li(),widget_border_color:Li(),widget_accent_color:Li(),widget_secondary_color:Li(),widget_border_radius:Li(),widget_font_size:Li(),widget_width:Li(),widget_height:Li(),widget_shadow:Li(),widget_animation_duration:Li(),widget_fade_duration:Li(),widget_bounce_effect:lo(),widget_chips:yo($a)}),Fa=bo({webhook_url:Li().url(),channel:Li(),bot_token:Li(),notifications_enabled:lo()}),Ua=ps.extend({application_id:io(),agent_id:io(),type:cs,settings:xo([ja,Fa]),status:Xo,marketrix_id:Li(),marketrix_key:Li(),snippet:Li().nullish()}),Ba=(Ua.extend({application:Na.partial(),workspace:Ps.partial(),user:As.partial(),agent:Ia.partial()}),Ua.extend({agent:Ia.partial().optional()})),Wa=(Na.extend({widgets:yo(Ua).optional(),agents:yo(Ia).optional()}),Ua.partial().extend({application_id:io().positive(),agent_id:io().positive(),type:cs,settings:xo([ja,Fa]).optional()})),Ga=Ua.partial(),Ha=ps.extend({widget_id:io(),url_pattern:Li(),message:xo([Li(),yo(Li())]),description:Li().optional()}),Za=Ha.partial().extend({widget_id:io().positive(),url_pattern:Li().min(1),message:xo([Li().min(1),yo(Li().min(1)).min(1)])}),Va=Ha.partial(),qa=(bo({marketrix_id:Li().optional(),marketrix_key:Li().optional(),agent_id:io().positive().optional(),application_id:io().positive().optional(),chat_id:Li().optional(),content:Li()}).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"}),bo({text:Li(),task_id:Li().optional()}),_o("type",[bo({type:Mo("registered"),chat_id:Li(),application_id:io().optional()}),bo({type:Mo("pong")}),bo({type:Mo("heartbeat")}),bo({type:Mo("chat/response"),request_id:Li(),text:Li(),task_id:Li().optional()}),bo({type:Mo("chat/error"),request_id:Li(),error:Li()}),bo({type:Mo("task/status"),status:To(["started","completed","failed","stopped","in_progress","has_question"]),message:Li().optional(),task_id:Li().optional(),timestamp:io().optional()}),bo({type:Mo("tool/call"),call_id:Li(),tool:Li(),args:Io(Li(),po()),mode:To(["show","do"]).optional(),explanation:Li().optional(),state_version:io().optional()})])),Ya=_o("type",[bo({type:Mo("chat/tell"),request_id:Li(),content:Li()}),bo({type:Mo("chat/show"),request_id:Li(),content:Li()}),bo({type:Mo("chat/do"),request_id:Li(),content:Li()}),bo({type:Mo("chat/stop"),task_id:Li().optional()}),bo({type:Mo("tool/response"),call_id:Li(),success:lo(),data:Li().optional(),error:Li().optional(),state_version:io().optional()}),bo({type:Mo("ping")}),bo({type:Mo("rrweb/metadata"),session_id:Li(),chat_id:Li(),application_id:io(),url:Li().optional(),user_agent:Li().optional(),timestamp:io().optional(),viewport:bo({width:io(),height:io()}).optional()}),bo({type:Mo("rrweb/events"),session_id:Li(),events:yo(po())})]),Ja=To(["simulations","agents","qa","user","jobs","triggers","automations"]),Ka=_o("type",[bo({type:Mo("simulation/updated"),simulation_id:io(),application_id:io(),status:Li(),step_label:Li().optional(),step_pending:lo().optional(),task_id:Li().nullish()}),bo({type:Mo("simulation/created"),simulation_id:io(),application_id:io()}),bo({type:Mo("simulation/deleted"),simulation_id:io(),application_id:io()}),bo({type:Mo("simulation/queued"),simulation_id:io(),job_id:Li()}),bo({type:Mo("simulation/started"),simulation_id:io(),job_id:Li()}),bo({type:Mo("simulation/step"),simulation_id:io(),job_id:Li(),step_count:io().optional(),message:Li().optional()}),bo({type:Mo("simulation/question"),simulation_id:io(),job_id:Li(),question:Li().optional()}),bo({type:Mo("simulation/completed"),simulation_id:io(),job_id:Li(),step_count:io().optional()}),bo({type:Mo("simulation/failed"),simulation_id:io(),job_id:Li(),error:Li().optional()}),bo({type:Mo("simulation/stopped"),simulation_id:io(),job_id:Li()}),bo({type:Mo("simulation/mindmap-updated"),simulation_id:io(),application_id:io(),mindmap_status:Li(),steps_processed:io(),steps_total:io()}),bo({type:Mo("qa-run/completed"),run_id:io(),status:Li()}),bo({type:Mo("agent/updated"),agent_id:io().optional(),context_id:Li().optional(),task_id:Li().optional(),application_id:io().optional(),status:Li()}),bo({type:Mo("agent/created"),agent_id:io(),application_id:io()}),bo({type:Mo("agent/deleted"),agent_id:io(),application_id:io()}),bo({type:Mo("qa-document/updated"),document_id:io(),application_id:io(),status:Li(),step_label:Li().optional()}),bo({type:Mo("qa-run/updated"),run_id:io(),document_id:io(),application_id:io(),status:Li(),simulation_id:io().optional()}),bo({type:Mo("qa-test/updated"),test_id:io(),run_id:io(),document_id:io(),application_id:io(),status:Li()}),bo({type:Mo("user/updated"),user_id:io(),workspace_id:io(),status:Li()}),bo({type:Mo("job/progress"),job_id:Li(),application_id:io(),status:Li(),message:Li().optional()}),bo({type:Mo("job/completed"),job_id:Li(),application_id:io(),result:po().optional()}),bo({type:Mo("job/failed"),job_id:Li(),application_id:io(),error:Li()}),bo({type:Mo("trigger/fired"),trigger_id:io(),workspace_id:io(),provider:Li(),name:Li(),payload:po().optional(),timestamp:Li()}),bo({type:Mo("automation-run/completed"),automation_id:io(),run_id:io(),status:Mo("completed")}),bo({type:Mo("automation-run/failed"),automation_id:io(),run_id:io(),status:Mo("failed"),error:Li().optional()})]),Qa=bo({details:Li().optional(),id:io().optional(),type:Li().optional(),name:Li().optional(),target_user_id:io().optional(),target_user_email:Li().optional(),reason:Li().optional(),assigned_role:Li().optional(),new_role:Li().optional(),previous_role:Li().optional(),workspace_name:Li().optional(),workspace_slug:Li().optional(),ip_address:Li().optional(),user_agent:Li().optional(),widget_type:Li().optional(),created_by:io().optional()}).passthrough(),Xa=ps.extend({workspace_id:io(),user_id:io(),type:us,metadata:Qa.optional()}),el=Xa.partial().extend({type:us}),tl=To(["widget_chat","app_chat","guide_preview","slack"]),nl=To(["user","agent","assistant","system","tool"]),rl=(ps.extend({context_id:Li(),workspace_id:io(),application_id:io().nullish(),agent_id:io().nullish(),user_id:io().nullish(),simulation_id:io().nullish(),session_id:io().nullish(),persona_id:io().nullish(),type:tl,channel_id:Li().nullish(),preview_video_url:Li().nullish(),metadata:Io(Li(),po()).nullish()}),ps.extend({conversation_id:io(),role:nl,content:Li(),tool_call_id:Li().nullish()}),ps.extend({workspace_id:io(),application_id:io().nullish(),provider:ds,name:Li().min(1).max(120),identifier:Li().max(120).nullish(),api_endpoint:Li().url().nullish(),api_token:Li().nullish(),metadata:Io(Li(),po()).nullish(),is_active:lo().default(!0),status:Xo.default("active")})),il=bo({id:Yo().optional(),application_id:io().nullish(),provider:ds,name:Li().min(1).max(120),identifier:Li().max(120).nullish(),api_endpoint:Li().url().nullish(),api_token:Li().nullish(),metadata:Io(Li(),po()).nullish(),is_active:lo().optional(),status:Xo.optional()}),ol=bo({application_id:io().nullish(),provider:ds.optional(),status:Xo.optional(),is_active:Jo().optional(),limit:Yo().int().positive().max(100).optional(),offset:Yo().int().nonnegative().optional()}),sl=bo({id:io(),application_id:io(),identifier:Li(),api_token:Li(),is_active:lo(),created_at:Ko().optional()}),al=bo({name:Li(),category:Li(),description:Li(),inputSchema:Io(Li(),po()),enabled:lo()}),ll=bo({id:io(),full_name:Li(),name:Li(),private:lo(),html_url:Li(),default_branch:Li().optional()}),cl=bo({id:io(),name:Li(),status:Li(),conclusion:Li().nullable(),created_at:Li(),updated_at:Li(),html_url:Li(),head_branch:Li(),run_attempt:io()}),dl=To(["pending","in_progress","completed","failed","stopped"]),ul=(To(["connector","condition"]),_o("kind",[bo({kind:Mo("connector"),connector_type:Li().min(1),connector_id:io().nullable().optional(),connection_id:io().nullable().optional(),trigger_id:io().nullable().optional(),action_id:io().nullable().optional(),capability:Li().min(1),role:To(["trigger","callback"]),config:Io(Li(),po()).default({})}),bo({kind:Mo("condition"),config:bo({field:Li().min(1),operator:To(["equals","not_equals","contains","gt","lt"]),value:po()})})])),pl=bo({from:Li().min(1),to:Li().min(1),when:To(["true","false"]).optional()}),hl=bo({nodes:Io(Li(),ul),edges:yo(pl)}),ml=To(["skip","queue","replace"]).default("skip"),fl=ps.extend({workspace_id:io(),created_by_user_id:io().nullable(),name:Li(),graph:hl,concurrency:ml,enabled:lo(),last_run_at:Ko().nullable(),next_run_at:Ko().nullable()}),gl=bo({name:Li().min(1).max(255),graph:hl,concurrency:ml.optional(),enabled:lo().optional()}),yl=bo({id:Yo(),name:Li().min(1).max(255).optional(),graph:hl.optional(),enabled:lo().optional()}),wl=bo({enabled:Jo().optional(),limit:Yo().int().positive().max(100).optional(),offset:Yo().int().nonnegative().optional()}),bl=bo({status:To(["in_progress","completed","failed","skipped","stopped"]),output:Io(Li(),po()).nullable().optional(),error:Li().nullable().optional(),duration_ms:io().optional()}),vl=bo({id:io().optional(),automation_id:io(),status:dl,trigger_node_id:Li(),trigger_data:Io(Li(),po()).nullable(),node_results:Io(Li(),bl),started_at:Ko(),completed_at:Ko().nullable()}),xl=bo({status:dl.optional(),limit:Yo().int().positive().max(100).optional(),offset:Yo().int().nonnegative().optional()}),kl=bo({connector_type:Li(),built_in:lo(),triggers:yo(bo({capability:Li(),description:Li(),config_schema:Io(Li(),po())})),callbacks:yo(bo({capability:Li(),description:Li(),config_schema:Io(Li(),po())}))}),_l=bo({filename:Li(),status:Li(),additions:io(),deletions:io(),patch:Li().optional()}),Sl=(bo({event:Li(),action:Li(),pull_request:bo({number:io(),title:Li(),html_url:Li(),head:bo({sha:Li(),ref:Li()}),base:bo({ref:Li()})}),repository:bo({full_name:Li(),name:Li(),owner:bo({login:Li()})}),sender:bo({login:Li()}),files:yo(_l).optional()}),bo({name:Li(),head_sha:Li(),status:To(["queued","in_progress","completed"]).optional(),conclusion:To(["success","failure","neutral","cancelled","timed_out","action_required"]).optional(),started_at:Li().optional(),completed_at:Li().optional(),output:bo({title:Li(),summary:Li(),text:Li().optional()}).optional()}),bo({migration_type:Li().optional(),dry_run:lo().default(!0)})),Cl=bo({migration_type:Li().optional(),backup:lo().default(!0)}),Il=bo({url:Li()}),El=(bo({user_id:io(),file:Vo(File)}),bo({user_id:io(),application_id:io(),source:as,prompt:Li(),status:Li()}),bo({user_id:io(),limit:io(),used:io(),remaining:io()})),Tl=(bo({user_id:io(),workspace_id:io(),chat_count:io(),prompt_text:Li(),metadata:Io(Li(),Li()).optional()}),bo({to:Li(),subject:Li(),template:Li(),context:Io(Li(),Li())}),bo({id:Li(),object:Mo("event"),api_version:Li().nullish(),created:io(),data:bo({object:Io(Li(),po()),previous_attributes:Io(Li(),po()).optional()}),livemode:lo(),pending_webhooks:io(),request:bo({id:Li().nullable(),idempotency_key:Li().nullable()}).nullable().optional(),type:Li()}),bo({priceId:Li().min(1,"Price ID is required"),successUrl:Li().url("Success URL must be a valid URL"),cancelUrl:Li().url("Cancel URL must be a valid URL")})),Al=bo({returnUrl:Li().url("Return URL must be a valid URL")}),Ml=bo({plan:To(["starter","growth"]).default("starter"),interval:To(["month","year"]).default("month")}),zl=bo({subscriptionId:Li().min(1,"Subscription ID is required"),priceId:Li().min(1,"Price ID is required")}),Ol=bo({success:lo(),message:Li()}),Rl=bo({subscriptionId:Li().nullable(),customerId:Li().nullable(),status:To(["active","past_due","canceled","unpaid","trialing","incomplete","incomplete_expired","paused"]).nullable(),planTier:To(["free","starter","growth","enterprise"]).nullable(),billingInterval:To(["month","year"]).nullable(),priceId:Li().nullable(),trialEndDate:Ko().nullable(),currentPeriodStart:Ko().nullable(),currentPeriodEnd:Ko().nullable(),cancelAtPeriodEnd:lo(),isTrialing:lo(),daysRemainingInTrial:io().nullable(),trialProvisioned:lo()}),Pl=bo({sessionId:Li(),url:Li().url()}),Nl=bo({url:Li().url()}),Ll=bo({subscriptionId:Li(),customerId:Li(),status:Mo("trialing"),trialStartDate:Ko(),trialEndDate:Ko(),planTier:To(["starter","growth"]),daysRemainingInTrial:io()}),Dl=bo({used:io().int().min(0),limit:io().int()}),$l=bo({applications:Dl,simulationsPerMonth:Dl,userPrompts:Dl}),jl=bo({amount:io().int().min(0),currency:Li().default("usd"),formatted:Li()}),Fl=bo({planId:To(["free","starter","growth","enterprise"]),monthly:jl.nullable(),annual:jl.nullable(),priceIds:bo({monthly:Li().nullable(),annual:Li().nullable()})}),Ul=bo({plans:yo(Fl),lastUpdated:Li().datetime()}),Bl=bo({id:To(["free","starter","growth","enterprise"]),name:Li(),description:Li(),features:yo(Li()),cta:Li(),isPopular:lo(),customPriceDisplay:Li().optional(),priceSubtext:Li().optional(),borderColor:Li(),buttonColor:Li(),outlineColor:Li(),checkColor:Li()}),Wl=bo({plans:yo(Bl)}),Gl=bo({publishableKey:Li(),priceIds:bo({starter:bo({monthly:Li().nullable(),annual:Li().nullable()}),growth:bo({monthly:Li().nullable(),annual:Li().nullable()})}),trialDays:io().int().min(0),calendlyUrl:Li()}),Hl=bo({widgetKey:Li(),widgetId:Li(),widgetUrl:Li()}),Zl=bo({date:Li().describe("YYYY-MM-DD"),sessions:io().int().nonnegative(),events:io().int().nonnegative()}),Vl=bo({items:yo(Zl)}),ql=bo({role:To(["user","assistant","system"]),content:Li(),timestamp:Li().optional()}),Yl=ps.extend({workspace_id:io(),application_id:io().nullish(),agent_id:io().nullish(),simulation_id:io().nullish(),chat_id:Li(),chat_content:Li().nullish(),chat_history:yo(ql).nullish(),chat_output:Li().nullish(),preview_video_url:Li().nullish(),metadata:Io(Li(),po()).nullish()}),Jl=bo({application_id:io().nullish(),agent_id:io().nullish(),simulation_id:io().nullish(),chat_id:Li(),chat_content:Li().nullish(),chat_history:yo(ql).nullish(),chat_output:Li().nullish(),preview_video_url:Li().nullish(),metadata:Io(Li(),po()).nullish()}),Kl=bo({chat_id:Li().optional(),agent_id:io().optional(),simulation_id:io().optional(),limit:io().optional(),offset:io().optional()}),Ql=To(["github","slack","teams","jira"]),Xl=To(["github","slack","teams","jira","timer","mcp"]),ec=To(["github","slack","teams","jira","internal"]),tc=To(["connected","disconnected"]),nc=ps.extend({workspace_id:io(),provider:Ql,status:tc.default("disconnected"),credentials:Io(Li(),po()).nullish(),provider_data:Io(Li(),po()).nullish(),connected_at:Ko().nullish()}),rc=ps.extend({workspace_id:io(),connection_id:io().nullish(),connector_id:io().nullish(),provider:Xl,name:Li().min(1).max(255),source_config:Io(Li(),po()).default({}),webhook_id:Li(),webhook_secret:Li(),enabled:lo().default(!0),last_triggered_at:Ko().nullish()}),ic=bo({connection_id:io().nullish(),connector_id:io().nullish(),provider:Xl,name:Li().min(1).max(255),source_config:Io(Li(),po()).default({})}),oc=bo({trigger_id:Yo(),name:Li().min(1).max(255).optional(),source_config:Io(Li(),po()).optional(),enabled:lo().optional()}),sc=bo({provider:Xl.optional(),connection_id:Yo().optional(),connector_id:Yo().optional()}).extend(_s.shape),ac=ps.extend({workspace_id:io(),connection_id:io().nullish(),provider:ec,name:Li().min(1).max(255),type:Li().min(1).max(60),target_config:Io(Li(),po()).default({}),is_default:lo().default(!1),enabled:lo().default(!0),last_executed_at:Ko().nullish()}),lc=bo({connection_id:io().nullish(),provider:ec,name:Li().min(1).max(255),type:Li().min(1).max(60),target_config:Io(Li(),po()).default({})}),cc=bo({action_id:Yo(),name:Li().min(1).max(255).optional(),target_config:Io(Li(),po()).optional(),enabled:lo().optional()}),dc=bo({provider:ec.optional(),type:Li().optional()}).extend(_s.shape),uc=To(["connected","not_connected"]),pc=bo({key:Li(),label:Li(),color:Li(),status:uc,session_count:io().nullable()}),hc=bo({id:io(),application_id:io(),name:Li(),percentage:io(),description:Li(),avg_sessions_per_week:io(),mobile_percentage:io(),created_at:Ko().optional(),updated_at:Ko().optional()}),mc=bo({id:io(),application_id:io(),segment_id:io().nullable(),segment_name:Li().optional(),name:Li(),initials:Li(),description:Li(),traits:yo(Li()),created_at:Ko().optional(),updated_at:Ko().optional()}),fc=bo({connectors:yo(pc),segments:yo(hc),personas:yo(mc)}),gc=To(["clicks","scroll","attention"]),yc=To(["desktop","tablet","mobile"]),wc=bo({x:io(),y:io(),radius:io(),intensity:io()}),bc=bo({total_interactions:io(),unique_users:io(),hottest_zone:Li(),dead_zones:io()}),vc=bo({id:io(),application_id:io(),path:Li(),session_count:io(),variation_count:io()}),xc=bo({id:io(),heatmap_page_id:io(),variation:yc,type:gc,spots:yo(wc),stats:bc}),kc=bo({score:io().min(1).max(10),justification:Li()}),_c=bo({id:io(),run_id:io(),persona_id:io().nullable(),persona_name:Li().optional(),persona_initials:Li().optional(),ad_hoc_persona:bo({name:Li(),description:Li(),traits:yo(Li())}).nullable().optional(),overall_reactions:Io(Li(),kc),dimension_scores:Io(Li(),kc),created_at:Ko().optional()}),Sc=bo({type:To(["doc","sim","session"]),id:Li(),label:Li()}),Cc=bo({description:Li(),selected:lo()}),Ic=bo({id:io(),reaction_id:io(),run_number:io().optional(),context_refs:yo(Sc),simulations:yo(Cc),persona_ids:yo(io()).optional(),results:yo(_c).optional(),created_at:Ko().optional()}),Ec=bo({id:io(),application_id:io(),question:Li(),run_count:io().optional(),last_run_at:Ko().optional(),runs:yo(Ic).optional(),created_at:Ko().optional()}),Tc=bo({contextRefs:yo(Sc),suggestedSimulations:yo(Cc)}),Ac=To(["received","classifying","dispatched","completed","failed"]),Mc=bo({id:io(),workspace_id:io(),slack_user_id:Li(),slack_channel_id:Li().nullable(),raw_text:Li(),detected_intent:Li(),extracted_params:Io(Li(),po()),status:Ac,response_text:Li().nullable(),error_message:Li().nullable(),duration_ms:io().nullable(),created_at:Ko().optional(),updated_at:Ko().optional()}),zc=bo({intent:Li().optional(),limit:Yo().optional().default(20),offset:Yo().optional().default(0)}),Oc=bo({intent:Li(),name:Li(),description:Li(),example:Li(),execution_count:io(),last_used:Li().nullable()}),Rc=class extends Error{issues;data;constructor(e){super(e.message,e),this.issues=e.issues,this.data=e.data}};function Pc(e,t){return{...e,...t}}var Nc=class{"~orpc";constructor(e){if(e.route?.successStatus&&X(e.route.successStatus))throw new Error("[ContractProcedure] Invalid successStatus.");if(Object.values(e.errorMap).some(e=>e&&e.status&&!X(e.status)))throw new Error("[ContractProcedure] Invalid error status code.");this["~orpc"]=e}};function Lc(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 Dc(e,t){if((n=e)instanceof Nc||("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 Nc({...e["~orpc"],errorMap:Pc(t.errorMap,e["~orpc"].errorMap),route:Lc(e["~orpc"].route,t)});var n;if("object"!=typeof e||null===e)return e;const r={};for(const i in e)r[i]=Dc(e[i],t);return r}var $c=new class e extends Nc{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:Pc(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 Dc(e,this["~orpc"])}}({errorMap:{},route:{},meta:{}}),jc=Symbol("ORPC_EVENT_ITERATOR_DETAILS");function Fc(e,t){return{"~standard":{[jc]:{yields:e,returns:t},vendor:"orpc",version:1,validate:n=>D(n)?{value:ge(n,{async value(n,r){const i=r?t:e;if(!i)return n;const o=await i["~standard"].validate(n);if(o.issues)throw new Q("EVENT_ITERATOR_VALIDATION_FAILED",{message:"Event iterator validation failed",cause:new Rc({issues:o.issues,message:"Event iterator validation failed",data:n})});return o.value},error:async e=>e})}:{issues:[{message:"Expect event iterator",path:[]}]}}}}$c.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),$c.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),$c.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(bo({url:Li().url(),skip_network:Li().optional()})).output(bo({valid:lo(),accessible:lo(),dnsResolves:lo(),error:Li().optional().describe("Error message if URL validation failed"),warnings:yo(Li()).optional().describe("Non-fatal issues found during URL validation")})),$c.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(Hl),$c.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(bo({user:As,workspace:Ps.nullable(),workspaces:yo(bo({id:io(),name:Li(),slug:Li(),role:To(["owner","member"])}))})),$c.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(bo({token:Li().min(1)})).output(bo({result:Li().describe("HTML response page")})),$c.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(bo({name:Li().min(1).max(45),slug:Li().min(1).max(45).optional(),domain:Li().min(1).max(200),team_emails:yo(Li().email()).optional().default([]),app_url:Li().optional(),app_username:Li().optional(),app_password:Li().optional()})).output(bo({workspace:Ps})),$c.route({method:"POST",tags:["Workspace"],path:"/workspaces",summary:"Create a new workspace",description:"Creates new workspace with specified settings and returns workspace entity"}).input(Ns).output(Ps),$c.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(bo({name:Li().optional(),domain:Li().optional(),email:Li().email().optional(),app_id:Yo().optional(),workspace_id:Yo().optional(),user_id:Yo().optional()}).extend(_s.shape)).output(Ss(Ps)),$c.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(bo({name:Li(),slug:Li()}).nullable()),$c.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(Ps),$c.route({method:"POST",tags:["Workspace"],path:"/workspaces/{slug}/select",summary:"Select the active workspace for the current session",description:"Updates the server-side session workspace context to match the selected workspace slug."}).input(fs).output(Ps),$c.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:Li()})).output(Ps),$c.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),$c.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})}))),$c.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:Li().email(),role:js.default("member")})).output(Fs),$c.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:io()})).output(xs),$c.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:io(),role:js})).output(Fs),$c.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(Ps.extend({role:js}))),$c.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(bo({workspaces_stripe_created:io(),users_workos_created:io(),workspace_plans_synced:io(),trials_provisioned:io(),stripe_plans_refreshed:io(),workos_profiles_synced:io(),errors:yo(bo({type:Li(),id:io(),error:Li()}))})),$c.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(bo({cosmos_containers_deleted:io(),orphaned_qa_simulations_deleted:io(),orphaned_blob_dirs_deleted:io(),errors:yo(bo({type:Li(),detail:Li()}))})),$c.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(bo({knowledge_removed:io(),simulations_removed:io(),agents_rebuilt:io(),errors:yo(bo({type:Li(),detail:Li()}))})),$c.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(La).output(Na),$c.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(bo({type:ls.optional(),include:yo(To(["widgets"])).optional()}).extend(_s.shape)).output(Ss(Na.extend({widgets:yo(Ua).optional()}))),$c.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(Na.extend({widgets:yo(Ua)})),$c.route({method:"PUT",tags:["Application"],path:"/applications/{application_id}",summary:"Update application",description:"Updates application details and configuration"}).input(Da.extend({application_id:Yo()})).output(Na),$c.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),$c.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(Wa).output(Ua),$c.route({method:"GET",tags:["Widget"],path:"/widgets",summary:"Search widgets for workspace",description:"Search widgets by type, application, marketrix_id, or marketrix_key"}).input(bo({type:cs.optional(),application_id:Yo().optional(),marketrix_id:Li().optional(),marketrix_key:Li().optional(),include:yo(To(["agent"])).optional()}).extend(_s.shape)).output(Ss(Ba)),$c.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(bo({type:cs})).output(xo([ja,Fa])),$c.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(Ua),$c.route({method:"PUT",tags:["Widget"],path:"/widgets/{widget_id}",summary:"Update widget",description:"Updates widget settings and configuration"}).input(Ga.extend({widget_id:Yo()})).output(Ua),$c.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),$c.route({method:"POST",tags:["Chat"],path:"/chat",summary:"Create a new chat thread",description:"Initializes new chat thread and returns session ID"}).output(Li()),$c.route({method:"GET",tags:["Chat"],path:"/chat",summary:"Search chats by user",description:"Returns chat list and quota for the specified user"}).input(bo({user_id:Yo().optional(),chat_id:Yo().optional()})).output(El),$c.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(Yl),$c.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(Kl).output(Cs(Yl)),$c.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(Yl.nullable()),$c.route({method:"POST",tags:["Connector"],path:"/connector",summary:"Create or update connector",description:"Stores provider credentials and API endpoint details for workspace connectors"}).input(il).output(rl),$c.route({method:"GET",tags:["Connector"],path:"/connector",summary:"Search connectors",description:"Returns workspace connectors filtered by provider/status"}).input(ol).output(Ss(rl)),$c.route({method:"GET",tags:["Connector"],path:"/connector/{id}",summary:"Get connector by ID",description:"Returns a single workspace connector"}).input(ms).output(rl.nullable()),$c.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),$c.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(bo({id:Yo(),per_page:Yo().int().min(1).max(100).optional(),page:Yo().int().min(1).optional()})).output(yo(ll)),$c.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(bo({id:Yo(),owner:Li().min(1),repo:Li().min(1),per_page:Yo().int().min(1).max(100).optional(),page:Yo().int().min(1).optional()})).output(yo(cl)),$c.route({method:"POST",tags:["MCP"],path:"/mcp/activate",summary:"Activate MCP for an application",description:"Creates or reactivates an MCP connector with auto-generated credentials."}).input(bo({application_id:Yo()})).output(sl),$c.route({method:"POST",tags:["MCP"],path:"/mcp/deactivate",summary:"Deactivate MCP for an application",description:"Deactivates the MCP connector. Credentials are preserved but access is revoked."}).input(bo({application_id:Yo()})).output(sl),$c.route({method:"POST",tags:["MCP"],path:"/mcp/regenerate",summary:"Regenerate MCP API key",description:"Generates a new API key for the MCP connector. Existing integrations will break."}).input(bo({application_id:Yo()})).output(sl),$c.route({method:"GET",tags:["MCP"],path:"/mcp/status/{application_id}",summary:"Get MCP activation status",description:"Returns the MCP connector status for an application, or null if not activated."}).input(bo({application_id:Yo()})).output(sl.nullable()),$c.route({method:"GET",tags:["MCP"],path:"/mcp/tools/{application_id}",summary:"List MCP platform tools",description:"Returns all platform tools with their enabled/disabled state."}).input(bo({application_id:Yo()})).output(yo(al)),$c.route({method:"PATCH",tags:["MCP"],path:"/mcp/tools/toggle",summary:"Toggle a platform tool",description:"Enable or disable a specific platform tool for the MCP server."}).input(bo({application_id:Yo(),tool_name:Li(),enabled:lo()})).output(yo(al)),$c.route({method:"POST",tags:["Automation"],path:"/automation",summary:"Create automation",description:"Creates a DAG-based automation workflow"}).input(gl).output(fl),$c.route({method:"GET",tags:["Automation"],path:"/automation",summary:"List automations",description:"Returns automations for the current workspace"}).input(wl).output(Ss(fl)),$c.route({method:"GET",tags:["Automation"],path:"/automation/{id}",summary:"Get automation",description:"Returns a single automation with its graph"}).input(ms).output(fl.nullable()),$c.route({method:"PUT",tags:["Automation"],path:"/automation/{id}",summary:"Update automation",description:"Updates automation graph and settings"}).input(yl).output(fl),$c.route({method:"DELETE",tags:["Automation"],path:"/automation/{id}",summary:"Delete automation",description:"Permanently deletes an automation and deregisters its triggers"}).input(ms).output(xs),$c.route({method:"PATCH",tags:["Automation"],path:"/automation/{id}/toggle",summary:"Toggle automation",description:"Enable or disable an automation"}).input(bo({id:Yo(),enabled:lo()})).output(fl),$c.route({method:"POST",tags:["Automation"],path:"/automation/{id}/run",summary:"Trigger automation run",description:"Manually triggers an automation run"}).input(ms).output(vl.nullable()),$c.route({method:"GET",tags:["Automation"],path:"/automation/{id}/runs",summary:"List automation runs",description:"Returns execution history for an automation"}).input(bo({id:Yo()}).extend(xl.shape)).output(Ss(vl)),$c.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(bo({id:Yo(),run_id:Yo()})).output(vl.nullable()),$c.route({method:"GET",tags:["Connection"],path:"/connection/{provider}",summary:"Get connection for a provider"}).input(bo({provider:Ql})).output(nc.nullable()),$c.route({method:"DELETE",tags:["Connection"],path:"/connection/{provider}",summary:"Disconnect a provider"}).input(bo({provider:Ql})).output(bo({success:lo()})),$c.route({method:"POST",tags:["Connection"],path:"/connection/{provider}/refresh",summary:"Re-fetch provider data using stored credentials"}).input(bo({provider:Ql})).output(nc),$c.route({method:"POST",tags:["Trigger"],path:"/trigger",summary:"Create a new trigger"}).input(ic).output(rc),$c.route({method:"GET",tags:["Trigger"],path:"/trigger/{trigger_id}",summary:"Get a single trigger"}).input(bo({trigger_id:Yo()})).output(rc),$c.route({method:"GET",tags:["Trigger"],path:"/trigger",summary:"List triggers"}).input(sc).output(Ss(rc)),$c.route({method:"PUT",tags:["Trigger"],path:"/trigger/{trigger_id}",summary:"Update trigger"}).input(oc).output(rc),$c.route({method:"DELETE",tags:["Trigger"],path:"/trigger/{trigger_id}",summary:"Delete a trigger"}).input(bo({trigger_id:Yo()})).output(bo({success:lo()})),$c.route({method:"PATCH",tags:["Trigger"],path:"/trigger/{trigger_id}/toggle",summary:"Toggle trigger enabled state"}).input(bo({trigger_id:Yo()})).output(rc),$c.route({method:"POST",tags:["Trigger"],path:"/trigger/{trigger_id}/install",summary:"Auto-install trigger configuration on the provider"}).input(bo({trigger_id:Yo()})).output(bo({success:lo(),message:Li()})),$c.route({method:"GET",tags:["Slack"],path:"/slack/command-log",summary:"Search slash command logs"}).input(zc).output(Ss(Mc)),$c.route({method:"GET",tags:["Slack"],path:"/slack/capabilities",summary:"Get Slack capability stats"}).output(yo(Oc)),$c.route({method:"POST",tags:["Action"],path:"/action",summary:"Create a custom action"}).input(lc).output(ac),$c.route({method:"GET",tags:["Action"],path:"/action/{action_id}",summary:"Get a single action"}).input(bo({action_id:Yo()})).output(ac),$c.route({method:"GET",tags:["Action"],path:"/action",summary:"List actions"}).input(dc).output(Ss(ac)),$c.route({method:"PUT",tags:["Action"],path:"/action/{action_id}",summary:"Update action"}).input(cc).output(ac),$c.route({method:"DELETE",tags:["Action"],path:"/action/{action_id}",summary:"Delete an action"}).input(bo({action_id:Yo()})).output(bo({success:lo()})),$c.route({method:"PATCH",tags:["Action"],path:"/action/{action_id}/toggle",summary:"Toggle action enabled state"}).input(bo({action_id:Yo()})).output(ac),$c.route({method:"GET",tags:["Connector"],path:"/connector-capabilities",summary:"List connector capabilities",description:"Returns available triggers and callbacks per connector type"}).input(bo({})).output(yo(kl)),$c.route({method:"GET",tags:["User"],path:"/user",summary:"Search and filter users by workspace",description:"Returns list of users associated with specified workspace"}).input(bo({workspace_id:Yo().optional(),status:Xo.optional()}).extend(_s.shape)).output(Ss(As)),$c.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(Os).output(yo(Rs)),$c.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),$c.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(zs.extend({user_id:Yo()})).output(As),$c.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:Yo()})).output(Il),$c.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),$c.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:Li().optional()})).output(xs),$c.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(Ma).output(Ia),$c.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(bo({workspace_id:Yo().optional(),user_id:Yo().optional(),application_id:Yo().optional(),include:yo(To(["knowledge","simulations"])).optional()}).extend(_s.shape)).output(Ss(Ia)),$c.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:yo(To(["knowledge","simulations"])).optional()})).output(Ia),$c.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(Ca),$c.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(za.extend({agent_id:Yo(),force_reset_learning:Jo().optional()})).output(Ia),$c.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),$c.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(Ra.extend({agent_id:Yo()})).output(Pa),$c.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(Ia),$c.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),$c.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(bo({workspace_id:Yo().optional(),type:us.optional(),application_id:Yo().optional()}).extend(_s.shape)).output(Ss(Xa)),$c.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(Ha)),$c.route({method:"POST",tags:["URL Guide"],path:"/url-guide",summary:"Create new URL guide",description:"Creates URL guide with pattern and message"}).input(Za).output(Ha),$c.route({method:"GET",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Get URL guide by ID",description:"Returns URL guide details"}).input(ms).output(Ha),$c.route({method:"PUT",tags:["URL Guide"],path:"/url-guide/{id}",summary:"Update URL guide",description:"Updates URL guide properties"}).input(Va.extend({id:Yo()})).output(Ha),$c.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),$c.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(bo({widget_id:Yo(),url:Li()})).output(Ha.nullable()),$c.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Get a single simulation by ID"}).input(bo({simulation_id:Yo()})).output(fa),$c.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(bo({workspace_id:Yo().optional(),application_id:Yo().optional(),agent_id:Yo().optional(),pinned:xo([lo(),Li()]).optional().transform(e=>void 0===e?void 0:"boolean"==typeof e?e:"true"===e||"false"!==e&&void 0),source:To(["direct","qa"]).optional(),include:yo(To(["agent","application"])).optional()}).extend(_s.shape)).output(Ss(fa)),$c.route({method:"POST",tags:["Simulation"],path:"/simulation/start",summary:"Start new application simulation",description:"Creates and initializes simulation with specified parameters"}).input(ga).output(fa),$c.route({method:"PUT",tags:["Simulation"],path:"/simulation/{simulation_id}",summary:"Update simulation configuration and status",description:"Modifies simulation parameters and updates execution state"}).input(ya.extend({simulation_id:Yo()})).output(fa),$c.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:yo(io())})).output(fa),$c.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.extend({task_id:Li().optional()})).output(Cs(xa)),$c.route({method:"GET",tags:["Simulation"],path:"/simulation/{simulation_id}/task/{task_id}/live-view",summary:"Get per-task live view URL",description:"Returns Browserbase per-tab live view URL for a specific task within a simulation."}).input(bo({simulation_id:Yo().int().positive(),task_id:Li()})).output(bo({live_view_url:Li(),status:Li()})),$c.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.extend({task_id:Li()})).output(Cs(ua)),$c.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)),$c.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(Ca),$c.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),$c.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(wa.extend({simulation_id:Yo()})).output(ks),$c.route({method:"POST",tags:["Simulation"],path:"/simulation/{simulation_id}/retry-mindmap",summary:"Retry mindmap generation",description:"Restarts mindmap generation from stored history for a simulation."}).input(bo({simulation_id:Yo()})).output(ks),$c.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),$c.route({method:"POST",tags:["Session"],path:"/sessions",summary:"Create or update session",description:"Creates a new session or updates an existing one"}).input(va).output(ba),$c.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}",summary:"Get session by session ID",description:"Retrieves a session by its session_id"}).input(bo({session_id:Li().min(1)})).output(ba.nullable()),$c.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(bo({chat_id:Li().min(1)})).output(Cs(ba)),$c.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(bo({application_id:Yo().optional(),start_date:Li().optional(),end_date:Li().optional()}).extend(_s.shape)).output(Ss(ba)),$c.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(bo({application_id:Yo(),start_date:Li().describe("YYYY-MM-DD"),end_date:Li().describe("YYYY-MM-DD")})).output(Vl),$c.route({method:"GET",tags:["Session"],path:"/sessions/{session_id}/events",summary:"Get session events (paginated by batch)",description:"Fetches batches from storage in pages. Use batch_offset/batch_limit to paginate."}).input(bo({session_id:Li().min(1),batch_offset:Yo().int().nonnegative().default(0),batch_limit:Yo().int().positive().max(50).default(20)})).output(bo({items:yo(bo({type:io(),timestamp:io(),data:po().describe("rrweb event payload — shape defined by rrweb library")})),count:io(),total_batches:io(),batch_offset:io(),batch_limit:io()})),$c.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(bo({application_id:io(),agent_id:io(),url:Li().nullish()})).output(bo({browser_session_id:Li(),live_view_url:Li()})),$c.route({method:"POST",tags:["Browser Session"],path:"/browser-session/{browser_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(bo({browser_session_id:Li(),stop_tasks:lo().optional().default(!0)})).output(ks),$c.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(bo({workspace_id:Yo().optional(),type:os.optional(),application_id:Yo().optional(),include:yo(To(["agents","application"])).optional()}).extend(_s.shape)).output(Ss(Bs)),$c.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(bo({file:function(e){return function(e,t){return new e({type:"file",...lt(t)})}(zo,e)}().optional(),application_id:Yo(),document_url:Li().url().optional(),document_name:Li().optional(),video_url:Li().url().optional(),video_name:Li().optional()})).output(Bs),$c.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),$c.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),$c.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),$c.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(bo({knowledge_id:Yo(),agent_ids:yo(io())})).output(Bs),$c.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),$c.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(bo({document:Hs})),$c.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:Li().min(5).max(2e3)})).output(Xs),$c.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(Fc(bo({event:Li().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:po().describe("Event payload object — shape varies by event type")}))),$c.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:Li().min(5)})).output(Fc(bo({event:Li().describe("SSE event type: response.created | response.progress | response.clear | response.completed | error"),data:po().describe("Event payload object — shape varies by event type")}))),$c.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),$c.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(bo({application_id:Yo().optional()}).extend(_s.shape)).output(Ss(Hs.extend({run_count:io(),display_title:Li(),total_failed:io(),pass_rate:io().nullable(),last_run:bo({id:io(),status:Li(),total_tests:io(),passed_tests:io(),failed_tests:io(),created_at:Ko().nullable()}).nullable()})).extend({metrics:bo({total_flows:io(),total_runs:io(),avg_pass_rate:io().nullable(),total_failed:io(),total_passed:io()})})),$c.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),$c.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:ss})).output(Hs),$c.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:io(),passed:io(),failed:io()}))),$c.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:yo(Qs)})),$c.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),$c.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(bo({run:Vs,simulations:yo(fa)})),$c.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:Yo().optional()})).output(Cs(Qs)),$c.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:Li().optional(),test_objective:Li().optional(),test_steps:yo(Li()).optional(),expected_outcome:Li().optional(),priority:To(["Low","Medium","High"]).optional(),is_active:lo().optional()})).output(Qs),$c.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(bo({run:Vs,simulations:yo(fa)})),$c.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(bo({simulation:fa})),$c.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 for a specific run, or null if no simulation exists."}).input(ms.extend({run_id:Yo().int().positive().optional()})).output(bo({simulation:fa.nullable()})),$c.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(Js)),$c.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:Yo()})).output(Js),$c.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:Yo()})).output(Js),$c.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:Yo(),version2:Yo()})).output(bo({version1:Js,version2:Js,diff:yo(bo({field:Li(),oldValue:ta,newValue:ta}))})),$c.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:Yo()})).output(xs.extend({current_version:io()})),$c.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:Yo()})).output(xs),$c.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)),$c.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:Yo()})).output(xs),$c.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:Yo()})).output(xs),$c.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:io(),config:bo({enabled:lo().optional(),autoApply:lo().optional(),minConfidenceThreshold:io().min(0).max(1).optional(),maxHealingAttempts:io().int().min(1).max(5).optional()}).optional()})).output(bo({healed:lo(),attemptIndex:io().nullable(),analysis:ra.nullable(),confidence:io().nullable()})),$c.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:Yo()})).output(bo({runs:yo(bo({browserType:Ws,runId:io(),status:To(["completed","failed","skipped"]),passedTests:io(),failedTests:io(),totalTests:io()})),summary:bo({totalRuns:io(),completedRuns:io(),failedRuns:io(),overallPassed:io(),overallFailed:io()})})),$c.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(bo({byTest:Io(Li(),Io(Li(),bo({status:Li(),runId:io()}))),byBrowser:Io(Li(),bo({passed:io(),failed:io(),total:io()}))})),$c.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:Yo()})).output(xs),$c.route({method:"POST",tags:["Internal"],path:"/migrate/prepare",summary:"Prepare database migration",description:"Validates migration requirements and prepares system for migration"}).input(Sl).output(bo({message:Li(),status:Li(),data:Sl})),$c.route({method:"POST",tags:["Internal"],path:"/migrate/run",summary:"Execute database migration",description:"Runs migration scripts and updates database schema"}).input(Cl).output(bo({message:Li(),status:Li(),data:Cl})),$c.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(Ml).output(Ll),$c.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(Tl).output(Pl),$c.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(Al).output(Nl),$c.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(zl).output(Ol),$c.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(bo({subscriptionId:Li().min(1)})).output(bo({subscriptionId:Li(),cancelAtPeriodEnd:lo()})),$c.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(bo({pricing:Ul,plans:Wl,config:Gl})),$c.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(bo({plan:Rl,usage:$l})),$c.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(bo({chat_id:Li(),tab_id:Li().optional(),marketrix_id:Li().optional(),marketrix_key:Li().optional(),agent_id:Yo().optional(),application_id:Yo().optional()})).output(Fc(qa)),$c.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(bo({chat_id:Li(),command:Ya})).output(bo({ok:lo()})),$c.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(bo({scopes:yo(Ja).min(1),application_id:Yo().optional()})).output(Fc(Ka)),$c.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(bo({event:Li(),data:Io(Li(),po())})).output(bo({received:lo()})),$c.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(bo({id:Li(),object:Li(),type:Li(),data:Io(Li(),po())}).passthrough().describe("Stripe event payload")).output(bo({received:lo()})),$c.route({method:"GET",tags:["Insight"],path:"/insights/personas",summary:"Get personas overview (connectors + segments + personas)"}).input(bs).output(fc),$c.route({method:"POST",tags:["Insight"],path:"/insights/segments/generate",summary:"Generate segments from session data (mocked)"}).input(bs).output(bo({items:yo(hc)})),$c.route({method:"DELETE",tags:["Insight"],path:"/insights/segments/{id}",summary:"Delete a segment"}).input(bo({id:Yo()})).output(xs),$c.route({method:"POST",tags:["Insight"],path:"/insights/personas/generate",summary:"Generate personas from segments (mocked)"}).input(bs).output(bo({items:yo(mc)})),$c.route({method:"DELETE",tags:["Insight"],path:"/insights/personas/{id}",summary:"Delete a persona"}).input(bo({id:Yo()})).output(xs),$c.route({method:"GET",tags:["Insight"],path:"/insights/heatmaps/pages",summary:"Get all tracked heatmap pages"}).input(bs).output(bo({items:yo(vc)})),$c.route({method:"GET",tags:["Insight"],path:"/insights/heatmaps/snapshot",summary:"Get heatmap snapshot for a page/variation/type"}).input(bo({page_id:Yo(),variation:yc,type:gc})).output(xc.nullable()),$c.route({method:"POST",tags:["Insight"],path:"/insights/heatmaps/generate",summary:"Generate heatmap data from sessions (mocked)"}).input(bs).output(xs),$c.route({method:"GET",tags:["Insight"],path:"/insights/reactions",summary:"Get all reactions with runs and results"}).input(bs).output(bo({reactions:yo(Ec),personas:yo(mc)})),$c.route({method:"POST",tags:["Insight"],path:"/insights/reactions",summary:"Create a new reaction (question)"}).input(bo({application_id:Yo(),question:Li()})).output(Ec),$c.route({method:"DELETE",tags:["Insight"],path:"/insights/reactions/{id}",summary:"Delete a reaction and all its runs"}).input(bo({id:Yo()})).output(xs),$c.route({method:"POST",tags:["Insight"],path:"/insights/reactions/context",summary:"Get context for a reaction question (mocked)"}).input(bo({application_id:Yo(),question:Li()})).output(Tc),$c.route({method:"POST",tags:["Insight"],path:"/insights/reactions/{reaction_id}/run",summary:"Run reaction scoring for selected personas (mocked scoring)"}).input(bo({reaction_id:Yo(),persona_ids:yo(Yo()),context_refs:yo(Sc),simulations:yo(Cc)})).output(Ic);var Uc,Bc=null,Wc="";function Gc(e){return ye(new $e({url:e,headers:()=>{const e={};return Bc&&(e.Authorization=`Bearer ${Bc}`),e}}))}Uc=Gc("");var Hc=e=>{if(!e?.trim())throw new Error("API URL is required for SDK configuration");e!==Wc&&(Wc=e,Uc=Gc(e))},Zc={setAuthToken:e=>{Bc=e},clearAuthToken:()=>{Bc=null},getAuthToken:()=>Bc,configure:Hc},Vc=new Proxy({},{get:(e,t)=>t in Zc?Zc[t]:Uc[t]}),qc=e=>e?.mtxApiHost?e.mtxApiHost:"";function Yc(e,t="Unknown error"){return e instanceof Error?e.message:"string"==typeof e?e:t}function Jc(e,t="Operation",n){const r=Yc(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 ${qc(n)||"configured API server"}. Error: ${r}`}:{isValid:!1,error:`${t} failed: ${r}`}}var Kc="undefined"==typeof window||"localhost"!==window.location.hostname&&"127.0.0.1"!==window.location.hostname&&!window.location.hostname.includes("localhost")?"error":"debug",Qc={debug:0,info:1,warn:2,error:3};function Xc(e){return Qc[e]>=Qc[Kc]}var ed=(e,t,...n)=>{Xc("debug")},td=(e,t,...n)=>{Xc("info")},nd=(e,t,...n)=>{Xc("warn")},rd=(e,t,...n)=>{Xc("error")};function id(e){return{debug:(t,...n)=>ed(e,t,...n),info:(t,...n)=>td(e,t,...n),warn:(t,...n)=>nd(e,t,...n),error:(t,...n)=>rd(e,t,...n)}}id("ErrorUtils");var od=[{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 sd(e){return e.includes("__THINKING__")}function ad(e){return sd(e)?e:`${e}\n\n__THINKING__`}function ld(e,t,n,r,i,o){if("agent"!==e.sender||e.isSystemMessage||e.isScreenAccessRequest)return!1;if(o&&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(i){const t=e.content.trim().length>0,n=e.parts&&e.parts.length>0;if(!t&&!n)return!1}return!0}function cd(e){const{messages:t,isTaskRunning:n,currentMode:r,preferPlaceholder:i,requireContent:o}=e;let s=-1;if(n&&("show"===r||"do"===r)){const e=!0;for(let i=t.length-1;i>=0;i--){const a=t[i],l=ld(a,n,r,0,o,e),c=a.isPlaceholder,d=!o||a.content.trim().length>0||a.parts&&a.parts.length>0;if(l&&c&&d){s=i;break}}if(s<0&&!o)for(let i=t.length-1;i>=0;i--){const a=t[i],l=ld(a,n,r,0,o,e),c=a.isPlaceholder;if(l&&c){s=i;break}}if(s<0)for(let i=t.length-1;i>=0;i--){const a=t[i],l=ld(a,n,r,0,o,e),c=a.isPlaceholder;if(l&&!c){s=i;break}}}if(s<0){for(let e=t.length-1;e>=0;e--){const n=t[e],r="agent"===n.sender,i=n.isPlaceholder,a=!n.isSystemMessage,l=!n.isScreenAccessRequest,c=!o||n.content.trim().length>0||n.parts&&n.parts.length>0;if(r&&i&&a&&l&&c){s=e;break}}if(s<0&&!o)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 dd(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 ud=new Set(["click_element","type_text","send_keys","select_dropdown_option","upload_file","scroll"]);function pd(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 hd(e,t,n,r=!1){const i=dd(e);if(!t||"show"!==n&&"do"!==n)return sd(i.content)?{...i,content:i.content.replace(/\n\n__THINKING__$/,"").replace(/__THINKING__/g,""),placeholderState:void 0}:i;const o=r?"waiting-for-user":"thinking";return sd(i.content)?i.placeholderState!==o?{...i,placeholderState:o}:i:{...i,content:ad(i.content),placeholderState:o}}var md=Object.fromEntries(od.map(e=>[e.id,e.displayAction]));var fd="marketrix_chat_context",gd={chat_id:null,messages:[],isTaskRunning:!1,activeTaskId:null,taskProgress:[],currentMode:"tell",isOpen:!1,isMinimized:!1,isLoading:!1,config:null,timestamp:Date.now()},yd=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={...gd},this.context;try{const e=localStorage.getItem(fd);if(e){const t=JSON.parse(e);return Date.now()-t.timestamp>6048e5?(this.context={...gd},this.saveContext(),this.context):(this.context=t,this.context)}}catch(e){}return this.context={...gd},this.context}saveContext(){if("undefined"!=typeof window&&this.context)try{this.context.timestamp=Date.now(),localStorage.setItem(fd,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={...gd},"undefined"!=typeof window&&localStorage.removeItem(fd)}hasValidContext(){const e=this.getContext();return null!==e.chat_id&&e.chat_id.length>0}}.getInstance(),wd=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(yd.hasValidContext())return;yd.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=yd.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});yd.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 bd(e,t,n="user-message"){const r=[],i=e.trim();return i&&r.push({type:"text",content:i}),{id:`${n}-${Date.now()}`,content:i,sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,parts:r}}function vd(e,t,n,r="agent-message"){const i=[],o=e.trim();return o&&i.push({type:"text",content:o}),{id:n||`${r}-${Date.now()}`,content:e,sender:"agent",timestamp:/* @__PURE__ */new Date,mode:t,parts:i}}function xd(e,t,n="agent",r="system-message"){const i=[];return e&&i.push({type:"text",content:e}),{id:`${r}-${Date.now()}`,content:e,sender:n,timestamp:/* @__PURE__ */new Date,mode:t,isSystemMessage:!0,parts:i}}function kd(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 _d(e,t="show"){return{id:`screenshare-${Date.now()}`,content:"",sender:"user",timestamp:/* @__PURE__ */new Date,mode:t,videoStream:e,parts:[]}}var Sd=id("ChatIdManager"),Cd=class e{static instance=null;chatId=null;initializationPromise=null;constructor(){"undefined"!=typeof window&&"undefined"!=typeof document&&(this.chatId=this.getStoredChatId(),this.chatId&&Sd.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 Sd.debug("Returning existing chat ID:",this.chatId),this.chatId;if(this.initializationPromise)return Sd.debug("Chat ID initialization in progress, waiting..."),this.initializationPromise;const e=this.getStoredChatId();if(e)return this.chatId=e,Sd.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{Sd.info("Creating new chat ID...");const e=await Vc.chatCreate(void 0);if(!e)throw new Error("API returned empty chat ID");return this.chatId=e,this.storeChatId(e),Sd.info("Created and stored new chat ID:",this.chatId),wd.createInitialContext(e),e}catch(e){throw Sd.error("Failed to create chat ID:",e),this.initializationPromise=null,e}}clearChatId(){this.chatId=null,this.initializationPromise=null,Sd.debug("Cleared chat ID")}static resetInstance(){e.instance=null}getStoredChatId(){return yd.getChatId()}storeChatId(e){yd.setChatId(e)}}.getInstance(),Id=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;connectionId=0;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");const n=++this.connectionId;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 i=await Vc.widgetStream(t,{signal:r});this.setStatus("connected"),this.reconnectAttempts=0,this.reconnectDelay=1e3,this.consumeEvents(i,n)}catch(i){r.aborted||(this.setStatus("error"),this.notifyError(/* @__PURE__ */new Error("Stream connection failed")),this.scheduleReconnect())}}async consumeEvents(e,t){let n=!1;try{for await(const r of e){if(this.connectionId!==t){n=!0;break}this.handleMessage(r)}}catch(r){this.connectionId!==t?n=!0:this.isIntentionallyDisconnected||this.setStatus("error")}finally{n||this.connectionId!==t||this.isIntentionallyDisconnected||(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){return this.chatId?Vc.widgetMessage({chat_id:this.chatId,command:e}).then(()=>{}).catch(e=>{throw this.notifyError(/* @__PURE__ */new Error(`Failed to send message: ${String(e)}`)),e}):Promise.reject(/* @__PURE__ */new Error("No active chat"))}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){this.isIntentionallyDisconnected||"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)}},Ed=class{config;constructor(e){this.config=e}getChatId(){return Cd.getChatId()}async getOrCreateChatId(){return Cd.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),Vc.activityLogCreate({type:"widget_question",metadata:r}).catch(e=>{})}catch(n){}}async sendMessage(e){if(!(await Cd.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 Id.getInstance().send(r),{messageId:n,response:"",mode:t,timestamp:/* @__PURE__ */new Date}}async checkAgentAvailability(){try{return null!==Cd.getChatId()}catch(e){return!1}}async getAgentInfo(){return{available:!0,status:"online"}}async stopTask(e){return Id.getInstance().send({type:"chat/stop",...e&&{task_id:e}}),{status:"stopping",message:"Stop command sent"}}updateConfig(e){this.config={...this.config,...e}}},Td=class e{static instance;config=null;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}loadConfig(){const e=yd.getConfig();return e?(this.config=e,e):(this.config={},this.config)}saveConfig(e){yd.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 Ad(e,t={}){return{...t,...e}}var Md=n(void 0),zd=({children:e,previewMode:t=!1,uiActions:n,currentMode:r})=>{const[i,s]=p({messages:[]}),a=u(r);a.current=r;const l=o(e=>{s(t=>(wd.addMessage(e),{messages:[...t.messages,e]}))},[]),c=o((e,t)=>{s(n=>(wd.updateMessage(e,t),{messages:n.messages.map(n=>n.id===e?{...n,...t}:n)}))},[]),h=o(e=>{s(t=>(wd.removeMessage(e),{messages:t.messages.filter(t=>t.id!==e)}))},[]),m=o(e=>{s(()=>(wd.setMessages(e),{messages:e}))},[]),g=o(()=>{wd.clearMessages(),s({messages:[]})},[]),y=o(async(e,r,i,o,c)=>{const d=r??a.current;if(t)return c||l(bd(e,d)),void l(vd("This is a preview. In production, I'll respond to your messages here."));let u=Td.getConfig();if(u||(u=Td.loadConfig()),!u||!u.mtxId&&!u.mtxKey&&!u.mtxAgent)return void l(vd("Configuration error: Missing API credentials. Please check your widget settings."));c||l(bd(e,d));const p=`temp-${globalThis.crypto.randomUUID()}`;l({id:p,content:ad(""),sender:"agent",timestamp:/* @__PURE__ */new Date,mode:d,isPlaceholder:!0,placeholderState:"thinking",parts:[]}),n.setLoading(!0);const h=new Ed(u);try{i&&h.updateConfig({mtxApp:i});const t=h.getChatId();if(t){const e=Id.getInstance();if(!e.isConnected()){const n=Td.getConfig();try{await e.connect(t,n?{mtxId:n.mtxId,mtxKey:n.mtxKey,mtxAgent:n.mtxAgent,mtxApp:n.mtxApp}:void 0)}catch(m){}}}await h.sendMessage({message:e,mode:d,question:o,requestId:p})}catch(f){s(e=>{const t="I'm sorry, I encountered an error processing your request. Please try again.",n=e.messages.map(e=>{if(e.id!==p)return e;const n=[...e.parts??[],{type:"text",content:t}];return{...e,isPlaceholder:!1,parts:n,content:t}});return wd.setMessages(n),{messages:n}})}finally{n.setLoading(!1)}},[t,l,n]),w=d(()=>({addMessage:l,updateMessage:c,removeMessage:h,setMessages:m,clearMessages:g,sendMessage:y}),[l,c,h,m,g,y]);/* @__PURE__ */
|
|
3
3
|
return f(Md.Provider,{value:{chatState:i,chatActions:w,_setMessages:s},children:e})};function Od(e,t){return"object"==typeof e&&null!==e&&t in e}function Rd(e){return null!==e&&e instanceof HTMLElement}function Pd(e){return null!==e&&e instanceof HTMLScriptElement}function Nd(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 i=(t,n)=>{if(r){e.tagName,e.id,e.className}};if(!0===e.disabled)return i("disabled","button is disabled"),!1;if("true"===e.getAttribute("aria-disabled"))return i("aria-disabled","aria-disabled is true"),!1;try{let t=e;for(;t;){if(t instanceof HTMLElement&&t.inert)return i("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 o=e.hasAttribute("onclick");if(r&&o)return!0;let s,a;try{s=window.getComputedStyle(e)}catch(t){return i("computed-style","failed to get computed style"),!1}if("none"===s.display)return i("display","display is none"),!1;if("none"===s.pointerEvents)return i("pointer-events","pointer-events is none"),!1;try{a=e.getBoundingClientRect()}catch(t){return i("bounding-rect","failed to get bounding rect"),!1}if(a.width<=0||a.height<=0)return i("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 o,s;try{o=window.getComputedStyle(n),s=n.getBoundingClientRect()}catch{t=n;continue}if("hidden"===o.overflow||"clip"===o.overflow){const e=a.right<s.left||a.left>s.right||a.bottom<s.top||a.top>s.bottom;if(r){if(e)return i("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 Ld=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,i=Array.from(t.children).filter(e=>e.tagName===r);if(i.length>1){e+=`:nth-of-type(${i.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"]'),i=t.classList.contains("cursor-pointer")||t.classList.contains("clickable"),o="onclick"in t&&"function"==typeof t.onclick;if(e||i||o||Nd(t)){this.elementMap.set(n,t),this.elementToSequence.set(t,n);const e=this.generateSelector(t);this.selectorMap.set(n,e);const i=this.generateFingerprint(t,e);this.fingerprintMap.set(n,i),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 i=t.willChange;if(i&&(i.includes("transform")||i.includes("opacity")))return!0;if("isolate"===t.isolation)return!0;const o=t.contain;return!(!o||!(o.includes("layout")||o.includes("style")||o.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 i=0;t.parentElement&&(i=Array.from(t.parentElement.children).indexOf(t)),n.push({element:t,zIndex:r,domOrder:i})}t=t.parentElement}let r=1e6;for(let i=n.length-1;i>=0;i--){const e=n[i];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 i=this.selectorMap.get(n);if(i)try{const t=(e.querySelector("body")||e).querySelector(i);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 i=r.left+r.width/2,o=r.top+r.height/2,s=document.elementFromPoint(i,o);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}}.getInstance(),Dd=null;async function $d(){if(Dd?.active){const e=Dd.getVideoTracks();if(e.length>0&&"live"===e[0].readyState)return Dd}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 Dd=e,e.getVideoTracks()[0].addEventListener("ended",()=>{Dd=null}),e}function jd(){return null!==function(){if(Dd?.active){const e=Dd.getVideoTracks();if(e.length>0&&"live"===e[0].readyState)return Dd}return Dd=null,null}()}var Fd=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:i}=e;return this.currentOptions?.element===t&&this.currentOptions.explanation===n&&this.currentOptions.toolName===i&&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,i=e.left+e.width/2,o=e.top+e.height/2,s=[{left:e.right+20,top:o-60},{left:e.left-t-20,top:o-60},{left:i-160,top:e.top-n-20},{left:i-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=Ld.getSequenceForElement(this.currentElement)??-1,t=Ld.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}}.getInstance(),Ud=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:i}=Ld.getElementByIndex(n);if(!t)return{success:!1,data:{text:""},error:i||`Element ${n} not found`};if(!(await Fd.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(i){return Fd.cleanup(),{success:!1,data:{text:""},error:i instanceof Error?i.message:String(i)}}}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}=Ld.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}=Ld.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(i){}const o=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,o),s=!0)}catch(i){a=i}if(!s)try{r.value=o,s=!0}catch(i){a=i}if(!s)try{r.focus(),t&&r.select(),document.execCommand("insertText",!1,e.text)&&(s=!0)}catch(i){a=i}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(i){a=i}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(i){}}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(i){return{success:!1,data:{text:""},error:`Failed to set value on element: ${i instanceof Error?i.message:String(i)}`}}else try{n.textContent=e.text,n.dispatchEvent(new Event("input",{bubbles:!0}))}catch(i){return{success:!1,data:{text:""},error:`Failed to set textContent: ${i instanceof Error?i.message:String(i)}`}}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}=Ld.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}=Ld.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}=Ld.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,i=e.selectionStart??t.length,o=e.selectionEnd??t.length;if(0===i&&0===o&&(i=t.length,o=t.length),i===o&&i>0)n=t.slice(0,i-1)+t.slice(o),r=i-1;else{if(i===o)return"Backspace: cursor at start, nothing to delete";n=t.slice(0,i)+t.slice(o),r=i}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 i;if(t===n&&t<r.length)i=r.slice(0,t)+r.slice(n+1);else{if(t===n)return"Delete: cursor at end, nothing to delete";i=r.slice(0,t)+r.slice(n)}const o=Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,"value")?.set;return o?o.call(e,i):e.value=i,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),e.setSelectionRange(t,t),`Delete: deleted character, value is now "${i}"`}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:Ld.getSnapshotHtml()}}}catch(e){return{success:!1,data:{text:""},error:String(e)}}}getInteractableElements(){try{return{success:!0,data:{elements:Ld.getInteractableElements()}}}catch(e){return{success:!1,data:{elements:[]},error:String(e)}}}async getScreenshot(){try{const e=await $d();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)}}}}.getInstance(),Bd=n(void 0),Wd=({children:e,previewMode:t=!1,currentMode:n,setMessages:r,uiActions:i,activeTaskIdRef:s})=>{const[l,c]=p({activeTaskId:null,isTaskRunning:!1,taskProgress:[]}),h=u(!1),m=u(0),g=u(/* @__PURE__ */new Set),y=u({}),w=u(n);w.current=n,a(()=>{s.current=l.activeTaskId},[l.activeTaskId,s]);const b=o(e=>{if(g.current.add(e),g.current.size>1e3){const e=Array.from(g.current);g.current=new Set(e.slice(-500))}},[]),v=o((e,t,n,i)=>{r(r=>{const o=function(e){return md[e]?md[e]:e.replace(/([A-Z])/g," $1").replace(/_/g," ").trim().split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}(e),s=cd({messages:r.messages,isTaskRunning:h.current,currentMode:w.current,preferPlaceholder:!0,requireContent:"failed"===n});if(!s)return r;let a=s.message;const l=["click_element","type_text","select_dropdown_option","send_keys","upload_file"].includes(e),c=h.current&&"show"===w.current&&l,d="done"===e;"in_progress"===n?(d||(a=function(e,t,n){const r=dd(e),i=r.parts||[],o=[...i],s=i.findIndex(e=>"progress"===e.type&&e.toolName===t&&"in_progress"===e.status),a=!ud.has(t),l="default",c=pd(n);return s>=0?o[s]={...o[s],content:c,hideIcon:a,textStyle:l}:o.push({type:"progress",content:c,status:"in_progress",toolName:t,hideIcon:a,textStyle:l}),{...r,parts:o}}(a,o,t||o)),!h.current||"show"!==w.current&&"do"!==w.current||(a=hd(a,h.current,w.current,c))):"completed"===n?(d||(a=function(e,t){const n=dd(e),r=n.parts||[],i=[...r];let o=-1;if(t)o=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&&"in_progress"===r[s].status){o=s;break}return o>=0&&(i[o]={...i[o],status:"completed"}),{...n,parts:i}}(a)),!h.current||"show"!==w.current&&"do"!==w.current||(a=hd(a,h.current,w.current,!1))):(a=function(e,t,n){const r=dd(e),i=r.parts||[],o=n.toLowerCase().includes("cancelled by cleanup"),s=[...i];let a=i.map(e=>"progress"===e.type?e.toolName:"").lastIndexOf(t);if(-1===a)for(let l=i.length-1;l>=0;l--)if("progress"===i[l].type&&"in_progress"===i[l].status){a=l;break}if(a>=0)if(o){const e=pd(s[a].content);s[a]={...s[a],status:"completed",content:e}}else{const e=pd(n),t=pd(s[a].content);s[a]={...s[a],status:"failed",content:e?`${t} (${e})`:t}}return{...r,parts:s}}(a,o,i||""),!h.current||"show"!==w.current&&"do"!==w.current||(a=hd(a,h.current,w.current,!1)));const u=[...r.messages];return u[s.index]=a,wd.setMessages(u),{messages:u}})},[]),x=o(()=>{const e=y.current;if(e.apiTaskId&&e.agentStarted){const t=e.apiTaskId;y.current={},c(e=>(wd.setTaskState(!0,t,[]),h.current=!0,{...e,isTaskRunning:!0,activeTaskId:t,taskProgress:[]}))}},[]);a(()=>{if(t)return;const e=Id.getInstance(),n={onStatusChange:e=>{i.setAgentAvailable("registered"===e)},onMessage:async t=>{if("tool/call"===t.type){const i=t.call_id;if(g.current.has(i))return;if(b(i),!od.map(e=>e.id).includes(t.tool))return void e.send({type:"tool/response",call_id:i,success:!1,error:`Unknown tool: ${t.tool}`,state_version:m.current}).catch(e=>{});h.current||(h.current=!0,c(e=>({...e,isTaskRunning:!0})));const o=t.tool,s=t.args,a=t.mode||w.current||"do",l=t.explanation||"",d=t.state_version;void 0!==d&&d>m.current&&(m.current=d),v(o,l,"in_progress");const u=await Ud.executeTool(o,s,a,l);if(u.success)try{m.current++,e.send({type:"tool/response",call_id:i,success:!0,data:"string"==typeof u.data?u.data:JSON.stringify(u.data),state_version:m.current}).catch(e=>{}),v(o,l,"completed"),"done"===o&&(y.current={},c(e=>(wd.setTaskState(!1,null,[]),h.current=!1,r(t=>{const n=cd({messages:t.messages,isTaskRunning:e.isTaskRunning,currentMode:w.current,preferPlaceholder:!0,requireContent:!1}),r=[...t.messages];if(n){const e=(n.message.parts??[]).filter(e=>!("progress"===e.type&&"done"===e.toolName));r[n.index]={...n.message,taskStatus:"done",parts:e},wd.setMessages(r)}return{messages:r}}),{...e,isTaskRunning:!1,activeTaskId:null,taskProgress:[]})))}catch(n){v(o,l,"failed","Connection error")}else v(o,l,"failed",u.error||"Tool execution failed"),m.current++,e.send({type:"tool/response",call_id:i,success:!1,data:"string"==typeof u.data?u.data:JSON.stringify(u.data),error:u.error??void 0,state_version:m.current}).catch(e=>{})}else if("task/status"===t.type){const e=t.status,n=t.message||"";"started"===e?(y.current={...y.current,agentStarted:!0,apiTaskId:y.current.apiTaskId||t.task_id||void 0},x()):"completed"!==e&&"failed"!==e&&"stopped"!==e||(g.current.clear(),y.current={},c(t=>(wd.setTaskState(!1,null,[]),r(r=>{const i=cd({messages:r.messages,isTaskRunning:t.isTaskRunning,currentMode:w.current,preferPlaceholder:!0,requireContent:!1}),o=[...r.messages];if(i){let t="done";"failed"===e?t="failed":"stopped"===e&&(t="stopped"),o[i.index]={...i.message,taskStatus:t,...n&&{content:n}},wd.setMessages(o)}return{messages:o}}),h.current=!1,{...t,isTaskRunning:!1,activeTaskId:null,taskProgress:[]})))}else"chat/response"===t.type?(r(e=>{const n=e.messages.map(e=>{if(e.id!==t.request_id)return e;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 wd.setMessages(n),t.task_id&&(y.current={...y.current,apiTaskId:t.task_id},x()),{messages:n}}),i.setLoading(!1)):"chat/error"===t.type&&(r(e=>{const n=e.messages.map(e=>{if(e.id!==t.request_id)return e;const n=`Error: ${t.error}`,r=[...e.parts??[],{type:"text",content:n}];return{...e,content:n,isPlaceholder:!1,placeholderState:void 0,parts:r}});return wd.setMessages(n),{messages:n}}),i.setLoading(!1))},onError:e=>{i.setError(e.message)}};return e.addCallbacks(n),()=>{e.removeCallbacks(n)}},[t,v,x,b,r,i]);const k=o(e=>{c(t=>(wd.setTaskState(e.isTaskRunning,e.activeTaskId,e.taskProgress??[]),{...t,...e}))},[]),_=o(async()=>{const e=s.current??void 0;c(e=>(r(n=>{const r=cd({messages:n.messages,isTaskRunning:e.isTaskRunning,currentMode:w.current,preferPlaceholder:!0,requireContent:!1}),i=[...n.messages];return r&&(i[r.index]={...r.message,taskStatus:"stopped"},t||wd.setMessages(i)),{messages:i}}),t||wd.setTaskState(!1,null,[]),h.current=!1,{...e,isTaskRunning:!1,activeTaskId:null,taskProgress:[]})),t||Id.getInstance().send({type:"chat/stop",...e&&{task_id:e}}).catch(e=>{})},[t,r,s]),S=d(()=>({setTaskState:k,stopTask:_}),[k,_]);/* @__PURE__ */
|
|
4
4
|
return f(Bd.Provider,{value:{taskState:l,taskActions:S},children:e})},Gd=n(void 0),Hd=({children:e,initialMode:t="tell",initialIsOpen:n=!1,initialIsMinimized:r=!1})=>{const[i,o]=p({isOpen:n,isMinimized:r,activeView:"home",currentMode:t,agentAvailable:!1,isLoading:!1}),s=d(()=>({setActiveView:e=>o(t=>({...t,activeView:e})),toggleWidget:()=>o(e=>{const t={...e,isOpen:!e.isOpen,isMinimized:!!e.isOpen};return wd.setWidgetState(t.isOpen,t.isMinimized),t}),closeWidget:()=>o(e=>{const t={...e,isOpen:!1,isMinimized:!0};return wd.setWidgetState(t.isOpen,t.isMinimized),t}),setMode:e=>o(t=>(wd.setMode(e),{...t,currentMode:e})),setLoading:e=>{wd.setIsLoading(e),o(t=>({...t,isLoading:e}))},setAgentAvailable:e=>o(t=>({...t,agentAvailable:e})),setError:e=>o(t=>({...t,error:e})),clearError:()=>o(e=>({...e,error:void 0})),applyState:e=>o(t=>({...t,...e}))}),[]);/* @__PURE__ */
|
|
5
5
|
return f(Gd.Provider,{value:{uiState:i,uiActions:s},children:e})},Zd=()=>{const e=s(Gd);if(!e)throw new Error("useUIStateContext must be used within UIStateProvider");return e},Vd=({children:e,previewMode:t})=>{const{uiState:n,uiActions:r}=Zd(),{_setMessages:i}=(()=>{const e=s(Md);if(!e)throw new Error("useChatContextInternal must be used within ChatProvider");return e})(),o=u(null);return a(()=>{if(t)return;(async()=>{const e=await Cd.getOrCreateChatId();wd.createInitialContext(e),wd.initialize(e);const t=wd.getIsTaskRunning(),n=wd.getActiveTaskId();if(r.applyState({isLoading:wd.getIsLoading(),currentMode:wd.getCurrentMode(),isOpen:wd.getIsOpen(),isMinimized:wd.getIsMinimized()}),i({messages:wd.getMessages()}),o.current=t?n:null,e){const t=Id.getInstance(),n=Td.getConfig();t.connect(e,n?{mtxId:n.mtxId,mtxKey:n.mtxKey,mtxAgent:n.mtxAgent,mtxApp:n.mtxApp}:void 0).catch(e=>{})}})()},[]),/* @__PURE__ */f(Wd,{previewMode:t,currentMode:n.currentMode,setMessages:i,uiActions:r,activeTaskIdRef:o,children:e})},qd=({children:e,previewMode:t})=>{const{uiState:n,uiActions:r}=Zd();/* @__PURE__ */
|
|
@@ -19,7 +19,7 @@ return f(Op,{position:"fixed",style:{zIndex:b,maxWidth:"420px",opacity:l?0:1,tra
|
|
|
19
19
|
return g(Op,{ref:_,className:`${O} ${C?"":z} ${S?"":"transition-transform duration-300 ease-in-out"}`,style:{zIndex:p,pointerEvents:e?"none":"auto",...R,...C},children:[/* @__PURE__ */g(Op,{className:`\n group relative w-14 h-14 overflow-visible transition-all duration-300 ease-in-out\n ${e?"scale-0 opacity-0 pointer-events-none":"scale-100 opacity-100 hover:scale-110"}\n `,children:[w&&/* @__PURE__ */f(Op,{className:v,"aria-hidden":!0}),b&&!S&&/* @__PURE__ */f(kh,{type:"button",variant:"secondary",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),o?.()},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 "+(h.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"}),
|
|
20
20
|
/* @__PURE__ */f(kh,{type:"button",variant:"bare",onClick:()=>{Date.now()<M.current||i()},onDragStart:e=>e.preventDefault(),onPointerDown:I,onPointerMove:E,onPointerUp:T,onPointerCancel:A,className:"relative z-10 w-14 h-14 min-w-14",style:{touchAction:"none",cursor:S?"grabbing":"grab",userSelect:"none",WebkitUserSelect:"none"},"aria-label":e?"Close":"Open","aria-live":"polite",children:/* @__PURE__ */f(_h,{className:"w-full h-full items-center justify-center relative",children:/* @__PURE__ */g(Op,{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:l,backgroundColor:e?a:s,boxShadow:bp.fab},children:[w&&/* @__PURE__ */f("svg",{className:x,viewBox:"0 0 54 54",fill:"none","aria-hidden":!0,children:/* @__PURE__ */f("rect",{x:"1.25",y:"1.25",width:"51.5",height:"51.5",rx:k+1,ry:k+1})}),
|
|
21
21
|
/* @__PURE__ */f(_h,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(30deg) scale(0)":"rotate(0deg) scale(1)",opacity:e?0:1,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":e,children:/* @__PURE__ */f(Np,{src:Rp,alt:"",className:"relative z-10 w-full h-full object-contain",draggable:!1,onDragStart:e=>e.preventDefault(),style:{borderRadius:l,border:"none",outline:"none",backgroundColor:"transparent",pointerEvents:"none",userSelect:"none"}})}),
|
|
22
|
-
/* @__PURE__ */f(_h,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */f(Ch,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(Op,{className:`absolute bottom-16 ${h.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:c,color:d},children:[/* @__PURE__ */f(Ph,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */f(Op,{"aria-hidden":!0,className:`absolute top-full ${h.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:c}})]})]})},Wh="3.3.
|
|
22
|
+
/* @__PURE__ */f(_h,{className:"absolute inset-0 items-center justify-center transition-[transform,opacity] duration-[160ms] linear",style:{transform:e?"rotate(0deg) scale(1)":"rotate(-30deg) scale(0)",opacity:e?1:0,transitionProperty:"transform, opacity",transitionDuration:"0.16s, 0.08s",transitionTimingFunction:"linear"},"aria-hidden":!e,children:/* @__PURE__ */f(Ch,{name:"chevronDown",size:24,className:"relative z-10 text-foreground pointer-events-none"})})]})})})]}),!e&&/* @__PURE__ */g(Op,{className:`absolute bottom-16 ${h.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:c,color:d},children:[/* @__PURE__ */f(Ph,{as:"span",className:"text-inherit",children:"Support Agent"}),/* @__PURE__ */f(Op,{"aria-hidden":!0,className:`absolute top-full ${h.includes("left")?"left-4":"right-4"} w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent`,style:{borderTopColor:c}})]})]})},Wh="3.3.81";function Gh(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 Hh(e){if(!e)return 360;const t=parseInt(e.replace(/px|rem|em/gi,""),10);return isNaN(t)?360:t}function Zh(e,t,n){return Math.min(Math.max(e,t),n)}function Vh(e,t,n,r,i){const o={"bottom-right":"nwse-resize","bottom-left":"nesw-resize","top-right":"nesw-resize","top-left":"nwse-resize"};switch(e){case"bottom-right":return{dx:r-t,dy:i-n,cursor:o[e]};case"bottom-left":return{dx:t-r,dy:i-n,cursor:o[e]};case"top-right":return{dx:r-t,dy:n-i,cursor:o[e]};case"top-left":return{dx:t-r,dy:n-i,cursor:o[e]}}}var qh={count:"inline-flex items-center rounded-full bg-muted px-1.5 py-0.5 text-[9px] font-medium text-muted-foreground",live:"inline-flex items-center gap-1",status:"inline-flex items-center text-[9px] font-medium px-1.5 py-0.5 rounded"},Yh={default:"bg-muted text-muted-foreground",muted:"bg-muted text-muted-foreground",primary:"bg-chart-1/15 text-chart-1",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning"},Jh=i(function({variant:e,color:t,tone:n="default",className:r,style:i,children:o,...s},a){/* @__PURE__ */
|
|
23
23
|
return g("span",{...s,ref:a,className:wp(qh[e],"status"===e&&Yh[n],r),"data-variant":e,style:{color:t,...i},children:["live"===e&&/* @__PURE__ */g("span",{className:"relative flex h-1.5 w-1.5",children:[/* @__PURE__ */f("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-current opacity-75"}),/* @__PURE__ */f("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-current"})]}),o]})}),Kh=i(function({background:e="card",border:t=!0,children:n,className:r,elevation:i="card",paddingPreset:o="card",radius:s="xl",style:a,...l},c){/* @__PURE__ */
|
|
24
24
|
return f(Op,{...l,ref:c,as:"div",background:e,border:t,className:r,elevation:i,paddingPreset:o,radius:s,style:a,children:n})});var Qh=n(null);function Xh(e){const t=s(Qh);if(!t)throw new Error(`${e} must be used within Dialog`);return t}function em({children:e,defaultOpen:t,onOpenChange:n,open:r}){const{isOpen:i,setIsOpen:s}=function({defaultOpen:e=!1,onOpenChange:t,open:n}){const[r,i]=p(e),s=void 0!==n;return{isOpen:s?n:r,setIsOpen:o(e=>{s||i(e),t?.(e)},[s,t])}}({defaultOpen:t,onOpenChange:n,open:r}),a=l(),c=l(),u=l(),h=d(()=>({contentId:a,descriptionId:u,open:i,setOpen:s,titleId:c}),[a,u,i,s,c]);/* @__PURE__ */
|
|
25
25
|
return f(Qh.Provider,{value:h,children:e})}function tm({children:e,className:t,onKeyDown:n,...r}){const i=Xh("DialogContent"),{variant:o="default",style:s,...l}=r;return a(()=>{if(!i.open)return;const e=e=>{"Escape"===e.key&&i.setOpen(!1)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[i]),i.open?/* @__PURE__ */f("div",{...l,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"aria-modal":"true",className:wp("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-h-[85vh] overflow-auto bg-card animate-dialog-content-in","default"===o&&"max-w-[500px] rounded-lg p-6","confirm"===o&&"max-w-sm rounded-lg p-4","info"===o&&"w-64 rounded-md border border-border p-0",t),"data-state":"open",id:i.contentId,onKeyDown:e=>{n?.(e),e.defaultPrevented||"Escape"!==e.key||i.setOpen(!1)},role:"dialog",style:{...Cp("info"===o?"section":"panel"),...s},tabIndex:-1,children:e}):null}function nm({className:e,variant:t="default",...n}){const r=Xh("DialogTitle");/* @__PURE__ */
|
|
@@ -62,7 +62,7 @@ return g(Mh,{ref:O,position:Y,rounded:"theme",border:!0,overflow:"hidden",style:
|
|
|
62
62
|
/* @__PURE__ */f(ym,{isOpen:F,onClose:()=>U(!1),diagnosticData:{chatId:Cd.getChatId(),streamEndpoint:(()=>{const t=Td.getConfig()?.mtxApiHost||e.mtxApiHost;return t?`${t.replace(/\/$/,"")}/widget/stream`:null})(),connectionStatus:(()=>{try{return Id.getInstance().getStatus()}catch{return"disconnected"}})(),applicationId:Td.getConfig()?.mtxApp,agentId:Td.getConfig()?.mtxAgent,version:Wh,build:"dev"}})]})},Jm=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}},Km=({config:e})=>{const[t,n]=p(!1),{state:r,actions:i,config:o,shouldShow:s,isPreviewMode:l,configValid:c}=Xd({config:e});var u;u=r.isOpen,a(()=>{if(!u)return;if(!window.matchMedia("(max-width: 767px)").matches)return;const e=document.documentElement,t=document.body,n=e.style.overflow,r=t.style.overflow;return e.style.overflow="hidden",t.style.overflow="hidden",()=>{e.style.overflow=n,t.style.overflow=r}},[u]);const[h,m]=p(e.widget_position??"bottom_right"),b=d(()=>`marketrix_widget_position_${e.mtxId??(null!=e.mtxApp?String(e.mtxApp):"default")}`,[e.mtxApp,e.mtxId]);a(()=>{m(o.widget_position??"bottom_right")},[o.widget_position]),a(()=>{if(l||"undefined"==typeof localStorage)return;const e=o.widget_position??"bottom_right",t=localStorage.getItem(b);"bottom_left"!==t&&"bottom_right"!==t&&"top_left"!==t&&"top_right"!==t?(localStorage.setItem(b,e),m(e)):m(t)},[l,b,o.widget_position]),a(()=>{if(r.isOpen||l||"default"!==o.widget_appearance)return void n(!1);const e=setTimeout(()=>n(!0),2e3);return()=>clearTimeout(e)},[r.isOpen,l,o.widget_appearance]);if(!c)return null;if(!(l?e.widget_enabled??o.widget_enabled:s&&o.widget_enabled&&!1!==e.show_widget))return null;const v=(S=function(e={}){return E({...I,widget_background_color:e.widget_background_color??I.widget_background_color,widget_text_color:e.widget_text_color??I.widget_text_color,widget_border_color:e.widget_border_color??I.widget_border_color,widget_accent_color:e.widget_accent_color??I.widget_accent_color,widget_secondary_color:e.widget_secondary_color??I.widget_secondary_color,widget_border_radius:e.widget_border_radius??I.widget_border_radius,widget_font_size:e.widget_font_size??I.widget_font_size,widget_width:e.widget_width??I.widget_width,widget_height:e.widget_height??I.widget_height,widget_shadow:e.widget_shadow??I.widget_shadow,widget_animation_duration:e.widget_animation_duration??I.widget_animation_duration,widget_fade_duration:e.widget_fade_duration??I.widget_fade_duration})}(o),{"--background":S.color.background,"--foreground":S.color.foreground,"--card":S.color.background,"--card-foreground":S.color.foreground,"--popover":S.color.background,"--popover-foreground":S.color.foreground,"--primary":S.color.primary,"--foreground-muted":S.color.foregroundMuted,"--foreground-faint":S.color.foregroundFaint,"--border-muted":S.color.borderMuted,"--primary-foreground":S.color.primaryForeground,"--primary-hover":S.color.primaryHover,"--primary-muted":S.color.primaryMuted,"--secondary":S.color.secondary,"--secondary-foreground":S.color.secondaryForeground,"--secondary-bg":S.color.secondaryBg,"--secondary-hover":S.color.secondaryHover,"--muted":S.color.border,"--muted-foreground":S.color.secondary,"--accent":S.color.background,"--accent-foreground":S.color.foreground,"--border":S.color.border,"--input":S.color.border,"--ring":S.color.primary,"--radius":S.radius,"--shadow":S.shadow,"--duration-animation":S.motion.durationAnimation,"--duration-fade":S.motion.durationFade,"--widget-width":S.size.widgetWidth,"--widget-height":S.size.widgetHeight});var S;const C=Math.max(o.widget_position_z_index??0,y),T={...o,widget_position:h,widget_position_z_index:C,show_widget:e.show_widget,use_screenshare:e.use_screenshare},A=r.isLoading||r.isTaskRunning;/* @__PURE__ */
|
|
63
63
|
return g(Op,{"data-marketrix-widget":!0,position:"relative",style:{...v,"--widget-z-index":C,...l&&{width:"100%",height:"100%"}},"data-widget-mode":o?.widget_feature_human?"hybrid":"ai",children:[A&&/* @__PURE__ */f(Op,{"data-screen-edge-glow":!0,position:"fixed",inset:"0",style:{boxShadow:`inset 0 0 22px 2px ${k(o.widget_accent_color,.72)}, inset 0 0 46px 10px ${k(o.widget_accent_color,.28)}`,pointerEvents:"none",zIndex:w}}),
|
|
64
64
|
/* @__PURE__ */f(Jm,{children:/* @__PURE__ */f(Ym,{config:T,isOpen:r.isOpen,isMinimized:r.isMinimized,messages:r.messages,currentMode:r.currentMode,isTaskRunning:r.isTaskRunning,taskProgress:r.taskProgress,activeView:r.activeView,onClose:i.closeWidget,onSendMessage:i.sendMessage,onSetMode:i.setMode,onAddMessage:i.addMessage,onUpdateMessage:i.updateMessage,onRemoveMessage:i.removeMessage,onStopTask:i.stopTask,onClearChat:i.clearChatHistory,setActiveView:i.setActiveView})}),
|
|
65
|
-
/* @__PURE__ */f(Bh,{open:r.isOpen,processing:r.isLoading,error:!!r.error,taskRunning:r.isTaskRunning,onClick:i.toggleWidget,onStop:i.stopTask,accentColor:T.widget_accent_color,backgroundColor:T.widget_background_color,borderRadius:T.widget_border_radius,tooltipBgColor:_(T.widget_accent_color,.3),tooltipTextColor:x(_(T.widget_accent_color,.3)),zIndex:T.widget_position_z_index??50,position:h,onDrag:e=>{m(e),l||"undefined"==typeof localStorage||localStorage.setItem(b,e)},isPreviewMode:l}),r.error&&/* @__PURE__ */f(Lh,{tone:"error",title:r.error,onDismiss:()=>i.clearError(),onRetry:()=>i.clearError(),position:h.includes("top")?"bottom-center":"above-fab"}),t&&!r.error&&o.widget_greeting&&/* @__PURE__ */f(Lh,{tone:"info",title:o.widget_greeting,body:o.widget_body,onDismiss:()=>n(!1),position:"bottom-center"})]})},Qm=Object.defineProperty,Xm=(e,t,n)=>((e,t,n)=>t in e?Qm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),ef=Object.defineProperty,tf=(e,t,n)=>((e,t,n)=>t in e?ef(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),nf=/* @__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))(nf||{}),rf={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},of={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},sf={};function af(e){if(sf[e])return sf[e];const t=globalThis[e],n=t.prototype,r=e in rf?rf[e]:void 0,i=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]"))})),o=e in of?of[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s&&!globalThis.Zone)return sf[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?sf[e]=o:n}catch{return n}}var lf={};function cf(e,t,n){var r;const i=`${e}.${String(n)}`;if(lf[i])return lf[i].call(t);const o=af(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(lf[i]=s,s.call(t)):t[n]}var df={};function uf(e,t,n){const r=`${e}.${String(n)}`;if(df[r])return df[r].bind(t);const i=af(e)[n];return"function"!=typeof i?t[n]:(df[r]=i,i.bind(t))}var pf={ownerDocument:function(e){return cf("Node",e,"ownerDocument")},childNodes:function(e){return cf("Node",e,"childNodes")},parentNode:function(e){return cf("Node",e,"parentNode")},parentElement:function(e){return cf("Node",e,"parentElement")},textContent:function(e){return cf("Node",e,"textContent")},contains:function(e,t){return uf("Node",e,"contains")(t)},getRootNode:function(e){return uf("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?cf("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?cf("Element",e,"shadowRoot"):null},querySelector:function(e,t){return cf("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return cf("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return af("MutationObserver").constructor},patch:function(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}};function hf(e){return e.nodeType===e.ELEMENT_NODE}function mf(e){const t=e&&"host"in e&&"mode"in e&&pf.host(e)||null;return Boolean(t&&"shadowRoot"in t&&pf.shadowRoot(t)===e)}function ff(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function gf(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=>yf(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 yf(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=gf(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?Tf(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?Tf(n,t):n}}var wf=class{constructor(){tf(this,"idNodeMap",/* @__PURE__ */new Map),tf(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 bf({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"";const a=r&&vf(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function vf(e){return e.toLowerCase()}var xf="__rrweb_original__";function kf(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?vf(t):null}function _f(e,t){let n;try{n=new URL(e,t??window.location.href)}catch(i){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}var Sf=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Cf=/^(?:[a-z+]+:)?\/\//i,If=/^www\..*/i,Ef=/^(data:)([^,]*),(.*)/i;function Tf(e,t){return(e||"").replace(Sf,(e,n,r,i,o,s)=>{const a=r||o||s,l=n||i||"";if(!a)return e;if(Cf.test(a)||If.test(a))return`url(${l}${a}${l})`;if(Ef.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 Af(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Mf(e,t){return function(e,t,n=!1){const r=Array.from(t.childNodes),i=[];let o=0;if(r.length>1&&e&&"string"==typeof e){let t=Af(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=Af(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 i.push(e),i;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=Af(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(o+=1,o>50*r.length)return i.push(e),i;const l=Af(e.substring(0,a),n);if(l.length===h){i.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 i.push(e),i}(e,t).join("/* rr_split */")}var zf,Of,Rf=1,Pf=/* @__PURE__ */new RegExp("[^a-z0-9-_:]");function Nf(){return Rf++}var Lf=/^[^ \t\n\r\u000c]+/,Df=/^[, \t\n\r\u000c]+/;var $f=/* @__PURE__ */new WeakMap;function jf(e,t){return t&&""!==t.trim()?Uf(e,t):t}function Ff(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Uf(e,t){let n=$f.get(e);if(n||(n=e.createElement("a"),$f.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function Bf(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)?jf(e,r):"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}const i=[];for(;r(Df),!(n>=t.length);){let o=r(Lf);if(","===o.slice(-1))o=jf(e,o.substring(0,o.length-1)),i.push(o);else{let r="";o=jf(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((o+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,i.push((o+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return i.join(", ")}(e,r):"style"===n?Tf(r,Uf(e)):"object"===t&&"data"===n?jf(e,r):r:r}function Wf(e,t,n){return["video","audio"].includes(e)&&"autoplay"===t}function Gf(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Gf(pf.parentNode(e),t,n);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!n&&Gf(pf.parentNode(e),t,n)}function Hf(e,t,n,r){let i;if(hf(e)){if(i=e,!pf.childNodes(i).length)return!1}else{if(null===pf.parentElement(e))return!1;i=pf.parentElement(e)}try{if("string"==typeof t){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Gf(i,t,r))return!0;if(n)if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}catch(o){}return!1}function Zf(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,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:nf.Document,childNodes:[],compatMode:e.compatMode}:{type:nf.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:nf.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:i,inlineStylesheet:o,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,i),f=function(e){if(e instanceof HTMLFormElement)return"form";const t=vf(e.tagName);return Pf.test(t)?"div":t}(e);let g={};const y=e.attributes.length;for(let v=0;v<y;v++){const t=e.attributes[v];Wf(f,t.name,t.value)||(g[t.name]=Bf(n,f,vf(t.name),t.value))}if("link"===f&&o){const t=Array.from(n.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=gf(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if("style"===f&&e.sheet){let t=gf(e.sheet);t&&(e.childNodes.length>1&&(t=Mf(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=bf({element:e,type:kf(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 i=t.getImageData,o=xf in i?i[xf]:i;if(new Uint32Array(o.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){zf||(zf=n.createElement("canvas"),Of=zf.getContext("2d"));const t=e,r=(t.currentSrc||t.getAttribute("src"),t.crossOrigin),i=()=>{t.removeEventListener("load",i);try{zf.width=t.naturalWidth,zf.height=t.naturalHeight,Of.drawImage(t,0,0),g.rr_dataURL=zf.toDataURL(l.type,l.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i))}"anonymous"===t.crossOrigin&&(r?g.crossOrigin=r:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i)}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:nf.Element,tagName:f,attributes:g,childNodes:[],isSVG:Ff(e)||void 0,needBlock:m,rootId:h,isCustom:w}}(e,{doc:n,blockClass:i,blockSelector:o,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:i,cssCaptured:o}=t,s=pf.parentNode(e),a=s&&s.tagName;let l="";const c="STYLE"===a||void 0,d="SCRIPT"===a||void 0;d?l="SCRIPT_PLACEHOLDER":o||(l=pf.textContent(e),c&&l&&(l=Tf(l,Uf(t.doc))));!c&&!d&&l&&n&&(l=r?r(l,pf.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:nf.Text,textContent:l||"",rootId:i}}(e,{doc:n,needsMask:s,maskTextFn:c,rootId:y,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:nf.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:nf.Comment,textContent:pf.textContent(e)||"",rootId:y};default:return!1}}function Vf(e){return null==e?"":e.toLowerCase()}function qf(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 Yf(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,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=Hf(e,s,a,void 0===C));const E=Zf(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,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===nf.Comment)return!0;if(e.type===nf.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"===_f(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Vf(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Vf(e.attributes.name)||"icon"===Vf(e.attributes.rel)||"apple-touch-icon"===Vf(e.attributes.rel)||"shortcut icon"===Vf(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Vf(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Vf(e.attributes.property).match(/^(og|twitter|fb):/)||Vf(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Vf(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===Vf(e.attributes.name)||"googlebot"===Vf(e.attributes.name)||"bingbot"===Vf(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===Vf(e.attributes.name)||"generator"===Vf(e.attributes.name)||"framework"===Vf(e.attributes.name)||"publisher"===Vf(e.attributes.name)||"progid"===Vf(e.attributes.name)||Vf(e.attributes.property).match(/^article:/)||Vf(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===Vf(e.attributes.name)||"yandex-verification"===Vf(e.attributes.name)||"csrf-token"===Vf(e.attributes.name)||"p:domain_verify"===Vf(e.attributes.name)||"verify-v1"===Vf(e.attributes.name)||"verification"===Vf(e.attributes.name)||"shopify-checkout-api-token"===Vf(e.attributes.name)))return!0}}return!1}(E,h)||!I&&E.type===nf.Text&&!E.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Nf();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===nf.Element){M=M&&!A.needBlock,delete A.needBlock;const t=pf.shadowRoot(e);t&&ff(t)&&(A.isShadowHost=!0)}if((A.type===nf.Document||A.type===nf.Element)&&M){h.headWhitespace&&A.type===nf.Element&&"head"===A.tagName&&(I=!1);const t={doc:n,mirror:r,blockClass:i,blockSelector:o,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===nf.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else{A.type===nf.Element&&void 0!==A.attributes._cssText&&"string"==typeof A.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(pf.childNodes(e))){const e=Yf(n,t);e&&A.childNodes.push(e)}}let _=null;if(hf(e)&&(_=pf.shadowRoot(e)))for(const e of Array.from(pf.childNodes(_))){const n=Yf(e,t);n&&(ff(_)&&(n.isShadow=!0),A.childNodes.push(n))}}const z=pf.parentNode(e);return z&&mf(z)&&ff(z)&&(A.isShadow=!0),A.type===nf.Element&&"iframe"===A.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let i,o=!1;try{i=r.document.readyState}catch(a){return}if("complete"!==i){const r=setTimeout(()=>{o||(t(),o=!0)},n);return void e.addEventListener("load",()=>{clearTimeout(r),o=!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=Yf(t,{doc:t,mirror:r,blockClass:i,blockSelector:o,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===nf.Element&&"link"===A.tagName&&"string"==typeof A.attributes.rel&&("stylesheet"===A.attributes.rel||"preload"===A.attributes.rel&&"string"==typeof A.attributes.href&&"css"===_f(A.attributes.href))&&function(e,t,n){let r,i=!1;try{r=e.sheet}catch(s){return}if(r)return;const o=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),i=!0,t()})}(e,()=>{if(v){const t=Yf(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,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 Jf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kf(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 Qf={exports:{}},Xf=String,eg=function(){return{isColorSupported:!1,reset:Xf,bold:Xf,dim:Xf,italic:Xf,underline:Xf,inverse:Xf,hidden:Xf,strikethrough:Xf,black:Xf,red:Xf,green:Xf,yellow:Xf,blue:Xf,magenta:Xf,cyan:Xf,white:Xf,gray:Xf,bgBlack:Xf,bgRed:Xf,bgGreen:Xf,bgYellow:Xf,bgBlue:Xf,bgMagenta:Xf,bgCyan:Xf,bgWhite:Xf}};Qf.exports=eg(),Qf.exports.createColors=eg;var tg=Qf.exports,ng=/* @__PURE__ */Kf(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),rg=tg,ig=ng,og=class e extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),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=rg.isColorSupported),ig&&e&&(t=ig(t));let n,r,i=t.split(/\r?\n/),o=Math.max(this.line-3,0),s=Math.min(this.line+2,i.length),a=String(s).length;if(e){let{bold:e,gray:t,red:i}=rg.createColors(!0);n=t=>e(i(t)),r=e=>t(e)}else n=r=e=>e;return i.slice(o,s).map((e,t)=>{let i=o+1+t,s=" "+(" "+i).slice(-a)+" | ";if(i===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}},sg=og;og.default=og;var ag={};ag.isClean=Symbol("isClean"),ag.my=Symbol("my");var lg={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var cg=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 i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,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,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;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 i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,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 i=e.parent;if("before"===n){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return lg[n];let o=e.root();if(o.rawCache||(o.rawCache={}),void 0!==o.rawCache[n])return o.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let i="raw"+((s=n)[0].toUpperCase()+s.slice(1));this[i]?r=this[i](o,e):o.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var s;return void 0===r&&(r=lg[n]),o.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)}},dg=cg;cg.default=cg;var ug=dg;function pg(e,t){new ug(t).stringify(e)}var hg=pg;pg.default=pg;var{isClean:mg,my:fg}=ag,gg=sg,yg=dg,wg=hg;function bg(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 i=e[r],o=typeof i;"parent"===r&&"object"===o?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>bg(e,n)):("object"===o&&null!==i&&(i=bg(i)),n[r]=i)}return n}var vg=class{constructor(e={}){this.raws={},this[mg]=!1,this[fg]=!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=bg(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 gg(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[mg]){this[mg]=!1;let e=this;for(;e=e.parent;)e[mg]=!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,i=this.source.start.line;for(let o=0;o<e;o++)"\n"===n[o]?(r=1,i+=1):r+=1;return{column:r,line:i}}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(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+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 yg).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 i=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o))continue;if("parent"===o||"proxyCache"===o)continue;let e=this[o];if(Array.isArray(e))n[o]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)n[o]=e.toJSON(null,t);else if("source"===o){let r=t.get(e.input);null==r&&(r=i,t.set(e.input,i),i++),n[o]={end:e.end,inputId:r,start:e.start}}else n[o]=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=wg){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let i in n)r[i]=n[i];return e.warn(t,r)}get proxyOf(){return this}},xg=vg;vg.default=vg;var kg=xg,_g=class extends kg{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]}},Sg=_g;_g.default=_g;var Cg={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="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},{SourceMapConsumer:Ig,SourceMapGenerator:Eg}=ng,{existsSync:Tg,readFileSync:Ag}=ng,{dirname:Mg,join:zg}=ng;var Og=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=Mg(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new Ig(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=Mg(e),Tg(e))return this.mapFile=e,Ag(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 Ig)return Eg.fromSourceMap(t).toString();if(t instanceof Eg)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=zg(Mg(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)}},Rg=Og;Og.default=Og;var{SourceMapConsumer:Pg,SourceMapGenerator:Ng}=ng,{fileURLToPath:Lg,pathToFileURL:Dg}=ng,{isAbsolute:$g,resolve:jg}=ng,{nanoid:Fg}=Cg,Ug=ng,Bg=sg,Wg=Rg,Gg=Symbol("fromOffsetCache"),Hg=Boolean(Pg&&Ng),Zg=Boolean(jg&&$g),Vg=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&&(!Zg||/^\w+:\/\//.test(t.from)||$g(t.from)?this.file=t.from:this.file=jg(t.from)),Zg&&Hg){let e=new Wg(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 "+Fg(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,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);o=e.line,s=e.col}else o=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,o,s);return i=a?new Bg(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 Bg(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:s,line:o},this.css,this.file,r.plugin),i.input={column:n,endColumn:s,endLine:o,line:t,source:this.css},this.file&&(Dg&&(i.input.url=Dg(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[Gg])n=this[Gg];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[Gg]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=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:jg(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let i,o,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof n&&(i=s.originalPositionFor({column:r,line:n})),o=$g(a.source)?Dg(a.source):new URL(a.source,this.map.consumer().sourceRoot||Dg(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:o.toString()};if("file:"===o.protocol){if(!Lg)throw new Error("file: protocol is not available in this PostCSS build");l.file=Lg(o)}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}},qg=Vg;Vg.default=Vg,Ug&&Ug.registerInput&&Ug.registerInput(Vg);var{SourceMapConsumer:Yg,SourceMapGenerator:Jg}=ng,{dirname:Kg,relative:Qg,resolve:Xg,sep:ey}=ng,{pathToFileURL:ty}=ng,ny=qg,ry=Boolean(Yg&&Jg),iy=Boolean(Kg&&Xg&&Qg&&ey),oy=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||Kg(e.file);!1===this.mapOpts.sourcesContent?(t=new Yg(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(),iy&&ry&&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=Jg.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Jg({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 Jg({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",o={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&&(o.generated.line=n,o.generated.column=r-1,a.source&&a.source.start?(o.source=this.sourcePath(a),o.original.line=a.source.start.line,o.original.column=a.source.start.column-1,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,this.map.addMapping(o))),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?(o.source=this.sourcePath(a),o.original.line=a.source.end.line,o.original.column=a.source.end.column-1,o.generated.line=n,o.generated.column=r-2,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,o.generated.line=n,o.generated.column=r-1,this.map.addMapping(o)))}})}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?Kg(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=Kg(Xg(n,this.mapOpts.annotation)));let r=Qg(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 ny(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(ty){let t=ty(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;"\\"===ey&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},sy=xg,ay=class extends sy{constructor(e){super(e),this.type="comment"}},ly=ay;ay.default=ay;var cy,dy,uy,py,{isClean:hy,my:my}=ag,fy=Sg,gy=ly,yy=xg;function wy(e){return e.map(e=>(e.nodes&&(e.nodes=wy(e.nodes)),delete e.source,e))}function by(e){if(e[hy]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)by(t)}var vy=class e extends yy{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),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let s of o)this.proxyOf.nodes.splice(r,0,s);for(let s in this.indexes)n=this.indexes[s],r<=n&&(this.indexes[s]=n+o.length);return this.markDirty(),this}normalize(t,n){if("string"==typeof t)t=wy(cy(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 fy(t)]}else if(t.selector)t=[new dy(t)];else if(t.name)t=[new uy(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new gy(t)]}return t.map(t=>(t[my]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[hy]&&by(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(i){throw t.addToError(i)}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]}};vy.registerParse=e=>{cy=e},vy.registerRule=e=>{dy=e},vy.registerAtRule=e=>{uy=e},vy.registerRoot=e=>{py=e};var xy=vy;vy.default=vy,vy.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,uy.prototype):"rule"===e.type?Object.setPrototypeOf(e,dy.prototype):"decl"===e.type?Object.setPrototypeOf(e,fy.prototype):"comment"===e.type?Object.setPrototypeOf(e,gy.prototype):"root"===e.type&&Object.setPrototypeOf(e,py.prototype),e[my]=!0,e.nodes&&e.nodes.forEach(e=>{vy.rebuild(e)})};var ky,_y,Sy=xy,Cy=class extends Sy{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new ky(new _y,this,e).stringify()}};Cy.registerLazyResult=e=>{ky=e},Cy.registerProcessor=e=>{_y=e};var Iy=Cy;Cy.default=Cy;var Ey=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}},Ty=Ey;Ey.default=Ey;var Ay=Ty,My=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 Ay(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},zy=My;My.default=My;var Oy="'".charCodeAt(0),Ry='"'.charCodeAt(0),Py="\\".charCodeAt(0),Ny="/".charCodeAt(0),Ly="\n".charCodeAt(0),Dy=" ".charCodeAt(0),$y="\f".charCodeAt(0),jy="\t".charCodeAt(0),Fy="\r".charCodeAt(0),Uy="[".charCodeAt(0),By="]".charCodeAt(0),Wy="(".charCodeAt(0),Gy=")".charCodeAt(0),Hy="{".charCodeAt(0),Zy="}".charCodeAt(0),Vy=";".charCodeAt(0),qy="*".charCodeAt(0),Yy=":".charCodeAt(0),Jy="@".charCodeAt(0),Ky=/[\t\n\f\r "#'()/;[\\\]{}]/g,Qy=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Xy=/.[\r\n"'(/\\]/,ew=/[\da-f]/i,tw=xy,nw=class extends tw{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)}},rw=nw;nw.default=nw,tw.registerAtRule(nw);var iw,ow,sw=xy,aw=class extends sw{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 i of r)i.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 iw(new ow,this,e).stringify()}};aw.registerLazyResult=e=>{iw=e},aw.registerProcessor=e=>{ow=e};var lw=aw;aw.default=aw,sw.registerRoot(aw);var cw={comma:e=>cw.split(e,[","],!0),space:e=>cw.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!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)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=d;return(n||""!==i)&&r.push(i.trim()),r}},dw=cw;cw.default=cw;var uw=xy,pw=dw,hw=class extends uw{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return pw.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)}},mw=hw;hw.default=hw,uw.registerRule(hw);var fw=Sg,gw=function(e,t={}){let n,r,i,o,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 Ly:case Dy:case jy:case Fy:case $y:r=f;do{r+=1,n=p.charCodeAt(r)}while(n===Dy||n===Ly||n===jy||n===Fy||n===$y);u=["space",p.slice(f,r)],f=r-1;break;case Uy:case By:case Hy:case Zy:case Yy:case Vy:case Gy:{let e=String.fromCharCode(n);u=[e,e,f];break}case Wy:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==Oy&&d!==Ry&&d!==Dy&&d!==Ly&&d!==jy&&d!==$y&&d!==Fy){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)===Py;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,r+1),f,r],f=r}else r=p.indexOf(")",f+1),o=p.slice(f,r+1),-1===r||Xy.test(o)?u=["(","(",f]:(u=["brackets",o,f,r],f=r);break;case Oy:case Ry:i=n===Oy?"'":'"',r=f;do{if(a=!1,r=p.indexOf(i,r+1),-1===r){if(h||t){r=f+1;break}w("string")}for(l=r;p.charCodeAt(l-1)===Py;)l-=1,a=!a}while(a);u=["string",p.slice(f,r+1),f,r],f=r;break;case Jy:Ky.lastIndex=f+1,Ky.test(p),r=0===Ky.lastIndex?p.length-1:Ky.lastIndex-2,u=["at-word",p.slice(f,r+1),f,r],f=r;break;case Py:for(r=f,s=!0;p.charCodeAt(r+1)===Py;)r+=1,s=!s;if(n=p.charCodeAt(r+1),s&&n!==Ny&&n!==Dy&&n!==Ly&&n!==jy&&n!==Fy&&n!==$y&&(r+=1,ew.test(p.charAt(r)))){for(;ew.test(p.charAt(r+1));)r+=1;p.charCodeAt(r+1)===Dy&&(r+=1)}u=["word",p.slice(f,r+1),f,r],f=r;break;default:n===Ny&&p.charCodeAt(f+1)===qy?(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):(Qy.lastIndex=f+1,Qy.test(p),r=0===Qy.lastIndex?p.length-1:Qy.lastIndex-2,u=["word",p.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},yw=ly,ww=rw,bw=lw,vw=mw,xw={empty:!0,space:!0};var kw=xy,_w=class{constructor(e){this.input=e,this.root=new bw,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,i=new ww;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let o=!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){i.source.end=this.getPosition(e[2]),i.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&&(i.source.end=this.getPosition(n[3]||n[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),o&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),s&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new yw;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=gw(this.input)}decl(e,t){let n=new fw;this.init(n,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(i[3]||i[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 o,s=[];for(;e.length&&(o=e[0][0],"space"===o||"comment"===o);)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 vw;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,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.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===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),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 i,o,s,a,l=n.length,c="",d=!0;for(let u=0;u<l;u+=1)i=n[u],o=i[0],"space"!==o||u!==l-1||r?"comment"===o?(a=n[u-1]?n[u-1][0]:"empty",s=n[u+1]?n[u+1][0]:"empty",xw[a]||xw[s]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[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 vw;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})}},Sw=qg;function Cw(e,t){let n=new _w(new Sw(e,t));try{n.parse()}catch(r){throw r}return n.root}var Iw=Cw;Cw.default=Cw,kw.registerParse(Cw);var{isClean:Ew,my:Tw}=ag,Aw=oy,Mw=hg,zw=xy,Ow=Iy,Rw=zy,Pw=Iw,Nw=lw,Lw={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Dw={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},$w={Once:!0,postcssPlugin:!0,prepare:!0};function jw(e){return"object"==typeof e&&"function"==typeof e.then}function Fw(e){let t=!1,n=Lw[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 Uw(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Fw(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Bw(e){return e[Ew]=!1,e.nodes&&e.nodes.forEach(e=>Bw(e)),e}var Ww={},Gw=class e{constructor(t,n,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof e||n instanceof Rw)i=Bw(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=Pw;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(n,r)}catch(o){this.processed=!0,this.error=o}i&&!i[Tw]&&zw.rebuild(i)}else i=Bw(n);this.result=new Rw(t,i,r),this.helpers={...Ww,postcss:Ww,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(!Dw[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!$w[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(jw(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ew];){e[Ew]=!0;let n=[Uw(e)];for(;n.length>0;){let e=this.visitTick(n);if(jw(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 jw(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=Mw;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new Aw(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(jw(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ew];)e[Ew]=!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,i]of e){let e;this.result.lastPlugin=r;try{e=i(t,this.helpers)}catch(n){throw this.handleError(n,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(jw(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,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(o){throw this.handleError(o,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[Ew])return r[Ew]=!0,void e.push(Uw(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[Ew]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Ew]=!0;let t=Fw(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[Ew]||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"}};Gw.registerPostcss=e=>{Ww=e};var Hw=Gw;Gw.default=Gw,Nw.registerLazyResult(Gw),Ow.registerLazyResult(Gw);var Zw=oy,Vw=hg,qw=Iw,Yw=zy,Jw=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 i=Vw;this.result=new Yw(this._processor,r,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get:()=>o.root});let s=new Zw(i,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=qw;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"}},Kw=Jw;Jw.default=Jw;var Qw=Kw,Xw=Hw,eb=Iy,tb=lw,nb=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 Xw(this,e,t):new Qw(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},rb=nb;nb.default=nb,tb.registerProcessor(nb),eb.registerProcessor(nb);var ib=Sg,ob=Rg,sb=ly,ab=rw,lb=qg,cb=lw,db=mw;function ub(e,t){if(Array.isArray(e))return e.map(e=>ub(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:lb.prototype};n.map&&(n.map={...n.map,__proto__:ob.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>ub(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 cb(r);if("decl"===r.type)return new ib(r);if("rule"===r.type)return new db(r);if("comment"===r.type)return new sb(r);if("atrule"===r.type)return new ab(r);throw new Error("Unknown node type: "+e.type)}var pb=ub;ub.default=ub;var hb=sg,mb=Sg,fb=Hw,gb=xy,yb=rb,wb=hg,bb=pb,vb=Iy,xb=Ty,kb=ly,_b=rw,Sb=zy,Cb=qg,Ib=Iw,Eb=dw,Tb=mw,Ab=lw,Mb=xg;function zb(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new yb(e)}zb.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!0,{}.LANG&&{}.LANG.startsWith("cn"));let i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new yb).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return zb([i(n)]).process(e,t)},i},zb.stringify=wb,zb.parse=Ib,zb.fromJSON=bb,zb.list=Eb,zb.comment=e=>new kb(e),zb.atRule=e=>new _b(e),zb.decl=e=>new mb(e),zb.rule=e=>new Tb(e),zb.root=e=>new Ab(e),zb.document=e=>new vb(e),zb.CssSyntaxError=hb,zb.Declaration=mb,zb.Container=gb,zb.Processor=yb,zb.Document=vb,zb.Comment=kb,zb.Warning=xb,zb.AtRule=_b,zb.Result=Sb,zb.Input=Cb,zb.Rule=Tb,zb.Root=Ab,zb.Node=Mb,fb.registerPostcss(zb);var Ob=zb;zb.default=zb;var Rb=/* @__PURE__ */Jf(Ob);Rb.stringify,Rb.fromJSON,Rb.plugin,Rb.parse,Rb.list,Rb.document,Rb.comment,Rb.atRule,Rb.rule,Rb.decl,Rb.root,Rb.CssSyntaxError,Rb.Declaration,Rb.Container,Rb.Processor,Rb.Document,Rb.Comment,Rb.Warning,Rb.AtRule,Rb.Result,Rb.Input,Rb.Rule,Rb.Root,Rb.Node;var Pb=Object.defineProperty,Nb=(e,t,n)=>((e,t,n)=>t in e?Pb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function Lb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Db(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 $b={exports:{}},jb=String,Fb=function(){return{isColorSupported:!1,reset:jb,bold:jb,dim:jb,italic:jb,underline:jb,inverse:jb,hidden:jb,strikethrough:jb,black:jb,red:jb,green:jb,yellow:jb,blue:jb,magenta:jb,cyan:jb,white:jb,gray:jb,bgBlack:jb,bgRed:jb,bgGreen:jb,bgYellow:jb,bgBlue:jb,bgMagenta:jb,bgCyan:jb,bgWhite:jb}};$b.exports=Fb(),$b.exports.createColors=Fb;var Ub=$b.exports,Bb=/* @__PURE__ */Db(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),Wb=Ub,Gb=Bb,Hb=class e extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),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=Wb.isColorSupported),Gb&&e&&(t=Gb(t));let n,r,i=t.split(/\r?\n/),o=Math.max(this.line-3,0),s=Math.min(this.line+2,i.length),a=String(s).length;if(e){let{bold:e,gray:t,red:i}=Wb.createColors(!0);n=t=>e(i(t)),r=e=>t(e)}else n=r=e=>e;return i.slice(o,s).map((e,t)=>{let i=o+1+t,s=" "+(" "+i).slice(-a)+" | ";if(i===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}},Zb=Hb;Hb.default=Hb;var Vb={};Vb.isClean=Symbol("isClean"),Vb.my=Symbol("my");var qb={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var Yb=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 i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,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,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;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 i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,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 i=e.parent;if("before"===n){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return qb[n];let o=e.root();if(o.rawCache||(o.rawCache={}),void 0!==o.rawCache[n])return o.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let i="raw"+((s=n)[0].toUpperCase()+s.slice(1));this[i]?r=this[i](o,e):o.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var s;return void 0===r&&(r=qb[n]),o.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)}},Jb=Yb;Yb.default=Yb;var Kb=Jb;function Qb(e,t){new Kb(t).stringify(e)}var Xb=Qb;Qb.default=Qb;var{isClean:ev,my:tv}=Vb,nv=Zb,rv=Jb,iv=Xb;function ov(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 i=e[r],o=typeof i;"parent"===r&&"object"===o?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>ov(e,n)):("object"===o&&null!==i&&(i=ov(i)),n[r]=i)}return n}var sv=class{constructor(e={}){this.raws={},this[ev]=!1,this[tv]=!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=ov(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 nv(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[ev]){this[ev]=!1;let e=this;for(;e=e.parent;)e[ev]=!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,i=this.source.start.line;for(let o=0;o<e;o++)"\n"===n[o]?(r=1,i+=1):r+=1;return{column:r,line:i}}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(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+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 rv).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 i=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o))continue;if("parent"===o||"proxyCache"===o)continue;let e=this[o];if(Array.isArray(e))n[o]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)n[o]=e.toJSON(null,t);else if("source"===o){let r=t.get(e.input);null==r&&(r=i,t.set(e.input,i),i++),n[o]={end:e.end,inputId:r,start:e.start}}else n[o]=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=iv){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let i in n)r[i]=n[i];return e.warn(t,r)}get proxyOf(){return this}},av=sv;sv.default=sv;var lv=av,cv=class extends lv{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]}},dv=cv;cv.default=cv;var uv={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="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},{SourceMapConsumer:pv,SourceMapGenerator:hv}=Bb,{existsSync:mv,readFileSync:fv}=Bb,{dirname:gv,join:yv}=Bb;var wv=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=gv(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new pv(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=gv(e),mv(e))return this.mapFile=e,fv(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 pv)return hv.fromSourceMap(t).toString();if(t instanceof hv)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=yv(gv(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)}},bv=wv;wv.default=wv;var{SourceMapConsumer:vv,SourceMapGenerator:xv}=Bb,{fileURLToPath:kv,pathToFileURL:_v}=Bb,{isAbsolute:Sv,resolve:Cv}=Bb,{nanoid:Iv}=uv,Ev=Bb,Tv=Zb,Av=bv,Mv=Symbol("fromOffsetCache"),zv=Boolean(vv&&xv),Ov=Boolean(Cv&&Sv),Rv=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&&(!Ov||/^\w+:\/\//.test(t.from)||Sv(t.from)?this.file=t.from:this.file=Cv(t.from)),Ov&&zv){let e=new Av(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 "+Iv(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,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);o=e.line,s=e.col}else o=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,o,s);return i=a?new Tv(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 Tv(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:s,line:o},this.css,this.file,r.plugin),i.input={column:n,endColumn:s,endLine:o,line:t,source:this.css},this.file&&(_v&&(i.input.url=_v(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[Mv])n=this[Mv];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[Mv]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=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:Cv(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let i,o,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof n&&(i=s.originalPositionFor({column:r,line:n})),o=Sv(a.source)?_v(a.source):new URL(a.source,this.map.consumer().sourceRoot||_v(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:o.toString()};if("file:"===o.protocol){if(!kv)throw new Error("file: protocol is not available in this PostCSS build");l.file=kv(o)}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}},Pv=Rv;Rv.default=Rv,Ev&&Ev.registerInput&&Ev.registerInput(Rv);var{SourceMapConsumer:Nv,SourceMapGenerator:Lv}=Bb,{dirname:Dv,relative:$v,resolve:jv,sep:Fv}=Bb,{pathToFileURL:Uv}=Bb,Bv=Pv,Wv=Boolean(Nv&&Lv),Gv=Boolean(Dv&&jv&&$v&&Fv),Hv=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||Dv(e.file);!1===this.mapOpts.sourcesContent?(t=new Nv(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(),Gv&&Wv&&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=Lv.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Lv({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 Lv({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",o={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&&(o.generated.line=n,o.generated.column=r-1,a.source&&a.source.start?(o.source=this.sourcePath(a),o.original.line=a.source.start.line,o.original.column=a.source.start.column-1,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,this.map.addMapping(o))),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?(o.source=this.sourcePath(a),o.original.line=a.source.end.line,o.original.column=a.source.end.column-1,o.generated.line=n,o.generated.column=r-2,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,o.generated.line=n,o.generated.column=r-1,this.map.addMapping(o)))}})}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?Dv(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=Dv(jv(n,this.mapOpts.annotation)));let r=$v(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 Bv(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(Uv){let t=Uv(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;"\\"===Fv&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Zv=av,Vv=class extends Zv{constructor(e){super(e),this.type="comment"}},qv=Vv;Vv.default=Vv;var Yv,Jv,Kv,Qv,{isClean:Xv,my:ex}=Vb,tx=dv,nx=qv,rx=av;function ix(e){return e.map(e=>(e.nodes&&(e.nodes=ix(e.nodes)),delete e.source,e))}function ox(e){if(e[Xv]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)ox(t)}var sx=class e extends rx{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),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let s of o)this.proxyOf.nodes.splice(r,0,s);for(let s in this.indexes)n=this.indexes[s],r<=n&&(this.indexes[s]=n+o.length);return this.markDirty(),this}normalize(t,n){if("string"==typeof t)t=ix(Yv(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 tx(t)]}else if(t.selector)t=[new Jv(t)];else if(t.name)t=[new Kv(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new nx(t)]}return t.map(t=>(t[ex]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[Xv]&&ox(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(i){throw t.addToError(i)}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]}};sx.registerParse=e=>{Yv=e},sx.registerRule=e=>{Jv=e},sx.registerAtRule=e=>{Kv=e},sx.registerRoot=e=>{Qv=e};var ax=sx;sx.default=sx,sx.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,Kv.prototype):"rule"===e.type?Object.setPrototypeOf(e,Jv.prototype):"decl"===e.type?Object.setPrototypeOf(e,tx.prototype):"comment"===e.type?Object.setPrototypeOf(e,nx.prototype):"root"===e.type&&Object.setPrototypeOf(e,Qv.prototype),e[ex]=!0,e.nodes&&e.nodes.forEach(e=>{sx.rebuild(e)})};var lx,cx,dx=ax,ux=class extends dx{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new lx(new cx,this,e).stringify()}};ux.registerLazyResult=e=>{lx=e},ux.registerProcessor=e=>{cx=e};var px=ux;ux.default=ux;var hx=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}},mx=hx;hx.default=hx;var fx=mx,gx=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 fx(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},yx=gx;gx.default=gx;var wx="'".charCodeAt(0),bx='"'.charCodeAt(0),vx="\\".charCodeAt(0),xx="/".charCodeAt(0),kx="\n".charCodeAt(0),_x=" ".charCodeAt(0),Sx="\f".charCodeAt(0),Cx="\t".charCodeAt(0),Ix="\r".charCodeAt(0),Ex="[".charCodeAt(0),Tx="]".charCodeAt(0),Ax="(".charCodeAt(0),Mx=")".charCodeAt(0),zx="{".charCodeAt(0),Ox="}".charCodeAt(0),Rx=";".charCodeAt(0),Px="*".charCodeAt(0),Nx=":".charCodeAt(0),Lx="@".charCodeAt(0),Dx=/[\t\n\f\r "#'()/;[\\\]{}]/g,$x=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,jx=/.[\r\n"'(/\\]/,Fx=/[\da-f]/i,Ux=ax,Bx=class extends Ux{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)}},Wx=Bx;Bx.default=Bx,Ux.registerAtRule(Bx);var Gx,Hx,Zx=ax,Vx=class extends Zx{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 i of r)i.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 Gx(new Hx,this,e).stringify()}};Vx.registerLazyResult=e=>{Gx=e},Vx.registerProcessor=e=>{Hx=e};var qx=Vx;Vx.default=Vx,Zx.registerRoot(Vx);var Yx={comma:e=>Yx.split(e,[","],!0),space:e=>Yx.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!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)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=d;return(n||""!==i)&&r.push(i.trim()),r}},Jx=Yx;Yx.default=Yx;var Kx=ax,Qx=Jx,Xx=class extends Kx{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Qx.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)}},ek=Xx;Xx.default=Xx,Kx.registerRule(Xx);var tk=dv,nk=function(e,t={}){let n,r,i,o,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 kx:case _x:case Cx:case Ix:case Sx:r=f;do{r+=1,n=p.charCodeAt(r)}while(n===_x||n===kx||n===Cx||n===Ix||n===Sx);u=["space",p.slice(f,r)],f=r-1;break;case Ex:case Tx:case zx:case Ox:case Nx:case Rx:case Mx:{let e=String.fromCharCode(n);u=[e,e,f];break}case Ax:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==wx&&d!==bx&&d!==_x&&d!==kx&&d!==Cx&&d!==Sx&&d!==Ix){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)===vx;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,r+1),f,r],f=r}else r=p.indexOf(")",f+1),o=p.slice(f,r+1),-1===r||jx.test(o)?u=["(","(",f]:(u=["brackets",o,f,r],f=r);break;case wx:case bx:i=n===wx?"'":'"',r=f;do{if(a=!1,r=p.indexOf(i,r+1),-1===r){if(h||t){r=f+1;break}w("string")}for(l=r;p.charCodeAt(l-1)===vx;)l-=1,a=!a}while(a);u=["string",p.slice(f,r+1),f,r],f=r;break;case Lx:Dx.lastIndex=f+1,Dx.test(p),r=0===Dx.lastIndex?p.length-1:Dx.lastIndex-2,u=["at-word",p.slice(f,r+1),f,r],f=r;break;case vx:for(r=f,s=!0;p.charCodeAt(r+1)===vx;)r+=1,s=!s;if(n=p.charCodeAt(r+1),s&&n!==xx&&n!==_x&&n!==kx&&n!==Cx&&n!==Ix&&n!==Sx&&(r+=1,Fx.test(p.charAt(r)))){for(;Fx.test(p.charAt(r+1));)r+=1;p.charCodeAt(r+1)===_x&&(r+=1)}u=["word",p.slice(f,r+1),f,r],f=r;break;default:n===xx&&p.charCodeAt(f+1)===Px?(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):($x.lastIndex=f+1,$x.test(p),r=0===$x.lastIndex?p.length-1:$x.lastIndex-2,u=["word",p.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},rk=qv,ik=Wx,ok=qx,sk=ek,ak={empty:!0,space:!0};var lk=ax,ck=class{constructor(e){this.input=e,this.root=new ok,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,i=new ik;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let o=!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){i.source.end=this.getPosition(e[2]),i.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&&(i.source.end=this.getPosition(n[3]||n[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),o&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),s&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new rk;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=nk(this.input)}decl(e,t){let n=new tk;this.init(n,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(i[3]||i[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 o,s=[];for(;e.length&&(o=e[0][0],"space"===o||"comment"===o);)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 sk;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,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.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===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),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 i,o,s,a,l=n.length,c="",d=!0;for(let u=0;u<l;u+=1)i=n[u],o=i[0],"space"!==o||u!==l-1||r?"comment"===o?(a=n[u-1]?n[u-1][0]:"empty",s=n[u+1]?n[u+1][0]:"empty",ak[a]||ak[s]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[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 sk;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})}},dk=Pv;function uk(e,t){let n=new ck(new dk(e,t));try{n.parse()}catch(r){throw r}return n.root}var pk=uk;uk.default=uk,lk.registerParse(uk);var{isClean:hk,my:mk}=Vb,fk=Hv,gk=Xb,yk=ax,wk=px,bk=yx,vk=pk,xk=qx,kk={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},_k={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},Sk={Once:!0,postcssPlugin:!0,prepare:!0};function Ck(e){return"object"==typeof e&&"function"==typeof e.then}function Ik(e){let t=!1,n=kk[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 Ek(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Ik(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Tk(e){return e[hk]=!1,e.nodes&&e.nodes.forEach(e=>Tk(e)),e}var Ak={},Mk=class e{constructor(t,n,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof e||n instanceof bk)i=Tk(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=vk;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(n,r)}catch(o){this.processed=!0,this.error=o}i&&!i[mk]&&yk.rebuild(i)}else i=Tk(n);this.result=new bk(t,i,r),this.helpers={...Ak,postcss:Ak,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(!_k[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Sk[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(Ck(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[hk];){e[hk]=!0;let n=[Ek(e)];for(;n.length>0;){let e=this.visitTick(n);if(Ck(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 Ck(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=gk;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new fk(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(Ck(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[hk];)e[hk]=!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,i]of e){let e;this.result.lastPlugin=r;try{e=i(t,this.helpers)}catch(n){throw this.handleError(n,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Ck(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,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(o){throw this.handleError(o,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[hk])return r[hk]=!0,void e.push(Ek(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[hk]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[hk]=!0;let t=Ik(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[hk]||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"}};Mk.registerPostcss=e=>{Ak=e};var zk=Mk;Mk.default=Mk,xk.registerLazyResult(Mk),wk.registerLazyResult(Mk);var Ok=Hv,Rk=Xb,Pk=pk,Nk=yx,Lk=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 i=Rk;this.result=new Nk(this._processor,r,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get:()=>o.root});let s=new Ok(i,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=Pk;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"}},Dk=Lk;Lk.default=Lk;var $k=Dk,jk=zk,Fk=px,Uk=qx,Bk=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 jk(this,e,t):new $k(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Wk=Bk;Bk.default=Bk,Uk.registerProcessor(Bk),Fk.registerProcessor(Bk);var Gk=dv,Hk=bv,Zk=qv,Vk=Wx,qk=Pv,Yk=qx,Jk=ek;function Kk(e,t){if(Array.isArray(e))return e.map(e=>Kk(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:qk.prototype};n.map&&(n.map={...n.map,__proto__:Hk.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>Kk(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 Yk(r);if("decl"===r.type)return new Gk(r);if("rule"===r.type)return new Jk(r);if("comment"===r.type)return new Zk(r);if("atrule"===r.type)return new Vk(r);throw new Error("Unknown node type: "+e.type)}var Qk=Kk;Kk.default=Kk;var Xk=Zb,e_=dv,t_=zk,n_=ax,r_=Wk,i_=Xb,o_=Qk,s_=px,a_=mx,l_=qv,c_=Wx,d_=yx,u_=Pv,p_=pk,h_=Jx,m_=ek,f_=qx,g_=av;function y_(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new r_(e)}y_.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!0,{}.LANG&&{}.LANG.startsWith("cn"));let i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new r_).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return y_([i(n)]).process(e,t)},i},y_.stringify=i_,y_.parse=p_,y_.fromJSON=o_,y_.list=h_,y_.comment=e=>new l_(e),y_.atRule=e=>new c_(e),y_.decl=e=>new e_(e),y_.rule=e=>new m_(e),y_.root=e=>new f_(e),y_.document=e=>new s_(e),y_.CssSyntaxError=Xk,y_.Declaration=e_,y_.Container=n_,y_.Processor=r_,y_.Document=s_,y_.Comment=l_,y_.Warning=a_,y_.AtRule=c_,y_.Result=d_,y_.Input=u_,y_.Rule=m_,y_.Root=f_,y_.Node=g_,t_.registerPostcss(y_);var w_=y_;y_.default=y_;var b_=/* @__PURE__ */Lb(w_);b_.stringify,b_.fromJSON,b_.plugin,b_.parse,b_.list,b_.document,b_.comment,b_.atRule,b_.rule,b_.decl,b_.root,b_.CssSyntaxError,b_.Declaration,b_.Container,b_.Processor,b_.Document,b_.Comment,b_.Warning,b_.AtRule,b_.Result,b_.Input,b_.Rule,b_.Root,b_.Node;var v_=class e{constructor(...e){Nb(this,"parentElement",null),Nb(this,"parentNode",null),Nb(this,"ownerDocument"),Nb(this,"firstChild",null),Nb(this,"lastChild",null),Nb(this,"previousSibling",null),Nb(this,"nextSibling",null),Nb(this,"ELEMENT_NODE",1),Nb(this,"TEXT_NODE",3),Nb(this,"nodeType"),Nb(this,"nodeName"),Nb(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"}},x_={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},k_={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},__={};function S_(e){if(__[e])return __[e];const t=globalThis[e],n=t.prototype,r=e in x_?x_[e]:void 0,i=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]"))})),o=e in k_?k_[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s&&!globalThis.Zone)return __[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?__[e]=o:n}catch{return n}}var C_={};function I_(e,t,n){var r;const i=`${e}.${String(n)}`;if(C_[i])return C_[i].call(t);const o=S_(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(C_[i]=s,s.call(t)):t[n]}var E_={};function T_(e,t,n){const r=`${e}.${String(n)}`;if(E_[r])return E_[r].bind(t);const i=S_(e)[n];return"function"!=typeof i?t[n]:(E_[r]=i,i.bind(t))}function A_(){return S_("MutationObserver").constructor}function M_(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var z_={ownerDocument:function(e){return I_("Node",e,"ownerDocument")},childNodes:function(e){return I_("Node",e,"childNodes")},parentNode:function(e){return I_("Node",e,"parentNode")},parentElement:function(e){return I_("Node",e,"parentElement")},textContent:function(e){return I_("Node",e,"textContent")},contains:function(e,t){return T_("Node",e,"contains")(t)},getRootNode:function(e){return T_("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?I_("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?I_("Element",e,"shadowRoot"):null},querySelector:function(e,t){return I_("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return I_("Element",e,"querySelectorAll")(t)},mutationObserver:A_,patch:M_};function O_(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var R_={map:{},getId:()=>-1,getNode:()=>null,removeNodeFromMap(){},has:()=>!1,reset(){}};function P_(e,t,n={}){let r=null,i=0;return function(...o){const s=Date.now();i||!1!==n.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(l,o)},a))}}function N_(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),o&&o.set&&o.set.call(this,e)}}),()=>N_(e,t,o||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(R_=new Proxy(R_,{get:(e,t,n)=>Reflect.get(e,t,n)}));var L_=Date.now;function D_(e){var t,n,r,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=z_.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(r=z_.parentElement(o.body))?void 0:r.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function $_(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function j_(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function F_(e){return e?e.nodeType===e.ELEMENT_NODE?e:z_.parentElement(e):null}function U_(e,t,n,r){if(!e)return!1;const i=F_(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(Gf(i,t,r))return!0}catch(o){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function B_(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function W_(e,t){if(mf(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=z_.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||W_(r,t))}function G_(e){return Boolean(e.changedTouches)}function H_(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Z_(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function V_(e){return!!e&&(e instanceof v_&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(z_.shadowRoot(e)))}/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())||(L_=()=>/* @__PURE__ */(new Date).getTime());var q_=class{constructor(){Xm(this,"id",1),Xm(this,"styleIDMap",/* @__PURE__ */new WeakMap),Xm(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 Y_(e){var t;let n=null;return"getRootNode"in e&&(null==(t=z_.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&z_.host(z_.getRootNode(e))&&(n=z_.host(z_.getRootNode(e))),n}function J_(e){const t=z_.ownerDocument(e);if(!t)return!1;const n=function(e){let t,n=e;for(;t=Y_(n);)n=t;return n}(e);return z_.contains(t,n)}function K_(e){const t=z_.ownerDocument(e);return!!t&&(z_.contains(t,e)||J_(e))}var Q_=/* @__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))(Q_||{}),X_=/* @__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))(X_||{}),eS=/* @__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))(eS||{}),tS=/* @__PURE__ */(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(tS||{}),nS=/* @__PURE__ */(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(nS||{}),rS=/* @__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))(rS||{}),iS=/* @__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))(iS||{});function oS(e){return"__ln"in e}var sS,aS=class{constructor(){Xm(this,"length",0),Xm(this,"head",null),Xm(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&&oS(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&&oS(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--)}},lS=(e,t)=>`${e}@${t}`,cS=class{constructor(){Xm(this,"frozen",!1),Xm(this,"locked",!1),Xm(this,"texts",[]),Xm(this,"attributes",[]),Xm(this,"attributeMap",/* @__PURE__ */new WeakMap),Xm(this,"removes",[]),Xm(this,"mapRemoves",[]),Xm(this,"movedMap",{}),Xm(this,"addedSet",/* @__PURE__ */new Set),Xm(this,"movedSet",/* @__PURE__ */new Set),Xm(this,"droppedSet",/* @__PURE__ */new Set),Xm(this,"removesSubTreeCache",/* @__PURE__ */new Set),Xm(this,"mutationCb"),Xm(this,"blockClass"),Xm(this,"blockSelector"),Xm(this,"maskTextClass"),Xm(this,"maskTextSelector"),Xm(this,"inlineStylesheet"),Xm(this,"maskInputOptions"),Xm(this,"maskTextFn"),Xm(this,"maskInputFn"),Xm(this,"keepIframeSrcFn"),Xm(this,"recordCanvas"),Xm(this,"inlineImages"),Xm(this,"slimDOMOptions"),Xm(this,"dataURLOptions"),Xm(this,"doc"),Xm(this,"mirror"),Xm(this,"iframeManager"),Xm(this,"stylesheetManager"),Xm(this,"shadowDomManager"),Xm(this,"canvasManager"),Xm(this,"processedNodeManager"),Xm(this,"unattachedDoc"),Xm(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Xm(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=/* @__PURE__ */new Set,n=new aS,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{const o=z_.parentNode(i);if(!o||!K_(i))return;let s=!1;if(i.nodeType===Node.TEXT_NODE){const e=o.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(o)&&(s=!0)}const a=mf(o)?this.mirror.getId(Y_(i)):this.mirror.getId(o),l=r(i);if(-1===a||-1===l)return n.addNode(i);const c=Yf(i,{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=>{H_(e,this.mirror)&&this.iframeManager.addIframe(e),Z_(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),V_(i)&&this.shadowDomManager.addShadowRoot(z_.shadowRoot(i),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)uS(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(z_.parentNode(a))||i(a);for(const a of this.addedSet)pS(this.droppedSet,a)||uS(this.removesSubTreeCache,a,this.mirror)?pS(this.movedSet,a)?i(a):this.droppedSet.add(a):i(a);let o=null;for(;n.length;){let e=null;if(o){const t=this.mirror.getId(z_.parentNode(o.value)),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(z_.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=z_.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=z_.host(r);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),i(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,n=z_.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))}),Xm(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(z_.childNodes(e),e=>z_.textContent(e)||"").join("");t.attributes.value=bf({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:kf(e),value:n,maskInputFn:this.maskInputFn})}),Xm(this,"processMutation",e=>{if(!B_(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=z_.textContent(e.target);U_(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Hf(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,F_(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if("value"===r){const e=kf(n);i=bf({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:i,maskInputFn:this.maskInputFn})}if(U_(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let o=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(i)){if(n.contentDocument)return;r="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(e.target,o)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!Wf(n.tagName,r))if(o.attributes[r]=Bf(this.doc,vf(n.tagName),vf(r),i),"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),i=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||i!==r.style.getPropertyPriority(e)?o.styleDiff[e]=""===i?t:[t,i]:o._unchangedStyles[e]=[t,i]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}else"open"===r&&"DIALOG"===n.tagName&&(n.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":if(U_(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=mf(e.target)?this.mirror.getId(z_.host(e.target)):this.mirror.getId(e.target);U_(e.target,this.blockClass,this.blockSelector,!1)||B_(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(dS(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||W_(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[lS(n,r)]?dS(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!mf(e.target)||!ff(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),z_.childNodes(e).forEach(e=>n.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),Xm(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(B_(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[lS(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);U_(e,this.blockClass,this.blockSelector,!1)||(z_.childNodes(e).forEach(e=>this.genAdds(e)),V_(e)&&z_.childNodes(z_.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 dS(e,t){e.delete(t),z_.childNodes(t).forEach(t=>dS(e,t))}function uS(e,t,n){return 0!==e.size&&function(e,t){const n=z_.parentNode(t);return!!n&&e.has(n)}(e,t)}function pS(e,t){return 0!==e.size&&hS(e,t)}function hS(e,t){const n=z_.parentNode(t);return!!n&&(!!e.has(n)||hS(e,n))}var mS=e=>{if(!sS)return e;return(...t)=>{try{return e(...t)}catch(n){if(sS&&!0===sS(n))return;throw n}}},fS=[];function gS(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 yS(e,t){const n=new cS;fS.push(n),n.init(e);const r=new(A_())(mS(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function wS({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];let l=null;return Object.keys(eS).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(o=>{let s=vf(o);const c=(t=>o=>{const s=gS(o);if(U_(s,r,i,!0))return;let a=null,c=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=tS.Mouse;break;case"touch":a=tS.Touch;break;case"pen":a=tS.Pen}a===tS.Touch?eS[t]===eS.MouseDown?c="TouchStart":eS[t]===eS.MouseUp&&(c="TouchEnd"):tS.Pen}else G_(o)&&(a=tS.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===tS.Touch||c.startsWith("Mouse")&&a===tS.Mouse)&&(a=null)):eS[t]===eS.Click&&(a=l,l=null);const d=G_(o)?o.changedTouches[0]:o;if(!d)return;const u=n.getId(s),{clientX:p,clientY:h}=d;mS(e)({type:eS[c],id:u,x:p,y:h,...null!==a&&{pointerType:a}})})(o);if(window.PointerEvent)switch(eS[o]){case eS.MouseDown:case eS.MouseUp:s=s.replace("mouse","pointer");break;case eS.TouchStart:case eS.TouchEnd:return}a.push(O_(s,c,t))}),mS(()=>{a.forEach(e=>e())})}function bS({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){return O_("scroll",mS(P_(mS(o=>{const s=gS(o);if(!s||U_(s,r,i,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=D_(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100)),t)}var vS=["INPUT","TEXTAREA","SELECT"],xS=/* @__PURE__ */new WeakMap;function kS(e){return function(e,t){if(IS("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||IS("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||IS("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||IS("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 _S(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function SS({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(z_.host(n));const a="#document"===n.nodeName?null==(r=n.defaultView)?void 0:r.Document:null==(o=null==(i=n.ownerDocument)?void 0:i.defaultView)?void 0:o.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(i){}return r}}),mS(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function CS(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,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),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...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=yS(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const l=P_(mS(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),o),c=mS(P_(mS(e=>{const t=gS(e),{clientX:n,clientY:i}=G_(e)?e.changedTouches[0]:e;s||(s=L_()),a.push({x:n,y:i,id:r.getId(t),timeOffset:L_()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?X_.Drag:e instanceof MouseEvent?X_.MouseMove:X_.TouchMove)}),i,{trailing:!1})),d=[O_("mousemove",c,n),O_("touchmove",c,n),O_("drag",c,n)];return mS(()=>{d.forEach(e=>e())})}(e),o=wS(e),s=bS(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return O_("resize",mS(P_(mS(()=>{const t=$_(),i=j_();n===t&&r===i||(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}(e,{win:n}),l=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:d}){function u(e){let n=gS(e);const c=e.isTrusted,u=n&&n.tagName;if(n&&"OPTION"===u&&(n=z_.parentElement(n)),!n||!u||vS.indexOf(u)<0||U_(n,r,i,!0))return;if(n.classList.contains(o)||s&&n.matches(s))return;let h=n.value,m=!1;const f=kf(n)||"";"radio"===f||"checkbox"===f?m=n.checked:(a[u.toLowerCase()]||a[f])&&(h=bf({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 i=xS.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){xS.set(t,r);const i=n.getId(t);mS(e)({...r,id:i})}}const h=("last"===c.input?["change"]:["input","change"]).map(e=>O_(e,mS(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=>N_(e[0],e[1],{set(){mS(u)({target:this,isTrusted:!1})}},!1,m))),mS(()=>{h.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const s=mS(o=>P_(mS(i=>{const s=gS(i);if(!s||U_(s,t,n,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:d,loop:u}=s;e({type:o,id:r.getId(s),currentTime:a,volume:l,muted:c,playbackRate:d,loop:u})}),i.media||500)),a=[O_("play",s(rS.Play),o),O_("pause",s(rS.Pause),o),O_("seeked",s(rS.Seeked),o),O_("volumechange",s(rS.VolumeChange),o),O_("ratechange",s(rS.RateChange),o)];return mS(()=>{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 i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:mS((r,i,o)=>{const[s,a]=o,{id:l,styleId:c}=_S(i,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:s,index:a}]}),r.apply(i,o)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){const i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};const o=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:s}]}),r.apply(i,o)})}),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:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),r.apply(i,o)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),r.apply(i,o)})}));const l={};ES("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(ES("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),ES("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),ES("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([r,i])=>{c[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(c[r].insertRule,{apply:mS((r,i,o)=>{const[s,a]=o,{id:l,styleId:c}=_S(i.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:s,index:[...kS(i),a||0]}]}),r.apply(i,o)})}),i.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...kS(i),s]}]}),r.apply(i,o)})})}),mS(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,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=SS(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:mS((i,s,a)=>{var l;const[c,d,u]=a;if(n.has(c))return o.apply(s,[c,d,u]);const{id:p,styleId:h}=_S(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:kS(s.parentRule)}),i.apply(s,a)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:mS((i,o,a)=>{var l;const[c]=a;if(n.has(c))return s.apply(o,[c]);const{id:d,styleId:u}=_S(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:c},index:kS(o.parentRule)}),i.apply(o,a)})}),mS(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(h=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=/* @__PURE__ */new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const r=new o(e,t,n);return i.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=M_(t.fonts,"add",function(t){return function(n){return setTimeout(mS(()=>{const t=i.get(n);t&&(e(t),i.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=o}),r.push(s),mS(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let s=!0;const a=mS(()=>{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:o,startOffset:s,endContainer:l,endOffset:c}=e.getRangeAt(t);U_(o,r,i,!0)||U_(l,r,i,!0)||a.push({start:n.getId(o),startOffset:s,end:n.getId(l),endOffset:c})}o({ranges:a})});return a(),O_("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?M_(n.customElements,"define",function(e){return function(n,r,i){try{t({define:{name:n}})}catch(o){}return e.apply(this,[n,r,i])}}):()=>{}}(e),g=[];for(const y of e.plugins)g.push(y.observer(y.callback,n,y.options));return mS(()=>{fS.forEach(e=>e.reset()),r?.disconnect(),i(),o(),s(),a(),l(),c(),d(),u(),p(),h(),m(),f(),g.forEach(e=>e())})}function IS(e){return void 0!==window[e]}function ES(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var TS=class{constructor(e){Xm(this,"iframeIdToRemoteIdMap",/* @__PURE__ */new WeakMap),Xm(this,"iframeRemoteIdToIdMap",/* @__PURE__ */new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const i=n||this.getIdToRemoteIdMap(e),o=r||this.getRemoteIdToIdMap(e);let s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),o.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 i=r.get(t);return i||-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}},AS=class{constructor(e){Xm(this,"iframes",/* @__PURE__ */new WeakMap),Xm(this,"crossOriginIframeMap",/* @__PURE__ */new WeakMap),Xm(this,"crossOriginIframeMirror",new TS(Nf)),Xm(this,"crossOriginIframeStyleMirror"),Xm(this,"crossOriginIframeRootIdMap",/* @__PURE__ */new WeakMap),Xm(this,"mirror"),Xm(this,"mutationCb"),Xm(this,"wrappedEmit"),Xm(this,"loadListener"),Xm(this,"stylesheetManager"),Xm(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new TS(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 Q_.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:Q_.IncrementalSnapshot,data:{source:X_.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Q_.Meta:case Q_.Load:case Q_.DomContentLoaded:return!1;case Q_.Plugin:return t;case Q_.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Q_.IncrementalSnapshot:switch(t.data.source){case X_.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 X_.Drag:case X_.TouchMove:case X_.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case X_.ViewportResize:return!1;case X_.MediaInteraction:case X_.MouseInteraction:case X_.Scroll:case X_.CanvasMutation:case X_.Input:return this.replaceIds(t.data,e,["id"]),t;case X_.StyleSheetRule:case X_.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case X_.Font:return t;case X_.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case X_.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 i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));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===iS.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},MS=class{constructor(e){Xm(this,"shadowDoms",/* @__PURE__ */new WeakSet),Xm(this,"mutationCb"),Xm(this,"scrollCb"),Xm(this,"bypassOptions"),Xm(this,"mirror"),Xm(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(!ff(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=yS({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(bS({...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(z_.host(e))),this.restoreHandlers.push(SS({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(M_(e.prototype,"attachShadow",function(e){return function(r){const i=e.call(this,r),o=z_.shadowRoot(this);return o&&K_(this)&&n.addShadowRoot(o,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=/* @__PURE__ */new WeakSet}},zS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",OS="undefined"==typeof Uint8Array?[]:new Uint8Array(256),RS=0;RS<64;RS++)OS[zS.charCodeAt(RS)]=RS;var PS=function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=zS[n[t]>>2],i+=zS[(3&n[t])<<4|n[t+1]>>4],i+=zS[(15&n[t+1])<<2|n[t+2]>>6],i+=zS[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i},NS=/* @__PURE__ */new Map;var LS=(e,t,n)=>{if(!e||!jS(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=NS.get(e);return n||(n=/* @__PURE__ */new Map,NS.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function DS(e,t,n){if(e instanceof Array)return e.map(e=>DS(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:PS(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[DS(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:[DS(e.data,t,n),e.width,e.height]}:jS(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:LS(e,t,n)}:e}var $S=(e,t,n)=>e.map(e=>DS(e,t,n)),jS=(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 FS(e,t,n,r){const i=[];try{const o=M_(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...o){if(!U_(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(o[0]&&"object"==typeof o[0]){const e=o[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...o])}});i.push(o)}catch{}return()=>{i.forEach(e=>e())}}function US(e,t,n,r,i,o){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=M_(e,l,function(e){return function(...s){const a=e.apply(this,s);if(LS(a,o,this),"tagName"in this.canvas&&!U_(this.canvas,r,i,!0)){const e={type:t,property:l,args:$S(s,o,this)};n(this.canvas,e)}return a}});s.push(a)}catch{const r=N_(e,l,{set(e){n(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(r)}return s}var BS="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",WS="undefined"!=typeof window&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(BS)],{type:"text/javascript;charset=utf-8"});function GS(e){let t;try{if(t=WS&&(window.URL||window.webkitURL).createObjectURL(WS),!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,"+BS,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var HS,ZS,VS,qS=class{constructor(e){Xm(this,"pendingCanvasMutations",/* @__PURE__ */new Map),Xm(this,"rafStamps",{latestId:0,invokeId:null}),Xm(this,"mirror"),Xm(this,"mutationCb"),Xm(this,"resetObservers"),Xm(this,"frozen",!1),Xm(this,"locked",!1),Xm(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:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{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,i){const o=FS(t,n,r,!0),s=/* @__PURE__ */new Map,a=new GS;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:nS["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{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=>{U_(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:i.dataURLOptions},[r])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{o(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=FS(e,t,n,!1),i=function(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=M_(t.CanvasRenderingContext2D.prototype,s,function(i){return function(...o){return U_(this.canvas,n,r,!0)||setTimeout(()=>{const n=$S(o,t,this);e(this.canvas,{type:nS["2D"],property:s,args:n})},0),i.apply(this,o)}});i.push(o)}catch{const n=N_(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:nS["2D"],property:s,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r){const i=[];return i.push(...US(t.WebGLRenderingContext.prototype,nS.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&i.push(...US(t.WebGL2RenderingContext.prototype,nS.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),i(),o()}}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:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}},YS=class{constructor(e){Xm(this,"trackedLinkElements",/* @__PURE__ */new WeakSet),Xm(this,"mutationCb"),Xm(this,"adoptedStyleSheetCb"),Xm(this,"styleMirror",new q_),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 i of e){let e;this.styleMirror.has(i)?e=this.styleMirror.getId(i):(e=this.styleMirror.add(i),r.push({styleId:e,rules:Array.from(i.rules||CSSRule,(e,t)=>({rule:yf(e,i.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){}},JS=class{constructor(){Xm(this,"nodeMap",/* @__PURE__ */new WeakMap),Xm(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(){}},KS=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(Wm=e.contentWindow)?void 0:Wm.Array.from)||Array.from,document.body.removeChild(e)}}catch(KC){}var QS,XS,eC=new wf;function tC(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=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:z}=e;sS=z;const O=!_||window.parent===window;let R=!1;if(!O)try{window.parent.document&&(R=!1)}catch(Z){R=!0}if(O&&!t)throw new Error("emit function is required");if(!O&&!R)return()=>{};void 0!==v&&void 0===w.mousemove&&(w.mousemove=v),eC.reset();const P=!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},N=qf(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};HS=(e,i)=>{var o;const s=e;if(s.timestamp=L_(),!(null==(o=fS[0])?void 0:o.isFrozen())||s.type===Q_.FullSnapshot||s.type===Q_.IncrementalSnapshot&&s.data.source===X_.Mutation||fS.forEach(e=>e.unfreeze()),O)t?.($(s),i);else if(R){const e={type:"rrweb",event:$(s),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,"*")}if(s.type===Q_.FullSnapshot)L=s,D=0;else if(s.type===Q_.IncrementalSnapshot){if(s.data.source===X_.Mutation&&s.data.isAttachIframe)return;D++;const e=r&&D>=r,t=n&&s.timestamp-L.timestamp>n;(e||t)&&ZS(!0)}};const j=e=>{HS({type:Q_.IncrementalSnapshot,data:{source:X_.Mutation,...e}})},F=e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.Scroll,...e}}),U=e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.CanvasMutation,...e}}),B=new YS({mutationCb:j,adoptedStyleSheetCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.AdoptedStyleSheet,...e}})}),W=new AS({mirror:eC,mutationCb:j,stylesheetManager:B,recordCrossOriginIframes:_,wrappedEmit:HS});for(const q of T||[])q.getMirror&&q.getMirror({nodeMirror:eC,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const G=new JS;VS=new qS({recordCanvas:k,mutationCb:U,win:window,blockClass:i,blockSelector:o,mirror:eC,sampling:w.canvas,dataURLOptions:b});const H=new MS({mutationCb:j,scrollCb:F,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:P,dataURLOptions:b,maskTextFn:f,maskInputFn:m,recordCanvas:k,inlineImages:E,sampling:w,slimDOMOptions:N,iframeManager:W,stylesheetManager:B,canvasManager:VS,keepIframeSrcFn:A,processedNodeManager:G},mirror:eC});ZS=(e=!1)=>{if(!x)return;HS({type:Q_.Meta,data:{href:window.location.href,width:j_(),height:$_()}},e),B.reset(),H.init(),fS.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new wf,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="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 Yf(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,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:qf(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:eC,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:P,maskTextFn:f,maskInputFn:m,slimDOM:N,dataURLOptions:b,recordCanvas:k,inlineImages:E,onSerialize:e=>{H_(e,eC)&&W.addIframe(e),Z_(e,eC)&&B.trackLinkElement(e),V_(e)&&H.addShadowRoot(z_.shadowRoot(e),document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{B.attachLinkElement(e,t)},keepIframeSrcFn:A});t&&(HS({type:Q_.FullSnapshot,data:{node:t,initialOffset:D_(window)}},e),fS.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&B.adoptStyleSheets(document.adoptedStyleSheets,eC.getId(document)))};try{const e=[],t=e=>{var t;return mS(CS)({mutationCb:j,mousemoveCb:(e,t)=>HS({type:Q_.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.MouseInteraction,...e}}),scrollCb:F,viewportResizeCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.ViewportResize,...e}}),inputCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.Input,...e}}),mediaInteractionCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.MediaInteraction,...e}}),styleSheetRuleCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.StyleSheetRule,...e}}),styleDeclarationCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.StyleDeclaration,...e}}),canvasMutationCb:U,fontCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.Font,...e}}),selectionCb:e=>{HS({type:Q_.IncrementalSnapshot,data:{source:X_.Selection,...e}})},customElementCb:e=>{HS({type:Q_.IncrementalSnapshot,data:{source:X_.CustomElement,...e}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:P,inlineStylesheet:d,sampling:w,recordDOM:x,recordCanvas:k,inlineImages:E,userTriggeredOnInput:C,collectFonts:I,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:A,blockSelector:o,slimDOMOptions:N,dataURLOptions:b,mirror:eC,iframeManager:W,stylesheetManager:B,shadowDomManager:H,processedNodeManager:G,canvasManager:VS,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=>HS({type:Q_.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};W.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(r){}});const n=()=>{ZS(),e.push(t(document)),KS=!0};return["interactive","complete"].includes(document.readyState)?n():(e.push(O_("DOMContentLoaded",()=>{HS({type:Q_.DomContentLoaded,data:{}}),"DOMContentLoaded"===S&&n()})),e.push(O_("load",()=>{HS({type:Q_.Load,data:{}}),"load"===S&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(t){String(t).toLowerCase().includes("cross-origin")}}),G.destroy(),KS=!1,sS=void 0}}catch(V){}}tC.addCustomEvent=(e,t)=>{if(!KS)throw new Error("please add custom event after start recording");HS({type:Q_.Custom,data:{tag:e,payload:t}})},tC.freezePage=()=>{fS.forEach(e=>e.freeze())},tC.takeFullSnapshot=e=>{if(!KS)throw new Error("please take full snapshot after start recording");ZS(e)},tC.mirror=eC,(XS=QS||(QS={}))[XS.NotStarted=0]="NotStarted",XS[XS.Running=1]="Running",XS[XS.Stopped=2]="Stopped";var nC=id("SessionRecorder"),rC=500,iC=5e5,oC=class{eventQueue=[];estimatedQueueBytes=0;sessionId;stopRecording=null;isRecording=!1;chatId;applicationId;metadataSent=!1;startPromise=null;stopRequested=!1;flushTimer=null;consecutiveFailures=0;isFlushing=!1;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");nC.info("Constructor called with chatId:",e,"applicationId:",t),this.chatId=e,this.applicationId=t,this.sessionId=e,nC.info("Initialized with sessionId:",this.sessionId)}async sendMetadata(){this.metadataSent?nC.warn("Metadata already sent, skipping"):(nC.info("Sending rrweb/metadata via POST"),await Vc.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,nC.info("✅ rrweb/metadata sent successfully"))}bufferEvent(e){if(this.eventQueue.push(e),this.estimatedQueueBytes+=new Blob([JSON.stringify(e)]).size,this.eventQueue.length>rC){const e=this.eventQueue.length-rC,t=this.eventQueue.splice(0,e);for(const n of t)this.estimatedQueueBytes-=JSON.stringify(n).length;nC.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.isFlushing)return;if(this.isFlushing=!0,this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),0===this.eventQueue.length)return void(this.isFlushing=!1);let e,t;if(this.estimatedQueueBytes<=iC)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>iC&&e.length>0)break;const i=this.eventQueue.shift();void 0!==i&&e.push(i),t+=r,this.estimatedQueueBytes-=r}this.eventQueue.length>0&&!this.flushTimer&&(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},0))}nC.debug(`Flushing ${e.length} events (~${t} bytes)`),Vc.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 nC.error(`Dropping ${e.length} events after permanent ${String(r)} error:`,n),void(this.consecutiveFailures=0);if(this.consecutiveFailures++,this.consecutiveFailures>5)return nC.error(`Dropping ${e.length} events after 5 consecutive failures:`,n),void(this.consecutiveFailures=0);if(nC.error(`Failed to flush events (attempt ${this.consecutiveFailures}/5), re-queuing:`,n),this.eventQueue=e.concat(this.eventQueue),this.estimatedQueueBytes+=t,this.eventQueue.length>rC){const e=this.eventQueue.length-rC,t=this.eventQueue.splice(0,e);for(const n of t)this.estimatedQueueBytes-=JSON.stringify(n).length;nC.warn(`⚠️ Event queue exceeded 500 after re-queue, dropped ${e} oldest events`)}}).finally(()=>{this.isFlushing=!1})}async start(){if(this.isRecording)nC.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(nC.info("🚀 start() called"),await this.sendMetadata(),this.stopRequested)throw new Error("Recording stopped during startup");this.stopRecording=tC({emit:e=>{this.bufferEvent(e)},recordCanvas:!1,recordCrossOriginIframes:!1,maskAllInputs:!1,collectFonts:!1,inlineStylesheet:!0,blockClass:"rr-block",ignoreClass:"rr-ignore"}),this.isRecording=!0,nC.info("Recording started with chatId:",this.sessionId)}catch(e){throw nC.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,nC.info("Recording stopped")}getSessionId(){return this.sessionId}isActive(){return this.isRecording}},sC=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 Vc.widgetSearch({marketrix_id:e,marketrix_key:t});if(!r||0===r.length)return{isValid:!1,error:"Widget not found or invalid credentials"};const i=r.find(e=>"widget"===e.type&&"active"===e.status);if(!i){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(!i.agent_id)return{isValid:!1,error:"Widget missing agent_id",widget:i};try{const e=await Vc.agentGet({agent_id:i.agent_id});if(!i.application_id)return{isValid:!1,error:"Widget missing application_id",widget:i,agent:e};return{isValid:!0,widget:i,agent:e,application:await Vc.applicationGet({application_id:i.application_id})}}catch(n){return{isValid:!1,error:`Failed to validate agent: ${Yc(n)}`,widget:i}}}catch(r){return Jc(r,"Widget validation",this.config)}}async validateByAgentAndApplication(e,t){try{const n=await Vc.applicationGet({application_id:e}),r=await Vc.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 Jc(n,"Agent and application validation",this.config)}}},aC=null,lC=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{aC||(aC=await Vc.widgetGetDefaults({type:"widget"}));const e=aC;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 Vc.widgetSearch({type:"widget",marketrix_id:this.mtxId,marketrix_key:this.mtxKey})).items;else{if(!this.mtxApp)return null;t=(await Vc.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)&&Od(n,"widget_enabled")&&"boolean"==typeof n.widget_enabled&&Od(n,"widget_appearance")&&"string"==typeof n.widget_appearance&&Od(n,"widget_position")&&"string"==typeof n.widget_position?t:null;var n}},cC="#6b7280",dC="#1f2937",uC="rgba(255, 255, 255, 0.95)",pC="rgba(255, 255, 255, 0.2)",hC="rgba(0, 0, 0, 0.15)",mC=({message:e="Loading widget settings..."})=>{const[t,n]=p(!1),r=e?.includes("marketrix_id")||e?.includes("marketrix_key");return t?null:/* @__PURE__ */g(Op,{position:"fixed",style:{bottom:"20px",left:"50%",transform:"translateX(-50%)",maxWidth:"420px",backgroundColor:uC,borderRadius:r?"18px":"999px",boxShadow:`0 2px 12px ${hC}`,display:"flex",flexDirection:"column",alignItems:"stretch",gap:"8px",padding:"10px 12px",border:`1px solid ${pC}`,zIndex:9999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[/* @__PURE__ */g(_h,{align:"center",style:{gap:"10px"},children:[
|
|
65
|
+
/* @__PURE__ */f(Bh,{open:r.isOpen,processing:r.isLoading,error:!!r.error,taskRunning:r.isTaskRunning,onClick:i.toggleWidget,onStop:i.stopTask,accentColor:T.widget_accent_color,backgroundColor:T.widget_background_color,borderRadius:T.widget_border_radius,tooltipBgColor:_(T.widget_accent_color,.3),tooltipTextColor:x(_(T.widget_accent_color,.3)),zIndex:T.widget_position_z_index??50,position:h,onDrag:e=>{m(e),l||"undefined"==typeof localStorage||localStorage.setItem(b,e)},isPreviewMode:l}),r.error&&/* @__PURE__ */f(Lh,{tone:"error",title:r.error,onDismiss:()=>i.clearError(),onRetry:()=>i.clearError(),position:h.includes("top")?"bottom-center":"above-fab"}),t&&!r.error&&o.widget_greeting&&/* @__PURE__ */f(Lh,{tone:"info",title:o.widget_greeting,body:o.widget_body,onDismiss:()=>n(!1),position:"bottom-center"})]})},Qm=Object.defineProperty,Xm=(e,t,n)=>((e,t,n)=>t in e?Qm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),ef=Object.defineProperty,tf=(e,t,n)=>((e,t,n)=>t in e?ef(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n),nf=/* @__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))(nf||{}),rf={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},of={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},sf={};function af(e){if(sf[e])return sf[e];const t=globalThis[e],n=t.prototype,r=e in rf?rf[e]:void 0,i=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]"))})),o=e in of?of[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s&&!globalThis.Zone)return sf[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?sf[e]=o:n}catch{return n}}var lf={};function cf(e,t,n){var r;const i=`${e}.${String(n)}`;if(lf[i])return lf[i].call(t);const o=af(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(lf[i]=s,s.call(t)):t[n]}var df={};function uf(e,t,n){const r=`${e}.${String(n)}`;if(df[r])return df[r].bind(t);const i=af(e)[n];return"function"!=typeof i?t[n]:(df[r]=i,i.bind(t))}var pf={ownerDocument:function(e){return cf("Node",e,"ownerDocument")},childNodes:function(e){return cf("Node",e,"childNodes")},parentNode:function(e){return cf("Node",e,"parentNode")},parentElement:function(e){return cf("Node",e,"parentElement")},textContent:function(e){return cf("Node",e,"textContent")},contains:function(e,t){return uf("Node",e,"contains")(t)},getRootNode:function(e){return uf("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?cf("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?cf("Element",e,"shadowRoot"):null},querySelector:function(e,t){return cf("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return cf("Element",e,"querySelectorAll")(t)},mutationObserver:function(){return af("MutationObserver").constructor},patch:function(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}};function hf(e){return e.nodeType===e.ELEMENT_NODE}function mf(e){const t=e&&"host"in e&&"mode"in e&&pf.host(e)||null;return Boolean(t&&"shadowRoot"in t&&pf.shadowRoot(t)===e)}function ff(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function gf(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=>yf(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 yf(e,t){if(function(e){return"styleSheet"in e}(e)){let t;try{t=gf(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?Tf(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?Tf(n,t):n}}var wf=class{constructor(){tf(this,"idNodeMap",/* @__PURE__ */new Map),tf(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 bf({element:e,maskInputOptions:t,tagName:n,type:r,value:i,maskInputFn:o}){let s=i||"";const a=r&&vf(r);return(t[n.toLowerCase()]||a&&t[a])&&(s=o?o(s,e):"*".repeat(s.length)),s}function vf(e){return e.toLowerCase()}var xf="__rrweb_original__";function kf(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?vf(t):null}function _f(e,t){let n;try{n=new URL(e,t??window.location.href)}catch(i){return null}const r=n.pathname.match(/\.([0-9a-z]+)(?:$)/i);return(null==r?void 0:r[1])??null}var Sf=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Cf=/^(?:[a-z+]+:)?\/\//i,If=/^www\..*/i,Ef=/^(data:)([^,]*),(.*)/i;function Tf(e,t){return(e||"").replace(Sf,(e,n,r,i,o,s)=>{const a=r||o||s,l=n||i||"";if(!a)return e;if(Cf.test(a)||If.test(a))return`url(${l}${a}${l})`;if(Ef.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 Af(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function Mf(e,t){return function(e,t,n=!1){const r=Array.from(t.childNodes),i=[];let o=0;if(r.length>1&&e&&"string"==typeof e){let t=Af(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=Af(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 i.push(e),i;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=Af(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(o+=1,o>50*r.length)return i.push(e),i;const l=Af(e.substring(0,a),n);if(l.length===h){i.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 i.push(e),i}(e,t).join("/* rr_split */")}var zf,Of,Rf=1,Pf=/* @__PURE__ */new RegExp("[^a-z0-9-_:]");function Nf(){return Rf++}var Lf=/^[^ \t\n\r\u000c]+/,Df=/^[, \t\n\r\u000c]+/;var $f=/* @__PURE__ */new WeakMap;function jf(e,t){return t&&""!==t.trim()?Uf(e,t):t}function Ff(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function Uf(e,t){let n=$f.get(e);if(n||(n=e.createElement("a"),$f.set(e,n)),t){if(t.startsWith("blob:")||t.startsWith("data:"))return t}else t="";return n.setAttribute("href",t),n.href}function Bf(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)?jf(e,r):"srcset"===n?function(e,t){if(""===t.trim())return t;let n=0;function r(e){let r;const i=e.exec(t.substring(n));return i?(r=i[0],n+=r.length,r):""}const i=[];for(;r(Df),!(n>=t.length);){let o=r(Lf);if(","===o.slice(-1))o=jf(e,o.substring(0,o.length-1)),i.push(o);else{let r="";o=jf(e,o);let s=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((o+r).trim());break}if(s)")"===e&&(s=!1);else{if(","===e){n+=1,i.push((o+r).trim());break}"("===e&&(s=!0)}r+=e,n+=1}}}return i.join(", ")}(e,r):"style"===n?Tf(r,Uf(e)):"object"===t&&"data"===n?jf(e,r):r:r}function Wf(e,t,n){return["video","audio"].includes(e)&&"autoplay"===t}function Gf(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&Gf(pf.parentNode(e),t,n);for(let r=e.classList.length;r--;){const n=e.classList[r];if(t.test(n))return!0}return!!n&&Gf(pf.parentNode(e),t,n)}function Hf(e,t,n,r){let i;if(hf(e)){if(i=e,!pf.childNodes(i).length)return!1}else{if(null===pf.parentElement(e))return!1;i=pf.parentElement(e)}try{if("string"==typeof t){if(r){if(i.closest(`.${t}`))return!0}else if(i.classList.contains(t))return!0}else if(Gf(i,t,r))return!0;if(n)if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}catch(o){}return!1}function Zf(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,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:nf.Document,childNodes:[],compatMode:e.compatMode}:{type:nf.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:nf.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:i,inlineStylesheet:o,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,i),f=function(e){if(e instanceof HTMLFormElement)return"form";const t=vf(e.tagName);return Pf.test(t)?"div":t}(e);let g={};const y=e.attributes.length;for(let v=0;v<y;v++){const t=e.attributes[v];Wf(f,t.name,t.value)||(g[t.name]=Bf(n,f,vf(t.name),t.value))}if("link"===f&&o){const t=Array.from(n.styleSheets).find(t=>t.href===e.href);let r=null;t&&(r=gf(t)),r&&(delete g.rel,delete g.href,g._cssText=r)}if("style"===f&&e.sheet){let t=gf(e.sheet);t&&(e.childNodes.length>1&&(t=Mf(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=bf({element:e,type:kf(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 i=t.getImageData,o=xf in i?i[xf]:i;if(new Uint32Array(o.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){zf||(zf=n.createElement("canvas"),Of=zf.getContext("2d"));const t=e,r=(t.currentSrc||t.getAttribute("src"),t.crossOrigin),i=()=>{t.removeEventListener("load",i);try{zf.width=t.naturalWidth,zf.height=t.naturalHeight,Of.drawImage(t,0,0),g.rr_dataURL=zf.toDataURL(l.type,l.quality)}catch(e){if("anonymous"!==t.crossOrigin)return t.crossOrigin="anonymous",void(t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i))}"anonymous"===t.crossOrigin&&(r?g.crossOrigin=r:t.removeAttribute("crossorigin"))};t.complete&&0!==t.naturalWidth?i():t.addEventListener("load",i)}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:nf.Element,tagName:f,attributes:g,childNodes:[],isSVG:Ff(e)||void 0,needBlock:m,rootId:h,isCustom:w}}(e,{doc:n,blockClass:i,blockSelector:o,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:i,cssCaptured:o}=t,s=pf.parentNode(e),a=s&&s.tagName;let l="";const c="STYLE"===a||void 0,d="SCRIPT"===a||void 0;d?l="SCRIPT_PLACEHOLDER":o||(l=pf.textContent(e),c&&l&&(l=Tf(l,Uf(t.doc))));!c&&!d&&l&&n&&(l=r?r(l,pf.parentElement(e)):l.replace(/[\S]/g,"*"));return{type:nf.Text,textContent:l||"",rootId:i}}(e,{doc:n,needsMask:s,maskTextFn:c,rootId:y,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:nf.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:nf.Comment,textContent:pf.textContent(e)||"",rootId:y};default:return!1}}function Vf(e){return null==e?"":e.toLowerCase()}function qf(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 Yf(e,t){const{doc:n,mirror:r,blockClass:i,blockSelector:o,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=Hf(e,s,a,void 0===C));const E=Zf(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,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===nf.Comment)return!0;if(e.type===nf.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"===_f(e.attributes.href)))return!0;if(t.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(Vf(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Vf(e.attributes.name)||"icon"===Vf(e.attributes.rel)||"apple-touch-icon"===Vf(e.attributes.rel)||"shortcut icon"===Vf(e.attributes.rel))))return!0;if("meta"===e.tagName){if(t.headMetaDescKeywords&&Vf(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(Vf(e.attributes.property).match(/^(og|twitter|fb):/)||Vf(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===Vf(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===Vf(e.attributes.name)||"googlebot"===Vf(e.attributes.name)||"bingbot"===Vf(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.headMetaAuthorship&&("author"===Vf(e.attributes.name)||"generator"===Vf(e.attributes.name)||"framework"===Vf(e.attributes.name)||"publisher"===Vf(e.attributes.name)||"progid"===Vf(e.attributes.name)||Vf(e.attributes.property).match(/^article:/)||Vf(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&("google-site-verification"===Vf(e.attributes.name)||"yandex-verification"===Vf(e.attributes.name)||"csrf-token"===Vf(e.attributes.name)||"p:domain_verify"===Vf(e.attributes.name)||"verify-v1"===Vf(e.attributes.name)||"verification"===Vf(e.attributes.name)||"shopify-checkout-api-token"===Vf(e.attributes.name)))return!0}}return!1}(E,h)||!I&&E.type===nf.Text&&!E.textContent.replace(/^\s+|\s+$/gm,"").length?-2:Nf();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===nf.Element){M=M&&!A.needBlock,delete A.needBlock;const t=pf.shadowRoot(e);t&&ff(t)&&(A.isShadowHost=!0)}if((A.type===nf.Document||A.type===nf.Element)&&M){h.headWhitespace&&A.type===nf.Element&&"head"===A.tagName&&(I=!1);const t={doc:n,mirror:r,blockClass:i,blockSelector:o,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===nf.Element&&"textarea"===A.tagName&&void 0!==A.attributes.value);else{A.type===nf.Element&&void 0!==A.attributes._cssText&&"string"==typeof A.attributes._cssText&&(t.cssCaptured=!0);for(const n of Array.from(pf.childNodes(e))){const e=Yf(n,t);e&&A.childNodes.push(e)}}let _=null;if(hf(e)&&(_=pf.shadowRoot(e)))for(const e of Array.from(pf.childNodes(_))){const n=Yf(e,t);n&&(ff(_)&&(n.isShadow=!0),A.childNodes.push(n))}}const z=pf.parentNode(e);return z&&mf(z)&&ff(z)&&(A.isShadow=!0),A.type===nf.Element&&"iframe"===A.tagName&&function(e,t,n){const r=e.contentWindow;if(!r)return;let i,o=!1;try{i=r.document.readyState}catch(a){return}if("complete"!==i){const r=setTimeout(()=>{o||(t(),o=!0)},n);return void e.addEventListener("load",()=>{clearTimeout(r),o=!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=Yf(t,{doc:t,mirror:r,blockClass:i,blockSelector:o,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===nf.Element&&"link"===A.tagName&&"string"==typeof A.attributes.rel&&("stylesheet"===A.attributes.rel||"preload"===A.attributes.rel&&"string"==typeof A.attributes.href&&"css"===_f(A.attributes.href))&&function(e,t,n){let r,i=!1;try{r=e.sheet}catch(s){return}if(r)return;const o=setTimeout(()=>{i||(t(),i=!0)},n);e.addEventListener("load",()=>{clearTimeout(o),i=!0,t()})}(e,()=>{if(v){const t=Yf(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,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 Jf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kf(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 Qf={exports:{}},Xf=String,eg=function(){return{isColorSupported:!1,reset:Xf,bold:Xf,dim:Xf,italic:Xf,underline:Xf,inverse:Xf,hidden:Xf,strikethrough:Xf,black:Xf,red:Xf,green:Xf,yellow:Xf,blue:Xf,magenta:Xf,cyan:Xf,white:Xf,gray:Xf,bgBlack:Xf,bgRed:Xf,bgGreen:Xf,bgYellow:Xf,bgBlue:Xf,bgMagenta:Xf,bgCyan:Xf,bgWhite:Xf}};Qf.exports=eg(),Qf.exports.createColors=eg;var tg=Qf.exports,ng=/* @__PURE__ */Kf(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),rg=tg,ig=ng,og=class e extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),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=rg.isColorSupported),ig&&e&&(t=ig(t));let n,r,i=t.split(/\r?\n/),o=Math.max(this.line-3,0),s=Math.min(this.line+2,i.length),a=String(s).length;if(e){let{bold:e,gray:t,red:i}=rg.createColors(!0);n=t=>e(i(t)),r=e=>t(e)}else n=r=e=>e;return i.slice(o,s).map((e,t)=>{let i=o+1+t,s=" "+(" "+i).slice(-a)+" | ";if(i===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}},sg=og;og.default=og;var ag={};ag.isClean=Symbol("isClean"),ag.my=Symbol("my");var lg={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var cg=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 i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,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,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;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 i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,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 i=e.parent;if("before"===n){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return lg[n];let o=e.root();if(o.rawCache||(o.rawCache={}),void 0!==o.rawCache[n])return o.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let i="raw"+((s=n)[0].toUpperCase()+s.slice(1));this[i]?r=this[i](o,e):o.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var s;return void 0===r&&(r=lg[n]),o.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)}},dg=cg;cg.default=cg;var ug=dg;function pg(e,t){new ug(t).stringify(e)}var hg=pg;pg.default=pg;var{isClean:mg,my:fg}=ag,gg=sg,yg=dg,wg=hg;function bg(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 i=e[r],o=typeof i;"parent"===r&&"object"===o?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>bg(e,n)):("object"===o&&null!==i&&(i=bg(i)),n[r]=i)}return n}var vg=class{constructor(e={}){this.raws={},this[mg]=!1,this[fg]=!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=bg(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 gg(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[mg]){this[mg]=!1;let e=this;for(;e=e.parent;)e[mg]=!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,i=this.source.start.line;for(let o=0;o<e;o++)"\n"===n[o]?(r=1,i+=1):r+=1;return{column:r,line:i}}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(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+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 yg).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 i=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o))continue;if("parent"===o||"proxyCache"===o)continue;let e=this[o];if(Array.isArray(e))n[o]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)n[o]=e.toJSON(null,t);else if("source"===o){let r=t.get(e.input);null==r&&(r=i,t.set(e.input,i),i++),n[o]={end:e.end,inputId:r,start:e.start}}else n[o]=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=wg){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let i in n)r[i]=n[i];return e.warn(t,r)}get proxyOf(){return this}},xg=vg;vg.default=vg;var kg=xg,_g=class extends kg{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]}},Sg=_g;_g.default=_g;var Cg={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="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},{SourceMapConsumer:Ig,SourceMapGenerator:Eg}=ng,{existsSync:Tg,readFileSync:Ag}=ng,{dirname:Mg,join:zg}=ng;var Og=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=Mg(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new Ig(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=Mg(e),Tg(e))return this.mapFile=e,Ag(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 Ig)return Eg.fromSourceMap(t).toString();if(t instanceof Eg)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=zg(Mg(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)}},Rg=Og;Og.default=Og;var{SourceMapConsumer:Pg,SourceMapGenerator:Ng}=ng,{fileURLToPath:Lg,pathToFileURL:Dg}=ng,{isAbsolute:$g,resolve:jg}=ng,{nanoid:Fg}=Cg,Ug=ng,Bg=sg,Wg=Rg,Gg=Symbol("fromOffsetCache"),Hg=Boolean(Pg&&Ng),Zg=Boolean(jg&&$g),Vg=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&&(!Zg||/^\w+:\/\//.test(t.from)||$g(t.from)?this.file=t.from:this.file=jg(t.from)),Zg&&Hg){let e=new Wg(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 "+Fg(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,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);o=e.line,s=e.col}else o=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,o,s);return i=a?new Bg(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 Bg(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:s,line:o},this.css,this.file,r.plugin),i.input={column:n,endColumn:s,endLine:o,line:t,source:this.css},this.file&&(Dg&&(i.input.url=Dg(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[Gg])n=this[Gg];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[Gg]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=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:jg(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let i,o,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof n&&(i=s.originalPositionFor({column:r,line:n})),o=$g(a.source)?Dg(a.source):new URL(a.source,this.map.consumer().sourceRoot||Dg(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:o.toString()};if("file:"===o.protocol){if(!Lg)throw new Error("file: protocol is not available in this PostCSS build");l.file=Lg(o)}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}},qg=Vg;Vg.default=Vg,Ug&&Ug.registerInput&&Ug.registerInput(Vg);var{SourceMapConsumer:Yg,SourceMapGenerator:Jg}=ng,{dirname:Kg,relative:Qg,resolve:Xg,sep:ey}=ng,{pathToFileURL:ty}=ng,ny=qg,ry=Boolean(Yg&&Jg),iy=Boolean(Kg&&Xg&&Qg&&ey),oy=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||Kg(e.file);!1===this.mapOpts.sourcesContent?(t=new Yg(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(),iy&&ry&&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=Jg.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Jg({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 Jg({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",o={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&&(o.generated.line=n,o.generated.column=r-1,a.source&&a.source.start?(o.source=this.sourcePath(a),o.original.line=a.source.start.line,o.original.column=a.source.start.column-1,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,this.map.addMapping(o))),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?(o.source=this.sourcePath(a),o.original.line=a.source.end.line,o.original.column=a.source.end.column-1,o.generated.line=n,o.generated.column=r-2,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,o.generated.line=n,o.generated.column=r-1,this.map.addMapping(o)))}})}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?Kg(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=Kg(Xg(n,this.mapOpts.annotation)));let r=Qg(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 ny(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(ty){let t=ty(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;"\\"===ey&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},sy=xg,ay=class extends sy{constructor(e){super(e),this.type="comment"}},ly=ay;ay.default=ay;var cy,dy,uy,py,{isClean:hy,my:my}=ag,fy=Sg,gy=ly,yy=xg;function wy(e){return e.map(e=>(e.nodes&&(e.nodes=wy(e.nodes)),delete e.source,e))}function by(e){if(e[hy]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)by(t)}var vy=class e extends yy{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),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let s of o)this.proxyOf.nodes.splice(r,0,s);for(let s in this.indexes)n=this.indexes[s],r<=n&&(this.indexes[s]=n+o.length);return this.markDirty(),this}normalize(t,n){if("string"==typeof t)t=wy(cy(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 fy(t)]}else if(t.selector)t=[new dy(t)];else if(t.name)t=[new uy(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new gy(t)]}return t.map(t=>(t[my]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[hy]&&by(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(i){throw t.addToError(i)}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]}};vy.registerParse=e=>{cy=e},vy.registerRule=e=>{dy=e},vy.registerAtRule=e=>{uy=e},vy.registerRoot=e=>{py=e};var xy=vy;vy.default=vy,vy.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,uy.prototype):"rule"===e.type?Object.setPrototypeOf(e,dy.prototype):"decl"===e.type?Object.setPrototypeOf(e,fy.prototype):"comment"===e.type?Object.setPrototypeOf(e,gy.prototype):"root"===e.type&&Object.setPrototypeOf(e,py.prototype),e[my]=!0,e.nodes&&e.nodes.forEach(e=>{vy.rebuild(e)})};var ky,_y,Sy=xy,Cy=class extends Sy{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new ky(new _y,this,e).stringify()}};Cy.registerLazyResult=e=>{ky=e},Cy.registerProcessor=e=>{_y=e};var Iy=Cy;Cy.default=Cy;var Ey=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}},Ty=Ey;Ey.default=Ey;var Ay=Ty,My=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 Ay(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},zy=My;My.default=My;var Oy="'".charCodeAt(0),Ry='"'.charCodeAt(0),Py="\\".charCodeAt(0),Ny="/".charCodeAt(0),Ly="\n".charCodeAt(0),Dy=" ".charCodeAt(0),$y="\f".charCodeAt(0),jy="\t".charCodeAt(0),Fy="\r".charCodeAt(0),Uy="[".charCodeAt(0),By="]".charCodeAt(0),Wy="(".charCodeAt(0),Gy=")".charCodeAt(0),Hy="{".charCodeAt(0),Zy="}".charCodeAt(0),Vy=";".charCodeAt(0),qy="*".charCodeAt(0),Yy=":".charCodeAt(0),Jy="@".charCodeAt(0),Ky=/[\t\n\f\r "#'()/;[\\\]{}]/g,Qy=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,Xy=/.[\r\n"'(/\\]/,ew=/[\da-f]/i,tw=xy,nw=class extends tw{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)}},rw=nw;nw.default=nw,tw.registerAtRule(nw);var iw,ow,sw=xy,aw=class extends sw{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 i of r)i.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 iw(new ow,this,e).stringify()}};aw.registerLazyResult=e=>{iw=e},aw.registerProcessor=e=>{ow=e};var lw=aw;aw.default=aw,sw.registerRoot(aw);var cw={comma:e=>cw.split(e,[","],!0),space:e=>cw.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!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)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=d;return(n||""!==i)&&r.push(i.trim()),r}},dw=cw;cw.default=cw;var uw=xy,pw=dw,hw=class extends uw{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return pw.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)}},mw=hw;hw.default=hw,uw.registerRule(hw);var fw=Sg,gw=function(e,t={}){let n,r,i,o,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 Ly:case Dy:case jy:case Fy:case $y:r=f;do{r+=1,n=p.charCodeAt(r)}while(n===Dy||n===Ly||n===jy||n===Fy||n===$y);u=["space",p.slice(f,r)],f=r-1;break;case Uy:case By:case Hy:case Zy:case Yy:case Vy:case Gy:{let e=String.fromCharCode(n);u=[e,e,f];break}case Wy:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==Oy&&d!==Ry&&d!==Dy&&d!==Ly&&d!==jy&&d!==$y&&d!==Fy){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)===Py;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,r+1),f,r],f=r}else r=p.indexOf(")",f+1),o=p.slice(f,r+1),-1===r||Xy.test(o)?u=["(","(",f]:(u=["brackets",o,f,r],f=r);break;case Oy:case Ry:i=n===Oy?"'":'"',r=f;do{if(a=!1,r=p.indexOf(i,r+1),-1===r){if(h||t){r=f+1;break}w("string")}for(l=r;p.charCodeAt(l-1)===Py;)l-=1,a=!a}while(a);u=["string",p.slice(f,r+1),f,r],f=r;break;case Jy:Ky.lastIndex=f+1,Ky.test(p),r=0===Ky.lastIndex?p.length-1:Ky.lastIndex-2,u=["at-word",p.slice(f,r+1),f,r],f=r;break;case Py:for(r=f,s=!0;p.charCodeAt(r+1)===Py;)r+=1,s=!s;if(n=p.charCodeAt(r+1),s&&n!==Ny&&n!==Dy&&n!==Ly&&n!==jy&&n!==Fy&&n!==$y&&(r+=1,ew.test(p.charAt(r)))){for(;ew.test(p.charAt(r+1));)r+=1;p.charCodeAt(r+1)===Dy&&(r+=1)}u=["word",p.slice(f,r+1),f,r],f=r;break;default:n===Ny&&p.charCodeAt(f+1)===qy?(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):(Qy.lastIndex=f+1,Qy.test(p),r=0===Qy.lastIndex?p.length-1:Qy.lastIndex-2,u=["word",p.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},yw=ly,ww=rw,bw=lw,vw=mw,xw={empty:!0,space:!0};var kw=xy,_w=class{constructor(e){this.input=e,this.root=new bw,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,i=new ww;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let o=!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){i.source.end=this.getPosition(e[2]),i.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&&(i.source.end=this.getPosition(n[3]||n[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),o&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),s&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new yw;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=gw(this.input)}decl(e,t){let n=new fw;this.init(n,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(i[3]||i[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 o,s=[];for(;e.length&&(o=e[0][0],"space"===o||"comment"===o);)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 vw;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,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.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===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),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 i,o,s,a,l=n.length,c="",d=!0;for(let u=0;u<l;u+=1)i=n[u],o=i[0],"space"!==o||u!==l-1||r?"comment"===o?(a=n[u-1]?n[u-1][0]:"empty",s=n[u+1]?n[u+1][0]:"empty",xw[a]||xw[s]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[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 vw;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})}},Sw=qg;function Cw(e,t){let n=new _w(new Sw(e,t));try{n.parse()}catch(r){throw r}return n.root}var Iw=Cw;Cw.default=Cw,kw.registerParse(Cw);var{isClean:Ew,my:Tw}=ag,Aw=oy,Mw=hg,zw=xy,Ow=Iy,Rw=zy,Pw=Iw,Nw=lw,Lw={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},Dw={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},$w={Once:!0,postcssPlugin:!0,prepare:!0};function jw(e){return"object"==typeof e&&"function"==typeof e.then}function Fw(e){let t=!1,n=Lw[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 Uw(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Fw(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Bw(e){return e[Ew]=!1,e.nodes&&e.nodes.forEach(e=>Bw(e)),e}var Ww={},Gw=class e{constructor(t,n,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof e||n instanceof Rw)i=Bw(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=Pw;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(n,r)}catch(o){this.processed=!0,this.error=o}i&&!i[Tw]&&zw.rebuild(i)}else i=Bw(n);this.result=new Rw(t,i,r),this.helpers={...Ww,postcss:Ww,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(!Dw[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!$w[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(jw(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ew];){e[Ew]=!0;let n=[Uw(e)];for(;n.length>0;){let e=this.visitTick(n);if(jw(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 jw(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=Mw;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new Aw(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(jw(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[Ew];)e[Ew]=!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,i]of e){let e;this.result.lastPlugin=r;try{e=i(t,this.helpers)}catch(n){throw this.handleError(n,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(jw(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,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(o){throw this.handleError(o,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[Ew])return r[Ew]=!0,void e.push(Uw(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[Ew]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[Ew]=!0;let t=Fw(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[Ew]||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"}};Gw.registerPostcss=e=>{Ww=e};var Hw=Gw;Gw.default=Gw,Nw.registerLazyResult(Gw),Ow.registerLazyResult(Gw);var Zw=oy,Vw=hg,qw=Iw,Yw=zy,Jw=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 i=Vw;this.result=new Yw(this._processor,r,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get:()=>o.root});let s=new Zw(i,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=qw;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"}},Kw=Jw;Jw.default=Jw;var Qw=Kw,Xw=Hw,eb=Iy,tb=lw,nb=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 Xw(this,e,t):new Qw(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},rb=nb;nb.default=nb,tb.registerProcessor(nb),eb.registerProcessor(nb);var ib=Sg,ob=Rg,sb=ly,ab=rw,lb=qg,cb=lw,db=mw;function ub(e,t){if(Array.isArray(e))return e.map(e=>ub(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:lb.prototype};n.map&&(n.map={...n.map,__proto__:ob.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>ub(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 cb(r);if("decl"===r.type)return new ib(r);if("rule"===r.type)return new db(r);if("comment"===r.type)return new sb(r);if("atrule"===r.type)return new ab(r);throw new Error("Unknown node type: "+e.type)}var pb=ub;ub.default=ub;var hb=sg,mb=Sg,fb=Hw,gb=xy,yb=rb,wb=hg,bb=pb,vb=Iy,xb=Ty,kb=ly,_b=rw,Sb=zy,Cb=qg,Ib=Iw,Eb=dw,Tb=mw,Ab=lw,Mb=xg;function zb(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new yb(e)}zb.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!0,{}.LANG&&{}.LANG.startsWith("cn"));let i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new yb).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return zb([i(n)]).process(e,t)},i},zb.stringify=wb,zb.parse=Ib,zb.fromJSON=bb,zb.list=Eb,zb.comment=e=>new kb(e),zb.atRule=e=>new _b(e),zb.decl=e=>new mb(e),zb.rule=e=>new Tb(e),zb.root=e=>new Ab(e),zb.document=e=>new vb(e),zb.CssSyntaxError=hb,zb.Declaration=mb,zb.Container=gb,zb.Processor=yb,zb.Document=vb,zb.Comment=kb,zb.Warning=xb,zb.AtRule=_b,zb.Result=Sb,zb.Input=Cb,zb.Rule=Tb,zb.Root=Ab,zb.Node=Mb,fb.registerPostcss(zb);var Ob=zb;zb.default=zb;var Rb=/* @__PURE__ */Jf(Ob);Rb.stringify,Rb.fromJSON,Rb.plugin,Rb.parse,Rb.list,Rb.document,Rb.comment,Rb.atRule,Rb.rule,Rb.decl,Rb.root,Rb.CssSyntaxError,Rb.Declaration,Rb.Container,Rb.Processor,Rb.Document,Rb.Comment,Rb.Warning,Rb.AtRule,Rb.Result,Rb.Input,Rb.Rule,Rb.Root,Rb.Node;var Pb=Object.defineProperty,Nb=(e,t,n)=>((e,t,n)=>t in e?Pb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);function Lb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Db(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 $b={exports:{}},jb=String,Fb=function(){return{isColorSupported:!1,reset:jb,bold:jb,dim:jb,italic:jb,underline:jb,inverse:jb,hidden:jb,strikethrough:jb,black:jb,red:jb,green:jb,yellow:jb,blue:jb,magenta:jb,cyan:jb,white:jb,gray:jb,bgBlack:jb,bgRed:jb,bgGreen:jb,bgYellow:jb,bgBlue:jb,bgMagenta:jb,bgCyan:jb,bgWhite:jb}};$b.exports=Fb(),$b.exports.createColors=Fb;var Ub=$b.exports,Bb=/* @__PURE__ */Db(/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"}))),Wb=Ub,Gb=Bb,Hb=class e extends Error{constructor(t,n,r,i,o,s){super(t),this.name="CssSyntaxError",this.reason=t,o&&(this.file=o),i&&(this.source=i),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=Wb.isColorSupported),Gb&&e&&(t=Gb(t));let n,r,i=t.split(/\r?\n/),o=Math.max(this.line-3,0),s=Math.min(this.line+2,i.length),a=String(s).length;if(e){let{bold:e,gray:t,red:i}=Wb.createColors(!0);n=t=>e(i(t)),r=e=>t(e)}else n=r=e=>e;return i.slice(o,s).map((e,t)=>{let i=o+1+t,s=" "+(" "+i).slice(-a)+" | ";if(i===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}},Zb=Hb;Hb.default=Hb;var Vb={};Vb.isClean=Symbol("isClean"),Vb.my=Symbol("my");var qb={after:"\n",beforeClose:"\n",beforeComment:"\n",beforeDecl:"\n",beforeOpen:" ",beforeRule:"\n",colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};var Yb=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 i=(e.raws.between||"")+(t?";":"");this.builder(n+r+i,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,i=0;for(;r&&"root"!==r.type;)i+=1,r=r.parent;if(n.includes("\n")){let t=this.raw(e,null,"indent");if(t.length)for(let e=0;e<i;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 i=e.nodes[r],o=this.raw(i,"before");o&&this.builder(o),this.stringify(i,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 i=e.parent;if("before"===n){if(!i||"root"===i.type&&i.first===e)return"";if(i&&"document"===i.type)return""}if(!i)return qb[n];let o=e.root();if(o.rawCache||(o.rawCache={}),void 0!==o.rawCache[n])return o.rawCache[n];if("before"===n||"after"===n)return this.beforeAfter(e,n);{let i="raw"+((s=n)[0].toUpperCase()+s.slice(1));this[i]?r=this[i](o,e):o.walk(e=>{if(r=e.raws[t],void 0!==r)return!1})}var s;return void 0===r&&(r=qb[n]),o.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)}},Jb=Yb;Yb.default=Yb;var Kb=Jb;function Qb(e,t){new Kb(t).stringify(e)}var Xb=Qb;Qb.default=Qb;var{isClean:ev,my:tv}=Vb,nv=Zb,rv=Jb,iv=Xb;function ov(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 i=e[r],o=typeof i;"parent"===r&&"object"===o?t&&(n[r]=t):"source"===r?n[r]=i:Array.isArray(i)?n[r]=i.map(e=>ov(e,n)):("object"===o&&null!==i&&(i=ov(i)),n[r]=i)}return n}var sv=class{constructor(e={}){this.raws={},this[ev]=!1,this[tv]=!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=ov(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 nv(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[ev]){this[ev]=!1;let e=this;for(;e=e.parent;)e[ev]=!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,i=this.source.start.line;for(let o=0;o<e;o++)"\n"===n[o]?(r=1,i+=1):r+=1;return{column:r,line:i}}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(),i=r.indexOf(e.word);-1!==i&&(t=this.positionInside(i,r),n=this.positionInside(i+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 rv).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 i=0;for(let o in this){if(!Object.prototype.hasOwnProperty.call(this,o))continue;if("parent"===o||"proxyCache"===o)continue;let e=this[o];if(Array.isArray(e))n[o]=e.map(e=>"object"==typeof e&&e.toJSON?e.toJSON(null,t):e);else if("object"==typeof e&&e.toJSON)n[o]=e.toJSON(null,t);else if("source"===o){let r=t.get(e.input);null==r&&(r=i,t.set(e.input,i),i++),n[o]={end:e.end,inputId:r,start:e.start}}else n[o]=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=iv){e.stringify&&(e=e.stringify);let t="";return e(this,e=>{t+=e}),t}warn(e,t,n){let r={node:this};for(let i in n)r[i]=n[i];return e.warn(t,r)}get proxyOf(){return this}},av=sv;sv.default=sv;var lv=av,cv=class extends lv{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]}},dv=cv;cv.default=cv;var uv={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="",i=n;for(;i--;)r+=e[Math.random()*e.length|0];return r}},{SourceMapConsumer:pv,SourceMapGenerator:hv}=Bb,{existsSync:mv,readFileSync:fv}=Bb,{dirname:gv,join:yv}=Bb;var wv=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=gv(this.mapFile)),r&&(this.text=r)}consumer(){return this.consumerCache||(this.consumerCache=new pv(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=gv(e),mv(e))return this.mapFile=e,fv(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 pv)return hv.fromSourceMap(t).toString();if(t instanceof hv)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=yv(gv(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)}},bv=wv;wv.default=wv;var{SourceMapConsumer:vv,SourceMapGenerator:xv}=Bb,{fileURLToPath:kv,pathToFileURL:_v}=Bb,{isAbsolute:Sv,resolve:Cv}=Bb,{nanoid:Iv}=uv,Ev=Bb,Tv=Zb,Av=bv,Mv=Symbol("fromOffsetCache"),zv=Boolean(vv&&xv),Ov=Boolean(Cv&&Sv),Rv=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&&(!Ov||/^\w+:\/\//.test(t.from)||Sv(t.from)?this.file=t.from:this.file=Cv(t.from)),Ov&&zv){let e=new Av(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 "+Iv(6)+">"),this.map&&(this.map.file=this.from)}error(e,t,n,r={}){let i,o,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);o=e.line,s=e.col}else o=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,o,s);return i=a?new Tv(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 Tv(e,void 0===o?t:{column:n,line:t},void 0===o?n:{column:s,line:o},this.css,this.file,r.plugin),i.input={column:n,endColumn:s,endLine:o,line:t,source:this.css},this.file&&(_v&&(i.input.url=_v(this.file).toString()),i.input.file=this.file),i}fromOffset(e){let t,n;if(this[Mv])n=this[Mv];else{let e=this.css.split("\n");n=new Array(e.length);let t=0;for(let r=0,i=e.length;r<i;r++)n[r]=t,t+=e[r].length+1;this[Mv]=n}t=n[n.length-1];let r=0;if(e>=t)r=n.length-1;else{let t,i=n.length-2;for(;r<i;)if(t=r+(i-r>>1),e<n[t])i=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:Cv(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,t,n,r){if(!this.map)return!1;let i,o,s=this.map.consumer(),a=s.originalPositionFor({column:t,line:e});if(!a.source)return!1;"number"==typeof n&&(i=s.originalPositionFor({column:r,line:n})),o=Sv(a.source)?_v(a.source):new URL(a.source,this.map.consumer().sourceRoot||_v(this.map.mapFile));let l={column:a.column,endColumn:i&&i.column,endLine:i&&i.line,line:a.line,url:o.toString()};if("file:"===o.protocol){if(!kv)throw new Error("file: protocol is not available in this PostCSS build");l.file=kv(o)}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}},Pv=Rv;Rv.default=Rv,Ev&&Ev.registerInput&&Ev.registerInput(Rv);var{SourceMapConsumer:Nv,SourceMapGenerator:Lv}=Bb,{dirname:Dv,relative:$v,resolve:jv,sep:Fv}=Bb,{pathToFileURL:Uv}=Bb,Bv=Pv,Wv=Boolean(Nv&&Lv),Gv=Boolean(Dv&&jv&&$v&&Fv),Hv=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||Dv(e.file);!1===this.mapOpts.sourcesContent?(t=new Nv(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(),Gv&&Wv&&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=Lv.fromSourceMap(e,{ignoreInvalidMapping:!0})}else this.map=new Lv({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 Lv({file:this.outputFile(),ignoreInvalidMapping:!0});let e,t,n=1,r=1,i="<no source>",o={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&&(o.generated.line=n,o.generated.column=r-1,a.source&&a.source.start?(o.source=this.sourcePath(a),o.original.line=a.source.start.line,o.original.column=a.source.start.column-1,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,this.map.addMapping(o))),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?(o.source=this.sourcePath(a),o.original.line=a.source.end.line,o.original.column=a.source.end.column-1,o.generated.line=n,o.generated.column=r-2,this.map.addMapping(o)):(o.source=i,o.original.line=1,o.original.column=0,o.generated.line=n,o.generated.column=r-1,this.map.addMapping(o)))}})}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?Dv(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(n=Dv(jv(n,this.mapOpts.annotation)));let r=$v(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 Bv(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(Uv){let t=Uv(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;"\\"===Fv&&(e=e.replace(/\\/g,"/"));let n=encodeURI(e).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(e,n),n}},Zv=av,Vv=class extends Zv{constructor(e){super(e),this.type="comment"}},qv=Vv;Vv.default=Vv;var Yv,Jv,Kv,Qv,{isClean:Xv,my:ex}=Vb,tx=dv,nx=qv,rx=av;function ix(e){return e.map(e=>(e.nodes&&(e.nodes=ix(e.nodes)),delete e.source,e))}function ox(e){if(e[Xv]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)ox(t)}var sx=class e extends rx{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),i=this.normalize(t,this.proxyOf.nodes[r]).reverse();r=this.index(e);for(let o of i)this.proxyOf.nodes.splice(r+1,0,o);for(let o in this.indexes)n=this.indexes[o],r<n&&(this.indexes[o]=n+i.length);return this.markDirty(),this}insertBefore(e,t){let n,r=this.index(e),i=0===r&&"prepend",o=this.normalize(t,this.proxyOf.nodes[r],i).reverse();r=this.index(e);for(let s of o)this.proxyOf.nodes.splice(r,0,s);for(let s in this.indexes)n=this.indexes[s],r<=n&&(this.indexes[s]=n+o.length);return this.markDirty(),this}normalize(t,n){if("string"==typeof t)t=ix(Yv(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 tx(t)]}else if(t.selector)t=[new Jv(t)];else if(t.name)t=[new Kv(t)];else{if(!t.text)throw new Error("Unknown node type in node creation");t=[new nx(t)]}return t.map(t=>(t[ex]||e.rebuild(t),(t=t.proxyOf).parent&&t.parent.removeChild(t),t[Xv]&&ox(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(i){throw t.addToError(i)}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]}};sx.registerParse=e=>{Yv=e},sx.registerRule=e=>{Jv=e},sx.registerAtRule=e=>{Kv=e},sx.registerRoot=e=>{Qv=e};var ax=sx;sx.default=sx,sx.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,Kv.prototype):"rule"===e.type?Object.setPrototypeOf(e,Jv.prototype):"decl"===e.type?Object.setPrototypeOf(e,tx.prototype):"comment"===e.type?Object.setPrototypeOf(e,nx.prototype):"root"===e.type&&Object.setPrototypeOf(e,Qv.prototype),e[ex]=!0,e.nodes&&e.nodes.forEach(e=>{sx.rebuild(e)})};var lx,cx,dx=ax,ux=class extends dx{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new lx(new cx,this,e).stringify()}};ux.registerLazyResult=e=>{lx=e},ux.registerProcessor=e=>{cx=e};var px=ux;ux.default=ux;var hx=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}},mx=hx;hx.default=hx;var fx=mx,gx=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 fx(e,t);return this.messages.push(n),n}warnings(){return this.messages.filter(e=>"warning"===e.type)}get content(){return this.css}},yx=gx;gx.default=gx;var wx="'".charCodeAt(0),bx='"'.charCodeAt(0),vx="\\".charCodeAt(0),xx="/".charCodeAt(0),kx="\n".charCodeAt(0),_x=" ".charCodeAt(0),Sx="\f".charCodeAt(0),Cx="\t".charCodeAt(0),Ix="\r".charCodeAt(0),Ex="[".charCodeAt(0),Tx="]".charCodeAt(0),Ax="(".charCodeAt(0),Mx=")".charCodeAt(0),zx="{".charCodeAt(0),Ox="}".charCodeAt(0),Rx=";".charCodeAt(0),Px="*".charCodeAt(0),Nx=":".charCodeAt(0),Lx="@".charCodeAt(0),Dx=/[\t\n\f\r "#'()/;[\\\]{}]/g,$x=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,jx=/.[\r\n"'(/\\]/,Fx=/[\da-f]/i,Ux=ax,Bx=class extends Ux{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)}},Wx=Bx;Bx.default=Bx,Ux.registerAtRule(Bx);var Gx,Hx,Zx=ax,Vx=class extends Zx{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 i of r)i.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 Gx(new Hx,this,e).stringify()}};Vx.registerLazyResult=e=>{Gx=e},Vx.registerProcessor=e=>{Hx=e};var qx=Vx;Vx.default=Vx,Zx.registerRoot(Vx);var Yx={comma:e=>Yx.split(e,[","],!0),space:e=>Yx.split(e,[" ","\n","\t"]),split(e,t,n){let r=[],i="",o=!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)&&(o=!0),o?(""!==i&&r.push(i.trim()),i="",o=!1):i+=d;return(n||""!==i)&&r.push(i.trim()),r}},Jx=Yx;Yx.default=Yx;var Kx=ax,Qx=Jx,Xx=class extends Kx{constructor(e){super(e),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return Qx.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)}},ek=Xx;Xx.default=Xx,Kx.registerRule(Xx);var tk=dv,nk=function(e,t={}){let n,r,i,o,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 kx:case _x:case Cx:case Ix:case Sx:r=f;do{r+=1,n=p.charCodeAt(r)}while(n===_x||n===kx||n===Cx||n===Ix||n===Sx);u=["space",p.slice(f,r)],f=r-1;break;case Ex:case Tx:case zx:case Ox:case Nx:case Rx:case Mx:{let e=String.fromCharCode(n);u=[e,e,f];break}case Ax:if(c=g.length?g.pop()[1]:"",d=p.charCodeAt(f+1),"url"===c&&d!==wx&&d!==bx&&d!==_x&&d!==kx&&d!==Cx&&d!==Sx&&d!==Ix){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)===vx;)l-=1,a=!a}while(a);u=["brackets",p.slice(f,r+1),f,r],f=r}else r=p.indexOf(")",f+1),o=p.slice(f,r+1),-1===r||jx.test(o)?u=["(","(",f]:(u=["brackets",o,f,r],f=r);break;case wx:case bx:i=n===wx?"'":'"',r=f;do{if(a=!1,r=p.indexOf(i,r+1),-1===r){if(h||t){r=f+1;break}w("string")}for(l=r;p.charCodeAt(l-1)===vx;)l-=1,a=!a}while(a);u=["string",p.slice(f,r+1),f,r],f=r;break;case Lx:Dx.lastIndex=f+1,Dx.test(p),r=0===Dx.lastIndex?p.length-1:Dx.lastIndex-2,u=["at-word",p.slice(f,r+1),f,r],f=r;break;case vx:for(r=f,s=!0;p.charCodeAt(r+1)===vx;)r+=1,s=!s;if(n=p.charCodeAt(r+1),s&&n!==xx&&n!==_x&&n!==kx&&n!==Cx&&n!==Ix&&n!==Sx&&(r+=1,Fx.test(p.charAt(r)))){for(;Fx.test(p.charAt(r+1));)r+=1;p.charCodeAt(r+1)===_x&&(r+=1)}u=["word",p.slice(f,r+1),f,r],f=r;break;default:n===xx&&p.charCodeAt(f+1)===Px?(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):($x.lastIndex=f+1,$x.test(p),r=0===$x.lastIndex?p.length-1:$x.lastIndex-2,u=["word",p.slice(f,r+1),f,r],g.push(u),f=r)}return f++,u},position:function(){return f}}},rk=qv,ik=Wx,ok=qx,sk=ek,ak={empty:!0,space:!0};var lk=ax,ck=class{constructor(e){this.input=e,this.root=new ok,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,i=new ik;i.name=e[1].slice(1),""===i.name&&this.unnamedAtrule(i,e),this.init(i,e[2]);let o=!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){i.source.end=this.getPosition(e[2]),i.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&&(i.source.end=this.getPosition(n[3]||n[2]),i.source.end.offset++)}this.end(e);break}a.push(e)}else a.push(e);if(this.tokenizer.endOfFile()){o=!0;break}}i.raws.between=this.spacesAndCommentsFromEnd(a),a.length?(i.raws.afterName=this.spacesAndCommentsFromStart(a),this.raw(i,"params",a),o&&(e=a[a.length-1],i.source.end=this.getPosition(e[3]||e[2]),i.source.end.offset++,this.spaces=i.raws.between,i.raws.between="")):(i.raws.afterName="",i.params=""),s&&(i.nodes=[],this.current=i)}checkMissedSemicolon(e){let t=this.colon(e);if(!1===t)return;let n,r=0;for(let i=t-1;i>=0&&(n=e[i],"space"===n[0]||(r+=1,2!==r));i--);throw this.input.error("Missed semicolon","word"===n[0]?n[3]+1:n[2])}colon(e){let t,n,r,i=0;for(let[o,s]of e.entries()){if(t=s,n=t[0],"("===n&&(i+=1),")"===n&&(i-=1),0===i&&":"===n){if(r){if("word"===r[0]&&"progid"===r[1])continue;return o}this.doubleColon(t)}r=t}return!1}comment(e){let t=new rk;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=nk(this.input)}decl(e,t){let n=new tk;this.init(n,e[0][2]);let r,i=e[e.length-1];for(";"===i[0]&&(this.semicolon=!0,e.pop()),n.source.end=this.getPosition(i[3]||i[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 o,s=[];for(;e.length&&(o=e[0][0],"space"===o||"comment"===o);)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 sk;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,i=null,o=[],s=e[1].startsWith("--"),a=[],l=e;for(;l;){if(n=l[0],a.push(l),"("===n||"["===n)i||(i=l),o.push("("===n?")":"]");else if(s&&r&&"{"===n)i||(i=l),o.push("}");else if(0===o.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===o[o.length-1]&&(o.pop(),0===o.length&&(i=null));l=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(t=!0),o.length>0&&this.unclosedBracket(i),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 i,o,s,a,l=n.length,c="",d=!0;for(let u=0;u<l;u+=1)i=n[u],o=i[0],"space"!==o||u!==l-1||r?"comment"===o?(a=n[u-1]?n[u-1][0]:"empty",s=n[u+1]?n[u+1][0]:"empty",ak[a]||ak[s]||","===c.slice(-1)?d=!1:c+=i[1]):c+=i[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 sk;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})}},dk=Pv;function uk(e,t){let n=new ck(new dk(e,t));try{n.parse()}catch(r){throw r}return n.root}var pk=uk;uk.default=uk,lk.registerParse(uk);var{isClean:hk,my:mk}=Vb,fk=Hv,gk=Xb,yk=ax,wk=px,bk=yx,vk=pk,xk=qx,kk={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},_k={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},Sk={Once:!0,postcssPlugin:!0,prepare:!0};function Ck(e){return"object"==typeof e&&"function"==typeof e.then}function Ik(e){let t=!1,n=kk[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 Ek(e){let t;return t="document"===e.type?["Document",0,"DocumentExit"]:"root"===e.type?["Root",0,"RootExit"]:Ik(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Tk(e){return e[hk]=!1,e.nodes&&e.nodes.forEach(e=>Tk(e)),e}var Ak={},Mk=class e{constructor(t,n,r){let i;if(this.stringified=!1,this.processed=!1,"object"!=typeof n||null===n||"root"!==n.type&&"document"!==n.type)if(n instanceof e||n instanceof bk)i=Tk(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=vk;r.syntax&&(e=r.syntax.parse),r.parser&&(e=r.parser),e.parse&&(e=e.parse);try{i=e(n,r)}catch(o){this.processed=!0,this.error=o}i&&!i[mk]&&yk.rebuild(i)}else i=Tk(n);this.result=new bk(t,i,r),this.helpers={...Ak,postcss:Ak,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(!_k[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${t.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!Sk[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(Ck(r))try{await r}catch(e){throw this.handleError(e)}}if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[hk];){e[hk]=!0;let n=[Ek(e)];for(;n.length>0;){let e=this.visitTick(n);if(Ck(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 Ck(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=gk;e.syntax&&(t=e.syntax.stringify),e.stringifier&&(t=e.stringifier),t.stringify&&(t=t.stringify);let n=new fk(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(Ck(this.runOnRoot(e)))throw this.getAsyncError();if(this.prepareVisitors(),this.hasListener){let e=this.result.root;for(;!e[hk];)e[hk]=!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,i]of e){let e;this.result.lastPlugin=r;try{e=i(t,this.helpers)}catch(n){throw this.handleError(n,t.proxyOf)}if("root"!==t.type&&"document"!==t.type&&!t.parent)return!0;if(Ck(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,i]=r[t.visitorIndex];t.visitorIndex+=1,t.visitorIndex===r.length&&(t.visitors=[],t.visitorIndex=0),this.result.lastPlugin=e;try{return i(n.toProxy(),this.helpers)}catch(o){throw this.handleError(o,n)}}if(0!==t.iterator){let r,i=t.iterator;for(;r=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!r[hk])return r[hk]=!0,void e.push(Ek(r));t.iterator=0,delete n.indexes[i]}let i=t.events;for(;t.eventIndex<i.length;){let e=i[t.eventIndex];if(t.eventIndex+=1,0===e)return void(n.nodes&&n.nodes.length&&(n[hk]=!0,t.iterator=n.getIterator()));if(this.listeners[e])return void(t.visitors=this.listeners[e])}e.pop()}walkSync(e){e[hk]=!0;let t=Ik(e);for(let n of t)if(0===n)e.nodes&&e.each(e=>{e[hk]||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"}};Mk.registerPostcss=e=>{Ak=e};var zk=Mk;Mk.default=Mk,xk.registerLazyResult(Mk),wk.registerLazyResult(Mk);var Ok=Hv,Rk=Xb,Pk=pk,Nk=yx,Lk=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 i=Rk;this.result=new Nk(this._processor,r,this._opts),this.result.css=t;let o=this;Object.defineProperty(this.result,"root",{get:()=>o.root});let s=new Ok(i,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=Pk;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"}},Dk=Lk;Lk.default=Lk;var $k=Dk,jk=zk,Fk=px,Uk=qx,Bk=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 jk(this,e,t):new $k(this,e,t)}use(e){return this.plugins=this.plugins.concat(this.normalize([e])),this}},Wk=Bk;Bk.default=Bk,Uk.registerProcessor(Bk),Fk.registerProcessor(Bk);var Gk=dv,Hk=bv,Zk=qv,Vk=Wx,qk=Pv,Yk=qx,Jk=ek;function Kk(e,t){if(Array.isArray(e))return e.map(e=>Kk(e));let{inputs:n,...r}=e;if(n){t=[];for(let e of n){let n={...e,__proto__:qk.prototype};n.map&&(n.map={...n.map,__proto__:Hk.prototype}),t.push(n)}}if(r.nodes&&(r.nodes=e.nodes.map(e=>Kk(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 Yk(r);if("decl"===r.type)return new Gk(r);if("rule"===r.type)return new Jk(r);if("comment"===r.type)return new Zk(r);if("atrule"===r.type)return new Vk(r);throw new Error("Unknown node type: "+e.type)}var Qk=Kk;Kk.default=Kk;var Xk=Zb,e_=dv,t_=zk,n_=ax,r_=Wk,i_=Xb,o_=Qk,s_=px,a_=mx,l_=qv,c_=Wx,d_=yx,u_=Pv,p_=pk,h_=Jx,m_=ek,f_=qx,g_=av;function y_(...e){return 1===e.length&&Array.isArray(e[0])&&(e=e[0]),new r_(e)}y_.plugin=function(e,t){let n,r=!1;function i(...n){console&&console.warn&&!r&&(r=!0,{}.LANG&&{}.LANG.startsWith("cn"));let i=t(...n);return i.postcssPlugin=e,i.postcssVersion=(new r_).version,i}return Object.defineProperty(i,"postcss",{get:()=>(n||(n=i()),n)}),i.process=function(e,t,n){return y_([i(n)]).process(e,t)},i},y_.stringify=i_,y_.parse=p_,y_.fromJSON=o_,y_.list=h_,y_.comment=e=>new l_(e),y_.atRule=e=>new c_(e),y_.decl=e=>new e_(e),y_.rule=e=>new m_(e),y_.root=e=>new f_(e),y_.document=e=>new s_(e),y_.CssSyntaxError=Xk,y_.Declaration=e_,y_.Container=n_,y_.Processor=r_,y_.Document=s_,y_.Comment=l_,y_.Warning=a_,y_.AtRule=c_,y_.Result=d_,y_.Input=u_,y_.Rule=m_,y_.Root=f_,y_.Node=g_,t_.registerPostcss(y_);var w_=y_;y_.default=y_;var b_=/* @__PURE__ */Lb(w_);b_.stringify,b_.fromJSON,b_.plugin,b_.parse,b_.list,b_.document,b_.comment,b_.atRule,b_.rule,b_.decl,b_.root,b_.CssSyntaxError,b_.Declaration,b_.Container,b_.Processor,b_.Document,b_.Comment,b_.Warning,b_.AtRule,b_.Result,b_.Input,b_.Rule,b_.Root,b_.Node;var v_=class e{constructor(...e){Nb(this,"parentElement",null),Nb(this,"parentNode",null),Nb(this,"ownerDocument"),Nb(this,"firstChild",null),Nb(this,"lastChild",null),Nb(this,"previousSibling",null),Nb(this,"nextSibling",null),Nb(this,"ELEMENT_NODE",1),Nb(this,"TEXT_NODE",3),Nb(this,"nodeType"),Nb(this,"nodeName"),Nb(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"}},x_={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},k_={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},__={};function S_(e){if(__[e])return __[e];const t=globalThis[e],n=t.prototype,r=e in x_?x_[e]:void 0,i=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]"))})),o=e in k_?k_[e]:void 0,s=Boolean(o&&o.every(e=>{var t;return"function"==typeof n[e]&&(null==(t=n[e])?void 0:t.toString().includes("[native code]"))}));if(i&&s&&!globalThis.Zone)return __[e]=t.prototype,t.prototype;try{const r=document.createElement("iframe");document.body.appendChild(r);const i=r.contentWindow;if(!i)return t.prototype;const o=i[e].prototype;return document.body.removeChild(r),o?__[e]=o:n}catch{return n}}var C_={};function I_(e,t,n){var r;const i=`${e}.${String(n)}`;if(C_[i])return C_[i].call(t);const o=S_(e),s=null==(r=Object.getOwnPropertyDescriptor(o,n))?void 0:r.get;return s?(C_[i]=s,s.call(t)):t[n]}var E_={};function T_(e,t,n){const r=`${e}.${String(n)}`;if(E_[r])return E_[r].bind(t);const i=S_(e)[n];return"function"!=typeof i?t[n]:(E_[r]=i,i.bind(t))}function A_(){return S_("MutationObserver").constructor}function M_(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return"function"==typeof i&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}var z_={ownerDocument:function(e){return I_("Node",e,"ownerDocument")},childNodes:function(e){return I_("Node",e,"childNodes")},parentNode:function(e){return I_("Node",e,"parentNode")},parentElement:function(e){return I_("Node",e,"parentElement")},textContent:function(e){return I_("Node",e,"textContent")},contains:function(e,t){return T_("Node",e,"contains")(t)},getRootNode:function(e){return T_("Node",e,"getRootNode")()},host:function(e){return e&&"host"in e?I_("ShadowRoot",e,"host"):null},styleSheets:function(e){return e.styleSheets},shadowRoot:function(e){return e&&"shadowRoot"in e?I_("Element",e,"shadowRoot"):null},querySelector:function(e,t){return I_("Element",e,"querySelector")(t)},querySelectorAll:function(e,t){return I_("Element",e,"querySelectorAll")(t)},mutationObserver:A_,patch:M_};function O_(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}var R_={map:{},getId:()=>-1,getNode:()=>null,removeNodeFromMap(){},has:()=>!1,reset(){}};function P_(e,t,n={}){let r=null,i=0;return function(...o){const s=Date.now();i||!1!==n.leading||(i=s);const a=t-(s-i),l=this;a<=0||a>t?(r&&(clearTimeout(r),r=null),i=s,e.apply(l,o)):r||!1===n.trailing||(r=setTimeout(()=>{i=!1===n.leading?0:Date.now(),r=null,e.apply(l,o)},a))}}function N_(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(e){setTimeout(()=>{n.set.call(this,e)},0),o&&o.set&&o.set.call(this,e)}}),()=>N_(e,t,o||{},!0)}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(R_=new Proxy(R_,{get:(e,t,n)=>Reflect.get(e,t,n)}));var L_=Date.now;function D_(e){var t,n,r,i;const o=e.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:o.documentElement.scrollLeft||(null==o?void 0:o.body)&&(null==(t=z_.parentElement(o.body))?void 0:t.scrollLeft)||(null==(n=null==o?void 0:o.body)?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==o?void 0:o.documentElement.scrollTop)||(null==o?void 0:o.body)&&(null==(r=z_.parentElement(o.body))?void 0:r.scrollTop)||(null==(i=null==o?void 0:o.body)?void 0:i.scrollTop)||0}}function $_(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function j_(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function F_(e){return e?e.nodeType===e.ELEMENT_NODE?e:z_.parentElement(e):null}function U_(e,t,n,r){if(!e)return!1;const i=F_(e);if(!i)return!1;try{if("string"==typeof t){if(i.classList.contains(t))return!0;if(r&&null!==i.closest("."+t))return!0}else if(Gf(i,t,r))return!0}catch(o){}if(n){if(i.matches(n))return!0;if(r&&null!==i.closest(n))return!0}return!1}function B_(e,t,n){return!("TITLE"!==e.tagName||!n.headTitleMutations)||-2===t.getId(e)}function W_(e,t){if(mf(e))return!1;const n=t.getId(e);if(!t.has(n))return!0;const r=z_.parentNode(e);return(!r||r.nodeType!==e.DOCUMENT_NODE)&&(!r||W_(r,t))}function G_(e){return Boolean(e.changedTouches)}function H_(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function Z_(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function V_(e){return!!e&&(e instanceof v_&&"shadowRoot"in e?Boolean(e.shadowRoot):Boolean(z_.shadowRoot(e)))}/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())||(L_=()=>/* @__PURE__ */(new Date).getTime());var q_=class{constructor(){Xm(this,"id",1),Xm(this,"styleIDMap",/* @__PURE__ */new WeakMap),Xm(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 Y_(e){var t;let n=null;return"getRootNode"in e&&(null==(t=z_.getRootNode(e))?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&z_.host(z_.getRootNode(e))&&(n=z_.host(z_.getRootNode(e))),n}function J_(e){const t=z_.ownerDocument(e);if(!t)return!1;const n=function(e){let t,n=e;for(;t=Y_(n);)n=t;return n}(e);return z_.contains(t,n)}function K_(e){const t=z_.ownerDocument(e);return!!t&&(z_.contains(t,e)||J_(e))}var Q_=/* @__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))(Q_||{}),X_=/* @__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))(X_||{}),eS=/* @__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))(eS||{}),tS=/* @__PURE__ */(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(tS||{}),nS=/* @__PURE__ */(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(nS||{}),rS=/* @__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))(rS||{}),iS=/* @__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))(iS||{});function oS(e){return"__ln"in e}var sS,aS=class{constructor(){Xm(this,"length",0),Xm(this,"head",null),Xm(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&&oS(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&&oS(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--)}},lS=(e,t)=>`${e}@${t}`,cS=class{constructor(){Xm(this,"frozen",!1),Xm(this,"locked",!1),Xm(this,"texts",[]),Xm(this,"attributes",[]),Xm(this,"attributeMap",/* @__PURE__ */new WeakMap),Xm(this,"removes",[]),Xm(this,"mapRemoves",[]),Xm(this,"movedMap",{}),Xm(this,"addedSet",/* @__PURE__ */new Set),Xm(this,"movedSet",/* @__PURE__ */new Set),Xm(this,"droppedSet",/* @__PURE__ */new Set),Xm(this,"removesSubTreeCache",/* @__PURE__ */new Set),Xm(this,"mutationCb"),Xm(this,"blockClass"),Xm(this,"blockSelector"),Xm(this,"maskTextClass"),Xm(this,"maskTextSelector"),Xm(this,"inlineStylesheet"),Xm(this,"maskInputOptions"),Xm(this,"maskTextFn"),Xm(this,"maskInputFn"),Xm(this,"keepIframeSrcFn"),Xm(this,"recordCanvas"),Xm(this,"inlineImages"),Xm(this,"slimDOMOptions"),Xm(this,"dataURLOptions"),Xm(this,"doc"),Xm(this,"mirror"),Xm(this,"iframeManager"),Xm(this,"stylesheetManager"),Xm(this,"shadowDomManager"),Xm(this,"canvasManager"),Xm(this,"processedNodeManager"),Xm(this,"unattachedDoc"),Xm(this,"processMutations",e=>{e.forEach(this.processMutation),this.emit()}),Xm(this,"emit",()=>{if(this.frozen||this.locked)return;const e=[],t=/* @__PURE__ */new Set,n=new aS,r=e=>{let t=e,n=-2;for(;-2===n;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},i=i=>{const o=z_.parentNode(i);if(!o||!K_(i))return;let s=!1;if(i.nodeType===Node.TEXT_NODE){const e=o.tagName;if("TEXTAREA"===e)return;"STYLE"===e&&this.addedSet.has(o)&&(s=!0)}const a=mf(o)?this.mirror.getId(Y_(i)):this.mirror.getId(o),l=r(i);if(-1===a||-1===l)return n.addNode(i);const c=Yf(i,{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=>{H_(e,this.mirror)&&this.iframeManager.addIframe(e),Z_(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),V_(i)&&this.shadowDomManager.addShadowRoot(z_.shadowRoot(i),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)uS(this.removesSubTreeCache,a,this.mirror)&&!this.movedSet.has(z_.parentNode(a))||i(a);for(const a of this.addedSet)pS(this.droppedSet,a)||uS(this.removesSubTreeCache,a,this.mirror)?pS(this.movedSet,a)?i(a):this.droppedSet.add(a):i(a);let o=null;for(;n.length;){let e=null;if(o){const t=this.mirror.getId(z_.parentNode(o.value)),n=r(o.value);-1!==t&&-1!==n&&(e=o)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(z_.parentNode(n.value));if(-1===r(n.value))continue;if(-1!==t){e=n;break}{const t=n.value,r=z_.parentNode(t);if(r&&r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const t=z_.host(r);if(-1!==this.mirror.getId(t)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}o=e.previous,n.removeNode(e.value),i(e.value)}const s={texts:this.texts.map(e=>{const t=e.node,n=z_.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))}),Xm(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(z_.childNodes(e),e=>z_.textContent(e)||"").join("");t.attributes.value=bf({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:kf(e),value:n,maskInputFn:this.maskInputFn})}),Xm(this,"processMutation",e=>{if(!B_(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{const t=z_.textContent(e.target);U_(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:Hf(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,F_(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let r=e.attributeName,i=e.target.getAttribute(r);if("value"===r){const e=kf(n);i=bf({element:n,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:i,maskInputFn:this.maskInputFn})}if(U_(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue)return;let o=this.attributeMap.get(e.target);if("IFRAME"===n.tagName&&"src"===r&&!this.keepIframeSrcFn(i)){if(n.contentDocument)return;r="rr_src"}if(o||(o={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(o),this.attributeMap.set(e.target,o)),"type"===r&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!Wf(n.tagName,r))if(o.attributes[r]=Bf(this.doc,vf(n.tagName),vf(r),i),"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),i=n.style.getPropertyPriority(e);t!==r.style.getPropertyValue(e)||i!==r.style.getPropertyPriority(e)?o.styleDiff[e]=""===i?t:[t,i]:o._unchangedStyles[e]=[t,i]}for(const e of Array.from(r.style))""===n.style.getPropertyValue(e)&&(o.styleDiff[e]=!1)}else"open"===r&&"DIALOG"===n.tagName&&(n.matches("dialog:modal")?o.attributes.rr_open_mode="modal":o.attributes.rr_open_mode="non-modal");break}case"childList":if(U_(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=mf(e.target)?this.mirror.getId(z_.host(e.target)):this.mirror.getId(e.target);U_(e.target,this.blockClass,this.blockSelector,!1)||B_(t,this.mirror,this.slimDOMOptions)||!function(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(dS(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||W_(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[lS(n,r)]?dS(this.movedSet,t):(this.removes.push({parentId:r,id:n,isShadow:!(!mf(e.target)||!ff(e.target))||void 0}),function(e,t){const n=[e];for(;n.length;){const e=n.pop();t.has(e)||(t.add(e),z_.childNodes(e).forEach(e=>n.push(e)))}}(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}}),Xm(this,"genAdds",(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(B_(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[lS(this.mirror.getId(e),n)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);U_(e,this.blockClass,this.blockSelector,!1)||(z_.childNodes(e).forEach(e=>this.genAdds(e)),V_(e)&&z_.childNodes(z_.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 dS(e,t){e.delete(t),z_.childNodes(t).forEach(t=>dS(e,t))}function uS(e,t,n){return 0!==e.size&&function(e,t){const n=z_.parentNode(t);return!!n&&e.has(n)}(e,t)}function pS(e,t){return 0!==e.size&&hS(e,t)}function hS(e,t){const n=z_.parentNode(t);return!!n&&(!!e.has(n)||hS(e,n))}var mS=e=>{if(!sS)return e;return(...t)=>{try{return e(...t)}catch(n){if(sS&&!0===sS(n))return;throw n}}},fS=[];function gS(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 yS(e,t){const n=new cS;fS.push(n),n.init(e);const r=new(A_())(mS(n.processMutations.bind(n)));return r.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function wS({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(!1===o.mouseInteraction)return()=>{};const s=!0===o.mouseInteraction||void 0===o.mouseInteraction?{}:o.mouseInteraction,a=[];let l=null;return Object.keys(eS).filter(e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==s[e]).forEach(o=>{let s=vf(o);const c=(t=>o=>{const s=gS(o);if(U_(s,r,i,!0))return;let a=null,c=t;if("pointerType"in o){switch(o.pointerType){case"mouse":a=tS.Mouse;break;case"touch":a=tS.Touch;break;case"pen":a=tS.Pen}a===tS.Touch?eS[t]===eS.MouseDown?c="TouchStart":eS[t]===eS.MouseUp&&(c="TouchEnd"):tS.Pen}else G_(o)&&(a=tS.Touch);null!==a?(l=a,(c.startsWith("Touch")&&a===tS.Touch||c.startsWith("Mouse")&&a===tS.Mouse)&&(a=null)):eS[t]===eS.Click&&(a=l,l=null);const d=G_(o)?o.changedTouches[0]:o;if(!d)return;const u=n.getId(s),{clientX:p,clientY:h}=d;mS(e)({type:eS[c],id:u,x:p,y:h,...null!==a&&{pointerType:a}})})(o);if(window.PointerEvent)switch(eS[o]){case eS.MouseDown:case eS.MouseUp:s=s.replace("mouse","pointer");break;case eS.TouchStart:case eS.TouchEnd:return}a.push(O_(s,c,t))}),mS(()=>{a.forEach(e=>e())})}function bS({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){return O_("scroll",mS(P_(mS(o=>{const s=gS(o);if(!s||U_(s,r,i,!0))return;const a=n.getId(s);if(s===t&&t.defaultView){const n=D_(t.defaultView);e({id:a,x:n.left,y:n.top})}else e({id:a,x:s.scrollLeft,y:s.scrollTop})}),o.scroll||100)),t)}var vS=["INPUT","TEXTAREA","SELECT"],xS=/* @__PURE__ */new WeakMap;function kS(e){return function(e,t){if(IS("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||IS("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||IS("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||IS("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 _S(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function SS({mirror:e,stylesheetManager:t},n){var r,i,o;let s=null;s="#document"===n.nodeName?e.getId(n):e.getId(z_.host(n));const a="#document"===n.nodeName?null==(r=n.defaultView)?void 0:r.Document:null==(o=null==(i=n.ownerDocument)?void 0:i.defaultView)?void 0:o.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(i){}return r}}),mS(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})):()=>{}}function CS(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let r;!function(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,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),i(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),o(...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=yS(e,e.doc));const i=function({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(!1===t.mousemove)return()=>{};const i="number"==typeof t.mousemove?t.mousemove:50,o="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let s,a=[];const l=P_(mS(t=>{const n=Date.now()-s;e(a.map(e=>(e.timeOffset-=n,e)),t),a=[],s=null}),o),c=mS(P_(mS(e=>{const t=gS(e),{clientX:n,clientY:i}=G_(e)?e.changedTouches[0]:e;s||(s=L_()),a.push({x:n,y:i,id:r.getId(t),timeOffset:L_()-s}),l("undefined"!=typeof DragEvent&&e instanceof DragEvent?X_.Drag:e instanceof MouseEvent?X_.MouseMove:X_.TouchMove)}),i,{trailing:!1})),d=[O_("mousemove",c,n),O_("touchmove",c,n),O_("drag",c,n)];return mS(()=>{d.forEach(e=>e())})}(e),o=wS(e),s=bS(e),a=function({viewportResizeCb:e},{win:t}){let n=-1,r=-1;return O_("resize",mS(P_(mS(()=>{const t=$_(),i=j_();n===t&&r===i||(e({width:Number(i),height:Number(t)}),n=t,r=i)}),200)),t)}(e,{win:n}),l=function({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:d}){function u(e){let n=gS(e);const c=e.isTrusted,u=n&&n.tagName;if(n&&"OPTION"===u&&(n=z_.parentElement(n)),!n||!u||vS.indexOf(u)<0||U_(n,r,i,!0))return;if(n.classList.contains(o)||s&&n.matches(s))return;let h=n.value,m=!1;const f=kf(n)||"";"radio"===f||"checkbox"===f?m=n.checked:(a[u.toLowerCase()]||a[f])&&(h=bf({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 i=xS.get(t);if(!i||i.text!==r.text||i.isChecked!==r.isChecked){xS.set(t,r);const i=n.getId(t);mS(e)({...r,id:i})}}const h=("last"===c.input?["change"]:["input","change"]).map(e=>O_(e,mS(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=>N_(e[0],e[1],{set(){mS(u)({target:this,isTrusted:!1})}},!1,m))),mS(()=>{h.forEach(e=>e())})}(e),c=function({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i,doc:o}){const s=mS(o=>P_(mS(i=>{const s=gS(i);if(!s||U_(s,t,n,!0))return;const{currentTime:a,volume:l,muted:c,playbackRate:d,loop:u}=s;e({type:o,id:r.getId(s),currentTime:a,volume:l,muted:c,playbackRate:d,loop:u})}),i.media||500)),a=[O_("play",s(rS.Play),o),O_("pause",s(rS.Pause),o),O_("seeked",s(rS.Seeked),o),O_("volumechange",s(rS.VolumeChange),o),O_("ratechange",s(rS.RateChange),o)];return mS(()=>{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 i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:mS((r,i,o)=>{const[s,a]=o,{id:l,styleId:c}=_S(i,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:s,index:a}]}),r.apply(i,o)})}),r.CSSStyleSheet.prototype.addRule=function(e,t,n=this.cssRules.length){const i=`${e} { ${t} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[i,n])};const o=r.CSSStyleSheet.prototype.deleteRule;let s,a;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:s}]}),r.apply(i,o)})}),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:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replace:s}),r.apply(i,o)})})),r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,replaceSync:s}),r.apply(i,o)})}));const l={};ES("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(ES("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),ES("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),ES("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const c={};return Object.entries(l).forEach(([r,i])=>{c[r]={insertRule:i.prototype.insertRule,deleteRule:i.prototype.deleteRule},i.prototype.insertRule=new Proxy(c[r].insertRule,{apply:mS((r,i,o)=>{const[s,a]=o,{id:l,styleId:c}=_S(i.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||c&&-1!==c)&&e({id:l,styleId:c,adds:[{rule:s,index:[...kS(i),a||0]}]}),r.apply(i,o)})}),i.prototype.deleteRule=new Proxy(c[r].deleteRule,{apply:mS((r,i,o)=>{const[s]=o,{id:a,styleId:l}=_S(i.parentStyleSheet,t,n.styleMirror);return(a&&-1!==a||l&&-1!==l)&&e({id:a,styleId:l,removes:[{index:[...kS(i),s]}]}),r.apply(i,o)})})}),mS(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,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=SS(e,e.doc),p=function({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:mS((i,s,a)=>{var l;const[c,d,u]=a;if(n.has(c))return o.apply(s,[c,d,u]);const{id:p,styleId:h}=_S(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:kS(s.parentRule)}),i.apply(s,a)})});const s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:mS((i,o,a)=>{var l;const[c]=a;if(n.has(c))return s.apply(o,[c]);const{id:d,styleId:u}=_S(null==(l=o.parentRule)?void 0:l.parentStyleSheet,t,r.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,remove:{property:c},index:kS(o.parentRule)}),i.apply(o,a)})}),mS(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}(e,{win:n}),e.collectFonts&&(h=function({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=/* @__PURE__ */new WeakMap,o=n.FontFace;n.FontFace=function(e,t,n){const r=new o(e,t,n);return i.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=M_(t.fonts,"add",function(t){return function(n){return setTimeout(mS(()=>{const t=i.get(n);t&&(e(t),i.delete(n))}),0),t.apply(this,[n])}});return r.push(()=>{n.FontFace=o}),r.push(s),mS(()=>{r.forEach(e=>e())})}(e)));const m=function(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let s=!0;const a=mS(()=>{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:o,startOffset:s,endContainer:l,endOffset:c}=e.getRangeAt(t);U_(o,r,i,!0)||U_(l,r,i,!0)||a.push({start:n.getId(o),startOffset:s,end:n.getId(l),endOffset:c})}o({ranges:a})});return a(),O_("selectionchange",a)}(e),f=function({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?M_(n.customElements,"define",function(e){return function(n,r,i){try{t({define:{name:n}})}catch(o){}return e.apply(this,[n,r,i])}}):()=>{}}(e),g=[];for(const y of e.plugins)g.push(y.observer(y.callback,n,y.options));return mS(()=>{fS.forEach(e=>e.reset()),r?.disconnect(),i(),o(),s(),a(),l(),c(),d(),u(),p(),h(),m(),f(),g.forEach(e=>e())})}function IS(e){return void 0!==window[e]}function ES(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}for(var TS=class{constructor(e){Xm(this,"iframeIdToRemoteIdMap",/* @__PURE__ */new WeakMap),Xm(this,"iframeRemoteIdToIdMap",/* @__PURE__ */new WeakMap),this.generateIdFn=e}getId(e,t,n,r){const i=n||this.getIdToRemoteIdMap(e),o=r||this.getRemoteIdToIdMap(e);let s=i.get(t);return s||(s=this.generateIdFn(),i.set(t,s),o.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 i=r.get(t);return i||-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}},AS=class{constructor(e){Xm(this,"iframes",/* @__PURE__ */new WeakMap),Xm(this,"crossOriginIframeMap",/* @__PURE__ */new WeakMap),Xm(this,"crossOriginIframeMirror",new TS(Nf)),Xm(this,"crossOriginIframeStyleMirror"),Xm(this,"crossOriginIframeRootIdMap",/* @__PURE__ */new WeakMap),Xm(this,"mirror"),Xm(this,"mutationCb"),Xm(this,"wrappedEmit"),Xm(this,"loadListener"),Xm(this,"stylesheetManager"),Xm(this,"recordCrossOriginIframes"),this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new TS(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 Q_.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:Q_.IncrementalSnapshot,data:{source:X_.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Q_.Meta:case Q_.Load:case Q_.DomContentLoaded:return!1;case Q_.Plugin:return t;case Q_.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case Q_.IncrementalSnapshot:switch(t.data.source){case X_.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 X_.Drag:case X_.TouchMove:case X_.MouseMove:return t.data.positions.forEach(t=>{this.replaceIds(t,e,["id"])}),t;case X_.ViewportResize:return!1;case X_.MediaInteraction:case X_.MouseInteraction:case X_.Scroll:case X_.CanvasMutation:case X_.Input:return this.replaceIds(t.data,e,["id"]),t;case X_.StyleSheetRule:case X_.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case X_.Font:return t;case X_.Selection:return t.data.ranges.forEach(t=>{this.replaceIds(t,e,["start","end"])}),t;case X_.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 i of r)(Array.isArray(t[i])||"number"==typeof t[i])&&(Array.isArray(t[i])?t[i]=e.getIds(n,t[i]):t[i]=e.getId(n,t[i]));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===iS.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(e=>{this.patchRootIdOnNode(e,t)})}},MS=class{constructor(e){Xm(this,"shadowDoms",/* @__PURE__ */new WeakSet),Xm(this,"mutationCb"),Xm(this,"scrollCb"),Xm(this,"bypassOptions"),Xm(this,"mirror"),Xm(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(!ff(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=yS({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(bS({...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(z_.host(e))),this.restoreHandlers.push(SS({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(M_(e.prototype,"attachShadow",function(e){return function(r){const i=e.call(this,r),o=z_.shadowRoot(this);return o&&K_(this)&&n.addShadowRoot(o,t),i}}))}reset(){this.restoreHandlers.forEach(e=>{try{e()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=/* @__PURE__ */new WeakSet}},zS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",OS="undefined"==typeof Uint8Array?[]:new Uint8Array(256),RS=0;RS<64;RS++)OS[zS.charCodeAt(RS)]=RS;var PS=function(e){var t,n=new Uint8Array(e),r=n.length,i="";for(t=0;t<r;t+=3)i+=zS[n[t]>>2],i+=zS[(3&n[t])<<4|n[t+1]>>4],i+=zS[(15&n[t+1])<<2|n[t+2]>>6],i+=zS[63&n[t+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i},NS=/* @__PURE__ */new Map;var LS=(e,t,n)=>{if(!e||!jS(e,t)&&"object"!=typeof e)return;const r=function(e,t){let n=NS.get(e);return n||(n=/* @__PURE__ */new Map,NS.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let i=r.indexOf(e);return-1===i&&(i=r.length,r.push(e)),i};function DS(e,t,n){if(e instanceof Array)return e.map(e=>DS(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:PS(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[DS(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:[DS(e.data,t,n),e.width,e.height]}:jS(e,t)||"object"==typeof e?{rr_type:e.constructor.name,index:LS(e,t,n)}:e}var $S=(e,t,n)=>e.map(e=>DS(e,t,n)),jS=(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 FS(e,t,n,r){const i=[];try{const o=M_(e.HTMLCanvasElement.prototype,"getContext",function(e){return function(i,...o){if(!U_(this,t,n,!0)){const e=function(e){return"experimental-webgl"===e?"webgl":e}(i);if("__context"in this||(this.__context=e),r&&["webgl","webgl2"].includes(e))if(o[0]&&"object"==typeof o[0]){const e=o[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else o.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[i,...o])}});i.push(o)}catch{}return()=>{i.forEach(e=>e())}}function US(e,t,n,r,i,o){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=M_(e,l,function(e){return function(...s){const a=e.apply(this,s);if(LS(a,o,this),"tagName"in this.canvas&&!U_(this.canvas,r,i,!0)){const e={type:t,property:l,args:$S(s,o,this)};n(this.canvas,e)}return a}});s.push(a)}catch{const r=N_(e,l,{set(e){n(this.canvas,{type:t,property:l,args:[e],setter:!0})}});s.push(r)}return s}var BS="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",WS="undefined"!=typeof window&&window.Blob&&new Blob([(e=>Uint8Array.from(atob(e),e=>e.charCodeAt(0)))(BS)],{type:"text/javascript;charset=utf-8"});function GS(e){let t;try{if(t=WS&&(window.URL||window.webkitURL).createObjectURL(WS),!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,"+BS,{name:null==e?void 0:e.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var HS,ZS,VS,qS=class{constructor(e){Xm(this,"pendingCanvasMutations",/* @__PURE__ */new Map),Xm(this,"rafStamps",{latestId:0,invokeId:null}),Xm(this,"mirror"),Xm(this,"mutationCb"),Xm(this,"resetObservers"),Xm(this,"frozen",!1),Xm(this,"locked",!1),Xm(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:i,recordCanvas:o,dataURLOptions:s}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,o&&"all"===t&&this.initCanvasMutationObserver(n,r,i),o&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,r,i,{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,i){const o=FS(t,n,r,!0),s=/* @__PURE__ */new Map,a=new GS;a.onmessage=e=>{const{id:t}=e.data;if(s.set(t,!1),!("base64"in e.data))return;const{base64:n,type:r,width:i,height:o}=e.data;this.mutationCb({id:t,type:nS["2D"],commands:[{property:"clearRect",args:[0,0,i,o]},{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=>{U_(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:i.dataURLOptions},[r])})),c=requestAnimationFrame(u)};c=requestAnimationFrame(u),this.resetObservers=()=>{o(),cancelAnimationFrame(c)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=FS(e,t,n,!1),i=function(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const s of o)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[s])continue;const o=M_(t.CanvasRenderingContext2D.prototype,s,function(i){return function(...o){return U_(this.canvas,n,r,!0)||setTimeout(()=>{const n=$S(o,t,this);e(this.canvas,{type:nS["2D"],property:s,args:n})},0),i.apply(this,o)}});i.push(o)}catch{const n=N_(t.CanvasRenderingContext2D.prototype,s,{set(t){e(this.canvas,{type:nS["2D"],property:s,args:[t],setter:!0})}});i.push(n)}return()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n),o=function(e,t,n,r){const i=[];return i.push(...US(t.WebGLRenderingContext.prototype,nS.WebGL,e,n,r,t)),void 0!==t.WebGL2RenderingContext&&i.push(...US(t.WebGL2RenderingContext.prototype,nS.WebGL2,e,n,r,t)),()=>{i.forEach(e=>e())}}(this.processMutation.bind(this),e,t,n);this.resetObservers=()=>{r(),i(),o()}}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:i}=n[0];this.mutationCb({id:t,type:i,commands:r}),this.pendingCanvasMutations.delete(e)}},YS=class{constructor(e){Xm(this,"trackedLinkElements",/* @__PURE__ */new WeakSet),Xm(this,"mutationCb"),Xm(this,"adoptedStyleSheetCb"),Xm(this,"styleMirror",new q_),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 i of e){let e;this.styleMirror.has(i)?e=this.styleMirror.getId(i):(e=this.styleMirror.add(i),r.push({styleId:e,rules:Array.from(i.rules||CSSRule,(e,t)=>({rule:yf(e,i.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){}},JS=class{constructor(){Xm(this,"nodeMap",/* @__PURE__ */new WeakMap),Xm(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(){}},KS=!1;try{if(2!==Array.from([1],e=>2*e)[0]){const e=document.createElement("iframe");document.body.appendChild(e),Array.from=(null==(Wm=e.contentWindow)?void 0:Wm.Array.from)||Array.from,document.body.removeChild(e)}}catch(KC){}var QS,XS,eC=new wf;function tC(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=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:z}=e;sS=z;const O=!_||window.parent===window;let R=!1;if(!O)try{window.parent.document&&(R=!1)}catch(Z){R=!0}if(O&&!t)throw new Error("emit function is required");if(!O&&!R)return()=>{};void 0!==v&&void 0===w.mousemove&&(w.mousemove=v),eC.reset();const P=!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},N=qf(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};HS=(e,i)=>{var o;const s=e;if(s.timestamp=L_(),!(null==(o=fS[0])?void 0:o.isFrozen())||s.type===Q_.FullSnapshot||s.type===Q_.IncrementalSnapshot&&s.data.source===X_.Mutation||fS.forEach(e=>e.unfreeze()),O)t?.($(s),i);else if(R){const e={type:"rrweb",event:$(s),origin:window.location.origin,isCheckout:i};window.parent.postMessage(e,"*")}if(s.type===Q_.FullSnapshot)L=s,D=0;else if(s.type===Q_.IncrementalSnapshot){if(s.data.source===X_.Mutation&&s.data.isAttachIframe)return;D++;const e=r&&D>=r,t=n&&s.timestamp-L.timestamp>n;(e||t)&&ZS(!0)}};const j=e=>{HS({type:Q_.IncrementalSnapshot,data:{source:X_.Mutation,...e}})},F=e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.Scroll,...e}}),U=e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.CanvasMutation,...e}}),B=new YS({mutationCb:j,adoptedStyleSheetCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.AdoptedStyleSheet,...e}})}),W=new AS({mirror:eC,mutationCb:j,stylesheetManager:B,recordCrossOriginIframes:_,wrappedEmit:HS});for(const q of T||[])q.getMirror&&q.getMirror({nodeMirror:eC,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const G=new JS;VS=new qS({recordCanvas:k,mutationCb:U,win:window,blockClass:i,blockSelector:o,mirror:eC,sampling:w.canvas,dataURLOptions:b});const H=new MS({mutationCb:j,scrollCb:F,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:P,dataURLOptions:b,maskTextFn:f,maskInputFn:m,recordCanvas:k,inlineImages:E,sampling:w,slimDOMOptions:N,iframeManager:W,stylesheetManager:B,canvasManager:VS,keepIframeSrcFn:A,processedNodeManager:G},mirror:eC});ZS=(e=!1)=>{if(!x)return;HS({type:Q_.Meta,data:{href:window.location.href,width:j_(),height:$_()}},e),B.reset(),H.init(),fS.forEach(e=>e.lock());const t=function(e,t){const{mirror:n=new wf,blockClass:r="rr-block",blockSelector:i=null,maskTextClass:o="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 Yf(e,{doc:e,mirror:n,blockClass:r,blockSelector:i,maskTextClass:o,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:qf(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:eC,blockClass:i,blockSelector:o,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:P,maskTextFn:f,maskInputFn:m,slimDOM:N,dataURLOptions:b,recordCanvas:k,inlineImages:E,onSerialize:e=>{H_(e,eC)&&W.addIframe(e),Z_(e,eC)&&B.trackLinkElement(e),V_(e)&&H.addShadowRoot(z_.shadowRoot(e),document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{B.attachLinkElement(e,t)},keepIframeSrcFn:A});t&&(HS({type:Q_.FullSnapshot,data:{node:t,initialOffset:D_(window)}},e),fS.forEach(e=>e.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&B.adoptStyleSheets(document.adoptedStyleSheets,eC.getId(document)))};try{const e=[],t=e=>{var t;return mS(CS)({mutationCb:j,mousemoveCb:(e,t)=>HS({type:Q_.IncrementalSnapshot,data:{source:t,positions:e}}),mouseInteractionCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.MouseInteraction,...e}}),scrollCb:F,viewportResizeCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.ViewportResize,...e}}),inputCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.Input,...e}}),mediaInteractionCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.MediaInteraction,...e}}),styleSheetRuleCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.StyleSheetRule,...e}}),styleDeclarationCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.StyleDeclaration,...e}}),canvasMutationCb:U,fontCb:e=>HS({type:Q_.IncrementalSnapshot,data:{source:X_.Font,...e}}),selectionCb:e=>{HS({type:Q_.IncrementalSnapshot,data:{source:X_.Selection,...e}})},customElementCb:e=>{HS({type:Q_.IncrementalSnapshot,data:{source:X_.CustomElement,...e}})},blockClass:i,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:P,inlineStylesheet:d,sampling:w,recordDOM:x,recordCanvas:k,inlineImages:E,userTriggeredOnInput:C,collectFonts:I,doc:e,maskInputFn:m,maskTextFn:f,keepIframeSrcFn:A,blockSelector:o,slimDOMOptions:N,dataURLOptions:b,mirror:eC,iframeManager:W,stylesheetManager:B,shadowDomManager:H,processedNodeManager:G,canvasManager:VS,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=>HS({type:Q_.Plugin,data:{plugin:e.name,payload:t}})})))||[]},g)};W.addLoadListener(n=>{try{e.push(t(n.contentDocument))}catch(r){}});const n=()=>{ZS(),e.push(t(document)),KS=!0};return["interactive","complete"].includes(document.readyState)?n():(e.push(O_("DOMContentLoaded",()=>{HS({type:Q_.DomContentLoaded,data:{}}),"DOMContentLoaded"===S&&n()})),e.push(O_("load",()=>{HS({type:Q_.Load,data:{}}),"load"===S&&n()},window))),()=>{e.forEach(e=>{try{e()}catch(t){String(t).toLowerCase().includes("cross-origin")}}),G.destroy(),KS=!1,sS=void 0}}catch(V){}}tC.addCustomEvent=(e,t)=>{if(!KS)throw new Error("please add custom event after start recording");HS({type:Q_.Custom,data:{tag:e,payload:t}})},tC.freezePage=()=>{fS.forEach(e=>e.freeze())},tC.takeFullSnapshot=e=>{if(!KS)throw new Error("please take full snapshot after start recording");ZS(e)},tC.mirror=eC,(XS=QS||(QS={}))[XS.NotStarted=0]="NotStarted",XS[XS.Running=1]="Running",XS[XS.Stopped=2]="Stopped";var nC=id("SessionRecorder"),rC=500,iC=5e5,oC=class{eventQueue=[];estimatedQueueBytes=0;sessionId;stopRecording=null;isRecording=!1;chatId;applicationId;metadataSent=!1;startPromise=null;stopRequested=!1;flushTimer=null;consecutiveFailures=0;isFlushing=!1;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");nC.info("Constructor called with chatId:",e,"applicationId:",t),this.chatId=e,this.applicationId=t,this.sessionId=e,nC.info("Initialized with sessionId:",this.sessionId)}async sendMetadata(){this.metadataSent?nC.warn("Metadata already sent, skipping"):(nC.info("Sending rrweb/metadata via POST"),await Vc.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(),viewport:{width:window.innerWidth,height:window.innerHeight}}}),this.metadataSent=!0,nC.info("✅ rrweb/metadata sent successfully"))}bufferEvent(e){if(this.eventQueue.push(e),this.estimatedQueueBytes+=new Blob([JSON.stringify(e)]).size,this.eventQueue.length>rC){const e=this.eventQueue.length-rC,t=this.eventQueue.splice(0,e);for(const n of t)this.estimatedQueueBytes-=JSON.stringify(n).length;nC.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.isFlushing)return;if(this.isFlushing=!0,this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),0===this.eventQueue.length)return void(this.isFlushing=!1);let e,t;if(this.estimatedQueueBytes<=iC)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>iC&&e.length>0)break;const i=this.eventQueue.shift();void 0!==i&&e.push(i),t+=r,this.estimatedQueueBytes-=r}this.eventQueue.length>0&&!this.flushTimer&&(this.flushTimer=setTimeout(()=>{this.flushTimer=null,this.flush()},0))}nC.debug(`Flushing ${e.length} events (~${t} bytes)`),Vc.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 nC.error(`Dropping ${e.length} events after permanent ${String(r)} error:`,n),void(this.consecutiveFailures=0);if(this.consecutiveFailures++,this.consecutiveFailures>5)return nC.error(`Dropping ${e.length} events after 5 consecutive failures:`,n),void(this.consecutiveFailures=0);if(nC.error(`Failed to flush events (attempt ${this.consecutiveFailures}/5), re-queuing:`,n),this.eventQueue=e.concat(this.eventQueue),this.estimatedQueueBytes+=t,this.eventQueue.length>rC){const e=this.eventQueue.length-rC,t=this.eventQueue.splice(0,e);for(const n of t)this.estimatedQueueBytes-=JSON.stringify(n).length;nC.warn(`⚠️ Event queue exceeded 500 after re-queue, dropped ${e} oldest events`)}}).finally(()=>{this.isFlushing=!1})}async start(){if(this.isRecording)nC.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(nC.info("🚀 start() called"),await this.sendMetadata(),this.stopRequested)throw new Error("Recording stopped during startup");this.stopRecording=tC({emit:e=>{this.bufferEvent(e)},recordCanvas:!1,recordCrossOriginIframes:!1,maskAllInputs:!1,collectFonts:!1,inlineStylesheet:!0,blockClass:"rr-block",ignoreClass:"rr-ignore"}),this.isRecording=!0,nC.info("Recording started with chatId:",this.sessionId)}catch(e){throw nC.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,nC.info("Recording stopped")}getSessionId(){return this.sessionId}isActive(){return this.isRecording}},sC=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 Vc.widgetSearch({marketrix_id:e,marketrix_key:t});if(!r||0===r.length)return{isValid:!1,error:"Widget not found or invalid credentials"};const i=r.find(e=>"widget"===e.type&&"active"===e.status);if(!i){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(!i.agent_id)return{isValid:!1,error:"Widget missing agent_id",widget:i};try{const e=await Vc.agentGet({agent_id:i.agent_id});if(!i.application_id)return{isValid:!1,error:"Widget missing application_id",widget:i,agent:e};return{isValid:!0,widget:i,agent:e,application:await Vc.applicationGet({application_id:i.application_id})}}catch(n){return{isValid:!1,error:`Failed to validate agent: ${Yc(n)}`,widget:i}}}catch(r){return Jc(r,"Widget validation",this.config)}}async validateByAgentAndApplication(e,t){try{const n=await Vc.applicationGet({application_id:e}),r=await Vc.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 Jc(n,"Agent and application validation",this.config)}}},aC=null,lC=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{aC||(aC=await Vc.widgetGetDefaults({type:"widget"}));const e=aC;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 Vc.widgetSearch({type:"widget",marketrix_id:this.mtxId,marketrix_key:this.mtxKey})).items;else{if(!this.mtxApp)return null;t=(await Vc.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)&&Od(n,"widget_enabled")&&"boolean"==typeof n.widget_enabled&&Od(n,"widget_appearance")&&"string"==typeof n.widget_appearance&&Od(n,"widget_position")&&"string"==typeof n.widget_position?t:null;var n}},cC="#6b7280",dC="#1f2937",uC="rgba(255, 255, 255, 0.95)",pC="rgba(255, 255, 255, 0.2)",hC="rgba(0, 0, 0, 0.15)",mC=({message:e="Loading widget settings..."})=>{const[t,n]=p(!1),r=e?.includes("marketrix_id")||e?.includes("marketrix_key");return t?null:/* @__PURE__ */g(Op,{position:"fixed",style:{bottom:"20px",left:"50%",transform:"translateX(-50%)",maxWidth:"420px",backgroundColor:uC,borderRadius:r?"18px":"999px",boxShadow:`0 2px 12px ${hC}`,display:"flex",flexDirection:"column",alignItems:"stretch",gap:"8px",padding:"10px 12px",border:`1px solid ${pC}`,zIndex:9999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'},children:[/* @__PURE__ */g(_h,{align:"center",style:{gap:"10px"},children:[
|
|
66
66
|
/* @__PURE__ */f(Np,{src:Rp,alt:"",size:28,style:{borderRadius:"50%",overflow:"hidden",flexShrink:0}}),
|
|
67
67
|
/* @__PURE__ */f(Ph,{as:"span",style:{fontSize:"13px",color:dC,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1,minWidth:0},children:e}),
|
|
68
68
|
/* @__PURE__ */f(Ah,{label:"Dismiss",onClick:()=>n(!0),style:{background:"none",border:"none",cursor:"pointer",padding:"2px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:cC,borderRadius:"50%",width:"20px",height:"20px",minWidth:"unset"},children:/* @__PURE__ */f(Ch,{name:"closeSmall",size:12})})]}),r?/* @__PURE__ */f(Ph,{as:"p",style:{fontSize:"12px",color:cC,textAlign:"left",margin:0},children:"Please configure marketrix_id and marketrix_key"}):null]})},fC='/*! 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-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-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--tracking-normal:0em;--tracking-wide:.025em;--leading-tight:1.25;--leading-snug:1.375;--leading-normal:1.5;--leading-relaxed:1.625;--shadow-2xs: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;--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-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.inset-2{inset:calc(var(--spacing) * 2)}.inset-3{inset:calc(var(--spacing) * 3)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.top-1\\/2{top:50%}.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-4{right:calc(var(--spacing) * 4)}.right-5{right:calc(var(--spacing) * 5)}.right-full{right:100%}.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-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-\\[calc\\(var\\(--layer-dialog\\)\\+1\\)\\]{z-index:calc(var(--layer-dialog) + 1)}.z-\\[var\\(--layer-popover\\)\\]{z-index:var(--layer-popover)}.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-0{margin:calc(var(--spacing) * 0)}.m-2{margin:calc(var(--spacing) * 2)}.m-32{margin:calc(var(--spacing) * 32)}.mx-3{margin-inline:calc(var(--spacing) * 3)}.my-0\\.5{margin-block:calc(var(--spacing) * .5)}.mt-0\\.5{margin-top:calc(var(--spacing) * .5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.-mr-1{margin-right:calc(var(--spacing) * -1)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-0{margin-bottom:calc(var(--spacing) * 0)}.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-4{margin-bottom:calc(var(--spacing) * 4)}.ml-2{margin-left:calc(var(--spacing) * 2)}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.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-3\\.5{height:calc(var(--spacing) * 3.5)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-12{height:calc(var(--spacing) * 12)}.h-14{height:calc(var(--spacing) * 14)}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[85vh\\]{max-height:85vh}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-7{min-height:calc(var(--spacing) * 7)}.min-h-9{min-height:calc(var(--spacing) * 9)}.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-3\\.5{width:calc(var(--spacing) * 3.5)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-64{width:calc(var(--spacing) * 64)}.w-auto{width:auto}.w-full{width:100%}.max-w-\\[500px\\]{max-width:500px}.max-w-sm{max-width:var(--container-sm)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-5{min-width:calc(var(--spacing) * 5)}.min-w-7{min-width:calc(var(--spacing) * 7)}.min-w-14{min-width:calc(var(--spacing) * 14)}.min-w-\\[180px\\]{min-width:180px}.flex-1{flex:1}.flex-shrink{flex-shrink:1}.flex-shrink-0{flex-shrink:0}.shrink{flex-shrink:1}.grow{flex-grow:1}.-translate-x-1\\/2{--tw-translate-x:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-0{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x) var(--tw-scale-y)}.scale-100{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-dialog-content-in{animation:dialog-content-in var(--duration-animation) ease-out}.animate-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-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.resize-none{resize:none}.resize-y{resize:vertical}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.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-4{gap:calc(var(--spacing) * 4)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.overflow-y-hidden{overflow-y:hidden}.rounded{border-radius:.25rem}.rounded-\\[var\\(--radius\\)\\]{border-radius:var(--radius)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\\[1\\.5px\\]{border-style:var(--tw-border-style);border-width:1.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-4{border-top-style:var(--tw-border-style);border-top-width:4px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.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{border-left-style:var(--tw-border-style);border-left-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-border{border-color:var(--border)}.border-current{border-color:currentColor}.border-gray-200{border-color:var(--color-gray-200)}.border-input{border-color:var(--input)}.border-transparent{border-color:#0000}.border-white\\/25{border-color:#ffffff40}@supports (color:color-mix(in lab, red, red)){.border-white\\/25{border-color:color-mix(in oklab, var(--color-white) 25%, transparent)}}.border-t-transparent{border-top-color:#0000}.bg-background{background-color:var(--background)}.bg-card{background-color:var(--card)}.bg-chart-1\\/15{background-color:var(--chart-1)}@supports (color:color-mix(in lab, red, red)){.bg-chart-1\\/15{background-color:color-mix(in oklab, var(--chart-1) 15%, transparent)}}.bg-current{background-color:currentColor}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-900{background-color:var(--color-gray-900)}.bg-muted{background-color:var(--muted)}.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-success\\/15{background-color:var(--success)}@supports (color:color-mix(in lab, red, red)){.bg-success\\/15{background-color:color-mix(in oklab, var(--success) 15%, transparent)}}.bg-transparent{background-color:#0000}.bg-warning\\/15{background-color:var(--warning)}@supports (color:color-mix(in lab, red, red)){.bg-warning\\/15{background-color:color-mix(in oklab, var(--warning) 15%, transparent)}}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing) * 0)}.p-0\\.5{padding:calc(var(--spacing) * .5)}.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\\.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\\.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-4{padding-block:calc(var(--spacing) * 4)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pl-2{padding-left:calc(var(--spacing) * 2)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.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-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)}.whitespace-nowrap{white-space:nowrap}.text-blue-500{color:var(--color-blue-500)}.text-card-foreground{color:var(--card-foreground)}.text-chart-1{color:var(--chart-1)}.text-foreground{color:var(--foreground)}.text-foreground-faint{color:var(--foreground-faint)}.text-foreground-muted{color:var(--foreground-muted)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-inherit{color:inherit}.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-500{color:var(--color-red-500)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-success{color:var(--success)}.text-warning{color:var(--warning)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.opacity-0{opacity:0}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-100{opacity:1}.shadow,.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-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)}.ring{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + 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)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-filter{backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\,background-color\\]{transition-property:transform,opacity,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-\\[160ms\\]{--tw-duration:.16s;transition-duration:.16s}.duration-\\[167ms\\]{--tw-duration:.167s;transition-duration:.167s}.ease-\\[cubic-bezier\\(0\\.33\\,0\\,0\\,1\\)\\]{--tw-ease:cubic-bezier(.33,0,0,1);transition-timing-function:cubic-bezier(.33,0,0,1)}.ease-in{--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\\: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\\:border-primary:hover{border-color:var(--primary)}.hover\\:bg-accent:hover{background-color:var(--accent)}.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{background-color:var(--primary)}.hover\\:bg-primary-hover:hover{background-color:var(--primary-hover)}.hover\\:bg-primary\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-primary\\/90:hover{background-color:color-mix(in oklab, var(--primary) 90%, transparent)}}.hover\\:bg-secondary-hover:hover{background-color:var(--secondary-hover)}.hover\\:bg-secondary\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\:bg-secondary\\/80:hover{background-color:color-mix(in oklab, var(--secondary) 80%, transparent)}}.hover\\:bg-transparent:hover{background-color:#0000}.hover\\:text-foreground:hover{color:var(--foreground)}.hover\\:text-primary:hover{color:var(--primary)}.hover\\:text-primary-foreground:hover{color:var(--primary-foreground)}.hover\\:opacity-100:hover{opacity:1}.hover\\:duration-\\[250ms\\]:hover{--tw-duration:.25s;transition-duration:.25s}}.focus\\:border-ring:focus{border-color:var(--ring)}.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-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-ring:focus{--tw-ring-color:var(--ring)}.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,[data-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 *,[data-marketrix-widget],[data-marketrix-widget] *{pointer-events:auto;box-sizing:border-box;transition:color .2s ease-in-out,background-color .2s ease-in-out,border-color .2s ease-in-out,opacity .2s ease-in-out,box-shadow .2s ease-in-out,transform .2s ease-in-out}.marketrix-widget button,.marketrix-widget input,.marketrix-widget textarea,.marketrix-widget select,[data-marketrix-widget] button,[data-marketrix-widget] input,[data-marketrix-widget] textarea,[data-marketrix-widget] select{font:inherit}[data-resizing=true],[data-resizing=true] *{transition:none!important}.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,[data-screen-edge-glow]{animation:1.6s ease-in-out infinite marketrix-screen-edge-pulse}.marketrix-widget-button-processing-glow,.marketrix-widget-button-error-glow{pointer-events:none;filter:blur(14px);will-change:transform, opacity;border-radius:50%;width:140%;height:140%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}@keyframes widget-activity-dash-travel{0%{stroke-dashoffset:0;opacity:.5}18%{stroke-dashoffset:-112px;opacity:1}35%{stroke-dashoffset:-160px;opacity:.65}60%{stroke-dashoffset:-160px;opacity:.45}82%{stroke-dashoffset:-272px;opacity:1}to{stroke-dashoffset:-320px;opacity:.6}}.marketrix-widget-button-processing-activity-ring,.marketrix-widget-button-error-activity-ring{pointer-events:none;z-index:0;position:absolute;inset:-3px;overflow:visible}.marketrix-widget-button-processing-activity-ring rect,.marketrix-widget-button-error-activity-ring rect{fill:none;stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:40 120;animation:1.9s cubic-bezier(.4,0,.2,1) infinite widget-activity-dash-travel}.marketrix-widget-button-processing-activity-ring rect{stroke:#31d06d;filter:drop-shadow(0 0 3px #31d06db3)}.marketrix-widget-button-error-activity-ring rect{stroke:#d0342c;filter:drop-shadow(0 0 3px #d0342cb3)}@keyframes widget-glow-green{0%,to{opacity:.72;background:radial-gradient(circle,#31d06d00 38%,#31d06d61 58%,#31d06d3d 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:1;background:radial-gradient(circle,#31d06d00 34%,#31d06d8c 56%,#31d06d54 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}.marketrix-widget-button-processing-glow{animation:2s ease-in-out infinite widget-glow-green}@keyframes widget-glow-red{0%,to{opacity:.65;background:radial-gradient(circle,#d0342c00 38%,#d0342c57 58%,#d0342c38 68%,#0000 78%);transform:translate(-50%,-50%)scale(1)}50%{opacity:.95;background:radial-gradient(circle,#d0342c00 34%,#d0342c80 56%,#d0342c4d 68%,#0000 80%);transform:translate(-50%,-50%)scale(1.1)}}.marketrix-widget-button-error-glow{animation:1.5s ease-in-out infinite widget-glow-red}@keyframes launcher-entrance{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.animate-launcher-entrance{animation:.25s ease-out forwards launcher-entrance}@keyframes messenger-entrance{0%{opacity:0;transform:scale(0)}40%{opacity:1}to{transform:scale(1)}}@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)}[data-view-transition][data-direction=forward]{animation:.3s both viewSlideForward}[data-view-transition][data-direction=back]{animation:.3s both viewSlideBack}@keyframes viewSlideForward{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes viewSlideBack{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@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-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}}',gC=null,yC=null,wC=null,bC=!1,vC=!1,xC=0,kC=(e,t)=>{const n=t||"marketrix-widget-container-"+ ++xC;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",!Rd(r))throw new Error("Container is not an HTMLElement");if(r.shadowRoot)throw new Error("Container already has a shadow root");const i=r.attachShadow({mode:"closed"}),o=document.createElement("style");if(o.textContent=fC,i.appendChild(o),i.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",i.appendChild(s),{container:r,shadowRoot:i,mountEl:s}},_C=(e,n,r=!1)=>{const i=h(e);return i.render(/* @__PURE__ */f(t.StrictMode,{children:/* @__PURE__ */f(Qd,{previewMode:r,children:/* @__PURE__ */f(Km,{config:n})})})),i},SC=e=>{if(!e)throw new Error("Container is required");e.remove()},CC=()=>yC,IC=()=>null!==gC,EC=e=>{bC=e},TC=()=>bC,AC=()=>vC,MC=e=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(wC){const e=document.getElementById("marketrix-widget-loader-container");e&&e.remove(),wC.unmount(),wC=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"}),i=document.createElement("style");i.textContent=fC,r.appendChild(i);const o=document.createElement("div");o.id="marketrix-widget-loader-root",r.appendChild(o);const s=h(o);wC=s,s.render(/* @__PURE__ */f(t.StrictMode,{children:/* @__PURE__ */f(mC,{message:e})}))},zC=()=>{if(wC){wC.unmount(),wC=null;const e=document.getElementById("marketrix-widget-loader-container");e&&e.remove()}},OC=null,RC=(e=0)=>{if("undefined"==typeof window||"undefined"==typeof document)return;if(window.__mtx?.state)return;const t=[0,100,500,1e3,2e3];if(!OC)return;const n=document.querySelectorAll("script[mtx-id], script[mtx-app], script[marketrix-id]"),r=(void 0!==document.currentScript&&null!=document.currentScript&&Pd(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||!Pd(r)){if(0===n.length)return void(IC()||TC());if(e<5){return void setTimeout(()=>RC(e+1),t[e]||2e3)}if(IC()||TC())return;return void MC("Please configure mtx-id and mtx-key, or mtx-app and mtx-agent")}const i=r,o=i.getAttribute("mtx-id")||i.getAttribute("marketrix-id"),s=i.getAttribute("mtx-key")||i.getAttribute("marketrix-key"),a=i.getAttribute("mtx-api-host"),l=i.getAttribute("mtx-app"),c=i.getAttribute("mtx-agent"),d=i.getAttribute("mtx-use-screenshare");if(o&&s){const e={mtxId:o,mtxKey:s};a&&(e.mtxApiHost=a),"false"===d&&(e.use_screenshare=!1),OC(e).catch(e=>{})}else if(l&&c){const e=Number.parseInt(l),t=Number.parseInt(c);if(isNaN(e)||isNaN(t))return void MC("Invalid mtx-app or mtx-agent values");const n={mtxApp:e,mtxAgent:t};a&&(n.mtxApiHost=a),"false"===d&&(n.use_screenshare=!1),OC(n).catch(e=>{})}else{if(IC()||TC())return;MC("Please configure mtx-id and mtx-key, or mtx-app and mtx-agent")}},PC=null,NC=!1,LC=!1,DC=null,$C=null,jC=null;async function FC(e,t){if(EC(!0),IC())return void EC(!1);if(AC())return void EC(!1);window.__mtx={state:"initializing"},e.mtxApiHost&&Hc(e.mtxApiHost),MC("Validating widget configuration...");const n=await(new sC).validateConfig(e);if(!n.isValid)return MC(n.error||"Widget validation failed. Please check your configuration."),EC(!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");MC("Loading widget settings...");try{const t=new lC(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 i=["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(i.length>0)throw new Error(`Widget settings are incomplete. Missing required fields: ${i.join(", ")}. The API must return all widget settings.`);return Ad(r,e)}catch(KC){throw KC}finally{zC()}}(e,n)}catch(s){return MC(s instanceof Error?s.message:"Failed to initialize widget"),EC(!1),void(window.__mtx=void 0)}(e=>{yC=e})(r);const{mountEl:i}=kC(t,`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);var o;o=_C(i,r),gC=o,vC=!0,EC(!1),window.__mtx={state:"active"};try{if(PC&&NC)return;PC&&(PC.stop(),PC=null,NC=!1),jC=new AbortController;const t=(e,t)=>{if(!(PC&&NC||LC)){LC=!0;try{PC=new oC(t,e),NC=!0;const n=PC;DC=n.start().catch(e=>{PC===n&&(NC=!1)}).finally(()=>{LC=!1,PC===n&&(DC=null)})}catch{LC=!1}}},n=e=>{const n=yd.getChatId();n?t(e,n):window.addEventListener("marketrix:chatid",()=>{const n=yd.getChatId();n&&t(e,n)},{once:!0,signal:jC?.signal})},i=r.mtxApp??e.mtxApp;if(i)n(i);else{const e=Id.getInstance(),t={onRegistered:r=>{r&&n(r),e.removeCallbacks(t)}};e.addCallbacks(t)}}catch(s){NC=!1}}var UC=!1,BC=async(e,t)=>{if(!window.__mtx?.state){if($C)return $C;if(UC&&$C)return $C;if(UC)return Promise.resolve();if(!IC()&&!AC()){$C=FC(e,t),UC=!0;try{await $C}finally{$C=null,UC=!1}}}},WC=()=>{if(gC){gC.unmount(),gC=null,yC=null,vC=!1;const e=document.querySelector(".marketrix-widget-container");e&&SC(e)}jC?.abort(),jC=null,PC&&(PC.stop(),PC=null,NC=!1,LC=!1,DC=null),$C=null,window.__mtx=void 0,zC()},GC=()=>{PC&&PC.stop()},HC=async()=>{if(!PC)throw new Error("Session recording not available. Ensure the widget is initialized with mtxApiHost and mtxApp.");if(DC&&(await DC.catch(()=>{}),PC?.isActive()))return;if(PC.isActive())return;const e=PC.start();DC=e;try{await e}finally{DC===e&&(DC=null)}},ZC=()=>PC?.isActive()??!1,VC=async e=>{if(IC()){const t=CC();if(!t)throw new Error("Widget not initialized");const n={...t,...e};WC(),await BC(n)}},qC=({settings:e,container:t,mtxId:n,mtxKey:r,mtxApiHost:i})=>{const o=u(null),s=u(null),l=u(null),c=u(null);return a(()=>{const a=t??o?.current?.parentElement??document.body;if(!a||!Rd(a))return;c.current||(c.current=`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);const{container:d,mountEl:u}=kC(a,c.current);l.current=d;const p={...Ad(e,{mtxId:n,mtxKey:r,mtxApiHost:i}),isPreviewMode:!0,widget_enabled:e.widget_enabled??!0};s.current&&(s.current.unmount(),s.current=null);const m=h(u);return s.current=m,m.render(/* @__PURE__ */f(Qd,{previewMode:!0,children:/* @__PURE__ */f(Km,{config:p})})),()=>{s.current&&(s.current.unmount(),s.current=null),l.current&&(SC(l.current),l.current=null,c.current=null)}},[e,t]),t?null:/* @__PURE__ */f("div",{ref:o,style:{width:"100%",height:"100%",position:"relative"}})},YC=async e=>{EC(!0);const t=e.container;if("settings"in e&&void 0!==e.settings){const{settings:n,container:r,...i}=e,o={...Ad(n,i),isPreviewMode:!0},{mountEl:s}=kC(t,`marketrix-widget-${Date.now()}-${Math.random().toString(36).slice(2,11)}`);_C(s,o,!0),EC(!1)}else if("mtxId"in e&&void 0!==e.mtxId&&void 0!==e.mtxKey){const{mtxId:n,mtxKey:r,container:i,...o}=e;await BC({mtxId:n,mtxKey:r,...o},t)}else{if(!("mtxApp"in e)||void 0===e.mtxApp||void 0===e.mtxAgent)throw EC(!1),new Error("Invalid configuration: provide either settings (preview), mtxId+mtxKey (production), or mtxApp+mtxAgent (dev)");{const{mtxApp:n,mtxAgent:r,container:i,...o}=e;await BC({mtxApp:n,mtxAgent:r,...o},t)}}};"undefined"!=typeof window&&setTimeout(()=>{try{(e=>{"function"==typeof e&&(OC=e,RC())})(BC)}catch(e){}},0);var JC={MarketrixWidget:qC,mountWidget:YC,initWidget:BC,unmountWidget:WC,updateMarketrixConfig:VC,getCurrentConfig:CC,startRecording:HC,stopRecording:GC,getRecordingState:ZC};export{qC as MarketrixWidget,JC as default,CC as getCurrentConfig,ZC as getRecordingState,BC as initWidget,YC as mountWidget,HC as startRecording,GC as stopRecording,WC as unmountWidget,VC as updateMarketrixConfig};
|