ripplo 0.9.7 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-XJJDHGK4.js → chunk-26A42N75.js} +28 -28
- package/dist/{chunk-TPCKMDWU.js → chunk-43C7VPGA.js} +1 -1
- package/dist/{chunk-GZPE7I7U.js → chunk-44GHUVW6.js} +2 -2
- package/dist/{chunk-2Q7VXQYN.js → chunk-4OSYMIH6.js} +1 -1
- package/dist/{chunk-GFKK7K6T.js → chunk-5X4M4MTG.js} +3 -3
- package/dist/chunk-67YR3QHA.js +6 -0
- package/dist/{chunk-BJWGAKKD.js → chunk-6NKSEWP6.js} +6 -6
- package/dist/chunk-6TCK75ER.js +83 -0
- package/dist/{chunk-5DT43ABQ.js → chunk-73TKORK6.js} +1 -1
- package/dist/{chunk-IG7J452B.js → chunk-CEVQ5RNC.js} +1 -1
- package/dist/chunk-FXCBWBN5.js +4 -0
- package/dist/{chunk-6VUSLPQD.js → chunk-GOZWOCTE.js} +2 -2
- package/dist/chunk-IONMYZ3K.js +4 -0
- package/dist/{chunk-V4CLXOCP.js → chunk-LL4HUOJP.js} +1 -1
- package/dist/{chunk-CAS7MBA7.js → chunk-M3CXHDFV.js} +1 -1
- package/dist/{chunk-OES7HGNF.js → chunk-QAR7FZO3.js} +1 -1
- package/dist/{chunk-BNMS3N54.js → chunk-UDPKOYZT.js} +1 -1
- package/dist/chunk-VDAFHS7J.js +7 -0
- package/dist/{chunk-7CELUIVK.js → chunk-VOZOP7MQ.js} +1 -1
- package/dist/{cli-error-OIG4RO4E.js → cli-error-AHNJULLG.js} +1 -1
- package/dist/{compile-write-OLP4DB4P.js → compile-write-OLQOR3OK.js} +1 -1
- package/dist/daemon-BJAGK2Q3.js +152 -0
- package/dist/{daemon-WEKGUIRK.js → daemon-H4P5PCVH.js} +1 -1
- package/dist/{dsl-loader-IRBKYLNW.js → dsl-loader-LXH6PUY5.js} +1 -1
- package/dist/{exit-plan-gate-HSTV7UO4.js → exit-plan-gate-CJ3IXWTN.js} +1 -1
- package/dist/hook.js +1 -1
- package/dist/index.js +175 -175
- package/dist/{plan-reminder-FZSSUVNB.js → plan-reminder-EPCNBFY3.js} +1 -1
- package/dist/post-edit-ZVCYZ62V.js +4 -0
- package/dist/post-edit-analyze-J2H3I3IO.js +4 -0
- package/dist/post-edit-flag-stubs-E22KT2LD.js +4 -0
- package/dist/{pre-edit-WZJVD3J4.js → pre-edit-TEN3AFRK.js} +1 -1
- package/dist/pre-edit-scope-gate-2YIFSEDY.js +1 -1
- package/dist/{pre-edit-watch-gate-GQZYMDOC.js → pre-edit-watch-gate-BUFWLXR3.js} +1 -1
- package/dist/{prompt-submit-LE5LR62B.js → prompt-submit-DJFWNGYC.js} +1 -1
- package/dist/scope-reminder-DIDCHDAA.js +1 -1
- package/dist/status-FDM2RK37.js +4 -0
- package/dist/{stop-enforce-EH2SC7ND.js → stop-enforce-4XV6LK7Z.js} +2 -2
- package/dist/tasks-reminder-SDS6RNLP.js +1 -1
- package/package.json +2 -3
- package/dist/chunk-22JUAYHM.js +0 -4
- package/dist/chunk-4GA5662U.js +0 -83
- package/dist/chunk-FJPJDGSS.js +0 -7
- package/dist/chunk-L2ZJK7MP.js +0 -6
- package/dist/chunk-RIVHBABX.js +0 -4
- package/dist/daemon-3IWI7VQT.js +0 -152
- package/dist/post-edit-333UCJ6G.js +0 -4
- package/dist/post-edit-analyze-JFWA223C.js +0 -4
- package/dist/post-edit-flag-stubs-IZSAIM4O.js +0 -4
- package/dist/solve-worker.js +0 -4
- package/dist/status-H5WYYH4J.js +0 -4
package/dist/chunk-4GA5662U.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as __ripploCreateRequire } from "node:module";
|
|
3
|
-
const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
|
|
4
|
-
import{$ as Xc,A as Vc,B as Mt,C as st,D as xe,E as Wc,F as Uc,G as zc,H as Gc,I as K,J as ye,M as bs,N as Kc,O as Hn,P as qc,T as Yn,U as Hc,Y as Yc,Z as Zc,_ as Jc,a as b,b as Tc,c as Ss,d as ot,e as Jt,ea as at,f as ce,fa as Qc,g as Lc,h as it,ha as eu,i as Br,j as zn,k as Gn,l as Kn,m as Nc,n as Fc,o as $c,p as qn,t as Dc,u as _c,v as Bc,w as jc,x as ve,y as Fe,z as At}from"./chunk-XJJDHGK4.js";import{a as jy}from"./chunk-NNH3YVVO.js";import{a as By,b as Ic}from"./chunk-KMZ3L5YA.js";var Vd=By((yN,ta)=>{"use strict";var Io=process||{},Bd=Io.argv||[],Oo=Io.env||{},Kb=!(Oo.NO_COLOR||Bd.includes("--no-color"))&&(!!Oo.FORCE_COLOR||Bd.includes("--color")||Io.platform==="win32"||(Io.stdout||{}).isTTY&&Oo.TERM!=="dumb"||!!Oo.CI),qb=(e,t,r=e)=>n=>{let o=""+n,i=o.indexOf(t,e.length);return~i?e+Hb(o,t,r,i)+t:e+o+t},Hb=(e,t,r,n)=>{let o="",i=0;do o+=e.substring(i,n)+r,i=n+t.length,n=e.indexOf(t,i);while(~n);return o+e.substring(i)},jd=(e=Kb)=>{let t=e?qb:()=>String;return{isColorSupported:e,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};ta.exports=jd();ta.exports.createColors=jd});function ee(e){return`${e.workflow}/${e.slug}`}var tu=new WeakMap;function J(e){let t=tu.get(e);if(t!=null)return t;let r=e.workflows.flatMap(n=>n.tests.map(o=>({ref:ee(o),test:o,workflow:n})));return tu.set(e,r),r}function ws({onlyFirst:e=!1}={}){let o="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(o,e?void 0:"g")}var Vy=ws();function Rs(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(Vy,"")}function vs(e,t,r){return{detail:r.slice(0,500),kind:"engine-http",path:e,status:t}}function Xt(e,t){return{code:au(t)??null,kind:"engine-network",message:Vr(t),path:e}}function Zn(e){return{kind:"client-mount-missing",mountKey:e}}function xs(e,t){return{kind:"app-not-ready",readyKey:e,timeoutMs:t}}function ks(e,t){return{kind:"engine-decode",message:Vr(t),path:e}}function Cs(e,t){return{entity:e,field:t,kind:"state-identity"}}function Es(e){return{as:e,kind:"setup-missing-row"}}function Ke(e){return{kind:"driver-launch",message:Vr(e)}}function Jn(e){return{kind:"page-read",message:Vr(e)}}function Ps(e){return{kind:"engine-unreachable",url:e}}function As(e,t){return{action:e,failure:t,kind:"action-failed"}}function Ms(e){return{kind:"unclassified",message:Vr(e)}}function Os(){return{kind:"aborted"}}var Wy=["aborted","action-failed","page-read","app-not-ready","check-failed","client-mount-missing","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable","setup-missing-row","state-identity"],Uy=new Set(Wy);function Xn(e){if(typeof e!="object"||e==null||!("kind"in e))return!1;let{kind:t}=e;return typeof t=="string"&&Uy.has(t)}var zy=["app-not-ready","client-mount-missing","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable"],ou=new Set(zy);function Qn(e){return ou.has(e.kind)}function iu(e){return ou.has(e)}var ru=300;function jr(e){switch(e.kind){case"engine-http":return`engine ${e.path} returned ${String(e.status)}: ${su(e.detail)}${Hy(e.status)}`;case"engine-network":return`engine ${e.path} request failed: ${e.message}${Gy(e.code)}${qy(e.code,e.message)}`;case"client-mount-missing":return`this test reads client-side state, but the app never mounted the client engine ("${e.mountKey}"). Call mountClientEngine() where your app boots.`;case"app-not-ready":return`the app never called ready() within ${String(e.timeoutMs)}ms of loading the page. Call ready() from @ripplo/testing once your app is interactive \u2014 see setup.`;case"engine-decode":return`engine ${e.path} response did not match schema: ${e.message}`;case"state-identity":return`row of "${e.entity}" is missing identity field "${e.field}"`;case"setup-missing-row":return`setup returned no row for "${e.as}"`;case"engine-unreachable":return`the engine at ${e.url} did not respond in time \u2014 the dev server may still be recompiling. Re-run once it settles.`;case"driver-launch":return`browser driver failed to launch: ${e.message}`;case"page-read":return`reading the page failed: ${e.message}`;case"action-failed":return`action "${e.action}" failed: ${nu(e.failure)}`;case"check-failed":return`check failed: ${nu(e.failure)}`;case"aborted":return"run aborted"}}function nu(e){switch(e.kind){case"notFound":return"the element was not found";case"multipleMatches":return`the locator matched ${String(e.count)} elements`;case"covered":return`the element is covered by ${e.by}`;case"notPossible":return"the action is not possible on this element";case"wrongState":return`the element is ${e.observed.value?"":"not "}${e.observed.checkKind}`;case"wrongContent":return`the content was "${e.observed}"`;case"unclassified":return e.message}}function ke(){}function su(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=ru?t:`${t.slice(0,ru)}\u2026 [truncated]`}function Gy(e){return e==null?"":` (${e})`}var Ky=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function qy(e,t){return e!=null&&Ky.has(e)?" \u2014 nothing accepted the connection at the engine URL. Check that the app's dev server is running and RIPPLO_ENGINE_URL points at it.":t.toLowerCase().includes("timeout")?" \u2014 the app took too long to respond. On a dev server the first hit to a route compiles it on demand and can blow the timeout \u2014 warm the route or raise the setup budget. A hung seed/read impl does the same, so check the app logs if it persists.":" \u2014 the app dropped the connection mid-request. A thrown error in the engine route or a seed/read impl can cause this \u2014 check the app logs."}function Hy(e){return e===404?" \u2014 the engine adapter is not mounted at RIPPLO_ENGINE_URL (or the mount path differs). Verify the adapter is wired into the app server and ENABLE_RIPPLO_TESTING=true; `ripplo doctor` checks the endpoint.":e===403||e===401?" \u2014 the adapter rejected the request: ENABLE_RIPPLO_TESTING is not true in the app's env, or RIPPLO_WEBHOOK_SECRET differs between the app and .ripplo env.":""}function au(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?au(e.cause):void 0}function Vr(e){let t=e instanceof Error?e.message:String(e);return su(Rs(t))}var lu=new WeakMap;function Qt(e){let t=lu.get(e);if(t!=null)return t;let r={entities:e.entities,singletonSchemas:e.singletons,valueSpaces:e.valueSpaces};return eu(r,e.solved),lu.set(e,r),r}import{createHash as PS}from"crypto";import{z as Yy}from"zod";import{stringify as Zy}from"safe-stable-stringify";var Is=Yy.string().brand(),A=Is.parse("");function De(e){return Is.parse(e)}function Ce(e,t){return Is.parse(e.length===0?t:`${e}.${t}`)}function N(e){return Tc.safeParse(e).success}function Ot(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function qe(e){return typeof e=="object"&&e!==null&&"template"in e}function cu(e){return typeof e!="string"&&"count"in e}var $e=class extends Error{subject;constructor(t){super(t),this.subject=t}};function ge(e){return{counts:void 0,env:e}}function Wr(e,t,r){let n=Ce(t,e.ref);if(!r.has(n))throw new $e(n);return r.get(n)??null}function Ur(e,t,r){return eo(e).every(n=>r.has(Ce(t,n)))}function He(e,t,r){return typeof e=="string"?e:N(e)?String(Wr(e,t,r.env)):e.template.map(n=>Xy(n,t,r)).join("")}function Ee(e,t,r){return e===null||typeof e=="number"||typeof e=="boolean"?e:N(e)?Wr(e,t,r.env):He(e,t,r)}function uu(e,t){return Ee(e,A,t)}function It(e){return Zy(e)}function er(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,Ee(o,t,r)]))}function eo(e){return e==null||typeof e!="object"?[]:qe(e)?e.template.flatMap(t=>typeof t=="string"?[]:cu(t)?Jy(t):[t.ref]):[e.ref]}function Jy(e){return Object.values(e.count.where).flatMap(t=>du(t))}function du(e){return e==null||typeof e!="object"?[]:"kind"in e?e.kind==="within"?Object.values(e.selection.where).flatMap(t=>du(t)):e.kind==="anyOf"?e.values.flatMap(t=>eo(t)):eo(e.value):eo(e)}function Xy(e,t,r){if(typeof e=="string")return e;if(!cu(e))return String(Wr(e,t,r.env));if(r.counts==null)throw new $e(e.count.entity);return String(r.counts(e,r.env))}function ae(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:He(e.name,A,t),role:e.role}:e.by==="inside"?{by:"inside",scope:ae(e.scope,t),target:ae(e.target,t)}:e.by==="surface"?{by:"surface",container:ae(e.container,t),overlay:e.overlay}:e.by==="frame"?{by:"frame",element:ae(e.element,t)}:{by:"testId",value:He(e.value,A,t)}}var Qy="https://ripplo.invalid";var pu={hash:void 0,path:void 0,query:{},title:void 0,viewport:void 0};function hu(e){return e.kind!=="title"&&e.kind!=="viewport"}function Gr(e){return e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function to(e,t){return e==="title"?{kind:"title"}:e==="viewport"?{kind:"viewport"}:t===void 0||t.kind==="path"?{kind:"path"}:t.kind==="hash"?{kind:"hash"}:{key:t.key,kind:"query"}}function zr(e){let t=new URL(e,Qy),r=Object.fromEntries(t.searchParams.entries());return{hash:t.hash.length>0?t.hash.slice(1):void 0,path:t.pathname,query:r,title:void 0,viewport:void 0}}function mu(e){if(typeof e=="string")return fu(zr(e));let t=N(e)?[e]:e.template,r=t.findIndex(c=>typeof c=="string"&&/[?#]/.test(c)),n=t[r];if(r===-1||typeof n!="string")return{...pu,path:e};let o=[...t.slice(0,r),n.slice(0,n.search(/[?#]/))].filter(c=>typeof c!="string"||c.length>0),i=t.slice(r),s={template:o};if(i.some(c=>typeof c!="string"))return{...pu,path:s};let a=i.filter(c=>typeof c=="string").join(""),l=zr(`/p${a.slice(a.search(/[?#]/))}`);return{...fu(l),path:s}}function yu(e){let r=[[{kind:"path"},e.path],[{kind:"hash"},e.hash],[{kind:"title"},e.title],[{kind:"viewport"},e.viewport]].flatMap(([o,i])=>i===void 0?[]:[{clause:i,key:o}]),n=Object.entries(e.query).map(([o,i])=>({clause:i,key:{key:o,kind:"query"}}));return[...r,...n]}function fu(e){return{hash:e.hash,path:e.path,query:e.query,title:e.title,viewport:e.viewport}}var _e=new Map;function R(e){return e.kind!=="element"?b(e):Jt(e.locator,e.state)}function lt(e,t){return new Map([...gu(e,t),[R(t.subject),t]])}function Ts(e,t){return new Map([...gu(e,t),[R(t.subject),t]])}function Se(e,t){return new Map([...e,...t])}function Ls(e){return e.kind==="element"}function St(e){return e.kind==="path"||e.kind==="query"||e.kind==="hash"}function ne(e,t){let r=e.get(R(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function rr(e){let t=zr(e),r=[[{kind:"path"},t.path],[{kind:"hash"},t.hash],...Object.entries(t.query).map(n=>[{key:n[0],kind:"query"},n[1]])];return new Map(r.flatMap(([n,o])=>o===void 0?[]:[[R(n),{declared:!0,expect:{expect:"is",value:o},subject:n}]]))}function Ns(e){return[...e].toSorted(([t],[r])=>t.localeCompare(r))}function gu(e,t){return eg(t)?tg(e,t.subject):ng(t)?og(e,t.subject):e}function eg(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function tg(e,t){if(t.kind!=="element")return e;let r=b(ce(t.locator)),n=[...e].filter(([,o])=>rg(o,r));return n.length===e.size?e:new Map(n)}function rg(e,t){if(e.subject.kind!=="element")return!0;let r=ce(e.subject.locator);return Kr(r,t)?!1:b(r)!==t?!0:e.subject.state!=="text"&&e.subject.state!=="value"}function Kr(e,t){return e.by==="frame"?b(e.element)===t||Kr(e.element,t):e.by!=="inside"?!1:b(e.scope)===t||b(e.target)===t||Kr(e.scope,t)||Kr(e.target,t)}function ng(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!0&&Su(e.subject.locator)}function Su(e){return e.by==="surface"&&e.overlay}function og(e,t){if(t.kind!=="element")return e;let r=b(ce(t.locator)),n=[...e].filter(([,o])=>ig(o,r));return n.length===e.size?e:new Map(n)}function ig(e,t){if(e.subject.kind!=="element"||Su(e.subject.locator))return!0;let r=ce(e.subject.locator);return b(r)===t||Kr(r,t)}function Ye({declared:e,entry:t,scope:r}){let n=t.subject.kind==="element"?{...t.subject,locator:ae(t.subject.locator,r)}:t.subject;if(t.expect.expect==="absent")return{declared:e,expect:{expect:"absent"},subject:n};let o=Ee(t.expect.value,A,r),i=lg(n)&&typeof o=="number"?String(o):o;return{declared:e,expect:{expect:t.expect.expect,value:i},subject:n}}function Tt({got:e,subject:t,want:r}){if(r.expect==="absent")return e===void 0;if(sg(t)){let n=ag(e,r.value);return r.expect==="is"?n:!n}return r.expect==="is"?e===r.value:e!==r.value}function sg(e){return e.kind==="element"&&e.state==="text"}function tr(e){return e.replaceAll(/\s+/gu," ").trim()}function ag(e,t){return typeof e=="string"&&typeof t=="string"&&tr(e)===tr(t)}function lg(e){return e.kind==="element"&&(e.state==="value"||e.state==="text")}import cg from"better-sqlite3";var bu={current:null};function ro(){let e=bu.current;if(e!=null)return e;let t={columns:new Map,db:new cg(":memory:"),loaded:null,statements:new Map};return bu.current=t,t}function Lt(e,t){let r=e.statements.get(t);if(r!=null)return r;let n=e.db.prepare(t);return e.statements.set(t,n),n}function Ze(e,t,r){e.columns.get(t)==null&&(e.db.exec(`CREATE TABLE "${t}" (__as TEXT PRIMARY KEY)`),e.columns.set(t,new Set));let o=e.columns.get(t);r.filter(s=>o?.has(s)!==!0).forEach(s=>{e.db.exec(`ALTER TABLE "${t}" ADD COLUMN "${s}"`),o?.add(s),e.loaded=null})}function no(e,t){t.entities.forEach((r,n)=>{let o=[...new Set([...r.values()].flatMap(i=>Object.keys(i)))];Ze(e,n,o)})}function qr(e,t,r){Ze(e,t,Object.keys(r)),Object.values(r).forEach(n=>{ve(n)&&(Ze(e,n.selection.entity,[n.field]),qr(e,n.selection.entity,n.selection.where))})}function oo(e,t){e.loaded!==t&&(e.columns.forEach((r,n)=>{Lt(e,`DELETE FROM "${n}"`).run();let o=t.entities.get(n);if(o==null||o.size===0)return;let i=[...r],s=i.map(d=>`"${d}"`).join(", "),a=i.map(()=>"?").join(", "),l=i.length===0?"(__as)":`(__as, ${s})`,c=i.length===0?"(?)":`(?, ${a})`,u=Lt(e,`INSERT INTO "${n}" ${l} VALUES ${c}`);o.forEach((d,p)=>{u.run(p,...i.map(y=>ug(d[y])))})}),e.loaded=t)}function ug(e){return typeof e=="boolean"?e?1:0:typeof e=="string"||typeof e=="number"?e:e instanceof Date?e.toISOString():null}function Fs({entity:e,snapshot:t,where:r}){let n=ro();qr(n,e,r),no(n,t),oo(n,t);let i=`SELECT r.__as AS __as FROM "${e}" r WHERE ${io(r,{depth:0,refExpr:dg,row:"r"})} ORDER BY r.rowid`;return Lt(n,i).all().flatMap(s=>{let a=s!=null&&typeof s=="object"?Reflect.get(s,"__as"):null;return typeof a=="string"?[a]:[]})}function wu(e){let t=e.snapshot.entities.get(e.entity);return t==null||t.size===0?[]:Fs(e).flatMap(r=>{let n=t.get(r);return n==null?[]:[n]})}function dg(e){throw new Error(`sql-where: unresolved ref "${e}" \u2014 resolve refs before matching`)}function io(e,t){let r=Object.entries(e).map(([n,o])=>pg({column:`${t.row}."${n}"`,scope:t,want:o}));return r.length===0?"1":r.join(" AND ")}function pg({column:e,scope:t,want:r}){if(ve(r)){let n=`w${String(t.depth)}`,o=io(r.selection.where,{...t,depth:t.depth+1,row:n});return`${e} IN (SELECT ${n}."${r.field}" FROM "${r.selection.entity}" ${n} WHERE ${o})`}return Fe(r)?yg({column:e,scope:t,want:r}):`${e} IS ${Nt(r,t.refExpr)}`}function Nt(e,t){let r=fg(e);if(r!=null)return t(r);if(e instanceof Date)return Ft(e.toISOString());if(e!=null&&typeof e=="object")throw new Error("sql-where: template values must be resolved before compiling");return Ft(e)}function Ft(e){if(e==null)return"NULL";if(typeof e=="boolean")return e?"1":"0";if(typeof e=="number")return String(e);if(typeof e=="string")return`'${e.replaceAll("'","''")}'`;throw new Error("sql-where: only primitive literals can be compiled")}function fg(e){return N(e)?e.ref:void 0}function so(e,t){return e.map(r=>{let n=[...Object.entries(r.literals).map(([i,s])=>`x."${i}" IS ${Ft(s)}`),...r.relations.map(i=>{let s=t(i.targetAlias,i.targetField);return s==null?"0":`x."${i.field}" = ${s}`})],o=n.length===0?"":` WHERE ${n.join(" AND ")}`;return`NOT EXISTS (SELECT 1 FROM "${r.entity}" x${o})`})}function ao(e,t){return e.map(r=>{let n=t(r),o=n.length===0?"":` WHERE x.__as NOT IN (${n.join(", ")})`;return`NOT EXISTS (SELECT 1 FROM "${r}" x${o})`})}function lo(e,t){return e.flatMap(r=>$s(r,t))}function $s(e,t){if(e.kind==="singleton")return[];if(e.kind==="not"){let r=$s(e.predicate,t);return r.length===0?[]:[`NOT (${r.join(" AND ")})`]}return e.kind==="and"||e.kind==="or"?hg(e,t):[mg(e,t)]}function hg(e,t){let r=e.predicates.flatMap(o=>$s(o,t)),n=e.kind==="and"?" AND ":" OR ";return r.length===0?[]:[`(${r.join(n)})`]}function mg(e,t){return e.kind==="count"?`(SELECT COUNT(*) FROM "${e.entity}" c WHERE ${io(e.where,t)}) = ${String(e.value)}`:`EXISTS (SELECT 1 FROM "${e.entity}" c WHERE ${io(e.where,t)})`}function yg({column:e,scope:t,want:r}){let{refExpr:n}=t;if(r.kind==="not")return`${e} IS NOT ${Nt(r.value,n)}`;if(r.kind==="anyOf")return`(${r.values.map(i=>`${e} IS ${Nt(i,n)}`).join(" OR ")})`;if(r.kind==="compare"){let o={gt:">",gte:">=",lt:"<",lte:"<="}[r.op];return`${e} ${o} ${Nt(r.value,n)}`}return r.kind==="contains"?`instr(${e}, ${Nt(r.value,n)}) > 0`:`substr(${e}, 1, length(${Nt(r.value,n)})) IS ${Nt(r.value,n)}`}function bt(e){return typeof e=="object"&&e!==null&&"kind"in e}function wt(e){return Object.fromEntries(Object.entries(e).filter(t=>!bt(t[1])))}function _s(e){return new Map(e.entities.filter(t=>t.identityKind==="surrogate").map(t=>[t.name,t.identity]))}function pe(e){return(t,r)=>Be(e,t.count.entity,t.count.where,r).length}function $t(e,t,r){return t.reduce((n,o)=>bg(n,o,r,e),e)}function Ru(e,{clears:t,forget:r,sets:n}){let o=new Set(t),i=gg(e,r,n),s=[...e.scalars].filter(([l,c])=>!o.has(l)&&!(i&&(Ls(c.subject)||Sg(c.subject)))),a=[...n.values()].reduce((l,c)=>lt(l,c),new Map(s));return{...e,scalars:a}}function gg(e,t,r){if(t==="hard")return!0;if(t==="none")return!1;let n=ne(e.scalars,{kind:"path"}),o=ne(r,{kind:"path"});return o!==void 0&&o!==n}function Sg(e){return e.kind==="query"||e.kind==="hash"}function bg(e,t,r,n){let{env:o,identities:i}=r;if(!vg(t,o))return e;if(t.assertion.kind==="created"){let l=er(t.assertion.props,A,{counts:pe(e),env:o}),c=wg({entity:t.entity,identities:i,props:l},e);return kg(e,t.entity,It(c),c)}let s=ku({entity:t.entity,env:o,key:t.key,snapshot:n});if(t.assertion.kind==="deleted")return Ds(e,t.entity,l=>new Map([...l].filter(([c])=>!s.has(c))));let a=er(wt(t.assertion.props),A,{counts:pe(e),env:o});return Ds(e,t.entity,l=>new Map([...l].map(([c,u])=>s.has(c)?[c,{...u,...a}]:[c,u])))}var Bs="#surrogate#";function vu(e){return typeof e=="string"&&e.includes(Bs)}function wg({entity:e,identities:t,props:r},n){let o=(t.get(e)??[]).filter(a=>!(a in r));if(o.length===0)return r;let i=Rg(n.entities.get(e),e),s=Object.fromEntries(o.map(a=>[a,`${e}${Bs}${String(i)}`]));return{...r,...s}}function Rg(e,t){let r=`${t}${Bs}`;return[...(e??new Map).values()].flatMap(o=>Object.values(o)).filter(o=>typeof o=="string"&&o.startsWith(r)).map(o=>Number(o.slice(r.length))).filter(o=>Number.isFinite(o)).reduce((o,i)=>Math.max(o,i),0)+1}function vg(e,t){return("props"in e.assertion?[e.key,wt(e.assertion.props)]:[e.key]).every(n=>Object.values(n).every(o=>ve(o)||xg(o).every(i=>!N(i)||t.has(De(i.ref)))))}function xg(e){return Fe(e)?e.kind==="anyOf"?e.values:[e.value]:[e]}function kg(e,t,r,n){let o=new Map([...e.entities.get(t)??[],[r,n]]);return{...e,entities:new Map([...e.entities,[t,o]])}}function Ds(e,t,r){let n=r(e.entities.get(t)??new Map);return{...e,entities:new Map([...e.entities,[t,n]])}}function Be(e,t,r,n){return wu({entity:t,snapshot:e,where:js(r,{env:n,snapshot:e})})}function xu(e,t,r,n,o){let i=ku({entity:t,env:n,key:r,snapshot:e});return Ds(e,t,s=>new Map([...s].map(([a,l])=>[a,i.has(a)?o(l):l])))}function ku({entity:e,env:t,key:r,snapshot:n}){return new Set(Fs({entity:e,snapshot:n,where:js(r,{env:t,snapshot:n})}))}function js(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Cg(n,t)]))}function Cg(e,t){return ve(e)?{...e,selection:{...e.selection,where:js(e.selection.where,t)}}:Fe(e)?e.kind==="anyOf"?{...e,values:e.values.map(r=>co(r,t))}:e.kind==="contains"||e.kind==="startsWith"?{...e,value:String(co(e.value,t))}:{...e,value:co(e.value,t)}:co(e,t)}function co(e,t){return Ee(e,A,{counts:pe(t.snapshot),env:t.env})}function Eu(e,t,r){return e.reduce((n,o)=>{let i=Eg(o,n.snapshot,r),s=$t(n.snapshot,Pu(o,i),r);return{resolved:[...n.resolved,{executedBranches:i,step:o}],snapshot:s}},{resolved:[],snapshot:t}).resolved}function Dt(e,t){if(e.kind==="count")return Be(t.snapshot,e.entity,e.where,t.env).length===e.value;if(e.kind==="exists")return Be(t.snapshot,e.entity,e.where,t.env).length>0;if(e.kind==="singleton"){let r=Ee(e.assertion.value,A,{counts:pe(t.snapshot),env:t.env});return Cu(ne(t.snapshot.scalars,{kind:"variable",name:e.singleton}))===Cu(r)}return e.kind==="not"?!Dt(e.predicate,t):e.kind==="or"?e.predicates.some(r=>Dt(r,t)):e.predicates.every(r=>Dt(r,t))}function Eg(e,t,r){let n=$t(t,Pu(e,[]),r);return e.expect.filter(o=>o.kind==="when").flatMap(o=>{let i=o.branches.find(s=>s.condition==null||Dt(s.condition,{env:r.env,snapshot:n}));return i==null?[]:[i.name]})}function Pu(e,t){return qn({executedBranches:t,expect:e.expect}).flatMap(r=>r.predicate.kind==="state"&&!r.negated?[r.predicate]:[])}function Cu(e){return e==null?"\u2205":JSON.stringify(e)}function Au(e){return[...e.world.flatMap(t=>Pg(t)),...e.steps.flatMap(t=>Vs(t)),...Object.values(e.singletons).flatMap(t=>K(t)),...e.absent.flatMap(t=>Object.values(t.where).flatMap(r=>K(r))),...e.actor.kind==="user"?[e.actor.alias]:[]]}function Pg(e){return Object.values(e.set).flatMap(t=>K(t))}function Vs(e){return[...Ag(e.action),...e.expect.flatMap(t=>ct(t))]}function ct(e){switch(e.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return ye(e.locator);case"value":case"text":{let t=ot(e.value)?e.value.value:e.value;return[...ye(e.locator),...K(t)]}case"singleton":return K(e.assertion.value);case"browser":return K(e.value);case"state":return[...e.assertion.kind==="deleted"?[]:Object.values(wt(e.assertion.props)).flatMap(t=>K(t)),...Object.values(e.key).flatMap(t=>_t(t))];case"not":return ct(e.predicate);case"when":return e.branches.flatMap(t=>[...t.condition==null?[]:ct(t.condition),...t.consequence.flatMap(r=>ct(r))]);case"and":case"or":return e.predicates.flatMap(t=>ct(t));case"count":case"exists":return Object.values(e.where).flatMap(t=>_t(t));case"actor":return e.target.kind==="anonymous"?[]:[e.target.ref.ref]}}function _t(e){return ve(e)?Object.values(e.selection.where).flatMap(t=>_t(t)):Fe(e)?(e.kind==="anyOf"?e.values:[e.value]).flatMap(r=>K(r)):K(e)}function Mu(e){return!e.includes(".")}function nr(e){let t=e.indexOf(".");return t===-1?e:e.slice(0,t)}function Ag(e){return e.kind==="goto"?K(e.url):e.kind==="actor"?[e.ref.ref]:e.kind==="fill"||e.kind==="select"?[...ye(e.locator),...K(e.value)]:e.kind==="press"?e.locator==null?[]:ye(e.locator):e.kind==="drag"?[...ye(e.source),...ye(e.target)]:ye(e.locator)}var Ou=2e4;function Lu(e,t){let r=["__stage_a","__stage_b"],n=t.entities.reduce((a,l,c)=>{let u=r[c%2]??"__stage_a";e.db.exec(`DROP TABLE IF EXISTS ${u}`);let d=a==null?"":"prev.*, ",p=a==null?"":`${a} prev, `,y=Og({index:c,pattern:t,prev:a});return e.db.exec(`CREATE TEMP TABLE ${u} AS SELECT ${d}t.__as AS "a${String(c)}" FROM ${p}"${l.entity}" t WHERE ${y}`),Mg(e,u),u},null);if(n==null)return{};let o=Ig(t),i=o.length===0?"":` WHERE ${o.join(" AND ")}`,s=e.db.prepare(`SELECT * FROM ${n} s${i} LIMIT 1`).get();return s==null||typeof s!="object"?null:{...s}}function Mg(e,t){let r=e.db.prepare(`SELECT COUNT(*) AS n FROM ${t}`).get(),n=r!=null&&typeof r=="object"?Reflect.get(r,"n"):0;if(typeof n=="number"&&n>Ou)throw new Error(`sql-staged: pattern too weakly constrained \u2014 ${String(n)} partial assignments exceed the ${String(Ou)} cap`)}function Og({index:e,pattern:t,prev:r}){let n=t.entities[e];if(n==null)return"1";let o=Object.entries(n.literals).map(([u,d])=>`t."${u}" IS ${Ft(d)}`),i=new Map(t.entities.slice(0,e).map((u,d)=>[u.alias,d])),s=n.relations.flatMap(u=>{let d=i.get(u.targetAlias);return d==null?[]:[`t."${u.field}" = ${Iu(t,d,u.targetField)}`]}),a=t.entities.slice(0,e).flatMap((u,d)=>u.relations.flatMap(p=>p.targetAlias===n.alias?[`${Iu(t,d,p.field)} = t."${p.targetField}"`]:[])),l=t.entities.slice(0,e).flatMap((u,d)=>u.entity===n.entity&&r!=null?[`t.__as <> prev."a${String(d)}"`]:[]),c=[...o,...s,...a,...l];return c.length===0?"1":c.join(" AND ")}function Iu(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT b."${r}" FROM "${n}" b WHERE b.__as = prev."a${String(t)}")`}function Tu(e,t,r){let n=e.entities[t]?.entity??"";return`(SELECT r."${r}" FROM "${n}" r WHERE r.__as = s."a${String(t)}")`}function Ig(e){let t=new Map(e.entities.map((i,s)=>[i.alias,s])),r=i=>{let s=Ot(i),a=s==null?void 0:t.get(s.alias);if(s==null||a==null)throw new Error(`sql-staged: unresolved ref "${i}"`);return Tu(e,a,s.field)},n=(i,s)=>{let a=t.get(i);return a==null?null:Tu(e,a,s)},o=i=>e.entities.flatMap((s,a)=>s.entity===i?[`s."a${String(a)}"`]:[]);return[...so(e.absences,n),...ao(e.exclusives,o),...lo(e.conditions,{depth:0,refExpr:r,row:"c"})]}var Nu=new WeakMap,Tg=60;function $u(e,t){let r=ro(),n=_u(t);if(Bu(e.actor,n))return null;if(Lg(r,e),no(r,t),oo(r,t),e.entities.length>Tg){let s=Lu(r,e);return s==null?null:Fu({pattern:e,picked:s,snapshot:t})}let o=Nu.get(e)??Ng(e);Nu.set(e,o);let i=o.includes(":actor")?Lt(r,o).get({actor:n}):Lt(r,o).get();return i==null||typeof i!="object"?null:Fu({pattern:e,picked:i,snapshot:t})}function Du(e,t){let r=_u(t);return Bu(e.actor,r)?{got:r}:null}function _u(e){let t=e.scalars.get(R({kind:"actor"})),r=t!=null&&t.expect.expect==="is"?t.expect.value:null;return typeof r=="string"?r:null}function Bu(e,t){return e.kind==="user"?t==null:e.kind==="anonymous"?t!=null:!1}function Lg(e,t){t.entities.forEach(r=>{Ze(e,r.entity,[...Object.keys(r.literals),...r.relations.map(n=>n.field)]),r.relations.forEach(n=>{let o=t.entities.find(i=>i.alias===n.targetAlias);o!=null&&Ze(e,o.entity,[n.targetField])})}),t.absences.forEach(r=>{Ze(e,r.entity,[...Object.keys(r.literals),...r.relations.map(n=>n.field)]),r.relations.forEach(n=>{let o=t.entities.find(i=>i.alias===n.targetAlias);o!=null&&Ze(e,o.entity,[n.targetField])})}),t.conditions.forEach(r=>{Us(e,r),Ws({condition:r,pattern:t,store:e})}),t.exclusives.forEach(r=>{Ze(e,r,[])})}function Ws({condition:e,pattern:t,store:r}){if(e.kind!=="singleton"){if(e.kind==="not"){Ws({condition:e.predicate,pattern:t,store:r});return}if(e.kind==="and"||e.kind==="or"){e.predicates.forEach(n=>{Ws({condition:n,pattern:t,store:r})});return}Object.values(e.where).flatMap(n=>_t(n)).forEach(n=>{let o=Ot(n);if(o==null)return;let i=t.entities.find(s=>s.alias===o.alias);i!=null&&Ze(r,i.entity,[o.field])})}}function Us(e,t){if(t.kind!=="singleton"){if(t.kind==="not"){Us(e,t.predicate);return}if(t.kind==="and"||t.kind==="or"){t.predicates.forEach(r=>{Us(e,r)});return}qr(e,t.entity,t.where)}}function Fu({pattern:e,picked:t,snapshot:r}){let n=e.entities.map((o,i)=>{let s=Reflect.get(t,`a${String(i)}`),a=typeof s=="string"?r.entities.get(o.entity)?.get(s):null;return a==null?null:[o.alias,a]});return n.some(o=>o==null)?null:new Map(n.filter(o=>o!=null))}function Ng(e){let t=new Map(e.entities.map((l,c)=>[l.alias,`t${String(c)}`])),r=e.entities.length===0?"1":e.entities.map((l,c)=>`t${String(c)}.__as AS a${String(c)}`).join(", "),n=e.entities.length===0?"":` FROM ${e.entities.map((l,c)=>`"${l.entity}" t${String(c)}`).join(", ")}`,o=(l,c)=>{let u=t.get(l);return u==null?null:`${u}."${c}"`},i=l=>e.entities.flatMap(c=>c.entity===l?[t.get(c.alias)].flatMap(u=>u==null?[]:[`${u}.__as`]):[]),s=[...Fg(e,t),...e.entities.flatMap((l,c)=>$g({alias:`t${String(c)}`,aliases:t,constraint:l})),...Dg(e,t),...so(e.absences,o),...lo(e.conditions,{depth:0,refExpr:_g(t),row:"c"}),...ao(e.exclusives,i)],a=s.length===0?"":` WHERE ${s.join(" AND ")}`;return`SELECT ${r}${n}${a} LIMIT 1`}function Fg(e,t){if(e.actor.kind!=="user")return[];let r=t.get(e.actor.alias);return r==null?[]:[`${r}.__as = :actor`]}function $g({alias:e,aliases:t,constraint:r}){let n=Object.entries(r.literals).map(([i,s])=>`${e}."${i}" IS ${Ft(s)}`),o=r.relations.map(i=>{let s=t.get(i.targetAlias);return s==null?"1":`${e}."${i.field}" = ${s}."${i.targetField}"`});return[...n,...o]}function Dg(e,t){return e.entities.flatMap((r,n)=>e.entities.slice(n+1).flatMap((o,i)=>{if(r.entity!==o.entity)return[];let s=t.get(r.alias),a=t.get(e.entities[n+1+i]?.alias??o.alias);return s==null||a==null?[]:[`${s}.__as <> ${a}.__as`]}))}function _g(e){return t=>{let r=Ot(t),n=r==null?void 0:e.get(r.alias);if(r==null||n==null)throw new Error(`sql-match: unresolved ref "${t}"`);return`${n}."${r.field}"`}}function Pe(e,t){let r=Hr(e,t);if(r==null)return null;let n=Vg(e.scalars,t,Uu(r));return n==null?null:e.conditions.every(i=>Dt(i,{env:n,snapshot:t}))?n:null}function Hr(e,t){return $u(e,t)}function uo(e,t){let r=Hr(e,t);if(r==null)return Bg(e,t);let n=jg(e.scalars,t,Uu(r));if(n.unmet!=null)return n.unmet;let o=e.conditions.find(i=>!Dt(i,{env:n.env,snapshot:t}));return o==null?null:{condition:o,kind:"condition"}}function Bg(e,t){let r=Du(e,t);if(r!=null)return{got:r.got??void 0,kind:"scalar",subject:{kind:"actor"},want:e.actor.kind==="anonymous"?"signed out":"a signed-in user"};let n=e.entities.find((i,s)=>{let a={...e,absences:[],conditions:[],entities:e.entities.slice(0,s+1),scalars:new Map};return Hr(a,t)==null});if(n!=null)return{alias:n.alias,entity:n.entity,kind:"entities",mustBeAbsent:!1};let o=e.absences.find(i=>{let s={...e,absences:[i],conditions:[],scalars:new Map};return Hr(s,t)==null});return{alias:null,entity:o?.entity??null,kind:"entities",mustBeAbsent:o!=null}}function ju(e,t,r){let n=Vu(e.subject,r);if(n==null)return null;let o=Wu(t,n);return e.expect.expect==="absent"?o===void 0?r:null:e.expect.expect==="not"?zg({clause:e.expect.value,env:r,got:o,snapshot:t,subject:n}):Wg({clause:e.expect.value,env:r,got:o,snapshot:t,subject:n})}function jg(e,t,r){return[...e.values()].reduce((n,o)=>{if(n.unmet!=null)return n;let i=ju(o,t,n.env);if(i!=null)return{env:i,unmet:null};let s=Vu(o.subject,n.env),a=s==null?void 0:Wu(t,s),l=o.expect.expect==="absent"?null:o.expect.value;return{env:n.env,unmet:{got:a,kind:"scalar",subject:o.subject,want:l}}},{env:r,unmet:null})}function Vg(e,t,r){return[...e.values()].reduce((n,o)=>n==null?null:ju(o,t,n),r)}function Wg({clause:e,env:t,got:r,snapshot:n,subject:o}){if(Ug(o,e,t))return r===void 0?null:new Map([...t,[De(Gg(e)),r]]);if(!Ur(e,A,t))return null;let i=Ee(e,A,{counts:pe(n),env:t});return Tt({got:r,subject:o,want:{expect:"is",value:i}})?t:null}function Ug(e,t,r){return e.kind==="element"&&(e.state==="value"||e.state==="text")&&N(t)&&!Ur(t,A,r)}function zg({clause:e,env:t,got:r,snapshot:n,subject:o}){if(!Ur(e,A,t))return null;let i=Ee(e,A,{counts:pe(n),env:t});return Tt({got:r,subject:o,want:{expect:"not",value:i}})?t:null}function Gg(e){if(!N(e))throw new Error("expected a ref clause");return e.ref}function Vu(e,t){return e.kind!=="element"?e:Kg(e.locator,t)?{...e,locator:ae(e.locator,ge(t))}:null}function Kg(e,t){return Uc(e).every(r=>Ur(r,A,t))}function Wu(e,t){let r=e.scalars.get(R(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function Uu(e){return new Map([...e].flatMap(([t,r])=>Object.entries(r).flatMap(n=>{let o=n[1];return typeof o=="string"||typeof o=="number"||typeof o=="boolean"?[[De(`${t}.${n[0]}`),o]]:[]})))}function Ae(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function po(e){return e.flatMap(t=>t.kind==="and"?po(t.predicates):[t])}function or(e){return po(e).filter(t=>!At(t))}function fo(e){return e.action.kind==="goto"?!0:zs(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null)}function Bt(e){return e.action.kind==="goto"?!0:zs(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null&&(t.part===void 0||t.part.kind==="path"))}function zs(e){return e.flatMap(t=>t.kind==="and"?zs(t.predicates):[t])}function Je(e,t){return t.reduce((r,n)=>{let o=[...Qg(n),...Zr(n),...eS(n)],i=qg(n,r,o)?Xg(r):r;return o.reduce((s,a)=>Ts(s,a),i)},e)}function ue(e){return e.kind==="not"?Hg(e.predicate):e.kind==="singleton"?{expect:{expect:"is",value:e.assertion.value},subject:{kind:"variable",name:e.singleton}}:Yg(e)}function Yr(e){return yu(mu(e)).map(({clause:t,key:r})=>({expect:t===null?{expect:"absent"}:{expect:"is",value:t},subject:r}))}function qg(e,t,r){if(e.action.kind==="goto")return!0;if(!Bt(e))return!1;let n=t.get(R({kind:"path"})),o=r.find(i=>i.subject.kind==="path");return o==null?!1:n==null||b(n.expect)!==b(o.expect)}function Hg(e){return e.kind==="value"||e.kind==="text"?ot(e.value)?null:{expect:{expect:"not",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}}:zu(e,!0)}function zu(e,t){if(e.kind==="value"||e.kind==="text")return ot(e.value)?null:{expect:{expect:"is",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}};let r=Zg(e);return r==null?null:{expect:{expect:"is",value:r.value!==t},subject:{kind:"element",locator:r.locator,state:r.state}}}function Yg(e){return e.kind==="browser"?{expect:e.value===null?{expect:"absent"}:{expect:"is",value:e.value},subject:to(e.name,e.part)}:e.kind==="actor"?e.target.kind==="anonymous"?{expect:{expect:"absent"},subject:{kind:"actor"}}:{expect:{expect:"is",value:{ref:`${e.target.ref.ref}.id`}},subject:{kind:"actor"}}:zu(e,!1)}function Zr(e){let t=e.action;return!("locator"in t)||t.locator==null?[]:t.kind==="check"||t.kind==="uncheck"?[{expect:{expect:"is",value:t.kind==="check"},subject:{kind:"element",locator:t.locator,state:"checked"}}]:t.kind==="clear"?[{expect:{expect:"is",value:""},subject:{kind:"element",locator:t.locator,state:"value"}}]:t.kind==="fill"||t.kind==="select"?[{expect:{expect:"is",value:t.value},subject:{kind:"element",locator:t.locator,state:"value"}}]:[]}function Zg(e){return Jg(e)?e.kind==="disabled"?{locator:e.locator,state:"enabled",value:!1}:{locator:e.locator,state:e.kind,value:!0}:null}function Jg(e){return e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"}function Xg(e){return new Map([...e].filter(([,t])=>t.subject.kind==="variable"||t.subject.kind==="viewport"))}function Qg(e){return e.action.kind==="goto"?Yr(e.action.url):[]}function eS(e){return or(e.expect).flatMap(t=>{let r=ue(t);return r==null?[]:[r]})}function Gs(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var Jr={async:12e4,fast:5e3,slow:3e4},ho={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:Jr.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:Jr.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:Jr.slow}};function Gu(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function Xe(e){return`${e.test}#${String(e.index)}`}function Xr(e){let t=J(e).flatMap(r=>Qr(e,r.test));return Ae(t,r=>`${r.test}:${b(r.steps)}`)}function Qr(e,t){let r=Hu(t),n=qu(r,t.singletons,t.actor,t.viewport),o=kS(t,xS(e)),i=nS(e,t),s=_s(e);return iS(n,CS(t.steps),r).reduce((l,{chunk:c,requiredState:u},d)=>({offset:l.offset+c.length,transitions:[...l.transitions,wS({chunk:c,identities:s,index:d,intent:t.intent,namespace:r.namespace,paramSpaceOf:o,requiredState:u,testRef:ee(t),whenChunk:i.slice(l.offset,l.offset+c.length)})]}),{offset:0,transitions:[]}).transitions}function tS(e){return[R({kind:"viewport"}),{expect:{expect:"is",value:e},subject:{kind:"viewport"}}]}var rS=R({kind:"viewport"});function Ku(e){let t=e.scalars.get(rS);return t==null||t.expect.expect!=="is"||typeof t.expect.value!="string"?null:t.expect.value}function qu(e,t,r,n){return{absences:yS(e),actor:r,conditions:[],entities:bS(e),exclusives:e.exclusives,scalars:new Map([...Object.entries(t).filter(([,o])=>!N(o)&&!qe(o)).map(o=>{let[i,s]=o;return[R({kind:"variable",name:i}),{expect:{expect:"is",value:s},subject:{kind:"variable",name:i}}]}),tS(n)])}}function nS(e,t){let r=e.workflows.find(n=>n.name===t.workflow);return r==null||r.steps.length!==t.steps.length?t.steps:r.steps}function mo(e,t,r){return Object.values(e).flatMap(n=>N(n)?ir(n.ref,r):[]).find(n=>n.entity===t)?.aliasPath}function en(e,t){return t.reduce((r,n)=>oS(n)??r,e)}function oS(e){if(e.action.kind==="actor")return{alias:e.action.ref.ref,kind:"user"};let t=e.expect.find(r=>r.kind==="actor");return t==null?null:t.target.kind==="anonymous"?Vc:{alias:t.target.ref.ref,kind:"user"}}function iS(e,t,r){return t.reduce((n,o)=>({requiredState:sS(n.requiredState,o,r),withRequiredState:[...n.withRequiredState,{chunk:o,requiredState:mS(n.requiredState,o)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function sS(e,t,r){let n=t.flatMap(o=>o.expect.filter(i=>i.kind==="state")).reduce((o,i)=>aS(o,i,r),e);return{...n,actor:en(n.actor,t),scalars:Je(n.scalars,t)}}function aS(e,t,r){return t.assertion.kind==="deleted"?lS(e,t,r):t.assertion.kind==="created"?dS(e,t.entity,t.assertion.as,t.assertion.props,r):fS(e,t,r)}function lS(e,t,r){let n=mo(t.key,t.entity,r.namespace),o=e.entities.find(a=>a.alias===n),i=tn(cS(t.key),r),s=o==null?{entity:t.entity,params:{},...i}:{entity:o.entity,params:{},...uS(o,i)};return{...e,absences:[...e.absences,s],entities:e.entities.filter(a=>a.alias!==n)}}function cS(e){return Object.fromEntries(Object.entries(e).flatMap(t=>{let r=t[1];return ve(r)||Fe(r)?[]:[[t[0],r]]}))}function uS(e,t){return{literals:{...e.literals,...t.literals},relations:[...e.relations.filter(r=>!t.relations.some(n=>n.field===r.field)),...t.relations]}}function dS(e,t,r,n,o){let i=tn(n,o);return{...e,absences:e.absences.filter(s=>s.entity!==t||!pS(i,s)),entities:[...e.entities,{alias:r,entity:t,...i}]}}function pS(e,t){return Object.entries(t.literals).every(([n,o])=>e.literals[n]===o)&&t.relations.every(n=>e.relations.some(o=>o.field===n.field&&o.targetAlias===n.targetAlias&&o.targetField===n.targetField))}function fS(e,t,r){if(t.assertion.kind!=="updated")return e;let n=mo(t.key,t.entity,r.namespace);if(n==null)return e;let o=tn(wt(t.assertion.props),r),i=Object.entries(t.assertion.props).filter(([,a])=>bt(a)).map(([a])=>a),s=a=>a.alias===n?hS(a,o,i):a;return{...e,entities:e.entities.map(a=>s(a))}}function hS(e,t,r){let n=Object.entries(e.literals).filter(([o])=>!r.includes(o)&&!(o in t.literals));return{...e,literals:{...Object.fromEntries(n),...t.literals},relations:[...e.relations.filter(o=>!t.relations.some(i=>i.field===o.field)),...t.relations]}}function mS(e,t){return t[0]?.action.kind!=="goto"?e:{...e,scalars:new Map([...e.scalars].filter(([,r])=>r.subject.kind==="variable"||r.subject.kind==="viewport"))}}function yo(e,t){let r=Hu(t);return{namespace:r.namespace,requiredState:qu(r,t.singletons,t.actor,t.viewport)}}function Ks(e,t){return[...new Set(e)].flatMap(r=>ir(r,t))}function Hu(e){return{absences:e.absent,exclusives:e.exclusive,namespace:new Map(e.world.map(t=>[t.as,t.entity])),setups:e.world}}function yS(e){return e.absences.map(t=>({entity:t.entity,...tn(t.where,e),params:gS(t.where,e)}))}function tn(e,t){let r=Object.entries(e),n=Object.fromEntries(r.flatMap(([i,s])=>N(s)||qe(s)?[]:[[i,s]])),o=r.flatMap(i=>{let s=i[1];if(!N(s))return[];let a=ir(s.ref,t.namespace).at(0);return a==null?[]:[{entity:a.entity,field:i[0],targetAlias:a.aliasPath,targetField:a.field}]});return{literals:n,relations:o}}function gS(e,t){return Object.fromEntries(Object.entries(e).flatMap(r=>{let n=r[1];return!N(n)||ir(n.ref,t.namespace).at(0)!=null?[]:[[r[0],n.ref]]}))}function SS(e,t){return e.map(r=>({alias:r.as,entity:r.entity,...tn(r.set,t)}))}function bS(e){return SS(e.setups,e)}function ir(e,t){let r=Ot(e);if(r==null)return[];let n=t.get(r.alias);return n==null?[]:[{aliasPath:r.alias,entity:n,field:r.field,ref:e}]}function wS(e){let t=e.chunk.findIndex(s=>s.action.kind!=="goto"),r=t===-1?e.chunk:e.chunk.slice(0,t),n=e.chunk.slice(r.length),o=n.at(-1)??e.chunk.at(-1);if(o==null)throw new Error("empty transition chunk");let i=[...new Set(e.chunk.flatMap(s=>Vs(s)))];return{effectStep:o,identities:e.identities,index:e.index,intent:e.intent,namespace:e.namespace,nav:r,paramSpaces:Object.fromEntries(i.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:n,test:e.testRef,wait:Gs(e.chunk.flatMap(s=>[...RS(s),...vS(s)])),whenSteps:e.whenChunk}}function RS(e){return e.expect.flatMap(t=>t.kind==="state"&&t.wait!=null?[t.wait]:[])}function vS(e){return fo(e)?["slow"]:[]}function xS(e){return new Map(e.valueSpaces.map(t=>[t.name,t]))}function kS(e,t){return new Map(Object.entries(e.params).map(([r,n])=>[r,t.get(n.valueSpace)]))}function CS(e){return e.map(t=>[t])}function Yu(e,t){let r=st({conditions:e.when,...ES(e,t)});return e.expect.map(n=>({consequence:n,localConsequence:!1,origin:{kind:"declared",name:e.name},refs:new Set,when:r}))}var qs="@actor";function ES(e,t){if(!e.when.some(i=>Hs(i).some(s=>s.startsWith(`${qs}.`))))return{};let n=t.entities.filter(i=>i.principal),o=n[0];if(o==null||n.length>1)throw new Error(`the declared fact "${e.name}" uses actor.id, which needs exactly one principal entity`);return{actor:{alias:qs,kind:"user"},entities:[{alias:qs,entity:o.name,literals:{},relations:[]}]}}function Hs(e){return e.kind==="not"?Hs(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>Hs(t)):e.kind==="singleton"?K(e.assertion.value):Object.values(e.where).flatMap(t=>_t(t))}function Qe(e){return e.surfaces.filter(t=>t.by==="surface"&&t.overlay)}function go(e,t){return{...e,scalars:So(e.scalars,t)}}function So(e,t){return Xu(e,t,r=>({expect:{expect:"is",value:!1},subject:{kind:"element",locator:r,state:"visible"}}))}function Ju(e,t){let r=Xu(e.scalars,t,n=>({declared:!1,expect:{expect:"is",value:!1},subject:{kind:"element",locator:ae(n,ge(new Map)),state:"visible"}}));return{...e,scalars:r}}function Xu(e,t,r){let n=t.filter(o=>!e.has(Zu(o))).map(o=>[Zu(o),r(o)]);return n.length===0?e:new Map([...e,...n])}function Zu(e){return R({kind:"element",locator:e,state:"visible"})}var Qu=new WeakMap;function ut(e){let t=Qu.get(e);if(t!=null)return t;let r=PS("sha256").update(b({consequence:e.consequence,when:xe(e.when)})).digest("base64");return Qu.set(e,r),r}function wo(e){let t=e.facts.flatMap(i=>Yu(i,e)),r=new Set(Qe(e).map(i=>b(ce(i)))),n=J(e).map(i=>Zs(e,i)),o=Ae(n.flatMap(i=>i.steps.flatMap(s=>s.facts)),ut).filter(i=>!AS(i.consequence,r));return Promise.resolve([...t,...o])}function Ys(e,t){return e.filter(r=>!TS(r)||LS(r)===t)}function Ro(e){return e.kind==="not"?Ro(e.predicate):e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"||e.kind==="value"||e.kind==="text"}function AS(e,t){if(e.kind!=="visible")return!1;let r=ce(e.locator);return t.has(b(r))?!0:r.by==="inside"&&t.has(b(ce(r.scope)))}function vo(e,t){if(e.facts.length===0)return t;let r=rn(e,t);return r.size===0?t:{...t,scalars:Se(r,t.scalars)}}function rn(e,t){let r=Ju(t,e.overlays),n=e.facts.flatMap(s=>{let a=Pe(s.when,r);if(a==null)return[];let l=MS(s.consequence,a,r);return l==null?[]:[{entry:l,factKey:ut(s),key:R(l.subject)}]}),o=n.filter(s=>!IS({m:s,matched:n,overrides:e.overrides})),i=OS(o);return o.reduce((s,a)=>i.has(a.key)?s:lt(s,a.entry),_e)}function MS(e,t,r){let n=ue(e);if(n==null)return null;try{return Ye({declared:!0,entry:n,scope:{counts:pe(r),env:t}})}catch{return null}}function OS(e){let t=e.reduce((r,n)=>new Map([...r,[n.key,[...r.get(n.key)??[],b(n.entry.expect)]]]),new Map);return new Set([...t].flatMap(([r,n])=>new Set(n).size>1?[r]:[]))}function IS({m:e,matched:t,overrides:r}){let n=r.get(e.factKey);return n==null?!1:t.some(o=>o.key===e.key&&n.has(o.factKey))}function TS(e){return e.origin?.kind==="test"&&e.localConsequence}function LS(e){let{origin:t}=e;if(!(t==null||t.kind!=="test"))return t.test}var ed=new WeakMap;function Zs(e,t){let r=ed.get(t);if(r!=null)return r;let n=NS(e,t);return ed.set(t,n),n}function NS(e,{test:t,workflow:r}){let n=yo(e,t),o=Qe(e),i=FS(r.steps),s=t.steps.reduce((a,l)=>{let c=DS(a.requiredState,l,n,o),u=KS({branchConditions:i,namespace:n.namespace,origin:{kind:"test",test:ee(t)},paramNames:new Set(Object.keys(t.params)),post:c,pre:a.requiredState,step:l});return{requiredState:c,steps:[...a.steps,{facts:u,post:c}]}},{requiredState:go(n.requiredState,o),steps:[]});return{initial:go(n.requiredState,o),steps:s.steps}}function FS(e){return e.flatMap(r=>r.expect).flatMap(r=>bo(r)).reduce((r,n)=>{let o=b(n.consequence),i=r.get(o),s=i==null?n.condition:{kind:"or",predicates:[i,n.condition]};return new Map([...r,[o,s]])},new Map)}function bo(e){return e.kind==="not"?bo(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>bo(t)):e.kind!=="when"?[]:e.branches.flatMap((t,r)=>{let n=$S(e.branches,r);return t.consequence.flatMap(o=>[{condition:n,consequence:o},...bo(o)])})}function $S(e,t){let r=e.slice(0,t).flatMap(i=>i.condition==null?[]:[i.condition]).map(i=>({kind:"not",predicate:i})),n=e[t]?.condition,o=n==null?r:[...r,n];return o.length===1&&o[0]!=null?o[0]:{kind:"and",predicates:o}}function DS(e,t,r,n){let{entities:o}=_S(e,t,r),i=Je(e.scalars,[t]),s=en(e.actor,[t]);return go({...e,actor:s,entities:o,scalars:i},n)}function _S(e,t,r){return t.expect.reduce((n,o)=>o.kind==="state"?BS(n,o,r):n,e)}function BS(e,t,r){if(t.assertion.kind==="created"){let i=jS(t.assertion.as,t.entity,t.assertion.props,r);return{...e,entities:[...e.entities,i]}}let n=mo(t.key,t.entity,r.namespace);if(n==null)return e;if(t.assertion.kind==="deleted")return US(e,n);let o=wt(t.assertion.props);return{...e,entities:e.entities.map(i=>i.alias===n?nd(i,o,r):i)}}function jS(e,t,r,n){return nd({alias:e,entity:t,literals:{},relations:[]},r,n)}function nd(e,t,r){return Object.entries(t).reduce((n,[o,i])=>{if(qe(i))return n;if(N(i)){let s=VS(i.ref,o,r.namespace);return{...n,literals:WS(n.literals,o),relations:s==null?n.relations:[...td(n.relations,o),s]}}return{...n,literals:{...n.literals,[o]:i},relations:td(n.relations,o)}},e)}function VS(e,t,r){let[n]=ir(e,r);return n==null?void 0:{entity:n.entity,field:t,targetAlias:n.aliasPath,targetField:n.field}}function WS(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>r!==t))}function td(e,t){return e.filter(r=>r.field!==t)}function US(e,t){let r=e.entities.find(o=>o.alias===t),n=zS(e,t);return r==null?n:{...n,absences:[...n.absences,{entity:r.entity,literals:r.literals,params:{},relations:r.relations}]}}function zS(e,t){return{...e,entities:e.entities.filter(r=>r.alias!==t)}}var GS=16;function KS(e){return or(e.step.expect).filter(t=>Ro(t)).flatMap(t=>qS(t,e))}function qS(e,t){let r=ue(e);if(r==null)return[];if(ct(e).some(a=>t.paramNames.has(a)))return[];let n=R(r.subject),o=t.branchConditions.get(b(e)),i={...t.post,conditions:o==null?t.post.conditions:[...t.post.conditions,o],scalars:new Map([...t.post.scalars].filter(([a])=>a!==n))},s=HS(i,t.pre,t.paramNames);return s==null||s.entities.length>GS?[]:xe(s)===xe(t.pre)?[]:[{consequence:e,localConsequence:Ks(ct(e),t.namespace).length>0,origin:t.origin,refs:new Set(Ks([...ZS(s),...ct(e)],t.namespace).map(a=>a.aliasPath)),when:s}]}function HS(e,t,r){let n=[...e.scalars.values()].map(o=>YS(o,t,r));return n.some(o=>o==null)?null:{...e,scalars:new Map(n.flatMap(o=>o==null?[]:[[R(o.subject),o]]))}}function YS(e,t,r){if(!rd(e,r))return e;if(e.subject.kind!=="element"||e.expect.expect==="absent"||ye(e.subject.locator).some(o=>r.has(o)))return null;let n=t.scalars.get(R(e.subject));return n==null||n.expect.expect!=="is"||rd(n,r)?null:{expect:{expect:"not",value:n.expect.value},subject:e.subject}}function rd(e,t){let r=e.expect.expect==="absent"?[]:K(e.expect.value);return[...e.subject.kind==="element"?ye(e.subject.locator):[],...r].some(o=>t.has(o))}function ZS(e){return[...e.scalars.values()].flatMap(t=>St(t.subject)&&t.expect.expect!=="absent"?K(t.expect.value):[])}function od(e,t,r){let n=o=>e(o,...t);return r===void 0?n:Object.assign(n,{lazy:r,lazyArgs:t})}function id(e,t,r){let n=e.length-t.length;if(n===0)return e(...t);if(n===1)return od(e,t,r);throw Error("Wrong number of arguments")}function nn(...e){return id(JS,e)}var JS=(e,t)=>{let r=Object.create(null);for(let n=0;n<e.length;n++){let o=e[n],i=t(o,n,e);if(i!==void 0){let s=r[i];s===void 0?r[i]=[o]:s.push(o)}}return Object.setPrototypeOf(r,Object.prototype),r};function ad(e){return`\xA4param:${e}`}function ld(e,t){return`\xA4${e}.${t}`}var cd=new WeakMap;function Js(e){let t=cd.get(e);if(t!==void 0)return t;let r=XS(e);return cd.set(e,r),r}function XS(e){let t=ab(e);return t==null?null:{absenceKeys:new Set(e.absences.map(r=>b(r))),conditionKeys:new Set(e.conditions.map(r=>b(r))),pinned:rb(e),snapshot:t,specific:e}}var ud=new WeakMap,dd=new WeakMap;function Xs(e,t){if(t==null)return null;let r=dd.get(e)??new Map;dd.set(e,r);let n=xe(t.specific),o=r.get(n);if(o!==void 0)return o;let i=QS(e,t);return r.set(n,i),i}function xo(e,t){return Xs(e,Js(t))}function QS(e,t){let{absenceKeys:r,conditionKeys:n,pinned:o,snapshot:i,specific:s}=t,a=eb(e);if(!a.conditionKeys.every(p=>n.has(p))||!a.scalarEntries.every(([p])=>s.scalars.has(p)))return!1;let l=a.absenceEntries.filter(p=>!r.has(p.key)).map(p=>p.absence);if(l.some(p=>!s.exclusives.includes(p.entity))||!e.exclusives.every(p=>s.exclusives.includes(p)))return!1;let c=a.scalarEntries.map(([p,y])=>tb({entry:y,generalEntityOf:a.entityOf,host:s.scalars.get(p),key:p,pinned:o}));if(c.includes("false"))return!1;if(c.includes("defer"))return null;let u=new Map(c.flatMap(p=>typeof p=="string"?[]:[p])),d=st({absences:l,actor:e.actor,entities:e.entities,exclusives:e.exclusives,scalars:u});return Pe(d,i)!=null}function eb(e){let t=ud.get(e);if(t!=null)return t;let r={absenceEntries:e.absences.map(n=>({absence:n,key:b(n)})),conditionKeys:e.conditions.map(n=>b(n)),entityOf:new Map(e.entities.map(n=>[n.alias,n.entity])),scalarEntries:[...e.scalars]};return ud.set(e,r),r}function tb({entry:e,generalEntityOf:t,host:r,key:n,pinned:o}){if(r==null)return"false";let i=b(r.expect)===b(e.expect);return i&&ob(e.expect)?"skip":r.expect.expect!=="is"?nb({entry:e,host:r,identical:i}):e.expect.expect==="absent"?"false":ib({entry:e,generalEntityOf:t,key:n,pinned:o,want:e.expect,wantOfHost:r.expect})}function rb(e){let t=new Map(e.entities.map(i=>[i.alias,i.entity])),n=[...[...e.scalars.values()].flatMap(i=>[...i.expect.expect==="absent"?[]:K(i.expect.value),...i.subject.kind==="element"?ye(i.subject.locator):[]]).filter(i=>i.includes(".")),...e.entities.flatMap(i=>[...Object.keys(i.literals).map(s=>`${i.alias}.${s}`),...i.relations.flatMap(s=>[`${i.alias}.${s.field}`,`${s.targetAlias}.${s.targetField}`])])],o=n.flatMap(i=>{let s=i.indexOf("."),a=t.get(i.slice(0,s));return a==null?[]:[`${a}.${i.slice(s+1)}`]});return{byAlias:new Set(n),byEntity:new Set(o)}}function nb({entry:e,host:t,identical:r}){return r||t.expect.expect==="absent"&&e.expect.expect==="not"?"defer":"false"}function ob(e){return e.expect==="absent"?!0:K(e.value).every(t=>!t.includes("."))}function ib({entry:e,generalEntityOf:t,key:r,pinned:n,want:o,wantOfHost:i}){if(pd(o.value)||pd(i.value))return"defer";if(o.expect==="not")return K(o.value).length===0&&K(i.value).length===0?[r,e]:"defer";let s=new Set(K(o.value).filter(a=>a.includes(".")).map(a=>sb({generalEntityOf:t,pinned:n,ref:a})));return s.has("false")?"false":s.has("defer")?"defer":[r,{expect:md(o),subject:gd(e.subject)}]}function sb({generalEntityOf:e,pinned:t,ref:r}){if(t.byAlias.has(r))return"ok";let n=r.indexOf("."),o=e.get(r.slice(0,n));return o==null||t.byEntity.has(`${o}.${r.slice(n+1)}`)?"defer":"false"}function pd(e){return e!==null&&typeof e=="object"&&"template"in e&&e.template.some(t=>typeof t!="string"&&"count"in t)}var fd=new WeakMap;function ab(e){let t=fd.get(e);if(t!==void 0)return t;let r=lb(e);return fd.set(e,r),r}function lb(e){let t=cb(e),r=Pe(st({absences:e.absences,conditions:e.conditions,entities:e.entities,exclusives:e.exclusives}),t);if(r==null)return null;let n=db(e,r,t);return n==null?null:{...t,scalars:ub(n,e)}}function cb(e){let t=new Map(e.entities.map(s=>[s.alias,s])),r=[...e.scalars.values()].flatMap(s=>[...s.expect.expect==="absent"?[]:K(s.expect.value),...s.subject.kind==="element"?ye(s.subject.locator):[]]),n=[...e.entities.flatMap(s=>s.relations.map(a=>[a.targetAlias,a.targetField])),...r.flatMap(s=>{let a=s.indexOf(".");return a===-1?[]:[[s.slice(0,a),s.slice(a+1)]]})];return{entities:e.entities.map(s=>[s.entity,s.alias,{...Object.fromEntries(n.filter(([a])=>a===s.alias).map(([a,l])=>[l,hd(t,a,l)])),...s.literals,...Object.fromEntries(s.relations.map(a=>[a.field,hd(t,a.targetAlias,a.targetField)]))}]).reduce((s,[a,l,c])=>{let u=new Map([...s.get(a)??[],[l,c]]);return new Map([...s,[a,u]])},new Map),scalars:_e}}function hd(e,t,r){let o=e.get(t)?.literals[r];return o!==void 0?o:ld(t,r)}function ub(e,t){return t.actor.kind!=="user"?e:new Map([...e,[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:t.actor.alias},subject:{kind:"actor"}}]])}function db(e,t,r){let n=[...e.scalars.values()].filter(o=>o.expect.expect==="is").map(o=>{try{return Ye({declared:!0,entry:{expect:md(o.expect),subject:gd(o.subject)},scope:{counts:pe(r),env:t}})}catch{return null}});return n.some(o=>o==null)?null:new Map(n.flatMap(o=>o==null?[]:[[R(o.subject),o]]))}function md(e){return e.expect==="absent"?e:{...e,value:pb(e.value)}}function pb(e){return zc(e,yd)}function yd(e){return Mu(e.ref)?ad(e.ref):e}function gd(e){return e.kind!=="element"?e:{...e,locator:fb(e.locator)}}function fb(e){return Wc(e,hb)}function hb(e){return Gc(e,yd)}var Sd=new Map;async function ko({context:e,facts:t}){let r=nn(t.filter(i=>ue(i.consequence)!=null),i=>mb(i)),o=Object.values(r).flatMap(i=>i.flatMap(s=>i.filter(a=>a!==s).map(a=>({general:s,specific:a}))));return o.filter(({general:i,specific:s})=>xo(i.when,s.when)!==!1).forEach(({general:i,specific:s})=>{at({context:e,general:i.when,specific:s.when}).catch(()=>{})}),o.reduce(async(i,{general:s,specific:a})=>{let l=await i;if(!(xo(s.when,a.when)!==!1&&await at({context:e,general:s.when,specific:a.when}))||xo(a.when,s.when)!==!1&&await at({context:e,general:a.when,specific:s.when}))return l;let d=ut(s),p=l.get(d)??new Set;return new Map([...l,[d,new Set([...p,ut(a)])]])},Promise.resolve(Sd))}function bd(e){let t=ue(e.consequence);if(t==null)return null;try{let r=Ye({declared:!0,entry:t,scope:ge(new Map)});return R(r.subject)}catch{return null}}function mb(e){let t=ue(e.consequence);if(t==null)throw new Error("fact consequence has no pattern entry");return R(t.subject)}function Co(e){return Ae(J(e).flatMap(t=>yb(e,t.test)),sr)}function sr(e){return b({holds:xe(e.holds),reference:e.reference,when:xe(e.when)})}function Eo(e,t){return Pe(e.when,t)==null?!1:Pe(e.holds,t)==null}function yb(e,t){let r=yo(e,t);return r.requiredState.entities.flatMap(n=>n.relations.flatMap(o=>gb(e,n,o,r.namespace)?wb(n,o,r.namespace):[]))}function gb(e,t,r,n){let o=n.get(r.targetAlias);return o!=null&&!Sb(e,t.entity,r.field)&&bb(e,o,r.targetField)}function Sb(e,t,r){return e.entities.find(n=>n.name===t)?.props[r]?.optional===!0}function bb(e,t,r){return e.entities.find(n=>n.name===t)?.identity.includes(r)===!0}function wb(e,t,r){let n=r.get(t.targetAlias);if(n==null)return[];let o=wd(e.alias,e.entity),i=wd(t.targetAlias,n);return[{holds:st({entities:[{...o,relations:[t]},i]}),reference:{field:t.field,source:e.entity,target:n,targetField:t.targetField},when:st({entities:[o]})}]}function wd(e,t){return{alias:e,entity:t,literals:{},relations:[]}}function Rd(e){let t;return r=>{if(t!==void 0&&t.input===r)return t.output;let n=e(r);return t={input:r,output:n},n}}var Po=Rd(async e=>{let t=Qt(e),r=await wo(e);return{dataRules:Co(e),facts:r,overrides:await ko({context:t,facts:r})}});async function vd(e,t){let{context:r,pool:n,timelines:o}=vb(e,t),i=Rb(r),s=n.map(l=>Ku(l.fact.when)),a=await Promise.all([...o.values()].map(l=>{let c=l.locked.test.viewport,u=n.filter((d,p)=>s[p]==null||s[p]===c);return xb({entry:l,pool:u,resolve:i})}));return{pool:n,reports:a}}function xd(e,t){return{...kd(e.consequence),declared:e.origin?.kind==="test",key:ut(e),label:Yn(e.consequence),labelTokens:Hc(e.consequence),origins:t}}function Rb(e){return(t,r)=>at({context:e,general:t,specific:r})}function vb(e,t){let r=J(e),n=new Map(r.map(s=>[s.ref,{locked:s,timeline:Zs(e,s)}])),o=Pb(n),i=Ab({facts:t,originSites:o});return{context:Qt(e),pool:i,timelines:n}}async function xb(e){let{entry:t,pool:r,resolve:n}=e,{locked:o}=t,i=new Set(t.timeline.steps.flatMap(c=>c.facts.map(u=>b(u.consequence)))),s=r.filter(c=>!c.originWorkflows.has(o.test.workflow)).filter(c=>!i.has(c.consequenceKey)),a=await Cb({candidates:s,resolve:n,timeline:t.timeline});return{steps:t.timeline.steps.map((c,u)=>({borrowed:a.filter(d=>d.stepIndex===u).map(d=>d.borrowed),stepIndex:u})),testRef:o.ref,testSlug:o.test.slug,workflowSlug:o.test.workflow}}function kb(e,t){return e.map(r=>({candidate:r,holds:Xs(r.fact.when,t)}))}async function Cb({candidates:e,resolve:t,timeline:r}){let o=await[r.initial,...r.steps.map(i=>i.post)].reduce(async(i,s,a)=>{let l=await i,c=e.filter(f=>!l.has(f)),u=kb(c,Js(s)),d=await Promise.all(u.filter(f=>f.holds==null).map(async f=>({candidate:f.candidate,holds:await t(f.candidate.fact.when,s)}))),p=new Set(d.filter(f=>f.holds).map(f=>f.candidate)),y=u.filter(f=>f.holds===!0||p.has(f.candidate)).map(f=>f.candidate),h=a===0?0:a-1;return new Map([...l,...y.map(f=>[f,h])])},Promise.resolve(new Map));return r.steps.length===0?[]:[...o].map(([i,s])=>({borrowed:i.borrowed,stepIndex:s}))}function Eb(e,t){return{stepIndex:t,testRef:e.ref,testSlug:e.test.slug,workflowIntent:e.workflow.intent,workflowSlug:e.test.workflow}}function Pb(e){let t=[...e.values()].flatMap(r=>r.timeline.steps.flatMap((n,o)=>n.facts.map(i=>[ut(i),Eb(r.locked,o)])));return new Map(Object.entries(nn(t,([r])=>r)).map(([r,n])=>[r,n.map(([,o])=>o)]))}function Ab({facts:e,originSites:t}){return e.filter(r=>!(r.origin?.kind==="test"&&r.localConsequence)).map(r=>{let n=ut(r),i=r.origin?.kind==="test"?t.get(n)??[]:[];return{borrowed:xd(r,i),consequenceKey:b(r.consequence),fact:r,originWorkflows:new Set(i.map(s=>s.workflowSlug))}}).filter(r=>r.borrowed.origins.length>0)}function kd(e){if(e.kind==="not"){let t=kd(e.predicate);return{...t,negated:!t.negated}}return"locator"in e?{checkKind:e.kind,negated:!1,subject:Kn(ae(e.locator,ge(new Map)))}:{checkKind:void 0,negated:!1,subject:void 0}}function Cd(e){let t=Ae(e,xe),r=Ae(t.flatMap(c=>[...c.scalars.values()]),b),n=Ae(t.flatMap(c=>c.entities),b),o=Ae(t.flatMap(c=>c.absences),b),i=Ao(r,b),s=Ao(n,b),a=Ao(o,b),l=Ao(t,xe);return{absenceTable:o.map(c=>({...c,relations:[...c.relations]})),constraintTable:n.map(c=>({...c,relations:[...c.relations]})),patternTable:t.map(c=>({absences:c.absences.map(u=>Mo(a,b(u))),actor:c.actor,conditions:[...c.conditions],entities:c.entities.map(u=>Mo(s,b(u))),exclusives:[...c.exclusives],scalars:[...c.scalars.values()].map(u=>Mo(i,b(u)))})),scalarTable:r.map(c=>({expect:c.expect,subject:c.subject})),indexOf:c=>Mo(l,xe(c))}}function Ed(e){return e.patternTable.map(t=>({absences:t.absences.map(r=>jt(e.absenceTable,r)),actor:t.actor,conditions:t.conditions,entities:t.entities.map(r=>jt(e.constraintTable,r)),exclusives:t.exclusives,scalars:new Map(t.scalars.map(r=>{let n=jt(e.scalarTable,r);return[R(n.subject),n]}))}))}function jt(e,t){let r=e[t];if(r==null)throw new Error("compiled checks table index out of range \u2014 recompile");return r}function Ao(e,t){return new Map(e.map((r,n)=>[t(r),n]))}function Mo(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks pattern missing from table");return r}async function Ad(e){let t=await Po(e),{pool:r,reports:n}=await vd(e,t.facts),o=Cd([...t.facts.flatMap(a=>Tb(a)),...t.dataRules.flatMap(a=>[a.when,a.holds])]),i=new Map(t.facts.map((a,l)=>[a,l])),s=new Map(r.map((a,l)=>[a.borrowed,l]));return{absenceTable:o.absenceTable,constraintTable:o.constraintTable,dataRules:t.dataRules.map(a=>({holds:o.indexOf(a.holds),reference:a.reference,when:o.indexOf(a.when)})),factPool:r.map(a=>({fact:Md(i,a.fact),origins:a.borrowed.origins.map(l=>({...l}))})),factReports:n.map(a=>Fb(a,s)),facts:t.facts.map(a=>Lb(a,o)),overrides:Nb(t.overrides),patternTable:o.patternTable,scalarTable:o.scalarTable}}var Pd=new WeakMap;function ar(e){let t=Pd.get(e);if(t!=null)return t;let r=Mb(e),n=Ed(r),o={dataRules:r.dataRules.map(i=>({holds:jt(n,i.holds),reference:i.reference,when:jt(n,i.when)})),facts:r.facts.map(i=>Ob(i,n)),overrides:Ib(r.overrides)};return Pd.set(e,o),o}function Mb(e){return e.checks}function Md(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks item missing from index");return r}function Ob(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:e.origin,refs:new Set(e.refs),when:jt(t,e.when)}}function Ib(e){return new Map(Object.entries(e).map(([t,r])=>[t,new Set(r)]))}function Tb(e){return[e.when]}function Lb(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,origin:e.origin,refs:[...e.refs],when:t.indexOf(e.when)}}function Nb(e){return Object.fromEntries([...e].map(([t,r])=>[t,[...r].toSorted((n,o)=>n.localeCompare(o))]).toSorted(([t],[r])=>t.localeCompare(r)))}function Fb(e,t){return{steps:e.steps.map(r=>({borrowed:r.borrowed.map(n=>Md(t,n)),stepIndex:r.stepIndex})),testRef:e.testRef,testSlug:e.testSlug,workflowSlug:e.workflowSlug}}function Id(e){let t=new Map;return e.forEach(r=>{$b(r).forEach(n=>{on(n,t)})}),t}function ea(e,t){let r=Db(e.consequence,t);if(r.length===0)return e.when;let n=new Map(e.when.scalars);return r.forEach(o=>n.set(R(o.subject),o)),{...e.when,scalars:n}}function $b(e){let t=[...e.when.scalars.values()].flatMap(n=>n.subject.kind==="element"?[n.subject.locator]:[]),r=Td(e.consequence);return r==null?t:[...t,r]}function Td(e){return e.kind==="not"?Td(e.predicate):"locator"in e?e.locator:void 0}function on(e,t){if(e.by==="inside"){let r=Ld(Qs(e.scope));t.set(r,[...t.get(r)??[],e]),on(e.scope,t),on(e.target,t);return}if(e.by==="surface"){on(e.container,t);return}e.by==="frame"&&on(e.element,t)}function Ld(e){return Jt(e,"visible")}function Qs(e){return e.by==="frame"?e.element:e}function Db(e,t){let r=_b(e);if(r!=null)return(t.get(Ld(Qs(r)))??[]).map(o=>Od(o,!1));let n=Bb(e);return n==null?[]:[Od(Qs(n),!0)]}function _b(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function Od(e,t){return{expect:{expect:"is",value:t},subject:{kind:"element",locator:e,state:"visible"}}}function Bb(e){return e.kind!=="visible"||e.locator.by!=="inside"?null:e.locator.scope}function sn(e){return e.origin==null||e.origin.kind==="declared"?[]:[{test:e.origin.test,when:e.when}]}async function $d({context:e,facts:t}){let n=[...t.reduce((s,a)=>{let l=ue(a.consequence);if(l==null)return s;let c=R(l.subject);return new Map([...s,[c,[...s.get(c)??[],a]]])},new Map).values()].flatMap(s=>s.flatMap((a,l)=>s.slice(l+1).filter(c=>Dd(a.consequence,c.consequence)).map(c=>[a,c]))),o=Id(t),i=await Promise.all(n.map(async([s,a])=>{let l=await at({context:e,general:s.when,specific:a.when}),c=await at({context:e,general:a.when,specific:s.when});return l!==c?null:l||await Qc({aligned:!0,context:e,patterns:[ea(s,o),ea(a,o)]})?Wb(s,a):null}));return Ub(i.filter(s=>s!=null))}function Dd(e,t){let r=ue(e),n=ue(t);return r==null||n==null||R(r.subject)!==R(n.subject)?!1:jb(r,n)}function jb(e,t){return Vb(e)?Fd(e,t):e.expect.expect==="is"&&t.expect.expect==="is"?b(e.expect.value)!==b(t.expect.value):Fd(e,t)}function Vb(e){return e.subject.kind==="element"&&e.subject.state==="text"}function Wb(e,t){let r=sn(e),n=sn(t);return{a:e.consequence,aProducers:r,b:t.consequence,bProducers:n,tests:[...new Set([...Nd(e),...Nd(t)])],when:e.when}}function Nd(e){return e.origin==null?[]:e.origin.kind==="declared"?[]:[e.origin.test]}function Ub(e){return[...e.reduce((r,n)=>{let o=[b(n.a),b(n.b)].toSorted((a,l)=>a.localeCompare(l)).join("|"),i=r.get(o),s=i==null?n:{...i,tests:[...new Set([...i.tests,...n.tests])]};return new Map([...r,[o,s]])},new Map).values()]}function Fd(e,t){let r=[e.expect,t.expect],n=r.find(i=>i.expect==="is"),o=r.find(i=>i.expect==="not");return n==null||o==null?!1:b(n.value)===b(o.value)}function _d(e,t){return e.flatMap(r=>{let n=zb(r),o=new Set(r.requiredState.absences.map(i=>i.entity));return t.flatMap(i=>Gb(r,i,n,o))})}function zb(e){return new Set(e.steps.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="deleted"?[r.entity]:[])))}function Gb(e,t,r,n){let{source:o,target:i}=t.reference;return!r.has(i)||r.has(o)||n.has(o)?[]:[{dataRule:t,source:o,target:i,transition:Xe(e)}]}var M=Ic(Vd(),1),Ie={actual:e=>M.default.red(e),bad:e=>M.default.red(M.default.bold(e)),bold:e=>M.default.bold(e),dim:e=>M.default.dim(e),expected:e=>M.default.green(e),good:e=>M.default.green(M.default.bold(e)),heading:e=>M.default.bold(M.default.cyan(e)),path:e=>M.default.cyan(M.default.underline(e)),warn:e=>M.default.yellow(M.default.bold(e))},Yb={action:M.default.yellow,assertion:M.default.yellow,consistency:M.default.magenta,"data rule":M.default.yellow,driver:M.default.red,fact:M.default.yellow,"impossible action":M.default.cyan,"model drift":M.default.red,precondition:M.default.yellow,reachability:M.default.yellow,redundancy:M.default.yellow,skipped:M.default.red,state:M.default.magenta,surface:M.default.yellow};function oe(e){return`${M.default.red(M.default.bold("\u2717"))} ${Yb[e](M.default.bold(e))}`}var Zb=M.default.red("\u2717"),gN=M.default.green("\u2713"),Jb=M.default.dim("\u203A"),Xb=8;function Wd(e,t,r){let n=r==null?"":` ${Ie.dim(r)}`;return` ${Ie.dim(e.padStart(Xb))} ${t}${n}`}function Ud(e){let t=[...e.scalars.values()].find(r=>r.subject.kind==="path"&&r.expect.expect==="is")?.expect;return t==null||t.expect==="absent"?"(any view)":Qb(t.value)}function Qb(e){return typeof e!="object"||e==null?String(e):"template"in e?e.template.map(t=>typeof t=="string"?t:"ref"in t?`{${t.ref}}`:`{count:${t.count.entity}}`).join(""):`{${e.ref}}`}function Lo(e){let t=[...e.entities.map(r=>To(r)),...e.absences.map(r=>`no ${To(r)}`),...[...e.scalars.values()].filter(r=>r.subject.kind!=="path").filter(r=>!Gd(r)).map(r=>No(r))];return t.length===0?"always":t.join(" \u2227 ")}function No(e){let t=ew(e.subject);return e.expect.expect==="absent"?`${t} absent`:e.subject.kind==="element"&&tw(e.expect.value)?e.expect.value?t:`not ${t}`:`${t} ${e.expect.expect==="not"?"\u2260":"="} ${et(e.expect.value)}`}function ie(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${et(e.name)}`:e.by==="inside"?`${ie(e.scope)} \u25B8 ${ie(e.target)}`:e.by==="surface"?ie(e.container):e.by==="frame"?`frame ${ie(e.element)}`:et(e.value)}function et(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:ra(e)}function ra(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function zd(e,t){let r=new Set(t.entities.map(i=>To(i))),n=new Set(t.scalars.keys()),o=[...e.entities.map(i=>To(i)).filter(i=>!r.has(i)),...[...e.scalars].filter(([i])=>!n.has(i)).map(([,i])=>i).filter(i=>i.subject.kind!=="path"&&!Gd(i)).map(i=>No(i))];return o.length===0?"nothing beyond the shared state":o.join(" \u2227 ")}function Gd(e){return e.subject.kind==="element"&&e.subject.locator.by==="surface"&&e.subject.locator.overlay&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function ew(e){return e.kind==="variable"?e.name:e.kind==="element"?`${e.state} ${ie(e.locator)}`:e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function tw(e){return typeof e=="boolean"}function To(e){let t=Object.entries(e.literals).map(([r,n])=>`${r}=${et(n)}`);return t.length===0?e.entity:`${e.entity}(${t.join(", ")})`}function fe(e){return e.by==="testId"?`testId=${e.value}`:e.by==="inside"?`${fe(e.scope)} \u25B8 ${fe(e.target)}`:e.by==="surface"?fe(e.container):e.by==="frame"?`frame ${fe(e.element)}`:e.name==null?e.role:`${e.role} "${e.name}"`}function an(e){return e.kind==="variable"?`global variable "${e.name}"`:e.kind==="element"?`${e.state} ${fe(e.locator)}`:e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:e.kind==="actor"?"signed-in actor":`url ${e.kind}`}function Fo(e){return e.url!=null?`${e.kind} ${e.url}`:e.locator!=null?`${e.kind} ${fe(e.locator)}`:e.kind}function lr(e){let{field:t,source:r,target:n,targetField:o}=e.reference;return`${r}.${t} \u2192 ${n}.${o}`}function Te(e){return e==null?"\u2205":JSON.stringify(e)}function $o(e){if(e.kind==="entities")return rw(e);if(e.kind==="condition")return"a required condition did not hold";let t=e.want==null?"absent":et(e.want),r=e.got===void 0?"absent":et(e.got);return`${nw(e.subject)} needed ${t} but was ${r}`}function rw(e){if(e.entity==null)return"the required rows exist individually but could not be matched together";if(e.mustBeAbsent)return`a ${e.entity} row that must be absent was present`;let t=e.alias==null?"":` "${e.alias}"`;return`a required ${e.entity} row${t} was not present`}function nw(e){return e.kind==="element"?`${e.state} ${ie(e.locator)}`:e.kind==="variable"?`"${e.name}"`:e.kind==="query"?`url query "${e.key}"`:e.kind==="actor"?"signed-in actor":`url ${e.kind}`}var ow={"no-effect":"the action has no observable effect from this state","required-state-unsatisfied":"the live state doesn't satisfy the step's required state",unresolvable:"a step references a value that doesn't exist yet (e.g. a not-yet-created id)"};function na(e){return ow[e]}function Kd({debugDir:e,runId:t}){let r=`${e}/${t}`;return Wd("behavior",Ie.path(`${r}/behavior.jsonl`),void 0)}function ln(e){return e.kind==="drag"?`drag ${ie(e.source)} to ${ie(e.target)}`:"locator"in e&&e.locator!=null?`${e.kind} ${ie(e.locator)}`:"url"in e?`${e.kind} ${iw(e.url)}`:e.kind}function iw(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:ra(e)}function dt(e){return e.kind==="not"?`not ${dt(e.predicate)}`:e.kind==="and"?e.predicates.map(t=>dt(t)).join(" \u2227 "):e.kind==="when"?e.branches.map(t=>t.name).join(" | "):sw(e)}function sw(e){return"locator"in e?aw(e):e.kind==="browser"?`${e.name}=${et(e.value)}`:e.kind==="singleton"?`${e.singleton}=${et(e.assertion.value)}`:e.kind==="count"?Yn(e):e.kind==="actor"?e.target.kind==="anonymous"?"actor is signed out":`actor is ${e.target.ref.ref}`:""}function aw(e){let t=ie(e.locator);if(e.kind==="value"||e.kind==="text"){let r=ot(e.value)?e.value.value:e.value;return`${e.kind} ${t}=${et(r)}`}return`${e.kind} ${t}`}function qd({contradiction:e,evidencePath:t}){let r=lw(e);return t==null?r:`${r} Evidence: ${Ie.path(t)}`}function Do(e){return`${uw(e)}.`}function _o(e){return vw(dw(e))}function lw(e){switch(e.kind){case"check":{let t=` After "${e.step.intent}".`;return`${cw(e.record.body)} ${Do(e.record.body)}${t}`}case"stepError":return`${oe("driver")} Browser failed at "${e.step.intent}" \u2014 ${jr(e.record.error)}. Environment, not app or test.`;case"finding":return bw(e.finding)}}function cw(e){switch(e.family){case"element":case"content":case"scalar":return oe("assertion");case"state":case"frame":return oe("state");case"action":return oe("action");case"dataRule":return oe("data rule")}}function uw(e){switch(e.family){case"element":return`Expected ${e.subject} ${e.negated?"not ":""}${e.checkKind} \u2014 ${pw(e)}`;case"content":return`Expected ${e.subject} ${e.checkKind} ${Sw(e.match)} ${JSON.stringify(e.expected)}${e.negated?" to not hold":""} \u2014 ${fw(e)}`;case"scalar":return`Expected ${e.subject} to ${e.negated?"not ":""}be ${Hd(e.expected)} \u2014 ${hw(e)}`;case"state":return`Expected ${e.subject} ${e.assertion} \u2014 ${mw(e)}`;case"frame":return`Unexpected change \u2014 ${yw(e)}`;case"action":return`Could not ${e.actionKind} ${e.subject} \u2014 ${gw(e)}`;case"dataRule":return`Data rule ${e.rule} broke \u2014 a referenced row went missing`}}function dw(e){switch(e.kind){case"check":return Bc(e.record.body)??Do(e.record.body);case"stepError":return`driver failed at "${e.step.intent}": ${jr(e.record.error)}`;case"finding":return ww(e.finding)}}function oa(e){switch(e.kind){case"wrongValue":return`${e.entity}.${e.field} [${e.key}] showed ${Ie.actual(e.observed)}, expected ${Ie.expected(e.expected)}`;case"missingRow":return`${e.entity} row "${e.key}" never appeared`;case"unexpectedRow":return`${e.entity} row "${e.key}" is present but the test expected none`;case"unexpectedlyDeleted":return`${e.entity} row "${e.key}" disappeared`;case"neverChanged":return e.direction!=null?`${e.entity}.${e.field} [${e.key}] didn't ${e.direction==="increased"?"increase":"decrease"} from ${e.from} (showed ${Ie.actual(e.observed)})`:`${e.entity}.${e.field} [${e.key}] never changed from ${Ie.actual(e.observed)}`;case"wrongCount":return`found ${String(e.observed)} ${e.entity} rows, expected ${String(e.expected)}`}}function cr(e){let{outcome:t}=e;return t.kind==="passed"?null:t.reason}function pw(e){let t=cr(e);if(t==null)return"held";switch(t.kind){case"notFound":return"the element was not visible";case"multipleMatches":return`the locator matched ${String(t.count)} elements`;case"wrongState":return`the element ${t.observed.value?"stayed":"was never"} ${t.observed.checkKind}`;case"covered":return`the element is covered by ${t.by}`;case"unclassified":return t.message}}function fw(e){let t=cr(e);if(t==null)return"held";switch(t.kind){case"notFound":return"the element was not visible";case"multipleMatches":return`the locator matched ${String(t.count)} elements`;case"wrongContent":return`it showed ${JSON.stringify(t.observed)}`;case"unclassified":return t.message}}function hw(e){let t=cr(e);return t==null?"held":`it showed ${Hd(t.observed)}`}function Hd(e){return e??"absent"}function mw(e){let t=cr(e);return t==null?"held":oa(t)}function yw(e){let t=cr(e);return t==null?"none was seen":jc(t)}function gw(e){let t=cr(e);if(t==null)return"it succeeded";switch(t.kind){case"notFound":return"the element was not visible";case"multipleMatches":return`the locator matched ${String(t.count)} elements`;case"covered":return`the element is covered by ${t.by}`;case"notPossible":return"the test model says this action can't happen from the current state";case"unclassified":return t.message}}function Sw(e){switch(e){case"exact":return"to equal";case"contains":return"to contain";case"startsWith":return"to start with"}}function bw(e){switch(e.kind){case"impossible-action":return`${oe("impossible action")} "${e.step.intent}" ran ${Fo(e.step.action)} from a state the test calls impossible.`;case"unrunnable":return`${oe("model drift")} "${e.intent}" couldn't run \u2014 ${Yd(e)}.`;case"lift-visibility":return`${oe("reachability")} ${ie(e.locator)} is visible by step ${String(e.visibleIndex+1)} but declared at step ${String(e.declaredIndex+1)}.`}}function Yd(e){return e.unmet==null?na(e.reason):$o(e.unmet)}function ww(e){switch(e.kind){case"impossible-action":return`"${e.step.intent}" ran from a state the test says can't happen`;case"unrunnable":return`model drift: planned step "${e.intent}" could not run \u2014 ${Yd(e)}. Fix the model and recompile \u2014 do not dismiss`;case"lift-visibility":return`visible(${ie(e.locator)}) declared at step ${String(e.declaredIndex+1)} but already visible at step ${String(e.visibleIndex+1)}`}}var Rw=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function vw(e){return e.replaceAll(Rw,"").replaceAll(/\s+/g," ").trim()}function ur(e){let t=ne(e.scalars,{kind:"path"});return typeof t=="string"?t:null}function Bo(e,t){switch(e.kind){case"step":return{checkId:$c(e.ref,t),kind:"step"};case"action":return{checkId:Nc(t),kind:"step"};case"frame":return{checkId:Fc(t),kind:"step"};case"fact":return{factId:e.factId,kind:"fact"};case"dataRule":return{kind:"dataRule",ruleId:e.ruleId}}}function Zd(e){return e.body.outcome.kind==="failed"}function ia(e){return e.kind==="data-rule"?b({kind:e.kind,rule:sr(e.dataRule)}):b(e)}function jo({actual:e,canon:t,pre:r,predicted:n}){return[...[...new Set([...n.entities.keys(),...e.entities.keys()])].flatMap(s=>Ew({actual:e.entities.get(s),canon:t,entity:s,pre:r.entities.get(s),predicted:n.entities.get(s)})),...xw(r.scalars,n.scalars,e.scalars)]}function xw(e,t,r){let n=tt(r,R({kind:"path"}))!==void 0;return[...[...t.entries()].flatMap(([i,s])=>{if(s.subject.kind==="actor")return[];let a=tt(r,i),l=n&&St(s.subject)&&s.expect.expect!=="absent",c=a===void 0&&l?null:a;if(!s.declared||c===void 0||Tt({got:c,subject:s.subject,want:s.expect}))return[];let u=tt(e,i);return[{mismatch:{kind:"scalar-mismatch",subject:s.subject,sut:c,want:s.expect},pending:u!==void 0&&cn(u,c)}]}),...kw(e,t,r),...Cw(e,t,r)]}function tt(e,t){let r=e.get(t);return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function kw(e,t,r){let n=R({kind:"path"});if(tt(r,n)===void 0)return[];let o=!cn(tt(e,n),tt(r,n));return[...new Set([...e.keys(),...r.keys()])].flatMap(s=>{let a=(e.get(s)??r.get(s))?.subject;if(a==null||!St(a)||t.has(s))return[];let c=o&&a.kind!=="path"?null:tt(e,s)??null,u=tt(r,s)??null;return cn(c,u)?[]:[{mismatch:{kind:"scalar-mismatch",subject:a,sut:u,want:{expect:"is",value:c}},pending:!1}]})}function Cw(e,t,r){let n=R({kind:"actor"}),o=t.get(n);if(o==null)return[];let i=tt(r,n);if(Tt({got:i,subject:{kind:"actor"},want:o.expect}))return[];let s=tt(e,n);return[{mismatch:{kind:"scalar-mismatch",subject:{kind:"actor"},sut:i??null,want:o.expect},pending:s!==void 0&&cn(s,i)}]}function Ew({actual:e,canon:t,entity:r,pre:n,predicted:o}){return[...new Set([...o?.keys()??[],...e?.keys()??[]])].flatMap(s=>Pw({actual:e?.get(s),canon:t,entity:r,key:s,predicted:o?.get(s),preHadKey:n?.has(s)??!1,preRow:n?.get(s)}))}function Pw({actual:e,canon:t,entity:r,key:n,predicted:o,preHadKey:i,preRow:s}){if(o==null)return[{mismatch:{entity:r,key:n,kind:"unexpected-row",row:e},pending:i}];if(e==null)return[{mismatch:{entity:r,key:n,kind:"missing-row"},pending:!i}];let a=(c,u,d)=>cn(t(r,c,u),t(r,c,d));return[...new Set([...Object.keys(o),...Object.keys(e)])].filter(c=>!a(c,o[c],e[c])).map(c=>({mismatch:{entity:r,field:c,key:n,kind:"wrong-value",snapshot:o[c],sut:e[c]},pending:s==null?e[c]===void 0:a(c,s[c],e[c])}))}function cn(e,t){return Jd(e)===Jd(t)}function Jd(e){return e==null?"\u2205":JSON.stringify(e)}function Vo(e){let t=Aw(e.entities),r=Mw(e.singletons);return n=>Ow(n,t,r)}function Aw(e){return new Map(e.flatMap(t=>Object.entries(t.props).map(([r,n])=>[Xd(t.name,r),n.consistency])))}function Xd(e,t){return`${e}.${t}`}function Mw(e){return new Map(e.map(t=>[t.name,t.consistency]))}function Ow(e,t,r){return e.kind==="scalar-mismatch"?Iw(e.subject,r):e.kind==="unexpected-row"||e.kind==="missing-row"?"strict":t.get(Xd(e.entity,e.field))??"strict"}function Iw(e,t){return e.kind==="variable"?t.get(e.name)??"strict":"eventual"}function Wo(e){let t=new Set(e.valueSpaces.filter(r=>r.kind==="datetime").map(r=>r.name));return(r,n,o)=>{if(!t.has(`${r}.${n}`)||typeof o!="string")return o;let i=Date.parse(o);return Number.isNaN(i)?o:new Date(i).toISOString()}}var Rt=class extends Error{name="AbortError";constructor(){super("aborted")}};function un(e){return e instanceof Error&&e.name==="AbortError"}function be(e){if(e.aborted)throw new Rt}function vt(e,t){return t.aborted?Promise.reject(new Rt):new Promise((r,n)=>{let o=()=>{clearTimeout(i),n(new Rt)},i=setTimeout(()=>{t.removeEventListener("abort",o),r()},e);t.addEventListener("abort",o,{once:!0})})}function sa({check:e,ephemeral:t,failure:r,rrwebIds:n,waitedMs:o}){let{check:i,negated:s}=Qd(e,!1),a={ephemeral:t,rrwebIds:[...n],waitedMs:o};switch(i.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return{...a,checkKind:i.kind,family:"element",negated:s,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:Tw(r)},subject:fe(i.locator)};case"value":case"text":return{...a,checkKind:i.kind,expected:i.value,family:"content",match:i.match,negated:s,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:Lw(r)},subject:fe(i.locator)};case"browser":return{...a,expected:i.value,family:"scalar",negated:s,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:Nw(r)},subject:Gr(i.key),subjectKey:R(i.key),subjectKind:i.key.kind}}}function Qd(e,t){return e.kind==="not"?Qd(e.inner,!t):{check:e,negated:t}}function Tw(e){return e.kind==="wrongContent"?{kind:"unclassified",message:ep(e)}:e}function ep(e){switch(e.kind){case"notFound":return"element not found";case"multipleMatches":return`matched ${String(e.count)} elements`;case"covered":return`covered by ${e.by}`;case"wrongState":return`element ${e.observed.value?"is":"is not"} ${e.observed.checkKind}`;case"wrongContent":return`content was "${e.observed}"`;case"unclassified":return e.message}}function Lw(e){return e.kind==="wrongState"||e.kind==="covered"?{kind:"unclassified",message:ep(e)}:e}function aa({observed:e,passed:t,planned:r,waitedMs:n}){return{ephemeral:!1,expected:la(r.entry.expect),family:"scalar",negated:r.entry.expect.expect==="not",outcome:t?{kind:"passed"}:{kind:"failed",reason:{kind:"wrongScalar",observed:e}},rrwebIds:[],subject:an(r.entry.subject),subjectKey:R(r.entry.subject),subjectKind:r.entry.subject.kind,waitedMs:n}}function la(e){switch(e.expect){case"absent":return null;case"is":case"not":return Te(e.value)}}function Nw(e){return e.kind==="wrongContent"?{kind:"wrongScalar",observed:e.observed}:{kind:"wrongScalar",observed:null}}function ca({failure:e,planned:t,waitedMs:r}){return{assertion:Fw(t),entity:t.predicate.entity,ephemeral:!1,family:"state",outcome:e==null?{kind:"passed"}:{kind:"failed",reason:e},rrwebIds:[],subject:t.subject,waitedMs:r}}function Uo(e){switch(e.kind){case"unexpected-row":return{entity:e.entity,key:e.key,kind:"unexpectedRow"};case"missing-row":return{entity:e.entity,key:e.key,kind:"missingRow"};case"wrong-value":return{entity:e.entity,expected:Te(e.snapshot),field:e.field,key:e.key,kind:"wrongValue",observed:Te(e.sut)};case"expected-change":return{direction:e.direction??null,entity:e.entity,field:e.field,from:Te(e.from),key:e.key,kind:"neverChanged",observed:Te(e.value)}}}function Fw(e){let{negated:t,predicate:r}=e;switch(r.kind){case"count":return"count";case"exists":return t?"absent":"exists";case"state":return r.assertion.kind}}function ua({dataRule:e,violated:t,waitedMs:r}){return{ephemeral:!1,family:"dataRule",outcome:t?{kind:"failed",reason:{kind:"violated"}}:{kind:"passed"},rrwebIds:[],rule:lr(e),waitedMs:r}}function zo({failure:e,waitedMs:t}){return{ephemeral:!1,family:"frame",outcome:e==null?{kind:"passed"}:{kind:"failed",reason:e},rrwebIds:[],waitedMs:t}}function da({action:e,failure:t,rrwebIds:r,waitedMs:n}){return{actionKind:e.kind,ephemeral:!1,family:"action",outcome:t==null?{kind:"passed"}:{kind:"failed",reason:t},rrwebIds:[...r],subject:Dw(e),value:_w(e),waitedMs:n}}function pa(e){if(e.kind!=="scalar-mismatch")return Uo(e);let t=e.subject;return t.kind==="element"?$w(e,t):{expected:la(e.want),kind:"wrongScalar",observed:e.sut==null?null:Te(e.sut),subject:an(t),subjectKey:R(t)}}function $w(e,t){let r=fe(t.locator),n=R(t);return t.state==="text"||t.state==="value"?{checkKind:t.state,expected:la(e.want),kind:"wrongElementContent",observed:e.sut==null?null:Te(e.sut),subject:r,subjectKey:n}:{checkKind:t.state,kind:"wrongElementState",observed:e.sut===!0,subject:r,subjectKey:n}}function Dw(e){return e.locator!=null?fe(e.locator):e.url!=null?e.url:""}function _w(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key!=null?e.key:null}function tp(e){let t=Bw(e);return[...Uw(e,t),...zw(e,t),...Gw(e,t)]}function Bw(e){return e.mismatches.reduce((t,r)=>jw(t,r.mismatch,e),{frame:[],scalar:new Map,state:new Map})}function jw(e,t,r){if(t.kind==="scalar-mismatch")return Vw(e,t,r);let n=t,o=r.stateChecks.find(i=>!e.state.has(i)&&Ww(i,n));return o==null?{...e,frame:[...e.frame,t]}:{...e,state:new Map([...e.state,[o,n]])}}function Vw(e,t,r){let n=R(t.subject),o=r.scalarChecks.find(i=>!e.scalar.has(i)&&R(i.entry.subject)===n);return o!=null?{...e,scalar:new Map([...e.scalar,[o,t]])}:r.pendingElementKeys.has(n)?e:{...e,frame:[...e.frame,t]}}function Ww(e,t){if(e.predicate.kind!=="state"||e.predicate.entity!==t.entity)return!1;let{assertion:r}=e.predicate;switch(t.kind){case"wrong-value":return(r.kind==="created"||r.kind==="updated")&&t.field in r.props;case"missing-row":return r.kind==="created"||r.kind==="updated";case"expected-change":return r.kind==="updated"&&t.field in r.props;case"unexpected-row":return r.kind==="deleted"}}function Uw(e,t){return e.scalarChecks.map(r=>{let n=t.scalar.get(r),o=n?.kind==="scalar-mismatch"&&n.sut!=null?Te(n.sut):null;return{atMs:e.atMs,body:aa({observed:o,passed:n==null,planned:r,waitedMs:e.waitedMs}),target:{kind:"step",ref:r.ref}}})}function zw(e,t){return e.stateChecks.map(r=>{let n=t.state.get(r),o=n==null?null:Uo(n);return{atMs:e.atMs,body:ca({failure:r.verify==null?o:r.verify(e.post),planned:r,waitedMs:e.waitedMs}),target:{kind:"step",ref:r.ref}}})}function Gw(e,t){return t.frame.length===0?[{atMs:e.atMs,body:zo({failure:null,waitedMs:e.waitedMs}),target:{kind:"frame"}}]:t.frame.map(r=>({atMs:e.atMs,body:zo({failure:pa(r),waitedMs:e.waitedMs}),target:{kind:"frame"}}))}function rp(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function Kw(e,t,r){return r.reconcile==null?e:r.reconcile(e,t)}function np(e,t,r){let n=e.probed.filter(o=>!o.pending&&r(o.mismatch)==="strict");return n.length>0?{mismatches:n,snapshot:e.adopted,stepError:null}:e.probed.length===0?{mismatches:[],snapshot:e.adopted,stepError:null}:null}async function ip({canon:e,claimed:t,classify:r,observe:n,pre:o,predicted:i,signal:s,step:a}){let l=ho[a.sync],c=Date.now()+l.timeoutMs,u=Se(o.scalars,i.scalars),d=new Map([...u].filter(([m,v])=>v.declared&&(v.subject.kind!=="element"||t.has(m)))),p=()=>n(d),y=await rp(p);if(!y.ok)return{mismatches:[],snapshot:i,stepError:{atMs:Date.now(),error:y.error}};let h=op({canon:e,pre:o,predicted:i,step:a},y.observed),f=0;for(;Date.now()<c;){be(s);let m=np(h,a,r);if(m!=null)return m;await vt(Gu(l,f),s),f+=1;let v=await rp(p);if(!v.ok)return{mismatches:h.probed,snapshot:h.adopted,stepError:{atMs:Date.now(),error:v.error}};h=op({canon:e,pre:o,predicted:i,step:a},v.observed)}return np(h,a,r)??{mismatches:h.probed,snapshot:h.adopted,stepError:null}}function op({canon:e,pre:t,predicted:r,step:n},o){let i=n.verifyChanges==null?[]:n.verifyChanges(r,o),s=Kw(r,o,n),a=i.map(l=>({mismatch:l,pending:!0}));return{adopted:s,probed:[...a,...jo({actual:o.snapshot,canon:e,pre:t,predicted:s})]}}function dr(e){if(e.kind==="not")return dr(e.inner);if(e.kind!=="browser")return e.locator}function sp(e){return e.stepError!=null||e.findings.length>0||e.checks.some(t=>Zd(t))}var qw=()=>[],Hw=()=>_e;async function Go({canon:e,classify:t,dataRuleChecks:r,derive:n,initialSnapshot:o,observe:i,onStep:s,steps:a,stopAfterStep:l},c){return ap({canon:e,classify:t,dataRuleChecks:r??qw,derive:n??Hw,failed:!1,findings:[],index:0,observe:i,onStep:s,signal:c,snapshot:o,steps:a,stopAfterStep:l})}async function ap(e){let{index:t,signal:r,snapshot:n,steps:o}=e;be(r);let i=o[t];if(i==null)return{failed:e.failed,finalModel:n,findings:e.findings};let s=Date.now(),a=await i.targetIds();if(!i.requiredState(n)){let l={kind:"impossible-action",step:i.step};return ha(e.onStep,{checks:[fa({failure:{kind:"notPossible"},rrwebIds:a,startMs:s,step:i})],endMs:Date.now(),executedBranches:i.executedBranches,findings:[l],index:t,post:n,pre:n,source:i.source,startMs:s,step:i.step,stepError:null,url:ur(n)}),{failed:!0,finalModel:n,findings:[...e.findings,l]}}return i.perform().match(()=>Jw({params:e,rrwebIds:a,startMs:s,step:i}),l=>Promise.resolve(Yw({error:l,params:e,rrwebIds:a,startMs:s,step:i})))}function Yw({error:e,params:t,rrwebIds:r,startMs:n,step:o}){let{checks:i,stepError:s}=Zw({error:e,rrwebIds:r,startMs:n,step:o});return ha(t.onStep,{checks:i,endMs:Date.now(),executedBranches:o.executedBranches,findings:[],index:t.index,post:t.snapshot,pre:t.snapshot,source:o.source,startMs:n,step:o.step,stepError:s,url:ur(t.snapshot)}),{failed:!0,finalModel:t.snapshot,findings:t.findings}}function Zw({error:e,rrwebIds:t,startMs:r,step:n}){return e.kind==="action-failed"?{checks:[fa({failure:e.failure,rrwebIds:t,startMs:r,step:n})],stepError:null}:{checks:[],stepError:{atMs:Date.now(),error:e}}}function fa({failure:e,rrwebIds:t,startMs:r,step:n}){let o=Date.now();return{atMs:o,body:da({action:n.step.action,failure:e,rrwebIds:t,waitedMs:Math.max(0,o-r)}),target:{kind:"action"}}}async function Jw({params:e,rrwebIds:t,startMs:r,step:n}){let{snapshot:o}=e,i=n.effect(o),s=e.derive(i),a={...i,scalars:Se(s,i.scalars)},l=await ip({canon:e.canon,claimed:new Set([...n.assertedScalars,...s.keys()]),classify:e.classify,observe:e.observe,pre:o,predicted:a,signal:e.signal,step:n}),c={...l.snapshot,scalars:new Map([...[...l.snapshot.scalars].filter(([,g])=>g.subject.kind!=="element"),...[...i.scalars].filter(([,g])=>g.subject.kind==="element")])},u=Date.now(),d=[...n.pendingChecks,...e.dataRuleChecks(o,l.snapshot)],p=await tR({pendingChecks:d,signal:e.signal,windowStartMs:r}),y=fa({failure:null,rrwebIds:t,startMs:r,step:n}),h=tp({atMs:u,mismatches:l.mismatches,pendingElementKeys:Xw(n.pendingChecks),post:l.snapshot,scalarChecks:n.scalarChecks,stateChecks:n.stateChecks,waitedMs:Math.max(0,u-r)}),f=[y,...p.checks,...h],m=eR([...l.stepError==null?[]:[l.stepError],...p.stepErrors]),v={checks:f,endMs:Date.now(),executedBranches:n.executedBranches,findings:[],index:e.index,post:l.snapshot,pre:o,source:n.source,startMs:r,step:n.step,stepError:m,url:ur(l.snapshot)};return ha(e.onStep,v),sp(v)?{failed:!0,finalModel:c,findings:e.findings}:e.stopAfterStep!=null&&e.index+1>=e.stopAfterStep?{failed:!1,finalModel:c,findings:e.findings}:ap({...e,index:e.index+1,snapshot:c})}function Xw(e){return new Set(e.flatMap(t=>{if(!("check"in t.source))return[];let r=dr(t.source.check);return r==null?[]:Qw(t.source.check,r)}))}function Qw(e,t){let r=lp(e);return r==="browser"||r==="unobstructed"||r==="disabled"?[]:[Jt(t,r)]}function lp(e){return e.kind==="not"?lp(e.inner):e.kind}function eR(e){return e.at(0)??null}async function tR({pendingChecks:e,signal:t,windowStartMs:r}){let n=[...new Map(e.map(i=>[ia(i.source),i])).values()],o=await Promise.all(n.map(async i=>{let s=await sR({pendingCheck:i,signal:t,windowStartMs:r}),a=Date.now(),l=await i.targetIds();return{atMs:a,outcome:s,pendingCheck:i,rrwebIds:l}}));return{checks:o.flatMap(i=>i.outcome.kind==="error"?[]:[rR({atMs:i.atMs,outcome:i.outcome,pendingCheck:i.pendingCheck,rrwebIds:i.rrwebIds,windowStartMs:r})]),stepErrors:o.flatMap(i=>i.outcome.kind==="error"?[{atMs:i.atMs,error:i.outcome.error}]:[])}}function rR({atMs:e,outcome:t,pendingCheck:r,rrwebIds:n,windowStartMs:o}){let i=Math.max(0,e-o);return r.source.kind==="data-rule"?{atMs:e,body:ua({dataRule:r.source.dataRule,violated:t.kind==="failed",waitedMs:i}),target:{kind:"dataRule",ruleId:sr(r.source.dataRule)}}:{atMs:e,body:sa({check:r.source.check,ephemeral:r.ephemeral,failure:nR(t),rrwebIds:n,waitedMs:i}),target:oR(r.source)}}function nR(e){return e.kind==="passed"?null:e.failure??{kind:"unclassified",message:"check failed without diagnosis"}}function oR(e){switch(e.kind){case"step":return{kind:"step",ref:e.ref};case"fact":return{factId:ia(e),kind:"fact"};case"data-rule":return{kind:"dataRule",ruleId:sr(e.dataRule)}}}var iR=250;async function sR({pendingCheck:e,windowStartMs:t}){let r=e.check;if(r.kind==="decided")return r.passed?{kind:"passed"}:{failure:null,kind:"failed"};let n=Date.now()-t,o=Math.max(iR,ho[e.budget].timeoutMs-n);return r.wait(o).match(async i=>i?{kind:"passed"}:aR(r.diagnose),i=>Promise.resolve(cp(i)))}function aR(e){return e().match(t=>({failure:t,kind:"failed"}),t=>cp(t))}function cp(e){if(e.kind==="aborted")throw new Rt;return{error:e,kind:"error"}}function ha(e,t){e?.(t)}function ma(e){let t=e.predicates.filter(i=>yp(i)),r=t.filter(i=>i.assertion.kind==="created"),n=fp(t);if(r.length===0&&n.length===0&&e.deferred.length===0)return;let o=t.filter(i=>i.assertion.kind==="updated");return(i,s)=>{let a=r.reduce((u,d)=>fR(u,s,d,e),{env:e.env,snapshot:i}),l=n.reduce((u,d)=>pR(u,s,d,e.env),a.snapshot),c=o.reduce((u,d)=>lR(u,s,d),a.env);return gR(l,e.deferred,c)}}function pp(e,t,r){return new Map([...e,...Object.entries(r).map(([n,o])=>[Ce(A,`${t}.${n}`),o])])}function lR(e,t,r){let n=Be(t.snapshot,r.entity,r.key,e).at(0);return n==null?e:pp(e,r.assertion.as,n)}function ya(e){let t=fp(e.predicates.filter(r=>yp(r)));if(t.length!==0)return(r,n)=>t.flatMap(o=>cR(o,r,n,e.env))}function fp(e){return e.filter(t=>t.assertion.kind==="updated"&&hp(t.assertion.props).length>0)}function hp(e){return mp(e).map(([t])=>t)}function mp(e){return Object.entries(e).flatMap(([t,r])=>bt(r)?[[t,r.direction]]:[])}function yp(e){return e.assertion.kind==="created"||e.assertion.kind==="updated"}function cR(e,t,r,n){let o=Be(t,e.entity,e.key,n).at(0),i=Be(r.snapshot,e.entity,e.key,n).at(0);if(o==null||i==null)return[];let s=It(uR(e.key,n));return mp(e.assertion.props).flatMap(([a,l])=>dR(o[a],i[a],l)?[]:[{direction:l,entity:e.entity,field:a,from:o[a],key:s,kind:"expected-change",value:i[a]}])}function uR(e,t){let r=Object.fromEntries(Object.entries(e).filter(n=>!ve(n[1])&&!Fe(n[1])));return er(r,A,ge(t))}function dR(e,t,r){return r==null?up(e)!==up(t):r==="increased"?dp(e,t):dp(t,e)}function up(e){return e==null?"\u2205":JSON.stringify(e)}function dp(e,t){return(typeof e=="number"&&typeof t=="number"||typeof e=="string"&&typeof t=="string")&&e<t}function pR(e,t,r,n){let o=hp(r.assertion.props),i=Be(t.snapshot,r.entity,r.key,n).at(0);return i==null?e:xu(e,r.entity,r.key,n,s=>({...s,...Object.fromEntries(o.flatMap(a=>{let l=i[a];return l===void 0?[]:[[a,l]]}))}))}function fR(e,t,r,n){if(r.assertion.kind!=="created")return e;let o=er(r.assertion.props,A,ge(n.env)),i=e.snapshot.entities.get(r.entity);if(i==null)return e;let s=hR({identityFields:n.identities.get(r.entity)??[],props:o,set:i});if(s==null)return e;let a=mR(t.snapshot.entities.get(r.entity),i,o);if(a==null)return e;let[l,c]=a,u=new Map(i);return u.delete(s),u.set(l,{...c,...o}),{env:pp(e.env,r.assertion.as,c),snapshot:{...e.snapshot,entities:new Map(e.snapshot.entities).set(r.entity,u)}}}function hR({identityFields:e,props:t,set:r}){let n=It(t);if(r.has(n))return n;if(e.length===0)return null;let o=Object.entries(t),i=[...r].find(([,s])=>e.every(a=>vu(s[a]))&&o.every(([a,l])=>Ko(s[a])===Ko(l)));return i==null?null:i[0]}function mR(e,t,r){if(e==null)return;let n=Object.entries(r),o=[...e].filter(([i])=>!t.has(i)).map(([i,s])=>({entry:[i,s],score:n.filter(([a,l])=>Ko(s[a])===Ko(l)).length}));return yR(o,n.length)}function Ko(e){return e==null?"\u2205":JSON.stringify(e)}function yR(e,t){let r=e.reduce((o,i)=>Math.max(o,i.score),0);if(r===0)return;let n=e.filter(o=>o.score===r);if(!(r<t&&n.length!==1))return n[0]?.entry}function gR(e,t,r){let n=t.reduce((o,i)=>{let s=SR(i.value,r);return s==null||typeof s!="string"?o:lt(o,{declared:!0,expect:{expect:"is",value:s},subject:i.key})},e.scalars);return{...e,scalars:n}}function SR(e,t){try{return He(e,A,ge(t))}catch{return}}function ga(e){return e.kind==="not"?ga(e.inner):e.kind==="browser"&&hu(e.key)}function Sa(e,t){if(e.kind==="visible"||e.kind==="unobstructed"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed")return{kind:e.kind,locator:ae(e.locator,t)};if(e.kind==="not"){let r=Sa(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?bR(e,t):e.kind!=="browser"?null:{key:to(e.name,e.part),kind:"browser",value:e.value===null?null:He(e.value,A,t)}}function pr(e,t){let{executedBranches:r,step:n}=e,{env:o,identities:i}=t,s=qn({executedBranches:r,expect:n.expect}),a=s.flatMap(w=>w.predicate.kind==="state"&&!w.negated?[w.predicate]:[]),l=DR(a),c=t.snapshot==null?void 0:$t(t.snapshot,a,t),u={counts:c==null?void 0:pe(c),env:o},d={counts:t.snapshot==null?void 0:pe(t.snapshot),env:o},{clears:p,deferred:y,sets:h}=IR({after:u,captures:l,leaves:s,step:n}),f=fo(n),m=_R(n.action,d),v=wR(n,s);return{action:m,assertedScalars:[...h.keys()],executedBranches:r,label:n.action.kind,pendingChecks:s.flatMap(w=>VR(w,u,f)),reconcile:ma({deferred:y,env:o,identities:i,predicates:a}),scalarChecks:s.flatMap(w=>vR(w,u)),stateChecks:s.flatMap(w=>xR(w,o)),urlChecks:s.flatMap(w=>jR(dn(w),u)),verifyChanges:ya({deferred:y,env:o,identities:i,predicates:a}),effect:w=>Ru($t(w,a,t),{clears:p,forget:v,sets:h})}}function bR(e,t){let r=ot(e.value);return{kind:e.kind,locator:ae(e.locator,t),match:r?e.value.kind:"exact",value:He(r?e.value.value:e.value,A,t)}}function wR(e,t){return e.action.kind==="goto"||e.action.kind==="actor"||RR(t)?"hard":Bt(e)?"soft-path":"none"}function RR(e){return e.some(t=>t.predicate.kind==="actor")}function vR(e,t){let{predicate:r}=e;if(r.kind!=="singleton"&&r.kind!=="browser"&&r.kind!=="actor")return[];let n=ue(dn(e));if(n==null)return[];try{return[{entry:Ye({declared:!0,entry:n,scope:t}),negated:e.negated,ref:{branch:e.branch,ordinal:e.ordinal}}]}catch(o){if(o instanceof $e)return[];throw o}}function dn(e){return e.negated?{kind:"not",predicate:e.predicate}:e.predicate}function xR(e,t){let{predicate:r}=e;return r.kind!=="state"&&r.kind!=="count"&&r.kind!=="exists"?[]:[{negated:e.negated,predicate:r,ref:{branch:e.branch,ordinal:e.ordinal},subject:kR(r,t),verify:r.kind==="state"?void 0:PR(r,e.negated,t)}]}function kR(e,t){let r=e.kind==="state"?e.key:e.where,n=Object.entries(r).map(([o,i])=>`${o}=${CR(i,t)}`);return n.length===0?e.entity:`${e.entity} where ${n.join(", ")}`}function CR(e,t){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"?JSON.stringify(e):e==null?"null":N(e)?ER(e,t):"?"}function ER(e,t){try{return JSON.stringify(Wr(e,A,t))}catch(r){if(r instanceof $e)return e.ref;throw r}}function PR(e,t,r){return n=>{let o=Be(n,e.entity,e.where,r);return e.kind==="count"?AR(e,o.length):MR({entity:e.entity,negated:t,rows:o})}}function AR(e,t){return t===e.value?null:{entity:e.entity,expected:e.value,kind:"wrongCount",observed:t}}function MR({entity:e,negated:t,rows:r}){let n=r.at(0);return t?n==null?null:{entity:e,key:It(n),kind:"unexpectedRow"}:n==null?{entity:e,key:"",kind:"missingRow"}:null}function OR(e){return e.action.kind!=="actor"?null:{expect:{expect:"is",value:{ref:`${e.action.ref.ref}.id`}},subject:{kind:"actor"}}}function IR({after:e,captures:t,leaves:r,step:n}){let o=n.action.kind==="goto"?Yr(n.action.url):[],i=OR(n),s=r.filter(c=>!At(dn(c))).flatMap(c=>{let u=ue(dn(c));return u==null?[]:[u]}),a=[...o,...s,...i==null?[]:[i]].map(c=>({declared:!0,entry:c}));return[...Zr(n).map(c=>({declared:!1,entry:c})),...a].reduce((c,{declared:u,entry:d})=>TR({acc:c,captures:t,declared:u,entry:d,scope:e}),{clears:[],deferred:[],sets:_e})}function TR({acc:e,captures:t,declared:r,entry:n,scope:o}){if(LR(n,t))return n.expect.expect==="is"&&gp(n.expect.value)?{...e,deferred:[...e.deferred,{key:$R(n.subject),value:n.expect.value}]}:e;let i=Ye({declared:r,entry:n,scope:o});return i.expect.expect==="absent"&&!St(i.subject)?{...e,clears:[...e.clears,R(i.subject)]}:{...e,sets:lt(e.sets,i)}}function LR(e,t){return e.subject.kind==="element"||e.subject.kind==="variable"?!1:e.expect.expect==="is"&&gp(e.expect.value)&&NR(e.expect.value,t)}function gp(e){return typeof e=="string"||typeof e=="object"}function NR(e,t){return FR(e).some(r=>t.has(nr(r)))}function FR(e){return typeof e=="string"?[]:N(e)?[e.ref]:e.template.filter(t=>typeof t!="string").map(t=>t.ref)}function $R(e){if(e.kind==="element"||e.kind==="variable"||e.kind==="actor")throw new Error("expected a browser subject");return e}function DR(e){return new Set(e.flatMap(t=>t.assertion.kind==="created"||t.assertion.kind==="updated"?[t.assertion.as]:[]))}function _R(e,t){return{actorRef:e.kind==="actor"?e.ref.ref:void 0,files:e.kind==="upload"?e.files:void 0,key:e.kind==="press"?e.key:void 0,kind:e.kind,locator:BR(e,t),target:e.kind==="drag"?ae(e.target,t):void 0,url:e.kind==="goto"?He(e.url,A,t):void 0,value:"value"in e?uu(e.value,t):void 0}}function BR(e,t){if(e.kind==="drag")return ae(e.source,t);if(!(!("locator"in e)||e.locator==null))return ae(e.locator,t)}function jR(e,t){if(e.kind!=="browser"&&e.kind!=="not")return[];try{let r=Sa(e,t);return r!=null&&ga(r)?[r]:[]}catch(r){if(r instanceof $e)return[];throw r}}function VR(e,t,r){let n=dn(e);if(e.predicate.kind==="browser"||e.predicate.kind==="singleton")return[];let o=Sa(n,t);return o==null?[]:[{budget:WR(e.predicate,r),check:o,ephemeral:At(n),ref:{branch:e.branch,ordinal:e.ordinal}}]}function WR(e,t){return"wait"in e&&e.wait!=null?e.wait:t?"slow":"fast"}import{err as UR,errAsync as zR,ok as Sp,okAsync as bp,Result as GR}from"neverthrow";function fr(e,t,r){let n=tv(e),o={env:new Map,generate:r.generate,generatedParams:new Set,indexed:n,overrides:new Map(Object.entries(r.params??{}).map(([s,a])=>[De(s),a]))};rv(t.params,A,o);let i=t.world.map(s=>nv(s,A,o));return r.materialize(i).andThen(s=>av(s,o.env,n).asyncAndThen(a=>KR({base:a,rows:s,signIn:r.signIn,test:t}).map(l=>qR({base:l,generatedParams:o.generatedParams,lockfile:e,test:t}))))}function qo(e,t){let r=new Map(t.map(n=>[n.name,n]));return n=>bp(XR(n,e,r).rows)}function Ho(e){return t=>{let r=t.map(n=>({as:n.as,entity:n.entity,fields:n.fields}));return e(r).andThen(n=>JR(t,n))}}function wa(e,t){let r=pn(t);return Object.fromEntries(Object.entries(e).filter(([n,o])=>r.includes(n)&&o!=null))}function pn(e){return Object.keys(e.props)}function KR({base:e,rows:t,signIn:r,test:n}){if(n.actor.kind!=="user"||r==null)return bp(e);let o=n.actor.alias,i=t.find(s=>s.as===o);return i==null?zR(Es(o)):r({entity:i.entity,row:i.row}).map(s=>({...e,auth:s}))}function qR({base:e,generatedParams:t,lockfile:r,test:n}){let o=Object.fromEntries(r.singletons.map(d=>[d.name,d.default])),i=Object.fromEntries(Object.entries(n.singletons).map(([d,p])=>[d,Ee(p,A,ge(e.env))])),s=Object.entries(n.singletons).filter(([,d])=>HR(d,t)).map(([d])=>d),a={...o,...i},l=new Set(r.singletons.filter(d=>d.source==="client").map(d=>d.name)),c=Object.fromEntries(Object.entries(a).filter(([d])=>l.has(d))),u=YR(e.aliases,n);return{...e,clientState:c,generatedSingletons:s,snapshot:{...e.snapshot,scalars:Se(e.snapshot.scalars,new Map([...Object.entries(a).map(([d,p])=>[R({kind:"variable",name:d}),{declared:!0,expect:{expect:"is",value:p},subject:{kind:"variable",name:d}}]),...u,...ZR(n)]))}}}function HR(e,t){return N(e)?t.has(Ce(A,e.ref)):qe(e)?e.template.some(r=>typeof r!="string"&&"ref"in r&&t.has(Ce(A,r.ref))):!1}function YR(e,t){if(t.actor.kind!=="user")return[];let r=t.actor.alias,n=e.find(o=>o.alias===r);return n==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:n.key},subject:{kind:"actor"}}]]}function ZR(e){return[[R({kind:"viewport"}),{declared:!1,expect:{expect:"is",value:e.viewport},subject:{kind:"viewport"}}]]}function JR(e,t){let r=new Map(t.map(n=>[n.as,n]));return GR.combine(e.map(n=>{let o=r.get(n.as);return o==null?UR(Es(n.as)):Sp({as:n.as,entity:n.entity,generatedFields:n.generatedFields,row:o.row})}))}function XR(e,t,r){return e.reduce((n,o)=>{let i=QR(o.fields,n.env),s=lv({generate:t,model:o.model,seedPrefix:o.seedPrefix,set:i,valueSpaces:r}),a=Object.entries(s).map(([c,u])=>[`${o.as}.${c}`,u]),l=Object.keys(s).filter(c=>!(c in i));return{env:new Map([...n.env,...a]),rows:[...n.rows,{as:o.as,entity:o.entity,generatedFields:[...new Set([...o.generatedFields,...l])],row:s}]}},{env:new Map,rows:[]})}function QR(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>{if(N(n))return[r,ev(t,n.ref)];if(qe(n))throw new Error(`template value not allowed in entity field "${r}"`);return[r,n]}))}function ev(e,t){let r=e.get(t);if(r==null)throw new Error(`setup ref "${t}" was not produced by an earlier entity`);return r}function tv(e){return{models:new Map(e.entities.map(t=>[t.name,t])),valueSpaces:new Map(e.valueSpaces.map(t=>[t.name,t]))}}function rv(e,t,r){Object.entries(e).forEach(([n,o])=>{let i=Ce(t,n),s=r.indexed.valueSpaces.get(o.valueSpace);if(s==null)throw new Error(`unknown valueSpace "${o.valueSpace}" for param "${i}"`);let a=r.overrides.get(i);a==null&&r.generatedParams.add(i);let l=a??r.generate.value({anchor:void 0,nullable:!1,seed:i,space:s,type:Lc(s),valueSpace:o.valueSpace});r.env.set(i,l)})}function nv(e,t,r){let n=r.indexed.models.get(e.entity);if(n==null)throw new Error(`model "${e.entity}" not found for setup "${e.as}"`);let o=Ce(t,e.as),i=ov(e.set,t,r.env),s=sv(n,i,o,r),a=Object.entries(e.set).filter(([,l])=>N(l)&&r.generatedParams.has(Ce(t,l.ref))).map(([l])=>l);return{as:o,entity:e.entity,fields:{...s,...i},generatedFields:[...Object.keys(s),...a],model:n,seedPrefix:o}}function ov(e,t,r){return Object.fromEntries(Object.entries(e).map(([n,o])=>[n,iv(o,t,r)]))}function iv(e,t,r){if(!N(e))return e;let n=Ce(t,e.ref);return r.get(n)??{ref:n}}function sv(e,t,r,n){return Object.fromEntries(Object.entries(e.props).filter(([o,i])=>!i.optional&&!e.identity.includes(o)&&!(o in t)).map(([o,i])=>[o,wp({field:o,generate:n.generate,model:e,seedPrefix:r,spec:i,valueSpaces:n.indexed.valueSpaces})]))}function av(e,t,r){let n=new Map;e.forEach(a=>{let l=r.models.get(a.entity);if(l==null)throw new Error(`model "${a.entity}" not found for setup "${a.as}"`);Object.entries(a.row).forEach(([u,d])=>t.set(Ce(De(a.as),u),d));let c=n.get(a.entity)??new Map;c.set(ba(a.row,l),wa(a.row,l)),n.set(a.entity,c)});let o=e.flatMap(a=>{let l=r.models.get(a.entity);return l==null?[]:[{alias:a.as,entity:a.entity,key:ba(a.row,l)}]}),i=e.flatMap(a=>{let l=r.models.get(a.entity);if(l==null)return[];let c=ba(a.row,l);return a.generatedFields.map(u=>({entity:a.entity,field:u,key:c}))}),s=new Map(e.map(a=>[a.as,{entity:a.entity,row:a.row}]));return Sp({aliases:o,auth:void 0,env:t,generated:i,principals:s,snapshot:{entities:cv(n),scalars:_e}})}function lv({generate:e,model:t,seedPrefix:r,set:n,valueSpaces:o}){return{...Object.fromEntries(Object.entries(t.props).filter(([s])=>!(s in n)).map(([s,a])=>[s,wp({field:s,generate:e,model:t,seedPrefix:r,spec:a,valueSpaces:o})])),...n}}function wp({field:e,generate:t,model:r,seedPrefix:n,spec:o,valueSpaces:i}){let s=`${r.name}.${e}`;return t.value({anchor:void 0,nullable:o.optional,seed:Ce(n,e),space:i.get(s),type:o.type,valueSpace:s})}function ba(e,t){return t.identity.map(r=>String(e[r])).join(":")}function cv(e){return new Map([...e].map(([t,r])=>[t,new Map(r)]))}function fn(e,t,r){let n=Pe(e.requiredState,t);return n==null?null:new Map([...Object.entries(r).map(([o,i])=>[De(o),i]),...n])}function hn(e,t,r){let n={env:t,identities:e.identities,snapshot:r},o=Eu(e.whenSteps,r,n),i=o.at(-1)??{executedBranches:[],step:e.effectStep},s=pr(i,n),a=dv(e,n),l=o.reduce((c,u)=>{let d=pr(u,{...n,snapshot:c.current});return{current:d.effect(c.current),steps:[...c.steps,{action:d.action,assertedScalars:d.assertedScalars,effect:d.effect,executedBranches:u.executedBranches,pendingChecks:d.pendingChecks,reconcile:d.reconcile,scalarChecks:d.scalarChecks,source:u.step,stateChecks:d.stateChecks,urlChecks:d.urlChecks,verifyChanges:d.verifyChanges}]}},{current:r,steps:[]});return{effect:pv(s.effect,a),steps:l.steps}}function Zo(e,t,r){return Pe(e.requiredState,r)==null?!1:Yo(t(r))!==Yo(r)||fv(e)||uv(e)}function uv(e){return[...e.nav,...e.steps].every(t=>t.expect.every(r=>r.kind!=="state"))}var Rp=new WeakMap;function Yo(e){let t=Rp.get(e);if(t!=null)return t;let r=b({entities:[...e.entities].toSorted(([n],[o])=>n.localeCompare(o)).map(([n,o])=>[n,[...o].toSorted(([i],[s])=>i.localeCompare(s))]),scalars:Ns(e.scalars).map(([n,o])=>[n,o.expect])});return Rp.set(e,r),r}function dv(e,t){let r=e.nav.at(-1);if(r!=null)return pr({executedBranches:[],step:r},t).action.url}function pv(e,t){if(t==null)return e;let r=rr(t);return n=>{let o=e(n);return{...o,scalars:Se(o.scalars,r)}}}function fv(e){return e.effectStep.expect.some(t=>t.kind==="state"&&t.assertion.kind==="updated"&&Object.values(t.assertion.props).some(r=>bt(r)))}function hr(e,t,r){let n=fn(e,t.snapshot,r);if(n==null)return null;let o=hv(e,n,t.snapshot);return o==null||!Zo(e,o.effect,t.snapshot)?null:{next:{snapshot:o.effect(t.snapshot)},resolved:o}}function vp(e,t,r){let n=fn(e,t.snapshot,r);if(n==null)return"required-state-unsatisfied";try{return hn(e,n,t.snapshot),"no-effect"}catch(o){if(o instanceof $e)return"unresolvable";throw o}}function hv(e,t,r){try{return hn(e,t,r)}catch(n){if(n instanceof $e)return null;throw n}}function Jo(e,t,r){return e.flatMap((n,o)=>{let i=r(n),s=hr(n,t,i);return s==null?[]:[{idx:o,label:Xe(n),params:i,stepRun:s}]})}function Ra(e,t){let r=[...t.entities].flatMap(([i,s])=>[...s].map(([a,l])=>mv({entity:i,key:a,pre:e,row:l}))),n=[...e.entities].flatMap(([i,s])=>[...s].flatMap(([a,l])=>yv({entity:i,key:a,post:t,row:l}))),o=[...t.scalars.values()].flatMap(i=>{if(i.subject.kind!=="variable"||i.expect.expect!=="is")return[];let s=i.subject.name;return[{changed:ne(e.scalars,i.subject)!==i.expect.value,name:s,value:i.expect.value}]});return{rows:[...r,...n],singletons:o}}function mv({entity:e,key:t,pre:r,row:n}){let o=gv(r.entities.get(e),t),i=Object.entries(n).map(([s,a])=>({changed:o==null||o[s]!==a,field:s,value:a}));return{changed:o==null||i.some(s=>s.changed),entity:e,fields:i,key:t,status:o==null?"created":"present"}}function yv({entity:e,key:t,post:r,row:n}){if(r.entities.get(e)?.has(t)===!0)return[];let o=Object.entries(n).map(([i,s])=>({changed:!1,field:i,value:s}));return[{changed:!0,entity:e,fields:o,key:t,status:"deleted"}]}function gv(e,t){return e?.get(t)}function mr(e,t,r){return t.steps.map(n=>({assertedScalars:n.assertedScalars,effect:n.effect,executedBranches:n.executedBranches,pendingChecks:n.pendingChecks.map(o=>({budget:o.budget,check:{kind:"poll",diagnose:()=>r.diagnoseCheck(o.check),wait:i=>r.awaitCheck(o.check,i)},ephemeral:o.ephemeral,source:{check:o.check,kind:"step",ref:o.ref},targetIds:()=>r.locateIds(dr(o.check))})),reconcile:n.reconcile,scalarChecks:n.scalarChecks,source:n.source,stateChecks:n.stateChecks,step:{action:n.action,intent:e.intent,test:e.test},sync:e.wait,urlChecks:n.urlChecks,verifyChanges:n.verifyChanges,perform:()=>r.perform(n.action),requiredState:()=>!0,targetIds:()=>r.locateIds(n.action.locator)}))}async function xp({current:e,driver:t,index:r,next:n,state:o}){if(n==null||Sv(n))return[];if(Bt(e.transition.effectStep))return[];let i=hr(n.transition,o,n.params);if(i==null)return[];let s=mr(n.transition,i.resolved,t).flatMap(c=>c.pendingChecks.flatMap(u=>{let d=bv(u.source);return d==null?[]:[d]}));if(s.length===0)return[];let a=new Map(s.map(c=>{let u={kind:"element",locator:c,state:"visible"};return[R(u),{declared:!0,expect:{expect:"is",value:!0},subject:u}]})),l=await t.observe(a).match(c=>c,()=>null);return l==null?[]:s.filter(c=>{let u={kind:"element",locator:c,state:"visible"},d=ne(l.snapshot.scalars,u)===!0,p=ne(o.snapshot.scalars,u)===!1;return d&&p}).map(c=>({declaredIndex:r+1,kind:"lift-visibility",locator:c,visibleIndex:r}))}function Sv(e){return e.transition.nav.length>0||e.transition.steps.some(t=>t.action.kind==="goto"||Bt(t))}function bv(e){if(e.kind!=="data-rule")return e.check.kind==="visible"?e.check.locator:void 0}function Xo(e){let t=e.findings.map(n=>({finding:n,kind:"finding"})),r=e.step;return r==null?t:[...e.checks.filter(n=>n.body.outcome.kind==="failed").map(n=>({kind:"check",record:n,step:r,stepIndex:e.index})),...e.stepError==null?[]:[{kind:"stepError",record:e.stepError,step:r,stepIndex:e.index}],...t]}function yr(e){return e.filter(t=>t.kind!=="finding"||t.finding.kind!=="unrunnable")}async function xa(e,t){let{params:r,transition:n}=e.stepRun,o={snapshot:vo(e.facts,e.state.snapshot)},i=hr(n,o,r);if(i==null){let a=vp(n,o,r),l={intent:n.intent,kind:"unrunnable",reason:a,test:n.test,unmet:a==="required-state-unsatisfied"?uo(n.requiredState,o.snapshot)??void 0:void 0};return{label:Xe(n),next:e.state,result:{failed:!0,finalModel:e.state.snapshot,findings:[l]}}}let s=await Go({canon:e.canon,classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onStep:e.onStep,steps:mr(e.stepRun.transition,i.resolved,e.driver),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase,dataRuleChecks:(a,l)=>e.dataRules.flatMap(c=>Cp(c,l)),derive:a=>rn(e.facts,a)},t);return{label:Xe(e.stepRun.transition),next:{snapshot:s.finalModel},result:s}}function Cp(e,t){return Eo(e,t)?[{budget:"fast",check:{kind:"decided",passed:!1},ephemeral:!1,source:{dataRule:e,kind:"data-rule"},targetIds:()=>Promise.resolve([])}]:[]}function Qo(e,t){return va({acc:{contradictions:[],failed:!1,findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}async function va({acc:e,index:t,params:r,signal:n,state:o,stepBase:i}){be(n);let s=r.sequence[t];if(s==null)return e;let a=Date.now(),l=[],c=[],u=await xa({canon:r.canon,classify:r.classify,dataRules:r.dataRules,driver:r.driver,facts:r.facts,state:o,stepBase:i,stepRun:s,stopAfterStep:r.stopAfterStep,onStep:h=>{l.push(h.index);let f={checks:h.checks,endMs:h.endMs,executedBranches:h.executedBranches,findings:h.findings,index:i+h.index,kind:"step",source:h.source,startMs:h.startMs,state:Ra(h.pre,h.post),step:h.step,stepError:h.stepError,url:h.url};c.push(...Xo(f)),r.onEvent(f)}},n);if(u==null)return va({acc:e,index:t+1,params:r,signal:n,state:o,stepBase:i});r.onEvent({endMs:Date.now(),intent:s.transition.intent,kind:"ran",startMs:a});let d=await wv({index:t,outcome:u,params:r,signal:n,state:o,stepBase:i,stepRun:s},l),p=l.length>0?[]:u.result.findings,y={contradictions:[...e.contradictions,...c,...p.map(h=>({finding:h,kind:"finding"})),...d.map(h=>({finding:h,kind:"finding"}))],failed:e.failed||u.result.failed||c.length>0||d.length>0,findings:[...e.findings,...u.result.findings,...d],ran:[...e.ran,u.label]};return u.result.failed||c.length>0||d.length>0||r.stopAfterStep!=null&&i+l.length>=r.stopAfterStep?y:va({acc:y,index:t+1,params:r,signal:n,state:u.next,stepBase:i+l.length})}async function wv(e,t){let{index:r,outcome:n,params:o,stepBase:i,stepRun:s}=e,a=t.length>0;!a&&n.result.findings.length>0&&kp(o,s,e.state,i,n.result.findings);let l=o.sequence[r+1],c=a?await xp({current:s,driver:o.driver,index:r,next:l,state:n.next}):[];return n.result.findings.forEach(u=>{o.onEvent({finding:u,kind:"finding"})}),c.forEach(u=>{o.onEvent({finding:u,kind:"finding"})}),c.length>0&&l!=null&&kp(o,l,n.next,i+t.length,c),c}function kp(e,t,r,n,o){let i=Date.now(),s=ne(r.snapshot.scalars,{kind:"path"});e.onEvent({checks:[],endMs:i,executedBranches:[],findings:o,index:n,kind:"step",source:t.transition.steps[0]??t.transition.effectStep,startMs:i,state:Ra(r.snapshot,r.snapshot),step:null,stepError:null,url:typeof s=="string"?s:null})}function Ep(e){return J(e).flatMap(t=>Rv(t.test))}function Rv(e){let t=new Map(e.world.map(n=>[n.as,n])),r=kv(e.steps);return e.steps.flatMap((n,o)=>n.expect.filter(i=>Cv(i)).flatMap(i=>vv({createdAliases:r,predicate:i,setByAlias:t,stepIndex:o,test:e})))}function vv(e){let{createdAliases:t,predicate:r,setByAlias:n,stepIndex:o,test:i}=e,s=xv(r);if(s==null||t.has(s))return[];let a=n.get(s);return a==null?[]:Object.keys(r.assertion.props).filter(l=>!(l in a.set)).map(l=>({entity:r.entity,field:l,stepIndex:o,test:`${i.workflow}/${i.slug}`}))}function xv(e){return Object.values(e.key).flatMap(t=>N(t)?[nr(t.ref)]:[]).at(0)}function kv(e){return new Set(e.flatMap(t=>t.expect.flatMap(r=>r.kind==="state"&&r.assertion.kind==="created"?[r.assertion.as]:[])))}function Cv(e){return e.kind==="state"&&e.assertion.kind==="updated"}function Pp(e){return J(e).flatMap(({test:t})=>Ev(t.steps,ee(t)))}function Ev(e,t){return e.reduce((r,n)=>{let o=Pv(n.action).filter(i=>!Av(i,r.pre)).map(i=>({action:n.action,ephemeralOnly:r.ephemeralKeys.has(b(ce(i))),target:i,test:t}));return{ephemeralKeys:new Set([...r.ephemeralKeys,...Mv(n)]),pre:Je(r.pre,[n]),violations:[...r.violations,...o]}},{ephemeralKeys:new Set,pre:Mt,violations:[]}).violations}function Pv(e){return e.kind==="goto"||e.kind==="upload"?[]:e.kind==="drag"?[e.source,e.target]:"locator"in e&&e.locator!=null?[e.locator]:[]}function Av(e,t){let r=b(ce(e)),n=[...t.values()].filter(i=>i.subject.kind==="element"&&b(ce(i.subject.locator))===r);if(n.length===0)return!1;let o=i=>n.some(s=>s.subject.kind==="element"&&s.subject.state===i&&s.expect.expect==="is"&&s.expect.value===!1);return!o("visible")&&!o("enabled")}function Mv(e){return po(e.expect).filter(t=>At(t)).flatMap(t=>Ap(t)).map(t=>b(ce(t)))}function Ap(e){return e.kind==="not"?Ap(e.predicate):"locator"in e?[e.locator]:[]}function Mp(e){let t=Qe(e);return J(e).flatMap(({test:r})=>[...Lv(r.steps,ee(r),t),...Ov(r.steps,r.actor,ee(r))])}function Ov(e,t,r){return e.reduce((n,o,i)=>{let s=o.action.kind==="actor"?{alias:o.action.ref.ref,kind:"user"}:n.actor,a=Iv(o).filter(l=>Tv(l.target,s)).map(l=>({predicate:l,stepIndex:i,test:r}));return{actor:en(n.actor,[o]),flagged:[...n.flagged,...a]}},{actor:t,flagged:[]}).flagged}function Iv(e){return e.expect.filter(t=>t.kind==="actor")}function Tv(e,t){return e.kind==="anonymous"?t.kind==="anonymous":t.kind==="user"&&t.alias===e.ref.ref}function Lv(e,t,r){let n=So(Mt,r),o=new Set(n.keys());return e.reduce((i,s,a)=>{let l=Dv(s),c=Nv({acc:i,assertions:l,stepIndex:a,test:t}),u=So(Je(i.pattern,[s]),r);return{assertedKeys:new Set([...Fv({acc:i,assertions:l,pattern:u,step:s}),...o]),pattern:u,redundant:[...i.redundant,...c]}},{assertedKeys:o,pattern:n,redundant:[]}).redundant}function Nv({acc:e,assertions:t,stepIndex:r,test:n}){return t.reduce((o,{entry:i,predicate:s})=>{let a=R(i.subject),l=b(i.expect),c=e.pattern.get(a),u=c!=null&&e.assertedKeys.has(a)&&b(c.expect)===l,d=o.seen.get(a)===l;return{flagged:u||d?[...o.flagged,{predicate:s,stepIndex:r,test:n}]:o.flagged,seen:new Map([...o.seen,[a,l]])}},{flagged:[],seen:new Map}).flagged}function Fv({acc:e,assertions:t,pattern:r,step:n}){let o=new Set([...$v(n),...Zr(n)].map(a=>R(a.subject))),i=[...e.assertedKeys].filter(a=>r.has(a)&&!o.has(a)),s=t.map(({entry:a})=>R(a.subject)).filter(a=>r.has(a));return new Set([...i,...s])}function $v(e){return e.action.kind==="goto"?Yr(e.action.url):[]}function Dv(e){return or(e.expect).flatMap(t=>{if(t.kind==="actor")return[];let r=ue(t);return r==null?[]:[{entry:r,predicate:t}]})}var _v=2;function Op(e){return J(e).flatMap(({test:t})=>t.steps.reduce((n,o,i)=>{let s=Bv(o,n.pre),a=s.length>=_v?[...n.violations,{hidden:s,stepIndex:i,test:ee(t)}]:n.violations;return{pre:Je(n.pre,[o]),violations:a}},{pre:Mt,violations:[]}).violations)}function Bv(e,t){return e.expect.flatMap(r=>{let n=jv(r);return n!=null&&!ka(n)&&Vv(n,t)?[n]:[]})}function jv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function ka(e){return e.by==="surface"?!0:e.by==="inside"?ka(e.scope)||ka(e.target):!1}function Vv(e,t){let r=t.get(R({kind:"element",locator:e,state:"visible"}));return r!=null&&r.expect.expect==="is"&&r.expect.value===!0}function Tp(e){return J(e).flatMap(({test:t})=>{let r=ee(t);return t.steps.reduce((n,o,i)=>Wv(n,o,i,r),{found:[],open:new Set}).found})}function Wv(e,t,r,n){let o=t.action.kind==="goto"?new Set:e.open,i=Ip(t,Uv),s=Ip(t,zv),a=new Set([...o,...i].filter(c=>!s.has(c))),l=Gv(t).flatMap(c=>a.has(b(ce(c.surface)))?[]:[{...c,stepIndex:r,test:n}]);return{found:[...e.found,...l],open:a}}function Ip(e,t){return new Set(e.expect.flatMap(r=>{let n=t(r);return n==null?[]:[b(ce(n))]}))}function Uv(e){return e.kind!=="visible"?null:e.locator.by==="surface"?e.locator:null}function zv(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator.by==="surface"?e.predicate.locator:null}function Gv(e){return e.expect.flatMap(t=>{if(t.kind!=="visible"||t.locator.by!=="inside")return[];let r=Lp(t.locator);return r==null?[]:[{content:t.locator,surface:r}]})}function Lp(e){return e.by!=="inside"?null:e.scope.by==="surface"?e.scope:Lp(e.scope)}function Fp(e){switch(e.kind){case"cascade-gap":{let{gap:t}=e;return`${oe("data rule")} ${t.transition} deletes ${t.target} but leaves ${t.source} rows pointing at it, breaking ${lr(t.dataRule)}. Cascade the delete or declare the cleanup.`}case"create-gap":return Kv(e.gap);case"unreachable-interaction":{let{violation:t}=e,r=ie(t.target);return t.ephemeralOnly?`${oe("reachability")} ${t.test}: ${ln(t.action)}, but ${r} was only declared inside ephemeral(...), which grants no reachability. Assert a durable visible(...) first.`:`${oe("reachability")} ${t.test}: ${ln(t.action)}, but no prior step declared ${r} reachable. Assert visible(...) on it first.`}case"redundant-assertion":{let{redundancy:t}=e;return`${oe("redundancy")} ${t.test}: step ${String(t.stepIndex+1)} restates "${dt(t.predicate)}" \u2014 already asserted and unchanged since. Delete it.`}case"missing-precondition":{let{missing:t}=e;return`${oe("precondition")} ${t.test}: step ${String(t.stepIndex+1)} updates ${t.entity}.${t.field} but no earlier step or seed establishes its prior value. Set it on the step that creates the row, or seed it (a value, arbitrary(...), or null) \u2014 don't split the journey into a separate workflow.`}case"fact-conflict":return qv(e.conflict);case"unmodeled-surface":{let{surface:t}=e,r=t.hidden.map(n=>ie(n)).join(", ");return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} hides ${String(t.hidden.length)} elements at once (${r}). Elements hidden together are one surface \u2014 declare surface(...) and scope them to it.`}case"unpinned-surface-content":{let{content:t}=e,r=ie(t.surface);return`${oe("surface")} ${t.test}: step ${String(t.stepIndex+1)} asserts ${ie(t.content)} but never opens ${r}. A content fact holds only while its surface is active \u2014 assert visible(${r}) here or on a prior open step.`}}}function Kv(e){let t=e.missing.length===1?"field":"fields",r=e.missing.length===1?"it":"them";return`${oe("data rule")} ${e.transition} creates ${e.entity} without required ${t} ${e.missing.join(", ")}. Set ${r} or drop the requirement.`}function qv(e){return[`${oe("fact")} Two facts contradict on overlapping states \u2014 "${dt(e.a)}" vs "${dt(e.b)}".`,` Shared state: ${Lo(e.when)}.`,Np(e.a,e.aProducers,e.when),Np(e.b,e.bProducers,e.when),"The learned fact keeps only conditions all producers share \u2014 add the missing pin to the broad producer, or split with a when branch."].join(`
|
|
5
|
-
`)}function Np(e,t,r){let n=t.map(o=>` - ${o.test} adds ${zd(o.when,r)}`);return[` "${dt(e)}" declared by:`,...n].join(`
|
|
6
|
-
`)}var Hv=24301;function ei(e,t){return e.reduce((r,n)=>Xv(r,t[n.idx]?.paramSpaces),new Map)}function gr(e,t){return Object.fromEntries(Object.entries(e.paramSpaces).map(([r,n])=>[r,Yv(n,n?.name==null?0:t.get(n.name)??0)]))}var $p=new WeakMap;function Yv(e,t){if(e==null)return Dp(void 0,t);let r=$p.get(e)??new Map;$p.set(e,r);let n=r.get(t);if(n!=null)return n;let o=Dp(e,t);return r.set(t,o),o}function Zv(e){return e==null?ex(10):e.kind==="enum"?it.constantFrom(...e.values):e.kind==="number"?it.integer({max:e.max,min:e.min}):e.kind==="boolean"?it.boolean():e.kind==="datetime"?tx():Jv(e)}function Dp(e,t){let[r]=it.sample(Zv(e),{numRuns:1,seed:Hv+t});if(r==null)throw new Error("arbitrary produced no sample");return r}function Jv(e){let t=e.refine??e.pattern;return it.stringMatching(new RegExp(`^(?:${t})$`,"u")).filter(r=>(e.minLength==null||r.length>=e.minLength)&&(e.maxLength==null||r.length<=e.maxLength))}function Xv(e,t){return t==null?e:Object.values(t).reduce((r,n)=>n==null?r:new Map([...r,[n.name,(r.get(n.name)??0)+1]]),e)}var Qv="abcdefghijklmnopqrstuvwxyz0123456789".match(/./g)??[],ex=e=>it.array(it.constantFrom(...Qv),{maxLength:e,minLength:1}).map(t=>t.join(""));function tx(){return it.date({max:new Date("2030-12-31T23:59:59.999Z"),min:new Date("2020-01-01T00:00:00.000Z"),noInvalidDate:!0}).map(e=>e.toISOString())}var rx=new Map;function ti(e){return gr(e,rx)}import{z as j}from"zod";var Sr=j.enum(["crash","data-rule","fact","frame","model-drift"]),nx=j.object({intent:j.string().min(1),test:j.string().min(1)}),ox=j.discriminatedUnion("kind",[j.object({family:j.string().min(1),kind:j.literal("check"),layer:Sr,reason:j.string().min(1),step:nx,subject:j.string()}),j.object({error:j.string().min(1),kind:j.literal("stepError"),layer:Sr,step:j.string().min(1)}),j.object({intent:j.string().min(1),kind:j.literal("unrunnable"),layer:Sr,reason:j.string().min(1),test:j.string().min(1)}),j.object({kind:j.literal("impossible-action"),layer:Sr,step:j.string().min(1)}),j.object({declaredIndex:j.number().int(),kind:j.literal("lift-visibility"),layer:Sr,subject:j.string().min(1),visibleIndex:j.number().int()})]);function Ca(e){switch(e.kind){case"stepError":return"crash";case"check":return ix(e);case"finding":return e.finding.kind==="unrunnable"?"model-drift":"frame"}}function ix(e){switch(e.record.target.kind){case"dataRule":return"data-rule";case"fact":return"fact";case"step":case"action":case"frame":return"frame"}}function mn(e){let t=e.map(o=>({contradiction:o,line:_o(o),part:Bp(o)})).toSorted((o,i)=>b(o.part).localeCompare(b(i.part))),r=t.map(o=>o.part),n=t.at(0)?.contradiction;return{layer:ux(r),signature:b({parts:r.map(o=>b(o))}),sourceTest:n==null?void 0:sx(n),title:t.at(0)?.line}}function sx(e){switch(e.kind){case"check":case"stepError":return e.step.test;case"finding":return ax(e)}}function ax(e){let{finding:t}=e;switch(t.kind){case"impossible-action":return t.step.test;case"unrunnable":return t.test;case"lift-visibility":return}}var _p={crash:0,"data-rule":1,fact:2,frame:3,"model-drift":4};function Bp(e){let t=Ca(e);switch(e.kind){case"check":{let{body:r}=e.record;return{family:r.family,kind:"check",layer:t,reason:lx(r),step:{intent:e.step.intent,test:e.step.test},subject:"subject"in r?r.subject:""}}case"stepError":return{error:e.record.error.kind,kind:"stepError",layer:t,step:e.step.intent};case"finding":return cx(e,t)}}function lx(e){return e.outcome.kind==="failed"?e.outcome.reason.kind:"passed"}function cx(e,t){let{finding:r}=e;switch(r.kind){case"unrunnable":return{intent:r.intent,kind:"unrunnable",layer:t,reason:r.reason,test:r.test};case"impossible-action":return{kind:"impossible-action",layer:t,step:r.step.intent};case"lift-visibility":return{declaredIndex:r.declaredIndex,kind:"lift-visibility",layer:t,subject:fe(r.locator),visibleIndex:r.visibleIndex}}}function ux(e){return e.map(r=>r.layer).toSorted((r,n)=>_p[r]-_p[n]).at(0)??"frame"}function Pa(e){let t=new Map(e.entities.flatMap(o=>Object.entries(o.props).flatMap(([i,s])=>s.valueSpace==null?[]:[[`${o.name}.${i}`,s.valueSpace]]))),r=new Map(e.singletons.flatMap(o=>o.valueSpace==null?[]:[[o.name,o.valueSpace]]));return e.workflows.flatMap(o=>o.steps.flatMap(i=>i.expect.flatMap(s=>ri(s)))).reduce((o,i)=>{let s=i.kind==="field"?t.get(i.key):r.get(i.key);if(s==null)return o;let a=o.get(s)??[];return a.includes(i.value)?o:new Map([...o,[s,[...a,i.value]]])},new Map)}function ri(e){return e.kind==="not"?ri(e.predicate):e.kind==="and"?e.predicates.flatMap(t=>ri(t)):e.kind!=="when"?[]:e.branches.flatMap(t=>[...t.condition==null?[]:Ea(t.condition),...t.consequence.flatMap(r=>ri(r))])}function Ea(e){if(e.kind==="singleton"){let{value:t}=e.assertion;return t!==null&&typeof t!="object"?[{key:e.singleton,kind:"singleton",value:t}]:[]}return e.kind==="not"?Ea(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>Ea(t)):Object.entries(e.where).flatMap(([t,r])=>r===null||typeof r=="object"?[]:[{key:`${e.entity}.${t}`,kind:"field",value:r}])}import{z as jp}from"zod";var Vp=jp.object({maxAttemptLength:jp.number().int().positive()}),Aa={even:{maxAttemptLength:12}};function Wp(e){return Aa[e]}function ni(e){return{startingPoint:e.startingPoint.name,steps:Up(e,e.startingPoint.snapshot,[])}}function Up(e,t,r){if(r.length>=e.strategy.maxAttemptLength)return r;let n=vo(e.facts,t),o=Jo(e.corpus,{snapshot:n},hx(e,r)),i=px(o,e.corpus,e.random());return i==null?r:Up(e,i.stepRun.next.snapshot,[...r,{idx:i.idx,params:i.params}])}var dx=.02;function px(e,t,r){let n=e.map(a=>fx(a.idx,t)),o=n.reduce((a,l)=>a+l,0);if(o<=0)return null;let i=r*o,s=n.reduce((a,l,c)=>{if(a.hit!=null)return a;let u=a.acc+l;return{acc:u,hit:u>i?c:null}},{acc:0,hit:null});return e[s.hit??e.length-1]??null}function fx(e,t){return t[e]?.effectStep.action.kind==="goto"?dx:1}function hx(e,t){let r=ei(t,e.corpus);return n=>yx({drawn:gr(n,r),params:e,prior:r,rule:n})}var mx=3;function yx({drawn:e,params:t,prior:r,rule:n}){return Object.fromEntries(Object.entries(e).map(([o,i])=>{let s=n.paramSpaces[o],a=s==null?void 0:t.literals.get(s.name);if(s==null||a==null||a.length===0)return[o,i];let l=r.get(s.name)??0;return l%mx!==1?[o,i]:[o,a[l%a.length]??i]}))}function zp(e){return Math.max(9e4,e*1e4)}import{z as x}from"zod";var Gp=x.object({baseStateTest:qc,lockfileHash:x.string().min(1),stepRuns:x.array(x.object({idx:x.number().int().nonnegative(),params:x.record(x.string(),x.union([Ss,x.null()]))}))}),Kp=x.object({baseStateRef:x.string().min(1),steps:x.array(x.object({index:x.number().int().nonnegative(),params:x.record(x.string(),x.union([Ss,x.null()])),test:x.string().min(1)}))}),qp=x.object({actions:x.array(x.string()),label:x.string().min(1)}),Ma=x.object({test:x.string().min(1),text:x.string()}),oi=x.object({baseLabel:x.string(),baseState:x.string().min(1),durationMs:x.number().int().nonnegative(),signature:x.string().optional(),steps:x.array(Ma)}),Oa=x.enum(["driver","infra","trail"]),Ia=x.discriminatedUnion("source",[x.object({source:x.literal("empty-trail")}),x.object({source:x.literal("bad-assign")}),x.object({detail:x.string(),source:x.literal("config")}),x.object({source:x.literal("lockfile-stale")}),x.object({detail:x.string(),source:x.literal("transport")}),x.object({category:Oa,kind:x.string(),source:x.literal("runtime")})]);function Hp(e){switch(e.source){case"empty-trail":case"bad-assign":return"trail";case"config":case"lockfile-stale":case"transport":return"infra";case"runtime":return e.category}}var Yp=x.discriminatedUnion("kind",[x.object({kind:x.literal("aborted")}),x.object({error:Ia,kind:x.literal("error")}),x.object({kind:x.literal("clean"),trail:oi}),x.object({kind:x.literal("flaky"),trail:oi}),x.object({kind:x.literal("seen"),trail:oi}),x.object({kind:x.literal("finding"),runId:x.string().optional(),trail:oi})]);function ii(e,{sweep:t}){let r=Ae(J(e),n=>b({a:n.test.actor,s:n.test.singletons,v:n.test.viewport,w:n.test.world})).map(n=>({name:n.ref,test:n.test}));return t?[...r,...r.flatMap(n=>Sx(n))]:r}function gx(e){return e.world.filter(t=>{let r={...e,world:e.world.filter(n=>n!==t)};return Au(r).every(n=>nr(n)!==t.as)})}function si(e,t,r){return fr(e,t.test,r)}function Sx(e){return gx(e.test).map(t=>{let r={...t,as:`${t.as}~2`},n=`${e.name} +${t.entity}`;return{name:n,test:{...e.test,name:n,world:[...e.test.world,r]}}})}async function ai(e){let t=Xr(e);if(t.length===0)return null;let r=ii(e,{sweep:!1}),n=await bx(e,r);if(n.length===0)return null;let o=ar(e);return{corpus:t,facts:{facts:o.facts.filter(i=>!i.localConsequence),overlays:Qe(e),overrides:o.overrides},literals:Pa(e),startingPoints:n,startingPointTests:new Map(r.map(i=>[i.name,i.test]))}}function Zp({lockfileHash:e,prepared:t,random:r,strategy:n}){let o=t.startingPoints[Math.floor(r()*t.startingPoints.length)];if(o==null)return null;let i=ni({corpus:t.corpus,facts:t.facts,literals:t.literals,random:r,startingPoint:o,strategy:n}),s=t.startingPointTests.get(i.startingPoint);return s==null||i.steps.length===0?null:{baseStateTest:s,lockfileHash:e,stepRuns:i.steps.map(a=>({idx:a.idx,params:a.params}))}}async function bx(e,t){let r={generate:Br,materialize:qo(Br,e.valueSpaces),params:void 0,signIn:void 0};return(await Promise.all(t.map(async o=>(await si(e,o,r)).match(s=>({name:o.name,snapshot:s.snapshot}),()=>null)))).flatMap(o=>o==null?[]:[o])}import{createServer as Dx}from"http";import{mkdir as _x,rm as Bx,writeFile as jx}from"fs/promises";import Vx from"path";import{z as F}from"zod";var Wx="otlp-port",Xp=F.object({key:F.string(),value:F.object({boolValue:F.boolean().optional(),doubleValue:F.number().optional(),intValue:F.union([F.string(),F.number()]).optional(),stringValue:F.string().optional()})}),Ux=F.object({attributes:F.array(Xp).default([]),endTimeUnixNano:F.string(),kind:F.number().default(0),name:F.string(),parentSpanId:F.string().optional(),spanId:F.string(),startTimeUnixNano:F.string(),status:F.object({code:F.number(),message:F.string().optional()}).optional(),traceId:F.string()}),zx=F.object({resourceSpans:F.array(F.object({resource:F.object({attributes:F.array(Xp).default([])}).optional(),scopeSpans:F.array(F.object({spans:F.array(Ux).default([])})).default([])})).default([])});async function Ta({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:o,server:i}=await Gx({onRrwebBatch:t,onSpan:r}),s=Vx.join(e,Wx);return n&&(await _x(e,{recursive:!0}),await jx(s,String(o),{encoding:"utf8"})),{port:o,stop:async()=>{n&&await Bx(s,{force:!0}),await Zx(i)}}}function Gx(e){return new Promise((t,r)=>{let n=Dx((o,i)=>{Kx(o,i,e)});n.on("error",r),n.listen(0,()=>{let o=n.address();if(o==null||typeof o=="string"){r(new Error("otlp_receiver_no_port"));return}t({port:o.port,server:n})})})}function Kx(e,t,r){let n=qx(e.url);if(n!=null){Jp(e).then(o=>{r.onRrwebBatch(n,o),li(t)}).catch(()=>{li(t)});return}Jp(e).then(o=>{Hx(zx.parse(JSON.parse(o.toString("utf8"))),r.onSpan),li(t)}).catch(()=>{li(t)})}function qx(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Jp(e){return new Promise((t,r)=>{let n=[];e.on("data",o=>{n.push(o)}),e.on("end",()=>{t(Buffer.concat(n))}),e.on("error",r)})}function li(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function Hx(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:Yx(r.attributes),durationMs:Number((BigInt(r.endTimeUnixNano)-BigInt(r.startTimeUnixNano))/1000000n),kind:"span",name:r.name,parentSpanId:r.parentSpanId,source:"server",spanId:r.spanId,spanKind:Dc(r.kind),status:{code:_c(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function Yx(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function Zx(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{ResultAsync as wr}from"neverthrow";function Vt(e,t,r){if(t==null)throw new Error("action requires a locator");return pt(e,t,r)}function pt(e,t,r){if(t.by==="inside"){if(t.scope.by==="frame"){let i=pt(e,t.scope.element,{visibleOnly:!1});return pt(i.contentFrame(),t.target,r)}let o=pt(e,t.scope,r);return pt(o,t.target,r)}if(t.by==="surface")return pt(e,t.container,r);if(t.by==="frame")return pt(e,t.element,r);let n=t.by==="testId"?e.getByTestId(t.value):e.locator(La(t.role,t.name));return r.visibleOnly?n.filter({visible:!0}):n}function La(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}var Na=3e4,br=class extends Error{mountKey;constructor(t){super("client-mount-unmounted"),this.mountKey=t}},Wt=class extends Error{readyKey;timeoutMs;constructor(t,r){super("app-not-ready"),this.readyKey=t,this.timeoutMs=r}};function Fa(e){return{read:t=>Jx(t,e),seedScript:t=>`globalThis[${JSON.stringify(Kc)}] = ${JSON.stringify(t)};`}}async function Jx(e,t){let r=Se(rr(e.url()),Qp([[{kind:"title"},await e.title()],[{kind:"viewport"},tk(e.viewportSize())]]));if(t.length===0)return{scalars:r};let n=await e.evaluate(Qx,{mountKey:bs,names:t,timeoutMs:Xx});if(n.kind==="unmounted")throw new br(bs);let o=Qp(Object.entries(n.values).map(([i,s])=>[{kind:"variable",name:i},s]));return{scalars:Se(r,o)}}function Qp(e){return new Map(e.flatMap(([t,r])=>r===void 0?[]:[[R(t),{declared:!0,expect:{expect:"is",value:r},subject:t}]]))}var Xx=Na;async function Qx(e){let t=Date.now()+e.timeoutMs;for(;Reflect.get(globalThis,e.mountKey)==null&&Date.now()<t;)await new Promise(n=>setTimeout(n,25));let r=Reflect.get(globalThis,e.mountKey);return r==null?{kind:"unmounted"}:{kind:"values",values:Object.fromEntries(e.names.map(n=>[n,r.readSingleton(n)??null]))}}var ek=768;function tk(e){return e==null?"":e.width<ek?"mobile":"desktop"}async function ci({page:e,readiness:t,signal:r,startMs:n,tries:o,url:i}){if(be(r),!await rk(e,i)){if(Date.now()-n>=t.budgetMs)throw new Wt(Hn,t.budgetMs);let a=t.backoffMs[Math.min(o,t.backoffMs.length-1)]??8e3;await vt(a,r),await ci({page:e,readiness:t,signal:r,startMs:n,tries:o+1,url:i});return}let s=Math.max(0,t.budgetMs-(Date.now()-n));if(!await sk(e,r,Math.min(s,ok(t,o)))){if(Date.now()-n>=t.budgetMs)throw new Wt(Hn,t.budgetMs);await ci({page:e,readiness:t,signal:r,startMs:n,tries:o+1,url:i})}}function $a(e){let t=e instanceof Error?e.message:String(e);return/net::ERR_|ERR_HTTP_RESPONSE_CODE_FAILURE|ECONNREFUSED|ECONNRESET|socket hang up|fetch failed|page\.goto: Timeout/.test(t)}function ui(e){let t=e instanceof Error?e.message:String(e);return/Execution context was destroyed|Cannot find context with specified id|[Ff]rame was detached|frame got detached/.test(t)}async function rk(e,t){let r=await nk(e,t);return r==="net-error"?!1:r==null||r.status()<400}async function nk(e,t){try{return await e.goto(t,{waitUntil:"domcontentloaded"})}catch(r){if($a(r))return"net-error";throw r}}function ok(e,t){return t===0?e.budgetMs/2:e.budgetMs}var ik=50;async function sk(e,t,r){let n=Date.now()+r;for(;Date.now()<n;){if(be(t),await ef(e))return!0;await vt(ik,t)}return ef(e)}async function ef(e){try{return await e.evaluate(ak,Hn)}catch(t){if(ui(t))return!1;throw t}}function ak(e){return Reflect.get(globalThis,e)===!0}async function Da(e,t,r){if(r.kind==="browser")return lk(e,t,r.key,r.value);if(r.kind==="not")return!await Da(e,t,r.inner);let n=Vt(e,r.locator,{visibleOnly:!0});return r.kind==="value"?tf(await n.inputValue(),r.value,r.match):r.kind==="text"?tf(await n.textContent()??"",r.value,r.match):r.kind==="unobstructed"?nf(n):of(n,r.kind)}function tf(e,t,r){let n=tr(e),o=tr(t);return r==="contains"?n.includes(o):r==="startsWith"?n.startsWith(o):n===o}function nf(e){return e.evaluate(t=>{let r=t.getBoundingClientRect(),n=t.ownerDocument.defaultView;if(n==null||r.width<=0||r.height<=0)return!1;let o=2,i=Math.min(9,Math.max(3,Math.round(r.width/12))),s=Math.min(5,Math.max(2,Math.round(r.height/12))),a=(u,d,p)=>Array.from({length:p},(y,h)=>u+o+(d-o*2)*h/(p-1)),c=a(r.left,r.width,i).flatMap(u=>a(r.top,r.height,s).map(d=>({x:u,y:d}))).filter(u=>u.x>=0&&u.y>=0&&u.x<=n.innerWidth&&u.y<=n.innerHeight);return c.length===0?!1:c.every(u=>{let d=t.ownerDocument.elementFromPoint(u.x,u.y);return d!=null&&(d===t||t.contains(d)||d.contains(t))})})}function of(e,t){return t==="visible"?e.isVisible():t==="disabled"?e.isDisabled():t==="enabled"?e.isEnabled():t==="checked"?e.isChecked():t==="expanded"?rf(e,r=>r.getAttribute("aria-expanded")==="true"):t==="pressed"?rf(e,r=>r.getAttribute("aria-pressed")==="true"):e.evaluate(r=>r===r.ownerDocument.activeElement)}async function rf(e,t){return await e.count()===0?!1:e.evaluate(t)}async function lk(e,t,r,n){let o=await t.read(e),i=ne(o.scalars,r);return n===null?i===void 0:i===n}async function sf(e,t,r){let n=af(r,!1);if(n.check.kind==="browser"){let s=await t.read(e),a=ne(s.scalars,n.check.key);return{kind:"wrongContent",observed:a===void 0?"":String(a)}}let o=Vt(e,n.check.locator,{visibleOnly:!0}),i=await o.count();return i>1?{count:i,kind:"multipleMatches"}:i===0?{kind:"notFound"}:ck(o,n.check)}function af(e,t){return e.kind==="not"?af(e.inner,!t):{check:e,negated:t}}async function ck(e,t){switch(t.kind){case"value":return{kind:"wrongContent",observed:await e.inputValue()};case"text":return{kind:"wrongContent",observed:await e.textContent()??""};case"unobstructed":{let r=await uk(e);return r==null?{kind:"wrongState",observed:{checkKind:"unobstructed",value:await nf(e)}}:{by:r,kind:"covered"}}case"visible":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return{kind:"wrongState",observed:{checkKind:t.kind,value:await of(e,t.kind)}}}}function uk(e){return e.evaluate(t=>{let r=t.getBoundingClientRect(),n=t.ownerDocument.elementFromPoint(r.left+r.width/2,r.top+r.height/2);if(n==null||n===t||t.contains(n)||n.contains(t))return null;let o=n.dataset.testid;return o==null?n.tagName.toLowerCase():`testId=${o}`})}var Ba={backoffMs:[500,1e3,2e3,4e3,8e3],budgetMs:Na},dk={readiness:Ba,readSession:void 0,switchActor:void 0};function ja(e,t,r,n,{readiness:o,readSession:i,switchActor:s}=dk){return{awaitCheck:(a,l)=>wr.fromPromise(Rk({check:a,engine:r,page:e,signal:n,timeoutMs:l}),c=>un(c)?{kind:"aborted"}:yn(c)),diagnoseCheck:a=>wr.fromPromise(_a(sf(e,r,a),`diagnose ${a.kind}`),yn),evaluate:a=>wr.fromPromise(_a(Va(e,r,a),`check ${a.kind}`),yn),locateIds:a=>Ik(e,a),observe:a=>wr.fromPromise(i==null?Promise.resolve(void 0):i(),yn).andThen(l=>hk(t.read(l))).andThen(l=>wr.fromPromise(_a(vk({backend:l,engine:r,page:e,tracked:a}),"observe"),yn)),perform:a=>wr.fromPromise(df(e,a,0,n,{readiness:o,switchActor:s}),l=>yk(a,l))}}function yn(e){return e instanceof br?Zn(e.mountKey):Jn(e)}async function Va(e,t,r){try{return await Da(e,t,r)}catch(n){if(ui(n)||fk(n))return!1;throw n}}var pk=/strict mode violation/;function fk(e){return e instanceof Error&&pk.test(e.message)}function hk(e){return e.mapErr(t=>t.kind==="action-failed"||t.kind==="check-failed"?Jn(new Error(mk(t.kind))):t)}function mk(e){return`unexpected ${e} while reading app state`}function yk(e,t){return t instanceof Wt?xs(t.readyKey,t.timeoutMs):t instanceof br?Zn(t.mountKey):As(e.kind,bk(t))}var gk=/resolved to (\d+) elements/,Sk=/(<[^<>]+>)[^<>]* intercepts pointer events/;function bk(e){let t=e instanceof Error?e.message:String(e),r=gk.exec(t);if(r?.[1]!=null)return{count:Number(r[1]),kind:"multipleMatches"};let n=Sk.exec(t);return n?.[1]!=null?{by:n[1],kind:"covered"}:e instanceof Error&&e.name==="TimeoutError"&&t.includes("waiting for")?{kind:"notFound"}:Ms(e)}var wk=75;function Rk(e){return cf(e,Date.now()+e.timeoutMs)}async function cf(e,t){return be(e.signal),await Va(e.page,e.engine,e.check)?!0:Date.now()>=t?!1:(await vt(wk,e.signal),cf(e,t))}async function vk({backend:e,engine:t,page:r,tracked:n}){let o=await uf(r,t,0),i=await xk(r,t,n);return{snapshot:{...e,scalars:new Map([...e.scalars,...o.scalars,...i])}}}async function xk(e,t,r){let n=await Promise.all([...r.values()].filter(o=>o.subject.kind==="element").map(async o=>{let i=await kk(e,t,o.subject);return[R(o.subject),{declared:!0,expect:{expect:"is",value:i},subject:o.subject}]}));return new Map(n)}async function kk(e,t,r){return r.state==="value"||r.state==="text"?Ck(e,r.locator,r.state):Va(e,t,{kind:r.state,locator:r.locator})}async function Ck(e,t,r){try{let n=Vt(e,t,{visibleOnly:!0});return r==="value"?await n.inputValue():await n.textContent()??""}catch{return""}}var Ek=[100,250,500];async function uf(e,t,r){try{return await t.read(e)}catch(n){let o=Ek[r];if(o==null||!ui(n))throw n;return await pf(o),uf(e,t,r+1)}}var lf=35e3;function _a(e,t){let r,n=new Promise((o,i)=>{r=setTimeout(()=>{i(new Error(`driver op "${t}" exceeded ${String(lf)}ms`))},lf)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}var Pk=[250,750,2e3];async function df(e,t,r,n,o){try{await Ak(e,t,n,o.readiness,o.switchActor)}catch(i){let s=Pk[r];if(s==null||!$a(i))throw i;await pf(s),await df(e,t,r+1,n,o)}}async function Ak(e,t,r,n,o){if(t.kind==="actor"){if(o==null)throw new Error("this driver cannot switch actors");await o(xt(t.actorRef,t,"actorRef"));return}if(t.kind==="goto"){await ci({page:e,readiness:n,signal:r,startMs:Date.now(),tries:0,url:xt(t.url,t,"url")});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(xt(t.key,t,"key"));return}let i=t.kind!=="upload";await Mk(e,Vt(e,t.locator,{visibleOnly:i}),t)}function xt(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function Mk(e,t,r){switch(r.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(xt(r.value,r,"value")));case"clear":return t.clear();case"click":return t.click();case"dblclick":return t.dblclick();case"check":return t.check();case"uncheck":return t.uncheck();case"hover":return t.hover();case"select":return Ok(e,t,String(xt(r.value,r,"value")));case"upload":return t.setInputFiles(xt(r.files,r,"files"));case"press":return t.press(xt(r.key,r,"key"));case"drag":return t.dragTo(Vt(e,xt(r.target,r,"target"),{visibleOnly:!0}));case"actor":throw new Error("actor switch must not be located")}}async function Ok(e,t,r){if(await t.evaluate(o=>o.tagName==="SELECT")){await t.selectOption(r);return}await t.click(),await t.fill(r),await e.locator(La("option",r)).filter({visible:!0}).click()}function pf(e){return new Promise(t=>{setTimeout(t,e)})}async function Ik(e,t){if(t==null)return[];try{let r=pt(e,t,{visibleOnly:!1});if(await r.count()===0)return[];let n=await r.first().evaluate(Tk);return n>0?[n]:[]}catch{return[]}}function Tk(e){let t=globalThis.__ripploRrwebMirror;if(t!=null)return t.getId(e);let r=globalThis.top;if(r==null||typeof r!="object"||!("__ripploRrwebMirror"in r))return-1;let n=r.__ripploRrwebMirror;if(n==null||typeof n!="object"||!("getId"in n))return-1;let o=n.getId;if(typeof o!="function")return-1;let i=o.call(n,e);return typeof i=="number"?i:-1}import Lk from"path";var hf={desktop:{height:720,width:1280},mobile:{height:844,width:390}};function mf(e){return hf[e]}var y_=hf.desktop;async function Wa({baseUrl:e,browser:t,capture:r,clientState:n,engine:o,fixturesDir:i,networkHeaders:s,observeActor:a,reader:l,session:c,signal:u,signInActor:d,viewport:p}){let y=await t.newContext({baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",storageState:c==null?void 0:{cookies:za(c.cookies,e),origins:c.origins},viewport:p});s!=null&&await $k(y,e,s),c?.headers!=null&&await y.setExtraHTTPHeaders(c.headers),await y.addInitScript("globalThis.__name = globalThis.__name ?? ((target) => target);"),await y.addInitScript(o.seedScript(n));let h=r==null?Dk():await r.hub.attach(y,r.runId),f=await y.newPage();h.onPage(f);let m=f,v=Nk({baseUrl:e,context:y,page:f,signInActor:d}),w=a?Fk(e,y):void 0;return{context:y,driver:jk(_k(ja(m,l,o,u,{readiness:Ba,readSession:w,switchActor:v}),i),h),emitStepOutcome:h.emitStepOutcome,close:()=>Vk({context:y,handle:h})}}async function Ua(e,t){let r=await gf(e,void 0);try{return await t(r)}finally{await r.close()}}async function yf(e){let{chromium:t}=await import("playwright");return t.launchPersistentContext(e,{headless:!1,viewport:null})}function Nk({baseUrl:e,context:t,page:r,signInActor:n}){if(n!=null)return async o=>{let i=await n(o).match(s=>s,s=>{throw new Error(`actor switch failed: ${s.kind}`)});await t.clearCookies(),await t.addCookies(za(i.cookies,e)),i.headers!=null&&await t.setExtraHTTPHeaders(i.headers),await r.reload()}}function za(e,t){let r=new URL(t).hostname;return e.map(n=>({...n,domain:r}))}function Fk(e,t){return async()=>{let r=await t.cookies();return{cookies:za(r,e),headers:void 0,origins:[]}}}async function $k(e,t,r){let n=new URL(t).host;await e.route(o=>o.host===n,o=>o.continue({headers:{...o.request().headers(),...r}}))}function Dk(){return{emitAction:()=>{},emitStepOutcome:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function gf(e,t){let{chromium:r}=await import("playwright"),n=t==null?[]:[`--disk-cache-dir=${t}`,"--disk-cache-size=268435456"];return r.launch({args:n,headless:!e})}function di({cacheDir:e,headed:t}){let r;return{acquire:async()=>{let i=r;if(i!=null){let s=await i.catch(()=>{});if(s?.isConnected()===!0)return s;r===i&&(r=void 0)}return r??=gf(t,e),r},close:async()=>{let i=r;r=void 0,i!=null&&await i.then(s=>s.close()).catch(()=>{})}}}function _k(e,t){return{...e,perform:r=>e.perform(Bk(r,t))}}function Bk(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(r=>Lk.join(t,r))}}function jk(e,t){return{...e,perform:r=>(t.emitAction(r),e.perform(r))}}async function Vk({context:e,handle:t}){await ff(t.finish()),await ff(e.close())}var Wk=15e3;async function ff(e){let t,r=new Promise(n=>{t=setTimeout(n,Wk)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as Uk,ok as zk,Result as Ga}from"neverthrow";function Ka(e,t,r){return{read:n=>r.read(e.map(o=>o.name),t,n).andThen(o=>Gk(e,o))}}function Gk(e,t){return Ga.combine(e.map(r=>Kk(r,t.entities[r.name]??[]).map(n=>[r.name,n]))).map(r=>({entities:new Map(r),scalars:new Map([...Yk(t.singletons),...Zk(t.actor)])}))}function Kk(e,t){let r=pn(e);return Ga.combine(t.map(n=>qk(n,e).map(o=>[o,Hk(n,r)]))).map(n=>new Map(n))}function qk(e,t){return Ga.combine(t.identity.map(r=>{let n=e[r];return n==null?Uk(Cs(t.name,r)):zk(String(n))})).map(r=>r.join(":"))}function Hk(e,t){let r=t.map(n=>[n,e[n]]).filter(n=>n[1]!=null);return Object.fromEntries(r)}function Yk(e){return Object.entries(e).map(([t,r])=>[R({kind:"variable",name:t}),{declared:!0,expect:{expect:"is",value:r},subject:{kind:"variable",name:t}}])}function Zk(e){return e==null?[]:[[R({kind:"actor"}),{declared:!1,expect:{expect:"is",value:e},subject:{kind:"actor"}}]]}var Sf=Ic(jy(),1);import Jk from"crypto";import{err as Xk,errAsync as qa,ok as Qk,ResultAsync as Rr}from"neverthrow";var eC=1e4,tC=[250,750,2e3],rC=[500,1e3,2e3,3e3];function Ha({baseUrl:e,extraHeaders:t,runId:r,secret:n},o){let i=new Sf.Webhook(n),s=(a,l,c)=>nC({baseUrl:e,body:l,extraHeaders:t,path:a,retry:c.retry,schema:c.schema,signal:c.signal,webhook:i});return{query:{read:(a,l,c)=>s("/state",{entities:a,runId:r,session:c,singletons:l},{retry:"transient",schema:Jc,signal:o}).map(u=>({actor:u.actor,entities:u.entities,singletons:u.singletons}))},ready:()=>wf(e,t,o,0),setupWorld:a=>s("/setup",{entities:a,runId:r},{retry:"connection",schema:Yc,signal:o}).map(l=>l.rows),signIn:({entity:a,row:l})=>s("/sign-in",{entity:a,row:l,runId:r},{retry:"connection",schema:Zc,signal:o}).map(c=>c.session),teardown:()=>s("/teardown",{runId:r},{retry:"connection",schema:Xc,signal:void 0}).map(()=>{})}}function nC(e){return bf(e.retry,()=>aC(e),0)}function bf(e,t,r){return t().orElse(n=>{let o=tC[r];return o==null||!iC(n,e)?qa(n):Rr.fromSafePromise(Rf(o)).andThen(()=>bf(e,t,r+1))})}function wf(e,t,r,n){return Rr.fromPromise(fetch(e,{headers:t,method:"HEAD",signal:vf(r)}),o=>Xt("",o)).map(()=>{}).orElse(()=>{let o=rC[n];return o==null||r.aborted?qa(Ps(e)):Rr.fromSafePromise(Rf(o)).andThen(()=>wf(e,t,r,n+1))})}var oC=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function iC(e,t){return e.kind==="aborted"?!1:sC(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function sC(e){return e.kind==="engine-network"&&e.code!=null&&oC.has(e.code)}function Rf(e){return new Promise(t=>{setTimeout(t,e)})}function aC({baseUrl:e,body:t,extraHeaders:r,path:n,schema:o,signal:i,webhook:s}){let a=JSON.stringify(t);return Rr.fromPromise(fetch(`${e}${n}`,{body:a,headers:{...r,"Content-Type":"application/json",...lC(s,a)},method:"PUT",signal:vf(i)}),l=>Xt(n,l)).andThen(l=>cC(l,n)).andThen(l=>uC(o,l,n)).mapErr(l=>i?.aborted===!0?Os():l)}function lC(e,t){let r=`msg_${Jk.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function vf(e){let t=AbortSignal.timeout(eC);return e==null?t:AbortSignal.any([e,t])}function cC(e,t){return e.ok?Rr.fromPromise(e.json(),r=>Xt(t,r)):Rr.fromPromise(e.text().catch(()=>""),r=>Xt(t,r)).andThen(r=>qa(vs(t,e.status,r)))}function uC(e,t,r){let n=e.safeParse(t);return n.success?Qk(n.data):Xk(ks(r,n.error))}import cI from"path";import{err as Zt,errAsync as uI,ok as Fr,ResultAsync as xc}from"neverthrow";import Cy from"path";import{z as Ue}from"zod";import dC from"path";function xf({debugDir:e,runId:t,worker:r}){let n=dC.join(e,t,"behavior.jsonl");return r.open({file:n,runId:t}),{close:o=>r.close({noticeLineIfNoRrweb:o?.noticeIfNoRrweb==null?"":JSON.stringify(pC(o.noticeIfNoRrweb)),runId:t}),emit:o=>{let i={...o,timestamp:fC(o.timeNanos)};r.line({line:JSON.stringify(i),runId:t,timeNanos:o.timeNanos})},emitRrwebBatch:o=>{r.rrwebBatch({data:o,runId:t})}}}function Ut(e){return String(BigInt(Math.round(e))*1000000n)}function pC(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function fC(e){return Number(BigInt(e)/1000000n)}import{existsSync as hC}from"fs";import{createRequire as mC}from"module";import{fileURLToPath as yC}from"url";import{Worker as gC}from"worker_threads";var SC=mC(import.meta.url);function kf(e){let t=new gC(bC(),{workerData:e});t.unref();let r=new Map,n={next:0};t.on("message",i=>{let s=r.get(i.seq);s!=null&&(r.delete(i.seq),s())});let o=i=>{t.postMessage(i)};return{close:({noticeLineIfNoRrweb:i,runId:s})=>{let a=n.next;return n.next+=1,new Promise(l=>{r.set(a,l),o({noticeLineIfNoRrweb:i,runId:s,seq:a,t:"close"})})},line:({line:i,runId:s,timeNanos:a})=>{o({line:i,runId:s,t:"line",timeNanos:a})},open:({file:i,runId:s})=>{o({file:i,runId:s,t:"open"})},rrwebBatch:({data:i,runId:s})=>{o({data:i,runId:s,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function bC(){try{return SC.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>yC(new URL(r,import.meta.url))),t=e.find(r=>hC(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as wC}from"fs/promises";import{createRequire as RC}from"module";import{fileURLToPath as vC}from"url";var xC=RC(import.meta.url);function Ya(e,t){try{return xC.resolve(e)}catch{return vC(new URL(`assets/${t}`,import.meta.url))}}function Za(e){let t;return()=>(t??=wC(e,"utf8"),t)}var kC=Za(Ya("@ripplo/browser-trace/bundle","browser-trace.js"));async function Cf(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await kC())}var CC=Object.defineProperty,EC=(e,t,r)=>t in e?CC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,S=(e,t,r)=>EC(e,typeof t!="symbol"?t+"":t,r),Ef,PC=Object.defineProperty,AC=(e,t,r)=>t in e?PC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pf=(e,t,r)=>AC(e,typeof t!="symbol"?t+"":t,r),se=(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))(se||{}),Af={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},Mf={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},pi={},MC=()=>!!globalThis.Zone;function ec(e){if(pi[e])return pi[e];let t=globalThis[e],r=t.prototype,n=e in Af?Af[e]:void 0,o=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in Mf?Mf[e]:void 0,s=!!(i&&i.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(o&&s&&!MC())return pi[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let c=l[e].prototype;return document.body.removeChild(a),c?pi[e]=c:r}catch{return r}}var Ja={};function yt(e,t,r){var n;let o=`${e}.${String(r)}`;if(Ja[o])return Ja[o].call(t);let i=ec(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(Ja[o]=s,s.call(t)):t[r]}var Xa={};function Eh(e,t,r){let n=`${e}.${String(r)}`;if(Xa[n])return Xa[n].bind(t);let i=ec(e)[r];return typeof i!="function"?t[r]:(Xa[n]=i,i.bind(t))}function OC(e){return yt("Node",e,"ownerDocument")}function IC(e){return yt("Node",e,"childNodes")}function TC(e){return yt("Node",e,"parentNode")}function LC(e){return yt("Node",e,"parentElement")}function NC(e){return yt("Node",e,"textContent")}function FC(e,t){return Eh("Node",e,"contains")(t)}function $C(e){return Eh("Node",e,"getRootNode")()}function DC(e){return!e||!("host"in e)?null:yt("ShadowRoot",e,"host")}function _C(e){return e.styleSheets}function BC(e){return!e||!("shadowRoot"in e)?null:yt("Element",e,"shadowRoot")}function jC(e,t){return yt("Element",e,"querySelector")(t)}function VC(e,t){return yt("Element",e,"querySelectorAll")(t)}function WC(){return ec("MutationObserver").constructor}function UC(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var de={ownerDocument:OC,childNodes:IC,parentNode:TC,parentElement:LC,textContent:NC,contains:FC,getRootNode:$C,host:DC,styleSheets:_C,shadowRoot:BC,querySelector:jC,querySelectorAll:VC,mutationObserver:WC,patch:UC};function Ph(e){return e.nodeType===e.ELEMENT_NODE}function vn(e){let t=e&&"host"in e&&"mode"in e&&de.host(e)||null;return!!(t&&"shadowRoot"in t&&de.shadowRoot(t)===e)}function xn(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function zC(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function GC(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function dl(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;!r&&e.ownerNode&&(r=e.ownerNode.baseURI);let n=Array.from(t,o=>Ah(o,r)).join("");return zC(n)}catch{return null}}function Ah(e,t){if(qC(e)){let r;try{r=dl(e.styleSheet)||GC(e)}catch{r=e.cssText}return e.styleSheet.href?zi(r,e.styleSheet.href):r}else{let r=e.cssText;return HC(e)&&e.selectorText.includes(":")&&(r=KC(r)),t?zi(r,t):r}}function KC(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function qC(e){return"styleSheet"in e}function HC(e){return"selectorText"in e}var Vi=class{constructor(){Pf(this,"idNodeMap",new Map),Pf(this,"nodeMetaMap",new WeakMap)}getId(t){var r;return t?((r=this.getMeta(t))==null?void 0:r.id)??-1:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){let r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){let n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){let n=this.getNode(t);if(n){let o=this.nodeMetaMap.get(n);o&&this.nodeMetaMap.set(r,o)}this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function YC(){return new Vi}function Wi({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:i}){let s=o||"",a=n&&Gt(n);return(t[r.toLowerCase()]||a&&t[a])&&(i?s=i(s,e):s="*".repeat(s.length)),s}function Gt(e){return e.toLowerCase()}var Of="__rrweb_original__";function ZC(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let i=t.getImageData,s=Of in i?i[Of]:i;if(new Uint32Array(s.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(l=>l!==0))return!1}return!0}function Ui(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Gt(t):null}function Mh(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}let n=/\.([0-9a-z]+)(?:$)/i,o=r.pathname.match(n);return o?.[1]??null}function JC(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var XC=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,QC=/^(?:[a-z+]+:)?\/\//i,eE=/^www\..*/i,tE=/^(data:)([^,]*),(.*)/i;function zi(e,t){return(e||"").replace(XC,(r,n,o,i,s,a)=>{let l=o||s||a,c=n||i||"";if(!l)return r;if(QC.test(l)||eE.test(l))return`url(${c}${l}${c})`;if(tE.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${JC(t)+l}${c})`;let u=t.split("/"),d=l.split("/");u.pop();for(let p of d)p!=="."&&(p===".."?u.pop():u.push(p));return`url(${c}${u.join("/")}${c})`})}function fi(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function rE(e,t,r=!1){let n=Array.from(t.childNodes),o=[],i=0;if(n.length>1&&e&&typeof e=="string"){let s=fi(e,r),a=s.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let c=fi(n[l].textContent,r),u=100,d=3;for(;d<c.length&&(c[d].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,d),1)!==-1);d++);for(;d<c.length;d++){let p=c.substring(0,d),y=s.split(p),h=-1;if(y.length===2)h=y[0].length;else if(y.length>2&&y[0]===""&&n[l-1].textContent!=="")h=s.indexOf(p,1);else if(y.length===1){if(p=p.substring(0,p.length-1),y=s.split(p),y.length<=1)return o.push(e),o;d=u+1}else d===c.length-1&&(h=s.indexOf(p));if(y.length>=2&&d>u){let f=n[l-1].textContent;if(f&&typeof f=="string"){let m=fi(f).length;h=s.indexOf(p,m)}h===-1&&(h=y[0].length)}if(h!==-1){let f=Math.floor(h/a);for(;f>0&&f<e.length;){if(i+=1,i>50*n.length)return o.push(e),o;let m=fi(e.substring(0,f),r);if(m.length===h){o.push(e.substring(0,f)),e=e.substring(f),s=s.substring(h);break}else m.length<h?f+=Math.max(1,Math.floor((h-m.length)/a)):f-=Math.max(1,Math.floor((m.length-h)*a))}break}}}}return o.push(e),o}function nE(e,t){return rE(e,t).join("/* rr_split */")}var oE=1,iE=new RegExp("[^a-z0-9-_:]"),Cn=-2;function Oh(){return oE++}function sE(e){if(e instanceof HTMLFormElement)return"form";let t=Gt(e.tagName);return iE.test(t)?"div":t}var vr,If,aE=/^[^ \t\n\r\u000c]+/,lE=/^[, \t\n\r\u000c]+/;function cE(e,t){if(t.trim()==="")return t;let r=0;function n(i){let s,a=i.exec(t.substring(r));return a?(s=a[0],r+=s.length,s):""}let o=[];for(;n(lE),!(r>=t.length);){let i=n(aE);if(i.slice(-1)===",")i=Cr(e,i.substring(0,i.length-1)),o.push(i);else{let s="";i=Cr(e,i);let a=!1;for(;;){let l=t.charAt(r);if(l===""){o.push((i+s).trim());break}else if(a)l===")"&&(a=!1);else if(l===","){r+=1,o.push((i+s).trim());break}else l==="("&&(a=!0);s+=l,r+=1}}}return o.join(", ")}var Tf=new WeakMap;function Cr(e,t){return!t||t.trim()===""?t:tc(e,t)}function uE(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function tc(e,t){let r=Tf.get(e);if(r||(r=e.createElement("a"),Tf.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Ih(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?Cr(e,n):r==="srcset"?cE(e,n):r==="style"?zi(n,tc(e)):t==="object"&&r==="data"?Cr(e,n):n)}function Th(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function dE(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}if(r)return e.matches(r)}catch{}return!1}function Gi(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?Gi(de.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}return r?Gi(de.parentNode(e),t,r):!1}function Lh(e,t,r,n){let o;if(Ph(e)){if(o=e,!de.childNodes(o).length)return!1}else{if(de.parentElement(e)===null)return!1;o=de.parentElement(e)}try{if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(Gi(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}}catch{}return!1}function pE(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,i;try{i=n.document.readyState}catch{return}if(i!=="complete"){let a=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),o=!0,t()});return}let s="about:blank";if(n.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function fE(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let i=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(i),n=!0,t()})}function hE(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:s,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:c,maskInputFn:u,dataURLOptions:d={},inlineImages:p,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:f=!1,cssCaptured:m=!1}=t,v=mE(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:se.Document,childNodes:[],compatMode:e.compatMode}:{type:se.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:se.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:v};case e.ELEMENT_NODE:return gE(e,{doc:r,blockClass:o,blockSelector:i,inlineStylesheet:a,maskInputOptions:l,maskInputFn:u,dataURLOptions:d,inlineImages:p,recordCanvas:y,keepIframeSrcFn:h,newlyAddedElement:f,rootId:v});case e.TEXT_NODE:return yE(e,{doc:r,needsMask:s,maskTextFn:c,rootId:v,cssCaptured:m});case e.CDATA_SECTION_NODE:return{type:se.CDATA,textContent:"",rootId:v};case e.COMMENT_NODE:return{type:se.Comment,textContent:de.textContent(e)||"",rootId:v};default:return!1}}function mE(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function yE(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:i}=t,s=de.parentNode(e),a=s&&s.tagName,l="",c=a==="STYLE"?!0:void 0,u=a==="SCRIPT"?!0:void 0;return u?l="SCRIPT_PLACEHOLDER":i||(l=de.textContent(e),c&&l&&(l=zi(l,tc(t.doc)))),!c&&!u&&l&&r&&(l=n?n(l,de.parentElement(e)):l.replace(/[\S]/g,"*")),{type:se.Text,textContent:l||"",rootId:o}}function gE(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:i,maskInputOptions:s={},maskInputFn:a,dataURLOptions:l={},inlineImages:c,recordCanvas:u,keepIframeSrcFn:d,newlyAddedElement:p=!1,rootId:y}=t,h=dE(e,n,o),f=sE(e),m={},v=e.attributes.length;for(let g=0;g<v;g++){let k=e.attributes[g];Th(f,k.name,k.value)||(m[k.name]=Ih(r,f,Gt(k.name),k.value))}if(f==="link"&&i){let g=Array.from(r.styleSheets).find(_=>_.href===e.href),k=null;g&&(k=dl(g)),k&&(delete m.rel,delete m.href,m._cssText=k)}if(f==="style"&&e.sheet){let g=dl(e.sheet);g&&(e.childNodes.length>1&&(g=nE(g,e)),m._cssText=g)}if(["input","textarea","select"].includes(f)){let g=e.value,k=e.checked;m.type!=="radio"&&m.type!=="checkbox"&&m.type!=="submit"&&m.type!=="button"&&g?m.value=Wi({element:e,type:Ui(e),tagName:f,value:g,maskInputOptions:s,maskInputFn:a}):k&&(m.checked=k)}if(f==="option"&&(e.selected&&!s.select?m.selected=!0:delete m.selected),f==="dialog"&&e.open&&(m.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),f==="canvas"&&u){if(e.__context==="2d")ZC(e)||(m.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let g=e.toDataURL(l.type,l.quality),k=r.createElement("canvas");k.width=e.width,k.height=e.height;let _=k.toDataURL(l.type,l.quality);g!==_&&(m.rr_dataURL=g)}}if(f==="img"&&c){vr||(vr=r.createElement("canvas"),If=vr.getContext("2d"));let g=e,k=g.currentSrc||g.getAttribute("src")||"<unknown-src>",_=g.crossOrigin,V=()=>{g.removeEventListener("load",V);try{vr.width=g.naturalWidth,vr.height=g.naturalHeight,If.drawImage(g,0,0),m.rr_dataURL=vr.toDataURL(l.type,l.quality)}catch(te){if(g.crossOrigin!=="anonymous"){g.crossOrigin="anonymous",g.complete&&g.naturalWidth!==0?V():g.addEventListener("load",V);return}else console.warn(`Cannot inline img src=${k}! Error: ${te}`)}g.crossOrigin==="anonymous"&&(_?m.crossOrigin=_:g.removeAttribute("crossorigin"))};g.complete&&g.naturalWidth!==0?V():g.addEventListener("load",V)}if(["audio","video"].includes(f)){let g=m;g.rr_mediaState=e.paused?"paused":"played",g.rr_mediaCurrentTime=e.currentTime,g.rr_mediaPlaybackRate=e.playbackRate,g.rr_mediaMuted=e.muted,g.rr_mediaLoop=e.loop,g.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(m.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(m.rr_scrollTop=e.scrollTop)),h){let{width:g,height:k}=e.getBoundingClientRect();m={class:m.class,rr_width:`${g}px`,rr_height:`${k}px`}}f==="iframe"&&!d(m.src)&&(e.contentDocument||(m.rr_src=m.src),delete m.src);let w;try{customElements.get(f)&&(w=!0)}catch{}return{type:se.Element,tagName:f,attributes:m,childNodes:[],isSVG:uE(e)||void 0,needBlock:h,rootId:y,isCustom:w}}function W(e){return e==null?"":e.toLowerCase()}function Nh(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function SE(e,t){if(t.comment&&e.type===se.Comment)return!0;if(e.type===se.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&Mh(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(W(e.attributes.name).match(/^msapplication-tile(image|color)$/)||W(e.attributes.name)==="application-name"||W(e.attributes.rel)==="icon"||W(e.attributes.rel)==="apple-touch-icon"||W(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&W(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(W(e.attributes.property).match(/^(og|twitter|fb):/)||W(e.attributes.name).match(/^(og|twitter):/)||W(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(W(e.attributes.name)==="robots"||W(e.attributes.name)==="googlebot"||W(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(W(e.attributes.name)==="author"||W(e.attributes.name)==="generator"||W(e.attributes.name)==="framework"||W(e.attributes.name)==="publisher"||W(e.attributes.name)==="progid"||W(e.attributes.property).match(/^article:/)||W(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(W(e.attributes.name)==="google-site-verification"||W(e.attributes.name)==="yandex-verification"||W(e.attributes.name)==="csrf-token"||W(e.attributes.name)==="p:domain_verify"||W(e.attributes.name)==="verify-v1"||W(e.attributes.name)==="verification"||W(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Er(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:i,maskTextClass:s,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:u={},maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h={},inlineImages:f=!1,recordCanvas:m=!1,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g=5e3,onStylesheetLoad:k,stylesheetLoadTimeout:_=5e3,keepIframeSrcFn:V=()=>!1,newlyAddedElement:te=!1,cssCaptured:G=!1}=t,{needsMask:Q}=t,{preserveWhiteSpace:le=!0}=t;Q||(Q=Lh(e,s,a,Q===void 0));let Me=hE(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,dataURLOptions:h,inlineImages:f,recordCanvas:m,keepIframeSrcFn:V,newlyAddedElement:te,cssCaptured:G});if(!Me)return console.warn(e,"not serialized"),null;let ze;n.hasNode(e)?ze=n.getId(e):SE(Me,y)||!le&&Me.type===se.Text&&!Me.textContent.replace(/^\s+|\s+$/gm,"").length?ze=Cn:ze=Oh();let T=Object.assign(Me,{id:ze});if(n.add(e,T),ze===Cn)return null;v&&v(e);let Dr=!l;if(T.type===se.Element){Dr=Dr&&!T.needBlock,delete T.needBlock;let re=de.shadowRoot(e);re&&xn(re)&&(T.isShadowHost=!0)}if((T.type===se.Document||T.type===se.Element)&&Dr){y.headWhitespace&&T.type===se.Element&&T.tagName==="head"&&(le=!1);let re={doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,maskTextClass:s,maskTextSelector:a,skipChild:l,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h,inlineImages:f,recordCanvas:m,preserveWhiteSpace:le,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:V,cssCaptured:!1};if(!(T.type===se.Element&&T.tagName==="textarea"&&T.attributes.value!==void 0)){T.type===se.Element&&T.attributes._cssText!==void 0&&typeof T.attributes._cssText=="string"&&(re.cssCaptured=!0);for(let Ct of Array.from(de.childNodes(e))){let Ge=Er(Ct,re);Ge&&T.childNodes.push(Ge)}}let Oe=null;if(Ph(e)&&(Oe=de.shadowRoot(e)))for(let Ct of Array.from(de.childNodes(Oe))){let Ge=Er(Ct,re);Ge&&(xn(Oe)&&(Ge.isShadow=!0),T.childNodes.push(Ge))}}let _r=de.parentNode(e);return _r&&vn(_r)&&xn(_r)&&(T.isShadow=!0),T.type===se.Element&&T.tagName==="iframe"&&pE(e,()=>{let re=e.contentDocument;if(re&&w){let Oe=Er(re,{doc:re,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h,inlineImages:f,recordCanvas:m,preserveWhiteSpace:le,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:V});Oe&&w(e,Oe)}},g),T.type===se.Element&&T.tagName==="link"&&typeof T.attributes.rel=="string"&&(T.attributes.rel==="stylesheet"||T.attributes.rel==="preload"&&typeof T.attributes.href=="string"&&Mh(T.attributes.href)==="css")&&fE(e,()=>{if(k){let re=Er(e,{doc:r,mirror:n,blockClass:o,blockSelector:i,needsMask:Q,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:c,maskInputOptions:u,maskTextFn:d,maskInputFn:p,slimDOMOptions:y,dataURLOptions:h,inlineImages:f,recordCanvas:m,preserveWhiteSpace:le,onSerialize:v,onIframeLoad:w,iframeLoadTimeout:g,onStylesheetLoad:k,stylesheetLoadTimeout:_,keepIframeSrcFn:V});re&&k(e,re)}},_),T}function bE(e,t){let{mirror:r=new Vi,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:i="rr-mask",maskTextSelector:s=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:u=!1,maskTextFn:d,maskInputFn:p,slimDOM:y=!1,dataURLOptions:h,preserveWhiteSpace:f,onSerialize:m,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:_=()=>!1}=t||{},V=u===!0?{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}:u===!1?{password:!0}:u,te=Nh(y);return Er(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:a,maskInputOptions:V,maskTextFn:d,maskInputFn:p,slimDOMOptions:te,dataURLOptions:h,inlineImages:l,recordCanvas:c,preserveWhiteSpace:f,onSerialize:m,onIframeLoad:v,iframeLoadTimeout:w,onStylesheetLoad:g,stylesheetLoadTimeout:k,keepIframeSrcFn:_,newlyAddedElement:!1})}var wE=/(max|min)-device-(width|height)/,D_=new RegExp(wE.source,"g");function RE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function vE(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var rc={exports:{}},U=String,Fh=function(){return{isColorSupported:!1,reset:U,bold:U,dim:U,italic:U,underline:U,inverse:U,hidden:U,strikethrough:U,black:U,red:U,green:U,yellow:U,blue:U,magenta:U,cyan:U,white:U,gray:U,bgBlack:U,bgRed:U,bgGreen:U,bgYellow:U,bgBlue:U,bgMagenta:U,bgCyan:U,bgWhite:U}};rc.exports=Fh();rc.exports.createColors=Fh;var xE=rc.exports,kE={},CE=Object.freeze(Object.defineProperty({__proto__:null,default:kE},Symbol.toStringTag,{value:"Module"})),Ve=vE(CE),Lf=xE,Nf=Ve,pl=class $h extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,$h)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let r=this.source;t==null&&(t=Lf.isColorSupported),Nf&&t&&(r=Nf(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),s=String(i).length,a,l;if(t){let{bold:c,gray:u,red:d}=Lf.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(o,i).map((c,u)=>{let d=o+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let y=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
|
|
7
|
-
`+y+a("^")}return" "+l(p)+c}).join(`
|
|
8
|
-
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
|
9
|
-
|
|
10
|
-
`+t+`
|
|
11
|
-
`),this.name+": "+this.message+t}},nc=pl;pl.default=pl;var Fn={};Fn.isClean=Symbol("isClean");Fn.my=Symbol("my");var Ff={after:`
|
|
12
|
-
`,beforeClose:`
|
|
13
|
-
`,beforeComment:`
|
|
14
|
-
`,beforeDecl:`
|
|
15
|
-
`,beforeOpen:" ",beforeRule:`
|
|
16
|
-
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function EE(e){return e[0].toUpperCase()+e.slice(1)}var fl=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:o&&(n+=" "),t.nodes)this.block(t,n+o);else{let i=(t.raws.between||"")+(r?";":"");this.builder(n+o+i,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let o=t.parent,i=0;for(;o&&o.type!=="root";)i+=1,o=o.parent;if(n.includes(`
|
|
17
|
-
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<i;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let o;t.nodes&&t.nodes.length?(this.body(t),o=this.raw(t,"after")):o=this.raw(t,"after","emptyBody"),o&&this.builder(o),this.builder("}",t,"end")}body(t){let r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=this.raw(t,"semicolon");for(let o=0;o<t.nodes.length;o++){let i=t.nodes[o],s=this.raw(i,"before");s&&this.builder(s),this.stringify(i,r!==o||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),o=t.prop+n+this.rawValue(t,"value");t.important&&(o+=t.raws.important||" !important"),r&&(o+=";"),this.builder(o,t)}document(t){this.body(t)}raw(t,r,n){let o;if(n||(n=r),r&&(o=t.raws[r],typeof o<"u"))return o;let i=t.parent;if(n==="before"&&(!i||i.type==="root"&&i.first===t||i&&i.type==="document"))return"";if(!i)return Ff[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+EE(n);this[a]?o=this[a](s,t):s.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=Ff[n]),s.rawCache[n]=o,o}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
|
|
18
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
19
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
20
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
|
21
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let o=n.parent;if(o&&o!==t&&o.parent&&o.parent===t&&typeof n.raws.before<"u"){let i=n.raws.before.split(`
|
|
22
|
-
`);return r=i[i.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],o=t.raws[r];return o&&o.value===n?o.raw:n}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},Dh=fl;fl.default=fl;var PE=Dh;function hl(e,t){new PE(t).stringify(e)}var os=hl;hl.default=hl;var{isClean:hi,my:AE}=Fn,ME=nc,OE=Dh,IE=os;function ml(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let o=e[n],i=typeof o;n==="parent"&&i==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(s=>ml(s,r)):(i==="object"&&o!==null&&(o=ml(o)),r[n]=o)}return r}var yl=class{constructor(t={}){this.raws={},this[hi]=!1,this[AE]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let r=ml(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:o}=this.rangeBy(r);return this.source.input.error(t,{column:o.column,line:o.line},{column:n.column,line:n.line},r)}return new ME(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[hi]){this[hi]=!1;let t=this;for(;t=t.parent;)t[hi]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let o=r.indexOf(t.word);o!==-1&&(n=this.positionInside(o,r))}return n}positionInside(t,r){let n=r||this.toString(),o=this.source.start.column,i=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
|
|
23
|
-
`?(o=1,i+=1):o+=1;return{column:o,line:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let r={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:r.column+1,line:r.line};if(t.word){let o=this.toString(),i=o.indexOf(t.word);i!==-1&&(r=this.positionInside(i,o),n=this.positionInside(i+t.word.length,o))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new OE().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let o of t)o===this?n=!0:n?(this.parent.insertAfter(r,o),r=o):this.parent.insertBefore(r,o);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},o=r==null;r=r||new Map;let i=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=i,r.set(a.input,i),i++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return o&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=IE){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let i in n)o[i]=n[i];return t.warn(r,o)}get proxyOf(){return this}},is=yl;yl.default=yl;var TE=is,gl=class extends TE{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},ss=gl;gl.default=gl;var LE="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",NE=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},FE=(e=21)=>{let t="",r=e;for(;r--;)t+=LE[Math.random()*64|0];return t},$E={nanoid:FE,customAlphabet:NE},{SourceMapConsumer:$f,SourceMapGenerator:Df}=Ve,{existsSync:DE,readFileSync:_E}=Ve,{dirname:Qa,join:BE}=Ve;function jE(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Sl=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,o=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=Qa(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new $f(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,i=/^data:application\/json,/;if(o.test(t)||i.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return jE(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),o=t.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,o)))}loadFile(t){if(this.root=Qa(t),DE(t))return this.mapFile=t,_E(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let o=this.loadFile(n);if(!o)throw new Error("Unable to load previous source map: "+n.toString());return o}}else{if(r instanceof $f)return Df.fromSourceMap(r).toString();if(r instanceof Df)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=BE(Qa(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},_h=Sl;Sl.default=Sl;var{SourceMapConsumer:VE,SourceMapGenerator:WE}=Ve,{fileURLToPath:_f,pathToFileURL:mi}=Ve,{isAbsolute:bl,resolve:wl}=Ve,{nanoid:UE}=$E,el=Ve,Bf=nc,zE=_h,tl=Symbol("fromOffsetCache"),GE=!!(VE&&WE),jf=!!(wl&&bl),Ki=class{constructor(t,r={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!jf||/^\w+:\/\//.test(r.from)||bl(r.from)?this.file=r.from:this.file=wl(r.from)),jf&&GE){let n=new zE(this.css,r);if(n.text){this.map=n;let o=n.consumer().file;!this.file&&o&&(this.file=this.mapResolve(o))}}this.file||(this.id="<input css "+UE(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let i,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?i=new Bf(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,o.plugin):i=new Bf(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,o.plugin),i.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(mi&&(i.input.url=mi(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[tl])n=this[tl];else{let i=this.css.split(`
|
|
24
|
-
`);n=new Array(i.length);let s=0;for(let a=0,l=i.length;a<l;a++)n[a]=s,s+=i[a].length+1;this[tl]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let i=n.length-2,s;for(;o<i;)if(s=o+(i-o>>1),t<n[s])i=s-1;else if(t>=n[s+1])o=s+1;else{o=s;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:wl(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let i=this.map.consumer(),s=i.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=i.originalPositionFor({column:o,line:n}));let l;bl(s.source)?l=mi(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||mi(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(_f)c.file=_f(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=i.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},as=Ki;Ki.default=Ki;el&&el.registerInput&&el.registerInput(Ki);var{SourceMapConsumer:Bh,SourceMapGenerator:Fi}=Ve,{dirname:$i,relative:jh,resolve:Vh,sep:Wh}=Ve,{pathToFileURL:Vf}=Ve,KE=as,qE=!!(Bh&&Fi),HE=!!($i&&Vh&&jh&&Wh),YE=class{constructor(t,r,n,o){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let r=`
|
|
25
|
-
`;this.css.includes(`\r
|
|
26
|
-
`)&&(r=`\r
|
|
27
|
-
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||$i(t.file),o;this.mapOpts.sourcesContent===!1?(o=new Bh(t.text),o.sourcesContent&&(o.sourcesContent=null)):o=t.consumer(),this.map.applySourceMap(o,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),HE&&qE&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=Fi.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Fi({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 Fi({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",o={generated:{column:0,line:0},original:{column:0,line:0},source:""},i,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(o.generated.line=t,o.generated.column=r-1,l.source&&l.source.start?(o.source=this.sourcePath(l),o.original.line=l.source.start.line,o.original.column=l.source.start.column-1,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,this.map.addMapping(o))),i=a.match(/\n/g),i?(t+=i.length,s=a.lastIndexOf(`
|
|
28
|
-
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(o.source=this.sourcePath(l),o.original.line=l.source.end.line,o.original.column=l.source.end.column-1,o.generated.line=t,o.generated.column=r-2,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,o.generated.line=t,o.generated.column=r-1,this.map.addMapping(o)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(r=>r.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?$i(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=$i(Vh(n,this.mapOpts.annotation)));let o=jh(n,t);return this.memoizedPaths.set(t,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new KE(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let r=this.memoizedFileURLs.get(t);if(r)return r;if(Vf){let n=Vf(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;Wh==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Uh=YE,ZE=is,Rl=class extends ZE{constructor(t){super(t),this.type="comment"}},ls=Rl;Rl.default=Rl;var{isClean:zh,my:Gh}=Fn,Kh=ss,qh=ls,JE=is,Hh,oc,ic,Yh;function Zh(e){return e.map(t=>(t.nodes&&(t.nodes=Zh(t.nodes)),delete t.source,t))}function Jh(e){if(e[zh]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Jh(t)}var ht=class Xh extends JE{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let o of n)this.proxyOf.nodes.push(o)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,o;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],o=t(this.proxyOf.nodes[n],n),o!==!1);)this.indexes[r]+=1;return delete this.indexes[r],o}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(o=>typeof o=="function"?(i,s)=>o(i.toProxy(),s):o)):r==="every"||r==="some"?n=>t[r]((o,...i)=>n(o.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),o=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of o)this.proxyOf.nodes.splice(n+1,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<i&&(this.indexes[s]=i+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,i=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Zh(Hh(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Kh(t)]}else if(t.selector)t=[new oc(t)];else if(t.name)t=[new ic(t)];else if(t.text)t=[new qh(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[Gh]||Xh.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[zh]&&Jh(o),typeof o.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(o.raws.before=r.raws.before.replace(/\S/g,"")),o.parent=this.proxyOf,o))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let o of n)this.proxyOf.nodes.unshift(o);for(let o in this.indexes)this.indexes[o]=this.indexes[o]+n.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(o=>{r.props&&!r.props.includes(o.prop)||r.fast&&!o.value.includes(r.fast)||(o.value=o.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let o;try{o=t(r,n)}catch(i){throw r.addToError(i)}return o!==!1&&r.walk&&(o=r.walk(t)),o})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,o)}):this.walk((n,o)=>{if(n.type==="atrule"&&n.name===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="atrule")return r(n,o)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,o)}):this.walk((n,o)=>{if(n.type==="decl"&&n.prop===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="decl")return r(n,o)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,o)}):this.walk((n,o)=>{if(n.type==="rule"&&n.selector===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="rule")return r(n,o)}))}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]}};ht.registerParse=e=>{Hh=e};ht.registerRule=e=>{oc=e};ht.registerAtRule=e=>{ic=e};ht.registerRoot=e=>{Yh=e};var Kt=ht;ht.default=ht;ht.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,ic.prototype):e.type==="rule"?Object.setPrototypeOf(e,oc.prototype):e.type==="decl"?Object.setPrototypeOf(e,Kh.prototype):e.type==="comment"?Object.setPrototypeOf(e,qh.prototype):e.type==="root"&&Object.setPrototypeOf(e,Yh.prototype),e[Gh]=!0,e.nodes&&e.nodes.forEach(t=>{ht.rebuild(t)})};var XE=Kt,Qh,em,En=class extends XE{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Qh(new em,this,t).stringify()}};En.registerLazyResult=e=>{Qh=e};En.registerProcessor=e=>{em=e};var sc=En;En.default=En;var Wf={},tm=function(t){Wf[t]||(Wf[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},vl=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[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}},rm=vl;vl.default=vl;var QE=rm,xl=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new QE(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},ac=xl;xl.default=xl;var rl=39,Uf=34,yi=92,zf=47,gi=10,gn=32,Si=12,bi=9,wi=13,eP=91,tP=93,rP=40,nP=41,oP=123,iP=125,sP=59,aP=42,lP=58,cP=64,Ri=/[\t\n\f\r "#'()/;[\\\]{}]/g,vi=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,uP=/.[\r\n"'(/\\]/,Gf=/[\da-f]/i,dP=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,y,h,f=n.length,m=0,v=[],w=[];function g(){return m}function k(G){throw t.error("Unclosed "+G,m)}function _(){return w.length===0&&m>=f}function V(G){if(w.length)return w.pop();if(m>=f)return;let Q=G?G.ignoreUnclosed:!1;switch(i=n.charCodeAt(m),i){case gi:case gn:case bi:case wi:case Si:{s=m;do s+=1,i=n.charCodeAt(s);while(i===gn||i===gi||i===bi||i===wi||i===Si);h=["space",n.slice(m,s)],m=s-1;break}case eP:case tP:case oP:case iP:case lP:case sP:case nP:{let le=String.fromCharCode(i);h=[le,le,m];break}case rP:{if(p=v.length?v.pop()[1]:"",y=n.charCodeAt(m+1),p==="url"&&y!==rl&&y!==Uf&&y!==gn&&y!==gi&&y!==bi&&y!==Si&&y!==wi){s=m;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||Q){s=m;break}else k("bracket");for(d=s;n.charCodeAt(d-1)===yi;)d-=1,u=!u}while(u);h=["brackets",n.slice(m,s+1),m,s],m=s}else s=n.indexOf(")",m+1),l=n.slice(m,s+1),s===-1||uP.test(l)?h=["(","(",m]:(h=["brackets",l,m,s],m=s);break}case rl:case Uf:{a=i===rl?"'":'"',s=m;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||Q){s=m+1;break}else k("string");for(d=s;n.charCodeAt(d-1)===yi;)d-=1,u=!u}while(u);h=["string",n.slice(m,s+1),m,s],m=s;break}case cP:{Ri.lastIndex=m+1,Ri.test(n),Ri.lastIndex===0?s=n.length-1:s=Ri.lastIndex-2,h=["at-word",n.slice(m,s+1),m,s],m=s;break}case yi:{for(s=m,c=!0;n.charCodeAt(s+1)===yi;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==zf&&i!==gn&&i!==gi&&i!==bi&&i!==wi&&i!==Si&&(s+=1,Gf.test(n.charAt(s)))){for(;Gf.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===gn&&(s+=1)}h=["word",n.slice(m,s+1),m,s],m=s;break}default:{i===zf&&n.charCodeAt(m+1)===aP?(s=n.indexOf("*/",m+2)+1,s===0&&(o||Q?s=n.length:k("comment")),h=["comment",n.slice(m,s+1),m,s],m=s):(vi.lastIndex=m+1,vi.test(n),vi.lastIndex===0?s=n.length-1:s=vi.lastIndex-2,h=["word",n.slice(m,s+1),m,s],v.push(h),m=s);break}}return m++,h}function te(G){w.push(G)}return{back:te,endOfFile:_,nextToken:V,position:g}},nm=Kt,qi=class extends nm{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},lc=qi;qi.default=qi;nm.registerAtRule(qi);var om=Kt,im,sm,Ar=class extends om{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let o=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let i of o)i.raws.before=r.raws.before}return o}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new im(new sm,this,t).stringify()}};Ar.registerLazyResult=e=>{im=e};Ar.registerProcessor=e=>{sm=e};var $n=Ar;Ar.default=Ar;om.registerRoot(Ar);var Pn={comma(e){return Pn.split(e,[","],!0)},space(e){let t=[" ",`
|
|
29
|
-
`," "];return Pn.split(e,t)},split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(i=!0),i?(o!==""&&n.push(o.trim()),o="",i=!1):o+=u;return(r||o!=="")&&n.push(o.trim()),n}},am=Pn;Pn.default=Pn;var lm=Kt,pP=am,Hi=class extends lm{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return pP.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},cc=Hi;Hi.default=Hi;lm.registerRule(Hi);var fP=ss,hP=dP,mP=ls,yP=lc,gP=$n,Kf=cc,qf={empty:!0,space:!0};function SP(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var bP=class{constructor(t){this.input=t,this.root=new gP,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let r=new yP;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,i,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(i=l.length-1,o=l[i];o&&o[0]==="space";)o=l[--i];o&&(r.source.end=this.getPosition(o[3]||o[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let i=r-1;i>=0&&(o=t[i],!(o[0]!=="space"&&(n+=1,n===2)));i--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,i;for(let[s,a]of t.entries()){if(n=a,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!i)this.doubleColon(n);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=n}return!1}comment(t){let r=new mP;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let o=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=o[2],r.raws.left=o[1],r.raws.right=o[3]}}createTokenizer(){this.tokenizer=hP(this.input)}decl(t,r){let n=new fP;this.init(n,t[0][2]);let o=t[t.length-1];for(o[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||SP(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let i;for(;t.length;)if(i=t.shift(),i[0]===":"){n.raws.between+=i[1];break}else i[0]==="word"&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(i=t[c],i[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(i[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let y=u[p][0];if(d.trim().indexOf("!")===0&&y!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(i[0]!=="space"&&i[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new Kf;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}end(t){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(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}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(t){if(this.spaces+=t[1],this.current.nodes){let r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,o=!1,i=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")i||(i=c),s.push(n==="("?")":"]");else if(a&&o&&n==="{")i||(i=c),s.push("}");else if(s.length===0)if(n===";")if(o){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(o=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(i),r&&o){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,r,n,o){let i,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)i=n[p],s=i[0],s==="space"&&p===a-1&&!o?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!qf[d]&&!qf[u]?l.slice(-1)===","?c=!1:l+=i[1]:c=!1):l+=i[1];if(!c){let p=n.reduce((y,h)=>y+h[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new Kf;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let o=r;o<t.length;o++)n+=t[o][1];return t.splice(r,t.length-r),n}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},wP=bP,RP=Kt,vP=wP,xP=as;function Yi(e,t){let r=new xP(e,t),n=new vP(r);try{n.parse()}catch(o){throw process.env.NODE_ENV!=="production"&&o.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?o.message+=`
|
|
30
|
-
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?o.message+=`
|
|
31
|
-
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(o.message+=`
|
|
32
|
-
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),o}return n.root}var uc=Yi;Yi.default=Yi;RP.registerParse(Yi);var{isClean:rt,my:kP}=Fn,CP=Uh,EP=os,PP=Kt,AP=sc,MP=tm,Hf=ac,OP=uc,IP=$n,TP={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},LP={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},NP={Once:!0,postcssPlugin:!0,prepare:!0},Mr=0;function Sn(e){return typeof e=="object"&&typeof e.then=="function"}function cm(e){let t=!1,r=TP[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Mr,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Mr,r+"Exit"]:[r,r+"Exit"]}function Yf(e){let t;return e.type==="document"?t=["Document",Mr,"DocumentExit"]:e.type==="root"?t=["Root",Mr,"RootExit"]:t=cm(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function kl(e){return e[rt]=!1,e.nodes&&e.nodes.forEach(t=>kl(t)),e}var Cl={},Or=class um{constructor(t,r,n){this.stringified=!1,this.processed=!1;let o;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=kl(r);else if(r instanceof um||r instanceof Hf)o=kl(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let i=OP;n.syntax&&(i=n.syntax.parse),n.parser&&(i=n.parser),i.parse&&(i=i.parse);try{o=i(r,n)}catch(s){this.processed=!0,this.error=s}o&&!o[kP]&&PP.rebuild(o)}this.result=new Hf(t,o,n),this.helpers={...Cl,postcss:Cl,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let o=n.postcssPlugin,i=n.postcssVersion,s=this.result.processor.version,a=i.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+o+" uses "+i+". Perhaps this is the source of the error below.")}}catch(o){console&&console.error&&console.error(o)}return t}prepareVisitors(){this.listeners={};let t=(r,n,o)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,o])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!LP[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!NP[n])if(typeof r[n]=="object")for(let o in r[n])o==="*"?t(r,n,r[n][o]):t(r,n+"-"+o.toLowerCase(),r[n][o]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(Sn(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[rt];){t[rt]=!0;let r=[Yf(t)];for(;r.length>0;){let n=this.visitTick(r);if(Sn(n))try{await n}catch(o){let i=r[r.length-1].node;throw this.handleError(o,i)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let o=t.nodes.map(i=>n(i,this.helpers));await Promise.all(o)}else await n(t,this.helpers)}catch(o){throw this.handleError(o)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return Sn(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=EP;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new CP(r,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[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 t of this.plugins){let r=this.runOnRoot(t);if(Sn(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[rt];)t[rt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||MP("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[n,o]of t){this.result.lastPlugin=n;let i;try{i=o(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(Sn(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:o}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(o.length>0&&r.visitorIndex<o.length){let[s,a]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[rt]){a[rt]=!0,t.push(Yf(a));return}r.iterator=0,delete n.indexes[s]}let i=r.events;for(;r.eventIndex<i.length;){let s=i[r.eventIndex];if(r.eventIndex+=1,s===Mr){n.nodes&&n.nodes.length&&(n[rt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[rt]=!0;let r=cm(t);for(let n of r)if(n===Mr)t.nodes&&t.each(o=>{o[rt]||this.walkSync(o)});else{let o=this.listeners[n];if(o&&this.visitSync(o,t.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"}};Or.registerPostcss=e=>{Cl=e};var dm=Or;Or.default=Or;IP.registerLazyResult(Or);AP.registerLazyResult(Or);var FP=Uh,$P=os,DP=tm,_P=uc,BP=ac,El=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let o,i=$P;this.result=new BP(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new FP(i,o,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||DP("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}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 t,r=_P;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},jP=El;El.default=El;var VP=jP,WP=dm,UP=sc,zP=$n,An=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new VP(this,t,r):new WP(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},GP=An;An.default=An;zP.registerProcessor(An);UP.registerProcessor(An);var KP=ss,qP=_h,HP=ls,YP=lc,ZP=as,JP=$n,XP=cc;function Mn(e,t){if(Array.isArray(e))return e.map(o=>Mn(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:ZP.prototype};i.map&&(i.map={...i.map,__proto__:qP.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Mn(o,t))),n.source){let{inputId:o,...i}=n.source;n.source=i,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new JP(n);if(n.type==="decl")return new KP(n);if(n.type==="rule")return new XP(n);if(n.type==="comment")return new HP(n);if(n.type==="atrule")return new YP(n);throw new Error("Unknown node type: "+e.type)}var QP=Mn;Mn.default=Mn;var eA=nc,pm=ss,tA=dm,rA=Kt,dc=GP,nA=os,oA=QP,fm=sc,iA=rm,hm=ls,mm=lc,sA=ac,aA=as,lA=uc,cA=am,ym=cc,gm=$n,uA=is;function $(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new dc(e)}$.plugin=function(t,r){let n=!1;function o(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
33
|
-
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
34
|
-
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new dc().version,a}let i;return Object.defineProperty(o,"postcss",{get(){return i||(i=o()),i}}),o.process=function(s,a,l){return $([o(l)]).process(s,a)},o};$.stringify=nA;$.parse=lA;$.fromJSON=oA;$.list=cA;$.comment=e=>new hm(e);$.atRule=e=>new mm(e);$.decl=e=>new pm(e);$.rule=e=>new ym(e);$.root=e=>new gm(e);$.document=e=>new fm(e);$.CssSyntaxError=eA;$.Declaration=pm;$.Container=rA;$.Processor=dc;$.Document=fm;$.Comment=hm;$.Warning=iA;$.AtRule=mm;$.Result=sA;$.Input=aA;$.Rule=ym;$.Root=gm;$.Node=uA;tA.registerPostcss($);var dA=$;$.default=$;var q=RE(dA);q.stringify;q.fromJSON;q.plugin;q.parse;q.list;q.document;q.comment;q.atRule;q.rule;q.decl;q.root;q.CssSyntaxError;q.Declaration;q.Container;q.Processor;q.Document;q.Comment;q.Warning;q.AtRule;q.Result;q.Input;q.Rule;q.Root;q.Node;var pA=Object.defineProperty,fA=(e,t,r)=>t in e?pA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Le=(e,t,r)=>fA(e,typeof t!="symbol"?t+"":t,r);function hA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mA(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}),r}var pc={exports:{}},z=String,Sm=function(){return{isColorSupported:!1,reset:z,bold:z,dim:z,italic:z,underline:z,inverse:z,hidden:z,strikethrough:z,black:z,red:z,green:z,yellow:z,blue:z,magenta:z,cyan:z,white:z,gray:z,bgBlack:z,bgRed:z,bgGreen:z,bgYellow:z,bgBlue:z,bgMagenta:z,bgCyan:z,bgWhite:z}};pc.exports=Sm();pc.exports.createColors=Sm;var yA=pc.exports,gA={},SA=Object.freeze(Object.defineProperty({__proto__:null,default:gA},Symbol.toStringTag,{value:"Module"})),We=mA(SA),Zf=yA,Jf=We,Pl=class bm extends Error{constructor(t,r,n,o,i,s){super(t),this.name="CssSyntaxError",this.reason=t,i&&(this.file=i),o&&(this.source=o),s&&(this.plugin=s),typeof r<"u"&&typeof n<"u"&&(typeof r=="number"?(this.line=r,this.column=n):(this.line=r.line,this.column=r.column,this.endLine=n.line,this.endColumn=n.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,bm)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(t){if(!this.source)return"";let r=this.source;t==null&&(t=Zf.isColorSupported),Jf&&t&&(r=Jf(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),i=Math.min(this.line+2,n.length),s=String(i).length,a,l;if(t){let{bold:c,gray:u,red:d}=Zf.createColors(!0);a=p=>c(d(p)),l=p=>u(p)}else a=l=c=>c;return n.slice(o,i).map((c,u)=>{let d=o+1+u,p=" "+(" "+d).slice(-s)+" | ";if(d===this.line){let y=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return a(">")+l(p)+c+`
|
|
35
|
-
`+y+a("^")}return" "+l(p)+c}).join(`
|
|
36
|
-
`)}toString(){let t=this.showSourceCode();return t&&(t=`
|
|
37
|
-
|
|
38
|
-
`+t+`
|
|
39
|
-
`),this.name+": "+this.message+t}},fc=Pl;Pl.default=Pl;var Dn={};Dn.isClean=Symbol("isClean");Dn.my=Symbol("my");var Xf={after:`
|
|
40
|
-
`,beforeClose:`
|
|
41
|
-
`,beforeComment:`
|
|
42
|
-
`,beforeDecl:`
|
|
43
|
-
`,beforeOpen:" ",beforeRule:`
|
|
44
|
-
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function bA(e){return e[0].toUpperCase()+e.slice(1)}var Al=class{constructor(t){this.builder=t}atrule(t,r){let n="@"+t.name,o=t.params?this.rawValue(t,"params"):"";if(typeof t.raws.afterName<"u"?n+=t.raws.afterName:o&&(n+=" "),t.nodes)this.block(t,n+o);else{let i=(t.raws.between||"")+(r?";":"");this.builder(n+o+i,t)}}beforeAfter(t,r){let n;t.type==="decl"?n=this.raw(t,null,"beforeDecl"):t.type==="comment"?n=this.raw(t,null,"beforeComment"):r==="before"?n=this.raw(t,null,"beforeRule"):n=this.raw(t,null,"beforeClose");let o=t.parent,i=0;for(;o&&o.type!=="root";)i+=1,o=o.parent;if(n.includes(`
|
|
45
|
-
`)){let s=this.raw(t,null,"indent");if(s.length)for(let a=0;a<i;a++)n+=s}return n}block(t,r){let n=this.raw(t,"between","beforeOpen");this.builder(r+n+"{",t,"start");let o;t.nodes&&t.nodes.length?(this.body(t),o=this.raw(t,"after")):o=this.raw(t,"after","emptyBody"),o&&this.builder(o),this.builder("}",t,"end")}body(t){let r=t.nodes.length-1;for(;r>0&&t.nodes[r].type==="comment";)r-=1;let n=this.raw(t,"semicolon");for(let o=0;o<t.nodes.length;o++){let i=t.nodes[o],s=this.raw(i,"before");s&&this.builder(s),this.stringify(i,r!==o||n)}}comment(t){let r=this.raw(t,"left","commentLeft"),n=this.raw(t,"right","commentRight");this.builder("/*"+r+t.text+n+"*/",t)}decl(t,r){let n=this.raw(t,"between","colon"),o=t.prop+n+this.rawValue(t,"value");t.important&&(o+=t.raws.important||" !important"),r&&(o+=";"),this.builder(o,t)}document(t){this.body(t)}raw(t,r,n){let o;if(n||(n=r),r&&(o=t.raws[r],typeof o<"u"))return o;let i=t.parent;if(n==="before"&&(!i||i.type==="root"&&i.first===t||i&&i.type==="document"))return"";if(!i)return Xf[n];let s=t.root();if(s.rawCache||(s.rawCache={}),typeof s.rawCache[n]<"u")return s.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let a="raw"+bA(n);this[a]?o=this[a](s,t):s.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=Xf[n]),s.rawCache[n]=o,o}rawBeforeClose(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length>0&&typeof n.raws.after<"u")return r=n.raws.after,r.includes(`
|
|
46
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawBeforeComment(t,r){let n;return t.walkComments(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
47
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeDecl"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeDecl(t,r){let n;return t.walkDecls(o=>{if(typeof o.raws.before<"u")return n=o.raws.before,n.includes(`
|
|
48
|
-
`)&&(n=n.replace(/[^\n]+$/,"")),!1}),typeof n>"u"?n=this.raw(r,null,"beforeRule"):n&&(n=n.replace(/\S/g,"")),n}rawBeforeOpen(t){let r;return t.walk(n=>{if(n.type!=="decl"&&(r=n.raws.between,typeof r<"u"))return!1}),r}rawBeforeRule(t){let r;return t.walk(n=>{if(n.nodes&&(n.parent!==t||t.first!==n)&&typeof n.raws.before<"u")return r=n.raws.before,r.includes(`
|
|
49
|
-
`)&&(r=r.replace(/[^\n]+$/,"")),!1}),r&&(r=r.replace(/\S/g,"")),r}rawColon(t){let r;return t.walkDecls(n=>{if(typeof n.raws.between<"u")return r=n.raws.between.replace(/[^\s:]/g,""),!1}),r}rawEmptyBody(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length===0&&(r=n.raws.after,typeof r<"u"))return!1}),r}rawIndent(t){if(t.raws.indent)return t.raws.indent;let r;return t.walk(n=>{let o=n.parent;if(o&&o!==t&&o.parent&&o.parent===t&&typeof n.raws.before<"u"){let i=n.raws.before.split(`
|
|
50
|
-
`);return r=i[i.length-1],r=r.replace(/\S/g,""),!1}}),r}rawSemicolon(t){let r;return t.walk(n=>{if(n.nodes&&n.nodes.length&&n.last.type==="decl"&&(r=n.raws.semicolon,typeof r<"u"))return!1}),r}rawValue(t,r){let n=t[r],o=t.raws[r];return o&&o.value===n?o.raw:n}root(t){this.body(t),t.raws.after&&this.builder(t.raws.after)}rule(t){this.block(t,this.rawValue(t,"selector")),t.raws.ownSemicolon&&this.builder(t.raws.ownSemicolon,t,"end")}stringify(t,r){if(!this[t.type])throw new Error("Unknown AST node type "+t.type+". Maybe you need to change PostCSS stringifier.");this[t.type](t,r)}},wm=Al;Al.default=Al;var wA=wm;function Ml(e,t){new wA(t).stringify(e)}var cs=Ml;Ml.default=Ml;var{isClean:xi,my:RA}=Dn,vA=fc,xA=wm,kA=cs;function Ol(e,t){let r=new e.constructor;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||n==="proxyCache")continue;let o=e[n],i=typeof o;n==="parent"&&i==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(s=>Ol(s,r)):(i==="object"&&o!==null&&(o=Ol(o)),r[n]=o)}return r}var Il=class{constructor(t={}){this.raws={},this[xi]=!1,this[RA]=!0;for(let r in t)if(r==="nodes"){this.nodes=[];for(let n of t[r])typeof n.clone=="function"?this.append(n.clone()):this.append(n)}else this[r]=t[r]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let r=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${r.input.from}:${r.start.line}:${r.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let r in t)this[r]=t[r];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let r=Ol(this);for(let n in t)r[n]=t[n];return r}cloneAfter(t={}){let r=this.clone(t);return this.parent.insertAfter(this,r),r}cloneBefore(t={}){let r=this.clone(t);return this.parent.insertBefore(this,r),r}error(t,r={}){if(this.source){let{end:n,start:o}=this.rangeBy(r);return this.source.input.error(t,{column:o.column,line:o.line},{column:n.column,line:n.line},r)}return new vA(t)}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:r==="root"?()=>t.root().toProxy():t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="prop"||r==="value"||r==="name"||r==="params"||r==="important"||r==="text")&&t.markDirty()),!0}}}markDirty(){if(this[xi]){this[xi]=!1;let t=this;for(;t=t.parent;)t[xi]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t,r){let n=this.source.start;if(t.index)n=this.positionInside(t.index,r);else if(t.word){r=this.toString();let o=r.indexOf(t.word);o!==-1&&(n=this.positionInside(o,r))}return n}positionInside(t,r){let n=r||this.toString(),o=this.source.start.column,i=this.source.start.line;for(let s=0;s<t;s++)n[s]===`
|
|
51
|
-
`?(o=1,i+=1):o+=1;return{column:o,line:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t){let r={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:r.column+1,line:r.line};if(t.word){let o=this.toString(),i=o.indexOf(t.word);i!==-1&&(r=this.positionInside(i,o),n=this.positionInside(i+t.word.length,o))}else t.start?r={column:t.start.column,line:t.start.line}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line}:typeof t.endIndex=="number"?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line}),{end:n,start:r}}raw(t,r){return new xA().raw(this,t,r)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let r=this,n=!1;for(let o of t)o===this?n=!0:n?(this.parent.insertAfter(r,o),r=o):this.parent.insertBefore(r,o);n||this.remove()}return this}root(){let t=this;for(;t.parent&&t.parent.type!=="document";)t=t.parent;return t}toJSON(t,r){let n={},o=r==null;r=r||new Map;let i=0;for(let s in this){if(!Object.prototype.hasOwnProperty.call(this,s)||s==="parent"||s==="proxyCache")continue;let a=this[s];if(Array.isArray(a))n[s]=a.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof a=="object"&&a.toJSON)n[s]=a.toJSON(null,r);else if(s==="source"){let l=r.get(a.input);l==null&&(l=i,r.set(a.input,i),i++),n[s]={end:a.end,inputId:l,start:a.start}}else n[s]=a}return o&&(n.inputs=[...r.keys()].map(s=>s.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=kA){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let i in n)o[i]=n[i];return t.warn(r,o)}get proxyOf(){return this}},us=Il;Il.default=Il;var CA=us,Tl=class extends CA{constructor(t){t&&typeof t.value<"u"&&typeof t.value!="string"&&(t={...t,value:String(t.value)}),super(t),this.type="decl"}get variable(){return this.prop.startsWith("--")||this.prop[0]==="$"}},ds=Tl;Tl.default=Tl;var EA="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",PA=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},AA=(e=21)=>{let t="",r=e;for(;r--;)t+=EA[Math.random()*64|0];return t},MA={nanoid:AA,customAlphabet:PA},{SourceMapConsumer:Qf,SourceMapGenerator:eh}=We,{existsSync:OA,readFileSync:IA}=We,{dirname:nl,join:TA}=We;function LA(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Ll=class{constructor(t,r){if(r.map===!1)return;this.loadAnnotation(t),this.inline=this.startWith(this.annotation,"data:");let n=r.map?r.map.prev:void 0,o=this.loadMap(r.from,n);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=nl(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new Qf(this.text)),this.consumerCache}decodeInline(t){let r=/^data:application\/json;charset=utf-?8;base64,/,n=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,i=/^data:application\/json,/;if(o.test(t)||i.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return LA(t.substr(RegExp.lastMatch.length));let s=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+s)}getAnnotationURL(t){return t.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()}isMap(t){return typeof t!="object"?!1:typeof t.mappings=="string"||typeof t._mappings=="string"||Array.isArray(t.sections)}loadAnnotation(t){let r=t.match(/\/\*\s*# sourceMappingURL=/gm);if(!r)return;let n=t.lastIndexOf(r.pop()),o=t.indexOf("*/",n);n>-1&&o>-1&&(this.annotation=this.getAnnotationURL(t.substring(n,o)))}loadFile(t){if(this.root=nl(t),OA(t))return this.mapFile=t,IA(t,"utf-8").toString().trim()}loadMap(t,r){if(r===!1)return!1;if(r){if(typeof r=="string")return r;if(typeof r=="function"){let n=r(t);if(n){let o=this.loadFile(n);if(!o)throw new Error("Unable to load previous source map: "+n.toString());return o}}else{if(r instanceof Qf)return eh.fromSourceMap(r).toString();if(r instanceof eh)return r.toString();if(this.isMap(r))return JSON.stringify(r);throw new Error("Unsupported previous source map format: "+r.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){let n=this.annotation;return t&&(n=TA(nl(t),n)),this.loadFile(n)}}}startWith(t,r){return t?t.substr(0,r.length)===r:!1}withContent(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)}},Rm=Ll;Ll.default=Ll;var{SourceMapConsumer:NA,SourceMapGenerator:FA}=We,{fileURLToPath:th,pathToFileURL:ki}=We,{isAbsolute:Nl,resolve:Fl}=We,{nanoid:$A}=MA,ol=We,rh=fc,DA=Rm,il=Symbol("fromOffsetCache"),_A=!!(NA&&FA),nh=!!(Fl&&Nl),Zi=class{constructor(t,r={}){if(t===null||typeof t>"u"||typeof t=="object"&&!t.toString)throw new Error(`PostCSS received ${t} instead of CSS string`);if(this.css=t.toString(),this.css[0]==="\uFEFF"||this.css[0]==="\uFFFE"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!nh||/^\w+:\/\//.test(r.from)||Nl(r.from)?this.file=r.from:this.file=Fl(r.from)),nh&&_A){let n=new DA(this.css,r);if(n.text){this.map=n;let o=n.consumer().file;!this.file&&o&&(this.file=this.mapResolve(o))}}this.file||(this.id="<input css "+$A(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let i,s,a;if(r&&typeof r=="object"){let c=r,u=n;if(typeof c.offset=="number"){let d=this.fromOffset(c.offset);r=d.line,n=d.col}else r=c.line,n=c.column;if(typeof u.offset=="number"){let d=this.fromOffset(u.offset);s=d.line,a=d.col}else s=u.line,a=u.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,s,a);return l?i=new rh(t,l.endLine===void 0?l.line:{column:l.column,line:l.line},l.endLine===void 0?l.column:{column:l.endColumn,line:l.endLine},l.source,l.file,o.plugin):i=new rh(t,s===void 0?r:{column:n,line:r},s===void 0?n:{column:a,line:s},this.css,this.file,o.plugin),i.input={column:n,endColumn:a,endLine:s,line:r,source:this.css},this.file&&(ki&&(i.input.url=ki(this.file).toString()),i.input.file=this.file),i}fromOffset(t){let r,n;if(this[il])n=this[il];else{let i=this.css.split(`
|
|
52
|
-
`);n=new Array(i.length);let s=0;for(let a=0,l=i.length;a<l;a++)n[a]=s,s+=i[a].length+1;this[il]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let i=n.length-2,s;for(;o<i;)if(s=o+(i-o>>1),t<n[s])i=s-1;else if(t>=n[s+1])o=s+1;else{o=s;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Fl(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let i=this.map.consumer(),s=i.originalPositionFor({column:r,line:t});if(!s.source)return!1;let a;typeof n=="number"&&(a=i.originalPositionFor({column:o,line:n}));let l;Nl(s.source)?l=ki(s.source):l=new URL(s.source,this.map.consumer().sourceRoot||ki(this.map.mapFile));let c={column:s.column,endColumn:a&&a.column,endLine:a&&a.line,line:s.line,url:l.toString()};if(l.protocol==="file:")if(th)c.file=th(l);else throw new Error("file: protocol is not available in this PostCSS build");let u=i.sourceContentFor(s.source);return u&&(c.source=u),c}toJSON(){let t={};for(let r of["hasBOM","css","file","id"])this[r]!=null&&(t[r]=this[r]);return this.map&&(t.map={...this.map},t.map.consumerCache&&(t.map.consumerCache=void 0)),t}get from(){return this.file||this.id}},ps=Zi;Zi.default=Zi;ol&&ol.registerInput&&ol.registerInput(Zi);var{SourceMapConsumer:vm,SourceMapGenerator:Di}=We,{dirname:_i,relative:xm,resolve:km,sep:Cm}=We,{pathToFileURL:oh}=We,BA=ps,jA=!!(vm&&Di),VA=!!(_i&&km&&xm&&Cm),WA=class{constructor(t,r,n,o){this.stringify=t,this.mapOpts=n.map||{},this.root=r,this.opts=n,this.css=o,this.originalCSS=o,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;this.isInline()?t="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?t=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?t=this.mapOpts.annotation(this.opts.to,this.root):t=this.outputFile()+".map";let r=`
|
|
53
|
-
`;this.css.includes(`\r
|
|
54
|
-
`)&&(r=`\r
|
|
55
|
-
`),this.css+=r+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let r=this.toUrl(this.path(t.file)),n=t.root||_i(t.file),o;this.mapOpts.sourcesContent===!1?(o=new vm(t.text),o.sourcesContent&&(o.sourcesContent=null)):o=t.consumer(),this.map.applySourceMap(o,r,this.toUrl(this.path(n)))}}clearAnnotation(){if(this.mapOpts.annotation!==!1)if(this.root){let t;for(let r=this.root.nodes.length-1;r>=0;r--)t=this.root.nodes[r],t.type==="comment"&&t.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(r)}else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),VA&&jA&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,r=>{t+=r}),[t]}}generateMap(){if(this.root)this.generateString();else if(this.previous().length===1){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=Di.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new Di({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 Di({file:this.outputFile(),ignoreInvalidMapping:!0});let t=1,r=1,n="<no source>",o={generated:{column:0,line:0},original:{column:0,line:0},source:""},i,s;this.stringify(this.root,(a,l,c)=>{if(this.css+=a,l&&c!=="end"&&(o.generated.line=t,o.generated.column=r-1,l.source&&l.source.start?(o.source=this.sourcePath(l),o.original.line=l.source.start.line,o.original.column=l.source.start.column-1,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,this.map.addMapping(o))),i=a.match(/\n/g),i?(t+=i.length,s=a.lastIndexOf(`
|
|
56
|
-
`),r=a.length-s):r+=a.length,l&&c!=="start"){let u=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==u.last||u.raws.semicolon)&&(l.source&&l.source.end?(o.source=this.sourcePath(l),o.original.line=l.source.end.line,o.original.column=l.source.end.column-1,o.generated.line=t,o.generated.column=r-2,this.map.addMapping(o)):(o.source=n,o.original.line=1,o.original.column=0,o.generated.line=t,o.generated.column=r-1,this.map.addMapping(o)))}})}isAnnotation(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(t=>t.annotation):!0}isInline(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;let t=this.mapOpts.annotation;return typeof t<"u"&&t!==!0?!1:this.previous().length?this.previous().some(r=>r.inline):!0}isMap(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0}isSourcesContent(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(t=>t.withContent()):!0}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute||t.charCodeAt(0)===60||/^\w+:\/\//.test(t))return t;let r=this.memoizedPaths.get(t);if(r)return r;let n=this.opts.to?_i(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=_i(km(n,this.mapOpts.annotation)));let o=xm(n,t);return this.memoizedPaths.set(t,o),o}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(t=>{if(t.source&&t.source.input.map){let r=t.source.input.map;this.previousMaps.includes(r)||this.previousMaps.push(r)}});else{let t=new BA(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk(r=>{if(r.source){let n=r.source.input.from;if(n&&!t[n]){t[n]=!0;let o=this.usesFileUrls?this.toFileUrl(n):this.toUrl(this.path(n));this.map.setSourceContent(o,r.source.input.css)}}});else if(this.css){let r=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(r,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let r=this.memoizedFileURLs.get(t);if(r)return r;if(oh){let n=oh(t).toString();return this.memoizedFileURLs.set(t,n),n}else throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let r=this.memoizedURLs.get(t);if(r)return r;Cm==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},Em=WA,UA=us,$l=class extends UA{constructor(t){super(t),this.type="comment"}},fs=$l;$l.default=$l;var{isClean:Pm,my:Am}=Dn,Mm=ds,Om=fs,zA=us,Im,hc,mc,Tm;function Lm(e){return e.map(t=>(t.nodes&&(t.nodes=Lm(t.nodes)),delete t.source,t))}function Nm(e){if(e[Pm]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Nm(t)}var mt=class Fm extends zA{append(...t){for(let r of t){let n=this.normalize(r,this.last);for(let o of n)this.proxyOf.nodes.push(o)}return this.markDirty(),this}cleanRaws(t){if(super.cleanRaws(t),this.nodes)for(let r of this.nodes)r.cleanRaws(t)}each(t){if(!this.proxyOf.nodes)return;let r=this.getIterator(),n,o;for(;this.indexes[r]<this.proxyOf.nodes.length&&(n=this.indexes[r],o=t(this.proxyOf.nodes[n],n),o!==!1);)this.indexes[r]+=1;return delete this.indexes[r],o}every(t){return this.nodes.every(t)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let t=this.lastEach;return this.indexes[t]=0,t}getProxyProcessor(){return{get(t,r){return r==="proxyOf"?t:t[r]?r==="each"||typeof r=="string"&&r.startsWith("walk")?(...n)=>t[r](...n.map(o=>typeof o=="function"?(i,s)=>o(i.toProxy(),s):o)):r==="every"||r==="some"?n=>t[r]((o,...i)=>n(o.toProxy(),...i)):r==="root"?()=>t.root().toProxy():r==="nodes"?t.nodes.map(n=>n.toProxy()):r==="first"||r==="last"?t[r].toProxy():t[r]:t[r]},set(t,r,n){return t[r]===n||(t[r]=n,(r==="name"||r==="params"||r==="selector")&&t.markDirty()),!0}}}index(t){return typeof t=="number"?t:(t.proxyOf&&(t=t.proxyOf),this.proxyOf.nodes.indexOf(t))}insertAfter(t,r){let n=this.index(t),o=this.normalize(r,this.proxyOf.nodes[n]).reverse();n=this.index(t);for(let s of o)this.proxyOf.nodes.splice(n+1,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<i&&(this.indexes[s]=i+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,i=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let a of i)this.proxyOf.nodes.splice(n,0,a);let s;for(let a in this.indexes)s=this.indexes[a],n<=s&&(this.indexes[a]=s+i.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Lm(Im(t).nodes);else if(typeof t>"u")t=[];else if(Array.isArray(t)){t=t.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type==="root"&&this.type!=="document"){t=t.nodes.slice(0);for(let o of t)o.parent&&o.parent.removeChild(o,"ignore")}else if(t.type)t=[t];else if(t.prop){if(typeof t.value>"u")throw new Error("Value field is missed in node creation");typeof t.value!="string"&&(t.value=String(t.value)),t=[new Mm(t)]}else if(t.selector)t=[new hc(t)];else if(t.name)t=[new mc(t)];else if(t.text)t=[new Om(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[Am]||Fm.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[Pm]&&Nm(o),typeof o.raws.before>"u"&&r&&typeof r.raws.before<"u"&&(o.raws.before=r.raws.before.replace(/\S/g,"")),o.parent=this.proxyOf,o))}prepend(...t){t=t.reverse();for(let r of t){let n=this.normalize(r,this.first,"prepend").reverse();for(let o of n)this.proxyOf.nodes.unshift(o);for(let o in this.indexes)this.indexes[o]=this.indexes[o]+n.length}return this.markDirty(),this}push(t){return t.parent=this,this.proxyOf.nodes.push(t),this}removeAll(){for(let t of this.proxyOf.nodes)t.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(t){t=this.index(t),this.proxyOf.nodes[t].parent=void 0,this.proxyOf.nodes.splice(t,1);let r;for(let n in this.indexes)r=this.indexes[n],r>=t&&(this.indexes[n]=r-1);return this.markDirty(),this}replaceValues(t,r,n){return n||(n=r,r={}),this.walkDecls(o=>{r.props&&!r.props.includes(o.prop)||r.fast&&!o.value.includes(r.fast)||(o.value=o.value.replace(t,n))}),this.markDirty(),this}some(t){return this.nodes.some(t)}walk(t){return this.each((r,n)=>{let o;try{o=t(r,n)}catch(i){throw r.addToError(i)}return o!==!1&&r.walk&&(o=r.walk(t)),o})}walkAtRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="atrule"&&t.test(n.name))return r(n,o)}):this.walk((n,o)=>{if(n.type==="atrule"&&n.name===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="atrule")return r(n,o)}))}walkComments(t){return this.walk((r,n)=>{if(r.type==="comment")return t(r,n)})}walkDecls(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="decl"&&t.test(n.prop))return r(n,o)}):this.walk((n,o)=>{if(n.type==="decl"&&n.prop===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="decl")return r(n,o)}))}walkRules(t,r){return r?t instanceof RegExp?this.walk((n,o)=>{if(n.type==="rule"&&t.test(n.selector))return r(n,o)}):this.walk((n,o)=>{if(n.type==="rule"&&n.selector===t)return r(n,o)}):(r=t,this.walk((n,o)=>{if(n.type==="rule")return r(n,o)}))}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]}};mt.registerParse=e=>{Im=e};mt.registerRule=e=>{hc=e};mt.registerAtRule=e=>{mc=e};mt.registerRoot=e=>{Tm=e};var qt=mt;mt.default=mt;mt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,mc.prototype):e.type==="rule"?Object.setPrototypeOf(e,hc.prototype):e.type==="decl"?Object.setPrototypeOf(e,Mm.prototype):e.type==="comment"?Object.setPrototypeOf(e,Om.prototype):e.type==="root"&&Object.setPrototypeOf(e,Tm.prototype),e[Am]=!0,e.nodes&&e.nodes.forEach(t=>{mt.rebuild(t)})};var GA=qt,$m,Dm,On=class extends GA{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new $m(new Dm,this,t).stringify()}};On.registerLazyResult=e=>{$m=e};On.registerProcessor=e=>{Dm=e};var yc=On;On.default=On;var ih={},_m=function(t){ih[t]||(ih[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Dl=class{constructor(t,r={}){if(this.type="warning",this.text=t,r.node&&r.node.source){let n=r.node.rangeBy(r);this.line=n.start.line,this.column=n.start.column,this.endLine=n.end.line,this.endColumn=n.end.column}for(let n in r)this[n]=r[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}},Bm=Dl;Dl.default=Dl;var KA=Bm,_l=class{constructor(t,r,n){this.processor=t,this.messages=[],this.root=r,this.opts=n,this.css=void 0,this.map=void 0}toString(){return this.css}warn(t,r={}){r.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(r.plugin=this.lastPlugin.postcssPlugin);let n=new KA(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},gc=_l;_l.default=_l;var sl=39,sh=34,Ci=92,ah=47,Ei=10,bn=32,Pi=12,Ai=9,Mi=13,qA=91,HA=93,YA=40,ZA=41,JA=123,XA=125,QA=59,eM=42,tM=58,rM=64,Oi=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ii=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,nM=/.[\r\n"'(/\\]/,lh=/[\da-f]/i,oM=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,i,s,a,l,c,u,d,p,y,h,f=n.length,m=0,v=[],w=[];function g(){return m}function k(G){throw t.error("Unclosed "+G,m)}function _(){return w.length===0&&m>=f}function V(G){if(w.length)return w.pop();if(m>=f)return;let Q=G?G.ignoreUnclosed:!1;switch(i=n.charCodeAt(m),i){case Ei:case bn:case Ai:case Mi:case Pi:{s=m;do s+=1,i=n.charCodeAt(s);while(i===bn||i===Ei||i===Ai||i===Mi||i===Pi);h=["space",n.slice(m,s)],m=s-1;break}case qA:case HA:case JA:case XA:case tM:case QA:case ZA:{let le=String.fromCharCode(i);h=[le,le,m];break}case YA:{if(p=v.length?v.pop()[1]:"",y=n.charCodeAt(m+1),p==="url"&&y!==sl&&y!==sh&&y!==bn&&y!==Ei&&y!==Ai&&y!==Pi&&y!==Mi){s=m;do{if(u=!1,s=n.indexOf(")",s+1),s===-1)if(o||Q){s=m;break}else k("bracket");for(d=s;n.charCodeAt(d-1)===Ci;)d-=1,u=!u}while(u);h=["brackets",n.slice(m,s+1),m,s],m=s}else s=n.indexOf(")",m+1),l=n.slice(m,s+1),s===-1||nM.test(l)?h=["(","(",m]:(h=["brackets",l,m,s],m=s);break}case sl:case sh:{a=i===sl?"'":'"',s=m;do{if(u=!1,s=n.indexOf(a,s+1),s===-1)if(o||Q){s=m+1;break}else k("string");for(d=s;n.charCodeAt(d-1)===Ci;)d-=1,u=!u}while(u);h=["string",n.slice(m,s+1),m,s],m=s;break}case rM:{Oi.lastIndex=m+1,Oi.test(n),Oi.lastIndex===0?s=n.length-1:s=Oi.lastIndex-2,h=["at-word",n.slice(m,s+1),m,s],m=s;break}case Ci:{for(s=m,c=!0;n.charCodeAt(s+1)===Ci;)s+=1,c=!c;if(i=n.charCodeAt(s+1),c&&i!==ah&&i!==bn&&i!==Ei&&i!==Ai&&i!==Mi&&i!==Pi&&(s+=1,lh.test(n.charAt(s)))){for(;lh.test(n.charAt(s+1));)s+=1;n.charCodeAt(s+1)===bn&&(s+=1)}h=["word",n.slice(m,s+1),m,s],m=s;break}default:{i===ah&&n.charCodeAt(m+1)===eM?(s=n.indexOf("*/",m+2)+1,s===0&&(o||Q?s=n.length:k("comment")),h=["comment",n.slice(m,s+1),m,s],m=s):(Ii.lastIndex=m+1,Ii.test(n),Ii.lastIndex===0?s=n.length-1:s=Ii.lastIndex-2,h=["word",n.slice(m,s+1),m,s],v.push(h),m=s);break}}return m++,h}function te(G){w.push(G)}return{back:te,endOfFile:_,nextToken:V,position:g}},jm=qt,Ji=class extends jm{constructor(t){super(t),this.type="atrule"}append(...t){return this.proxyOf.nodes||(this.nodes=[]),super.append(...t)}prepend(...t){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...t)}},Sc=Ji;Ji.default=Ji;jm.registerAtRule(Ji);var Vm=qt,Wm,Um,Ir=class extends Vm{constructor(t){super(t),this.type="root",this.nodes||(this.nodes=[])}normalize(t,r,n){let o=super.normalize(t);if(r){if(n==="prepend")this.nodes.length>1?r.raws.before=this.nodes[1].raws.before:delete r.raws.before;else if(this.first!==r)for(let i of o)i.raws.before=r.raws.before}return o}removeChild(t,r){let n=this.index(t);return!r&&n===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[n].raws.before),super.removeChild(t)}toResult(t={}){return new Wm(new Um,this,t).stringify()}};Ir.registerLazyResult=e=>{Wm=e};Ir.registerProcessor=e=>{Um=e};var _n=Ir;Ir.default=Ir;Vm.registerRoot(Ir);var In={comma(e){return In.split(e,[","],!0)},space(e){let t=[" ",`
|
|
57
|
-
`," "];return In.split(e,t)},split(e,t,r){let n=[],o="",i=!1,s=0,a=!1,l="",c=!1;for(let u of e)c?c=!1:u==="\\"?c=!0:a?u===l&&(a=!1):u==='"'||u==="'"?(a=!0,l=u):u==="("?s+=1:u===")"?s>0&&(s-=1):s===0&&t.includes(u)&&(i=!0),i?(o!==""&&n.push(o.trim()),o="",i=!1):o+=u;return(r||o!=="")&&n.push(o.trim()),n}},zm=In;In.default=In;var Gm=qt,iM=zm,Xi=class extends Gm{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return iM.comma(this.selector)}set selectors(t){let r=this.selector?this.selector.match(/,\s*/):null,n=r?r[0]:","+this.raw("between","beforeOpen");this.selector=t.join(n)}},bc=Xi;Xi.default=Xi;Gm.registerRule(Xi);var sM=ds,aM=oM,lM=fs,cM=Sc,uM=_n,ch=bc,uh={empty:!0,space:!0};function dM(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var pM=class{constructor(t){this.input=t,this.root=new uM,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:t,start:{column:1,line:1,offset:0}}}atrule(t){let r=new cM;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,i,s=!1,a=!1,l=[],c=[];for(;!this.tokenizer.endOfFile();){if(t=this.tokenizer.nextToken(),n=t[0],n==="("||n==="["?c.push(n==="("?")":"]"):n==="{"&&c.length>0?c.push("}"):n===c[c.length-1]&&c.pop(),c.length===0)if(n===";"){r.source.end=this.getPosition(t[2]),r.source.end.offset++,this.semicolon=!0;break}else if(n==="{"){a=!0;break}else if(n==="}"){if(l.length>0){for(i=l.length-1,o=l[i];o&&o[0]==="space";)o=l[--i];o&&(r.source.end=this.getPosition(o[3]||o[2]),r.source.end.offset++)}this.end(t);break}else l.push(t);else l.push(t);if(this.tokenizer.endOfFile()){s=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),s&&(t=l[l.length-1],r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++,this.spaces=r.raws.between,r.raws.between="")):(r.raws.afterName="",r.params=""),a&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let i=r-1;i>=0&&(o=t[i],!(o[0]!=="space"&&(n+=1,n===2)));i--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,i;for(let[s,a]of t.entries()){if(n=a,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!i)this.doubleColon(n);else{if(i[0]==="word"&&i[1]==="progid")continue;return s}i=n}return!1}comment(t){let r=new lM;this.init(r,t[2]),r.source.end=this.getPosition(t[3]||t[2]),r.source.end.offset++;let n=t[1].slice(2,-2);if(/^\s*$/.test(n))r.text="",r.raws.left=n,r.raws.right="";else{let o=n.match(/^(\s*)([^]*\S)(\s*)$/);r.text=o[2],r.raws.left=o[1],r.raws.right=o[3]}}createTokenizer(){this.tokenizer=aM(this.input)}decl(t,r){let n=new sM;this.init(n,t[0][2]);let o=t[t.length-1];for(o[0]===";"&&(this.semicolon=!0,t.pop()),n.source.end=this.getPosition(o[3]||o[2]||dM(t)),n.source.end.offset++;t[0][0]!=="word";)t.length===1&&this.unknownWord(t),n.raws.before+=t.shift()[1];for(n.source.start=this.getPosition(t[0][2]),n.prop="";t.length;){let c=t[0][0];if(c===":"||c==="space"||c==="comment")break;n.prop+=t.shift()[1]}n.raws.between="";let i;for(;t.length;)if(i=t.shift(),i[0]===":"){n.raws.between+=i[1];break}else i[0]==="word"&&/\w/.test(i[1])&&this.unknownWord([i]),n.raws.between+=i[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let s=[],a;for(;t.length&&(a=t[0][0],!(a!=="space"&&a!=="comment"));)s.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(i=t[c],i[1].toLowerCase()==="!important"){n.important=!0;let u=this.stringFrom(t,c);u=this.spacesFromEnd(t)+u,u!==" !important"&&(n.raws.important=u);break}else if(i[1].toLowerCase()==="important"){let u=t.slice(0),d="";for(let p=c;p>0;p--){let y=u[p][0];if(d.trim().indexOf("!")===0&&y!=="space")break;d=u.pop()[1]+d}d.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=d,t=u)}if(i[0]!=="space"&&i[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=s.map(c=>c[1]).join(""),s=[]),this.raw(n,"value",s.concat(t),r),n.value.includes(":")&&!r&&this.checkMissedSemicolon(t)}doubleColon(t){throw this.input.error("Double colon",{offset:t[2]},{offset:t[2]+t[1].length})}emptyRule(t){let r=new ch;this.init(r,t[2]),r.selector="",r.raws.between="",this.current=r}end(t){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(t[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(t)}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(t){if(this.spaces+=t[1],this.current.nodes){let r=this.current.nodes[this.current.nodes.length-1];r&&r.type==="rule"&&!r.raws.ownSemicolon&&(r.raws.ownSemicolon=this.spaces,this.spaces="")}}getPosition(t){let r=this.input.fromOffset(t);return{column:r.col,line:r.line,offset:t}}init(t,r){this.current.push(t),t.source={input:this.input,start:this.getPosition(r)},t.raws.before=this.spaces,this.spaces="",t.type!=="comment"&&(this.semicolon=!1)}other(t){let r=!1,n=null,o=!1,i=null,s=[],a=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")i||(i=c),s.push(n==="("?")":"]");else if(a&&o&&n==="{")i||(i=c),s.push("}");else if(s.length===0)if(n===";")if(o){this.decl(l,a);return}else break;else if(n==="{"){this.rule(l);return}else if(n==="}"){this.tokenizer.back(l.pop()),r=!0;break}else n===":"&&(o=!0);else n===s[s.length-1]&&(s.pop(),s.length===0&&(i=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),s.length>0&&this.unclosedBracket(i),r&&o){if(!a)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,a)}else this.unknownWord(l)}parse(){let t;for(;!this.tokenizer.endOfFile();)switch(t=this.tokenizer.nextToken(),t[0]){case"space":this.spaces+=t[1];break;case";":this.freeSemicolon(t);break;case"}":this.end(t);break;case"comment":this.comment(t);break;case"at-word":this.atrule(t);break;case"{":this.emptyRule(t);break;default:this.other(t);break}this.endFile()}precheckMissedSemicolon(){}raw(t,r,n,o){let i,s,a=n.length,l="",c=!0,u,d;for(let p=0;p<a;p+=1)i=n[p],s=i[0],s==="space"&&p===a-1&&!o?c=!1:s==="comment"?(d=n[p-1]?n[p-1][0]:"empty",u=n[p+1]?n[p+1][0]:"empty",!uh[d]&&!uh[u]?l.slice(-1)===","?c=!1:l+=i[1]:c=!1):l+=i[1];if(!c){let p=n.reduce((y,h)=>y+h[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new ch;this.init(r,t[0][2]),r.raws.between=this.spacesAndCommentsFromEnd(t),this.raw(r,"selector",t),this.current=r}spacesAndCommentsFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],!(r!=="space"&&r!=="comment"));)n=t.pop()[1]+n;return n}spacesAndCommentsFromStart(t){let r,n="";for(;t.length&&(r=t[0][0],!(r!=="space"&&r!=="comment"));)n+=t.shift()[1];return n}spacesFromEnd(t){let r,n="";for(;t.length&&(r=t[t.length-1][0],r==="space");)n=t.pop()[1]+n;return n}stringFrom(t,r){let n="";for(let o=r;o<t.length;o++)n+=t[o][1];return t.splice(r,t.length-r),n}unclosedBlock(){let t=this.current.source.start;throw this.input.error("Unclosed block",t.line,t.column)}unclosedBracket(t){throw this.input.error("Unclosed bracket",{offset:t[2]},{offset:t[2]+1})}unexpectedClose(t){throw this.input.error("Unexpected }",{offset:t[2]},{offset:t[2]+1})}unknownWord(t){throw this.input.error("Unknown word",{offset:t[0][2]},{offset:t[0][2]+t[0][1].length})}unnamedAtrule(t,r){throw this.input.error("At-rule without name",{offset:r[2]},{offset:r[2]+r[1].length})}},fM=pM,hM=qt,mM=fM,yM=ps;function Qi(e,t){let r=new yM(e,t),n=new mM(r);try{n.parse()}catch(o){throw process.env.NODE_ENV!=="production"&&o.name==="CssSyntaxError"&&t&&t.from&&(/\.scss$/i.test(t.from)?o.message+=`
|
|
58
|
-
You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(t.from)?o.message+=`
|
|
59
|
-
You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(t.from)&&(o.message+=`
|
|
60
|
-
You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),o}return n.root}var wc=Qi;Qi.default=Qi;hM.registerParse(Qi);var{isClean:nt,my:gM}=Dn,SM=Em,bM=cs,wM=qt,RM=yc,vM=_m,dh=gc,xM=wc,kM=_n,CM={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},EM={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},PM={Once:!0,postcssPlugin:!0,prepare:!0},Tr=0;function wn(e){return typeof e=="object"&&typeof e.then=="function"}function Km(e){let t=!1,r=CM[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,Tr,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,Tr,r+"Exit"]:[r,r+"Exit"]}function ph(e){let t;return e.type==="document"?t=["Document",Tr,"DocumentExit"]:e.type==="root"?t=["Root",Tr,"RootExit"]:t=Km(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Bl(e){return e[nt]=!1,e.nodes&&e.nodes.forEach(t=>Bl(t)),e}var jl={},Lr=class qm{constructor(t,r,n){this.stringified=!1,this.processed=!1;let o;if(typeof r=="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=Bl(r);else if(r instanceof qm||r instanceof dh)o=Bl(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let i=xM;n.syntax&&(i=n.syntax.parse),n.parser&&(i=n.parser),i.parse&&(i=i.parse);try{o=i(r,n)}catch(s){this.processed=!0,this.error=s}o&&!o[gM]&&wM.rebuild(o)}this.result=new dh(t,o,n),this.helpers={...jl,postcss:jl,result:this.result},this.plugins=this.processor.plugins.map(i=>typeof i=="object"&&i.prepare?{...i,...i.prepare(this.result)}:i)}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,r){let n=this.result.lastPlugin;try{if(r&&r.addToError(t),this.error=t,t.name==="CssSyntaxError"&&!t.plugin)t.plugin=n.postcssPlugin,t.setMessage();else if(n.postcssVersion&&process.env.NODE_ENV!=="production"){let o=n.postcssPlugin,i=n.postcssVersion,s=this.result.processor.version,a=i.split("."),l=s.split(".");(a[0]!==l[0]||parseInt(a[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+o+" uses "+i+". Perhaps this is the source of the error below.")}}catch(o){console&&console.error&&console.error(o)}return t}prepareVisitors(){this.listeners={};let t=(r,n,o)=>{this.listeners[n]||(this.listeners[n]=[]),this.listeners[n].push([r,o])};for(let r of this.plugins)if(typeof r=="object")for(let n in r){if(!EM[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!PM[n])if(typeof r[n]=="object")for(let o in r[n])o==="*"?t(r,n,r[n][o]):t(r,n+"-"+o.toLowerCase(),r[n][o]);else typeof r[n]=="function"&&t(r,n,r[n])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let r=this.plugins[t],n=this.runOnRoot(r);if(wn(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[nt];){t[nt]=!0;let r=[ph(t)];for(;r.length>0;){let n=this.visitTick(r);if(wn(n))try{await n}catch(o){let i=r[r.length-1].node;throw this.handleError(o,i)}}}if(this.listeners.OnceExit)for(let[r,n]of this.listeners.OnceExit){this.result.lastPlugin=r;try{if(t.type==="document"){let o=t.nodes.map(i=>n(i,this.helpers));await Promise.all(o)}else await n(t,this.helpers)}catch(o){throw this.handleError(o)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if(typeof t=="object"&&t.Once){if(this.result.root.type==="document"){let r=this.result.root.nodes.map(n=>t.Once(n,this.helpers));return wn(r[0])?Promise.all(r):r}return t.Once(this.result.root,this.helpers)}else if(typeof t=="function")return t(this.result.root,this.result)}catch(r){throw this.handleError(r)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,r=bM;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new SM(r,this.result.root,this.result.opts).generate();return this.result.css=o[0],this.result.map=o[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 t of this.plugins){let r=this.runOnRoot(t);if(wn(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[nt];)t[nt]=!0,this.walkSync(t);if(this.listeners.OnceExit)if(t.type==="document")for(let r of t.nodes)this.visitSync(this.listeners.OnceExit,r);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this.opts||vM("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this.css}visitSync(t,r){for(let[n,o]of t){this.result.lastPlugin=n;let i;try{i=o(r,this.helpers)}catch(s){throw this.handleError(s,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(wn(i))throw this.getAsyncError()}}visitTick(t){let r=t[t.length-1],{node:n,visitors:o}=r;if(n.type!=="root"&&n.type!=="document"&&!n.parent){t.pop();return}if(o.length>0&&r.visitorIndex<o.length){let[s,a]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=s;try{return a(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let s=r.iterator,a;for(;a=n.nodes[n.indexes[s]];)if(n.indexes[s]+=1,!a[nt]){a[nt]=!0,t.push(ph(a));return}r.iterator=0,delete n.indexes[s]}let i=r.events;for(;r.eventIndex<i.length;){let s=i[r.eventIndex];if(r.eventIndex+=1,s===Tr){n.nodes&&n.nodes.length&&(n[nt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[s]){r.visitors=this.listeners[s];return}}t.pop()}walkSync(t){t[nt]=!0;let r=Km(t);for(let n of r)if(n===Tr)t.nodes&&t.each(o=>{o[nt]||this.walkSync(o)});else{let o=this.listeners[n];if(o&&this.visitSync(o,t.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"}};Lr.registerPostcss=e=>{jl=e};var Hm=Lr;Lr.default=Lr;kM.registerLazyResult(Lr);RM.registerLazyResult(Lr);var AM=Em,MM=cs,OM=_m,IM=wc,TM=gc,Vl=class{constructor(t,r,n){r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=n,this._map=void 0;let o,i=MM;this.result=new TM(this._processor,o,this._opts),this.result.css=r;let s=this;Object.defineProperty(this.result,"root",{get(){return s.root}});let a=new AM(i,o,this._opts,r);if(a.isMap()){let[l,c]=a.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else a.clearAnnotation(),this.result.css=a.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,r){return process.env.NODE_ENV!=="production"&&("from"in this._opts||OM("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}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 t,r=IM;try{t=r(this._css,this._opts)}catch(n){this.error=n}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}},LM=Vl;Vl.default=Vl;var NM=LM,FM=Hm,$M=yc,DM=_n,Tn=class{constructor(t=[]){this.version="8.4.38",this.plugins=this.normalize(t)}normalize(t){let r=[];for(let n of t)if(n.postcss===!0?n=n():n.postcss&&(n=n.postcss),typeof n=="object"&&Array.isArray(n.plugins))r=r.concat(n.plugins);else if(typeof n=="object"&&n.postcssPlugin)r.push(n);else if(typeof n=="function")r.push(n);else if(typeof n=="object"&&(n.parse||n.stringify)){if(process.env.NODE_ENV!=="production")throw new Error("PostCSS syntaxes cannot be used as plugins. Instead, please use one of the syntax/parser/stringifier options as outlined in your PostCSS runner documentation.")}else throw new Error(n+" is not a PostCSS plugin");return r}process(t,r={}){return!this.plugins.length&&!r.parser&&!r.stringifier&&!r.syntax?new NM(this,t,r):new FM(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},_M=Tn;Tn.default=Tn;DM.registerProcessor(Tn);$M.registerProcessor(Tn);var BM=ds,jM=Rm,VM=fs,WM=Sc,UM=ps,zM=_n,GM=bc;function Ln(e,t){if(Array.isArray(e))return e.map(o=>Ln(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let i={...o,__proto__:UM.prototype};i.map&&(i.map={...i.map,__proto__:jM.prototype}),t.push(i)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Ln(o,t))),n.source){let{inputId:o,...i}=n.source;n.source=i,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new zM(n);if(n.type==="decl")return new BM(n);if(n.type==="rule")return new GM(n);if(n.type==="comment")return new VM(n);if(n.type==="atrule")return new WM(n);throw new Error("Unknown node type: "+e.type)}var KM=Ln;Ln.default=Ln;var qM=fc,Ym=ds,HM=Hm,YM=qt,Rc=_M,ZM=cs,JM=KM,Zm=yc,XM=Bm,Jm=fs,Xm=Sc,QM=gc,eO=ps,tO=wc,rO=zm,Qm=bc,ey=_n,nO=us;function D(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Rc(e)}D.plugin=function(t,r){let n=!1;function o(...s){console&&console.warn&&!n&&(n=!0,console.warn(t+`: postcss.plugin was deprecated. Migration guide:
|
|
61
|
-
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),process.env.LANG&&process.env.LANG.startsWith("cn")&&console.warn(t+`: \u91CC\u9762 postcss.plugin \u88AB\u5F03\u7528. \u8FC1\u79FB\u6307\u5357:
|
|
62
|
-
https://www.w3ctech.com/topic/2226`));let a=r(...s);return a.postcssPlugin=t,a.postcssVersion=new Rc().version,a}let i;return Object.defineProperty(o,"postcss",{get(){return i||(i=o()),i}}),o.process=function(s,a,l){return D([o(l)]).process(s,a)},o};D.stringify=ZM;D.parse=tO;D.fromJSON=JM;D.list=rO;D.comment=e=>new Jm(e);D.atRule=e=>new Xm(e);D.decl=e=>new Ym(e);D.rule=e=>new Qm(e);D.root=e=>new ey(e);D.document=e=>new Zm(e);D.CssSyntaxError=qM;D.Declaration=Ym;D.Container=YM;D.Processor=Rc;D.Document=Zm;D.Comment=Jm;D.Warning=XM;D.AtRule=Xm;D.Result=QM;D.Input=eO;D.Rule=Qm;D.Root=ey;D.Node=nO;HM.registerPostcss(D);var oO=D;D.default=D;var H=hA(oO);H.stringify;H.fromJSON;H.plugin;H.parse;H.list;H.document;H.comment;H.atRule;H.rule;H.decl;H.root;H.CssSyntaxError;H.Declaration;H.Container;H.Processor;H.Document;H.Comment;H.Warning;H.AtRule;H.Result;H.Input;H.Rule;H.Root;H.Node;var Wl=class e{constructor(...t){Le(this,"parentElement",null),Le(this,"parentNode",null),Le(this,"ownerDocument"),Le(this,"firstChild",null),Le(this,"lastChild",null),Le(this,"previousSibling",null),Le(this,"nextSibling",null),Le(this,"ELEMENT_NODE",1),Le(this,"TEXT_NODE",3),Le(this,"nodeType"),Le(this,"nodeName"),Le(this,"RRNodeType")}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof e){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};var fh={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},hh={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Ti={},iO=()=>!!globalThis.Zone;function vc(e){if(Ti[e])return Ti[e];let t=globalThis[e],r=t.prototype,n=e in fh?fh[e]:void 0,o=!!(n&&n.every(a=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,a))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),i=e in hh?hh[e]:void 0,s=!!(i&&i.every(a=>{var l;return typeof r[a]=="function"&&((l=r[a])==null?void 0:l.toString().includes("[native code]"))}));if(o&&s&&!iO())return Ti[e]=t.prototype,t.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let l=a.contentWindow;if(!l)return t.prototype;let c=l[e].prototype;return document.body.removeChild(a),c?Ti[e]=c:r}catch{return r}}var al={};function gt(e,t,r){var n;let o=`${e}.${String(r)}`;if(al[o])return al[o].call(t);let i=vc(e),s=(n=Object.getOwnPropertyDescriptor(i,r))==null?void 0:n.get;return s?(al[o]=s,s.call(t)):t[r]}var ll={};function ty(e,t,r){let n=`${e}.${String(r)}`;if(ll[n])return ll[n].bind(t);let i=vc(e)[r];return typeof i!="function"?t[r]:(ll[n]=i,i.bind(t))}function sO(e){return gt("Node",e,"ownerDocument")}function aO(e){return gt("Node",e,"childNodes")}function lO(e){return gt("Node",e,"parentNode")}function cO(e){return gt("Node",e,"parentElement")}function uO(e){return gt("Node",e,"textContent")}function dO(e,t){return ty("Node",e,"contains")(t)}function pO(e){return ty("Node",e,"getRootNode")()}function fO(e){return!e||!("host"in e)?null:gt("ShadowRoot",e,"host")}function hO(e){return e.styleSheets}function mO(e){return!e||!("shadowRoot"in e)?null:gt("Element",e,"shadowRoot")}function yO(e,t){return gt("Element",e,"querySelector")(t)}function gO(e,t){return gt("Element",e,"querySelectorAll")(t)}function ry(){return vc("MutationObserver").constructor}function Ht(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var C={ownerDocument:sO,childNodes:aO,parentNode:lO,parentElement:cO,textContent:uO,contains:dO,getRootNode:pO,host:fO,styleSheets:hO,shadowRoot:mO,querySelector:yO,querySelectorAll:gO,mutationObserver:ry,patch:Ht};function he(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var xr=`Please stop import mirror directly. Instead of that,\r
|
|
63
|
-
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
64
|
-
or you can use record.mirror to access the mirror instance during recording.`,mh={map:{},getId(){return console.error(xr),-1},getNode(){return console.error(xr),null},removeNodeFromMap(){console.error(xr)},has(){return console.error(xr),!1},reset(){console.error(xr)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(mh=new Proxy(mh,{get(e,t,r){return t==="map"&&console.error(xr),Reflect.get(e,t,r)}}));function Nn(e,t,r={}){let n=null,o=0;return function(...i){let s=Date.now();!o&&r.leading===!1&&(o=s);let a=t-(s-o),l=this;a<=0||a>t?(n&&(clearTimeout(n),n=null),o=s,e.apply(l,i)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(l,i)},a))}}function hs(e,t,r,n,o=window){let i=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(s){setTimeout(()=>{r.set.call(this,s)},0),i&&i.set&&i.set.call(this,s)}}),()=>hs(e,t,i||{},!0)}var es=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(es=()=>new Date().getTime());function ny(e){var t,r,n,o;let i=e.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:i.documentElement.scrollLeft||i?.body&&((t=C.parentElement(i.body))==null?void 0:t.scrollLeft)||((r=i?.body)==null?void 0:r.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:i?.documentElement.scrollTop||i?.body&&((n=C.parentElement(i.body))==null?void 0:n.scrollTop)||((o=i?.body)==null?void 0:o.scrollTop)||0}}function oy(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function iy(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function sy(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function me(e,t,r,n){if(!e)return!1;let o=sy(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(Gi(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function SO(e,t){return t.getId(e)!==-1}function cl(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Cn}function ay(e,t){if(vn(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=C.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?ay(n,t):!0}function Ul(e){return!!e.changedTouches}function bO(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)}function ly(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function cy(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function zl(e){return e?e instanceof Wl&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var Gl=class{constructor(){S(this,"id",1),S(this,"styleIDMap",new WeakMap),S(this,"idStyleMap",new Map)}getId(t){return this.styleIDMap.get(t)??-1}has(t){return this.styleIDMap.has(t)}add(t,r){if(this.has(t))return this.getId(t);let n;return r===void 0?n=this.id++:n=r,this.styleIDMap.set(t,n),this.idStyleMap.set(n,t),n}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function uy(e){var t;let r=null;return"getRootNode"in e&&((t=C.getRootNode(e))==null?void 0:t.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&C.host(C.getRootNode(e))&&(r=C.host(C.getRootNode(e))),r}function wO(e){let t=e,r;for(;r=uy(t);)t=r;return t}function RO(e){let t=C.ownerDocument(e);if(!t)return!1;let r=wO(e);return C.contains(t,r)}function dy(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||RO(e):!1}var O=(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))(O||{}),E=(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))(E||{}),we=(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))(we||{}),ft=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(ft||{}),Nr=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Nr||{}),kr=(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))(kr||{});var py=(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))(py||{});function yh(e){return"__ln"in e}var Kl=class{constructor(){S(this,"length",0),S(this,"head",null),S(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let n=0;n<t;n++)r=r?.next||null;return r}addNode(t){let r={value:t,previous:null,next:null};if(t.__ln=r,t.previousSibling&&yh(t.previousSibling)){let n=t.previousSibling.__ln.next;r.next=n,r.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=r,n&&(n.previous=r)}else if(t.nextSibling&&yh(t.nextSibling)&&t.nextSibling.__ln.previous){let n=t.nextSibling.__ln.previous;r.previous=n,r.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=r,n&&(n.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;r.next===null&&(this.tail=r),this.length++}removeNode(t){let r=t.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},gh=(e,t)=>`${e}@${t}`,ql=class{constructor(){S(this,"frozen",!1),S(this,"locked",!1),S(this,"texts",[]),S(this,"attributes",[]),S(this,"attributeMap",new WeakMap),S(this,"removes",[]),S(this,"mapRemoves",[]),S(this,"movedMap",{}),S(this,"addedSet",new Set),S(this,"movedSet",new Set),S(this,"droppedSet",new Set),S(this,"removesSubTreeCache",new Set),S(this,"mutationCb"),S(this,"blockClass"),S(this,"blockSelector"),S(this,"maskTextClass"),S(this,"maskTextSelector"),S(this,"inlineStylesheet"),S(this,"maskInputOptions"),S(this,"maskTextFn"),S(this,"maskInputFn"),S(this,"keepIframeSrcFn"),S(this,"recordCanvas"),S(this,"inlineImages"),S(this,"slimDOMOptions"),S(this,"dataURLOptions"),S(this,"doc"),S(this,"mirror"),S(this,"iframeManager"),S(this,"stylesheetManager"),S(this,"shadowDomManager"),S(this,"canvasManager"),S(this,"processedNodeManager"),S(this,"unattachedDoc"),S(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),S(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new Kl,o=l=>{let c=l,u=Cn;for(;u===Cn;)c=c&&c.nextSibling,u=c&&this.mirror.getId(c);return u},i=l=>{let c=C.parentNode(l);if(!c||!dy(l))return;let u=!1;if(l.nodeType===Node.TEXT_NODE){let h=c.tagName;if(h==="TEXTAREA")return;h==="STYLE"&&this.addedSet.has(c)&&(u=!0)}let d=vn(c)?this.mirror.getId(uy(l)):this.mirror.getId(c),p=o(l);if(d===-1||p===-1)return n.addNode(l);let y=Er(l,{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:h=>{ly(h,this.mirror)&&this.iframeManager.addIframe(h),cy(h,this.mirror)&&this.stylesheetManager.trackLinkElement(h),zl(l)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(l),this.doc)},onIframeLoad:(h,f)=>{this.iframeManager.attachIframe(h,f),this.shadowDomManager.observeAttachShadow(h)},onStylesheetLoad:(h,f)=>{this.stylesheetManager.attachLinkElement(h,f)},cssCaptured:u});y&&(t.push({parentId:d,nextId:p,node:y}),r.add(y.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)Sh(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(C.parentNode(l))||i(l);for(let l of this.addedSet)!bh(this.droppedSet,l)&&!Sh(this.removesSubTreeCache,l,this.mirror)||bh(this.movedSet,l)?i(l):this.droppedSet.add(l);let s=null;for(;n.length;){let l=null;if(s){let c=this.mirror.getId(C.parentNode(s.value)),u=o(s.value);c!==-1&&u!==-1&&(l=s)}if(!l){let c=n.tail;for(;c;){let u=c;if(c=c.previous,u){let d=this.mirror.getId(C.parentNode(u.value));if(o(u.value)===-1)continue;if(d!==-1){l=u;break}else{let y=u.value,h=C.parentNode(y);if(h&&h.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let f=C.host(h);if(this.mirror.getId(f)!==-1){l=u;break}}}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}s=l.previous,n.removeNode(l.value),i(l.value)}let a={texts:this.texts.map(l=>{let c=l.node,u=C.parentNode(c);return u&&u.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(u),{id:this.mirror.getId(c),value:l.value}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),attributes:this.attributes.map(l=>{let{attributes:c}=l;if(typeof c.style=="string"){let u=JSON.stringify(l.styleDiff),d=JSON.stringify(l._unchangedStyles);u.length<c.style.length&&(u+d).split("var(").length===c.style.split("var(").length&&(c.style=l.styleDiff)}return{id:this.mirror.getId(l.node),attributes:c}}).filter(l=>!r.has(l.id)).filter(l=>this.mirror.has(l.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(a))}),S(this,"genTextAreaValueMutation",t=>{let r=this.attributeMap.get(t);r||(r={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(t,r));let n=Array.from(C.childNodes(t),o=>C.textContent(o)||"").join("");r.attributes.value=Wi({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:Ui(t),value:n,maskInputFn:this.maskInputFn})}),S(this,"processMutation",t=>{if(!cl(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!me(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:Lh(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,sy(t.target)):r.replace(/[\S]/g,"*"):r,node:t.target});break}case"attributes":{let r=t.target,n=t.attributeName,o=t.target.getAttribute(n);if(n==="value"){let s=Ui(r);o=Wi({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:s,value:o,maskInputFn:this.maskInputFn})}if(me(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let i=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)n="rr_src";else return;if(i||(i={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(t.target,i)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!Th(r.tagName,n))if(i.attributes[n]=Ih(this.doc,Gt(r.tagName),Gt(n),o),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let s=this.unattachedDoc.createElement("span");t.oldValue&&s.setAttribute("style",t.oldValue);for(let a of Array.from(r.style)){let l=r.style.getPropertyValue(a),c=r.style.getPropertyPriority(a);l!==s.style.getPropertyValue(a)||c!==s.style.getPropertyPriority(a)?c===""?i.styleDiff[a]=l:i.styleDiff[a]=[l,c]:i._unchangedStyles[a]=[l,c]}for(let a of Array.from(s.style))r.style.getPropertyValue(a)===""&&(i.styleDiff[a]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?i.attributes.rr_open_mode="modal":i.attributes.rr_open_mode="non-modal");break}case"childList":{if(me(t.target,this.blockClass,this.blockSelector,!0))return;if(t.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(t.target);return}t.addedNodes.forEach(r=>this.genAdds(r,t.target)),t.removedNodes.forEach(r=>{let n=this.mirror.getId(r),o=vn(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);me(t.target,this.blockClass,this.blockSelector,!1)||cl(r,this.mirror,this.slimDOMOptions)||!SO(r,this.mirror)||(this.addedSet.has(r)?(Hl(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||ay(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[gh(n,o)]?Hl(this.movedSet,r):(this.removes.push({parentId:o,id:n,isShadow:vn(t.target)&&xn(t.target)?!0:void 0}),vO(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),S(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(cl(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let n=null;r&&this.mirror.hasNode(r)&&(n=this.mirror.getId(r)),n&&n!==-1&&(this.movedMap[gh(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);me(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),zl(t)&&C.childNodes(C.shadowRoot(t)).forEach(n=>{this.processedNodeManager.add(n,this),this.genAdds(n,t)}))}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(r=>{this[r]=t[r]})}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 Hl(e,t){e.delete(t),C.childNodes(t).forEach(r=>Hl(e,r))}function vO(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),C.childNodes(n).forEach(o=>r.push(o)))}}function Sh(e,t,r){return e.size===0?!1:xO(e,t)}function xO(e,t,r){let n=C.parentNode(t);return n?e.has(n):!1}function bh(e,t){return e.size===0?!1:fy(e,t)}function fy(e,t){let r=C.parentNode(t);return r?e.has(r)?!0:fy(e,r):!1}var kn;function kO(e){kn=e}function CO(){kn=void 0}var I=e=>kn?(...r)=>{try{return e(...r)}catch(n){if(kn&&kn(n)===!0)return;throw n}}:e,zt=[];function Bn(e){try{if("composedPath"in e){let 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 hy(e,t){let r=new ql;zt.push(r),r.init(e);let n=new(ry())(I(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function EO({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,i=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,s=[],a,l=Nn(I(d=>{let p=Date.now()-a;e(s.map(y=>(y.timeOffset-=p,y)),d),s=[],a=null}),i),c=I(Nn(I(d=>{let p=Bn(d),{clientX:y,clientY:h}=Ul(d)?d.changedTouches[0]:d;a||(a=es()),s.push({x:y,y:h,id:n.getId(p),timeOffset:es()-a}),l(typeof DragEvent<"u"&&d instanceof DragEvent?E.Drag:d instanceof MouseEvent?E.MouseMove:E.TouchMove)}),o,{trailing:!1})),u=[he("mousemove",c,r),he("touchmove",c,r),he("drag",c,r)];return I(()=>{u.forEach(d=>d())})}function PO({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){if(i.mouseInteraction===!1)return()=>{};let s=i.mouseInteraction===!0||i.mouseInteraction===void 0?{}:i.mouseInteraction,a=[],l=null,c=u=>d=>{let p=Bn(d);if(me(p,n,o,!0))return;let y=null,h=u;if("pointerType"in d){switch(d.pointerType){case"mouse":y=ft.Mouse;break;case"touch":y=ft.Touch;break;case"pen":y=ft.Pen;break}y===ft.Touch?we[u]===we.MouseDown?h="TouchStart":we[u]===we.MouseUp&&(h="TouchEnd"):ft.Pen}else Ul(d)&&(y=ft.Touch);y!==null?(l=y,(h.startsWith("Touch")&&y===ft.Touch||h.startsWith("Mouse")&&y===ft.Mouse)&&(y=null)):we[u]===we.Click&&(y=l,l=null);let f=Ul(d)?d.changedTouches[0]:d;if(!f)return;let m=r.getId(p),{clientX:v,clientY:w}=f;I(e)({type:we[h],id:m,x:v,y:w,...y!==null&&{pointerType:y}})};return Object.keys(we).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let d=Gt(u),p=c(u);if(window.PointerEvent)switch(we[u]){case we.MouseDown:case we.MouseUp:d=d.replace("mouse","pointer");break;case we.TouchStart:case we.TouchEnd:return}a.push(he(d,p,t))}),I(()=>{a.forEach(u=>u())})}function my({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:i}){let s=I(Nn(I(a=>{let l=Bn(a);if(!l||me(l,n,o,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let u=ny(t.defaultView);e({id:c,x:u.left,y:u.top})}else e({id:c,x:l.scrollLeft,y:l.scrollTop})}),i.scroll||100));return he("scroll",s,t)}function AO({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=I(Nn(I(()=>{let i=oy(),s=iy();(r!==i||n!==s)&&(e({width:Number(s),height:Number(i)}),r=i,n=s)}),200));return he("resize",o,t)}var MO=["INPUT","TEXTAREA","SELECT"],wh=new WeakMap;function OO({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:i,ignoreSelector:s,maskInputOptions:a,maskInputFn:l,sampling:c,userTriggeredOnInput:u}){function d(w){let g=Bn(w),k=w.isTrusted,_=g&&g.tagName;if(g&&_==="OPTION"&&(g=C.parentElement(g)),!g||!_||MO.indexOf(_)<0||me(g,n,o,!0)||g.classList.contains(i)||s&&g.matches(s))return;let V=g.value,te=!1,G=Ui(g)||"";G==="radio"||G==="checkbox"?te=g.checked:(a[_.toLowerCase()]||a[G])&&(V=Wi({element:g,maskInputOptions:a,tagName:_,type:G,value:V,maskInputFn:l})),p(g,u?{text:V,isChecked:te,userTriggered:k}:{text:V,isChecked:te});let Q=g.name;G==="radio"&&Q&&te&&t.querySelectorAll(`input[type="radio"][name="${Q}"]`).forEach(le=>{if(le!==g){let Me=le.value;p(le,u?{text:Me,isChecked:!te,userTriggered:!1}:{text:Me,isChecked:!te})}})}function p(w,g){let k=wh.get(w);if(!k||k.text!==g.text||k.isChecked!==g.isChecked){wh.set(w,g);let _=r.getId(w);I(e)({...g,id:_})}}let h=(c.input==="last"?["change"]:["input","change"]).map(w=>he(w,I(d),t)),f=t.defaultView;if(!f)return()=>{h.forEach(w=>w())};let m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),v=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(...v.map(w=>hs(w[0],w[1],{set(){I(d)({target:this,isTrusted:!1})}},!1,f))),I(()=>{h.forEach(w=>w())})}function ts(e){let t=[];function r(n,o){if(Li("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Li("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Li("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Li("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(s)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(s)}return o}return r(e,t)}function kt(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function IO({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:I((u,d,p)=>{let[y,h]=p,{id:f,styleId:m}=kt(d,t,r.styleMirror);return(f&&f!==-1||m&&m!==-1)&&e({id:f,styleId:m,adds:[{rule:y,index:h}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.addRule=function(u,d,p=this.cssRules.length){let y=`${u} { ${d} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[y,p])};let i=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(i,{apply:I((u,d,p)=>{let[y]=p,{id:h,styleId:f}=kt(d,t,r.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,removes:[{index:y}]}),u.apply(d,p)})}),n.CSSStyleSheet.prototype.removeRule=function(u){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;n.CSSStyleSheet.prototype.replace&&(s=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:I((u,d,p)=>{let[y]=p,{id:h,styleId:f}=kt(d,t,r.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,replace:y}),u.apply(d,p)})}));let a;n.CSSStyleSheet.prototype.replaceSync&&(a=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:I((u,d,p)=>{let[y]=p,{id:h,styleId:f}=kt(d,t,r.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,replaceSync:y}),u.apply(d,p)})}));let l={};Ni("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(Ni("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),Ni("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),Ni("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([u,d])=>{c[u]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=new Proxy(c[u].insertRule,{apply:I((p,y,h)=>{let[f,m]=h,{id:v,styleId:w}=kt(y.parentStyleSheet,t,r.styleMirror);return(v&&v!==-1||w&&w!==-1)&&e({id:v,styleId:w,adds:[{rule:f,index:[...ts(y),m||0]}]}),p.apply(y,h)})}),d.prototype.deleteRule=new Proxy(c[u].deleteRule,{apply:I((p,y,h)=>{let[f]=h,{id:m,styleId:v}=kt(y.parentStyleSheet,t,r.styleMirror);return(m&&m!==-1||v&&v!==-1)&&e({id:m,styleId:v,removes:[{index:[...ts(y),f]}]}),p.apply(y,h)})})}),I(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=i,s&&(n.CSSStyleSheet.prototype.replace=s),a&&(n.CSSStyleSheet.prototype.replaceSync=a),Object.entries(l).forEach(([u,d])=>{d.prototype.insertRule=c[u].insertRule,d.prototype.deleteRule=c[u].deleteRule})})}function yy({mirror:e,stylesheetManager:t},r){var n,o,i;let s=null;r.nodeName==="#document"?s=e.getId(r):s=e.getId(C.host(r));let a=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(i=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:i.ShadowRoot,l=a?.prototype?Object.getOwnPropertyDescriptor(a?.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!l?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var c;return(c=l.get)==null?void 0:c.call(this)},set(c){var u;let d=(u=l.set)==null?void 0:u.call(this,c);if(s!==null&&s!==-1)try{t.adoptStyleSheets(c,s)}catch{}return d}}),I(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function TO({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let i=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(i,{apply:I((a,l,c)=>{var u;let[d,p,y]=c;if(r.has(d))return i.apply(l,[d,p,y]);let{id:h,styleId:f}=kt((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,set:{property:d,value:p,priority:y},index:ts(l.parentRule)}),a.apply(l,c)})});let s=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:I((a,l,c)=>{var u;let[d]=c;if(r.has(d))return s.apply(l,[d]);let{id:p,styleId:y}=kt((u=l.parentRule)==null?void 0:u.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||y&&y!==-1)&&e({id:p,styleId:y,remove:{property:d},index:ts(l.parentRule)}),a.apply(l,c)})}),I(()=>{o.CSSStyleDeclaration.prototype.setProperty=i,o.CSSStyleDeclaration.prototype.removeProperty=s})}function LO({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:i}){let s=I(l=>Nn(I(c=>{let u=Bn(c);if(!u||me(u,t,r,!0))return;let{currentTime:d,volume:p,muted:y,playbackRate:h,loop:f}=u;e({type:l,id:n.getId(u),currentTime:d,volume:p,muted:y,playbackRate:h,loop:f})}),o.media||500)),a=[he("play",s(kr.Play),i),he("pause",s(kr.Pause),i),he("seeked",s(kr.Seeked),i),he("volumechange",s(kr.VolumeChange),i),he("ratechange",s(kr.RateChange),i)];return I(()=>{a.forEach(l=>l())})}function NO({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,i=r.FontFace;r.FontFace=function(l,c,u){let d=new i(l,c,u);return o.set(d,{family:l,buffer:typeof c!="string",descriptors:u,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),d};let s=Ht(t.fonts,"add",function(a){return function(l){return setTimeout(I(()=>{let c=o.get(l);c&&(e(c),o.delete(l))}),0),a.apply(this,[l])}});return n.push(()=>{r.FontFace=i}),n.push(s),I(()=>{n.forEach(a=>a())})}function FO(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:i}=e,s=!0,a=I(()=>{let l=t.getSelection();if(!l||s&&l?.isCollapsed)return;s=l.isCollapsed||!1;let c=[],u=l.rangeCount||0;for(let d=0;d<u;d++){let p=l.getRangeAt(d),{startContainer:y,startOffset:h,endContainer:f,endOffset:m}=p;me(y,n,o,!0)||me(f,n,o,!0)||c.push({start:r.getId(y),startOffset:h,end:r.getId(f),endOffset:m})}i({ranges:c})});return a(),he("selectionchange",a)}function $O({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:Ht(r.customElements,"define",function(o){return function(i,s,a){try{t({define:{name:i}})}catch{console.warn(`Custom element callback failed for ${i}`)}return o.apply(this,[i,s,a])}})}function DO(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:s,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:u,canvasMutationCb:d,fontCb:p,selectionCb:y,customElementCb:h}=e;e.mutationCb=(...f)=>{t.mutation&&t.mutation(...f),r(...f)},e.mousemoveCb=(...f)=>{t.mousemove&&t.mousemove(...f),n(...f)},e.mouseInteractionCb=(...f)=>{t.mouseInteraction&&t.mouseInteraction(...f),o(...f)},e.scrollCb=(...f)=>{t.scroll&&t.scroll(...f),i(...f)},e.viewportResizeCb=(...f)=>{t.viewportResize&&t.viewportResize(...f),s(...f)},e.inputCb=(...f)=>{t.input&&t.input(...f),a(...f)},e.mediaInteractionCb=(...f)=>{t.mediaInteaction&&t.mediaInteaction(...f),l(...f)},e.styleSheetRuleCb=(...f)=>{t.styleSheetRule&&t.styleSheetRule(...f),c(...f)},e.styleDeclarationCb=(...f)=>{t.styleDeclaration&&t.styleDeclaration(...f),u(...f)},e.canvasMutationCb=(...f)=>{t.canvasMutation&&t.canvasMutation(...f),d(...f)},e.fontCb=(...f)=>{t.font&&t.font(...f),p(...f)},e.selectionCb=(...f)=>{t.selection&&t.selection(...f),y(...f)},e.customElementCb=(...f)=>{t.customElement&&t.customElement(...f),h(...f)}}function _O(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};DO(e,t);let n;e.recordDOM&&(n=hy(e,e.doc));let o=EO(e),i=PO(e),s=my(e),a=AO(e,{win:r}),l=OO(e),c=LO(e),u=()=>{},d=()=>{},p=()=>{},y=()=>{};e.recordDOM&&(u=IO(e,{win:r}),d=yy(e,e.doc),p=TO(e,{win:r}),e.collectFonts&&(y=NO(e)));let h=FO(e),f=$O(e),m=[];for(let v of e.plugins)m.push(v.observer(v.callback,r,v.options));return I(()=>{zt.forEach(v=>v.reset()),n?.disconnect(),o(),i(),s(),a(),l(),c(),u(),d(),p(),y(),h(),f(),m.forEach(v=>v())})}function Li(e){return typeof window[e]<"u"}function Ni(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var rs=class{constructor(t){S(this,"iframeIdToRemoteIdMap",new WeakMap),S(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,o){let i=n||this.getIdToRemoteIdMap(t),s=o||this.getRemoteIdToIdMap(t),a=i.get(r);return a||(a=this.generateIdFn(),i.set(r,a),s.set(a,r)),a}getIds(t,r){let n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(i=>this.getId(t,i,n,o))}getRemoteId(t,r,n){let o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let i=o.get(r);return i||-1}getRemoteIds(t,r){let n=this.getRemoteIdToIdMap(t);return r.map(o=>this.getRemoteId(t,o,n))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let r=this.iframeIdToRemoteIdMap.get(t);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(t,r)),r}getRemoteIdToIdMap(t){let r=this.iframeRemoteIdToIdMap.get(t);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(t,r)),r}},Yl=class{constructor(t){S(this,"iframes",new WeakMap),S(this,"crossOriginIframeMap",new WeakMap),S(this,"crossOriginIframeMirror",new rs(Oh)),S(this,"crossOriginIframeStyleMirror"),S(this,"crossOriginIframeRootIdMap",new WeakMap),S(this,"mirror"),S(this,"mutationCb"),S(this,"wrappedEmit"),S(this,"loadListener"),S(this,"stylesheetManager"),S(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new rs(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,r){var n,o;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.recordCrossOriginIframes&&((n=t.contentWindow)==null||n.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){let r=t;if(r.data.type!=="rrweb"||r.origin!==r.data.origin||!t.source)return;let o=this.crossOriginIframeMap.get(t.source);if(!o)return;let i=this.transformCrossOriginEvent(o,r.data.event);i&&this.wrappedEmit(i,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case O.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(r.data.node,t);let o=r.data.node.id;return this.crossOriginIframeRootIdMap.set(t,o),this.patchRootIdOnNode(r.data.node,o),{timestamp:r.timestamp,type:O.IncrementalSnapshot,data:{source:E.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case O.Meta:case O.Load:case O.DomContentLoaded:return!1;case O.Plugin:return r;case O.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case O.IncrementalSnapshot:switch(r.data.source){case E.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(o.node,i)}),r.data.removes.forEach(o=>{this.replaceIds(o,t,["parentId","id"])}),r.data.attributes.forEach(o=>{this.replaceIds(o,t,["id"])}),r.data.texts.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case E.Drag:case E.TouchMove:case E.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case E.ViewportResize:return!1;case E.MediaInteraction:case E.MouseInteraction:case E.Scroll:case E.CanvasMutation:case E.Input:return this.replaceIds(r.data,t,["id"]),r;case E.StyleSheetRule:case E.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case E.Font:return r;case E.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case E.AdoptedStyleSheet:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleIds"]),(n=r.data.styles)==null||n.forEach(o=>{this.replaceStyleIds(o,t,["styleId"])}),r}}return!1}replace(t,r,n,o){for(let i of o)!Array.isArray(r[i])&&typeof r[i]!="number"||(Array.isArray(r[i])?r[i]=t.getIds(n,r[i]):r[i]=t.getId(n,r[i]));return r}replaceIds(t,r,n){return this.replace(this.crossOriginIframeMirror,t,r,n)}replaceStyleIds(t,r,n){return this.replace(this.crossOriginIframeStyleMirror,t,r,n)}replaceIdOnNode(t,r){this.replaceIds(t,r,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(n=>{this.replaceIdOnNode(n,r)})}patchRootIdOnNode(t,r){t.type!==py.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},Zl=class{constructor(t){S(this,"shadowDoms",new WeakSet),S(this,"mutationCb"),S(this,"scrollCb"),S(this,"bypassOptions"),S(this,"mirror"),S(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,r){if(!xn(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=hy({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(my({...this.bypassOptions,scrollCb:this.scrollCb,doc:t,mirror:this.mirror})),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(C.host(t))),this.restoreHandlers.push(yy({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,r){let n=this;this.restoreHandlers.push(Ht(t.prototype,"attachShadow",function(o){return function(i){let s=o.call(this,i),a=C.shadowRoot(this);return a&&dy(this)&&n.addShadowRoot(a,r),s}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},Pr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",BO=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(Rn=0;Rn<Pr.length;Rn++)BO[Pr.charCodeAt(Rn)]=Rn;var Rn,jO=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=Pr[t[r]>>2],o+=Pr[(t[r]&3)<<4|t[r+1]>>4],o+=Pr[(t[r+1]&15)<<2|t[r+2]>>6],o+=Pr[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o};var Rh=new Map;function VO(e,t){let r=Rh.get(e);return r||(r=new Map,Rh.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var gy=(e,t,r)=>{if(!e||!(by(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=VO(r,n),i=o.indexOf(e);return i===-1&&(i=o.length,o.push(e)),i};function Bi(e,t,r){if(e instanceof Array)return e.map(n=>Bi(n,t,r));if(e===null)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){let n=e.constructor.name,o=jO(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Bi(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else if(e instanceof HTMLCanvasElement){let n="HTMLImageElement",o=e.toDataURL();return{rr_type:n,src:o}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Bi(e.data,t,r),e.width,e.height]};if(by(e,t)||typeof e=="object"){let n=e.constructor.name,o=gy(e,t,r);return{rr_type:n,index:o}}}}return e}var Sy=(e,t,r)=>e.map(n=>Bi(n,t,r)),by=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(o=>typeof t[o]=="function").find(o=>e instanceof t[o]);function WO(e,t,r,n){let o=[],i=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let s of i)try{if(typeof t.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Ht(t.CanvasRenderingContext2D.prototype,s,function(l){return function(...c){return me(this.canvas,r,n,!0)||setTimeout(()=>{let u=Sy(c,t,this);e(this.canvas,{type:Nr["2D"],property:s,args:u})},0),l.apply(this,c)}});o.push(a)}catch{let a=hs(t.CanvasRenderingContext2D.prototype,s,{set(l){e(this.canvas,{type:Nr["2D"],property:s,args:[l],setter:!0})}});o.push(a)}return()=>{o.forEach(s=>s())}}function UO(e){return e==="experimental-webgl"?"webgl":e}function vh(e,t,r,n){let o=[];try{let i=Ht(e.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...l){if(!me(this,t,r,!0)){let c=UO(a);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(l[0]&&typeof l[0]=="object"){let u=l[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...l])}});o.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(i=>i())}}function xh(e,t,r,n,o,i){let s=[],a=Object.getOwnPropertyNames(e);for(let l of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let c=Ht(e,l,function(u){return function(...d){let p=u.apply(this,d);if(gy(p,i,this),"tagName"in this.canvas&&!me(this.canvas,n,o,!0)){let y=Sy(d,i,this),h={type:t,property:l,args:y};r(this.canvas,h)}return p}});s.push(c)}catch{let c=hs(e,l,{set(u){r(this.canvas,{type:t,property:l,args:[u],setter:!0})}});s.push(c)}return s}function zO(e,t,r,n){let o=[];return o.push(...xh(t.WebGLRenderingContext.prototype,Nr.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...xh(t.WebGL2RenderingContext.prototype,Nr.WebGL2,e,r,n,t)),()=>{o.forEach(i=>i())}}var wy="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",GO=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),kh=typeof window<"u"&&window.Blob&&new Blob([GO(wy)],{type:"text/javascript;charset=utf-8"});function KO(e){let t;try{if(t=kh&&(window.URL||window.webkitURL).createObjectURL(kh),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(window.URL||window.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;base64,"+wy,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var Jl=class{constructor(t){S(this,"pendingCanvasMutations",new Map),S(this,"rafStamps",{latestId:0,invokeId:null}),S(this,"mirror"),S(this,"mutationCb"),S(this,"resetObservers"),S(this,"frozen",!1),S(this,"locked",!1),S(this,"processMutation",(l,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(c)});let{sampling:r="all",win:n,blockClass:o,blockSelector:i,recordCanvas:s,dataURLOptions:a}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,s&&r==="all"&&this.initCanvasMutationObserver(n,o,i),s&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,i,{dataURLOptions:a})}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(t,r,n,o,i){let s=vh(r,n,o,!0),a=new Map,l=new KO;l.onmessage=h=>{let{id:f}=h.data;if(a.set(f,!1),!("base64"in h.data))return;let{base64:m,type:v,width:w,height:g}=h.data;this.mutationCb({id:f,type:Nr["2D"],commands:[{property:"clearRect",args:[0,0,w,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:m}],type:v}]},0,0]}]})};let c=1e3/t,u=0,d,p=()=>{let h=[];return r.document.querySelectorAll("canvas").forEach(f=>{me(f,n,o,!0)||h.push(f)}),h},y=h=>{if(u&&h-u<c){d=requestAnimationFrame(y);return}u=h,p().forEach(async f=>{var m;let v=this.mirror.getId(f);if(a.get(v)||f.width===0||f.height===0)return;if(a.set(v,!0),["webgl","webgl2"].includes(f.__context)){let g=f.getContext(f.__context);((m=g?.getContextAttributes())==null?void 0:m.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}let w=await createImageBitmap(f);l.postMessage({id:v,bitmap:w,width:f.width,height:f.height,dataURLOptions:i.dataURLOptions},[w])}),d=requestAnimationFrame(y)};d=requestAnimationFrame(y),this.resetObservers=()=>{s(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=vh(t,r,n,!1),i=WO(this.processMutation.bind(this),t,r,n),s=zO(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{o(),i(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{let n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;let n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;let o=n.map(s=>{let{type:a,...l}=s;return l}),{type:i}=n[0];this.mutationCb({id:r,type:i,commands:o}),this.pendingCanvasMutations.delete(t)}},Xl=class{constructor(t){S(this,"trackedLinkElements",new WeakSet),S(this,"mutationCb"),S(this,"adoptedStyleSheetCb"),S(this,"styleMirror",new Gl),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;let n={id:r,styleIds:[]},o=[];for(let i of t){let s;this.styleMirror.has(i)?s=this.styleMirror.getId(i):(s=this.styleMirror.add(i),o.push({styleId:s,rules:Array.from(i.rules||CSSRule,(a,l)=>({rule:Ah(a,i.href),index:l}))})),n.styleIds.push(s)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},Ql=class{constructor(){S(this,"nodeMap",new WeakMap),S(this,"active",!1)}inOtherBuffer(t,r){let n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}destroy(){}},X,ji,ul,ns=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((Ef=e.contentWindow)==null?void 0:Ef.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var je=YC();function Yt(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:i=null,ignoreClass:s="rr-ignore",ignoreSelector:a=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:u=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:y,maskInputFn:h,maskTextFn:f,hooks:m,packFn:v,sampling:w={},dataURLOptions:g={},mousemoveWait:k,recordDOM:_=!0,recordCanvas:V=!1,recordCrossOriginIframes:te=!1,recordAfter:G=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:Q=!1,collectFonts:le=!1,inlineImages:Me=!1,plugins:ze,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:Dr=new Set([]),errorHandler:_r}=e;kO(_r);let re=te?window.parent===window:!0,Oe=!1;if(!re)try{window.parent.document&&(Oe=!1)}catch{Oe=!0}if(re&&!t)throw new Error("emit function is required");if(!re&&!Oe)return()=>{};k!==void 0&&w.mousemove===void 0&&(w.mousemove=k),je.reset();let Ct=d===!0?{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}:p!==void 0?p:{password:!0},Ge=Nh(y);bO();let Pc,ms=0,Ac=L=>{for(let Ne of ze||[])Ne.eventProcessor&&(L=Ne.eventProcessor(L));return v&&!Oe&&(L=v(L)),L};X=(L,Ne)=>{var Y;let Z=L;if(Z.timestamp=es(),(Y=zt[0])!=null&&Y.isFrozen()&&Z.type!==O.FullSnapshot&&!(Z.type===O.IncrementalSnapshot&&Z.data.source===E.Mutation)&&zt.forEach(Re=>Re.unfreeze()),re)t?.(Ac(Z),Ne);else if(Oe){let Re={type:"rrweb",event:Ac(Z),origin:window.location.origin,isCheckout:Ne};window.parent.postMessage(Re,"*")}if(Z.type===O.FullSnapshot)Pc=Z,ms=0;else if(Z.type===O.IncrementalSnapshot){if(Z.data.source===E.Mutation&&Z.data.isAttachIframe)return;ms++;let Re=n&&ms>=n,B=r&&Z.timestamp-Pc.timestamp>r;(Re||B)&&ji(!0)}};let Wn=L=>{X({type:O.IncrementalSnapshot,data:{source:E.Mutation,...L}})},Mc=L=>X({type:O.IncrementalSnapshot,data:{source:E.Scroll,...L}}),Oc=L=>X({type:O.IncrementalSnapshot,data:{source:E.CanvasMutation,...L}}),_y=L=>X({type:O.IncrementalSnapshot,data:{source:E.AdoptedStyleSheet,...L}}),Et=new Xl({mutationCb:Wn,adoptedStyleSheetCb:_y}),Pt=new Yl({mirror:je,mutationCb:Wn,stylesheetManager:Et,recordCrossOriginIframes:te,wrappedEmit:X});for(let L of ze||[])L.getMirror&&L.getMirror({nodeMirror:je,crossOriginIframeMirror:Pt.crossOriginIframeMirror,crossOriginIframeStyleMirror:Pt.crossOriginIframeStyleMirror});let ys=new Ql;ul=new Jl({recordCanvas:V,mutationCb:Oc,win:window,blockClass:o,blockSelector:i,mirror:je,sampling:w.canvas,dataURLOptions:g});let Un=new Zl({mutationCb:Wn,scrollCb:Mc,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskInputOptions:Ct,dataURLOptions:g,maskTextFn:f,maskInputFn:h,recordCanvas:V,inlineImages:Me,sampling:w,slimDOMOptions:Ge,iframeManager:Pt,stylesheetManager:Et,canvasManager:ul,keepIframeSrcFn:T,processedNodeManager:ys},mirror:je});ji=(L=!1)=>{if(!_)return;X({type:O.Meta,data:{href:window.location.href,width:iy(),height:oy()}},L),Et.reset(),Un.init(),zt.forEach(Y=>Y.lock());let Ne=bE(document,{mirror:je,blockClass:o,blockSelector:i,maskTextClass:l,maskTextSelector:c,inlineStylesheet:u,maskAllInputs:Ct,maskTextFn:f,maskInputFn:h,slimDOM:Ge,dataURLOptions:g,recordCanvas:V,inlineImages:Me,onSerialize:Y=>{ly(Y,je)&&Pt.addIframe(Y),cy(Y,je)&&Et.trackLinkElement(Y),zl(Y)&&Un.addShadowRoot(C.shadowRoot(Y),document)},onIframeLoad:(Y,Z)=>{Pt.attachIframe(Y,Z),Un.observeAttachShadow(Y)},onStylesheetLoad:(Y,Z)=>{Et.attachLinkElement(Y,Z)},keepIframeSrcFn:T});if(!Ne)return console.warn("Failed to snapshot the document");X({type:O.FullSnapshot,data:{node:Ne,initialOffset:ny(window)}},L),zt.forEach(Y=>Y.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Et.adoptStyleSheets(document.adoptedStyleSheets,je.getId(document))};try{let L=[],Ne=Z=>{var Re;return I(_O)({mutationCb:Wn,mousemoveCb:(B,gs)=>X({type:O.IncrementalSnapshot,data:{source:gs,positions:B}}),mouseInteractionCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.MouseInteraction,...B}}),scrollCb:Mc,viewportResizeCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.ViewportResize,...B}}),inputCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.Input,...B}}),mediaInteractionCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.MediaInteraction,...B}}),styleSheetRuleCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.StyleSheetRule,...B}}),styleDeclarationCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.StyleDeclaration,...B}}),canvasMutationCb:Oc,fontCb:B=>X({type:O.IncrementalSnapshot,data:{source:E.Font,...B}}),selectionCb:B=>{X({type:O.IncrementalSnapshot,data:{source:E.Selection,...B}})},customElementCb:B=>{X({type:O.IncrementalSnapshot,data:{source:E.CustomElement,...B}})},blockClass:o,ignoreClass:s,ignoreSelector:a,maskTextClass:l,maskTextSelector:c,maskInputOptions:Ct,inlineStylesheet:u,sampling:w,recordDOM:_,recordCanvas:V,inlineImages:Me,userTriggeredOnInput:Q,collectFonts:le,doc:Z,maskInputFn:h,maskTextFn:f,keepIframeSrcFn:T,blockSelector:i,slimDOMOptions:Ge,dataURLOptions:g,mirror:je,iframeManager:Pt,stylesheetManager:Et,shadowDomManager:Un,processedNodeManager:ys,canvasManager:ul,ignoreCSSAttributes:Dr,plugins:((Re=ze?.filter(B=>B.observer))==null?void 0:Re.map(B=>({observer:B.observer,options:B.options,callback:gs=>X({type:O.Plugin,data:{plugin:B.name,payload:gs}})})))||[]},m)};Pt.addLoadListener(Z=>{try{L.push(Ne(Z.contentDocument))}catch(Re){console.warn(Re)}});let Y=()=>{ji(),L.push(Ne(document)),ns=!0};return["interactive","complete"].includes(document.readyState)?Y():(L.push(he("DOMContentLoaded",()=>{X({type:O.DomContentLoaded,data:{}}),G==="DOMContentLoaded"&&Y()})),L.push(he("load",()=>{X({type:O.Load,data:{}}),G==="load"&&Y()},window))),()=>{L.forEach(Z=>{try{Z()}catch(Re){String(Re).toLowerCase().includes("cross-origin")||console.warn(Re)}}),ys.destroy(),ns=!1,CO()}}catch(L){console.warn(L)}}Yt.addCustomEvent=(e,t)=>{if(!ns)throw new Error("please add custom event after start recording");X({type:O.Custom,data:{tag:e,payload:t}})};Yt.freezePage=()=>{zt.forEach(e=>e.freeze())};Yt.takeFullSnapshot=e=>{if(!ns)throw new Error("please take full snapshot after start recording");ji(e)};Yt.mirror=je;var Ch;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Ch||(Ch={}));var yB=5*1e3;var{addCustomEvent:gB}=Yt,{freezePage:SB}=Yt,{takeFullSnapshot:bB}=Yt;var vy="__ripploEmitRrwebEvent";function xy(){return{eventTypes:Ry(O),incrementalSources:Ry(E)}}function Ry(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var ky=Za(Ya("@ripplo/rrweb-bundle/bundle","rrweb.js"));async function jn({clientVersion:e,debugDir:t,writeOtlpPortFile:r}){let n=new Map,o=kf(xy()),i=await Ta({localDir:Cy.join(Cy.dirname(t),".local"),writePortFile:r,onRrwebBatch:(l,c)=>{n.get(l)?.emitRrwebBatch(c)},onSpan:l=>{let c=l.attributes["ripplo.run"];c!=null&&n.get(c)?.emit(l)}}),s=await ky();return{attach:async(l,c)=>{let u=xf({debugDir:t,runId:c,worker:o});u.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),n.set(c,u),await Cf(l,c),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(i.port)};`),await HO(l,u),await JO(l,u);let d=[];return{emitAction:p=>{eI(u,p)},emitStepOutcome:p=>{tI(u,p)},finish:()=>XO(u,{pages:d,registry:n,runId:c}),onPage:p=>{d.push(p),QO(u,s,p)}}},debugDir:t,close:async()=>{await i.stop(),await o.terminate()},injectSpan:(l,c)=>{n.get(l)?.emit(c)}}}async function qO(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function HO(e,t){await e.exposeBinding(vy,(r,n)=>{let o=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(o,"utf8"))})}var YO="__ripploEventPush",ZO=Ue.discriminatedUnion("kind",[Ue.object({kind:Ue.literal("console"),level:Ue.string(),text:Ue.string(),timestamp:Ue.number()}),Ue.object({kind:Ue.literal("error"),message:Ue.string(),stack:Ue.string().optional(),timestamp:Ue.number()})]);async function JO(e,t){await e.exposeBinding(YO,(r,n)=>{let o=ZO.safeParse(n);if(!o.success)return;let i=o.data;if(i.kind==="console"){t.emit({kind:"console",level:i.level,source:"browser",text:i.text,timeNanos:Ut(i.timestamp)});return}t.emit({kind:"error",message:i.message,source:"browser",stack:i.stack,timeNanos:Ut(i.timestamp)})})}async function XO(e,t){await qO(t.pages),t.registry.delete(t.runId),await e.close({noticeIfNoRrweb:"rrweb capture unavailable: recorder never pushed an event \u2014 page never loaded the recorder (blank page, failed navigation, or CSP block)"})}function QO(e,t,r){r.on("load",()=>{r.addScriptTag({content:t}).catch(()=>{})}),r.on("requestfinished",n=>{aI(e,n).catch(()=>{})}),r.url()!=="about:blank"&&r.addScriptTag({content:t}).catch(()=>{})}function eI(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:oI(t),timeNanos:Ut(Date.now()),value:iI(t)})}function tI(e,t){t.checks.forEach(r=>{e.emit(rI(r,t.stepIndex))}),t.stepError!=null&&e.emit(nI(t.stepError,t.stepIndex))}function rI(e,t){return{...e.body,kind:"check",origin:Bo(e.target,t),source:"verifier",stepIndex:t,timeNanos:Ut(e.atMs)}}function nI(e,t){return{error:e.error,kind:"stepError",source:"verifier",stepIndex:t,timeNanos:Ut(e.atMs)}}function oI(e){if(e.url!=null)return e.url;if(e.locator!=null)return Kn(e.locator)}function iI(e){return e.value!=null?typeof e.value=="object"?JSON.stringify(e.value):String(e.value):e.key}var sI=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;async function aI(e,t){if(sI.test(t.url()))return;let r=await t.response();if(r==null)return;let n=t.resourceType(),o=n==="fetch"||n==="xhr",i=t.timing(),s=t.headers().traceparent?.split("-"),a=i.startTime;e.emit({durationMs:Math.max(0,i.responseEnd),kind:"network",method:t.method(),requestBody:o?t.postData()??void 0:void 0,resourceType:n,responseBody:o?await lI(r):void 0,source:"browser",spanId:s?.[2],status:r.status(),timeNanos:Ut(a>0?a:Date.now()),traceId:s?.[1],url:r.url()})}async function lI(e){try{return await e.text()}catch{return}}function Vn(e){return{aborted:!0,contradictions:[],failed:!1,findings:[],ran:[],teardown:e}}function kc(e,t){return new xc(wI(e,t))}function dI(e,t){return new xc(pI(e,t))}async function pI(e,t){let r=await yf(e.profileDir).catch(()=>{});if(r==null)return Zt(Ke(new Error("launch")));try{return Fr(await fI({context:r,params:e,signal:t}))}catch(n){return Zt(Ke(n))}finally{await r.close().catch(ke)}}async function fI({context:e,params:t,signal:r}){let n=e.pages()[0]??await e.newPage(),o=await jn({clientVersion:t.clientVersion,debugDir:t.debugDir,writeOtlpPortFile:!0}),i=await o.attach(e,t.runId);return i.onPage(n),e.on("page",s=>{i.onPage(s)}),await n.goto(t.startUrl).catch(ke),t.onReady(),await hI(e,r),await i.finish(),await o.close(),{behaviorPath:cI.join(t.debugDir,t.runId,"behavior.jsonl")}}function hI(e,t){return new Promise(r=>{let n=()=>{r()};t.addEventListener("abort",n,{once:!0}),e.on("close",n),e.browser()?.on("disconnected",n),e.on("page",o=>o.on("close",n)),e.pages().forEach(o=>o.on("close",n))})}function mI(e,t){return new xc(yI(e,t))}async function yI(e,t){let r=gI(e),n=My({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),o=async i=>{try{return Fr(await SI({established:i,params:e,signal:t}))}catch(s){return await i.teardown().match(ke,ke),Zt(Xn(s)?s:Ke(s))}};return Ay(n,r).match(o,async i=>(await Cc(n.teardown),Zt(i)))}function gI(e){return{capture:!1,lockfile:e.lockfile,onEvent:void 0,onPhase:void 0,options:e.options,params:void 0,runId:e.runId,sequence:e.sequence,test:e.test}}async function SI({established:e,params:t,signal:r}){let n=di({cacheDir:void 0,headed:!0}),o=await n.acquire(),{result:i,session:s}=await Py({browser:o,capture:null,established:e,lockfile:t.lockfile,onEvent:void 0,onPhase:void 0,options:t.options,sequence:t.sequence,signal:r,stopAfterStep:t.stopAfterStep,test:t.test,viewport:null});return i.failed?(await s.close().catch(ke),await e.teardown().match(ke,ke),await n.close(),{contradictions:i.contradictions,kind:"failed"}):(t.onReady(),await bI(o,s.context),await e.teardown().match(ke,ke),await n.close(),{kind:"handed-over",ran:i.ran.length})}function bI(e,t){return new Promise(r=>{let n=()=>{r()};e.on("disconnected",n),t.on("close",n),t.on("page",o=>o.on("close",n)),t.pages().forEach(o=>o.on("close",n))})}async function wI({browser:e,hub:t,request:r},n){if(n.aborted)return Fr(Vn("skipped"));let o=My({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),i=async s=>{try{return await vI({browser:e,established:s,hub:t,request:r,signal:n})}catch(a){return Zt(Xn(a)?a:Ke(a))}};return Ay(o,r).match(i,s=>RI(s,o.teardown))}async function RI(e,t){return e.kind!=="aborted"?Zt(e):Fr(Vn(await Cc(t)))}function Cc(e){return e().match(()=>"done",()=>"failed")}async function vI(e){let t=await xI(e);if(t.kind==="completed"){let n=Date.now();return e.established.teardown().match(()=>(e.request.onPhase?.("teardown",Date.now()-n),Fr({aborted:!1,...t.result})),o=>Zt(o))}let r=await Cc(e.established.teardown);if(t.kind==="aborted")return Fr(Vn(r));throw t.error}function Ey(e,t,r){return Qr(e,t).map(n=>({params:{...ti(n),...r},transition:n}))}async function Py(e){let{established:t,lockfile:r,signal:n}=e,o=Date.now(),i=await Wa({baseUrl:e.options.baseUrl,browser:e.browser,capture:e.capture,clientState:t.clientState,engine:Fa(EI(r)),fixturesDir:e.options.fixturesDir,networkHeaders:void 0,observeActor:t.observeActor,reader:t.reader,session:t.auth,signal:n,signInActor:t.signInActor,viewport:e.viewport});e.onPhase?.("browser",Date.now()-o);try{let s=ar(r),a=Date.now(),l=await Qo({canon:Wo(r),classify:Vo(r),dataRules:s.dataRules,driver:i.driver,facts:{facts:Ys(s.facts,ee(e.test)),overlays:Qe(r),overrides:s.overrides},initialState:{snapshot:t.snapshot},sequence:e.sequence,stopAfterStep:e.stopAfterStep,onEvent:c=>{c.kind==="step"&&i.emitStepOutcome({checks:c.checks,stepError:c.stepError,stepIndex:c.index}),e.onEvent?.(c)}},n);return e.onPhase?.("drive",Date.now()-a),{result:l,session:i}}catch(s){throw await i.close().catch(ke),s}}async function xI({browser:e,established:t,hub:r,request:n,signal:o}){try{be(o),n.onEvent?.({aliases:t.aliases,generated:t.generated,generatedSingletons:t.generatedSingletons,kind:"world"});let{result:i,session:s}=await Py({browser:e,capture:n.capture?{hub:r,runId:n.runId}:null,established:t,lockfile:n.lockfile,onEvent:n.onEvent,onPhase:n.onPhase,options:n.options,sequence:n.sequence??Ey(n.lockfile,n.test,n.params),signal:o,stopAfterStep:void 0,test:n.test,viewport:mf(n.test.viewport)});return await s.close(),{kind:"completed",result:i}}catch(i){return un(i)?{kind:"aborted"}:{error:i,kind:"threw"}}}function Ay(e,t){let r=Date.now();return e.ready().andThen(()=>{t.onPhase?.("engine",Date.now()-r);let n=Date.now();return fr(t.lockfile,t.test,{generate:Gn(zn(t.options.generate,t.runId),new Date().toISOString()),materialize:e.materialize,params:t.params,signIn:e.signIn}).map(o=>(t.onPhase?.("world",Date.now()-n),{aliases:o.aliases,auth:o.auth,clientState:o.clientState,generated:o.generated,generatedSingletons:o.generatedSingletons,observeActor:o.principals.size>0,reader:e.reader,signInActor:kI(e.signIn,o.principals),snapshot:o.snapshot,teardown:e.teardown}))})}function kI(e,t){return r=>{let n=t.get(r);return n==null?uI(Ke(new Error(`no seeded principal for actor "${r}"`))):e({entity:n.entity,row:n.row})}}function My({lockfile:e,options:t,runId:r,signal:n}){let o=Ha({baseUrl:t.engineUrl,extraHeaders:void 0,runId:r,secret:t.secret},n);return{materialize:Ho(o.setupWorld),reader:Ka(e.entities,CI(e),o.query),ready:o.ready,signIn:o.signIn,teardown:o.teardown}}function CI(e){return e.singletons.filter(t=>t.source==="backend").map(t=>t.name)}function EI(e){return e.singletons.filter(t=>t.source==="client").map(t=>t.name)}import{err as PI,ok as AI,ResultAsync as MI}from"neverthrow";function OI({cacheDir:e,clientVersion:t,debugDir:r,headed:n,writeOtlpPortFile:o}){let i=di({cacheDir:e,headed:n}),s,a,l=async()=>(s??=jn({clientVersion:t,debugDir:r,writeOtlpPortFile:o}),a=await s,a),c=async(p,y)=>{if(y.aborted)return AI(Vn("skipped"));try{let h=await l();if(p.options.headed&&!n)return await Ua(!0,async m=>kc({browser:m,hub:h,request:p},y));let f=await i.acquire();return await kc({browser:f,hub:h,request:p},y)}catch(h){return PI(Ke(h))}};return{close:async()=>{await i.close();let p=s;s=void 0,a=void 0,p!=null&&await p.then(y=>y.close()).catch(()=>{})},prewarm:async()=>{await l(),await i.acquire()},injectSpan:(p,y)=>{a?.injectSpan(p,y)},runOnce:(p,y)=>new MI(c(p,y))}}import{z as P}from"zod";function II(e){let t=e.split(`
|
|
65
|
-
`).map(o=>qI(o)).filter(o=>o!=null),r=VI(t),n=t.map(o=>FI(o,r)).filter(o=>o!=null).filter(o=>o.kind==="input"||o.element!=null);return TI(n)}function TI(e){return e.filter((t,r)=>{let n=e[r+1];return!(t.kind==="input"&&n?.kind==="input"&&LI(t.element,n.element))})}function LI(e,t){return e?.testId===t?.testId&&e?.ariaLabel===t?.ariaLabel&&e?.placeholder===t?.placeholder}var NI={2:"click",3:"contextmenu",4:"dblclick"};function FI(e,t){return e.rrwebType==="IncrementalSnapshot:MouseInteraction"?$I(e,t):e.rrwebType==="IncrementalSnapshot:Input"?DI(e,t):null}function $I(e,t){let r=QI.safeParse(e.event.data);if(!r.success)return null;let n=NI[r.data.type];if(n==null)return null;let o=Oy(r.data.id,t.nodes);return{element:Iy(o,t),kind:n,timeNanos:e.timeNanos,value:void 0}}function DI(e,t){let r=eT.safeParse(e.event.data);return r.success?{element:Iy(r.data.id,t),kind:"input",timeNanos:e.timeNanos,value:r.data.text??_I(r.data.isChecked)}:null}function _I(e){return e==null?void 0:String(e)}var BI=new Set(["button","a","input","select","textarea","summary"]);function Oy(e,t){let r=t.get(e);if(r!=null)return jI(r)?e:r.parentId==null?void 0:Oy(r.parentId,t)}function jI(e){return e.attrs["data-testid"]!=null||e.attrs["aria-label"]!=null||e.attrs.role!=null||BI.has(e.tag??"")}function Iy(e,t){let r=e==null?void 0:t.nodes.get(e);if(!(r==null||e==null))return{ariaLabel:$r(r,"aria-label"),href:$r(r,"href"),name:$r(r,"name"),placeholder:$r(r,"placeholder"),role:$r(r,"role"),tag:r.tag,testId:$r(r,"data-testid"),text:Ty(e,t)}}function $r(e,t){let r=e.attrs[t];return typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):void 0}function Ty(e,t){let r=t.nodes.get(e);if(r==null)return;let n=r.text?.trim()??"",i=(t.children.get(e)??[]).map(a=>Ty(a,t)??""),s=[n,...i].filter(a=>a.length>0).join(" ");return s.length===0?void 0:s.slice(0,100)}function VI(e){let t=e.flatMap(o=>WI(o).flatMap(i=>Ec(i,void 0))),r=e.flatMap(o=>UI(o).flatMap(i=>Ec(i.node,i.parentId??void 0))),n=GI(new Map([...t,...r]),e);return{children:zI(n),nodes:n}}function WI(e){if(e.rrwebType!=="FullSnapshot")return[];let t=ZI.safeParse(e.event.data);return t.success?[t.data.node]:[]}function UI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ly.safeParse(e.event.data);return t.success?t.data.adds.flatMap(r=>{let n=JI.safeParse(r);return n.success?[n.data]:[]}):[]}function zI(e){let t=new Map;return e.forEach((r,n)=>{r.parentId!=null&&t.set(r.parentId,[...t.get(r.parentId)??[],n])}),t}function Ec(e,t){let r=YI.safeParse(e);if(!r.success)return[];let n=r.data,o=n.childNodes??[];return[[n.id,{attrs:{...n.attributes},parentId:t,tag:n.tagName,text:n.textContent}],...o.flatMap(s=>Ec(s,n.id))]}function GI(e,t){return t.flatMap(n=>KI(n)).reduce((n,o)=>{let i=n.get(o.id);return i==null?n:new Map(n).set(o.id,{...i,attrs:{...i.attrs,...o.attributes}})},e)}function KI(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=Ly.safeParse(e.event.data);return t.success?t.data.attributes.flatMap(r=>{let n=XI.safeParse(r);return n.success?[n.data]:[]}):[]}function qI(e){if(e.trim().length===0)return null;let t=tT.safeParse(HI(e));return t.success?t.data:null}function HI(e){try{return JSON.parse(e)}catch{return null}}var YI=P.object({attributes:P.record(P.string(),P.unknown()).optional(),childNodes:P.array(P.unknown()).optional(),id:P.number(),tagName:P.string().optional(),textContent:P.string().optional()}),ZI=P.object({node:P.unknown()}),JI=P.object({node:P.unknown(),parentId:P.number().nullable().default(null)}),XI=P.object({attributes:P.record(P.string(),P.unknown()),id:P.number()}),Ly=P.object({adds:P.array(P.unknown()).default([]),attributes:P.array(P.unknown()).default([])}),QI=P.object({id:P.number(),type:P.number()}),eT=P.object({id:P.number(),isChecked:P.boolean().optional(),text:P.string().optional()}),tT=P.object({event:P.object({data:P.unknown()}),kind:P.literal("rrweb"),rrwebType:P.string(),timeNanos:P.string()});function rT(e){let t=r=>e.find(n=>n.phase===r)?.ms??0;return{browserMs:t("browser"),driveMs:t("drive"),engineMs:t("engine"),teardownMs:t("teardown"),worldMs:t("world")}}async function nT(e,t){let r=await $y({attemptIndex:0,capture:!1,params:e,stepRuns:e.stepRuns},t);if(r.kind!=="completed")return Ny(r);let n=Fy(r.contradictions);if(n!=null)return{error:n,kind:"error"};let o=yr(r.contradictions);if(o.length===0)return{kind:"clean",ranCount:r.ranCount,timing:{confirm:void 0,detect:r.timing}};let i=mn(o);return e.seenSignature!=null&&await e.seenSignature(i.signature)?{kind:"seen",ranCount:r.ranCount,signature:i.signature,timing:{confirm:void 0,detect:r.timing},title:i.title,verifierLayer:i.layer}:oT(e,i,r.timing,t)}function Ny(e){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:e.kind}}function Fy(e){let t=e.find(r=>r.kind==="stepError"&&Qn(r.record.error));return t!=null&&t.kind==="stepError"?t.record.error:void 0}async function oT(e,t,r,n){let o=await $y({attemptIndex:1,capture:!0,params:e,stepRuns:e.stepRuns},n);if(o.kind!=="completed")return Ny(o);let i=Fy(o.contradictions);if(i!=null)return{error:i,kind:"error"};let s={confirm:o.timing,detect:r},a=yr(o.contradictions);return a.length===0||mn(a).signature!==t.signature?{kind:"flaky",ranCount:o.ranCount,timing:s}:{baseState:e.baseState.name,captureEvents:o.events,kind:"finding",ranCount:o.ranCount,runId:o.runId,signature:t.signature,sourceTest:t.sourceTest,timing:s,title:t.title,verifierLayer:t.layer}}async function $y({attemptIndex:e,capture:t,params:r,stepRuns:n},o){let i=r.runIdFor(e),s=[],a=[];return(await r.session.runOnce({capture:t,lockfile:r.lockfile,onEvent:t?c=>{s.push(c)}:void 0,options:r.options,params:void 0,runId:i,sequence:iT(r,n),test:r.baseState.test,onPhase:(c,u)=>{a.push({ms:u,phase:c})}},o)).match(c=>c.aborted?{kind:"aborted"}:{contradictions:c.contradictions,events:s,kind:"completed",ranCount:c.ran.length,runId:i,timing:rT(a)},c=>({error:c,kind:"error"}))}function iT(e,t){return t.map(r=>{let n=e.corpus[r.idx];if(n==null)throw new Error("transition index out of corpus range");return{params:r.params,transition:n}})}async function Dy(e,t){let r=await ai(e);if(r==null)return{kind:"unplannable"};let n=[...r.startingPointTests.values()].find(i=>ee(i)===t.baseStateRef);if(n==null)return{kind:"unplannable"};let o=t.steps.map(i=>{let s=r.corpus.find(a=>a.test===i.test&&a.index===i.index);return s==null?null:{params:i.params,transition:s}});return o.some(i=>i==null)?{kind:"unplannable"}:{baseTest:n,kind:"ok",sequence:o.filter(i=>i!=null)}}async function sT({capture:e,lockfile:t,onEvent:r,options:n,repro:o,runId:i,session:s,signal:a}){let l=await Dy(t,o);return l.kind==="unplannable"?{kind:"unplannable"}:(await s.runOnce({capture:e,lockfile:t,onEvent:r,onPhase:void 0,options:n,params:void 0,runId:i,sequence:l.sequence,test:l.baseTest},a)).match(u=>{if(u.aborted)return{kind:"aborted"};let d=yr(u.contradictions);return d.length>0?{contradictions:d,kind:"still-fails"}:{kind:"resolved"}},u=>({kind:"state-unavailable",reason:u.kind}))}export{ee as a,J as b,Xr as c,Qn as d,iu as e,jr as f,Ie as g,Ud as h,Lo as i,Fo as j,$o as k,Kd as l,ln as m,dt as n,wo as o,Xo as p,Qt as q,bd as r,Po as s,Ad as t,$d as u,_d as v,Ep as w,Pp as x,Mp as y,Op as z,Tp as A,qd as B,Do as C,_o as D,Fp as E,Wp as F,zp as G,Gp as H,Kp as I,Hp as J,Yp as K,ii as L,ai as M,Zp as N,Ya as O,Za as P,Ta as Q,dI as R,mI as S,Ey as T,OI as U,II as V,nT as W,Dy as X,sT as Y};
|
|
66
|
-
/*! Bundled license information:
|
|
67
|
-
|
|
68
|
-
rrweb/dist/rrweb.js:
|
|
69
|
-
(*! *****************************************************************************
|
|
70
|
-
Copyright (c) Microsoft Corporation.
|
|
71
|
-
|
|
72
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
73
|
-
purpose with or without fee is hereby granted.
|
|
74
|
-
|
|
75
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
76
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
77
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
78
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
79
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
80
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
81
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
82
|
-
***************************************************************************** *)
|
|
83
|
-
*/
|