ripplo 0.12.0 → 0.14.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.
Files changed (40) hide show
  1. package/dist/{chunk-3VL4ORWB.js → chunk-3ZQRLG7C.js} +1 -1
  2. package/dist/{chunk-RYR5R3FA.js → chunk-56MARCN3.js} +1 -1
  3. package/dist/{chunk-ZW76MTLE.js → chunk-6JXOIP2T.js} +1 -1
  4. package/dist/{chunk-7JKAV7AT.js → chunk-75T33SK5.js} +1 -1
  5. package/dist/chunk-AVBTPZUU.js +360 -0
  6. package/dist/{chunk-QK7AEQ3B.js → chunk-B5HDXHPI.js} +2 -2
  7. package/dist/{chunk-ORWKDV2H.js → chunk-BQ25IGJS.js} +1 -1
  8. package/dist/{chunk-BTNSUORZ.js → chunk-EOBWMMVC.js} +1 -1
  9. package/dist/{chunk-SVM5ORF6.js → chunk-GTB7NYDE.js} +1 -1
  10. package/dist/{chunk-UAWFWSKD.js → chunk-LEYSGMW2.js} +1 -1
  11. package/dist/{chunk-3FTGPUK3.js → chunk-NIC2DOQW.js} +1 -1
  12. package/dist/{chunk-KAD7UO53.js → chunk-NXKOUVSC.js} +21 -21
  13. package/dist/chunk-PVRM4YWS.js +83 -0
  14. package/dist/{chunk-XBAVNTRQ.js → chunk-PWDBRLJP.js} +1 -1
  15. package/dist/{chunk-2UJUWE7A.js → chunk-Q7FIZGKZ.js} +1 -1
  16. package/dist/{chunk-7GY5ANXL.js → chunk-R3FZ2JEW.js} +1 -1
  17. package/dist/{chunk-6UJNBCPU.js → chunk-U4LFIMDP.js} +1 -1
  18. package/dist/{chunk-JMJXM477.js → chunk-ULIHURY6.js} +1 -1
  19. package/dist/{chunk-77BRFU6M.js → chunk-ZGWV564Y.js} +1 -1
  20. package/dist/{cli-error-PG24CNXE.js → cli-error-N7X2CREI.js} +1 -1
  21. package/dist/{compile-write-LMAPZGYL.js → compile-write-XMVD5PX2.js} +1 -1
  22. package/dist/{daemon-HTI5DVL2.js → daemon-DARMT5AV.js} +1 -1
  23. package/dist/{daemon-SIPLLQJP.js → daemon-ZUDQ7ERI.js} +1 -1
  24. package/dist/{dsl-loader-I6F73IFP.js → dsl-loader-SSXMC5EE.js} +1 -1
  25. package/dist/hook.js +1 -1
  26. package/dist/index.js +180 -180
  27. package/dist/{plan-reminder-MR2UFQZE.js → plan-reminder-K7HOFGJN.js} +1 -1
  28. package/dist/{post-edit-76WC4SU3.js → post-edit-OI6DDU25.js} +1 -1
  29. package/dist/post-edit-analyze-6V5YI3CR.js +4 -0
  30. package/dist/{post-edit-flag-stubs-UJ2SZJVQ.js → post-edit-flag-stubs-IKIH5DAH.js} +1 -1
  31. package/dist/{pre-edit-YGDITCNZ.js → pre-edit-IOWNUOZY.js} +1 -1
  32. package/dist/{pre-edit-watch-gate-4V2KYSIF.js → pre-edit-watch-gate-N7FI5HBA.js} +1 -1
  33. package/dist/{prompt-submit-ARRJRLMC.js → prompt-submit-ZU466ET5.js} +1 -1
  34. package/dist/status-OSHZ3JGU.js +4 -0
  35. package/dist/{stop-enforce-BLX3ZEDG.js → stop-enforce-4UUK36YU.js} +1 -1
  36. package/package.json +4 -4
  37. package/dist/chunk-RJ6MN3PT.js +0 -360
  38. package/dist/chunk-SQ4SBMKG.js +0 -83
  39. package/dist/post-edit-analyze-5F5VSL4T.js +0 -4
  40. package/dist/status-VWZXTEWF.js +0 -4
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire as __ripploCreateRequire } from "node:module";
3
+ const require = globalThis.require ?? __ripploCreateRequire(import.meta.url);
4
+ import{A as Ju,Aa as gp,B as Ar,Ba as ta,C as Gu,Ca as Ws,D as Yu,Da as Sp,E as Jo,Ea as ra,F as Go,Fa as Pr,G as Zu,Ga as Cn,H as Xu,Ha as bp,I as _s,J as Qu,Ja as Rp,K as ep,L as kt,M as tp,N as Yo,O as rp,Oa as vp,P as np,Q as op,R as ap,Ra as At,S as ip,T as sp,Ua as An,Y as lp,a as Du,aa as cp,b as Ne,ba as dp,c as x,ca as Yt,d as $u,da as up,e as Er,ea as pp,f as Vu,fa as fp,g as ju,ga as Zt,h as g,ha as yp,i as _u,ia as Xt,j as Wu,ja as xn,k as En,ka as Ge,l as Gt,m as ct,ma as Zo,n as xr,na as Ct,o as fe,oa as Fe,p as Ho,pa as kn,q as Uu,r as Ko,s as qu,t as kr,u as Cr,ua as Xo,v as dt,va as mp,w as zu,wa as Ye,x as Hu,xa as Qo,y as js,ya as ea,z as Ku,za as hp}from"./chunk-NXKOUVSC.js";import{a as Bu}from"./chunk-NNH3YVVO.js";import{a as Sv,b as Vs}from"./chunk-KMZ3L5YA.js";var yy=Sv((sj,bl)=>{"use strict";var Aa=process||{},py=Aa.argv||[],Ca=Aa.env||{},wx=!(Ca.NO_COLOR||py.includes("--no-color"))&&(!!Ca.FORCE_COLOR||py.includes("--color")||Aa.platform==="win32"||(Aa.stdout||{}).isTTY&&Ca.TERM!=="dumb"||!!Ca.CI),Ex=(e,t,r=e)=>n=>{let o=""+n,a=o.indexOf(t,e.length);return~a?e+xx(o,t,r,a)+t:e+o+t},xx=(e,t,r,n)=>{let o="",a=0;do o+=e.substring(a,n)+r,a=n+t.length,n=e.indexOf(t,a);while(~n);return o+e.substring(a)},fy=(e=wx)=>{let t=e?Ex:()=>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")}};bl.exports=fy();bl.exports.createColors=fy});function Us({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 bv=Us();function qs(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes("\x1B")&&!e.includes("\x9B")?e:e.replace(bv,"")}import{z as F}from"zod";function Hs(e,t,r){return{detail:r,kind:"engine-http",path:e,status:t}}function On(e,t){return{code:Pp(t)??null,kind:"engine-network",message:er(t),path:e}}function Ks(e,t){return{kind:"app-not-ready",readyKey:e,timeoutMs:t}}function A(e,t){return{kind:"engine-decode",message:er(t),path:e}}function he(e){return{kind:"driver-launch",message:er(e)}}function Js({observedMatches:e,source:t,workflowMatches:r}){return{kind:"actor-resolution",observedMatches:e,source:t,workflowMatches:r}}function Or(e){return{kind:"run-failed",message:er(e)}}function Gs(e){return{kind:"model-preparation",message:er(e)}}function Mr({path:e,record:t}){return{kind:"state-effect-reference",path:[...e],record:t}}var zs=class extends Error{kind;reason;stepIndex;test;constructor({reason:t,stepIndex:r,test:n}){super("workflow planning failed"),this.kind="workflow-plan",this.reason=t,this.stepIndex=r,this.test=n}};function Ys(e){return new zs(e)}function Tr(e){return{kind:"page-read",message:er(e)}}function Mn(e){return{kind:"state-mismatch",mismatches:[...e]}}function na(e,t){return{action:e,failure:t,kind:"action-failed"}}function Zs(e){return{kind:"unclassified",message:er(e)}}function Xs(){return{kind:"aborted"}}var Rv=["aborted","action-failed","actor-resolution","page-read","app-not-ready","check-failed","driver-launch","state-effect-reference","run-failed","model-preparation","workflow-plan","engine-decode","engine-http","engine-network","engine-unreachable","state-mismatch"],vv=new Set(Rv);function Tn(e){if(typeof e!="object"||e==null||!("kind"in e))return!1;let{kind:t}=e;return typeof t=="string"&&vv.has(t)}var wv=["actor-resolution","app-not-ready","driver-launch","engine-decode","engine-http","engine-network","engine-unreachable","state-effect-reference"],Cp=new Set(wv);function oa(e){return Cp.has(e.kind)}function Ap(e){return Cp.has(e)}var Ev=new Set([401,403]);function Qs(e){return e.kind==="engine-http"&&Ev.has(e.status)}var wp=300,xv={"no-effect":"the declared state change is not provably different from the current state","required-state-unsatisfied":"the state declared by earlier steps does not satisfy this step's requirements",unresolvable:"the step references a value that has not been created or bound yet"};function Qt(e){switch(e.kind){case"actor-resolution":{let t=xp({count:e.observedMatches,noun:"state row"}),r=xp({count:e.workflowMatches,noun:"workflow record"});return`the signed-in actor from ${e.source} could not be matched to one current workflow record. Ripplo found ${t} and ${r}`}case"engine-http":return Fv(e);case"engine-network":return`engine ${e.path} request failed: ${Ze(e.message)}${Iv(e.code)}${Nv(e.code,e.message)}`;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 could not be used: ${Wv(e.message)}`;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: ${Ze(e.message)} \u2014 check that the Playwright browser is installed and the browser launch configuration is valid`;case"state-effect-reference":return`the declared state change needs ${kv({path:e.path,record:e.record})}, but that value was not available when the action ran`;case"run-failed":return`workflow execution failed unexpectedly: ${Ze(e.message)}`;case"model-preparation":return`the compiled model could not be prepared before the first step: ${Ze(e.message)} \u2014 run npx ripplo compile and retry`;case"workflow-plan":return`workflow planning stopped before step ${String(e.stepIndex+1)} of ${e.test}: ${xv[e.reason]}`;case"page-read":return`reading the page failed: ${Tv(e.message)} \u2014 check the page and browser logs around this step`;case"state-mismatch":return Cv(e.mismatches);case"action-failed":return`action "${e.action}" failed: ${Ep(e.failure)}`;case"check-failed":return`check failed: ${Ep(e.failure)}`;case"aborted":return"run aborted"}}function Ep(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 Ze(e.message)}}function ge(){}function xp({count:e,noun:t}){return`${String(e)} matching ${t}${e===1?"":"s"}`}function kv({path:e,record:t}){if(e.length===0)return t;let r=e.join(".");return t==="$ripplo.params"?`generated step value "${r}"`:`a value from "${t}.${r}"`}function Cv(e){let t=e[0];if(t==null)throw new TypeError("state-mismatch-empty");let r=e.length-1,n=r===0?"":`, plus ${String(r)} more`;return Ze(`${Av(t)}${n}`)}function Av(e){let t=[e.selector.source,...e.selector.path].join(".");return e.kind==="constraint"?Pv({location:t,mismatch:e}):e.kind==="effect"?`state at ${t} did not match the declared change \u2014 expected ${Pt(e.effect)}, observed ${Pn(e.actual)}`:`state at ${t} changed unexpectedly \u2014 before ${Pn(e.before)}, after ${Pn(e.actual)}`}function Pv({location:e,mismatch:t}){let{constraint:r}=t;return r.kind==="equals"?`starting state at ${e} was ${Pn(t.actual)}, expected ${Pt(r.value)}`:r.kind==="absent-path"?`starting state at ${e} was present but should have been absent`:r.kind==="required-record"?`starting state at ${e} did not contain a record matching ${Pt(r.fields)}`:r.kind==="absent-record"?`starting state at ${e} contained a record matching ${Pt(r.fields)}, but it should have been absent`:r.kind==="relation"?`starting state did not satisfy ${r.label}`:Ov({actual:t.actual,expected:r.rows,location:e})}function Ov({actual:e,expected:t,location:r}){let n=Mv(e);return n!=null&&n!==t.length?`starting state at ${r} had ${String(n)} ${kp(n)}, expected exactly ${String(t.length)} ${kp(t.length)}`:`starting state at ${r} had different records than expected \u2014 expected ${Pt(t)}, observed ${Pn(e)}`}function Mv(e){if(!(!e.present||typeof e.value!="object"||e.value==null))return Array.isArray(e.value)?void 0:Object.keys(e.value).length}function kp(e){return e===1?"record":"records"}function Pn(e){return e.present?Pt(e.value):"nothing"}function Ze(e){let t=e.replaceAll(/\s+/gu," ").trim();return t.length<=wp?t:`${t.slice(0,wp)}\u2026 [truncated]`}function Tv(e){let[t]=e.split("Call log:"),r=/^(?<operation>[a-zA-Z]+\.[a-zA-Z]+): (?:Error: )?(?<rest>.+)$/su.exec(t??e),n=r?.groups?.operation,o=r?.groups?.rest;return n==null||o==null?Ze(t??e):`${Ze(o)} (while calling ${n})`}function Iv(e){return e==null?"":` (${e})`}var Lv=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function Nv(e,t){return e!=null&&Lv.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 Fv(e){if(Qs(e))return`the app rejected Ripplo's signed request: ENABLE_RIPPLO_TESTING is not true in the app's env, or RIPPLO_WEBHOOK_SECRET differs between the app and .ripplo env (${String(e.status)} from ${e.path})`;let t=e.detail.trim(),r=t.length===0?"no response body":t;return`engine ${e.path} returned ${String(e.status)}: ${r}${Bv(e.status)}`}function Bv(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. `npx ripplo doctor` checks the endpoint.":e===405?" \u2014 the route exists but rejects the request method. Ripplo calls engine routes with PUT, so the handler must accept PUT. In Next.js export the handler as `export const PUT`.":""}function Pp(e){if(!(typeof e!="object"||e==null))return"code"in e&&typeof e.code=="string"?e.code:"cause"in e?Pp(e.cause):void 0}function er(e){let t=e instanceof Error?e.message:Pt(e);return qs(t)}function Pt(e){if(typeof e=="string"||e===void 0||typeof e=="function"||typeof e=="symbol")return String(e);if(typeof e=="bigint")return e.toString();try{return JSON.stringify(e)}catch{return"unserializable diagnostic value"}}var Dv=F.discriminatedUnion("issue",[F.object({issue:F.literal("unresolved-optional")}).strict(),F.object({issue:F.literal("duplicate-operation")}).strict(),F.object({dependency:F.string(),issue:F.literal("browser-http-dependency"),operation:F.string()}).strict(),F.object({issue:F.literal("cyclic-operations"),operations:F.array(F.string())}).strict(),F.object({issue:F.literal("materialized-input-mismatch"),operation:F.string()}).strict(),F.object({issue:F.literal("browser-record-setup-not-supported"),source:F.string()}).strict(),F.object({issue:F.literal("state-budget"),stateBudget:F.unknown()}).strict()]),$v=F.object({operation:F.string(),path:F.array(F.string())}).strict(),Vv=F.object({operation:F.string()}).strict(),jv=F.object({source:F.string()}).strict(),_v=F.object({slot:F.string()}).strict();function Wv(e){let t=qv(e),r=Dv.safeParse(t);if(r.success)return Ze(Uv(r.data));let n=$v.safeParse(t);if(n.success){let s=n.data.path.join(".");return`setup operation "${n.data.operation}" did not return referenced path "${s}"`}let o=Vv.safeParse(t);if(o.success)return`setup operation "${o.data.operation}" could not be resolved or verified`;let a=jv.safeParse(t);if(a.success)return`state source "${a.data.source}" was missing or returned a mismatched contract`;let i=_v.safeParse(t);return i.success?`generated setup value "${i.data.slot}" was not resolved`:Ze(e)}function Uv(e){switch(e.issue){case"unresolved-optional":return"the starting state plan contains an unresolved optional value";case"duplicate-operation":return"the starting state plan contains duplicate setup operation IDs";case"browser-http-dependency":return`HTTP setup operation "${e.operation}" depends on browser setup operation "${e.dependency}". HTTP state must be set up before Ripplo signs in and sets up browser state`;case"cyclic-operations":return`setup operations depend on each other: ${e.operations.join(", ")}`;case"materialized-input-mismatch":return`setup operation "${e.operation}" returned state that did not include its requested input`;case"browser-record-setup-not-supported":return`browser state source "${e.source}" can only set up its full state, but the plan requested one record`;case"state-budget":return`state exceeded its size or depth limit: ${Pt(e.stateBudget)}`}}function qv(e){try{return JSON.parse(e)}catch{return}}function ne(e){return`${e.workflow}/${e.slug}`}var Op=new WeakMap;function Y(e){let t=Op.get(e);if(t!=null)return t;let r=e.workflows.flatMap(n=>n.tests.map(o=>({ref:ne(o),test:o,workflow:n})));return Op.set(e,r),r}import{createHash as UE}from"crypto";import{z as zv}from"zod";import{stringify as I1}from"safe-stable-stringify";var Hv=zv.string().brand();function q(e){return typeof e=="object"&&e!==null&&"deferred"in e}var Xe=new Set,In=new Map;function H(e){return Hv.parse(e)}function pt(e){return typeof e=="object"&&e!==null&&"ref"in e&&typeof e.ref=="string"}function tr(e){let t=e.lastIndexOf(".");return t===-1?void 0:{alias:e.slice(0,t),field:e.slice(t+1)}}function Mp(e){return typeof e=="object"&&e!==null&&"template"in e}function rr(e,t){let r=t.get(e);return r??e}function Ir(e,t){let r=tr(e);if(r==null)return e;let n=t.get(r.alias);return n==null?e:`${n}.${r.field}`}var D=class extends Error{subject;constructor(t){super(t),this.subject=t}};function Be(e){return{deferred:Xe,env:e,stateExpression:void 0,witnesses:In}}function Tp(e,t){return Lp(e).every(r=>t.env.has(H(Ir(r,t.witnesses))))}function Ip(e,t){return Lp(e).every(r=>t.env.has(H(Ir(r,t.witnesses)))||ia({ref:r},t))}function ia(e,t){let r=tr(Ir(e.ref,t.witnesses));return r!=null&&t.deferred.has(r.alias)}function De(e,t){return typeof e=="string"?e:pt(e)?Np(e,t):Gv(e,t)}function Ot(e,t){return e===null||typeof e=="number"||typeof e=="boolean"?e:pt(e)?Fp(e,t):De(e,t)}function Lp(e){return e==null||typeof e!="object"?[]:Mp(e)?e.template.flatMap(t=>typeof t=="string"?[]:"ref"in t?[t.ref]:ut(t)):[e.ref]}function ut(e){switch(e.kind){case"reference":return Kv(e);case"count":return Jv(e.selection);case"add":return[...ut(e.left),...ut(e.right)];case"divide":return[...ut(e.dividend),...ut(e.divisor)];case"concat":return e.values.flatMap(t=>ut(t));case"invert":return ut(e.value);case"after":case"before":case"path":case"value":return[]}}function Kv(e){let t=e.path[0];return e.record==="$ripplo.params"&&e.path.length===1&&t!=null?[t]:[]}function Jv(e){return e.relation==null?[]:aa(e.relation)}function aa(e){return e.kind==="not"?aa(e.relation):e.kind==="and"||e.kind==="or"?e.relations.flatMap(t=>aa(t)):e.kind==="exists"?e.selection.relation==null?[]:aa(e.selection.relation):[...ut(e.left),...ut(e.right)]}function Np(e,t){let r=Fp(e,t);return q(r)?r:String(r)}function Fp(e,t){let r={...e,ref:Ir(e.ref,t.witnesses)};if(ia(r,t))return{...r,deferred:!0};let n=H(r.ref);if(t.env.has(n))return t.env.get(n)??null;throw new D(n)}function Gv(e,t){let r=e.template.map(o=>Yv(o,t)),n=r.flatMap(o=>q(o)?[]:[o]);return n.length===r.length?n.join(""):{deferred:!0,template:r.map(o=>Zv(o))}}function Yv(e,t){if(typeof e=="string")return e;if("ref"in e)return Np(e,t);let r=t.stateExpression?.(e);if(r===void 0)throw new D("a state expression value");let n=Ne.safeParse(r);if(!n.success)throw new D("a non-scalar state expression value");return String(n.data)}function Zv(e){if(!q(e)||"ref"in e)return e;throw new D("a nested template value")}function ue(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:De(e.name,t),role:e.role}:e.by==="inside"?{by:"inside",scope:ue(e.scope,t),target:ue(e.target,t)}:e.by==="surface"?{by:"surface",container:ue(e.container,t),overlay:e.overlay}:e.by==="frame"?{by:"frame",element:ue(e.element,t)}:{by:"testId",value:De(e.value,t)}}function Ln({actorAlias:e,current:t,deferred:r,env:n,witnesses:o}){return{deferred:r,env:n,stateExpression:t==null?void 0:a=>Xv({actorAlias:e,current:t,env:n,expression:a,witnesses:o}),witnesses:o}}function Bp({actorAlias:e,current:t,env:r,relation:n,witnesses:o}){let a=$p({constraints:t.constraints,env:r});return Ye(n,{after:void 0,before:void 0,parameters:_p(r),records:Dp({actorAlias:e,state:a,witnesses:o}),state:a})}function Xv({actorAlias:e,current:t,env:r,expression:n,witnesses:o}){let a=$p({constraints:t.constraints,env:r}),i=Qo(n,{after:void 0,before:void 0,parameters:_p(r),records:Dp({actorAlias:e,state:a,witnesses:o}),state:a});return i.known?i.value:void 0}function Dp({actorAlias:e,state:t,witnesses:r}){let n=iw({actorAlias:e,state:t}),o=[...r].flatMap(([a,i])=>{let s=n[i];return s===void 0?[]:[[a,s]]});return o.length===0?n:{...n,...Object.fromEntries(o)}}function $p({constraints:e,env:t}){return e.reduce((r,n)=>Qv({constraint:n,env:t,state:r}),{})}function Qv({constraint:e,env:t,state:r}){return e.kind==="equals"?ew({constraint:e,env:t,state:r}):e.kind==="required-record"?tw({constraint:e,env:t,state:r}):e.kind==="closed-record"&&e.operations.length===0?el({selector:e.selector,state:r,value:{}}):r}function ew({constraint:e,env:t,state:r}){let n=sa({env:t,expression:e.value,fallbackPath:void 0});return n===void 0?r:el({selector:e.selector,state:r,value:n})}function tw({constraint:e,env:t,state:r}){let n=rw({alias:e.alias,env:t,fields:e.fields});return n==null?r:ow({alias:e.alias,row:n,selector:e.selector,state:r})}function rw({alias:e,env:t,fields:r}){let n=Object.entries(r).map(([o,a])=>[o,sa({env:t,expression:a,fallbackPath:`${e}.${o}`})]);return{...nw({alias:e,env:t}),...Object.fromEntries(n.flatMap(([o,a])=>a===void 0?[]:[[o,a]]))}}function nw({alias:e,env:t}){let r=`${e}.`;return Object.fromEntries([...t].flatMap(([n,o])=>{let a=String(n);if(!a.startsWith(r))return[];let i=a.slice(r.length);return i.length===0||i.includes(".")?[]:[[i,o]]}))}function sa({env:e,expression:t,fallbackPath:r}){switch(t.kind){case"value":return t.value;case"generate":return r==null?void 0:e.get(H(r));case"reference":{let n=t.operation===dt?t.path.join("."):[t.operation,...t.path].join(".");return e.get(sw(n))}case"array":{let n=t.items.map((o,a)=>sa({env:e,expression:o,fallbackPath:r==null?void 0:`${r}.${String(a)}`}));return lw(n)}case"object":{let n=Object.entries(t.fields).map(([o,a])=>[o,sa({env:e,expression:a,fallbackPath:r==null?void 0:`${r}.${o}`})]);return cw(n)}}}function el({selector:e,state:t,value:r}){let o=t[e.source]??{};return{...t,[e.source]:Vp({current:o,path:e.path,value:r})}}function ow({alias:e,row:t,selector:r,state:n}){let o=aw(n,r),a=x(o)?o:{};return el({selector:r,state:n,value:{...a,[e]:t}})}function Vp(e){let{current:t,path:r,value:n}=e,[o,...a]=r;if(o==null)return n;let i=x(t)?t:{},s=i[o]??{};return{...i,[o]:Vp({current:s,path:a,value:n})}}function aw(e,t){let r=e[t.source];return r==null?void 0:jp(r,t.path)}function jp(e,t){let[r,...n]=t;if(r==null)return e;if(!x(e))return;let o=e[r];return o==null?void 0:jp(o,n)}function _p(e){return Object.fromEntries([...e].filter(([t])=>!t.includes(".")))}function iw({actorAlias:e,state:t}){let r=Object.values(t).reduce((o,a)=>({...o,...Wp(a)}),{});if(typeof e!="string")return r;let n=r[e];return n===void 0?r:{...r,[Er]:n}}function Wp(e){return x(e)?{...Object.values(e).reduce((r,n)=>({...r,...Wp(n)}),{}),...e}:{}}function sw(e){return H(e)}function lw(e){if(!e.includes(void 0))return e.flatMap(t=>t===void 0?[]:[t])}function cw(e){if(!e.some(([,t])=>t===void 0))return Object.fromEntries(e.flatMap(([t,r])=>r===void 0?[]:[[t,r]]))}var dw="https://ripplo.invalid";var Up={hash:void 0,path:void 0,query:{},title:void 0,viewport:void 0};function zp(e){return e.kind!=="title"&&e.kind!=="viewport"}function nr(e){return e.kind==="query"?`url query "${e.key}"`:e.kind==="title"||e.kind==="viewport"?e.kind:`url ${e.kind}`}function la(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 Nn(e){let t=new URL(e,dw),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 Hp(e){if(typeof e=="string")return qp(Nn(e));let t=pt(e)?[e]:e.template,r=t.findIndex(c=>typeof c=="string"&&/[?#]/.test(c)),n=t[r];if(r===-1||typeof n!="string")return{...Up,path:e};let o=[...t.slice(0,r),n.slice(0,n.search(/[?#]/))].filter(c=>typeof c!="string"||c.length>0),a=t.slice(r),i={template:o};if(a.some(c=>typeof c!="string"))return{...Up,path:i};let s=a.filter(c=>typeof c=="string").join(""),l=Nn(`/p${s.slice(s.search(/[?#]/))}`);return{...qp(l),path:i}}function Kp(e){let r=[[{kind:"path"},e.path],[{kind:"hash"},e.hash],[{kind:"title"},e.title],[{kind:"viewport"},e.viewport]].flatMap(([o,a])=>a===void 0?[]:[{clause:a,key:o}]),n=Object.entries(e.query).map(([o,a])=>({clause:a,key:{key:o,kind:"query"}}));return[...r,...n]}function qp(e){return{hash:e.hash,path:e.path,query:e.query,title:e.title,viewport:e.viewport}}function Jp(e){return e.expect==="absent"?e:q(e.value)?void 0:{expect:e.expect,value:e.value}}var ft=new Map;function v(e){return e.kind!=="element"?g(e):xr(e.locator,e.state)}function yt(e,t){return new Map([...Gp(e,t),[v(t.subject),t]])}function tl(e,t){return new Map([...Gp(e,t),[v(t.subject),t]])}function $e(e,t){return new Map([...e,...t])}function rl(e){return e.kind==="element"}function Mt(e){return e.kind==="path"||e.kind==="query"||e.kind==="hash"}function K(e,t){let r=e.get(v(t));if(!(r==null||r.expect.expect!=="is"))return q(r.expect.value)?void 0:r.expect.value}function Nr(e){let t=Nn(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?[]:[[v(n),{declared:!0,expect:{expect:"is",value:o},subject:n}]]))}function nl(e){return[...e].toSorted(([t],[r])=>t.localeCompare(r))}function Gp(e,t){return uw(t)?pw(e,t.subject):yw(t)?mw(e,t.subject):e}function uw(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!1}function pw(e,t){if(t.kind!=="element")return e;let r=g(fe(t.locator)),n=[...e].filter(([,o])=>fw(o,r));return n.length===e.size?e:new Map(n)}function fw(e,t){if(e.subject.kind!=="element")return!0;let r=fe(e.subject.locator);return Fn(r,t)?!1:g(r)!==t?!0:e.subject.state!=="text"&&e.subject.state!=="value"}function Fn(e,t){return e.by==="frame"?g(e.element)===t||Fn(e.element,t):e.by!=="inside"?!1:g(e.scope)===t||g(e.target)===t||Fn(e.scope,t)||Fn(e.target,t)}function yw(e){return e.subject.kind==="element"&&e.subject.state==="visible"&&e.expect.expect==="is"&&e.expect.value===!0&&Yp(e.subject.locator)}function Yp(e){return e.by==="surface"&&e.overlay}function mw(e,t){if(t.kind!=="element")return e;let r=g(fe(t.locator)),n=[...e].filter(([,o])=>hw(o,r));return n.length===e.size?e:new Map(n)}function hw(e,t){if(e.subject.kind!=="element"||Yp(e.subject.locator))return!0;let r=fe(e.subject.locator);return g(r)===t||Fn(r,t)}function Tt({declared:e,entry:t,scope:r}){let n=t.subject.kind==="element"?{...t.subject,locator:ue(t.subject.locator,r)}:t.subject;if(t.expect.expect==="absent")return{declared:e,expect:{expect:"absent"},subject:n};let o=Ot(t.expect.value,r);return{declared:e,expect:{expect:t.expect.expect,value:Zp(o,n)},subject:n}}function Zp(e,t){return q(e)||!Rw(t)||typeof e!="number"?e:String(e)}function Xp({expect:e,scope:t,subject:r}){return e.expect==="absent"?{expect:"absent"}:{expect:e.expect,value:Zp(Ot(e.value,t),r)}}function Bn({got:e,subject:t,want:r}){if(r.expect==="absent")return e===void 0?"holds":"fails";let n=gw({got:e,subject:t,want:r.value});if(n==="unknown")return"unknown";let o=r.expect==="is";return n==="equal"===o?"holds":"fails"}function gw({got:e,subject:t,want:r}){return e!==void 0&&q(e)?q(r)&&g(r)===g(e)?"equal":"unknown":q(r)?"unknown":Qp({got:e,subject:t,want:{expect:"is",value:r}})?"equal":"different"}function Qp({got:e,subject:t,want:r}){if(r.expect==="absent")return e===void 0;if(Sw(t)){let n=bw(e,r.value);return r.expect==="is"?n:!n}return r.expect==="is"?e===r.value:e!==r.value}function Sw(e){return e.kind==="element"&&e.state==="text"}function Lr(e){return e.replaceAll(/\s+/gu," ").trim()}function bw(e,t){return typeof e=="string"&&typeof t=="string"&&Lr(e)===Lr(t)}function Rw(e){return e.kind==="element"&&(e.state==="value"||e.state==="text")}function ol({pattern:e,snapshot:t}){let r=da(t);return e.actor.kind==="any"?!0:e.actor.kind==="anonymous"?r==null:r===e.actor.alias}function ca(e,t){return al({base:new Map,deferred:Xe,logical:void 0,pattern:e,snapshot:t,witnesses:In})}function al({base:e,deferred:t,logical:r,pattern:n,snapshot:o,witnesses:a}){return tf(n,o)?Ew({deferred:t,env:e,logical:r,pattern:n.scalars,snapshot:o,witnesses:a}):null}function ef({base:e,deferred:t,logical:r,pattern:n,snapshot:o,witnesses:a}){return tf(n,o)?ww({deferred:t,env:e,logical:r,pattern:n.scalars,snapshot:o,witnesses:a}).unmet:vw(n,o)}function tf(e,t){let r=da(t);return e.actor.kind==="user"?r!=null:e.actor.kind==="anonymous"?r==null:!0}function da(e){let t=e.scalars.get(v({kind:"actor"})),r=t!=null&&t.expect.expect==="is"?t.expect.value:null;return typeof r=="string"?r:null}function vw(e,t){return{got:da(t)??void 0,kind:"scalar",subject:{kind:"actor"},want:e.actor.kind==="anonymous"?"signed out":"a signed-in user"}}function rf({deferred:e,entry:t,env:r,logical:n,snapshot:o,witnesses:a}){let i=of({deferred:e,env:r,logical:n,snapshot:o,witnesses:a}),s=nf(t.subject,i);return s==null?null:Cw({entry:t.expect,got:af(o,s),scope:i,subject:s})}function ww({deferred:e,env:t,logical:r,pattern:n,snapshot:o,witnesses:a}){return[...n.values()].reduce((i,s)=>{if(i.unmet!=null)return i;let l=rf({deferred:e,entry:s,env:i.env,logical:r,snapshot:o,witnesses:a});if(l!=null)return{env:l,unmet:null};let c=of({deferred:e,env:i.env,logical:r,snapshot:o,witnesses:a}),d=nf(s.subject,c),u=d==null?void 0:af(o,d),p=s.expect.expect==="absent"?null:s.expect.value;return{env:i.env,unmet:{got:u,kind:"scalar",subject:s.subject,want:p}}},{env:t,unmet:null})}function Ew({deferred:e,env:t,logical:r,pattern:n,snapshot:o,witnesses:a}){return[...n.values()].reduce((i,s)=>i==null?null:rf({deferred:e,entry:s,env:i,logical:r,snapshot:o,witnesses:a}),t)}function xw({clause:e,scope:t,subject:r}){return!(r.kind==="element"&&(r.state==="value"||r.state==="text"))||!pt(e)||Tp(e,t)?!1:!kw(e,t)}function kw(e,t){return pt(e)&&ia(e,t)}function Cw({entry:e,got:t,scope:r,subject:n}){if(e.expect!=="absent"&&xw({clause:e.value,scope:r,subject:n}))return Pw({clause:e.value,got:t,scope:r});let o=Aw({entry:e,scope:r,subject:n});return o==null||Bn({got:t,subject:n,want:o})==="fails"?null:r.env}function Aw({entry:e,scope:t,subject:r}){try{return Xp({expect:e,scope:t,subject:r})}catch(n){if(n instanceof D)return null;throw n}}function Pw({clause:e,got:t,scope:r}){return t===void 0||q(t)?null:new Map([...r.env,[H(Ir(Ow(e),r.witnesses)),t]])}function Ow(e){if(!pt(e))throw new Error("expected a ref clause");return e.ref}function nf(e,t){return e.kind!=="element"?e:Mw(e.locator,t)?{...e,locator:ue(e.locator,t)}:null}function Mw(e,t){return Zo(e).every(r=>Ip(r,t))}function of({deferred:e,env:t,logical:r,snapshot:n,witnesses:o}){return Ln({actorAlias:da(n)??void 0,current:r,deferred:e,env:t,witnesses:o})}function af(e,t){let r=e.scalars.get(v(t));return r==null||r.expect.expect!=="is"?void 0:r.expect.value}function Ve(e,t){return[...new Map(e.map(r=>[t(r),r])).values()]}function ua(e){return[...Tw(e.action),...e.effects.flatMap(t=>Iw(t)),...e.expect.flatMap(t=>mt(t))]}function mt(e){switch(e.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return Fe(e.locator);case"value":case"text":{let t=ct(e.value)?e.value.value:e.value;return[...Fe(e.locator),...Ct(t)]}case"browser":return Ct(e.value);case"not":return mt(e.predicate);case"when":return e.branches.flatMap(t=>[...t.condition==null?[]:mt(t.condition),...t.consequence.flatMap(r=>mt(r))]);case"and":case"or":return e.predicates.flatMap(t=>mt(t));case"optional-path":case"optional-record":case"state-compare":case"state-equals":case"viewport":return[];case"state-relation":return or(e.relation);case"actor":return e.target.kind==="anonymous"?[]:[e.target.ref.ref]}}function Fr(e){return[...e.scalars.values()].flatMap(t=>sl(t))}function sl(e){let t=e.subject.kind==="element"?Fe(e.subject.locator):[],r=e.expect.expect==="absent"?[]:Ct(e.expect.value);return[...t,...r]}function pa(e){return e.flatMap(t=>Go(t).flatMap(r=>Yu(r)))}function Tw(e){return e.kind==="goto"?Ct(e.url):e.kind==="actor"?[e.ref.ref]:e.kind==="fill"||e.kind==="select"?[...Fe(e.locator),...Ct(e.value)]:e.kind==="press"?e.locator==null?[]:Fe(e.locator):e.kind==="drag"?[...Fe(e.source),...Fe(e.target)]:Fe(e.locator)}function Iw(e){switch(e.kind){case"create-record":return Object.values(e.fields).flatMap(t=>sf(t));case"update-selected-records":return[...il(e.selection),...Object.values(e.changes).flatMap(t=>sf(t))];case"delete-selected-records":return il(e.selection);case"transform":return or(e.relation);case"create-path":case"delete-path":case"set":return[]}}function sf(e){return e.kind==="reference"?Lw(e):e.kind==="transform"?or(e.relation):[]}function Lw({path:e,record:t}){let r=e[0];return t===dt&&e.length===1&&r!=null?[r]:[]}function or(e){return e.kind==="not"?or(e.relation):e.kind==="and"||e.kind==="or"?e.relations.flatMap(t=>or(t)):e.kind==="exists"?e.selection.relation==null?[]:or(e.selection.relation):[...It(e.left),...It(e.right)]}function It(e){switch(e.kind){case"reference":return Nw(e);case"count":return il(e.selection);case"add":return[...It(e.left),...It(e.right)];case"divide":return[...It(e.dividend),...It(e.divisor)];case"concat":return e.values.flatMap(t=>It(t));case"invert":return It(e.value);case"after":case"before":case"path":case"value":return[]}}function Nw(e){let t=e.path[0];return e.record===dt&&e.path.length===1&&t!=null?[t]:[]}function il(e){return e.relation==null?[]:or(e.relation)}function Br(e){return e.flatMap(t=>t.kind==="and"?Br(t.predicates):[t])}function Dr(e){return Br(e).filter(t=>!Zt(t))}function fa(e){return e.action.kind==="goto"?!0:ll(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null)}function ar(e){return e.action.kind==="goto"?!0:ll(e.expect).some(t=>t.kind==="browser"&&t.name==="url"&&t.value!==null&&(t.part===void 0||t.part.kind==="path"))}function ll(e){return e.flatMap(t=>t.kind==="and"?ll(t.predicates):[t])}function Qe(e,t){return t.reduce((r,n)=>{let o=[..._w(n),...Lt(n),...Ww(n)],a=Fw(n,r,o)?jw(r):r;return o.reduce((i,s)=>tl(i,s),a)},e)}function ae(e){return e.kind==="not"?Bw(e.predicate):Dw(e)}function Dn(e){return Kp(Hp(e)).map(({clause:t,key:r})=>({expect:t===null?{expect:"absent"}:{expect:"is",value:t},subject:r}))}function Fw(e,t,r){if(e.action.kind==="goto")return!0;if(!ar(e))return!1;let n=t.get(v({kind:"path"})),o=r.find(a=>a.subject.kind==="path");return o==null?!1:n==null||g(n.expect)!==g(o.expect)}function Bw(e){return e.kind==="value"||e.kind==="text"?ct(e.value)?null:{expect:{expect:"not",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}}:lf(e,!0)}function lf(e,t){if(e.kind==="value"||e.kind==="text")return ct(e.value)?null:{expect:{expect:"is",value:e.value},subject:{kind:"element",locator:e.locator,state:e.kind}};let r=$w(e);return r==null?null:{expect:{expect:"is",value:r.value!==t},subject:{kind:"element",locator:r.locator,state:r.state}}}function Dw(e){return e.kind==="browser"?{expect:e.value===null?{expect:"absent"}:{expect:"is",value:e.value},subject:la(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"}}:lf(e,!1)}function Lt(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 $w(e){return Vw(e)?e.kind==="disabled"?{locator:e.locator,state:"enabled",value:!1}:{locator:e.locator,state:e.kind,value:!0}:null}function Vw(e){return e.kind==="visible"||e.kind==="disabled"||e.kind==="enabled"||e.kind==="focused"||e.kind==="checked"||e.kind==="expanded"||e.kind==="pressed"}function jw(e){return new Map([...e].filter(([,t])=>t.subject.kind==="variable"||t.subject.kind==="viewport"))}function _w(e){return e.action.kind==="goto"?Dn(e.action.url):[]}function Ww(e){return Dr(e.expect).flatMap(t=>{let r=ae(t);return r==null?[]:[r]})}function cl(e){return e.includes("async")?"async":e.includes("slow")?"slow":"fast"}var $n={async:12e4,fast:5e3,slow:3e4},Ce={async:{backoffMs:[500,1e3,2e3,5e3],timeoutMs:$n.async},fast:{backoffMs:[100,250,500,1e3],timeoutMs:$n.fast},slow:{backoffMs:[250,500,1e3,2e3],timeoutMs:$n.slow}};function ya(e,t){return e.backoffMs[Math.min(t,e.backoffMs.length-1)]??0}function $r({constraint:e,constraints:t,effect:r}){return!ta({records:Uw(t),relation:e.relation}).some(o=>Vn(o,r.selector))}function Uw(e){return e.flatMap(t=>qw(t)?[{alias:t.alias,selector:t.selector}]:[])}function qw(e){return e.kind==="required-record"||e.kind==="optional-record"}function cf({constraint:e,constraints:t,effect:r,parameters:n}){if(e.kind==="relation")return $r({constraint:e,constraints:t,effect:r})?[e]:[];if(g(e.selector)!==g(r.selector))return[e];if(e.kind!=="equals"||e.value.kind!=="value")return[];let o=Ws({before:e.value.value,context:{parameters:n,records:{},state:{}},relation:r.relation});return o.known?[{...e,value:{kind:"value",value:o.value}}]:[]}function df({changes:e,fields:t,parameters:r}){let n=Object.fromEntries(Object.entries(e).flatMap(([a,i])=>{let s=zw({before:t[a],expression:i,parameters:r});return s==null?[]:[[a,s]]}));return{...Object.fromEntries(Object.entries(t).filter(([a])=>!(a in e))),...n}}function zw({before:e,expression:t,parameters:r}){if(t.kind==="value")return t;if(t.kind==="reference")return{kind:"reference",operation:t.record,path:t.path};let n={parameters:r,records:{},state:{}},o=e?.kind==="value"?Ws({before:e.value,context:n,relation:t.relation}):Sp({context:n,relation:t.relation});return o.known?{kind:"value",value:o.value}:void 0}function uf({constraints:e,effect:t,parameters:r}){let n=ff(e),o=yf({parameters:r,records:n}),a=n.filter(i=>hf(i.constraint.selector,t.selector)).map(i=>({record:i,selected:mf({context:o,record:i,selection:t.selection})}));return e.flatMap(i=>i.kind==="relation"?Hw({constraint:i,constraints:e,effect:t}):Kw({constraint:i,decisions:a,effect:t,parameters:r}))}function Hw({constraint:e,constraints:t,effect:r}){return $r({constraint:e,constraints:t,effect:r})?[e]:[]}function pf({constraints:e,effect:t,parameters:r}){let n=ff(e),o=yf({parameters:r,records:n});return n.filter(a=>hf(a.constraint.selector,t.selector)).filter(a=>{let i=mf({context:o,record:a,selection:t.selection});return i.known&&i.value}).every(a=>Jw({context:o,effect:t,record:a}))}function Kw({constraint:e,decisions:t,effect:r,parameters:n}){if(!Qw(r.selector,e.selector))return[e];if(e.kind!=="required-record")return[];let o=t.find(a=>a.record.alias===e.alias);return o==null||!o.selected.known?[]:o.selected.value?r.kind==="delete-selected-records"?[{fields:e.fields,kind:"absent-record",selector:e.selector}]:[{...e,fields:df({changes:r.changes,fields:e.fields,parameters:n})}]:[e]}function Jw({context:e,effect:t,record:r}){let n={...e.records,[t.selection.alias]:r.value};return Object.entries(t.changes).every(([o,a])=>{if(a.kind!=="transform")return!0;let i=r.constraint.fields[o];return i?.kind!=="value"?!0:ra({before:i.value,context:{...e,records:n},relation:a.relation}).kind!=="invalid"})}function ff(e){return e.flatMap(t=>{if(t.kind!=="required-record")return[];let r=Gw(t.fields);return[{alias:t.alias,constraint:t,value:r}]})}function Gw(e){return Object.fromEntries(Object.entries(e).flatMap(([t,r])=>r.kind==="value"?[[t,r.value]]:[]))}function yf({parameters:e,records:t}){return{after:void 0,before:void 0,parameters:e,records:Object.fromEntries(t.map(r=>[r.alias,r.value])),state:{}}}function mf({context:e,record:t,selection:r}){if(r.relation==null)return{known:!0,value:!0};let n={...e,records:{...e.records,[r.alias]:t.value}};return dl({context:n,record:t,relation:r.relation,selectionAlias:r.alias})}function dl({context:e,record:t,relation:r,selectionAlias:n}){switch(r.kind){case"not":return Yw({context:e,record:t,relation:r.relation,selectionAlias:n});case"and":case"or":{let o=r.relations.map(a=>dl({context:e,record:t,relation:a,selectionAlias:n}));return Xw({children:o,kind:r.kind})}case"exists":return{known:!1};case"compare":case"equals":case"text":return Zw({context:e,record:t,relation:r,selectionAlias:n})}}function Yw(e){let t=dl(e);return t.known?{known:!0,value:!t.value}:t}function Zw({context:e,record:t,relation:r,selectionAlias:n}){let o=Gt({relation:r,map:i=>i.record===n?{...i,record:t.alias}:i});return o.kind==="equals"&&g(o.left)===g(o.right)?{known:!0,value:!0}:Vr({context:e,expression:r.left})&&Vr({context:e,expression:r.right})?{known:!0,value:Ye(r,e)}:{known:!1}}function Xw({children:e,kind:t}){let r=e.find(n=>n.known&&n.value===(t==="or"));return r??(e.every(n=>n.known)?{known:!0,value:t==="and"}:{known:!1})}function Vr({context:e,expression:t}){return t.kind==="path"||t.kind==="count"?!1:t.kind==="add"?Vr({context:e,expression:t.left})&&Vr({context:e,expression:t.right}):t.kind==="concat"?t.values.every(r=>Vr({context:e,expression:r})):t.kind==="invert"?Vr({context:e,expression:t.value}):Qo(t,e).known}function hf(e,t){return g(e)===g(t)}function Qw(e,t){if(e.source!==t.source)return!1;let r=Math.min(e.path.length,t.path.length);return e.path.slice(0,r).every((n,o)=>t.path[o]===n)}var ma={constraints:[]};function Rf({left:e,right:t}){return e.constraints.every(r=>t.constraints.every(n=>!iE(r,n)))}function ul({alias:e,candidates:t,current:r}){let n=t.find(o=>ha(o)&&o.alias===e);return n==null?!1:r.constraints.some(o=>nE({candidate:n,known:o}))}function vf({current:e,selector:t,value:r}){return e.constraints.some(n=>n.kind==="equals"&&jr(n.selector,t)&&n.value.kind==="value"&&g(n.value.value)===g(r))}function pl({current:e,op:t,selector:r,value:n}){return e.constraints.some(o=>{if(o.kind!=="equals"||!jr(o.selector,r)||o.value.kind!=="value")return!1;let a=Ne.safeParse(o.value.value);return a.success&&$u({left:a.data,op:t,right:n})})}function ht({effects:e,parameters:t,pattern:r}){return e.reduce((n,o)=>({constraints:oE({constraints:n.constraints,effect:o,parameters:t})}),r)}function wf({after:e,before:t,env:r}){let n=gf(t),o=gf(e),a=[...r].filter(([i])=>tE({after:o.get(i),before:n.get(i)}));return new Map([...a,...rE(e)])}function Ef({after:e,deferred:t,effects:r}){let n=eE(e),o=[...t].filter(a=>n.has(a));return new Set([...o,...jn(r)])}function jn(e){return e.flatMap(t=>t.kind==="create-record"?[t.as]:[])}function eE(e){return new Set(e.constraints.flatMap(t=>t.kind==="required-record"?[t.alias]:[]))}function gf(e){return new Map(e.constraints.flatMap(t=>t.kind==="required-record"?Object.entries(t.fields).map(([r,n])=>[H(`${t.alias}.${r}`),{expression:n,selector:t.selector}]):[]))}function ha(e){return e.kind==="optional-path"||e.kind==="optional-record"}function tE({after:e,before:t}){return t===void 0?!0:e===void 0||e.expression.kind==="value"?!1:g(e)===g(t)}function rE(e){return e.constraints.flatMap(t=>t.kind!=="required-record"?[]:Object.entries(t.fields).flatMap(([r,n])=>{if(n.kind!=="value")return[];let o=Ne.safeParse(n.value);return o.success?[[H(`${t.alias}.${r}`),o.data]]:[]}))}function nE({candidate:e,known:t}){return t.kind==="relation"||!jr(e.selector,t.selector)?!1:e.kind==="optional-path"?t.kind==="equals"&&ir(e.value,t.value):t.kind==="required-record"&&t.alias===e.alias}function oE({constraints:e,effect:t,parameters:r}){if(t.kind==="transform")return e.flatMap(o=>cf({constraint:o,constraints:e,effect:t,parameters:r}));if(t.kind==="delete-selected-records"||t.kind==="update-selected-records")return uf({constraints:e,effect:t,parameters:r});let n=e.filter(o=>aE({constraint:o,constraints:e,effect:t}));return t.kind==="set"||t.kind==="create-path"?[...n,{kind:"equals",selector:t.selector,value:uE(t.value)}]:t.kind==="delete-path"?[...n,{kind:"absent-path",selector:t.selector}]:[...n,{alias:fE(t),fields:pE(t.fields),kind:"required-record",selector:t.selector}]}function aE({constraint:e,constraints:t,effect:r}){return e.kind==="relation"?$r({constraint:e,constraints:t,effect:r}):Vn(r.selector,e.selector)?r.kind==="create-record"?e.kind==="required-record":!1:!0}function iE(e,t){return e.kind==="relation"||t.kind==="relation"||!jr(e.selector,t.selector)?!1:sE(e,t)||lE(e,t)}function sE(e,t){return e.kind==="equals"&&t.kind==="equals"?!ir(e.value,t.value):e.kind==="absent-path"&&t.kind==="equals"||e.kind==="equals"&&t.kind==="absent-path"}function lE(e,t){return Sf(e,t)||Sf(t,e)?!0:e.kind==="required-record"?bf(e,t):t.kind==="required-record"&&bf(t,e)}function Sf(e,t){return e.kind==="closed-record"&&e.operations.length===0&&t.kind==="required-record"}function bf(e,t){return t.kind==="required-record"?e.alias===t.alias&&dE({left:e.fields,right:t.fields}):t.kind==="absent-record"&&cE({fields:t.fields,record:e})}function cE({fields:e,record:t}){return Object.entries(e).every(([r,n])=>{if(n.kind==="reference"&&n.operation===t.alias&&n.path.length===1&&n.path[0]===r)return!0;let o=t.fields[r];return o!=null&&ir(o,n)})}function Vn(e,t){if(e.source!==t.source)return!1;let r=Math.min(e.path.length,t.path.length);return e.path.slice(0,r).every((n,o)=>t.path[o]===n)}function ir(e,t){return g(e)===g(t)}function jr(e,t){return g(e)===g(t)}function dE({left:e,right:t}){return Object.entries(e).some(([r,n])=>{let o=t[r];return o!=null&&!ir(n,o)})}function uE(e){return{kind:"value",value:e}}function pE(e){return Object.fromEntries(Object.entries(e).flatMap(([t,r])=>r.kind==="absent"||r.kind==="generated"?[]:[[t,r.kind==="value"?r:{kind:"reference",operation:r.record,path:r.path}]]))}function fE(e){return e.as}function _n(e){return{constraints:e.constraints.map(t=>kf({constraint:t,fieldsOf:yE,plan:e}))}}function xf(e){return{constraints:e.constraints.map(t=>kf({constraint:t,fieldsOf:mE,plan:e}))}}function kf({constraint:e,fieldsOf:t,plan:r}){if(e.kind!=="required-record")return e;let n=r.operations.find(o=>o.id===e.alias);return n?.input.kind!=="object"?e:{...e,fields:{...t(n.input),...e.fields}}}function yE(e){return e.fields}function mE(e){return Object.fromEntries(Object.entries(e.fields).filter(([,t])=>fl(t)))}function fl(e){switch(e.kind){case"array":return e.items.every(t=>fl(t));case"object":return Object.values(e.fields).every(t=>fl(t));case"generate":return!1;case"reference":case"value":return!0}}import{createHash as RE}from"crypto";function Pf({prior:e,step:t}){let r=Lt(t);if(r.length===0||yl(t).length===0)return null;let n=An({aligned:!0,patterns:[e,Af(r)]}),o=r.some(a=>An({aligned:!0,patterns:[e,Af([bE(a)])]}));return n===o?"undecided":n?"same":"different"}function Of({effects:e,prior:t}){let r=e.map(n=>gE({effect:n,prior:t}));return r.length===0||r.includes("undecided")?"undecided":r.every(n=>n==="same")?"same":"different"}function Mf(e){return e.every((t,r)=>e.slice(r+1).filter(n=>v(n.subject)===v(t.subject)).every(n=>SE({left:t,right:n})))}function yl(e){let t=Lt(e);return Br(e.expect).filter(r=>{let n=ae(r);return n==null||!t.some(o=>hE({left:o,right:n}))})}function hE({left:e,right:t}){return v(e.subject)===v(t.subject)&&g(e.expect)===g(t.expect)}function gE({effect:e,prior:t}){if(e.expect.expect!=="is")return"undecided";let r=t.get(v(e.subject));if(r==null||r.expect.expect==="absent")return"undecided";let n=g(r.expect.value)===g(e.expect.value);return r.expect.expect==="is"?n?"same":"different":n?"different":"undecided"}function SE({left:e,right:t}){return e.expect.expect==="absent"?t.expect.expect!=="is":t.expect.expect==="absent"?e.expect.expect!=="is":e.expect.expect===t.expect.expect?e.expect.expect==="not"||Cf({left:e,right:t}):!Cf({left:e,right:t})}function Cf({left:e,right:t}){return e.expect.expect==="absent"||t.expect.expect==="absent"?!1:g(e.expect.value)===g(t.expect.value)}function Af(e){return xn({scalars:new Map(e.map(t=>[v(t.subject),t]))})}function bE(e){return{...e,expect:{expect:e.expect.expect==="is"?"not":"is",value:e.expect.value}}}function sr(e){return`${e.test}#${String(e.index)}`}function ga(e){let t=Y(e).flatMap(r=>lr(e,r.test));return Ve(t,r=>r.id)}function lr(e,t){let r=Nf(t),n=Tf(t.actor,t.viewport),o=NE(t),a=t.steps,i=kE(e,t),s=FE(t.steps),l=AE(n,s,r),c=vE(xf(t.startingState).constraints,s);return l.reduce((d,{chunk:u,requiredState:p},y)=>({offset:d.offset+u.length,transitions:[...d.transitions,TE({chunk:u,index:y,intent:t.intent,logicalCandidates:i,logicalRequiredState:wE(c,y),namespace:r.namespace,paramSpaceOf:o,requiredState:p,testRef:ne(t),whenChunk:a.slice(d.offset,d.offset+u.length)})]}),{offset:0,transitions:[]}).transitions}function vE(e,t){return t.reduce((r,n)=>({current:ht({effects:n.flatMap(o=>o.effects),parameters:{},pattern:{constraints:r.current}}).constraints,required:[...r.required,r.current]}),{current:e,required:[]}).required}function wE(e,t){let r=e[t];if(r==null)throw new Error("logical required state missing");return r}function EE(e){return[v({kind:"viewport"}),{expect:{expect:"is",value:e},subject:{kind:"viewport"}}]}var xE=v({kind:"viewport"});function Sa(e){let t=e.scalars.get(xE);return t==null||t.expect.expect!=="is"||typeof t.expect.value!="string"?null:t.expect.value}function Tf(e,t){return{actor:e,scalars:new Map([EE(t)])}}function kE(e,t){return e.workflows.find(n=>n.name===t.workflow)?.startingState.constraints.filter(n=>n.kind==="optional-path"||n.kind==="optional-record")??[]}function Wn(e,t){return t.reduce((r,n)=>CE(n)??r,e)}function CE(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"?yp:{alias:t.target.ref.ref,kind:"user"}}function AE(e,t,r){return t.reduce((n,o)=>({requiredState:PE(n.requiredState,o,r),withRequiredState:[...n.withRequiredState,{chunk:o,requiredState:OE(n.requiredState,o)}]}),{requiredState:e,withRequiredState:[]}).withRequiredState}function PE(e,t,r){return{...e,actor:Wn(e.actor,t),scalars:Qe(e.scalars,t)}}function OE(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 If(e,t){return{namespace:Nf(t).namespace,requiredState:Tf(t.actor,t.viewport)}}function Lf(e,t){return[...new Set(e)].flatMap(r=>ME(r,t))}function Nf(e){return{namespace:new Map(e.startingState.operations.map(t=>[t.id,`$state.${t.source}.${t.target.kind==="state"?"state":t.target.path.join(".")}`]))}}function ME(e,t){let r=tr(e);if(r==null)return[];let n=t.get(r.alias);return n==null?[]:[{aliasPath:r.alias,field:r.field,recordPath:n,ref:e}]}function TE(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 a=[...new Set([...e.chunk.flatMap(s=>ua(s)),...Fr(e.requiredState),...pa(e.logicalRequiredState)])],i={actionRelationship:Pf({prior:e.requiredState,step:o}),effectStep:o,intent:e.intent,logicalCandidates:e.logicalCandidates,logicalRequiredState:e.logicalRequiredState,namespace:e.namespace,nav:r,paramSpaces:Object.fromEntries(a.filter(s=>e.paramSpaceOf.has(s)).map(s=>[s,e.paramSpaceOf.get(s)])),requiredState:e.requiredState,steps:n,test:e.testRef,wait:cl(e.chunk.flatMap(s=>IE(s))),whenSteps:e.whenChunk};return{...i,id:LE(i),index:e.index}}function IE(e){return fa(e)?["slow"]:[]}function LE(e){let t=g({...e,namespace:[...e.namespace].toSorted(([r],[n])=>r.localeCompare(n)),requiredState:Ge(e.requiredState)});return`transition_${RE("sha256").update(t).digest("base64url")}`}function NE(e){return new Map(Object.entries(e.params).map(([t,r])=>[t,r.space]))}function FE(e){return e.map(t=>[t])}function Ff(e,t){if(e.when.length>0)throw new Error(`fact "${e.name}" uses conditions that cannot be represented`);let r=xn({});return e.expect.map(n=>({consequence:n,localConsequence:!1,logicalWhen:ma,origin:{kind:"declared",name:e.name},refs:new Set,when:r}))}function et(e){return e.surfaces.filter(t=>t.by==="surface"&&t.overlay)}function ba(e,t){return{...e,scalars:Ra(e.scalars,t)}}function Ra(e,t){return $f(e,t,r=>{if(Vf(r)!=null)return{expect:{expect:"is",value:!1},subject:{kind:"element",locator:r,state:"visible"}}})}function Df(e,t){let r=$f(e.scalars,t,n=>{let o=Vf(n);if(o!=null)return{declared:!1,expect:{expect:"is",value:!1},subject:{kind:"element",locator:o,state:"visible"}}});return{...e,scalars:r}}function $f(e,t,r){let n=t.filter(o=>!e.has(Bf(o))).flatMap(o=>{let a=r(o);return a==null?[]:[[Bf(o),a]]});return n.length===0?e:new Map([...e,...n])}function Bf(e){return v({kind:"element",locator:e,state:"visible"})}function Vf(e){try{return ue(e,Be(new Map))}catch(t){if(t instanceof D)return;throw t}}var jf=new WeakMap,ml=new WeakMap;function Oe(e){return cr(e).kind==="holds"}function cr({current:e,required:t}){let r=ml.get(e)?.get(t.constraints);if(r!=null)return r;let n=BE({current:e,required:t}),o=ml.get(e);if(o!=null)return o.set(t.constraints,n),n;let a=new WeakMap;return a.set(t.constraints,n),ml.set(e,a),n}function BE({current:e,required:t}){let r=_f(t),n=_f(e);if(!r.other.every(i=>e.constraints.some(s=>zf({known:s,required:i}))))return{kind:"fails"};let a=DE({known:n.records,required:r.records});return a==null?{kind:"fails"}:{kind:"holds",witnesses:a}}function _f(e){let t=jf.get(e.constraints);if(t!=null)return t;let r={other:e.constraints.filter(n=>!Wf(n)),records:e.constraints.filter(n=>Wf(n))};return jf.set(e.constraints,r),r}function Wf(e){return e.kind==="required-record"}function DE({known:e,required:t}){if(t.length>e.length)return null;let r=t.map(n=>({alias:n.alias,indexes:$E({known:e,required:n})})).toSorted((n,o)=>n.indexes.length-o.indexes.length);return Uf({candidates:r,known:e,used:new Set})}function $E({known:e,required:t}){return e.flatMap((r,n)=>zf({known:r,required:t})?[n]:[])}function Uf({candidates:e,known:t,used:r}){let[n,...o]=e;return n==null?new Map:qf({candidates:o,indexes:n.indexes,known:t,next:n,used:r})}function qf({candidates:e,indexes:t,known:r,next:n,used:o}){let[a,...i]=t;if(a==null)return null;let s=VE({candidates:e,index:a,known:r,next:n,used:o});return s??qf({candidates:e,indexes:i,known:r,next:n,used:o})}function VE({candidates:e,index:t,known:r,next:n,used:o}){if(o.has(t))return null;let a=r[t];if(a==null)throw new Error("record witness index is out of range");let i=Uf({candidates:e,known:r,used:new Set([...o,t])});return i==null?null:new Map([...i,[n.alias,a.alias]])}function zf({known:e,required:t}){return t.kind==="relation"?e.kind==="relation"&&g(e.relation)===g(t.relation):e.kind==="relation"||ha(e)||ha(t)||!jr(e.selector,t.selector)?!1:t.kind==="required-record"?jE({known:e,required:t}):t.kind==="absent-record"?_E({known:e,required:t}):WE({known:e,required:t})}function jE({known:e,required:t}){return e.kind==="required-record"&&t.kind==="required-record"&&Hf({actual:e.fields,expected:t.fields})}function _E({known:e,required:t}){return e.kind==="absent-record"&&t.kind==="absent-record"&&Hf({actual:t.fields,expected:e.fields})}function WE({known:e,required:t}){return e.kind==="equals"&&t.kind==="equals"?ir(e.value,t.value):e.kind==="absent-path"&&t.kind==="absent-path"?!0:e.kind==="closed-record"&&t.kind==="closed-record"&&g(e.operations)===g(t.operations)}function Hf({actual:e,expected:t}){return Object.entries(t).every(([r,n])=>{let o=e[r];return o!=null&&ir(o,n)})}var Kf=new WeakMap;function gt(e){let t=Kf.get(e);if(t!=null)return t;let r=UE("sha256").update(g({consequence:e.consequence,logicalWhen:e.logicalWhen,when:Ge(e.when)})).digest("base64");return Kf.set(e,r),r}function wa(e){let t=e.facts.flatMap(a=>Ff(a,e)),r=new Set(et(e).map(a=>g(fe(a)))),n=Y(e).map(a=>gl(e,a)),o=Ve(n.flatMap(a=>a.steps.flatMap(i=>i.facts)),gt).filter(a=>!qE(a.consequence,r));return[...t,...o]}function hl(e,t){return e.filter(r=>!JE(r)||GE(r)===t)}function Ea(e){return e.kind==="not"?Ea(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 qE(e,t){if(e.kind!=="visible")return!1;let r=fe(e.locator);return t.has(g(r))?!0:r.by==="inside"&&t.has(g(fe(r.scope)))}function _r(e){let{model:t,snapshot:r}=e;if(t.facts.length===0)return r;let n=Un(e);return n.size===0?r:{...r,scalars:$e(n,r.scalars)}}function Un({logical:e,model:t,snapshot:r}){let n=Df(r,t.overlays),o=t.facts.flatMap(s=>{if(!Oe({current:e,required:s.logicalWhen}))return[];let l=ca(s.when,n);if(l==null)return[];let c=zE(s.consequence,l);return c==null?[]:[{entry:c,factKey:gt(s),key:v(c.subject)}]}),a=o.filter(s=>!KE({m:s,matched:o,overrides:t.overrides})),i=HE(a);return a.reduce((s,l)=>i.has(l.key)?s:yt(s,l.entry),ft)}function zE(e,t){let r=ae(e);if(r==null)return null;try{return Tt({declared:!0,entry:r,scope:Be(t)})}catch{return null}}function HE(e){let t=e.reduce((r,n)=>new Map([...r,[n.key,[...r.get(n.key)??[],g(n.entry.expect)]]]),new Map);return new Set([...t].flatMap(([r,n])=>new Set(n).size>1?[r]:[]))}function KE({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 JE(e){return e.origin?.kind==="test"&&e.localConsequence}function GE(e){let{origin:t}=e;if(!(t==null||t.kind!=="test"))return t.test}var Jf=new WeakMap;function gl(e,t){let r=Jf.get(t);if(r!=null)return r;let n=YE(e,t);return Jf.set(t,n),n}function YE(e,{test:t,workflow:r}){let n=If(e,t),o=et(e),a=ZE(r.steps),i=t.steps.reduce((s,l)=>{let c=QE(s.requiredState,l,o),d=ht({effects:l.effects,parameters:{},pattern:s.logicalRequiredState}),u=ex({branchConditions:a,logicalPost:d,namespace:n.namespace,origin:{kind:"test",test:ne(t)},paramNames:new Set(Object.keys(t.params)),post:c,pre:s.requiredState,step:l});return{logicalRequiredState:d,requiredState:c,steps:[...s.steps,{facts:u,logicalPost:d,post:c}]}},{logicalRequiredState:{constraints:t.startingState.constraints},requiredState:ba(n.requiredState,o),steps:[]});return{initial:ba(n.requiredState,o),logicalInitial:{constraints:t.startingState.constraints},steps:i.steps}}function ZE(e){return e.flatMap(r=>r.expect).flatMap(r=>va(r)).reduce((r,n)=>{let o=g(n.consequence),a=r.get(o),i=a==null?n.condition:{kind:"or",predicates:[a,n.condition]};return new Map([...r,[o,i]])},new Map)}function va(e){return e.kind==="not"?va(e.predicate):e.kind==="and"||e.kind==="or"?e.predicates.flatMap(t=>va(t)):e.kind!=="when"?[]:e.branches.flatMap((t,r)=>{let n=XE(e.branches,r);return t.consequence.flatMap(o=>[{condition:n,consequence:o},...va(o)])})}function XE(e,t){let r=e.slice(0,t).flatMap(a=>a.condition==null?[]:[a.condition]).map(a=>({kind:"not",predicate:a})),n=e[t]?.condition,o=n==null?r:[...r,n];return o.length===1&&o[0]!=null?o[0]:{kind:"and",predicates:o}}function QE(e,t,r){let n=Qe(e.scalars,[t]),o=Wn(e.actor,[t]);return ba({...e,actor:o,scalars:n},r)}function ex(e){return Dr(e.step.expect).filter(t=>Ea(t)).flatMap(t=>tx(t,e))}function tx(e,t){let r=ae(e);if(r==null)return[];if(mt(e).some(i=>t.paramNames.has(i)))return[];let n=v(r.subject);if(t.branchConditions.has(g(e)))return[];let o={...t.post,scalars:new Map([...t.post.scalars].filter(([i])=>i!==n))},a=rx(o,t.pre,t.paramNames);return a==null?[]:Ge(a)===Ge(t.pre)?[]:[{consequence:e,localConsequence:mt(e).length>0||r.subject.kind==="element"&&Zo(r.subject.locator).some(i=>typeof i!="string"),logicalWhen:t.logicalPost,origin:t.origin,refs:new Set(Lf([...ox(a),...mt(e)],t.namespace).map(i=>i.aliasPath)),when:a}]}function rx(e,t,r){let n=[...e.scalars.values()].map(o=>nx(o,t,r));return n.some(o=>o==null)?null:{...e,scalars:new Map(n.flatMap(o=>o==null?[]:[[v(o.subject),o]]))}}function nx(e,t,r){if(!Gf(e,r))return e;if(e.subject.kind!=="element"||e.expect.expect==="absent"||Fe(e.subject.locator).some(o=>r.has(o)))return null;let n=t.scalars.get(v(e.subject));return n==null||n.expect.expect!=="is"||Gf(n,r)?null:{expect:{expect:"not",value:n.expect.value},subject:e.subject}}function Gf(e,t){return sl(e).some(r=>t.has(r))}function ox(e){return[...e.scalars.values()].flatMap(t=>Mt(t.subject)&&t.expect.expect!=="absent"?Ct(t.expect.value):[])}function Yf(e,t,r){let n=o=>e(o,...t);return r===void 0?n:Object.assign(n,{lazy:r,lazyArgs:t})}function Zf(e,t,r){let n=e.length-t.length;if(n===0)return e(...t);if(n===1)return Yf(e,t,r);throw Error("Wrong number of arguments")}function qn(...e){return Zf(ax,e)}var ax=(e,t)=>{let r=Object.create(null);for(let n=0;n<e.length;n++){let o=e[n],a=t(o,n,e);if(a!==void 0){let i=r[a];i===void 0?r[a]=[o]:i.push(o)}}return Object.setPrototypeOf(r,Object.prototype),r};var Qf=new Map;function xa({facts:e}){let t=qn(e.filter(o=>ae(o.consequence)!=null),o=>ix(o));return Object.values(t).flatMap(o=>o.flatMap(a=>o.filter(i=>i!==a).map(i=>({general:a,specific:i})))).reduce((o,{general:a,specific:i})=>{if(!(At({general:a.when,specific:i.when})&&Oe({current:i.logicalWhen,required:a.logicalWhen}))||At({general:i.when,specific:a.when})&&Oe({current:a.logicalWhen,required:i.logicalWhen}))return o;let c=gt(a),d=o.get(c)??new Set;return new Map([...o,[c,new Set([...d,gt(i)])]])},Qf)}function ey(e){let t=ae(e.consequence);if(t==null)return null;try{let r=Tt({declared:!0,entry:t,scope:Be(new Map)});return v(r.subject)}catch{return null}}function ix(e){let t=ae(e.consequence);if(t==null)throw new Error("fact consequence has no pattern entry");return v(t.subject)}function ty(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 ka=ty(e=>{let t=wa(e);return{facts:t,overrides:xa({facts:t})}});function ry(e,t){let{pool:r,timelines:n}=lx(e,t),o=r.map(i=>Sa(i.fact.when)),a=[...n.values()].map(i=>{let s=i.locked.test.viewport,l=r.filter((c,d)=>o[d]==null||o[d]===s);try{return cx({entry:i,pool:l,resolve:sx})}catch(c){let d=c instanceof Error?c.message:String(c);throw new Error(`fact report for ${i.locked.ref}: ${d}`)}});return{pool:r,reports:a}}function ny(e,t){return{...oy(e.consequence),declared:e.origin?.kind==="test",key:gt(e),label:ep(e.consequence),labelTokens:bp(e.consequence),origins:t}}function sx(e,t){return At({general:e,specific:t})}function lx(e,t){let r=Y(e),n=new Map(r.map(i=>[i.ref,{locked:i,timeline:gl(e,i)}])),o=px(n);return{pool:fx({facts:t,originSites:o}),timelines:n}}function cx(e){let{entry:t,pool:r,resolve:n}=e,{locked:o}=t,a=new Set(t.timeline.steps.flatMap(c=>c.facts.map(d=>g(d.consequence)))),i=r.filter(c=>!c.originWorkflows.has(o.test.workflow)).filter(c=>!a.has(c.consequenceKey)),s=dx({candidates:i,resolve:n,timeline:t.timeline});return{steps:t.timeline.steps.map((c,d)=>({borrowed:s.filter(u=>u.stepIndex===d).map(u=>u.borrowed),stepIndex:d})),testRef:o.ref,testSlug:o.test.slug,workflowSlug:o.test.workflow}}function dx({candidates:e,resolve:t,timeline:r}){let o=[{logical:r.logicalInitial,snapshot:r.initial},...r.steps.map(a=>({logical:a.logicalPost,snapshot:a.post}))].reduce((a,i,s)=>{let d=e.filter(p=>!a.has(p)).filter(p=>Oe({current:i.logical,required:p.fact.logicalWhen})).filter(p=>t(p.fact.when,i.snapshot)),u=s===0?0:s-1;return new Map([...a,...d.map(p=>[p,u])])},new Map);return r.steps.length===0?[]:[...o].map(([a,i])=>({borrowed:a.borrowed,stepIndex:i}))}function ux(e,t){return{stepIndex:t,testRef:e.ref,testSlug:e.test.slug,workflowIntent:e.workflow.intent,workflowSlug:e.test.workflow}}function px(e){let t=[...e.values()].flatMap(r=>r.timeline.steps.flatMap((n,o)=>n.facts.map(a=>[gt(a),ux(r.locked,o)])));return new Map(Object.entries(qn(t,([r])=>r)).map(([r,n])=>[r,n.map(([,o])=>o)]))}function fx({facts:e,originSites:t}){return e.filter(r=>!(r.origin?.kind==="test"&&r.localConsequence)).map(r=>{let n=gt(r),a=r.origin?.kind==="test"?t.get(n)??[]:[];return{borrowed:ny(r,a),consequenceKey:g(r.consequence),fact:r,originWorkflows:new Set(a.map(i=>i.workflowSlug))}}).filter(r=>r.borrowed.origins.length>0)}function oy(e){if(e.kind==="not"){let t=oy(e.predicate);return{...t,negated:!t.negated}}return"locator"in e?{checkKind:e.kind,negated:!1,subject:yx(e.locator)}:{checkKind:void 0,negated:!1,subject:void 0}}function yx(e){try{return Yo(ue(e,Be(new Map)))}catch(t){if(t instanceof D)return tp(e);throw t}}function sy(e){let t=Ve(e,Ge),r=Ve(t.flatMap(a=>[...a.scalars.values()]),g),n=ay(r,g),o=ay(t,Ge);return{patternTable:t.map(a=>({actor:a.actor,scalars:[...a.scalars.values()].map(i=>iy(n,g(i)))})),scalarTable:r.map(a=>({expect:a.expect,subject:a.subject})),indexOf:a=>iy(o,Ge(a))}}function ly(e){return e.patternTable.map(t=>({actor:t.actor,scalars:new Map(t.scalars.map(r=>{let n=Sl(e.scalarTable,r);return[v(n.subject),n]}))}))}function Sl(e,t){let r=e[t];if(r==null)throw new Error(`compiled checks table entry ${String(t)} is missing \u2014 the lockfile is stale or corrupt`);return r}function ay(e,t){return new Map(e.map((r,n)=>[t(r),n]))}function iy(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks pattern missing from table");return r}function dy(e){let t=ka(e),{pool:r,reports:n}=ry(e,t.facts),o=sy(t.facts.flatMap(s=>Sx(s))),a=new Map(t.facts.map((s,l)=>[s,l])),i=new Map(r.map((s,l)=>[s.borrowed,l]));return{factPool:r.map(s=>({fact:uy(a,s.fact),origins:s.borrowed.origins.map(l=>({...l}))})),factReports:n.map(s=>vx(s,i)),facts:t.facts.map(s=>bx(s,o)),overrides:Rx(t.overrides),patternTable:o.patternTable,scalarTable:o.scalarTable}}var cy=new WeakMap;function Wr(e){let t=cy.get(e);if(t!=null)return t;let r=mx(e),n=ly(r),o={facts:r.facts.map(a=>hx(a,n)),overrides:gx(r.overrides)};return cy.set(e,o),o}function mx(e){return e.checks}function uy(e,t){let r=e.get(t);if(r==null)throw new Error("compiled checks item missing from index");return r}function hx(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,logicalWhen:{constraints:e.logicalWhen},origin:e.origin,refs:new Set(e.refs),when:Sl(t,e.when)}}function gx(e){return new Map(Object.entries(e).map(([t,r])=>[t,new Set(r)]))}function Sx(e){return[e.when]}function bx(e,t){return{consequence:e.consequence,localConsequence:e.localConsequence,logicalWhen:[...e.logicalWhen.constraints],origin:e.origin,refs:[...e.refs],when:t.indexOf(e.when)}}function Rx(e){return Object.fromEntries([...e].map(([t,r])=>[t,[...r].toSorted((n,o)=>n.localeCompare(o))]).toSorted(([t],[r])=>t.localeCompare(r)))}function vx(e,t){return{steps:e.steps.map(r=>({borrowed:r.borrowed.map(n=>uy(t,n)),stepIndex:r.stepIndex})),testRef:e.testRef,testSlug:e.testSlug,workflowSlug:e.workflowSlug}}var M=Vs(yy(),1),Me={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))},kx={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,precondition:M.default.yellow,reachability:M.default.yellow,redundancy:M.default.yellow,skipped:M.default.red,state:M.default.magenta,surface:M.default.yellow,value:M.default.yellow,"workflow gap":M.default.red};function le(e){return`${M.default.red(M.default.bold("\u2717"))} ${kx[e](M.default.bold(e))}`}var Cx=M.default.red("\u2717"),lj=M.default.green("\u2713"),Ax=M.default.dim("\u203A"),Px=8;function my(e,t,r){let n=r==null?"":` ${Me.dim(r)}`;return` ${Me.dim(e.padStart(Px))} ${t}${n}`}function hy(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)":Ox(t.value)}function Ox(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}}`:`{${Qu(t)}}`).join(""):`{${e.ref}}`}function Pa(e){let t=[...e.scalars.values()].filter(r=>r.subject.kind!=="path").filter(r=>!Sy(r)).map(r=>Oa(r));return t.length===0?"always":t.join(" \u2227 ")}function Oa(e){let t=Mx(e.subject);return e.expect.expect==="absent"?`${t} absent`:e.subject.kind==="element"&&Tx(e.expect.value)?e.expect.value?t:`not ${t}`:`${t} ${e.expect.expect==="not"?"\u2260":"="} ${Nt(e.expect.value)}`}function ie(e){return e.by==="role"?e.name==null?e.role:`${e.role} ${Nt(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)}`:Nt(e.value)}function Nt(e){return e===null?"\u2205":typeof e=="string"?`"${e}"`:typeof e!="object"?String(e):"ref"in e?`{${e.ref}}`:Rl(e)}function Rl(e){return e.template.map(t=>typeof t=="string"?t:":id").join("")}function gy(e,t){let r=new Set(t.scalars.keys()),n=[...e.scalars].filter(([o])=>!r.has(o)).map(([,o])=>o).filter(o=>o.subject.kind!=="path"&&!Sy(o)).map(o=>Oa(o));return n.length===0?"nothing beyond the shared state":n.join(" \u2227 ")}function Sy(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 Mx(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 Tx(e){return typeof e=="boolean"}function ce(e){return e.by==="testId"?`testId=${kt(e.value)}`:e.by==="inside"?`${ce(e.scope)} \u25B8 ${ce(e.target)}`:e.by==="surface"?ce(e.container):e.by==="frame"?`frame ${ce(e.element)}`:e.name==null?e.role:`${e.role} "${kt(e.name)}"`}function zn(e){return e.kind==="variable"?`global variable "${e.name}"`:e.kind==="element"?`${e.state} ${ce(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 Ma(e){return e.url!=null?`${e.kind} ${kt(e.url)}`:e.locator!=null?`${e.kind} ${ce(e.locator)}`:e.kind}function Ft(e){return e==null?"\u2205":JSON.stringify(e)}function Ta(e){let t=e.want==null?"absent":Nt(e.want),r=e.got===void 0?"absent":Nt(e.got);return`${Ix(e.subject)} needed ${t} but was ${r}`}function Ix(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 Lx={"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 vl(e){return Lx[e]}function by({debugDir:e,runId:t}){let r=`${e}/${t}`;return my("behavior",Me.path(`${r}/behavior.jsonl`),void 0)}function Bt(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} ${Nx(e.url)}`:e.kind}function Nx(e){return typeof e=="string"?e:"ref"in e?`{${e.ref}}`:Rl(e)}function je(e){return e.kind==="not"?`not ${je(e.predicate)}`:e.kind==="and"?e.predicates.map(t=>je(t)).join(" \u2227 "):e.kind==="when"?e.branches.map(t=>t.name).join(" | "):Fx(e)}function Fx(e){return"locator"in e?Bx(e):e.kind==="browser"?`${e.name}=${Nt(e.value)}`:e.kind==="actor"?e.target.kind==="anonymous"?"actor is signed out":`actor is ${e.target.ref.ref}`:""}function Bx(e){let t=ie(e.locator);if(e.kind==="value"||e.kind==="text"){let r=ct(e.value)?e.value.value:e.value;return`${e.kind} ${t}=${Nt(r)}`}return`${e.kind} ${t}`}function Ry({contradiction:e,evidencePath:t}){let r=Dx(e);return t==null?r:`${r} Evidence: ${Me.path(t)}`}function Ia(e){return`${Vx(e)}.`}function La(e){return Zx(jx(e))}function Dx(e){switch(e.kind){case"check":{let t=` After "${e.step.intent}".`;return`${$x(e.record.body)} ${Ia(e.record.body)}${t}`}case"stepError":return`${le("driver")} Run stopped at "${e.step.intent}" \u2014 ${Qt(e.record.error)}.`;case"finding":return Jx(e.finding)}}function $x(e){switch(e.family){case"element":case"content":case"scalar":return le("assertion");case"state":case"frame":return le("state");case"action":return le("action");case"dataRule":return le("data rule")}}function Vx(e){switch(e.family){case"element":return`Expected ${Yt(e)} ${e.negated?"not ":""}${e.checkKind} \u2014 ${_x(e)}`;case"content":return`Expected ${Yt(e)} ${e.checkKind} ${Kx(e.match)} ${JSON.stringify(e.expected)}${e.negated?" to not hold":""} \u2014 ${Wx(e)}`;case"scalar":return`Expected ${Yt(e)} to ${e.negated?"not ":""}be ${vy(e.expected)} \u2014 ${Ux(e)}`;case"state":return`Expected ${e.subject} ${e.assertion} \u2014 ${qx(e)}`;case"frame":return`Unexpected change \u2014 ${zx(e)}`;case"action":return`Could not ${up(e)} ${Yt(e)} \u2014 ${Hx(e)}`;case"dataRule":return`Data rule ${e.rule} broke \u2014 a referenced row went missing`}}function jx(e){switch(e.kind){case"check":return pp(e.record.body)??Ia(e.record.body);case"stepError":return`run stopped at "${e.step.intent}": ${Qt(e.record.error)}`;case"finding":return Gx(e.finding)}}function wl(e){switch(e.kind){case"wrongValue":return`${e.entity}.${e.field} [${e.key}] showed ${Me.actual(e.observed)}, expected ${Me.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 ${Me.actual(e.observed)})`:`${e.entity}.${e.field} [${e.key}] never changed from ${Me.actual(e.observed)}`;case"wrongCount":return`found ${String(e.observed)} ${e.entity} rows, expected ${String(e.expected)}`}}function Ur(e){let{outcome:t}=e;return t.kind==="passed"?null:t.reason}function _x(e){let t=Ur(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 Wx(e){let t=Ur(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 Ux(e){let t=Ur(e);return t==null?"held":`it showed ${vy(t.observed)}`}function vy(e){return e??"absent"}function qx(e){let t=Ur(e);return t==null?"held":wl(t)}function zx(e){let t=Ur(e);return t==null?"none was seen":fp(t)}function Hx(e){let t=Ur(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 current test state does not allow this action";case"unclassified":return t.message}}function Kx(e){switch(e){case"exact":return"to equal";case"contains":return"to contain";case"startsWith":return"to start with"}}function Jx(e){switch(e.kind){case"impossible-action":return`${le("impossible action")} "${e.step.intent}" ran ${Ma(e.step.action)} from a state the test calls impossible.`;case"unrunnable":return`${le("workflow gap")} "${e.intent}" couldn't run here \u2014 ${wy(e)}.`;case"lift-visibility":return`${le("reachability")} ${ie(e.locator)} is visible by step ${String(e.visibleIndex+1)} but declared at step ${String(e.declaredIndex+1)}.`}}function wy(e){return e.unmet==null?vl(e.reason):Ta(e.unmet)}function Gx(e){switch(e.kind){case"impossible-action":return`"${e.step.intent}" ran from a state the test says can't happen`;case"unrunnable":return`workflow gap: "${e.intent}" could not run here \u2014 ${wy(e)}. Add the missing before-state declaration, then run npx ripplo compile`;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 Yx=new RegExp(`${String.fromCodePoint(27)}\\[[0-9;]*m`,"g");function Zx(e){return e.replaceAll(Yx,"").replaceAll(/\s+/g," ").trim()}import{performance as Wa}from"perf_hooks";function Ey(e,{clears:t,forget:r,sets:n}){let o=new Set(t),a=Xx(e,r,n),i=[...e.scalars].filter(([l,c])=>!o.has(l)&&!(a&&(rl(c.subject)||Qx(c.subject)))),s=[...n.values()].reduce((l,c)=>yt(l,c),new Map(i));return{...e,scalars:s}}function Xx(e,t,r){if(t==="hard")return!0;if(t==="none")return!1;let n=K(e.scalars,{kind:"path"}),o=K(r,{kind:"path"});return o!==void 0&&o!==n}function Qx(e){return e.kind==="query"||e.kind==="hash"}function El(e){return e.kind==="not"?El(e.inner):e.kind==="browser"&&zp(e.key)}function zr(e,t){let{executedBranches:r,step:n}=e,{env:o}=t,a=sp({executedBranches:r,expect:n.expect}),i=t.logical,s=t.snapshot==null?void 0:K(t.snapshot.scalars,{kind:"actor"}),l=Ln({actorAlias:s,current:i?.current,deferred:t.deferred,env:o,witnesses:t.witnesses}),c=Ln({actorAlias:s,current:i?.current,deferred:new Set([...t.deferred,...jn(n.effects).map(f=>rr(f,t.witnesses))]),env:o,witnesses:t.witnesses}),{actionScalars:d,clears:u,sets:p}=ik({leaves:a,scope:c,step:n}),y=fa(n),m=lk(n.action,l),h=ek(n,a);return{action:m,actionScalars:d,assertedScalars:[...p.keys()],executedBranches:r,expectationScalars:rk(a,c),label:n.action.kind,pendingChecks:a.flatMap(f=>uk(f,c,y)),scalarChecks:a.flatMap(f=>nk(f,c)),urlChecks:a.flatMap(f=>dk(qr(f),c)),effect:f=>Ey(f,{clears:u,forget:h,sets:p})}}function ek(e,t){return e.action.kind==="goto"||e.action.kind==="actor"||tk(t)?"hard":ar(e)?"soft-path":"none"}function tk(e){return e.some(t=>t.predicate.kind==="actor")}function rk(e,t){return e.flatMap(r=>{let n=ae(qr(r));if(n==null)return[];let o=kl({declared:!0,entry:n,scope:t});return o==null?[]:[o]})}function qr(e){return e.negated?{kind:"not",predicate:e.predicate}:e.predicate}function nk(e,t){let{predicate:r}=e;if(r.kind!=="browser"&&r.kind!=="actor")return[];let n=ae(qr(e));if(n==null)return[];try{let o=Tt({declared:!0,entry:n,scope:t});return Jp(o.expect)==null?[]:[{entry:o,negated:e.negated,ref:{branch:e.branch,ordinal:e.ordinal}}]}catch(o){if(o instanceof D)return[];throw o}}function xl(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:ue(e.locator,t)};if(e.kind==="not"){let r=xl(e.predicate,t);return r==null?null:{inner:r,kind:"not"}}return e.kind==="value"||e.kind==="text"?ok(e,t):e.kind!=="browser"?null:{key:la(e.name,e.part),kind:"browser",value:e.value===null?null:De(e.value,t)}}function ok(e,t){let r=ct(e.value);return{kind:e.kind,locator:ue(e.locator,t),match:r?e.value.kind:"exact",value:De(r?e.value.value:e.value,t)}}function ak(e){return e.action.kind!=="actor"?null:{expect:{expect:"is",value:e.action.ref.ref},subject:{kind:"actor"}}}function ik({leaves:e,scope:t,step:r}){let n=r.action.kind==="goto"?Dn(r.action.url):[],o=ak(r),a=e.filter(c=>!Zt(qr(c))).flatMap(c=>{let d=ae(qr(c));return d==null?[]:[d]}),i=[...n,...a,...o==null?[]:[o]].map(c=>({declared:!0,entry:c})),s=Lt(r).map(c=>({declared:!1,entry:c}));return{...[...s,...i].reduce((c,{declared:d,entry:u})=>sk({acc:c,declared:d,entry:u,scope:t}),{actionScalars:[],clears:[],sets:ft}),actionScalars:s.flatMap(({declared:c,entry:d})=>{let u=kl({declared:c,entry:d,scope:t});return u==null?[]:[u]})}}function sk({acc:e,declared:t,entry:r,scope:n}){let o=kl({declared:t,entry:r,scope:n});return o==null?e:o.expect.expect==="absent"&&!Mt(o.subject)?{...e,clears:[...e.clears,v(o.subject)]}:{...e,sets:yt(e.sets,o)}}function kl({declared:e,entry:t,scope:r}){try{return Tt({declared:e,entry:t,scope:r})}catch(n){if(n instanceof D)return;throw n}}function lk(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:ck(e,t),target:e.kind==="drag"?ue(e.target,t):void 0,url:e.kind==="goto"?De(e.url,t):void 0,value:"value"in e?Ot(e.value,t):void 0}}function ck(e,t){if(e.kind==="drag")return ue(e.source,t);if(!(!("locator"in e)||e.locator==null))return ue(e.locator,t)}function dk(e,t){if(e.kind!=="browser"&&e.kind!=="not")return[];let r=xl(e,t);return r!=null&&El(r)?[r]:[]}function uk(e,t,r){let n=qr(e),o=xl(n,t);return e.predicate.kind==="browser"&&o!=null&&!xy(o)?[]:pk({check:o,leaf:e,navigates:r,predicate:n})}function xy(e){return e.kind==="not"?xy(e.inner):e.kind!=="browser"?!1:e.value!==null&&q(e.value)}function pk({check:e,leaf:t,navigates:r,predicate:n}){return e==null?[]:[{budget:fk(t.predicate,r),check:e,ephemeral:Zt(n),ref:{branch:t.branch,ordinal:t.ordinal}}]}function fk(e,t){return"wait"in e&&e.wait!=null?e.wait:t?"slow":"fast"}function ky(e,t,r){return e.reduce((n,o)=>{let a={...r,logical:n.logical,snapshot:n.snapshot},i=gk(o,n.snapshot,a),s=Sk(o,i);return{logical:Cy(s,n.logical),resolved:[...n.resolved,{executedBranches:i,step:s}],snapshot:n.snapshot}},{logical:r.logical,resolved:[],snapshot:t}).resolved}function Na(e,t){return e.kind==="not"?!Na(e.predicate,t):e.kind==="or"?e.predicates.some(r=>Na(r,t)):e.kind==="and"?e.predicates.every(r=>Na(r,t)):yk(e,t)}function yk(e,t){return e.kind==="state-relation"?t.logical!=null&&Bp({actorAlias:K(t.snapshot.scalars,{kind:"actor"}),current:t.logical.current,env:t.env,relation:e.relation,witnesses:t.witnesses}):e.kind==="state-compare"||e.kind==="state-equals"?mk({condition:e,logical:t.logical}):e.kind==="viewport"?K(t.snapshot.scalars,{kind:"viewport"})===e.value:hk(e,t.logical)}function mk({condition:e,logical:t}){return t==null?!1:e.kind==="state-compare"?pl({current:t.current,op:e.op,selector:e.selector,value:e.value}):vf({current:t.current,selector:e.selector,value:e.value})}function hk(e,t){return t!=null&&ul({alias:e.alias,candidates:t.candidates,current:t.current})}function gk(e,t,r){let n=Cy(e,r.logical);return e.expect.filter(o=>o.kind==="when").flatMap(o=>{let a=o.branches.find(i=>i.condition==null||Na(i.condition,{env:r.env,logical:n,snapshot:t,witnesses:r.witnesses}));return a==null?[]:[a.name]})}function Cy(e,t){if(t!=null)return{candidates:t.candidates,current:ht({effects:e.effects,parameters:{},pattern:t.current})}}function Sk(e,t){return{...e,effects:[...e.effects,...ip({executedBranches:t,expect:e.expect})]}}function Ay({effects:e,witnesses:t}){return t.size===0?e:e.map(r=>bk({effect:r,witnesses:t}))}function Py({effects:e,ordinal:t}){return new Map(jn(e).map(r=>[r,`${r}@${String(t)}`]))}function bk({effect:e,witnesses:t}){let r=Oy(t);switch(e.kind){case"set":case"create-path":case"delete-path":return e;case"transform":return{...e,relation:Gt({map:r,relation:e.relation})};case"create-record":return{...e,as:rr(e.as,t),fields:Rk({fields:e.fields,witnesses:t})};case"delete-selected-records":return{...e,selection:En({map:r,selection:e.selection})};case"update-selected-records":return{...e,changes:vk({fields:e.changes,witnesses:t}),selection:En({map:r,selection:e.selection})}}}function Oy(e){return t=>({...t,record:rr(t.record,e)})}function Rk({fields:e,witnesses:t}){return Object.fromEntries(Object.entries(e).map(([r,n])=>n.kind!=="reference"?[r,n]:[r,{...n,record:rr(n.record,t)}]))}function vk({fields:e,witnesses:t}){let r=Oy(t);return Object.fromEntries(Object.entries(e).map(([n,o])=>o.kind==="transform"?[n,{kind:"transform",relation:Gt({map:r,relation:o.relation})}]:o.kind!=="reference"?[n,o]:[n,{...o,record:rr(o.record,t)}]))}function Hn(e,t,r){let n=Object.keys(r).length===0?t.base:Cl({base:t.base,params:r});return wk({state:{...t,base:n},transition:e})}function wk({state:e,transition:t}){let r=al({base:e.base,deferred:e.deferred,logical:e.logical,pattern:t.requiredState,snapshot:e.snapshot,witnesses:e.witnesses});return r==null?null:new Map([...e.base,...r])}function Cl({base:e,params:t}){return new Map([...e,...Object.entries(t).map(([r,n])=>[H(r),n])])}function Kn(e,t,r){let n={deferred:r.deferred,env:t,logical:{candidates:e.logicalCandidates,current:r.logical},snapshot:r.snapshot,witnesses:r.witnesses},o=ky(e.whenSteps,r.snapshot,n),a=Py({effects:o.flatMap(u=>u.step.effects),ordinal:r.ordinal}),i={...n,witnesses:new Map([...r.witnesses,...a])},s=o.at(-1)??{executedBranches:[],step:e.effectStep},l=zr(s,i),c=Ek(e,i),d=o.reduce((u,p)=>{let y=zr(p,{...i,snapshot:u.current});return{current:y.effect(u.current),steps:[...u.steps,{action:y.action,actionScalars:y.actionScalars,assertedScalars:y.assertedScalars,effect:y.effect,effects:Ay({effects:p.step.effects,witnesses:i.witnesses}),executedBranches:p.executedBranches,expectationScalars:y.expectationScalars,pendingChecks:y.pendingChecks,scalarChecks:y.scalarChecks,source:p.step,urlChecks:y.urlChecks}]}},{current:r.snapshot,steps:[]});return{effect:xk(l.effect,c),steps:d.steps}}function Fa(e,t,r){return Dt(t(r))!==Dt(r)||e.steps.length>0}var My=new WeakMap;function Dt(e){let t=My.get(e);if(t!=null)return t;let r=g({scalars:nl(e.scalars).map(([n,o])=>[n,o.expect])});return My.set(e,r),r}function Ek(e,t){let r=e.nav.at(-1);if(r==null)return;let n=zr({executedBranches:[],step:r},t).action.url;return n==null||q(n)?void 0:n}function xk(e,t){if(t==null)return e;let r=Nr(t);return n=>{let o={...n,scalars:$e(n.scalars,r)};return e(o)}}function Ty({effects:e,parameters:t,pattern:r}){return e.every(n=>kk({effect:n,parameters:t,pattern:r}))}function kk({effect:e,parameters:t,pattern:r}){return e.kind==="update-selected-records"?pf({constraints:r.constraints,effect:e,parameters:t}):e.kind!=="transform"?!0:r.constraints.filter(n=>n.kind==="equals"&&g(n.selector)===g(e.selector)&&n.value.kind==="value").every(n=>n.kind!=="equals"||n.value.kind!=="value"||ra({before:n.value.value,context:{parameters:t,records:{},state:{}},relation:e.relation}).kind!=="invalid")}function dr(e,t,r){let n=Iy(e,t);return n==null?null:Ny({context:n,params:r,rule:e,state:t})}var Al=new WeakMap;function Iy(e,t){if(!ol({pattern:e.requiredState,snapshot:t.snapshot}))return null;let r=cr({current:t.logical,required:{constraints:e.logicalRequiredState}});if(r.kind==="fails")return null;let n=Ly({rule:e,witnesses:r.witnesses});if(Ck(e))return{env:void 0,witnesses:n};let o=Fy({params:{},rule:e,state:{...t,witnesses:n}});return o==null?null:{env:o,witnesses:n}}function Ly({rule:e,witnesses:t}){if(e.logicalRequiredState.filter(n=>n.kind==="required-record"&&!t.has(n.alias)).length>0)throw new Error("guard proof left a required record without a witness");return t}function Ck(e){let t=Al.get(e);if(t!=null)return t;if(Object.keys(e.paramSpaces).length===0)return Al.set(e,!1),!1;let r=new Set(Object.keys(e.paramSpaces)),n=Fr(e.requiredState).some(o=>r.has(o));return Al.set(e,n),n}function Jn(e,t,r){if(!ol({pattern:e.requiredState,snapshot:t.snapshot}))return"required-state-unsatisfied";let n=cr({current:t.logical,required:{constraints:e.logicalRequiredState}});if(n.kind==="fails")return"required-state-unsatisfied";let o={...t,witnesses:Ly({rule:e,witnesses:n.witnesses})};try{let a=Hn(e,o,r);return a==null?"required-state-unsatisfied":(Kn(e,a,o),"no-effect")}catch(a){if(a instanceof D)return"unresolvable";throw a}}function Ny({context:e,params:t,rule:r,state:n}){let o={...n,witnesses:e.witnesses},a=e.env==null?Fy({params:t,rule:r,state:o}):Cl({base:e.env,params:t});if(a==null)return null;let i=Ok(r,a,o);if(i==null||!Ak(i)||!Pk({resolved:i,rule:r,state:n})||!Fa(r,i.effect,n.snapshot))return null;let s=i.steps.flatMap(c=>c.effects);if(!Ty({effects:s,parameters:t,pattern:n.logical}))return null;let l=ht({effects:s,parameters:t,pattern:n.logical});return{next:{base:wf({after:l,before:n.logical,env:n.base}),deferred:Ef({after:l,deferred:n.deferred,effects:s}),logical:l,ordinal:n.ordinal+1,snapshot:i.effect(n.snapshot)},resolved:i}}function Ak(e){return e.steps.every(t=>Mf(t.expectationScalars))}function Pk({resolved:e,rule:t,state:r}){if(t.actionRelationship==null)return!0;if(t.actionRelationship==="undecided")return!1;let n=e.steps.at(-1);return n==null?!1:Of({effects:n.actionScalars,prior:r.snapshot.scalars})===t.actionRelationship}function Fy({params:e,rule:t,state:r}){try{return Hn(t,r,e)}catch(n){if(n instanceof D)return null;throw n}}function Ok(e,t,r){try{return Kn(e,t,r)}catch(n){if(n instanceof D)return null;throw n}}function Pl({attempts:e,paramsForAttempt:t,rule:r,state:n}){return By({attempts:e,paramsForAttempt:t,rule:r,state:n}).prepared}function By({attempts:e,paramsForAttempt:t,rule:r,state:n}){let o=Iy(r,n);return o==null?{parameterAttempts:0,prepared:null}:$y({attempt:0,attempts:e,context:o,paramsForAttempt:t,rule:r,state:n})}function Dy(e,t,r){return e.reduce((n,o)=>{if(n.runs.length===r.limit)return n;let a=By({attempts:r.attemptsFor(o),rule:o,state:t,paramsForAttempt:s=>r.paramsFor(o,s)}),i=a.prepared;return i==null?{parameterAttempts:n.parameterAttempts+a.parameterAttempts,rulesConsidered:n.rulesConsidered+1,runs:n.runs}:{parameterAttempts:n.parameterAttempts+a.parameterAttempts,rulesConsidered:n.rulesConsidered+1,runs:[...n.runs,{label:sr(o),parameterAttempt:i.parameterAttempt,params:i.params,stepRun:i.stepRun,transitionId:o.id}]}},{parameterAttempts:0,rulesConsidered:0,runs:[]})}function $y({attempt:e,attempts:t,context:r,paramsForAttempt:n,rule:o,state:a}){if(e===t)return{parameterAttempts:t,prepared:null};let i=n(e),s=Ny({context:r,params:i,rule:o,state:a});return s==null?$y({attempt:e+1,attempts:t,context:r,paramsForAttempt:n,rule:o,state:a}):{parameterAttempts:e+1,prepared:{parameterAttempt:e,params:i,stepRun:s}}}import{okAsync as Vk}from"neverthrow";function jy({plan:e,state:t}){let r=_y({pending:e.operations,results:{},state:t});return new Map(Object.entries(r).flatMap(([n,o])=>x(o)?Object.entries(o).flatMap(([a,i])=>$k(i)?[[H(`${n}.${a}`),i]]:[]):[]))}function _y({pending:e,results:t,state:r}){if(e.length===0)return t;let n=e.filter(a=>Ar(a.input).every(i=>Object.hasOwn(t,i)));if(n.length===0)return t;let o=Object.fromEntries(n.flatMap(a=>{let i=Ol({expression:a.input,results:t});return i.found?[[a.id,Mk({operation:a,state:r,value:i.value}).value]]:[]}));return _y({pending:e.filter(a=>!n.some(i=>i.id===a.id)),results:{...t,...o},state:r})}function Mk({operation:e,state:t,value:r}){let n=Tk({operation:e,state:t}).value,o=Wy({schema:n,token:`${e.id}.`});return o.found?qy({base:r,overlay:o.value}):ye(r)}function Tk({operation:e,state:t}){let r=Vy({key:e.source,schema:t.jsonSchema}).value;if(e.target.kind==="state")return ye(r);let n=e.target.path.reduce((a,i)=>Vy({key:i,schema:a}).value,r),o=_e({key:"additionalProperties",value:n}).value;if(o===void 0||typeof o=="boolean")throw new TypeError(`state schema record ${e.target.path.join(".")} has no row`);return ye(o)}function Vy({key:e,schema:t}){let r=_e({key:"properties",value:t}).value,n=_e({key:e,value:r}).value;if(n===void 0)throw new TypeError(`state schema has no property ${e}`);return ye(n)}function _e({key:e,value:t}){return{value:x(t)?t[e]:void 0}}function Wy({schema:e,token:t}){if(Ik(e).value==="generated")return Hr(Uy({schema:e,token:t}).value);let r=_e({key:"properties",value:e}).value;if(!x(r))return ur();let n=Object.fromEntries(Object.entries(r).flatMap(([o,a])=>{let i=Wy({schema:a,token:`${t}${o}.`});return i.found?[[o,i.value]]:[]}));return Object.keys(n).length===0?ur():Hr(n)}function Ik(e){let t=_e({key:"ripplo",value:e}).value,r=_e({key:"setup",value:t}).value;return{value:typeof r=="string"?r:void 0}}function Uy({schema:e,token:t}){let r=_e({key:"const",value:e}).value;if(r!==void 0)return ye(r);let n=_e({key:"enum",value:e}).value;if(Array.isArray(n)&&n[0]!==void 0)return ye(n[0]);let o=_e({key:"type",value:e}).value;return Lk({schema:e,token:t,type:o})}function Lk({schema:e,token:t,type:r}){return r==="boolean"?ye(t.length%2===0):r==="integer"||r==="number"?ye(Nk(t)):r==="null"?ye(null):r==="array"?ye([]):r==="object"?Fk({schema:e,token:t}):ye(`__ripplo_generated_${t.slice(0,-1)}`)}function Nk(e){return Buffer.from(e).reduce((t,r)=>(t*31+r)%1000003,17)}function Fk({schema:e,token:t}){let r=_e({key:"properties",value:e}).value,n=_e({key:"required",value:e}).value;return!x(r)||!Array.isArray(n)?ye({}):ye(Object.fromEntries(n.flatMap(o=>{if(typeof o!="string")return[];let a=r[o];return a===void 0?[]:[[o,Uy({schema:a,token:`${t}${o}.`}).value]]})))}function qy({base:e,overlay:t}){return!x(e)||!x(t)?ye(t):ye(Object.fromEntries([...new Set([...Object.keys(e),...Object.keys(t)])].map(r=>[r,Bk({base:e,key:r,overlay:t}).value])))}function Bk({base:e,key:t,overlay:r}){let n=r[t],o=e[t];if(n===void 0){if(o===void 0)throw new TypeError(`state operation field ${t} is missing`);return ye(o)}return o===void 0?ye(n):qy({base:o,overlay:n})}function Ol({expression:e,results:t}){if(e.kind==="value")return Hr(e.value);if(e.kind==="generate")return ur();if(e.kind==="reference")return Dk({operation:e.operation,path:e.path,results:t});if(e.kind==="array"){let r=e.items.map(n=>Ol({expression:n,results:t}));return r.every(n=>n.found)?Hr(r.map(n=>n.value)):ur()}return Hr(Object.fromEntries(Object.entries(e.fields).flatMap(([r,n])=>{let o=Ol({expression:n,results:t});return o.found?[[r,o.value]]:[]})))}function Dk({operation:e,path:t,results:r}){let n=r[e];return n===void 0?ur():zy({path:t,value:n})}function zy({path:e,value:t}){let[r,...n]=e;if(r==null)return Hr(t);if(!x(t))return ur();let o=t[r];return o===void 0?ur():zy({path:n,value:o})}function Hr(e){return{found:!0,value:e}}function ur(){return{found:!1}}function $k(e){return e==null||["boolean","number","string"].includes(typeof e)}function ye(e){return{value:e}}function Kr({generate:e,params:t,state:r,test:n}){let o={generate:e,params:t},a=new Map([...jk(Ml({...o,test:n})),...jy({plan:n.startingState,state:r})]);return Vk({env:a,snapshot:{scalars:new Map([_k(n),...Wk(n,a)])}})}function Ml({generate:e,params:t,test:r}){return Object.fromEntries(Object.entries(r.params).map(([n,o])=>{let a=t?.[n];return a!=null?[n,a]:[n,e.value({nullable:!1,seed:n,space:o.space,type:Ho(o.space),valueSpace:o.space.name})]}))}function jk(e){return Object.entries(e).map(([t,r])=>[H(t),r])}function _k(e){let t={kind:"viewport"};return[v(t),{declared:!1,expect:{expect:"is",value:e.viewport},subject:t}]}function Wk(e,t){if(e.actor.kind==="anonymous")return[];let r={kind:"actor"};return[[v(r),{declared:!1,expect:{expect:"is",value:e.actor.alias},subject:r}]]}var Uk=24301,qk=256;function Ky(e){return g({active:e.active==null?null:{params:Object.entries(e.active.params).toSorted(([t],[r])=>t.localeCompare(r)),spaces:Object.entries(e.active.spaces).toSorted(([t],[r])=>t.localeCompare(r)),test:e.active.test},completedDraws:[...e.completedDraws].toSorted(([t],[r])=>t.localeCompare(r))})}function Da({generate:e,test:t,testRef:r}){return Gn({params:Ml({generate:e,params:void 0,test:t}),test:t,testRef:r})}function Gn({params:e,test:t,testRef:r}){return{active:{params:e,spaces:Object.fromEntries(Object.entries(t.params).map(([n,o])=>[n,o.space])),test:r},completedDraws:new Map}}function pr({action:e,attempt:t,state:r}){let n=Tl({action:e,state:r}),o=n?r.completedDraws:Yy(r),a=n?Jy(e,r.active):{};return{...zk({attempt:t,drawnBefore:o,spaces:Gy(e.paramSpaces,a)}),...a}}function $t({action:e,params:t,state:r}){let n=Tl({action:e,state:r}),o=n?r.completedDraws:Yy(r),a=n&&r.active!=null?r.active.params:{},i=n&&r.active!=null?r.active.spaces:{};return{active:{params:{...a,...t},spaces:{...i,...e.paramSpaces},test:e.test},completedDraws:o}}function Jr({action:e,state:t}){let r=Tl({action:e,state:t})?Jy(e,t.active):{};return Hk(Gy(e.paramSpaces,r))}function zk({attempt:e,drawnBefore:t,spaces:r}){let n=Object.entries(r);return Object.fromEntries(n.map(([o,a],i)=>{let s=a?.name==null?0:t.get(a.name)??0;return[o,Gk(a,s+Kk({attempt:e,entries:n,index:i})).value]}))}function Hk(e){return Math.min(128,Object.values(e).reduce((t,r)=>t*Ba(r),1))}function Tl({action:e,state:t}){return t.active!=null&&t.active.test===e.test}function Jy(e,t){return t==null?{}:Object.fromEntries(Object.keys(e.paramSpaces).flatMap(r=>{let n=t.params[r];return n===void 0?[]:[[r,n]]}))}function Gy(e,t){return Object.fromEntries(Object.entries(e).filter(([r])=>t[r]===void 0))}function Yy(e){return e.active==null?e.completedDraws:Zk(e.completedDraws,e.active.spaces)}function Kk({attempt:e,entries:t,index:r}){let n=t.slice(0,r).reduce((o,a)=>o*Ba(a[1]),1);return Math.floor(e/n)%Ba(t[r]?.[1])}function Ba(e){return e?.kind==="enum"?e.values.length:e?.kind==="boolean"?2:e?.kind==="number"?Math.min(e.max-e.min+1,16):16}var Jk={probe:0,values:[]},Hy=new Map;function Gk(e,t){let r=t%Ba(e),n=e==null?"untyped":g(e),o=Zy({requiredLength:r+1,sequence:Hy.get(n)??Jk,space:e});Hy.set(n,o);let a=o.values[r%o.values.length];if(a===void 0)throw new Error("arbitrary produced no sample");return a}function Zy({requiredLength:e,sequence:t,space:r}){if(t.values.length>=e||t.probe===qk)return t;let n=Yk(r,t.probe),o=t.values.some(a=>Object.is(a.value,n.value))?t.values:[...t.values,n];return Zy({requiredLength:e,sequence:{probe:t.probe+1,values:o},space:r})}function Yk(e,t){let r=kr.value({nullable:!1,seed:String(Uk+t),space:e,type:e==null?"string":Ho(e),valueSpace:e?.name??"explore.untyped"});if(r===null)throw new Error("non-null exploration arbitrary produced null");return{value:r}}function Zk(e,t){return Object.values(t).reduce((r,n)=>n==null?r:new Map([...r,[n.name,(r.get(n.name)??0)+1]]),e)}import{createHash as fm}from"crypto";import{performance as Yr}from"perf_hooks";import{createHash as em}from"crypto";function $a({corpus:e,logical:t,patterns:r,startingLogical:n,steps:o}){let a=o.map(i=>Qy({corpus:e,step:i}));return{actionKinds:a.map(i=>i.effectStep.action.kind),actorStates:a.map(i=>i.requiredState.actor.kind),cardinalityShapes:t.constraints.flatMap(i=>nC(i)),effectKinds:a.flatMap(i=>i.steps.flatMap(s=>s.effects.map(l=>l.kind))),parameterShapes:o.flatMap(i=>Qk({step:i,transition:Qy({corpus:e,step:i})})),patterns:[...r].toSorted((i,s)=>i.localeCompare(s)),relationShapes:t.constraints.map(i=>g(Xy(i))),routeShapes:a.flatMap(i=>[...i.requiredState.scalars.values()].flatMap(s=>s.subject.kind==="path"||s.subject.kind==="query"||s.subject.kind==="hash"||s.subject.kind==="title"?[g(s.subject)]:[])),startingStateShapes:n.constraints.map(i=>g(Xy(i))),surfaceShapes:a.flatMap(i=>[...i.requiredState.scalars.values()].flatMap(s=>s.subject.kind==="element"?[g({locator:s.subject.locator,state:s.subject.state})]:[])),transitionIds:o.map(i=>i.transitionId),transitionPairs:Xk(o),workflowRefs:a.map(i=>i.test)}}function Xy(e){return e.kind==="closed-record"?{kind:e.kind,records:tm(e.operations.length),selector:e.selector}:e}function Xk(e){return e.slice(1).map((t,r)=>{let n=e[r];if(n===void 0)throw new Error("coverage transition pair has no preceding step");return`${n.transitionId}:${t.transitionId}`})}function Qk({step:e,transition:t}){return Object.entries(e.params).toSorted(([r],[n])=>r.localeCompare(n)).map(([r,n])=>g({name:r,shape:eC({space:t.paramSpaces[r],value:n})}))}function eC({space:e,value:t}){if(e==null)return{kind:"untyped",value:t};switch(e.kind){case"enum":case"boolean":return{kind:e.kind,value:t};case"number":return{band:tC({max:e.max,min:e.min,value:t}),kind:"number"};case"datetime":case"pattern":return{kind:e.kind,probe:rC(t),space:e.name}}}function Va(e){return em("sha256").update(g(e)).digest("base64url")}function tC({max:e,min:t,value:r}){if(typeof r!="number")throw new TypeError("number parameter space produced a non-number value");if(r===t)return"minimum";if(r===e)return"maximum";let n=e-t,o=n===0?0:(r-t)/n;return o<1/3?"lower":o>2/3?"upper":"middle"}function rC(e){let r=em("sha256").update(g(e)).digest()[0];if(r===void 0)throw new Error("parameter probe hash was empty");return r%8}function nC(e){return e.kind==="required-record"?[`${e.selector.source}:${e.selector.path.join(".")}:present`]:e.kind==="optional-record"?[`${e.selector.source}:${e.selector.path.join(".")}:optional`]:e.kind==="absent-record"?[`${e.selector.source}:${e.selector.path.join(".")}:absent`]:e.kind==="closed-record"?[`${e.selector.source}:${e.selector.path.join(".")}:${tm(e.operations.length)}`]:[]}function tm(e){return e===0?"empty":e===1?"one":"many"}function Qy({corpus:e,step:t}){let r=e.find(n=>n.id===t.transitionId);if(r==null)throw new Error(`planner transition ${t.transitionId} is missing`);return r}function Gr({corpus:e,steps:t}){let r=t.flatMap(a=>{let i=e.find(s=>s.id===a.transitionId);return i==null?[]:[i]}),n=r.flatMap(a=>a.steps.flatMap(i=>i.effects.map(s=>s.kind))),o=r.map(a=>a.effectStep.action.kind);return[...Vt({condition:oC({kinds:n,ordered:["create-record","update-selected-records","delete-selected-records"]}),pattern:"create-modify-delete"}),...Vt({condition:n.filter(a=>a==="create-record").length>=2&&n.includes("delete-selected-records"),pattern:"parent-child-delete"}),...Vt({condition:o.includes("actor")&&o.some(a=>a!=="actor"&&a!=="goto"),pattern:"role-attempt"}),...Vt({condition:n.includes("transform")&&o.length>=2,pattern:"threshold-gate"}),...Vt({condition:n.includes("delete-selected-records")&&o.includes("goto"),pattern:"last-record-navigation"}),...Vt({condition:n.length>=3,pattern:"lifecycle"}),...Vt({condition:new Set(r.map(a=>a.test)).size>=2,pattern:"cross-workflow"}),...Vt({condition:aC({actionKinds:o,effectKinds:n}),pattern:"overlay-mutate-close"})]}function oC({kinds:e,ordered:t}){return t.reduce((r,n)=>{if(r==null)return null;let o=e.indexOf(n,r);return o===-1?null:o+1},0)!=null}function aC({actionKinds:e,effectKinds:t}){return e.filter(r=>r==="click").length>=2&&t.length>0&&e.length>=3}function Vt({condition:e,pattern:t}){return e?[t]:[]}function rm({corpus:e,node:t,transition:r}){return t.steps.length===0||!iC({corpus:e,node:t,transition:r})||t.causalTransitionIds.has(r.id)?t.causalTransitionIds:new Set([...t.causalTransitionIds,r.id])}function iC(e){return sC(e)||cC(e)||dC(e)}function sC({node:e,transition:t}){return lC(t).some(r=>{let n=H(r);return e.startingPoint.env.has(n)!==e.state.base.has(n)||e.startingPoint.env.get(n)!==e.state.base.get(n)})}function lC(e){return[...new Set([...e.whenSteps.flatMap(t=>ua(t)),...Fr(e.requiredState),...pa(e.logicalRequiredState)])]}function cC({node:e,transition:t}){if(t.requiredState.actor.kind==="any")return!1;let r=K(e.startingPoint.snapshot.scalars,{kind:"actor"}),n=K(e.state.snapshot.scalars,{kind:"actor"});return r!==n}function dC({corpus:e,node:t,transition:r}){return t.steps.some(n=>{let o=e.find(i=>i.id===n.transitionId);if(o==null)throw new Error(`causal transition ${n.transitionId} is missing`);let a=o.steps.flatMap(i=>i.effects.map(s=>s.selector));return r.logicalRequiredState.flatMap(i=>Jo(i)?[i]:[]).some(i=>a.some(s=>Vn(s,i.selector)))})}import{createHash as uC}from"crypto";var nm=new WeakMap,om=new WeakMap;function am(e){let t=om.get(e);if(t!=null)return t;let r=Il({base:[...e.state.base].toSorted(([n],[o])=>n.localeCompare(o)),logical:e.state.logical.constraints,parameters:Ky(e.parameters),snapshot:Dt(e.state.snapshot)});return om.set(e,r),r}function im(e){let t=nm.get(e);if(t!=null)return t;let r=Il({state:am(e),visited:[...e.visited].toSorted((n,o)=>n.localeCompare(o))});return nm.set(e,r),r}function sm({node:e,params:t,transitionId:r}){return Il({params:t,state:am(e),transitionId:r})}function Il(e){return uC("sha256").update(g(e)).digest("base64url")}function lm(e){let{params:t,patterns:r,steps:n}=e,o=_a(n,t.corpus),a=dm({causalLinks:e.causalLinks,steps:n,transitions:o}),i=ja({corpus:t.corpus,targetId:t.agenda.primaryTransitionId,transitions:o}),s=t.agenda.secondaryTransitionId==null?0:ja({corpus:t.corpus,targetId:t.agenda.secondaryTransitionId,transitions:o});return[n.some(l=>l.transitionId===t.agenda.primaryTransitionId)?1:0,i,t.agenda.secondaryTransitionId!=null&&n.some(l=>l.transitionId===t.agenda.secondaryTransitionId)?1:0,s,r.includes(t.agenda.pattern)?1:0,a.causalLinks,a.uniqueInteractions,a.uniquePairs,a.effectKinds,a.deleteEffect,a.tests,-a.postEntryGotos]}function cm(e){let t=_a(e.steps,e.params.corpus),r=dm({causalLinks:e.causalLinks,steps:e.steps,transitions:t});return[e.steps.length,r.causalLinks,r.uniqueInteractions,r.uniquePairs,r.effectKinds,r.deleteEffect,r.tests,-r.postEntryGotos]}function Ll(e,t){let r=Nl({index:0,left:e.searchPriority,right:t.searchPriority});return r===0?e.tie.localeCompare(t.tie):r}function Yn(e,t){let r=Nl({index:0,left:e.selectionPriority,right:t.selectionPriority});return r===0?e.tie.localeCompare(t.tie):r}function Zn(e,t){return e.steps.some(r=>r.transitionId===t)}function ja({corpus:e,targetId:t,transitions:r}){let n=e.find(o=>o.id===t);if(n==null)throw new Error(`exploration target transition ${t} is missing`);return r.filter(o=>o.test===n.test&&o.index<=n.index).reduce((o,a)=>Math.max(o,a.index+1),0)}function _a(e,t){return e.map(r=>{let n=t.find(o=>o.id===r.transitionId);if(n==null)throw new Error(`exploration transition ${r.transitionId} is missing`);return n})}function Nl({index:e,left:t,right:r}){let n=t[e],o=r[e];if(n===void 0&&o===void 0)return 0;if(n===void 0||o===void 0)throw new Error("exploration candidate priorities have different lengths");let a=o-n;return a===0?Nl({index:e+1,left:t,right:r}):a}function dm({causalLinks:e,steps:t,transitions:r}){let n=r.filter(a=>a.effectStep.action.kind!=="goto"),o=r.flatMap(a=>a.steps.flatMap(i=>i.effects.map(s=>s.kind)));return{causalLinks:e,deleteEffect:o.includes("delete-selected-records")?1:0,effectKinds:new Set(o).size,postEntryGotos:r.slice(1).filter(a=>a.effectStep.action.kind==="goto").length,tests:new Set(r.map(a=>a.test)).size,uniqueInteractions:new Set(n.map(a=>a.id)).size,uniquePairs:new Set(t.slice(1).flatMap((a,i)=>{let s=t[i]?.transitionId;return s==null||s===a.transitionId?[]:[`${s}:${a.transitionId}`]})).size}}var ym=4096,pC=8,fC=32,yC=2,um=4;function mm(e){let t=e.startingPoints.map(r=>wC(r));return hm({params:e,state:{candidates:[],depths:[],expanded:0,frontier:t,rejectedCycles:0,stopReason:void 0,telemetry:{beamMs:0,candidateMs:0,expansionMs:0}}})}function hm({params:e,state:t}){let r=hC({params:e,state:t});if(r!=null)return{...t,stopReason:r};let n=Yr.now(),o=gC({frontier:t.frontier,limit:ym-t.expanded,params:e}),a=Yr.now()-n,i=o.nodes,s=i.filter(b=>!b.repeatedVisit),l=t.rejectedCycles+i.length-s.length,c=Yr.now(),d=s.map(b=>CC({node:b,params:e})),u=kC({entries:d,existing:t.candidates,primaryTransitionId:e.agenda.primaryTransitionId}),p=Yr.now()-c,y=Yr.now(),m=u.some(b=>mC({candidate:b,params:e})),h=AC({entries:d,params:e,width:m?yC:pC}),f=Yr.now()-y;return hm({params:e,state:{candidates:u,depths:[...t.depths,{depth:t.frontier[0]?.steps.length??0,expanded:i.length,parameterAttempts:o.parameterAttempts,primaryProgress:h.reduce((b,w)=>Math.max(b,ja({corpus:e.corpus,targetId:e.agenda.primaryTransitionId,transitions:_a(w.steps,e.corpus)})),0),retained:h.length,rulesConsidered:o.rulesConsidered}],expanded:t.expanded+i.length,frontier:h,rejectedCycles:l,stopReason:void 0,telemetry:{beamMs:t.telemetry.beamMs+f,candidateMs:t.telemetry.candidateMs+p,expansionMs:t.telemetry.expansionMs+a}}})}function mC({candidate:e,params:t}){let r=e.steps.some(o=>o.transitionId===t.agenda.primaryTransitionId),n=t.agenda.secondaryTransitionId==null||e.steps.some(o=>o.transitionId===t.agenda.secondaryTransitionId);return r&&n&&e.patterns.includes(t.agenda.pattern)}function hC({params:e,state:t}){if(t.frontier.length===0)return"frontierExhausted";let r=t.frontier[0]?.steps.length;return r!=null&&r>=e.strategy.maxAttemptLength?"targetReached":t.expanded>=ym?"budgetExhausted":void 0}function gC({frontier:e,limit:t,params:r}){if(t<=0||e.length===0)return{nodes:[],parameterAttempts:0,rulesConsidered:0};let n=Math.max(1,Math.floor(t/e.length)),o=e.map(a=>SC({node:a,params:r})).reduce((a,i)=>({nodes:[...a.nodes,...i.nodes.slice(0,n)].slice(0,t),parameterAttempts:a.parameterAttempts+i.parameterAttempts,rulesConsidered:a.rulesConsidered+i.rulesConsidered}),{nodes:[],parameterAttempts:0,rulesConsidered:0});return{...o,nodes:o.nodes.slice(0,t)}}function SC({node:e,params:t}){let r=_r({logical:e.state.logical,model:t.facts,snapshot:e.state.snapshot}),n=bC({corpus:RC({node:e,params:t}),node:e,proven:r});return{nodes:n.runs.map(a=>{let i=EC(t.corpus,a.transitionId),s=rm({corpus:t.corpus,node:e,transition:i}),l=sm({node:e,params:a.params,transitionId:a.transitionId}),c=[...e.steps,{params:a.params,transitionId:a.transitionId}];return{causalTransitionIds:s,parameters:$t({action:i,params:a.params,state:e.parameters}),repeatedVisit:e.visited.has(l),startingPoint:e.startingPoint,state:a.stepRun.next,steps:c,visited:new Set([...e.visited,l])}}),parameterAttempts:n.parameterAttempts,rulesConsidered:n.rulesConsidered}}function bC({corpus:e,node:t,proven:r}){let n=t.steps.length===0,o=e.filter(l=>l.effectStep.action.kind==="goto");if(n)return Fl({corpus:o,limit:um,node:t,proven:r});let a=e.filter(l=>l.effectStep.action.kind!=="goto"),i=Fl({corpus:a,limit:um,node:t,proven:r});if(i.runs.length>0)return i;let s=Fl({corpus:o,limit:1,node:t,proven:r});return{parameterAttempts:i.parameterAttempts+s.parameterAttempts,rulesConsidered:i.rulesConsidered+s.rulesConsidered,runs:[...i.runs,...s.runs]}}function Fl({corpus:e,limit:t,node:r,proven:n}){return Dy(e,{...r.state,snapshot:n},{limit:t,attemptsFor:o=>Jr({action:o,state:r.parameters}),paramsFor:(o,a)=>pr({action:o,attempt:a,state:r.parameters})})}function RC({node:e,params:t}){let r=pm({corpus:t.corpus,targetId:t.agenda.primaryTransitionId}),n=t.agenda.secondaryTransitionId==null?[]:pm({corpus:t.corpus,targetId:t.agenda.secondaryTransitionId}),o=new Set([...r,...n].map(s=>s.id)),a=t.corpus.filter(s=>!o.has(s.id)),i=vC({length:a.length,node:e,seed:t.assignmentSeed});return[...r,...n,...a.slice(i),...a.slice(0,i)]}function pm({corpus:e,targetId:t}){let r=e.find(n=>n.id===t);if(r==null)throw new Error(`exploration target transition ${t} is missing`);return e.filter(n=>n.test===r.test&&n.index<=r.index).toSorted((n,o)=>n.index-o.index)}function vC({length:e,node:t,seed:r}){if(e===0)return 0;let n=fm("sha256").update(`${r}:${t.startingPoint.name}:${Dt(t.state.snapshot)}`).digest("hex");return Number.parseInt(n.slice(0,8),16)%e}function wC(e){return{causalTransitionIds:new Set,parameters:e.parameters,repeatedVisit:!1,startingPoint:e,state:{base:e.env,deferred:Xe,logical:e.logical,ordinal:0,snapshot:e.snapshot},steps:[],visited:new Set}}function EC(e,t){let r=e.find(n=>n.id===t);if(r==null)throw new Error(`exploration transition ${t} is missing`);return r}function xC({node:e,params:t}){let r=Gr({corpus:t.corpus,steps:e.steps}),n=$a({corpus:t.corpus,logical:e.state.logical,patterns:r,startingLogical:e.startingPoint.logical,steps:e.steps}),o=Va(n);return{causalLinks:e.causalTransitionIds.size,coverageSignature:o,patterns:r,searchPriority:lm({causalLinks:e.causalTransitionIds.size,params:t,patterns:r,steps:e.steps}),selectionPriority:cm({causalLinks:e.causalTransitionIds.size,params:t,patterns:r,steps:e.steps}),startingPoint:e.startingPoint,steps:e.steps,tie:fm("sha256").update(`${t.assignmentSeed}:${o}`).digest("base64url")}}function gm(){return{candidates:[],depths:[],expanded:0,frontier:[],rejectedCycles:0,stopReason:void 0,telemetry:{beamMs:0,candidateMs:0,expansionMs:0}}}function kC({entries:e,existing:t,primaryTransitionId:r}){return[...[...t,...e.map(a=>a.candidate)].filter(a=>Zn(a,r)).reduce((a,i)=>{let s=a.get(i.coverageSignature),l=s==null||Yn(i,s)<0?i:s;return new Map([...a,[i.coverageSignature,l]])},new Map).values()].toSorted(Yn).slice(0,fC)}function CC({node:e,params:t}){return{candidate:xC({node:e,params:t}),node:e}}function AC({entries:e,params:t,width:r}){return[...e.reduce((o,a)=>{let i=PC({entry:a,params:t}),s=o.get(i),l=s==null||Ll(a.candidate,s.candidate)<0?a:s;return new Map([...o,[i,l]])},new Map).values()].toSorted((o,a)=>Ll(o.candidate,a.candidate)).slice(0,r).map(o=>o.node)}function PC({entry:e,params:t}){let r=t.agenda.secondaryTransitionId;return g({future:im(e.node),patternReached:e.candidate.patterns.includes(t.agenda.pattern),primaryReached:e.node.steps.some(n=>n.transitionId===t.agenda.primaryTransitionId),secondaryReached:r==null?"none":e.node.steps.some(n=>n.transitionId===r)})}function Ua(e){if(e.startingPoints.length===0||e.corpus.length===0)return Dl({agenda:e.agenda,reason:"modelEmpty",rejectedReplays:0,searched:gm(),startingPoints:e.startingPoints});let t=Wa.now(),r=mm(e),n=Wa.now()-t,o=Wa.now(),a=OC({params:e,searched:r});return{...a,telemetry:{...a.telemetry,searchMs:n,selectionMs:Wa.now()-o}}}function Sm({corpus:e,facts:t,startingPoint:r,steps:n}){let o={base:r.env,deferred:Xe,logical:r.logical,ordinal:0,snapshot:r.snapshot};return n.reduce((i,s,l)=>{if(i.result.kind==="unrunnable")return i;let c=e.find(y=>y.id===s.transitionId);if(c==null||l===0&&c.effectStep.action.kind!=="goto")return{...i,result:{kind:"unrunnable",stepIndex:l}};let d=_r({logical:i.result.state.logical,model:t,snapshot:i.result.state.snapshot}),u={...s.params},p=dr(c,{...i.result.state,snapshot:d},u);return p==null?{...i,result:{kind:"unrunnable",stepIndex:l}}:{parameters:$t({action:c,params:u,state:i.parameters}),result:{kind:"legal",state:p.next}}},{parameters:r.parameters,result:{kind:"legal",state:o}}).result}function OC({params:e,searched:t}){let r=t.candidates.toSorted(Yn),n=MC({agenda:e.agenda,candidates:r}),o=n.filter(d=>!e.reservedSignatures.has(d.candidate.coverageSignature)),a=Bl({params:e,selections:o});if(a.selection!=null)return{kind:"candidate",startingPoint:a.selection.candidate.startingPoint.name,steps:a.selection.candidate.steps,telemetry:vm(t),trace:Rm({agenda:e.agenda,rejectedReplays:a.rejected,searched:t,selectedCausalTransitions:a.selection.candidate.causalLinks,selectedCoverageSignature:a.selection.candidate.coverageSignature,selectedSteps:a.selection.candidate.steps.length,selectionTier:a.selection.tier,startingPoints:e.startingPoints})};let i=n.filter(d=>e.reservedSignatures.has(d.candidate.coverageSignature)),s=Bl({params:e,selections:i}),l=a.rejected+s.rejected;if(s.selection!=null)return Dl({agenda:e.agenda,reason:"allReserved",rejectedReplays:l,searched:t,startingPoints:e.startingPoints});let c=e.corpus.some(d=>d.effectStep.action.kind==="goto");return Dl({agenda:e.agenda,reason:TC({hasEntry:c,searched:t}),rejectedReplays:l,searched:t,startingPoints:e.startingPoints})}function MC({agenda:e,candidates:t}){let r=s=>Zn(s,e.primaryTransitionId),n=s=>e.secondaryTransitionId!=null&&Zn(s,e.secondaryTransitionId),o=s=>s.patterns.includes(e.pattern),i=[{tier:"primary-secondary-pattern",accepts:s=>r(s)&&n(s)&&o(s)},{tier:"primary-pattern",accepts:s=>r(s)&&o(s)},{tier:"primary-secondary",accepts:s=>r(s)&&n(s)},{accepts:r,tier:"primary"}].flatMap(s=>t.filter(l=>s.accepts(l)).map(l=>({candidate:l,tier:s.tier})));return i.filter((s,l)=>i.findIndex(c=>c.candidate.coverageSignature===s.candidate.coverageSignature)===l)}function Bl({params:e,selections:t}){let[r,...n]=t;if(r==null)return{rejected:0,selection:void 0};if(Sm({corpus:e.corpus,facts:e.facts,startingPoint:r.candidate.startingPoint,steps:r.candidate.steps}).kind==="legal")return{rejected:0,selection:r};let a=Bl({params:e,selections:n});return{rejected:a.rejected+1,selection:a.selection}}function Dl({agenda:e,reason:t,rejectedReplays:r,searched:n,startingPoints:o}){return{kind:"no-candidate",reason:t,telemetry:vm(n),trace:Rm({agenda:e,rejectedReplays:r,searched:n,selectedCausalTransitions:void 0,selectedCoverageSignature:void 0,selectedSteps:void 0,selectionTier:void 0,startingPoints:o})}}function bm(e){return[{kind:"agenda",pattern:e.agenda.pattern,primaryTransitionId:e.agenda.primaryTransitionId,secondaryTransitionId:e.agenda.secondaryTransitionId},{count:e.envelopes.length,kind:"envelope-candidates",refs:e.envelopes},...e.depths.map(t=>({...t,kind:"beam-depth"})),{count:e.rejectedCycles,kind:"cycle-rejections"},{count:e.rejectedReplays,kind:"replay-rejections"},{kind:"search-stop",reason:e.searchStopReason},{candidates:e.candidates,causalTransitions:e.selectedCausalTransitions,coverageSignature:e.selectedCoverageSignature,kind:"selection",steps:e.selectedSteps,tier:e.selectionTier}]}function Rm({agenda:e,rejectedReplays:t,searched:r,selectedCausalTransitions:n,selectedCoverageSignature:o,selectedSteps:a,selectionTier:i,startingPoints:s}){return{agenda:e,candidates:r.candidates.length,depths:r.depths,envelopes:s.map(l=>l.name),expanded:r.expanded,rejectedCycles:r.rejectedCycles,rejectedReplays:t,searchStopReason:r.stopReason,selectedCausalTransitions:n,selectedCoverageSignature:o,selectedSteps:a,selectionTier:i}}function vm(e){return{...e.telemetry,searchMs:0,selectionMs:0}}function TC({hasEntry:e,searched:t}){switch(t.stopReason){case"budgetExhausted":return"budgetExhausted";case"frontierExhausted":return e?"noLegalExpansion":"noEntry";case"targetReached":return"trailLengthExhausted";case void 0:throw new Error("exploration search did not record why it stopped")}}function wm({changes:e,next:t,previous:r,state:n}){return Object.entries(e).every(([o,a])=>{let i=t[o];if(i===void 0)return!1;if(a.kind==="transform"){let s=r[o];return s!==void 0&&Ye(a.relation,{after:i,before:s,parameters:{},records:{},state:n})}return a.kind==="value"&&g(a.value)===g(i)})}function qa({after:e,before:t}){let r=Object.keys(e).filter(a=>t[a]===void 0).flatMap(a=>{let i=e[a];return i===void 0?[]:[i]}),n=Object.keys(t).filter(a=>e[a]===void 0).flatMap(a=>{let i=t[a];return i===void 0?[]:[i]}),o=Object.keys(t).filter(a=>{let i=t[a],s=e[a];return i!==void 0&&s!==void 0&&g(i)!==g(s)});return{added:r,changed:o,removed:n}}function Xn(e,t){return x(e)?Object.entries(t).every(([r,n])=>{let o=e[r];return o!==void 0&&g(o)===g(n)}):!1}function xm(e){let t=e.effects.filter(r=>r.kind==="delete-selected-records"||r.kind==="update-selected-records");return IC({...e,selected:t})}function IC({actual:e,before:t,effects:r,pre:n,selected:o}){if(!e.present||!t.present||!x(e.value)||!x(t.value))return!1;let a=e.value,i=t.value,s=o.flatMap(p=>LC({effect:p,pre:n}));if(NC(s))return!1;let l=qa({after:a,before:i}),c=s.flatMap(p=>p.effect.kind==="delete-selected-records"?[p.key]:[]),d=s.filter(p=>p.effect.kind==="update-selected-records"),u=r.filter(p=>p.kind==="create-record");return l.added.length===u.length&&Am({effects:u,rows:l.added})&&FC({after:a,before:i,expected:c})&&l.changed.every(p=>d.some(y=>y.key===p))&&d.every(p=>DC({after:a,before:i,effect:p.effect,key:p.key,state:n}))}function LC({effect:e,pre:t}){return ea(e.selection,{after:void 0,before:void 0,parameters:{},records:{},state:t}).map(r=>({effect:e,key:r.key}))}function NC(e){return e.some((t,r)=>e.slice(r+1).some(n=>{if(t.key!==n.key)return!1;if(t.effect.kind==="delete-selected-records"||n.effect.kind==="delete-selected-records")return!0;let o=t.effect.changes,a=n.effect.changes;return Object.keys(o).some(i=>i in a)}))}function FC({after:e,before:t,expected:r}){let n=Object.keys(t).filter(o=>e[o]===void 0).toSorted((o,a)=>o.localeCompare(a));return g(n)===g([...r].toSorted((o,a)=>o.localeCompare(a)))}function km({after:e,before:t,bindings:r,effects:n}){return Cm({after:e,before:t,bindings:r,remaining:n.filter(o=>o.kind==="create-record"),used:new Set})}function Cm({after:e,before:t,bindings:r,remaining:n,used:o}){if(n.length===0)return r;let a=n.filter(s=>jC({bindings:r,effect:s})).map(s=>({candidates:VC({after:e,before:t,effect:s}).filter(l=>!o.has(l.id)&&Pm({bindings:r,effect:s,row:l.value})),effect:s})),i=BC(a);return i==null?r:Cm({after:e,before:t,bindings:{...r,[i.effect.as]:i.candidate.value},remaining:n.filter(s=>s!==i.effect),used:new Set([...o,i.candidate.id])})}function BC(e){let t=e.find(n=>n.candidates.length===1),r=t?.candidates[0];return t!=null&&r!=null?{candidate:r,effect:t.effect}:e.flatMap(n=>n.candidates.filter(o=>$C({candidate:o,choices:e})).map(o=>({candidate:o,effect:n.effect})))[0]}function DC({after:e,before:t,effect:r,key:n,state:o}){let a=t[n],i=e[n];if(a===void 0||i===void 0||!x(a)||!x(i)||!wm({changes:r.changes,next:i,previous:a,state:o}))return!1;let s=Object.fromEntries(Object.keys(r.changes).flatMap(l=>{let c=i[l];return c===void 0?[]:[[l,c]]}));return g(i)===g({...a,...s})}function $C({candidate:e,choices:t}){return t.filter(r=>r.candidates.some(n=>n.id===e.id)).length===1}function VC({after:e,before:t,effect:r}){let n=Em(e,r.selector),o=Em(t,r.selector);if(!n.present||!o.present||!x(n.value)||!x(o.value))return[];let a=n.value,i=o.value,s=g(r.selector);return Object.keys(a).filter(l=>i[l]===void 0).flatMap(l=>{let c=a[l];return c===void 0?[]:[{id:`${s}:${l}`,value:c}]})}function Am({effects:e,rows:t}){let[r,...n]=e;return r==null?t.length===0:t.some((o,a)=>Pm({bindings:{},effect:r,row:o})?Am({effects:n,rows:t.filter((i,s)=>s!==a)}):!1)}function Pm({bindings:e,effect:t,row:r}){return x(r)?Object.entries(t.fields).every(([n,o])=>{let a=r[n];if(o.kind==="absent")return a===void 0;if(o.kind==="generated")return a!==void 0;let i=Om({bindings:e,expression:o});return i.present&&a!==void 0&&g(a)===g(i.value)}):!1}function jC({bindings:e,effect:t}){return Object.values(t.fields).every(r=>r.kind==="absent"||r.kind==="generated"||Om({bindings:e,expression:r}).present)}function Om({bindings:e,expression:t}){if(t.kind==="value")return{present:!0,value:t.value};if(t.kind==="transform"||t.kind==="absent"||t.kind==="generated")return{present:!1};let r=e[t.record];return r===void 0?{present:!1}:$l(r,t.path)}function $l(e,t){let[r,...n]=t;if(r==null)return{present:!0,value:e};if(!x(e))return{present:!1};let o=e[r];return o===void 0?{present:!1}:$l(o,n)}function Em(e,t){let r=e[t.source];return r===void 0?{present:!1}:$l(r,t.path)}function Mm({constraints:e,state:t}){if(Qn(t,e))return[];let r=e.flatMap(n=>n.kind==="required-record"?[{alias:n.alias,selector:n.selector}]:[]);return Vl(e).map(n=>{let o=ta({records:r,relation:n.relation})[0];if(o==null)throw new Error(`starting state relation ${n.label} failed but references no state to attribute it to`);return{actual:Te(t,o),constraint:n,kind:"constraint",selector:o}})}function Vl(e){return e.flatMap(t=>t.kind==="relation"?[t]:[])}function jl({candidates:e,records:t,relations:r,state:n,used:o}){if(!WC({bound:new Set(Object.keys(t)),records:t,relations:r,state:n}))return!1;let[a,...i]=e;return a==null?!0:a.rows.some(({identity:s,row:l})=>o.has(s)?!1:jl({candidates:i,records:{...t,[a.alias]:l},relations:r,state:n,used:new Set([...o,s])}))}function _C(e,t){return e.rows.length===t.rows.length?e.alias.localeCompare(t.alias):e.rows.length-t.rows.length}function Tm({constraints:e,state:t}){return e.flatMap(r=>{if(r.kind!=="required-record")return[];let n=Te(t,r.selector);if(!n.present||!x(n.value))return[{alias:r.alias,rows:[]}];let o=g(r.selector),a=Object.entries(n.value).filter(([,i])=>Xn(i,r.fields)).map(({0:i,1:s})=>({identity:g([o,i,s]),row:s})).toSorted((i,s)=>i.identity.localeCompare(s.identity));return[{alias:r.alias,rows:a}]}).toSorted(_C)}function WC({bound:e,records:t,relations:r,state:n}){return r.every(o=>{if(![...hp(o.relation).aliases].every(s=>e.has(s)))return!0;let i={after:void 0,before:void 0,parameters:{},records:t,state:n};if(!gp({context:i,relation:o.relation}))throw new Error(`starting state relation ${o.label} reads a value the observed state does not contain`);return Ye(o.relation,i)})}function to({observed:e,plan:t,pre:r}){let o=[...t.constraints.flatMap(l=>js(l)?[l]:[]).flatMap(l=>{let c=Te(r,l.selector);return Lm(c,l)?[]:[{actual:c,constraint:l,kind:"constraint",selector:l.selector}]}),...Mm({constraints:t.constraints,state:r})],a=qC({effects:t.effects,observed:e,pre:r}),s=KC(r,e).filter(l=>!t.effects.some(c=>GC(c.selector,l.selector))).map(l=>({actual:l.after,before:l.before,kind:"unexpected-change",selector:l.selector}));return{mismatches:[...o,...a,...s],requiredStateHolds:o.length===0}}function Te(e,t){let r=e[t.source];return r===void 0?{present:!1}:Nm(r,t.path)}function Wl({after:e,before:t,bindings:r,effects:n}){return km({after:e,before:t,bindings:r,effects:n})}function UC({effect:e,observed:t,pre:r}){let n=Te(t,e.selector),o=Te(r,e.selector);return HC({actual:n,before:o,effect:e,observed:t,pre:r})?[]:[{actual:n,before:o,effect:e,kind:"effect",selector:e.selector,targetKeys:Ul({effect:e,pre:r})}]}function qC({effects:e,observed:t,pre:r}){let n=e.filter(s=>s.kind==="create-record"||s.kind==="delete-selected-records"||s.kind==="update-selected-records"),o=e.filter(s=>s.kind!=="create-record"&&s.kind!=="delete-selected-records"&&s.kind!=="update-selected-records").flatMap(s=>UC({effect:s,observed:t,pre:r})),i=[...new Map(n.map(s=>[g(s.selector),s.selector])).values()].flatMap(s=>{let l=n.filter(u=>g(u.selector)===g(s)),c=Te(t,s),d=Te(r,s);return xm({actual:c,before:d,effects:l,observed:t,pre:r})?[]:l.map(u=>({actual:c,before:d,effect:u,kind:"effect",selector:s,targetKeys:Ul({effect:u,pre:r})}))});return[...o,...i]}function Ul({effect:e,pre:t}){return e.kind!=="delete-selected-records"&&e.kind!=="update-selected-records"?[]:ea(e.selection,{after:void 0,before:void 0,parameters:{},records:{},state:t}).map(r=>r.key)}function Qn(e,t){return t.flatMap(n=>js(n)?[n]:[]).every(n=>Lm(Te(e,n.selector),n))&&jl({candidates:Tm({constraints:t,state:e}),records:{},relations:Vl(t),state:e,used:new Set})}function Lm(e,t){if(t.kind==="absent-path")return!e.present;if(t.kind==="equals")return _l(e,t.value);if(!e.present||!x(e.value))return!1;let r=Object.values(e.value);return t.kind==="required-record"?r.some(n=>Xn(n,t.fields)):t.kind==="absent-record"?r.every(n=>!Xn(n,t.fields)):zC(r,t.rows)}function zC(e,t){let r=n=>n.map(o=>g(o)).toSorted((o,a)=>o.localeCompare(a));return g(r(e))===g(r(t))}function HC({actual:e,before:t,effect:r,pre:n}){if(r.kind==="set")return _l(e,r.value);if(r.kind==="transform")return e.present&&t.present&&Ye(r.relation,{after:e.value,before:t.value,parameters:{},records:{},state:n});if(r.kind==="create-path")return!t.present&&_l(e,r.value);if(r.kind==="delete-path")return t.present&&!e.present;throw new TypeError("record-effect-group-required")}function Nm(e,t){let[r,...n]=t;if(r==null)return{present:!0,value:e};if(!x(e))return{present:!1};let o=e[r];return o===void 0?{present:!1}:Nm(o,n)}function KC(e,t){return[...new Set([...Object.keys(e),...Object.keys(t)])].toSorted((n,o)=>n.localeCompare(o)).flatMap(n=>Fm({after:eo(t[n]),before:eo(e[n]),selector:{path:[],source:n}}))}function Fm({after:e,before:t,selector:r}){if(!t.present||!e.present)return JC(t,e)?[]:[{after:e,before:t,selector:r}];if(!x(t.value)||!x(e.value))return ql(t.value,e.value)?[{after:e,before:t,selector:r}]:[];let n=t.value,o=e.value;return[...new Set([...Object.keys(n),...Object.keys(o)])].toSorted((i,s)=>i.localeCompare(s)).flatMap(i=>Fm({after:eo(o[i]),before:eo(n[i]),selector:{path:[...r.path,i],source:r.source}}))}function JC(e,t){return!e.present||!t.present?e.present===t.present:!ql(e.value,t.value)}function ql(e,t){return g(e)!==g(t)}function eo(e){return e===void 0?{present:!1}:{present:!0,value:e}}function GC(e,t){return e.source===t.source&&e.path.every((r,n)=>t.path[n]===r)}function _l(e,t){return e.present&&!ql(e.value,t)}function zl({after:e,bindings:t,effects:r,pre:n}){return r.map(o=>YC({after:e,bindings:t,effect:o,pre:n}))}function YC({after:e,bindings:t,effect:r,pre:n}){if(r.kind==="set"||r.kind==="transform"||r.kind==="create-path")return{kind:"scalar",value:Te(e,r.selector)};if(r.kind==="create-record"){let s=t[r.as];return s===void 0||!x(s)?{kind:"none"}:{kind:"records",rows:[Im({fields:Object.keys(r.fields),row:s})]}}if(r.kind!=="update-selected-records")return{kind:"none"};let o=Te(e,r.selector);if(!o.present||!x(o.value))return{kind:"none"};let a=o.value;return{kind:"records",rows:Ul({effect:r,pre:n}).flatMap(s=>{let l=a[s];return l===void 0||!x(l)?[]:[Im({fields:Object.keys(r.changes),row:l})]})}}function Im({fields:e,row:t}){return Object.fromEntries(e.map(r=>[r,eo(t[r])]))}function Ka({bindings:e,selection:t}){let r=Hl(t),n=_u(t).find(o=>r.has(o.record)?!1:!Ha({bindings:e,reference:o}).ok);return n!=null?{ok:!1,path:n.path,record:n.record}:{ok:!0,selection:En({selection:t,map:o=>{if(r.has(o.record))return o;let a=Ha({bindings:e,reference:o});if(!a.ok)throw new TypeError("state-selection-reference-unresolved");return{kind:"value",value:a.value}}})}}function Ja({bindings:e,relation:t}){let r=new Set(za(t)),n=Wu(t).find(o=>!r.has(o.record)&&!Ha({bindings:e,reference:o}).ok);return n!=null?{ok:!1,path:n.path,record:n.record}:{ok:!0,relation:Gt({relation:t,map:o=>ZC({aliases:r,bindings:e,reference:o})})}}function Hl(e){return new Set([e.alias,...e.relation==null?[]:za(e.relation)])}function za(e){return e.kind==="not"?za(e.relation):e.kind==="and"||e.kind==="or"?e.relations.flatMap(t=>za(t)):e.kind==="exists"?[...Hl(e.selection)]:[...Zr(e.left),...Zr(e.right)]}function Zr(e){return e.kind==="count"?[...Hl(e.selection)]:e.kind==="add"?[...Zr(e.left),...Zr(e.right)]:e.kind==="concat"?e.values.flatMap(t=>Zr(t)):e.kind==="invert"?Zr(e.value):[]}function ZC({aliases:e,bindings:t,reference:r}){if(e.has(r.record))return r;let n=Ha({bindings:t,reference:r});if(!n.ok)throw new TypeError("state-relation-reference-unresolved");return{kind:"value",value:n.value}}function Ha({bindings:e,reference:t}){let r=e[t.record];if(r===void 0)return{ok:!1};let n=Bm({path:t.path,value:r});if(!n.ok)return n;let o=Ne.safeParse(n.value);return o.success?{ok:!0,value:o.data}:{ok:!1}}function Bm({path:e,value:t}){let[r,...n]=e;if(r==null)return{ok:!0,value:t};if(!x(t))return{ok:!1};let o=t[r];return o===void 0?{ok:!1}:Bm({path:n,value:o})}var jt={};function Kl({bindings:e,effects:t}){let r=t.flatMap(a=>Object.values(Dm(a))).find(a=>a.kind==="reference"&&!Jl({bindings:e,expression:a}).present);if(r!=null&&r.kind==="reference")return{ok:!1,path:r.path,record:r.record};let n=t.flatMap(a=>a.kind==="delete-selected-records"||a.kind==="update-selected-records"?[Ka({bindings:e,selection:a.selection})]:[]).find(a=>!a.ok);if(n!=null)return{ok:!1,path:n.path,record:n.record};let o=XC(t).map(a=>Ja({bindings:e,relation:a})).find(a=>!a.ok);return o!=null?{ok:!1,path:o.path,record:o.record}:{effects:t.map(a=>QC({bindings:e,effect:a})),ok:!0}}function XC(e){return e.flatMap(t=>[...t.kind==="transform"?[t.relation]:[],...Object.values(Dm(t)).flatMap(r=>r.kind==="transform"?[r.relation]:[])])}function QC({bindings:e,effect:t}){switch(t.kind){case"transform":return eA({bindings:e,effect:t});case"update-selected-records":return tA({bindings:e,effect:t});case"delete-selected-records":return rA({bindings:e,effect:t});case"create-record":return{...t,fields:nA({bindings:e,expressions:t.fields})};case"create-path":case"delete-path":case"set":return t}}function eA({bindings:e,effect:t}){let r=Ja({bindings:e,relation:t.relation});if(!r.ok)throw new TypeError("state-transform-reference-unresolved");return{...t,relation:r.relation}}function tA({bindings:e,effect:t}){let r=Ka({bindings:e,selection:t.selection});if(!r.ok)throw new TypeError("state-selection-reference-unresolved");return{...t,changes:oA({bindings:e,expressions:t.changes}),selection:r.selection}}function rA({bindings:e,effect:t}){let r=Ka({bindings:e,selection:t.selection});if(!r.ok)throw new TypeError("state-selection-reference-unresolved");return{...t,selection:r.selection}}function Dm(e){return e.kind==="create-record"?e.fields:e.kind==="update-selected-records"?e.changes:{}}function nA({bindings:e,expressions:t}){return Object.fromEntries(Object.entries(t).map(([r,n])=>{if(n.kind!=="reference")return[r,n];let o=Jl({bindings:e,expression:n});if(!o.present)throw new TypeError("state-effect-reference-unresolved");return[r,{kind:"value",value:o.value}]}))}function oA({bindings:e,expressions:t}){return Object.fromEntries(Object.entries(t).map(([r,n])=>{if(n.kind==="transform"){let a=Ja({bindings:e,relation:n.relation});if(!a.ok)throw new TypeError("state-transform-reference-unresolved");return[r,{kind:"transform",relation:a.relation}]}if(n.kind!=="reference")return[r,n];let o=Jl({bindings:e,expression:n});if(!o.present)throw new TypeError("state-effect-reference-unresolved");return[r,{kind:"value",value:o.value}]}))}function Jl({bindings:e,expression:t}){let r=e[t.record];return r===void 0?{present:!1}:$m(r,t.path)}function $m(e,t){let[r,...n]=t;if(r==null)return{present:!0,value:e};if(!x(e))return{present:!1};let o=e[r];return o===void 0?{present:!1}:$m(o,n)}function tt(e){return new Map(Object.entries(e).flatMap(([t,r])=>aA({id:t,state:r})))}function aA({id:e,state:t}){return[[H(e),e],...Gl({prefix:e,value:t})]}function Gl({prefix:e,value:t}){return iA(t)?[[H(e),t]]:Array.isArray(t)?t.flatMap((r,n)=>Gl({prefix:`${e}.${String(n)}`,value:r})):x(t)?Object.entries(t).flatMap(([r,n])=>Gl({prefix:`${e}.${r}`,value:n})):[]}function iA(e){return e==null||["boolean","number","string"].includes(typeof e)}function Xr(e,t){let r=De(e,Be(t));if(q(r))throw new D(Cn(e));return r}function Ga(e,t){let r=Ot(e,Be(t));if(q(r))throw new D(Cn(e));return r}function we(e,t){return e.by==="role"?{by:"role",name:e.name==null?void 0:Xr(e.name,t),role:e.role}:e.by==="inside"?{by:"inside",scope:we(e.scope,t),target:we(e.target,t)}:e.by==="surface"?{by:"surface",container:we(e.container,t),overlay:e.overlay}:e.by==="frame"?{by:"frame",element:we(e.element,t)}:{by:"testId",value:Xr(e.value,t)}}function Ya(e,t){return e.kind==="not"?{inner:Ya(e.inner,t),kind:"not"}:e.kind==="browser"?{key:e.key,kind:e.kind,value:e.value===null?null:Xr(e.value,t)}:e.kind==="value"||e.kind==="text"?{kind:e.kind,locator:we(e.locator,t),match:e.match,value:Xr(e.value,t)}:{kind:e.kind,locator:we(e.locator,t)}}function Yl(e,t){return{...e,locator:e.locator==null?void 0:we(e.locator,t),target:e.target==null?void 0:we(e.target,t),url:e.url==null?void 0:Xr(e.url,t),value:e.value===void 0?void 0:Ga(e.value,t)}}function Za(e){switch(e.kind){case"goto":return{kind:"goto",url:rt(e.url,"goto.url")};case"fill":case"select":return{kind:e.kind,locator:rt(e.locator,`${e.kind}.locator`),value:rt(e.value,`${e.kind}.value`)};case"clear":case"click":case"dblclick":case"check":case"uncheck":case"hover":return{kind:e.kind,locator:rt(e.locator,`${e.kind}.locator`)};case"upload":return{files:[...rt(e.files,"upload.files")],kind:"upload",locator:rt(e.locator,"upload.locator")};case"press":return{key:rt(e.key,"press.key"),kind:"press",locator:e.locator};case"drag":return{kind:"drag",source:rt(e.locator,"drag.source"),target:rt(e.target,"drag.target")};case"actor":return{kind:"actor",ref:{ref:rt(e.actorRef,"actor.ref")}}}}function rt(e,t){if(e===void 0)throw new Error(`Concrete action is missing ${t}`);return e}var nt=class extends Error{name="AbortError";constructor(){super("aborted")}};function ro(e){return e instanceof Error&&e.name==="AbortError"}function me(e){if(e.aborted)throw new nt}function ot(e,t){return t.aborted?Promise.reject(new nt):new Promise((r,n)=>{let o=()=>{clearTimeout(a),n(new nt)},a=setTimeout(()=>{t.removeEventListener("abort",o),r()},e);t.addEventListener("abort",o,{once:!0})})}async function Zl({bindings:e,classify:t,initialState:r,observe:n,step:o},a){if(me(a),!Qn(r,o.plan.constraints))return{kind:"required-state-unsatisfied",state:r};let i=await o.perform().match(()=>null,l=>l);if(i!=null)return{error:i,kind:"perform-failed",state:r};let s=Ce[o.sync];return jm({attempt:0,bindings:e,classify:t,deadline:Date.now()+s.timeoutMs,observe:n,plan:o.plan,pre:r,signal:a,sync:o.sync})}async function jm(e){me(e.signal);let t=await sA(e.observe);if(!t.ok)return{error:t.error,kind:"observe-failed",state:e.pre};let r=Wl({after:t.state,before:e.pre,bindings:e.bindings,effects:e.plan.effects}),n=Kl({bindings:r,effects:e.plan.effects});if(!n.ok)return Date.now()>=e.deadline?{kind:"unresolved-reference",path:n.path,record:n.record,state:t.state}:Vm(e);let o=to({observed:t.state,plan:{...e.plan,effects:[...n.effects]},pre:e.pre}),a=zl({after:t.state,bindings:r,effects:n.effects,pre:e.pre});return o.mismatches.length===0||Date.now()>=e.deadline?{bindings:r,kind:"observed",observation:o,observedEffects:a,state:t.state}:o.mismatches.some(s=>!lA(s)&&e.classify(s)==="strict")?{bindings:r,kind:"observed",observation:o,observedEffects:a,state:t.state}:Vm(e)}function sA(e){return e().match(t=>({ok:!0,state:t}),t=>({error:t,ok:!1}))}async function Vm(e){let t=Ce[e.sync];return await ot(ya(t,e.attempt),e.signal),jm({...e,attempt:e.attempt+1})}function lA(e){return e.kind==="constraint"?!1:g(e.actual)===g(e.before)}function Qr(e){let t=K(e.scalars,{kind:"path"});return typeof t=="string"?t:null}function Xa(e,t){switch(e.kind){case"step":return{checkId:ap(e.ref,t),kind:"step"};case"effect":return{checkId:op(t,e.effectIndex),kind:"step"};case"action":return{checkId:rp(t),kind:"step"};case"frame":return{checkId:np(t),kind:"step"};case"fact":return{factId:e.factId,kind:"fact"};case"dataRule":return{kind:"dataRule",ruleId:e.ruleId}}}function _m(e){return e.body.outcome.kind==="failed"}function Xl(e){return g(e)}function ei({actual:e,pre:t,predicted:r,urlReset:n}){return cA(t.scalars,r.scalars,e.scalars,n)}function cA(e,t,r,n){let o=at(r,v({kind:"path"}))!==void 0;return[...[...t.entries()].flatMap(([i,s])=>{if(s.subject.kind==="actor")return[];let l=at(r,i),c=o&&Mt(s.subject)&&s.expect.expect!=="absent",d=l===void 0&&c?null:l;if(!s.declared||d===void 0||Bn({got:d,subject:s.subject,want:s.expect})!=="fails")return[];let u=at(e,i);return[{mismatch:{kind:"scalar-mismatch",subject:s.subject,sut:d,want:s.expect},pending:u!==void 0&&Qa(u,d)}]}),...dA(e,t,r,n),...uA(e,t,r)]}function at(e,t){let r=e.get(t);if(!(r==null||r.expect.expect!=="is"))return q(r.expect.value)?void 0:r.expect.value}function Qa(e,t){return Wm(e)===Wm(t)}function Wm(e){return e==null?"\u2205":JSON.stringify(e)}function dA(e,t,r,n){let o=v({kind:"path"});if(at(r,o)===void 0)return[];let a=!Qa(at(e,o),at(r,o));return[...new Set([...e.keys(),...r.keys()])].flatMap(s=>{let l=(e.get(s)??r.get(s))?.subject;if(l==null||!Mt(l)||t.has(s))return[];let d=(a||n)&&l.kind!=="path"?null:at(e,s)??null,u=at(r,s)??null;return Qa(d,u)?[]:[{mismatch:{kind:"scalar-mismatch",subject:l,sut:u,want:{expect:"is",value:d}},pending:!1}]})}function uA(e,t,r){let n=v({kind:"actor"}),o=t.get(n);if(o==null)return[];let a=at(r,n);if(Bn({got:a,subject:{kind:"actor"},want:o.expect})!=="fails")return[];let i=at(e,n);return[{mismatch:{kind:"scalar-mismatch",subject:{kind:"actor"},sut:a??null,want:o.expect},pending:i!==void 0&&Qa(i,a)}]}var ti=()=>"strict";var Ql=()=>"strict";function ec(e){return t=>t.kind==="effect"&&pA({effect:t.effect,eventualPaths:e})?"eventual":"strict"}function pA({effect:e,eventualPaths:t}){if(e.kind==="set"||e.kind==="transform")return fA({eventualPaths:t,selector:e.selector});if(e.kind!=="update-selected-records")return!1;let r=Object.keys(e.changes);return r.length>0&&r.every(n=>yA({eventualPaths:t,field:n,selector:e.selector}))}function fA({eventualPaths:e,selector:t}){return e.some(r=>Uu({pattern:r,selector:t}))}function yA({eventualPaths:e,field:t,selector:r}){return e.some(n=>n.source===r.source&&n.recordKeyIndex===r.path.length&&mA(n.path,[...r.path,t]))}function mA(e,t){return e.length===t.length&&e.every((r,n)=>r===t[n])}function tc({check:e,ephemeral:t,failure:r,rrwebIds:n,waitedMs:o}){let{check:a,negated:i}=Um(e,!1),s={ephemeral:t,rrwebIds:[...n],waitedMs:o};switch(a.kind){case"visible":case"unobstructed":case"disabled":case"enabled":case"focused":case"checked":case"expanded":case"pressed":return{...s,checkKind:a.kind,family:"element",locator:a.locator,negated:i,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:hA(r)},shape:"concrete"};case"value":case"text":return{...s,checkKind:a.kind,expected:a.value,family:"content",locator:a.locator,match:a.match,negated:i,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:gA(r)},shape:"concrete"};case"browser":return{...s,expected:a.value,family:"scalar",locator:null,negated:i,outcome:r==null?{kind:"passed"}:{kind:"failed",reason:SA(r)},shape:"concrete",subject:nr(a.key),subjectKey:v(a.key),subjectKind:a.key.kind}}}function Um(e,t){return e.kind==="not"?Um(e.inner,!t):{check:e,negated:t}}function hA(e){return e.kind==="wrongContent"?{kind:"unclassified",message:qm(e)}:e}function qm(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 gA(e){return e.kind==="wrongState"||e.kind==="covered"?{kind:"unclassified",message:qm(e)}:e}function rc({env:e,observed:t,passed:r,planned:n,waitedMs:o}){let a=n.entry.subject;return{ephemeral:!1,expected:nc(n.entry.expect,e),family:"scalar",locator:a.kind==="element"?we(a.locator,e):null,negated:n.entry.expect.expect==="not",outcome:r?{kind:"passed"}:{kind:"failed",reason:{kind:"wrongScalar",observed:t}},rrwebIds:[],shape:"concrete",subject:a.kind==="element"?null:zn(a),subjectKey:v(a),subjectKind:a.kind,waitedMs:o}}function nc(e,t){switch(e.expect){case"absent":return null;case"is":case"not":return Ft(Ga(e.value,t))}}function SA(e){return e.kind==="wrongContent"?{kind:"wrongScalar",observed:e.observed}:{kind:"wrongScalar",observed:null}}function ri({failure:e,waitedMs:t}){return{ephemeral:!1,family:"frame",outcome:e==null?{kind:"passed"}:{kind:"failed",reason:e},rrwebIds:[],waitedMs:t}}function oc({action:e,failure:t,rrwebIds:r,waitedMs:n}){return{action:Za(e),ephemeral:!1,family:"action",outcome:t==null?{kind:"passed"}:{kind:"failed",reason:t},rrwebIds:[...r],shape:"concrete",waitedMs:n}}function ac({env:e,mismatch:t}){let r=t.subject;return r.kind==="element"?bA({env:e,mismatch:t,subject:r}):{expected:nc(t.want,e),kind:"wrongScalar",observed:t.sut==null?null:Ft(t.sut),subject:zn(r),subjectKey:v(r)}}function bA({env:e,mismatch:t,subject:r}){let n=ce(we(r.locator,e)),o=v(r);return r.state==="text"||r.state==="value"?{checkKind:r.state,expected:nc(t.want,e),kind:"wrongElementContent",observed:t.sut==null?null:Ft(t.sut),subject:n,subjectKey:o}:{checkKind:r.state,kind:"wrongElementState",observed:t.sut===!0,subject:n,subjectKey:o}}async function ic({onRemaining:e,pendingChecks:t,signal:r,windowStartMs:n}){let o=[...new Map(t.map(s=>[Xl(s.source),s])).values()];e?.(o);let a=o.map((s,l)=>({ordinal:l,pendingCheck:s,result:(async()=>{let c=await xA({pendingCheck:s,signal:r,windowStartMs:n}),d=Date.now(),u=await s.targetIds();return{atMs:d,ordinal:l,outcome:c,pendingCheck:s,rrwebIds:u}})()})),i=await zm({onRemaining:e,pending:a});return{checks:i.flatMap(s=>s.outcome.kind==="error"?[]:[RA({atMs:s.atMs,outcome:s.outcome,pendingCheck:s.pendingCheck,rrwebIds:s.rrwebIds,windowStartMs:n})]),stepErrors:i.flatMap(s=>s.outcome.kind==="error"?[{atMs:s.atMs,error:s.outcome.error}]:[])}}async function zm({onRemaining:e,pending:t}){if(t.length===0)return[];let r=await Promise.race(t.map(({result:a})=>a)),n=t.filter(({ordinal:a})=>a!==r.ordinal);e?.(n.map(({pendingCheck:a})=>a));let o=await zm({onRemaining:e,pending:n});return[r,...o].toSorted((a,i)=>a.ordinal-i.ordinal)}function RA({atMs:e,outcome:t,pendingCheck:r,rrwebIds:n,windowStartMs:o}){let a=Math.max(0,e-o);return{atMs:e,body:tc({check:r.resolve(),ephemeral:r.ephemeral,failure:vA(t),rrwebIds:n,waitedMs:a}),target:wA(r.source)}}function vA(e){return e.kind==="passed"?null:e.failure??{kind:"unclassified",message:"check failed without diagnosis"}}function wA(e){switch(e.kind){case"step":return{kind:"step",ref:e.ref};case"fact":return{factId:Xl(e),kind:"fact"}}}var EA=250;async function xA({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(EA,Ce[e.budget].timeoutMs-n);return r.wait(o).match(async a=>a?{kind:"passed"}:kA(r.diagnose),a=>Promise.resolve(Hm(a)))}function kA(e){return e().match(t=>({failure:t,kind:"failed"}),t=>Hm(t))}function Hm(e){if(e.kind==="aborted")throw new nt;return{error:e,kind:"error"}}function Km(e){let t=CA(e);return[...OA(e,t),...MA(e,t)]}function CA(e){return e.mismatches.reduce((t,r)=>AA(t,r.mismatch,e),{frame:[],scalar:new Map})}function AA(e,t,r){return PA(e,t,r)}function PA(e,t,r){let n=v(t.subject),o=r.scalarChecks.find(a=>!e.scalar.has(a)&&v(a.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 OA(e,t){return e.scalarChecks.map(r=>{let n=t.scalar.get(r),o=n?.sut==null?null:Ft(n.sut);return{atMs:e.atMs,body:rc({env:e.env,observed:o,passed:n==null,planned:r,waitedMs:e.waitedMs}),target:{kind:"step",ref:r.ref}}})}function MA(e,t){return t.frame.length===0?[{atMs:e.atMs,body:ri({failure:null,waitedMs:e.waitedMs}),target:{kind:"frame"}}]:t.frame.map(r=>({atMs:e.atMs,body:ri({failure:ac({env:e.env,mismatch:r}),waitedMs:e.waitedMs}),target:{kind:"frame"}}))}async function Zm({claimed:e,classify:t,observe:r,pre:n,predicted:o,signal:a,step:i}){let s=Ce[i.sync],l=Date.now()+s.timeoutMs,c=i.source.action.kind==="goto",d=$e(n.scalars,o.scalars),u=new Map([...d].filter(([f,b])=>b.declared&&(b.subject.kind!=="element"||e.has(f)))),p=()=>r(u),y=await Gm(p);if(!y.ok)return{mismatches:[],snapshot:o,stepError:{atMs:Date.now(),error:y.error}};let m=Ym({pre:n,predicted:o,urlReset:c},y.observed),h=0;for(;Date.now()<l;){me(a);let f=Jm(m,i,t);if(f!=null)return f;await ot(ya(s,h),a),h+=1;let b=await Gm(p);if(!b.ok)return{mismatches:m.probed,snapshot:m.adopted,stepError:{atMs:Date.now(),error:b.error}};m=Ym({pre:n,predicted:o,urlReset:c},b.observed)}return Jm(m,i,t)??{mismatches:m.probed,snapshot:m.adopted,stepError:null}}function Jm(e,t,r){let n=new Set(t.urlChecks.flatMap(a=>Xm(a))),o=e.probed.filter(a=>!a.pending&&!TA(a,n)&&r(a.mismatch)==="strict");return o.length>0?{mismatches:o,snapshot:e.adopted,stepError:null}:e.probed.length===0?{mismatches:[],snapshot:e.adopted,stepError:null}:null}function Gm(e){return e().match(t=>({observed:t,ok:!0}),t=>({error:t,ok:!1}))}function Ym({pre:e,predicted:t,urlReset:r},n){return{adopted:t,probed:ei({actual:n.snapshot,pre:e,predicted:t,urlReset:r})}}function Xm(e){return e.kind==="not"?Xm(e.inner):e.kind==="browser"?[v(e.key)]:[]}function TA(e,t){return t.has(v(e.mismatch.subject))}function lc({atMs:e,effects:t,mismatches:r,observed:n,waitedMs:o}){let a=IA({effects:t,mismatches:r}),i=new Set(a.map(c=>c.mismatch)),s=t.map((c,d)=>({atMs:e,body:NA({effect:c,mismatch:a.find(u=>u.effectIndex===d)?.mismatch,observed:n?.[d],waitedMs:o}),target:{effectIndex:d,kind:"effect"}})),l=r.filter(c=>c.kind!=="effect"||!i.has(c)).map(c=>({atMs:e,body:KA({mismatch:c,waitedMs:o}),target:{kind:"frame"}}));return[...s,...l]}function IA({effects:e,mismatches:t}){return t.filter(r=>r.kind==="effect").reduce((r,n)=>{let o=e.findIndex((a,i)=>!r.used.has(i)&&LA({effect:a,mismatch:n}));return o===-1?r:{indexed:[...r.indexed,{effectIndex:o,mismatch:n}],used:new Set([...r.used,o])}},{indexed:[],used:new Set}).indexed}function LA({effect:e,mismatch:t}){return e.kind===t.effect.kind&&g(e.selector)===g(t.selector)}function NA({effect:e,mismatch:t,observed:r,waitedMs:n}){return cc(e)?FA({effect:e,mismatch:t,observed:r,waitedMs:n}):$A({effect:e,mismatch:t,observed:r,waitedMs:n})}function cc(e){return e.kind==="create-record"||e.kind==="delete-selected-records"||e.kind==="update-selected-records"}function FA({effect:e,mismatch:t,observed:r,waitedMs:n}){let o=rh(e.selector);return{assertion:DA(e),entity:o,ephemeral:!1,family:"state",outcome:t==null?BA(r):{kind:"failed",observed:Qm(r),reason:_A(t)},rrwebIds:[],subject:VA({effect:e,entity:o}),waitedMs:n}}function BA(e){let t=Qm(e);return t==null?{kind:"passed"}:{kind:"passed",observed:t}}function Qm(e){if(!(e==null||e.kind!=="records"||e.rows.length===0))return e.rows.map(t=>({...t}))}function DA(e){return e.kind==="create-record"?"created":e.kind==="delete-selected-records"?"deleted":"updated"}function $A({effect:e,mismatch:t,observed:r,waitedMs:n}){return{ephemeral:!1,expected:eh(e),family:"scalar",locator:null,negated:!1,outcome:t==null?jA(r):{kind:"failed",reason:{kind:"wrongScalar",observed:dc(t.actual)}},rrwebIds:[],shape:"concrete",subject:th(e.selector),subjectKey:g(e.selector),subjectKind:"variable",waitedMs:n}}function VA({effect:e,entity:t}){return e.kind==="create-record"?`${t} ${e.as}`:_s(e.selection)}function jA(e){return e==null||e.kind!=="scalar"?{kind:"passed"}:{kind:"passed",observed:e.value}}function eh(e){return e.kind==="delete-path"?null:e.kind==="transform"?Xu(e.relation):We(e.value)}function _A(e){let{effect:t}=e,r=rh(t.selector);return cc(t)?t.kind==="create-record"?WA({effect:t,entity:r,mismatch:e}):t.kind==="delete-selected-records"?UA({entity:r,mismatch:e}):qA({effect:t,entity:r,mismatch:e}):{entity:r,key:r,kind:"missingRow"}}function WA({effect:e,entity:t,mismatch:r}){let o=HA({actual:r.actual,before:r.before})?.added[0];if(o!=null&&x(o)){let a=Object.entries(e.fields).find(([i,s])=>s.kind==="value"&&g(o[i])!==g(s.value));if(a!=null&&a[1].kind==="value")return{entity:t,expected:We(a[1].value),field:a[0],key:e.as,kind:"wrongValue",observed:We(o[a[0]])}}return{entity:t,key:e.as,kind:"missingRow"}}function UA({entity:e,mismatch:t}){let r=t.targetKeys.find(n=>sc({key:n,observed:t.actual}).present);return{entity:e,key:r??t.targetKeys[0]??e,kind:"unexpectedRow"}}function qA({effect:e,entity:t,mismatch:r}){return r.targetKeys.flatMap(o=>zA({effect:e,entity:t,key:o,mismatch:r}))[0]??{entity:t,key:r.targetKeys[0]??_s(e.selection),kind:"missingRow"}}function zA({effect:e,entity:t,key:r,mismatch:n}){let o=sc({key:r,observed:n.before});if(!o.present||!x(o.value))return[{entity:t,key:r,kind:"missingRow"}];let a=o.value,i=sc({key:r,observed:n.actual});if(!i.present||!x(i.value))return[{entity:t,key:r,kind:"unexpectedlyDeleted"}];let s=i.value,l=Object.entries(e.changes).flatMap(([d,u])=>{let p=s[d];return u.kind!=="value"||g(u.value)===g(p)?[]:[{entity:t,expected:We(u.value),field:d,key:r,kind:"wrongValue",observed:We(p)}]})[0];if(l!=null)return[l];let c=Object.keys({...a,...s}).find(d=>!(d in e.changes)&&g(a[d])!==g(s[d]));return c!=null?[{entity:t,expected:We(a[c]),field:c,key:r,kind:"wrongValue",observed:We(s[c])}]:[]}function sc({key:e,observed:t}){if(!t.present||!x(t.value))return{present:!1};let r=t.value[e];return r===void 0?{present:!1}:{present:!0,value:r}}function HA({actual:e,before:t}){if(!(!e.present||!t.present||!x(e.value)||!x(t.value)))return qa({after:e.value,before:t.value})}function KA({mismatch:e,waitedMs:t}){return{ephemeral:!1,family:"frame",outcome:{kind:"failed",reason:{expected:JA(e),kind:"wrongScalar",observed:dc(e.actual),subject:th(e.selector),subjectKey:g(e.selector)}},rrwebIds:[],waitedMs:t}}function JA(e){return e.kind==="unexpected-change"?dc(e.before):e.kind==="constraint"?GA(e.constraint):cc(e.effect)?e.effect.kind:eh(e.effect)}function dc(e){return e.present?We(e.value):null}function We(e){return e===void 0?"\u2205":JSON.stringify(e)}function GA(e){return e.kind==="absent-path"||e.kind==="absent-record"?null:e.kind==="equals"?We(e.value):e.kind==="required-record"?We(e.fields):e.kind==="relation"?e.label:We(e.rows)}function th(e){return e.path.join(".")}function rh(e){return e.path.at(-1)??e.source}function en(e){if(e.kind==="not")return en(e.inner);if(e.kind!=="browser")return e.locator}function uc(e){switch(e.kind){case"goto":return{kind:e.kind,path:YA(kt(no(e.url)))};case"fill":case"clear":case"click":case"dblclick":case"select":case"check":case"uncheck":case"hover":case"upload":return{kind:e.kind,target:ce(no(e.locator))};case"press":return{key:no(e.key),kind:e.kind,target:e.locator==null?null:ce(e.locator)};case"drag":return{kind:e.kind,source:ce(no(e.locator)),target:ce(no(e.target))};case"actor":return{kind:e.kind}}}function pc({check:e,id:t}){return nh({check:e,id:t,negated:!1})}function nh({check:e,id:t,negated:r}){return e.kind==="not"?nh({check:e.inner,id:t,negated:!r}):e.kind==="browser"?{id:t,kind:e.kind,negated:r,subject:nr(e.key)}:e.kind==="text"||e.kind==="value"?{check:e.kind,id:t,kind:"content",negated:r,target:ce(e.locator)}:{check:e.kind,id:t,kind:"element",negated:r,target:ce(e.locator)}}function YA(e){let t=e.split(/[?#]/u)[0];return t==null||t.length===0?"/":t}function no(e){if(e===void 0)throw new TypeError("resolved-progress-value-required");return e}function oh({params:e,startMs:t,step:r}){let n=uc(r.step.action);ni({deadlineAt:oo(t,Ce[r.sync].timeoutMs),params:e,stage:{action:n,kind:"performingAction"}}),n.kind==="goto"&&ni({deadlineAt:oo(t,Ce[r.sync].timeoutMs),params:e,stage:{kind:"waitingForApp",path:n.path}})}function fc({deadlineAt:e,kind:t,params:r}){ni({deadlineAt:e,params:r,stage:{kind:t}})}function yc({params:e,remaining:t,startMs:r,step:n}){ni({deadlineAt:XA({remaining:t,startMs:r}),params:e,stage:{kind:"checkingExpectations",remaining:t.map(o=>ZA({pendingCheck:o,step:n}))}})}function ZA({pendingCheck:e,step:t}){let r=t.pendingChecks.indexOf(e);if(r===-1)throw new TypeError("pending-progress-check-not-found");return pc({check:e.source.check,id:`expectation-${String(r)}`})}function XA({remaining:e,startMs:t}){let r=e.reduce((n,o)=>Math.max(n,Ce[o.budget].timeoutMs),0);return r===0?null:oo(t,r)}function oo(e,t){return new Date(e+t).toISOString()}function ni({deadlineAt:e,params:t,stage:r}){t.onProgress?.({activity:{kind:"executingStep",stage:r,stepCount:t.stepCount,stepIndex:t.stepBase+t.index},deadlineAt:e,retry:null})}function QA(e){return e.stepError!=null||e.findings.length>0||e.checks.some(t=>_m(t))}var eP=()=>ft;async function ai({classify:e,derive:t,initialSnapshot:r,observe:n,onProgress:o,onStep:a,stepBase:i,stepCount:s,steps:l,stopAfterStep:c},d){return ah({classify:e,derive:t??eP,failed:!1,findings:[],index:0,observe:n,onProgress:o,onStep:a,signal:d,snapshot:r,stepBase:i,stepCount:s,steps:l,stopAfterStep:c})}async function ah(e){let{index:t,signal:r,snapshot:n,steps:o}=e;me(r);let a=o[t];if(a==null)return{failed:e.failed,finalModel:n,findings:e.findings};let i=Date.now();oh({params:e,startMs:i,step:a});let s=await a.targetIds();if(!a.requiredState(n)){let l={kind:"impossible-action",step:a.step},c=a.resolveAction();return mc(e.onStep,{action:c,checks:[oi({action:c,failure:{kind:"notPossible"},rrwebIds:s,startMs:i})],endMs:Date.now(),executedBranches:a.executedBranches,findings:[l],index:t,post:n,pre:n,source:a.source,startMs:i,stateBindings:jt,step:a.step,stepError:null,url:Qr(n)}),{failed:!0,finalModel:n,findings:[...e.findings,l]}}return a.perform().match(l=>nP({params:e,performed:l,rrwebIds:s,startMs:i,step:a}),l=>tP({error:l,params:e,rrwebIds:s,startMs:i,step:a}))}async function tP({error:e,params:t,rrwebIds:r,startMs:n,step:o}){let{action:a,checks:i,stepError:s}=rP({error:e,rrwebIds:r,startMs:n,step:o}),l=e.kind==="state-mismatch"?await ic({pendingChecks:o.pendingChecks,signal:t.signal,windowStartMs:n,onRemaining:c=>{yc({params:t,remaining:c,startMs:n,step:o})}}):{checks:[],stepErrors:[]};return mc(t.onStep,{action:a,checks:[...i,...l.checks],endMs:Date.now(),executedBranches:o.executedBranches,findings:[],index:t.index,post:t.snapshot,pre:t.snapshot,source:o.source,startMs:n,stateBindings:jt,step:o.step,stepError:sh([...s==null?[]:[s],...l.stepErrors]),url:Qr(t.snapshot)}),{failed:!0,finalModel:t.snapshot,findings:t.findings}}function rP({error:e,rrwebIds:t,startMs:r,step:n}){if(e.kind==="action-failed"){let o=n.resolveAction();return{action:o,checks:[oi({action:o,failure:e.failure,rrwebIds:t,startMs:r})],stepError:null}}if(e.kind==="state-mismatch"){let o=Date.now(),a=n.resolveAction();return{action:a,checks:[oi({action:a,failure:null,rrwebIds:t,startMs:r}),...lc({atMs:o,effects:n.source.effects,mismatches:e.mismatches,observed:void 0,waitedMs:Math.max(0,o-r)})],stepError:null}}return{action:null,checks:[],stepError:{atMs:Date.now(),error:e}}}function oi({action:e,failure:t,rrwebIds:r,startMs:n}){let o=Date.now();return{atMs:o,body:oc({action:e,failure:t,rrwebIds:r,waitedMs:Math.max(0,o-n)}),target:{kind:"action"}}}async function nP({params:e,performed:t,rrwebIds:r,startMs:n,step:o}){let{snapshot:a}=e,i=o.effect(a),s=e.derive(i),l={...i,scalars:$e(s,i.scalars)};fc({deadlineAt:oo(n,Ce[o.sync].timeoutMs),kind:"readingState",params:e});let c=await Zm({claimed:new Set([...o.assertedScalars,...s.keys()]),classify:e.classify,observe:e.observe,pre:a,predicted:l,signal:e.signal,step:o}),d={...c.snapshot,scalars:new Map([...[...c.snapshot.scalars].filter(([,E])=>E.subject.kind!=="element"),...[...i.scalars].filter(([,E])=>E.subject.kind==="element")])},u=Date.now();fc({deadlineAt:null,kind:"verifyingEffects",params:e});let p=await ic({pendingChecks:o.pendingChecks,signal:e.signal,windowStartMs:n,onRemaining:E=>{yc({params:e,remaining:E,startMs:n,step:o})}}),y=oi({action:t.action,failure:null,rrwebIds:r,startMs:n}),m=t.stateEffectsVerified?lc({atMs:u,effects:o.source.effects,mismatches:[],observed:t.observedEffects??void 0,waitedMs:Math.max(0,u-n)}):[],h=Km({atMs:u,env:tt(t.stateBindings),mismatches:c.mismatches,pendingElementKeys:oP(o.pendingChecks),scalarChecks:o.scalarChecks,waitedMs:Math.max(0,u-n)}),f=[y,...p.checks,...m,...h],b=sh([...c.stepError==null?[]:[c.stepError],...p.stepErrors]),w={action:t.action,checks:f,endMs:Date.now(),executedBranches:o.executedBranches,findings:[],index:e.index,post:c.snapshot,pre:a,source:o.source,startMs:n,stateBindings:t.stateBindings,step:o.step,stepError:b,url:Qr(c.snapshot)};return mc(e.onStep,w),QA(w)?{failed:!0,finalModel:d,findings:e.findings}:e.stopAfterStep!=null&&e.index+1>=e.stopAfterStep?{failed:!1,finalModel:d,findings:e.findings}:ah({...e,index:e.index+1,snapshot:d})}function oP(e){return new Set(e.flatMap(t=>{if(!("check"in t.source))return[];let r=en(t.source.check);return r==null?[]:aP(t.source.check,r)}))}function aP(e,t){let r=ih(e);return r==="browser"||r==="unobstructed"||r==="disabled"?[]:[xr(t,r)]}function ih(e){return e.kind==="not"?ih(e.inner):e.kind}function sh(e){return e.at(0)??null}function mc(e,t){e?.(t)}function hc(e,t){return{singletons:[...t.scalars.values()].flatMap(n=>{if(n.subject.kind!=="variable"||n.expect.expect!=="is")return[];let o=n.expect.value;if(q(o))return[];let a=n.subject.name;return[{changed:K(e.scalars,n.subject)!==o,name:a,value:o}]})}}function tn({driver:e,parameters:t,resolved:r,transition:n}){return r.steps.map(o=>({assertedScalars:o.assertedScalars,executedBranches:o.executedBranches,pendingChecks:o.pendingChecks.map(a=>({budget:a.budget,check:{kind:"poll",diagnose:()=>e.diagnoseCheck(a.check),wait:i=>e.awaitCheck(a.check,i)},ephemeral:a.ephemeral,source:{check:a.check,kind:"step",ref:a.ref},resolve:()=>iP(e,a.check),targetIds:()=>e.locateIds(en(a.check))})),scalarChecks:o.scalarChecks,source:o.source,step:{action:o.action,intent:n.intent,test:n.test},sync:n.wait,urlChecks:o.urlChecks,effect:a=>sP({driver:e,pendingChecks:o.pendingChecks,snapshot:o.effect(a)}),perform:()=>e.perform({action:o.action,effects:o.effects,parameters:t,sync:n.wait}),requiredState:()=>!0,resolveAction:()=>{let a=e.resolveAction({action:o.action,parameters:t});if(a==null)throw new D(`${o.action.kind} action`);return a},targetIds:()=>e.locateIds(o.action.locator)}))}function iP(e,t){let r=e.resolveCheck(t);if(r==null)throw new D(`${t.kind} check`);return r}function sP({driver:e,pendingChecks:t,snapshot:r}){let n=t.reduce((o,a)=>{let i=e.resolveCheck(a.check),s=i==null?null:lh({check:i,negated:!1});return s==null?o:yt(o,s)},r.scalars);return n===r.scalars?r:{...r,scalars:n}}function lh({check:e,negated:t}){return e.kind==="not"?lh({check:e.inner,negated:!t}):e.kind!=="browser"||e.value!==null&&q(e.value)?null:e.value===null?{declared:!0,expect:{expect:"absent"},subject:e.key}:{declared:!0,expect:t?{expect:"not",value:e.value}:{expect:"is",value:e.value},subject:e.key}}async function ch({current:e,driver:t,index:r,next:n,state:o}){if(n==null||lP(n))return[];if(ar(e.transition.effectStep))return[];let a=dr(n.transition,o,n.params);if(a==null)return[];let i=tn({driver:t,parameters:n.params,resolved:a.resolved,transition:n.transition}).flatMap(c=>c.pendingChecks.flatMap(d=>{let u=cP(d.source);return u==null?[]:[u]}));if(i.length===0)return[];let s=new Map(i.map(c=>{let d={kind:"element",locator:c,state:"visible"};return[v(d),{declared:!0,expect:{expect:"is",value:!0},subject:d}]})),l=await t.observe(s).match(c=>c,()=>null);return l==null?[]:i.filter(c=>{let d={kind:"element",locator:c,state:"visible"},u=K(l.snapshot.scalars,d)===!0,p=K(o.snapshot.scalars,d)===!1;return u&&p}).map(c=>({declaredIndex:r+1,kind:"lift-visibility",locator:c,visibleIndex:r}))}function lP(e){return e.transition.nav.length>0||e.transition.steps.some(t=>t.action.kind==="goto"||ar(t))}function cP(e){return e.check.kind==="visible"?e.check.locator:void 0}function ii(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 si(e){return e.filter(t=>t.kind!=="finding"||t.finding.kind!=="unrunnable")}function ao(e){return si(e).filter(t=>t.kind!=="finding"||t.finding.kind!=="lift-visibility")}function io(e){return e.filter(t=>t.kind==="finding"&&t.finding.kind==="lift-visibility")}function dP({state:e,transition:t}){let r=cr({current:e.logical,required:{constraints:t.logicalRequiredState}});return r.kind==="holds"?r.witnesses:In}async function Sc(e,t){let{params:r,transition:n}=e.stepRun,o={base:e.state.base,deferred:e.state.deferred,logical:e.state.logical,ordinal:e.state.ordinal,snapshot:_r({logical:e.state.logical,model:e.facts,snapshot:e.state.snapshot})},a=dr(n,o,r);if(a==null){let s=Jn(n,o,r),l={intent:n.intent,kind:"unrunnable",reason:s,test:n.test,unmet:s==="required-state-unsatisfied"?ef({base:o.base,deferred:o.deferred,logical:o.logical,pattern:n.requiredState,snapshot:o.snapshot,witnesses:dP({state:o,transition:n})})??void 0:void 0};return{label:sr(n),next:e.state,result:{failed:!0,finalModel:e.state.snapshot,findings:[l]}}}let i=await ai({classify:e.classify,initialSnapshot:e.state.snapshot,observe:e.driver.observe,onProgress:e.onProgress,onStep:e.onStep,stepBase:e.stepBase,stepCount:e.stepCount,steps:tn({driver:e.driver,parameters:e.stepRun.params,resolved:a.resolved,transition:e.stepRun.transition}),stopAfterStep:e.stopAfterStep==null?void 0:e.stopAfterStep-e.stepBase,derive:s=>Un({logical:a.next.logical,model:e.facts,snapshot:s})},t);return{label:sr(e.stepRun.transition),next:{base:a.next.base,deferred:a.next.deferred,logical:a.next.logical,ordinal:a.next.ordinal,snapshot:i.finalModel},result:i}}function li(e,t){return gc({acc:{contradictions:[],failed:!1,findings:[],ran:[]},index:0,params:e,signal:t,state:e.initialState,stepBase:0})}function uP(e){return e.reduce((t,r)=>t+r.transition.nav.length+r.transition.steps.length,0)}async function gc({acc:e,index:t,params:r,signal:n,state:o,stepBase:a}){me(n);let i=r.sequence[t];if(i==null)return e;let s=Date.now(),l=[],c=[],d=await Sc({classify:r.classify,driver:r.driver,facts:r.facts,onProgress:r.onProgress,state:o,stepBase:a,stepCount:uP(r.sequence),stepRun:i,stopAfterStep:r.stopAfterStep,onStep:m=>{l.push(m.index);let h={action:m.action,checks:m.checks,endMs:m.endMs,executedBranches:m.executedBranches,findings:m.findings,index:a+m.index,kind:"step",source:m.source,startMs:m.startMs,state:hc(m.pre,m.post),stateBindings:m.stateBindings,step:m.step,stepError:m.stepError,url:m.url};c.push(...ii(h)),r.onEvent(h)}},n);if(d==null)return gc({acc:e,index:t+1,params:r,signal:n,state:o,stepBase:a});r.onEvent({endMs:Date.now(),intent:i.transition.intent,kind:"ran",startMs:s});let u=await pP({index:t,outcome:d,params:r,signal:n,state:o,stepBase:a,stepRun:i},l),p=l.length>0?[]:d.result.findings,y={contradictions:[...e.contradictions,...c,...p.map(m=>({finding:m,kind:"finding"})),...u.map(m=>({finding:m,kind:"finding"}))],failed:e.failed||d.result.failed||c.length>0||u.length>0,findings:[...e.findings,...d.result.findings,...u],ran:[...e.ran,d.label]};return d.result.failed||c.length>0||u.length>0||r.stopAfterStep!=null&&a+l.length>=r.stopAfterStep?y:gc({acc:y,index:t+1,params:r,signal:n,state:d.next,stepBase:a+l.length})}async function pP(e,t){let{index:r,outcome:n,params:o,stepBase:a,stepRun:i}=e,s=t.length>0;!s&&n.result.findings.length>0&&dh(o,i,e.state,a,n.result.findings);let l=o.sequence[r+1],c=s?await ch({current:i,driver:o.driver,index:r,next:l,state:n.next}):[];return n.result.findings.forEach(d=>{o.onEvent({finding:d,kind:"finding"})}),c.forEach(d=>{o.onEvent({finding:d,kind:"finding"})}),c.length>0&&l!=null&&dh(o,l,n.next,a+t.length,c),c}function dh(e,t,r,n,o){let a=Date.now(),i=K(r.snapshot.scalars,{kind:"path"});e.onEvent({action:null,checks:[],endMs:a,executedBranches:[],findings:o,index:n,kind:"step",source:t.transition.steps[0]??t.transition.effectStep,startMs:a,state:hc(r.snapshot,r.snapshot),stateBindings:jt,step:null,stepError:null,url:typeof i=="string"?i:null})}function ph(e){let t=new Map;return e.forEach(r=>{fP(r).forEach(n=>{so(n,t)})}),t}function Rc(e,t){let r=yP(e.consequence,t);if(r.length===0)return e.when;let n=new Map(e.when.scalars);return r.forEach(o=>n.set(v(o.subject),o)),{...e.when,scalars:n}}function fP(e){let t=[...e.when.scalars.values()].flatMap(n=>n.subject.kind==="element"?[n.subject.locator]:[]),r=fh(e.consequence);return r==null?t:[...t,r]}function fh(e){return e.kind==="not"?fh(e.predicate):"locator"in e?e.locator:void 0}function so(e,t){if(e.by==="inside"){let r=yh(bc(e.scope));t.set(r,[...t.get(r)??[],e]),so(e.scope,t),so(e.target,t);return}if(e.by==="surface"){so(e.container,t);return}e.by==="frame"&&so(e.element,t)}function yh(e){return xr(e,"visible")}function bc(e){return e.by==="frame"?e.element:e}function yP(e,t){let r=mP(e);if(r!=null)return(t.get(yh(bc(r)))??[]).map(o=>uh(o,!1));let n=hP(e);return n==null?[]:[uh(bc(n),!0)]}function mP(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function uh(e,t){return{expect:{expect:"is",value:t},subject:{kind:"element",locator:e,state:"visible"}}}function hP(e){return e.kind!=="visible"||e.locator.by!=="inside"?null:e.locator.scope}function lo(e){return e.origin==null||e.origin.kind==="declared"?[]:[{test:e.origin.test,when:e.when}]}function Sh({facts:e}){let r=[...e.reduce((a,i)=>{let s=ae(i.consequence);if(s==null)return a;let l=v(s.subject);return new Map([...a,[l,[...a.get(l)??[],i]]])},new Map).values()].flatMap(a=>a.flatMap((i,s)=>a.slice(s+1).filter(l=>gP(i,l)&&SP(i.consequence,l.consequence)).map(l=>[i,l]))),n=ph(e),o=r.map(([a,i])=>{let s=At({general:a.when,specific:i.when})&&Oe({current:i.logicalWhen,required:a.logicalWhen}),l=At({general:i.when,specific:a.when})&&Oe({current:a.logicalWhen,required:i.logicalWhen});return s!==l?null:Rf({left:a.logicalWhen,right:i.logicalWhen})&&(s||An({aligned:!0,patterns:[Rc(a,n),Rc(i,n)]}))?vP(a,i):null});return wP(o.filter(a=>a!=null))}function gP(e,t){let r=mh(e),n=mh(t);return r==null||n==null||r===n}function mh(e){return e.localConsequence&&e.origin?.kind==="test"?e.origin.test:void 0}function SP(e,t){let r=ae(e),n=ae(t);return r==null||n==null||v(r.subject)!==v(n.subject)?!1:bP(r,n)}function bP(e,t){return RP(e)?gh(e,t):e.expect.expect==="is"&&t.expect.expect==="is"?g(e.expect.value)!==g(t.expect.value):gh(e,t)}function RP(e){return e.subject.kind==="element"&&e.subject.state==="text"}function vP(e,t){let r=lo(e),n=lo(t);return{a:e.consequence,aProducers:r,b:t.consequence,bProducers:n,tests:[...new Set([...hh(e),...hh(t)])],when:e.when}}function hh(e){return e.origin==null?[]:e.origin.kind==="declared"?[]:[e.origin.test]}function wP(e){return[...e.reduce((r,n)=>{let o=[g(n.a),g(n.b)].toSorted((s,l)=>s.localeCompare(l)).join("|"),a=r.get(o),i=a==null?n:{...a,tests:[...new Set([...a.tests,...n.tests])]};return new Map([...r,[o,i]])},new Map).values()]}function gh(e,t){let r=[e.expect,t.expect],n=r.find(a=>a.expect==="is"),o=r.find(a=>a.expect==="not");return n==null||o==null?!1:g(n.value)===g(o.value)}function bh(e){return e.workflows.flatMap(t=>vp({workflow:t}))}function Rh(e){return Y(e).flatMap(({test:t})=>lr(e,t).flatMap(r=>r.actionRelationship!=="undecided"?[]:[{action:r.effectStep.action,expectations:yl(r.effectStep),stepIndex:r.index,test:r.test}]))}function vh(e){return Y(e).flatMap(({test:t})=>EP(t.steps,ne(t)))}function EP(e,t){return e.reduce((r,n)=>{let o=xP(n.action).filter(a=>!kP(a,r.pre)).map(a=>({action:n.action,ephemeralOnly:r.ephemeralKeys.has(g(fe(a))),target:a,test:t}));return{ephemeralKeys:new Set([...r.ephemeralKeys,...CP(n)]),pre:Qe(r.pre,[n]),violations:[...r.violations,...o]}},{ephemeralKeys:new Set,pre:Xt,violations:[]}).violations}function xP(e){return e.kind==="goto"||e.kind==="upload"?[]:e.kind==="drag"?[e.source,e.target]:"locator"in e&&e.locator!=null?[e.locator]:[]}function kP(e,t){let r=g(fe(e)),n=[...t.values()].filter(a=>a.subject.kind==="element"&&g(fe(a.subject.locator))===r);if(n.length===0)return!1;let o=a=>n.some(i=>i.subject.kind==="element"&&i.subject.state===a&&i.expect.expect==="is"&&i.expect.value===!1);return!o("visible")&&!o("enabled")}function CP(e){return Br(e.expect).filter(t=>Zt(t)).flatMap(t=>wh(t)).map(t=>g(fe(t)))}function wh(e){return e.kind==="not"?wh(e.predicate):"locator"in e?[e.locator]:[]}function Eh(e){let t=et(e);return Y(e).flatMap(({test:r})=>[...MP(r.steps,ne(r),t),...AP(r.steps,r.actor,ne(r))])}function AP(e,t,r){return e.reduce((n,o,a)=>{let i=o.action.kind==="actor"?{alias:o.action.ref.ref,kind:"user"}:n.actor,s=PP(o).filter(l=>OP(l.target,i)).map(l=>({predicate:l,stepIndex:a,test:r}));return{actor:Wn(n.actor,[o]),flagged:[...n.flagged,...s]}},{actor:t,flagged:[]}).flagged}function PP(e){return e.expect.filter(t=>t.kind==="actor")}function OP(e,t){return e.kind==="anonymous"?t.kind==="anonymous":t.kind==="user"&&t.alias===e.ref.ref}function MP(e,t,r){let n=Ra(Xt,r),o=new Set(n.keys());return e.reduce((a,i,s)=>{let l=FP(i),c=TP({acc:a,assertions:l,stateChanged:xh(i),stepIndex:s,test:t}),d=Ra(Qe(a.pattern,[i]),r),u=new Set([...IP({acc:a,assertions:l,pattern:d,step:i}),...o]);return{assertedKeys:u,dynamicKeys:LP({acc:a,assertedKeys:u,assertions:l}),pattern:d,redundant:[...a.redundant,...c]}},{assertedKeys:o,dynamicKeys:new Set,pattern:n,redundant:[]}).redundant}function TP({acc:e,assertions:t,stateChanged:r,stepIndex:n,test:o}){return t.reduce((a,{entry:i,predicate:s})=>{let l=v(i.subject),c=g(i.expect),d=e.pattern.get(l),p=!(r&&e.dynamicKeys.has(l))&&d!=null&&e.assertedKeys.has(l)&&g(d.expect)===c,y=a.seen.get(l)===c;return{flagged:p||y?[...a.flagged,{predicate:s,stepIndex:n,test:o}]:a.flagged,seen:new Map([...a.seen,[l,c]])}},{flagged:[],seen:new Map}).flagged}function IP({acc:e,assertions:t,pattern:r,step:n}){let o=new Set([...NP(n),...Lt(n)].map(l=>v(l.subject))),a=xh(n)?e.dynamicKeys:new Set,i=[...e.assertedKeys].filter(l=>r.has(l)&&!o.has(l)&&!a.has(l)),s=t.map(({entry:l})=>v(l.subject)).filter(l=>r.has(l));return new Set([...i,...s])}function LP({acc:e,assertedKeys:t,assertions:r}){let n=[...e.dynamicKeys].filter(a=>t.has(a)),o=r.filter(({dynamic:a})=>a).map(({entry:a})=>v(a.subject));return new Set([...n,...o])}function NP(e){return e.action.kind==="goto"?Dn(e.action.url):[]}function FP(e){return Dr(e.expect).flatMap(t=>{if(t.kind==="actor")return[];let r=ae(t);return r==null?[]:[{dynamic:BP(t),entry:r,predicate:t}]})}function BP(e){return"locator"in e&&co(e.locator)}function co(e){return e.by==="role"?e.name!=null&&typeof e.name!="string":e.by==="testId"?typeof e.value!="string":e.by==="inside"?co(e.scope)||co(e.target):e.by==="surface"?co(e.container):co(e.element)}function xh(e){return e.effects.length>0}var DP=2;function kh(e){return Y(e).flatMap(({test:t})=>t.steps.reduce((n,o,a)=>{let i=$P(o,n.pre),s=i.length>=DP?[...n.violations,{hidden:i,stepIndex:a,test:ne(t)}]:n.violations;return{pre:Qe(n.pre,[o]),violations:s}},{pre:Xt,violations:[]}).violations)}function $P(e,t){return e.expect.flatMap(r=>{let n=VP(r);return n!=null&&!vc(n)&&jP(n,t)?[n]:[]})}function VP(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator}function vc(e){return e.by==="surface"?!0:e.by==="inside"?vc(e.scope)||vc(e.target):!1}function jP(e,t){let r=t.get(v({kind:"element",locator:e,state:"visible"}));return r!=null&&r.expect.expect==="is"&&r.expect.value===!0}var _P="[object Object]";function Ch(e){return Y(e).flatMap(({test:t})=>{let r=ne(t);return t.steps.flatMap((n,o)=>WP(n).map(a=>({stepIndex:o,test:r,value:a})))})}function WP(e){return[...new Set(wc(e).filter(t=>t.includes(_P)))]}function wc(e){return typeof e=="string"?[e]:Array.isArray(e)?e.flatMap(t=>wc(t)):typeof e!="object"||e===null?[]:Object.values(e).flatMap(t=>wc(t))}function Ph(e){return Y(e).flatMap(({test:t})=>{let r=ne(t);return t.steps.reduce((n,o,a)=>UP(n,o,a,r),{found:[],open:new Set}).found})}function UP(e,t,r,n){let o=t.action.kind==="goto"?new Set:e.open,a=Ah(t,qP),i=Ah(t,zP),s=new Set([...o,...a].filter(c=>!i.has(c))),l=HP(t).flatMap(c=>s.has(g(fe(c.surface)))?[]:[{...c,stepIndex:r,test:n}]);return{found:[...e.found,...l],open:s}}function Ah(e,t){return new Set(e.expect.flatMap(r=>{let n=t(r);return n==null?[]:[g(fe(n))]}))}function qP(e){return e.kind!=="visible"?null:e.locator.by==="surface"?e.locator:null}function zP(e){return e.kind!=="not"||e.predicate.kind!=="visible"?null:e.predicate.locator.by==="surface"?e.predicate.locator:null}function HP(e){return e.expect.flatMap(t=>{if(t.kind!=="visible"||t.locator.by!=="inside")return[];let r=Oh(t.locator);return r==null?[]:[{content:t.locator,surface:r}]})}function Oh(e){return e.by!=="inside"?null:e.scope.by==="surface"?e.scope:Oh(e.scope)}function Th(e){switch(e.kind){case"unreachable-interaction":{let{violation:t}=e,r=ie(t.target);return t.ephemeralOnly?`${le("reachability")} ${t.test}: ${Bt(t.action)}, but ${r} was only declared inside ephemeral(...), which grants no reachability. Assert a durable visible(...) first.`:`${le("reachability")} ${t.test}: ${Bt(t.action)}, but no prior step declared ${r} reachable. Assert visible(...) on it first.`}case"redundant-assertion":{let{redundancy:t}=e;return`${le("redundancy")} ${t.test}: step ${String(t.stepIndex+1)} restates "${je(t.predicate)}" \u2014 already asserted and unchanged since. Delete it.`}case"fact-conflict":return KP(e.conflict);case"possible-noop-effect":return JP(e.effect);case"undecided-action-consequence":return ZP(e.consequence);case"unmodeled-surface":{let{surface:t}=e,r=t.hidden.map(n=>ie(n)).join(", ");return`${le("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"stringified-binding":{let{binding:t}=e;return`${le("value")} ${t.test}: step ${String(t.stepIndex+1)} uses the literal "${t.value}" \u2014 a handle was turned into a string with String(...) or template concatenation instead of staying connected to state. Use s\`\${handle}\` so the value comes from the record.`}case"unpinned-surface-content":{let{content:t}=e,r=ie(t.surface);return`${le("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 KP(e){return[`${le("fact")} Two facts contradict on overlapping states \u2014 "${je(e.a)}" vs "${je(e.b)}".`,` Shared state: ${Pa(e.when)}.`,Mh(e.a,e.aProducers,e.when),Mh(e.b,e.bProducers,e.when),"These declarations overlap on this state. Add the missing distinguishing state to the broader declaration, or split the outcome with a when branch."].join(`
5
+ `)}function Mh(e,t,r){let n=t.map(o=>` - ${o.test} adds ${gy(o.when,r)}`);return[` "${je(e)}" declared by:`,...n].join(`
6
+ `)}function JP(e){let t=e.branch==null?"":` in branch "${e.branch}"`,r=[e.effect.selector.source,...e.effect.selector.path].join(".");return`${le("precondition")} ${e.workflow}: step ${String(e.stepIndex+1)}${t} declares an effect on ${r}, but the state may stay unchanged. ${GP(e.effect)} ${YP(e)}`}function GP(e){switch(e.kind){case"set":return`${e.selector.path.at(-1)??e.selector.source} may already be ${JSON.stringify(e.value)}.`;case"transform":return"The transform may permit the same value before and after.";case"create-path":return"The path may already exist.";case"delete-path":return"The path may already be absent.";case"delete-selected-records":return"The selection may match no records.";case"update-selected-records":return"The selection may match no records or write values they already contain."}}function YP(e){return(e.effect.kind==="delete-selected-records"||e.effect.kind==="update-selected-records")&&e.branch==null?"Move this effect into a branch guarded on exists(...) so the selection is known to match, or require the record in given. A step takes as many when(...) calls as it has independent dimensions, so scoping this one does not spend the step's other branches.":"Declare a transform that excludes equality, split state-dependent outcomes with a when branch, or add the least-specific precondition this behavior requires. Do not fix an unrelated starting value just to make the effect change."}function ZP(e){let t=e.expectations[0];if(t==null)throw new Error("undecided action consequence has no expectation");let r=e.expectations.length===1?`"${je(t)}"`:`${String(e.expectations.length)} outcomes including "${je(t)}"`,n="locator"in e.action&&e.action.locator!=null?ie(e.action.locator):"the control";return`${le("precondition")} ${e.test}: step ${String(e.stepIndex+1)} ${Bt(e.action)} and declares ${r}, but the previous state allows ${n} to already have the action's result or a different state. ${XP(e.action)} Add branches if the outcomes differ.`}function XP(e){return e.kind==="fill"||e.kind==="select"||e.kind==="clear"?"Declare value(...) or not(value(...)) before this step.":e.kind==="check"||e.kind==="uncheck"?"Declare checked(...) or not(checked(...)) before this step.":"Declare the action's result or its negation before this step."}function rn({corpus:e,planned:t}){return t.reduce((r,n)=>{if(r==null)return null;let o=e.find(a=>a.id===n.transitionId);return o==null?null:[...r,{params:{...n.params},transition:o}]},[])}function Ec(e){switch(e.kind){case"stepError":return"crash";case"check":return QP(e);case"finding":return e.finding.kind==="unrunnable"?"model-drift":"frame"}}function QP(e){switch(e.record.target.kind){case"dataRule":return"data-rule";case"fact":return"fact";case"effect":case"step":case"action":case"frame":return"frame"}}function uo(e){let t=e.map(o=>({contradiction:o,line:La(o),part:rO(o)})).toSorted((o,a)=>g(o.part).localeCompare(g(a.part))),r=t.map(o=>o.part),n=t.at(0)?.contradiction;return{layer:iO(r),signature:g({parts:r.map(o=>g(o))}),sourceTest:n==null?void 0:eO(n),title:t.at(0)?.line}}function eO(e){switch(e.kind){case"check":case"stepError":return e.step.test;case"finding":return tO(e)}}function tO(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 Lh={crash:0,"data-rule":1,fact:2,frame:3,"model-drift":4};function rO(e){let t=Ec(e);switch(e.kind){case"check":{let{body:r}=e.record;return{family:r.family,kind:"check",layer:t,reason:nO(r),step:{intent:e.step.intent,test:e.step.test},subject:oO(r)}}case"stepError":return{error:e.record.error.kind,kind:"stepError",layer:t,step:e.step.intent};case"finding":return aO(e,t)}}function nO(e){return e.outcome.kind==="failed"?e.outcome.reason.kind:"passed"}function oO(e){return e.family==="element"||e.family==="content"||e.family==="scalar"||e.family==="action"?Yt(e):"subject"in e?e.subject:""}function aO(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:ce(r.locator),visibleIndex:r.visibleIndex}}}function iO(e){return e.map(r=>r.layer).toSorted((r,n)=>Lh[r]-Lh[n]).at(0)??"frame"}import{z as Nh}from"zod";var Fh=Nh.object({maxAttemptLength:Nh.number().int().positive()}),xc={even:{maxAttemptLength:12}};function Bh(e){return xc[e]}import{z as be}from"zod";var sO=be.strictObject({value:be.string().min(1)}),lO=be.strictObject({kind:be.literal("dev-session"),value:be.string().min(1)}),ci=be.enum(["create-modify-delete","cross-workflow","last-record-navigation","lifecycle","overlay-mutate-close","parent-child-delete","role-attempt","threshold-gate"]),cO=be.strictObject({params:be.record(be.string(),Ne),transitionId:be.string().min(1)}),Dh=be.strictObject({assignmentSeed:sO,coverageSignature:be.string().min(1),envelopeRef:be.string().min(1),modelHash:be.string().min(1),steps:be.array(cO).min(1),targetGeneration:lO});function di({attemptOrdinal:e,corpus:t}){let n=t.filter(l=>l.effectStep.action.kind!=="goto").toSorted((l,c)=>l.id.localeCompare(c.id)),o=n[e%n.length];if(o==null)return null;let a=Math.floor(e/n.length),i=ci.options[(e+a)%ci.options.length];if(i==null)throw new Error("exploration pattern catalog is empty");let s=uO({attemptOrdinal:e,ordered:n,primaryId:o.id});return{objectives:[{kind:"transition",transitionId:o.id},{kind:"pattern",pattern:i},...dO(s)],pattern:i,primaryTransitionId:o.id,secondaryTransitionId:s?.id}}function dO(e){return e==null?[]:[{kind:"transition",transitionId:e.id}]}function uO({attemptOrdinal:e,ordered:t,primaryId:r}){if(t.length<2)return;let n=1+e%(t.length-1),o=t.findIndex(a=>a.id===r);return t[(o+n)%t.length]}function $h(e){switch(e){case"modelEmpty":case"noEntry":return!0;case"allReserved":case"budgetExhausted":case"noLegalExpansion":case"trailLengthExhausted":return!1}}function Vh(e){return Math.max(9e4,e*1e4)}import{z as St}from"zod";var kc=1,pO=St.strictObject({params:St.record(St.string(),Ne),transitionId:St.string().min(1)}),Cc=St.strictObject({envelopeRef:St.string().min(1),seed:St.string().min(1),steps:St.array(pO).min(1),version:St.literal(kc)});function jh(e){try{let t=JSON.parse(e),r=Cc.safeParse(t);return r.success?{kind:"valid",repro:r.data}:{kind:"rejected",reason:"schema-mismatch"}}catch{return{kind:"rejected",reason:"invalid-json"}}}import{z as k}from"zod";var fO=k.strictObject({test:k.string().min(1),text:k.string()}),po=k.strictObject({baseLabel:k.string(),baseState:k.string().min(1),durationMs:k.number().int().nonnegative(),signature:k.string().optional(),steps:k.array(fO)}),yO=k.enum(["driver","infra","trail"]),mO=k.enum(["envelope-missing","format-unsupported","model-changed","target-changed","transition-missing"]),hO=k.discriminatedUnion("source",[k.strictObject({source:k.literal("empty-trail")}),k.strictObject({reason:mO,source:k.literal("assignment-rejected")}),k.strictObject({detail:k.string(),source:k.literal("config")}),k.strictObject({source:k.literal("lockfile-stale")}),k.strictObject({detail:k.string(),source:k.literal("transport")}),k.strictObject({category:yO,detail:k.string().min(1),kind:k.string(),source:k.literal("runtime")})]);function _h(e){switch(e.source){case"empty-trail":case"assignment-rejected":return"trail";case"config":case"lockfile-stale":case"transport":return"infra";case"runtime":return e.category}}var Wh=k.discriminatedUnion("kind",[k.strictObject({kind:k.literal("aborted"),ranCount:k.number().int().nonnegative()}),k.strictObject({error:hO,kind:k.literal("error")}),k.strictObject({kind:k.literal("clean"),trail:po}),k.strictObject({kind:k.literal("coverage-gap"),runId:k.string().optional(),trail:po}),k.strictObject({kind:k.literal("flaky"),trail:po}),k.strictObject({kind:k.literal("seen"),trail:po}),k.strictObject({kind:k.literal("finding"),runId:k.string().optional(),trail:po})]);function Uh({assignment:e,corpus:t,currentModelHash:r,currentTargetGeneration:n,envelopeRefs:o}){if(e.modelHash!==r)return{kind:"rejected",reason:"model-changed"};if(e.targetGeneration.value!==n.value)return{kind:"rejected",reason:"target-changed"};if(!o.has(e.envelopeRef))return{kind:"rejected",reason:"envelope-missing"};let a=new Set(t.map(i=>i.id));return e.steps.some(i=>!a.has(i.transitionId))?{kind:"rejected",reason:"transition-missing"}:{kind:"valid"}}import{createHash as gO}from"crypto";import{performance as yi}from"perf_hooks";function ui(e){return g({a:e.actor,l:e.startingState,v:e.viewport})}function pi(e,t){return Ve(Y(e),r=>ui(r.test)).map(r=>({name:r.ref,test:r.test}))}function fi(e,t,r){return Kr({...r,state:e.state,test:t.test})}var SO="symbolic-bug-finder-v3";function mi(e){let t=ga(e),r=pi(e,{sweep:!1});if(!t.some(i=>i.effectStep.action.kind!=="goto")||r.length===0)return{kind:"model-empty"};let o=Wr(e),a=new Map(r.map(i=>[ui(i.test),i]));return{kind:"prepared",value:{baseSpecByTest:new Map(Y(e).flatMap(i=>{let s=a.get(ui(i.test));return s==null?[]:[[i.ref,s]]})),baseSpecs:r,corpus:t,facts:{facts:o.facts.filter(i=>!i.localConsequence),overlays:et(e),overrides:o.overrides},lockfile:e,startingPointTests:new Map(r.map(i=>[i.name,i.test]))}}}async function hi({attemptOrdinal:e,modelHash:t,prepared:r,reservedSignatures:n,strategy:o,targetGeneration:a}){let i=yi.now(),s=vO({attemptOrdinal:e,modelHash:t}),l=di({attemptOrdinal:e,corpus:r.corpus});if(l==null)throw new Error("prepared exploration has an empty transition corpus");let c=zh({agenda:l,attemptOrdinal:e,prepared:r}),d=yi.now(),u=await RO({lockfile:r.lockfile,seed:s,specs:c}),p=yi.now()-d,y=Ua({agenda:l,assignmentSeed:s,corpus:r.corpus,facts:r.facts,reservedSignatures:n,startingPoints:u,strategy:o}),m={beamMs:y.telemetry.beamMs,candidateMs:y.telemetry.candidateMs,envelopesMs:p,expansionMs:y.telemetry.expansionMs,searchMs:y.telemetry.searchMs,selectionMs:y.telemetry.selectionMs,totalMs:yi.now()-i};if(y.kind==="no-candidate")return{...y,timing:m};let h=r.startingPointTests.get(y.startingPoint),f=y.trace.selectedCoverageSignature;if(h==null||f==null)throw new Error("planner selected an incomplete assignment");return{assignment:{assignmentSeed:{value:s},coverageSignature:f,envelopeRef:y.startingPoint,modelHash:t,steps:[...y.steps],targetGeneration:a},kind:"assignment",timing:m,trace:y.trace}}var bO=8;function zh({agenda:e,attemptOrdinal:t,prepared:r}){let n=qh(r.corpus,e.primaryTransitionId),o=Sa(n.requiredState),a=r.baseSpecs.filter(c=>o==null||c.test.viewport===o).toSorted((c,d)=>c.name.localeCompare(d.name));if(a.length===0)return[];let i=t%a.length,s=[...a.slice(i),...a.slice(0,i)],l=[e.primaryTransitionId,e.secondaryTransitionId].flatMap(c=>{if(c==null)return[];let d=qh(r.corpus,c),u=r.baseSpecByTest.get(d.test);return u==null||o!=null&&u.test.viewport!==o?[]:[u]});return Ve([...l,...s],c=>c.name).slice(0,bO)}function qh(e,t){let r=e.find(n=>n.id===t);if(r==null)throw new Error(`exploration agenda transition ${t} is missing`);return r}async function RO({lockfile:e,seed:t,specs:r}){let n={generate:Cr(kr,t),params:void 0};return(await Promise.all(r.map(async a=>{let i=Xo({plan:a.test.startingState,seed:t}),s={...a,test:{...a.test,startingState:i}};return(await fi(e,s,n)).match(c=>({env:c.env,logical:_n(i),name:a.name,parameters:Da({generate:n.generate,test:s.test,testRef:a.name}),snapshot:c.snapshot}),()=>null)}))).flatMap(a=>a==null?[]:[a])}function vO({attemptOrdinal:e,modelHash:t}){return gO("sha256").update(`${SO}:${t}:${String(e)}`).digest("base64url")}async function Jh({attempts:e,modelHash:t,prepared:r,strategy:n}){let o=await kO({attempts:e,modelHash:t,prepared:r,strategy:n}),a=o.flatMap(f=>f.kind==="assignment"?[f.assignment]:[]),s=a.flatMap(f=>f.steps.map(b=>b.transitionId)).reduce((f,b)=>new Map([...f,[b,(f.get(b)??0)+1]]),new Map),l=new Set(o.map(f=>f.trace.agenda.primaryTransitionId)),c=r.corpus.filter(f=>l.has(f.id)&&!s.has(f.id)),d=r.corpus.filter(f=>l.has(f.id)&&s.get(f.id)===1),u=new Set(a.flatMap(f=>f.steps.flatMap((b,w,S)=>{let E=S[w+1];return E==null?[]:[`${b.transitionId}:${E.transitionId}`]}))),p=new Set(a.flatMap(f=>Gr({corpus:r.corpus,steps:f.steps}))),y=a.filter(f=>new Set(f.steps.map(b=>CO(r.corpus,b.transitionId))).size>1).length,m=r.corpus.filter(f=>f.steps.some(b=>b.effects.some(w=>w.kind==="transform"))),h=AO(o);return{attempts:e,composablePairs:u.size,crossWorkflowPaths:y,effectKinds:[...new Set(r.corpus.flatMap(f=>f.steps.flatMap(b=>b.effects.map(w=>w.kind))))].toSorted((f,b)=>f.localeCompare(b)),envelopesReached:new Set(a.map(f=>f.envelopeRef)).size,isolatedTransitions:c.map(f=>Ac(f)),noCandidates:h,opaqueTransforms:m.map(f=>Ac(f)),patternsReached:[...p].toSorted((f,b)=>f.localeCompare(b)),plannedPaths:a.length,planningDepth:wO({assignments:a,results:o,strategy:n}),planningPerformance:PO(o),planningWork:OO(o),recommendations:MO({isolated:c,noCandidates:h,plannedPaths:a.length}),targetsAnalyzed:l.size,transitionCount:r.corpus.length,transitionsReached:s.size,weaklyConnectedTransitions:d.map(f=>Ac(f))}}function wO({assignments:e,results:t,strategy:r}){let n=e.map(a=>a.steps.length),o=t.map(a=>EO(a.trace));return{averagePlannedSteps:Hh(n),averageSearchedSteps:Hh(o),maxPlannedSteps:Kh(n),maxSearchedSteps:Kh(o),searchStops:xO(t),targetSteps:r.maxAttemptLength}}function EO(e){return e.depths.reduce((t,r)=>Math.max(t,r.depth+(r.retained>0?1:0)),0)}function Hh(e){return e.length===0?0:gi(e)}function gi(e){return e.reduce((t,r)=>t+r,0)/e.length}function Kh(e){return e.length===0?0:Math.max(...e)}function xO(e){return e.reduce((t,r)=>{let n=r.trace.searchStopReason??"notStarted";return{...t,[n]:t[n]+1}},{budgetExhausted:0,frontierExhausted:0,notStarted:0,targetReached:0})}async function kO({attempts:e,modelHash:t,prepared:r,strategy:n}){return Array.from({length:e},(o,a)=>a).reduce(async(o,a)=>[...await o,await hi({attemptOrdinal:a,modelHash:t,prepared:r,reservedSignatures:new Set,strategy:n,targetGeneration:{kind:"dev-session",value:"analysis"}})],Promise.resolve([]))}function CO(e,t){let r=e.find(n=>n.id===t);if(r==null)throw new Error(`analysis transition ${t} is missing`);return r.test}function AO(e){return e.reduce((t,r)=>r.kind==="assignment"?t:{...t,[r.reason]:t[r.reason]+1},{allReserved:0,budgetExhausted:0,modelEmpty:0,noEntry:0,noLegalExpansion:0,trailLengthExhausted:0})}function Ac(e){return{action:Bt(e.effectStep.action),id:e.id,intent:e.intent,test:e.test}}function PO(e){return{beam:fr(e.map(t=>t.timing.beamMs)),candidates:fr(e.map(t=>t.timing.candidateMs)),envelopes:fr(e.map(t=>t.timing.envelopesMs)),expansion:fr(e.map(t=>t.timing.expansionMs)),search:fr(e.map(t=>t.timing.searchMs)),selection:fr(e.map(t=>t.timing.selectionMs)),total:fr(e.map(t=>t.timing.totalMs))}}function fr(e){if(e.length===0)return{averageMs:0,maxMs:0,p95Ms:0};let t=e.toSorted((o,a)=>o-a),r=t.at(Math.ceil(t.length*.95)-1),n=t.at(-1);if(r==null||n==null)throw new Error("exploration analysis timing sample is missing");return{averageMs:e.reduce((o,a)=>o+a,0)/e.length,maxMs:n,p95Ms:r}}function OO(e){return e.length===0?{averageExpandedNodes:0,averageParameterAttempts:0,averageRulesConsidered:0}:{averageExpandedNodes:gi(e.map(t=>t.trace.expanded)),averageParameterAttempts:gi(e.map(t=>t.trace.depths.reduce((r,n)=>r+n.parameterAttempts,0))),averageRulesConsidered:gi(e.map(t=>t.trace.depths.reduce((r,n)=>r+n.rulesConsidered,0)))}}function MO({isolated:e,noCandidates:t,plannedPaths:r}){return[...r===0?["No complete path could be proved. Add an entry navigation and declare every surface needed by the next action."]:[],...t.noEntry>0?["Some agendas have no modeled entry. Start those journeys with a declared navigation step."]:[],...e.length>0?[`${String(e.length)} targeted transitions could not be reached. Add the missing before-state declarations that connect them to earlier user actions.`]:[]]}import{createServer as HO}from"http";import{mkdir as KO,rm as JO,writeFile as GO}from"fs/promises";import YO from"path";import{z as $}from"zod";var ZO="otlp-port",Yh=$.object({key:$.string(),value:$.object({boolValue:$.boolean().optional(),doubleValue:$.number().optional(),intValue:$.union([$.string(),$.number()]).optional(),stringValue:$.string().optional()})}),XO=$.object({attributes:$.array(Yh).default([]),endTimeUnixNano:$.string(),kind:$.number().default(0),name:$.string(),parentSpanId:$.string().optional(),spanId:$.string(),startTimeUnixNano:$.string(),status:$.object({code:$.number(),message:$.string().optional()}).optional(),traceId:$.string()}),QO=$.object({resourceSpans:$.array($.object({resource:$.object({attributes:$.array(Yh).default([])}).optional(),scopeSpans:$.array($.object({spans:$.array(XO).default([])})).default([])})).default([])});async function Pc({localDir:e,onRrwebBatch:t,onSpan:r,writePortFile:n}){let{port:o,server:a}=await eM({onRrwebBatch:t,onSpan:r}),i=YO.join(e,ZO);return n&&(await KO(e,{recursive:!0}),await GO(i,String(o),{encoding:"utf8"})),{port:o,stop:async()=>{n&&await JO(i,{force:!0}),await aM(a)}}}function eM(e){return new Promise((t,r)=>{let n=HO((o,a)=>{tM(o,a,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 tM(e,t,r){let n=rM(e.url);if(n!=null){Gh(e).then(o=>{r.onRrwebBatch(n,o),Si(t)}).catch(()=>{Si(t)});return}Gh(e).then(o=>{nM(QO.parse(JSON.parse(o.toString("utf8"))),r.onSpan),Si(t)}).catch(()=>{Si(t)})}function rM(e){if(e==null||!e.startsWith("/rrweb/"))return;let t=decodeURIComponent(e.slice(7));return t.length===0?void 0:t}function Gh(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 Si(e){e.writeHead(200,{"content-type":"application/json"}),e.end("{}")}function nM(e,t){e.resourceSpans.flatMap(r=>r.scopeSpans).flatMap(r=>r.spans).forEach(r=>{t({attributes:oM(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:cp(r.kind),status:{code:dp(r.status?.code??0),message:r.status?.message},timeNanos:r.startTimeUnixNano,traceId:r.traceId})})}function oM(e){return Object.fromEntries(e.map(({key:t,value:r})=>[t,String(r.stringValue??r.intValue??r.doubleValue??r.boolValue??"")]))}function aM(e){return new Promise((t,r)=>{e.close(n=>{if(n==null){t();return}r(n)}),e.closeAllConnections()})}import{err as ug,errAsync as _M,ok as pg,ResultAsync as on}from"neverthrow";import{err as bM,ok as RM}from"neverthrow";function it(e,t,r){if(t==null)throw new Error("action requires a locator");return bt(e,t,r)}function bt(e,t,r){if(t.by==="inside"){if(t.scope.by==="frame"){let a=bt(e,t.scope.element,{visibleOnly:!1});return bt(a.contentFrame(),t.target,r)}let o=bt(e,t.scope,r);return bt(o,t.target,r)}if(t.by==="surface")return bt(e,t.container,r);if(t.by==="frame")return bt(e,t.element,r);let n=t.by==="testId"?e.getByTestId(t.value):iM(e,t.role,t.name);return r.visibleOnly?n.filter({visible:!0}):n}function Oc(e,t){return t==null?`role=${e}`:`role=${e}[name=${JSON.stringify(t)}i]`}function iM(e,t,r){let n=e.locator(Oc(t,r));return r==null||!Rp(t)?n:n.or(e.locator(`role=${t}`).filter({hasText:r}))}var _t=class extends Error{readyKey;timeoutMs;constructor(t,r){super("app-not-ready"),this.readyKey=t,this.timeoutMs=r}};async function Zh({page:e,readiness:t,signal:r}){if(!await Xh(e,r,t.budgetMs))throw new _t(kn,t.budgetMs)}async function bi({page:e,readiness:t,signal:r,startMs:n,tries:o,url:a}){if(me(r),!await sM(e,a)){if(Date.now()-n>=t.budgetMs)throw new _t(kn,t.budgetMs);let s=t.backoffMs[Math.min(o,t.backoffMs.length-1)]??8e3;await ot(s,r),await bi({page:e,readiness:t,signal:r,startMs:n,tries:o+1,url:a});return}let i=Math.max(0,t.budgetMs-(Date.now()-n));if(!await Xh(e,r,Math.min(i,cM(t,o)))){if(Date.now()-n>=t.budgetMs)throw new _t(kn,t.budgetMs);await bi({page:e,readiness:t,signal:r,startMs:n,tries:o+1,url:a})}}function Mc(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 nn(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 sM(e,t){let r=await lM(e,t);return r==="net-error"?!1:r==null||r.status()<400}async function lM(e,t){try{return await e.goto(t,{waitUntil:"domcontentloaded"})}catch(r){if(Mc(r))return"net-error";throw r}}function cM(e,t){return t===0?e.budgetMs/2:e.budgetMs}var dM=50;async function Xh(e,t,r){let n=pM({signal:t,timeoutMs:r}),o=Date.now()+r;try{return await Promise.race([uM({deadline:o,page:e,signal:t}),n.promise])}finally{n.clear()}}async function uM({deadline:e,page:t,signal:r}){for(;Date.now()<e;){if(me(r),await fM(t))return!0;await ot(dM,r)}return!1}function Ri(e){return new Promise(t=>{setTimeout(t,e)})}function pM({signal:e,timeoutMs:t}){let r,n;return{promise:new Promise((a,i)=>{n=()=>{i(new nt)},r=setTimeout(()=>{a(!1)},Math.max(0,t)),e.addEventListener("abort",n,{once:!0})}),clear:()=>{clearTimeout(r),n!=null&&e.removeEventListener("abort",n)}}}async function fM(e){try{return await e.evaluate(yM,kn)}catch(t){if(nn(t))return!1;throw t}}function yM(e){return Reflect.get(globalThis,e)===!0}var mM=[250,750,2e3];async function Tc(e,t,r,n,o){try{await hM(e,t,n,o.readiness,o.switchActor)}catch(a){let i=mM[r];if(i==null||!Mc(a))throw a;await Ri(i),await Tc(e,t,r+1,n,o)}}async function hM(e,t,r,n,o){if(t.kind==="actor"){if(o==null)throw new Error("this driver cannot switch actors");await o(Wt(t.actorRef,t,"actorRef"));return}if(t.kind==="goto"){await bi({page:e,readiness:n,signal:r,startMs:Date.now(),tries:0,url:Wt(t.url,t,"url")});return}if(t.kind==="press"&&t.locator==null){await e.keyboard.press(Wt(t.key,t,"key"));return}let a=t.kind!=="upload";await gM(e,it(e,t.locator,{visibleOnly:a}),t)}function Wt(e,t,r){if(e==null)throw new Error(`action "${t.kind}" requires ${r}`);return e}function gM(e,t,r){switch(r.kind){case"goto":throw new Error("goto must not be located");case"fill":return t.fill(String(Wt(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 SM(e,t,String(Wt(r.value,r,"value")));case"upload":return t.setInputFiles(Wt(r.files,r,"files"));case"press":return t.press(Wt(r.key,r,"key"));case"drag":return t.dragTo(it(e,Wt(r.target,r,"target"),{visibleOnly:!0}));case"actor":throw new Error("actor switch must not be located")}}async function SM(e,t,r){if(await t.evaluate(a=>a.tagName==="SELECT")){await t.selectOption(r);return}await t.click(),await t.evaluate(a=>a.tagName==="INPUT"||a.tagName==="TEXTAREA"||a.isContentEditable)&&await t.fill(r),await e.locator(Oc("option",r)).filter({visible:!0}).click()}async function Qh({action:e,page:t,readiness:r,signal:n,switchActor:o}){try{return await Tc(t,e,0,n,{readiness:r,switchActor:o}),RM(void 0)}catch(a){return bM(await wM({action:e,cause:a,page:t}))}}function vM(e,t){return t instanceof _t?Ks(t.readyKey,t.timeoutMs):na(e.kind,CM(t))}async function wM({action:e,cause:t,page:r}){let n=vM(e,t);return n.kind!=="action-failed"||n.failure.kind!=="covered"?n:await EM(r,e.locator)?na(e.kind,{kind:"notFound"}):n}async function EM(e,t){if(t==null)return!1;try{return await it(e,t,{visibleOnly:!1}).count()===0}catch{return!1}}var xM=/resolved to (\d+) elements/,kM=/intercepts pointer events/;function CM(e){let t=e instanceof Error?e.message:String(e),r=xM.exec(t);return r?.[1]!=null?{count:Number(r[1]),kind:"multipleMatches"}:kM.test(t)?{by:"another element",kind:"covered"}:e instanceof Error&&e.name==="TimeoutError"&&t.includes("waiting for")?{kind:"notFound"}:Zs(e)}async function Ic(e,t,r){if(r.kind==="browser")return MM(e,t,r.key,r.value);if(r.kind==="not")return!await Ic(e,t,r.inner);let n=it(e,r.locator,{visibleOnly:!0});if(r.kind==="value"){let o=await vi(n,"value");return o!=null&&eg(o,r.value,r.match)}if(r.kind==="text"){let o=await vi(n,"text");return o!=null&&eg(o,r.value,r.match)}return r.kind==="unobstructed"?rg(n):ng({kind:r.kind,loc:n})}var AM=/locator\.(?:evaluate|inputValue|isChecked|isDisabled|isEnabled|isVisible|textContent): Timeout \d+ms exceeded[\s\S]*waiting for locator/u,PM=new Set(["INPUT","TEXTAREA","SELECT"]);async function Lc(e,t){if(t==="text")return await e.textContent()??"";let r=await e.evaluate(n=>n.tagName);return PM.has(r)?e.inputValue():await e.textContent()??""}function tg(e){let t=e instanceof Error?e.message:String(e);return AM.test(t)}async function vi(e,t){if(await e.count()!==1)return null;try{return await Lc(e,t)}catch(r){if(tg(r))return null;throw r}}function eg(e,t,r){let n=Lr(e),o=Lr(t);return r==="contains"?n.includes(o):r==="startsWith"?n.startsWith(o):n===o}function rg(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,a=Math.min(9,Math.max(3,Math.round(r.width/12))),i=Math.min(5,Math.max(2,Math.round(r.height/12))),s=(d,u,p)=>Array.from({length:p},(y,m)=>d+o+(u-o*2)*m/(p-1)),c=s(r.left,r.width,a).flatMap(d=>s(r.top,r.height,i).map(u=>({x:d,y:u}))).filter(d=>d.x>=0&&d.y>=0&&d.x<=n.innerWidth&&d.y<=n.innerHeight);return c.length===0?!1:c.every(d=>{let u=t.ownerDocument.elementFromPoint(d.x,d.y);return u!=null&&(u===t||t.contains(u)||u.contains(t))})})}async function ng({kind:e,loc:t}){if(await t.count()!==1)return!1;try{return await OM({kind:e,loc:t})}catch(r){if(tg(r))return!1;throw r}}function OM({kind:e,loc:t}){return e==="visible"?t.isVisible():e==="disabled"?t.isDisabled():e==="enabled"?t.isEnabled():e==="checked"?t.isChecked():e==="expanded"?t.evaluate(r=>r.getAttribute("aria-expanded")==="true"):e==="pressed"?t.evaluate(r=>r.getAttribute("aria-pressed")==="true"):t.evaluate(r=>r===r.ownerDocument.activeElement)}async function MM(e,t,r,n){let o=await t.read(e),a=K(o.scalars,r);return n===null?a===void 0:a===n}async function og(e,t,r){let n=ag(r,!1);if(n.check.kind==="browser"){let i=await t.read(e),s=K(i.scalars,n.check.key);return{kind:"wrongContent",observed:s===void 0?"":String(s)}}let o=it(e,n.check.locator,{visibleOnly:!0}),a=await o.count();return a>1?{count:a,kind:"multipleMatches"}:a===0?{kind:"notFound"}:TM(o,n.check)}function ag(e,t){return e.kind==="not"?ag(e.inner,!t):{check:e,negated:t}}async function TM(e,t){switch(t.kind){case"value":{let r=await vi(e,"value");return r==null?{kind:"notFound"}:{kind:"wrongContent",observed:r}}case"text":{let r=await vi(e,"text");return r==null?{kind:"notFound"}:{kind:"wrongContent",observed:r}}case"unobstructed":{let r=await IM(e);return r==null?{kind:"wrongState",observed:{checkKind:"unobstructed",value:await rg(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 ng({kind:t.kind,loc:e})}}}}function IM(e){return e.evaluate(t=>{let r=t.getBoundingClientRect(),n=t.ownerDocument.elementFromPoint(r.left+r.width/2,r.top+r.height/2);return n==null||n===t||t.contains(n)||n.contains(t)?null:"another element"})}import{err as wi,ok as LM,ResultAsync as NM}from"neverthrow";function ig({bindings:e,classify:t,effects:r,observe:n,perform:o,signal:a,sync:i}){return n().andThen(s=>NM.fromSafePromise(Zl({bindings:e,classify:t,initialState:s,observe:n,step:{perform:o,plan:{constraints:[],effects:[...r]},sync:i}},a)).andThen(l=>FM(l)))}function FM(e){return e.kind==="perform-failed"||e.kind==="observe-failed"?wi(e.error):e.kind==="required-state-unsatisfied"?wi(Or(new Error("the action ran while its declared state requirements were unmet"))):e.kind==="unresolved-reference"?wi(Mr({path:e.path,record:e.record})):e.observation.mismatches.length===0?LM({bindings:e.bindings,observedEffects:e.observedEffects}):wi(Mn(e.observation.mismatches))}function BM(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 a=o.call(n,e);return typeof a=="number"?a:-1}async function sg(e,t){if(t==null)return[];try{let r=bt(e,t,{visibleOnly:!1});if(await r.count()===0)return[];let n=await r.first().evaluate(BM);return n>0?[n]:[]}catch{return[]}}import{okAsync as DM}from"neverthrow";function lg({readActor:e,session:t}){return e==null||t==null?DM({scalars:ft}):e(t).map(r=>({scalars:new Map($M(r))}))}function $M(e){return e==null?[]:[[v({kind:"actor"}),{declared:!1,expect:{expect:"is",value:e},subject:{kind:"actor"}}]]}function Nc({action:e,bindings:t,parameters:r}){let n={...t,[dt]:r};if(e.kind!=="actor"||e.actorRef==null)return n;let o=n[e.actorRef];return o===void 0?n:{...n,[Er]:o}}import{okAsync as VM}from"neverthrow";function cg({initialState:e,observe:t}){if(t==null)return;let r=e;return()=>{if(r==null)return t();let n=r;return r=void 0,VM(n)}}var xi={backoffMs:[500,1e3,2e3,4e3,8e3],budgetMs:6e4},WM={classifyLogicalState:Ql,initialLogicalState:void 0,initialStateEffectBindings:jt,readiness:xi,readLogicalState:void 0,readSession:void 0,switchActor:void 0};function Bc(e,t,r,n,{classifyLogicalState:o,initialLogicalState:a,initialStateEffectBindings:i,readiness:s,readLogicalState:l,readSession:c,switchActor:d}=WM){let u=i,p=cg({initialState:a,observe:l});return{awaitCheck:(y,m)=>Ei({bindings:u,check:y}).asyncAndThen(h=>on.fromPromise(YM({check:h,page:e,pageState:r,signal:n,timeoutMs:m}),f=>ro(f)?{kind:"aborted"}:fo(f))),diagnoseCheck:y=>Ei({bindings:u,check:y}).asyncAndThen(m=>on.fromPromise(Fc(og(e,r,m),`diagnose ${y.kind}`),fo)),evaluate:y=>Ei({bindings:u,check:y}).asyncAndThen(m=>on.fromPromise(Fc(Dc(e,r,m),`check ${y.kind}`),fo)),locateIds:y=>sg(e,yg(y,tt(u))),observe:y=>on.fromPromise(c==null?Promise.resolve(void 0):c(),fo).andThen(m=>KM(lg({readActor:t,session:m}))).andThen(m=>on.fromPromise(Fc(ZM({backend:m,env:tt(u),page:e,pageState:r,tracked:y}),"observe"),fo)),perform:y=>UM({bindings:u,classifyLogicalState:o,options:y,page:e,readiness:s,readLogicalState:p,signal:n,switchActor:d}).map(m=>(u=m.bindings,{action:m.action,observedEffects:m.observedEffects,stateBindings:m.bindings,stateEffectsVerified:m.stateEffectsVerified})),resolveAction:({action:y,parameters:m})=>mg(y,Nc({action:y,bindings:u,parameters:m})).unwrapOr(null),resolveCheck:y=>Ei({bindings:u,check:y}).unwrapOr(null)}}function Ei({bindings:e,check:t}){try{return pg(Ya(t,tt(e)))}catch(r){return ug(fg(r))}}function fg(e){if(!(e instanceof D))throw e;let t=e.subject,n=!t.includes(" ")&&!t.includes("{")?tr(t):void 0;return n==null?Mr({path:[],record:t}):Mr({path:[n.field],record:n.alias})}function yg(e,t){if(e!=null)try{return we(e,t)}catch(r){if(r instanceof D)return;throw r}}function mg(e,t){try{return pg(Yl(e,tt(t)))}catch(r){return ug(fg(r))}}function UM(e){let{bindings:t,options:r}=e,n=Nc({action:r.action,bindings:t,parameters:r.parameters});return mg(r.action,n).match(o=>qM({...e,action:o,actionBindings:n}),o=>_M(o))}function qM({action:e,actionBindings:t,classifyLogicalState:r,options:n,page:o,readiness:a,readLogicalState:i,signal:s,switchActor:l}){let c=()=>new on(Qh({action:e,page:o,readiness:a,signal:s,switchActor:l}));return i==null?c().map(()=>({action:e,bindings:t,observedEffects:null,stateEffectsVerified:!1})):ig({bindings:t,classify:r,effects:n.effects,observe:i,perform:c,signal:s,sync:n.sync}).map(d=>({action:e,bindings:d.bindings,observedEffects:d.observedEffects,stateEffectsVerified:!0}))}function fo(e){return Tr(e)}async function Dc(e,t,r){try{return await Ic(e,t,r)}catch(n){if(nn(n)||HM(n))return!1;throw n}}var zM=/strict mode violation/;function HM(e){return e instanceof Error&&zM.test(e.message)}function KM(e){return e.mapErr(t=>t.kind==="action-failed"||t.kind==="check-failed"?Tr(new Error(JM(t.kind))):t)}function JM(e){return`unexpected ${e} while reading app state`}var GM=75;function YM(e){return hg(e,Date.now()+e.timeoutMs)}async function hg(e,t){return me(e.signal),await Dc(e.page,e.pageState,e.check)?!0:Date.now()>=t?!1:(await ot(GM,e.signal),hg(e,t))}async function ZM({backend:e,env:t,page:r,pageState:n,tracked:o}){let a=await gg(r,n,0),i=await XM({env:t,page:r,pageState:n,tracked:o});return{snapshot:{...e,scalars:new Map([...e.scalars,...a.scalars,...i])}}}async function XM({env:e,page:t,pageState:r,tracked:n}){let o=await Promise.all([...n.values()].filter(a=>a.subject.kind==="element").map(async a=>{let i=await QM({env:e,page:t,pageState:r,subject:a.subject});return i===void 0?[]:[[v(a.subject),{declared:!0,expect:{expect:"is",value:i},subject:a.subject}]]}));return new Map(o.flat())}async function QM({env:e,page:t,pageState:r,subject:n}){let o=yg(n.locator,e);if(o!==void 0)return n.state==="value"||n.state==="text"?eT(t,o,n.state):Dc(t,r,{kind:n.state,locator:o})}async function eT(e,t,r){try{return await Lc(it(e,t,{visibleOnly:!0}),r)}catch{return""}}var tT=[100,250,500];async function gg(e,t,r){try{return await t.read(e)}catch(n){let o=tT[r];if(o==null||!nn(n))throw n;return await Ri(o),gg(e,t,r+1)}}var dg=35e3;function Fc(e,t){let r,n=new Promise((o,a)=>{r=setTimeout(()=>{a(new Error(`driver op "${t}" exceeded ${String(dg)}ms`))},dg)});return Promise.race([e,n]).finally(()=>{clearTimeout(r)})}import iT from"path";var Sg={read:rT};async function rT(e){return{scalars:$e(Nr(e.url()),nT([[{kind:"title"},await e.title()],[{kind:"viewport"},aT(e.viewportSize())]]))}}function nT(e){return new Map(e.flatMap(([t,r])=>r===void 0?[]:[[v(t),{declared:!0,expect:{expect:"is",value:r},subject:t}]]))}var oT=768;function aT(e){return e==null?"":e.width<oT?"mobile":"desktop"}var Rg={desktop:{height:720,width:1280},mobile:{height:844,width:390}};function ki(e){return Rg[e]}var WJ=Rg.desktop;async function $c({attachBrowser:e,baseUrl:t,browser:r,browserStateSeed:n,capture:o,eventualStatePaths:a,fixturesDir:i,networkHeaders:s,prepared:l,readActor:c,readLogicalState:d,releaseBrowser:u,session:p,signal:y,signInActor:m,stateEffectBindings:h,viewport:f}){let b=await cT({baseUrl:t,browser:r,networkHeaders:s,prepared:l,session:p,viewport:f});l==null&&await xg({browserStateSeed:n,context:b});let w=l?.page??await b.newPage(),S=w;e(S),await u().match(()=>{},U=>{throw new Error(`Ripplo could not release browser state: ${U.kind}`)});let E=l==null?void 0:await sT({page:w,pageLike:S,readLogicalState:d,signal:y}),L=o==null?yT():await o.hub.attach(b,o.runId);L.onPage(w);let _=uT({baseUrl:t,context:b,page:w,signInActor:m}),re=c==null?void 0:pT(t,b);return{context:b,driver:gT(mT(Bc(S,c,Sg,y,{classifyLogicalState:ec(a),initialLogicalState:E,initialStateEffectBindings:h,readiness:xi,readLogicalState:d,readSession:re,switchActor:_}),i),L),emitStepOutcome:L.emitStepOutcome,close:()=>ST({context:b,handle:L})}}async function sT({page:e,pageLike:t,readLogicalState:r,signal:n}){await Zh({page:t,readiness:xi,signal:n});let o=await lT({readLogicalState:r});return await e.goto("about:blank",{waitUntil:"domcontentloaded"}),o}async function lT({readLogicalState:e}){if(e!=null)return e().match(t=>t,t=>{throw new Error(`Ripplo could not read browser-backed state before starting the workflow: ${Qt(t)}`)})}async function cT({baseUrl:e,browser:t,networkHeaders:r,prepared:n,session:o,viewport:a}){let i=n?.context??await t.newContext({baseURL:e,ignoreHTTPSErrors:!0,reducedMotion:"reduce",storageState:o==null?void 0:{cookies:Ci(o.cookies,e),origins:o.origins},viewport:a});return r!=null&&await fT(i,e,r),o?.headers!=null&&await i.setExtraHTTPHeaders(o.headers),i}async function vg({attachBrowser:e,baseUrl:t,browser:r,browserStateSeed:n,viewport:o}){let a=await r.newContext({baseURL:t,ignoreHTTPSErrors:!0,reducedMotion:"reduce",viewport:o});await xg({browserStateSeed:n,context:a});let i=await a.newPage();return e(i),{context:a,page:i}}async function wg({baseUrl:e,prepared:t,session:r}){r!=null&&(await t.context.addCookies(Ci(r.cookies,e)),r.headers!=null&&await t.context.setExtraHTTPHeaders(r.headers)),await t.page.goto(e,{waitUntil:"domcontentloaded"}),r!=null&&await dT({baseUrl:e,page:t.page,session:r})}async function dT({baseUrl:e,page:t,session:r}){let n=new URL(e).origin,o=r.origins.find(a=>a.origin===n);o!=null&&(await t.evaluate(a=>{a.forEach(({name:i,value:s})=>{localStorage.setItem(i,s)})},o.localStorage),await t.reload({waitUntil:"domcontentloaded"}))}async function Vc(e,t){let r=await kg(e,void 0);try{return await t(r)}finally{await r.close()}}async function Eg(e){let{chromium:t}=await import("playwright");return t.launchPersistentContext(e,{headless:!1,viewport:null})}async function xg({browserStateSeed:e,context:t}){await t.addInitScript("globalThis.__name = globalThis.__name ?? ((target) => target);"),await t.addInitScript(`globalThis[${JSON.stringify(Hu)}] = ${JSON.stringify(e)};`)}function uT({baseUrl:e,context:t,page:r,signInActor:n}){if(n!=null)return async o=>{let a=await n(o).match(i=>i,i=>{throw new Error(`actor switch failed: ${i.kind}`)});await t.clearCookies(),await t.addCookies(Ci(a.cookies,e)),a.headers!=null&&await t.setExtraHTTPHeaders(a.headers),await r.reload()}}function Ci(e,t){let r=new URL(t).hostname;return e.map(n=>({...n,domain:r}))}function pT(e,t){return async()=>{let r=await t.cookies();return{cookies:Ci(r,e),headers:void 0,origins:[]}}}async function fT(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 yT(){return{emitAction:()=>{},emitStepOutcome:()=>{},finish:()=>Promise.resolve(),onPage:()=>{}}}async function kg(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 Ai({cacheDir:e,headed:t}){let r;return{acquire:async()=>{let a=r;if(a!=null){let i=await a.catch(()=>{});if(i?.isConnected()===!0)return i;r===a&&(r=void 0)}return r??=kg(t,e),r},close:async()=>{let a=r;r=void 0,a!=null&&await a.then(i=>i.close()).catch(()=>{})}}}function mT(e,t){return{...e,perform:r=>e.perform({...r,action:hT(r.action,t)})}}function hT(e,t){return e.kind!=="upload"||e.files==null?e:{...e,files:e.files.map(r=>iT.join(t,r))}}function gT(e,t){return{...e,perform:r=>(t.emitAction(r.action),e.perform(r))}}async function ST({context:e,handle:t}){await bg(t.finish()),await bg(e.close())}var bT=15e3;async function bg(e){let t,r=new Promise(n=>{t=setTimeout(n,bT)});await Promise.race([e.catch(()=>{}),r]).finally(()=>{clearTimeout(t)})}import{err as go,ok as So,ResultAsync as rS}from"neverthrow";import{z as nI}from"zod";import{err as jg,errAsync as _g,ok as Ug,okAsync as oI,ResultAsync as aI}from"neverthrow";var Og=Vs(Bu(),1);import{err as yo,ok as jc}from"neverthrow";import RT from"crypto";import{err as vT,errAsync as Cg,ok as wT,ResultAsync as Pi}from"neverthrow";var ET=1e4,xT=[250,750,2e3];function Oi({response:e,schemaHash:t,source:r}){return e.schemaHash===t&&e.source===r}function yr(e){return Ag(e.retry,()=>OT(e),0)}function Ag(e,t,r){return t().orElse(n=>{let o=xT[r];return o==null||!CT(n,e)?Cg(n):Pi.fromSafePromise(PT(o)).andThen(()=>Ag(e,t,r+1))})}var kT=new Set(["EAI_AGAIN","ECONNREFUSED","ENOTFOUND"]);function CT(e,t){return e.kind==="aborted"?!1:AT(e)?!0:t==="connection"?!1:e.kind==="engine-network"||e.kind==="engine-http"&&e.status>=500}function AT(e){return e.kind==="engine-network"&&e.code!=null&&kT.has(e.code)}function PT(e){return new Promise(t=>{setTimeout(t,e)})}function OT({baseUrl:e,body:t,extraHeaders:r,path:n,schema:o,signal:a,webhook:i}){let s=JSON.stringify(t);return Pi.fromPromise(fetch(`${e}${n}`,{body:s,headers:{...r,"Content-Type":"application/json",...MT(i,s)},method:"PUT",signal:TT(a)}),l=>On(n,l)).andThen(l=>IT(l,n)).andThen(l=>LT(o,l,n)).mapErr(l=>a?.aborted===!0?Xs():l)}function MT(e,t){let r=`msg_${RT.randomUUID()}`,n=new Date;return{"webhook-id":r,"webhook-signature":e.sign(r,n,t),"webhook-timestamp":String(Math.floor(n.getTime()/1e3))}}function TT(e){let t=AbortSignal.timeout(ET);return e==null?t:AbortSignal.any([e,t])}function IT(e,t){return e.ok?Pi.fromPromise(e.json(),r=>On(t,r)):Pi.fromPromise(e.text().catch(()=>""),r=>On(t,r)).andThen(r=>Cg(Hs(t,e.status,r)))}function LT(e,t,r){let n=e.safeParse(t);return n.success?wT(n.data):vT(A(r,n.error))}function Mg({baseUrl:e,extraHeaders:t,runId:r,schema:n,schemaHash:o,secret:a,setupCapable:i,source:s},l){let c=new Og.Webhook(a);return{setup:i?({input:d,target:u})=>yr({baseUrl:e,body:{input:d,runId:r,schemaHash:o,source:s,target:u},extraHeaders:t,path:"/setup",retry:"connection",schema:Ju,signal:l,webhook:c}).andThen(p=>Oi({response:p,schemaHash:o,source:s})?Pg({path:"/setup",value:p.state}):yo(A("/setup",p))):void 0,source:s,teardown:i?()=>NT({baseUrl:e,extraHeaders:t,runId:r,schemaHash:o,source:s,webhook:c}):void 0,read:()=>yr({baseUrl:e,body:{runId:r,schemaHash:o,source:s},extraHeaders:t,path:"/state",retry:"transient",schema:Ku,signal:l,webhook:c}).andThen(d=>Oi({response:d,schemaHash:o,source:s})?Pg({path:"/state",value:d.state}).andThen(u=>{let p=n.safeParse(u);return p.success?jc({[s]:u}):yo(A("/state",p.error))}):yo(A("/state",d)))}}function NT({baseUrl:e,extraHeaders:t,runId:r,schemaHash:n,source:o,webhook:a}){return yr({baseUrl:e,body:{runId:r,schemaHash:n,source:o},extraHeaders:t,path:"/teardown",retry:"connection",schema:Zu,signal:void 0,webhook:a}).andThen(i=>Oi({response:i,schemaHash:n,source:o})?jc(void 0):yo(A("/teardown",i)))}function Pg({path:e,value:t}){let r=Pr(t);return r==null?jc(t):yo(A(e,{issue:"state-budget",stateBudget:r}))}import{err as Ee,errAsync as mo,ok as Ut,okAsync as DT,Result as Wc,ResultAsync as Uc}from"neverthrow";function Tg({afterHttpSetup:e,browserSources:t,clients:r,operations:n,setupOperations:o,teardown:a,verify:i}){let s=FT({browserSources:t,clients:r,operations:n});return a(s.httpClients).andThen(()=>o({pending:s.httpOperations,results:{}})).andThen(l=>e(l).map(c=>({checkpoint:c,results:l}))).andThen(l=>BT({http:l,phases:s,setupOperations:o,teardown:a})).andThen(({checkpoint:l,results:c})=>i(c).map(d=>({checkpoint:l,setup:d})))}function FT({browserSources:e,clients:t,operations:r}){return{browserClients:t.filter(n=>e.has(n.source)),browserOperations:r.filter(n=>e.has(n.source)),httpClients:t.filter(n=>!e.has(n.source)),httpOperations:r.filter(n=>!e.has(n.source))}}function BT({http:e,phases:t,setupOperations:r,teardown:n}){return n(t.browserClients).andThen(()=>r({pending:t.browserOperations,results:e.results})).map(o=>({checkpoint:e.checkpoint,results:o}))}function Ig({browserSources:e,clients:t,datetimePaths:r}){return GT(t),{read:()=>Lg({clients:t,datetimePaths:r}),setup:n=>$T({browserSources:e,clients:t,datetimePaths:r,...n}),teardown:()=>Hc(t)}}function Lg({clients:e,datetimePaths:t}){return Uc.combine(e.map(r=>r.read())).map(r=>Ko({datetimePaths:t,state:r.reduce((n,o)=>({...n,...o}),{})}))}function $T({afterHttpSetup:e,browserSources:t,clients:r,datetimePaths:n,plan:o}){return zT({browserSources:t,clients:r,plan:o}).match(()=>Tg({afterHttpSetup:e,browserSources:t,clients:r,operations:o.operations,teardown:Hc,setupOperations:({pending:a,results:i})=>Fg({clients:r,datetimePaths:n,pending:a,results:i}),verify:a=>Lg({clients:r,datetimePaths:n}).andThen(i=>jT({plan:o,results:a,state:i}))}).orElse(a=>VT({clients:r,error:a})),a=>mo(a))}function VT({clients:e,error:t}){return Hc(e).andThen(()=>mo(t)).orElse(()=>mo(t))}function jT({plan:e,results:t,state:r}){let n=e.operations.find(o=>{let a=t[o.id];return a===void 0||!qT({operation:o,result:a,state:r})});return n!=null?Ee(A("/state",{operation:n.id})):_T({constraints:e.constraints,results:t}).andThen(o=>{let a=to({observed:r,plan:{constraints:[...o],effects:[]},pre:r});return a.requiredStateHolds?Ut({constraints:o,results:t,state:r}):Ee(Mn(a.mismatches))})}function _T({constraints:e,results:t}){return Wc.combine(e.map(r=>WT({constraint:r,results:t})))}function WT({constraint:e,results:t}){switch(e.kind){case"optional-path":case"optional-record":return Ee(A("/setup",{issue:"unresolved-optional"}));case"equals":return Mi({expression:e.value,results:t}).map(r=>({kind:"equals",selector:e.selector,value:r}));case"absent-path":case"relation":return Ut(e);case"closed-record":return UT({operations:e.operations,results:t}).map(r=>({kind:"closed-record",rows:r,selector:e.selector}));case"required-record":return _c({fields:e.fields,results:t}).map(r=>({alias:e.alias,fields:r,kind:"required-record",selector:e.selector}));case"absent-record":return _c({fields:e.fields,results:t}).map(r=>({fields:r,kind:"absent-record",selector:e.selector}))}}function UT({operations:e,results:t}){return Wc.combine(e.map(r=>{let n=t[r];return n===void 0?Ee(A("/setup",{operation:r})):Ut(n)}))}function _c({fields:e,results:t}){return Object.entries(e).reduce((r,[n,o])=>r.andThen(a=>Mi({expression:o,results:t}).map(i=>({...a,[n]:i}))),Ut({}))}function qT({operation:e,result:t,state:r}){let n=r[e.source];if(n===void 0)return!1;if(e.target.kind==="state")return qc({actual:n,expected:t});let o=zc({path:e.target.path,value:n});return o.found&&x(o.value)&&Object.values(o.value).some(a=>g(a)===g(t))}function qc({actual:e,expected:t}){return x(t)?x(e)?Object.entries(t).every(([r,n])=>{let o=e[r];return o!==void 0&&qc({actual:o,expected:n})}):!1:g(e)===g(t)}function zT({browserSources:e,clients:t,plan:r}){if(r.operations.some(c=>c.optional)||r.constraints.some(c=>c.kind==="optional-path"||c.kind==="optional-record"))return Ee(A("/setup",{issue:"unresolved-optional"}));let n=r.operations.map(c=>c.id);if(new Set(n).size!==n.length)return Ee(A("/setup",{issue:"duplicate-operation"}));let o=e==null?void 0:Gu({browserSources:e,operations:r.operations})[0];if(o!=null)return Ee(A("/setup",{dependency:o.dependency.id,issue:"browser-http-dependency",operation:o.operation.id}));let a=new Set(n),i=[...HT(r).flatMap(c=>Ar(c)),...r.constraints.flatMap(c=>c.kind==="closed-record"?c.operations:[])].find(c=>!a.has(c));if(i!=null)return Ee(A("/setup",{operation:i}));if(!Ng({completed:[],pending:r.operations}))return Ee(A("/setup",{issue:"cyclic-operations",operations:r.operations.map(({id:c})=>c)}));let l=[...r.operations.map(c=>c.source),...r.constraints.flatMap(c=>Jo(c)?[c.selector.source]:[])].find(c=>!t.some(d=>d.source===c));return l==null?Ut({}):Ee(A("/setup",{source:l}))}function HT(e){return[...e.operations.map(t=>t.input),...e.constraints.flatMap(t=>Go(t))]}function Ng({completed:e,pending:t}){if(t.length===0)return!0;let r=new Set(e),n=t.filter(o=>Ar(o.input).every(a=>r.has(a)));return n.length>0&&Ng({completed:[...e,...n.map(({id:o})=>o)],pending:t.filter(o=>!n.some(a=>a.id===o.id))})}function Fg({clients:e,datetimePaths:t,pending:r,results:n}){if(r.length===0)return DT(n);let o=r.filter(a=>Ar(a.input).every(i=>Object.hasOwn(n,i)));return o.length===0?mo(A("/setup",{issue:"cyclic-operations",operations:r.map(({id:a})=>a)})):Uc.combine(o.map(a=>KT({clients:e,datetimePaths:t,operation:a,results:n}))).andThen(a=>Fg({clients:e,datetimePaths:t,pending:r.filter(i=>!o.some(s=>s.id===i.id)),results:a.reduce((i,s)=>({...i,[s.id]:s.state}),n)}))}function KT({clients:e,datetimePaths:t,operation:r,results:n}){let a=e.find(({source:i})=>i===r.source)?.setup;return a==null?mo(A("/setup",{source:r.source})):Mi({expression:r.input,results:n}).asyncAndThen(i=>a({input:i,target:r.target}).andThen(s=>{let l=qu({datetimePaths:t,path:r.target.kind==="state"?[]:[...r.target.path,r.id],source:r.source,value:s});return qc({actual:l,expected:i})?Ut({id:r.id,state:l}):Ee(A("/setup",{issue:"materialized-input-mismatch",operation:r.id}))}))}function Mi({expression:e,results:t}){switch(e.kind){case"value":return Ut(e.value);case"reference":return JT({operation:e.operation,path:e.path,results:t});case"generate":return Ee(A("/setup",{slot:e.name}));case"array":return Wc.combine(e.items.map(r=>Mi({expression:r,results:t})));case"object":return _c({fields:e.fields,results:t})}}function JT({operation:e,path:t,results:r}){let n=r[e];if(n===void 0)return Ee(A("/setup",{operation:e}));let o=zc({path:t,value:n});return o.found?Ut(o.value):Ee(A("/setup",{operation:e,path:t}))}function zc({path:e,value:t}){let[r,...n]=e;if(r==null)return{found:!0,value:t};if(!x(t))return{found:!1};let o=t[r];return o===void 0?{found:!1}:zc({path:n,value:o})}function Hc(e){return Uc.combine(e.flatMap(t=>t.teardown==null?[]:[t.teardown()])).map(()=>{})}function GT(e){let t=e.map(r=>r.source);if(new Set(t).size!==t.length)throw new TypeError("state-source-duplicate")}import{errAsync as Ii,okAsync as Bg,ResultAsync as Dg}from"neverthrow";import{z as Kc}from"zod";function $g(e){let t=Kc.fromJSONSchema(e.jsonSchema),r,n=()=>{if(r==null||r.url()==="about:blank")throw new TypeError(`Browser state source "${e.name}" is not mounted`);return r};return{client:{setup:e.setupCapable?({input:o,target:a})=>Ti({mountedPage:n,request:{input:o,kind:"setup",source:e.name,target:a}}).andThen(i=>tI(i)):void 0,source:e.name,teardown:e.setupCapable?()=>Ti({mountedPage:n,request:{kind:"teardown",source:e.name}}).map(()=>{}):void 0,read:()=>Ti({mountedPage:n,request:{kind:"read",source:e.name}}).andThen(o=>eI({definition:e,schema:t,value:o}))},attach:o=>{r=o},mounted:()=>r!=null&&r.url()!=="about:blank",release:()=>Ti({mountedPage:n,request:{kind:"release",source:e.name}}).map(()=>{})}}function Ti({mountedPage:e,request:t}){return Dg.fromPromise(Promise.resolve().then(e),r=>A(`/browser-state/${t.kind}`,r)).andThen(r=>XT({page:r,request:t}))}var YT=3e4,ZT=25;function XT({page:e,request:t}){return Dg.fromPromise(Vg({deadline:Date.now()+YT,page:e,request:t}),r=>A(`/browser-state/${t.kind}`,r))}async function Vg({deadline:e,page:t,request:r}){try{return await t.evaluate(rI,{mountKey:zu,request:r,timeoutMs:Math.max(0,e-Date.now())})}catch(n){if(!nn(n)||Date.now()>=e)throw n;return await QT(ZT),Vg({deadline:e,page:t,request:r})}}function QT(e){return new Promise(t=>setTimeout(t,e))}function eI({definition:e,schema:t,value:r}){let n=Pr(r);if(n!=null)return Ii(A("/state",{issue:"state-budget",stateBudget:n}));let o=t.safeParse(r);if(!o.success)return Ii(A("/state",o.error));let a=Kc.json().safeParse(o.data);return a.success?Bg({[e.name]:a.data}):Ii(A("/state",a.error))}function tI(e){let t=Kc.json().safeParse(e);return t.success?Bg(t.data):Ii(A("/setup",t.error))}async function rI({request:e,timeoutMs:t}){let r=Date.now()+t;for(;globalThis.__ripploBrowserStateMount==null&&Date.now()<r;)await new Promise(o=>setTimeout(o,25));let n=globalThis.__ripploBrowserStateMount;if(n==null)throw new TypeError("The browser state source did not mount before setup timed out");switch(e.kind){case"read":return n.readSource(e.source);case"release":return await n.releaseSource(e.source),null;case"setup":return n.setupSource(e);case"teardown":return await n.teardownSource(e.source),null}}function qg({baseUrl:e,extraHeaders:t,runId:r,secret:n,state:o},a){let i=o.sources.filter(d=>d.transport==="browser").map(d=>$g(d)),s=Ig({browserSources:new Set(i.map(({client:{source:d}})=>d)),clients:[...o.sources.filter(d=>d.transport==="http").map(d=>Mg({baseUrl:e,extraHeaders:t,runId:r,schema:Wg(d.jsonSchema),schemaHash:d.schemaHash,secret:n,setupCapable:d.setupCapable,source:d.name},a)),...i.map(d=>d.client)],datetimePaths:o.datetimePaths}),l=Wg(o.jsonSchema),c=d=>sI({datetimePaths:o.datetimePaths,logicalState:d,schema:l});return{usesBrowser:i.length>0,attachBrowser:d=>{i.forEach(u=>{u.attach(d)})},read:()=>s.read().andThen(d=>i.every(u=>u.mounted())?c(d):Ug(d)),releaseBrowser:()=>aI.combine(i.map(d=>d.release())).map(()=>{}),setup:d=>s.setup(d).andThen(({checkpoint:u,setup:p})=>iI({client:s,setup:p,validate:c}).map(y=>({checkpoint:u,setup:y}))),teardown:()=>s.teardown()}}function iI({client:e,setup:t,validate:r}){return r(t.state).match(n=>oI({...t,state:n}),n=>e.teardown().andThen(()=>_g(n)).orElse(()=>_g(n)))}function sI({datetimePaths:e,logicalState:t,schema:r}){let n=Pr(t);if(n!=null)return jg(A("/state",{issue:"state-budget",stateBudget:n}));let o=r.safeParse(t);return o.success?Ug(Ko({datetimePaths:e,state:t})):jg(A("/state",o.error))}function Wg(e){return nI.fromJSONSchema(e)}var zg=Vs(Bu(),1);import{err as lI,ok as cI}from"neverthrow";function Hg({baseUrl:e,extraHeaders:t,runId:r,secret:n,signal:o}){let a=new zg.Webhook(n);return{currentActor:i=>yr({baseUrl:e,body:{runId:r,session:i},extraHeaders:t,path:"/current-actor",retry:"transient",schema:ju,signal:o,webhook:a}).map(s=>s.actor==null?null:{row:s.actor.row,selector:{path:s.actor.path,source:s.actor.source}}),signIn:({actor:i,schemaHash:s,selector:l})=>yr({baseUrl:e,body:{actor:i,path:l.path,runId:r,schemaHash:s,source:l.source},extraHeaders:t,path:"/sign-in",retry:"connection",schema:Vu,signal:o,webhook:a}).andThen(c=>dI({response:c,schemaHash:s,selector:l})?cI(c.session):lI(A("/sign-in",c)))}}function dI({response:e,schemaHash:t,selector:r}){return e.schemaHash===t&&e.source===r.source&&e.path.join(".")===r.path.join(".")}function Jc({lockfile:e,options:t,runId:r,signal:n}){let o=qg({baseUrl:t.engineUrl,extraHeaders:void 0,runId:r,secret:t.secret,state:e.state},n),a=Hg({baseUrl:t.engineUrl,extraHeaders:void 0,runId:r,secret:t.secret,signal:n});return{attachBrowser:o.attachBrowser,authentication:a,releaseBrowser:o.releaseBrowser,setupState:o.setup,teardown:o.teardown,usesBrowser:o.usesBrowser,readState:()=>o.read().mapErr(uI)}}function uI(e){return e.kind==="action-failed"||e.kind==="check-failed"?Tr(e):e}function Kg({corpus:e,parameterOverrides:t,parameters:r,preferred:n,state:o}){return n!=null?n.map(i=>({...i,params:{...i.params,...t}})):e.reduce((i,s,l)=>{let c=u=>({...pr({action:s,attempt:u,state:i.parameters}),...t}),d=Pl({attempts:Jr({action:s,state:i.parameters}),paramsForAttempt:c,rule:s,state:i.state});if(d==null)throw Ys({reason:Jn(s,i.state,c(0)),stepIndex:l,test:s.test});return{parameters:$t({action:s,params:d.params,state:i.parameters}),sequence:[...i.sequence,{params:d.params,transition:s}],state:d.stepRun.next}},{parameters:r,sequence:[],state:o}).sequence}function mr(e,t){e?.({activity:t,deadlineAt:null,retry:null})}function ho({env:e,test:t}){return Object.fromEntries(Object.keys(t.params).map(r=>{let n=e.get(H(r));if(n===void 0)throw new TypeError(`parameter "${r}" was not materialized`);return[r,n]}))}import{errAsync as hI,ResultAsync as an}from"neverthrow";import{errAsync as Gc,okAsync as Xc}from"neverthrow";function Jg({actor:e,authentication:t,constraints:r,results:n,state:o}){return e.kind==="anonymous"?Xc(void 0):Yg({alias:e.alias,authentication:t,constraints:r,results:n,state:o}).map(({row:a,session:i})=>({alias:e.alias,row:a,session:i}))}function Gg({authentication:e,setup:t,state:r}){return n=>Yg({alias:n,authentication:e,constraints:t.constraints,results:t.results,state:r}).map(({session:o})=>o)}function Yg({alias:e,authentication:t,constraints:r,results:n,state:o}){let a=n[e],i=Zg({alias:e,constraints:r}),s=o.sources.find(l=>l.name===i?.source);return a==null||i==null||s==null?Gc(he(new Error(`Ripplo could not find materialized actor "${e}"`))):s.transport!=="http"?Gc(he(new Error(`Actor "${e}" belongs to a browser state source. Authentication engines require an HTTP state source.`))):t.signIn({actor:a,schemaHash:s.schemaHash,selector:i}).map(l=>({row:a,session:l}))}function Zg({alias:e,constraints:t}){return t.flatMap(r=>r.kind==="required-record"&&r.alias===e?[r.selector]:[])[0]}function Xg({base:e,results:t}){return new Map([...e,...tt(t)])}function Qg(e){if(e==null)return[];let t={declared:!1,expect:{expect:"is",value:e.alias},subject:{kind:"actor"}};return[[v(t.subject),t]]}function eS({authentication:e,readState:t,setup:r}){return n=>e.currentActor(n).andThen(o=>o==null?Xc(null):t().andThen(a=>pI({current:o,observed:a,setup:r})))}function pI({current:e,observed:t,setup:r}){let n=mI({selector:e.selector,state:t}).filter(i=>g(i)===g(e.row)),o=fI({current:e,observed:t,setup:r}),a=o[0];return n.length!==1||o.length!==1||a==null?Gc(Js({observedMatches:n.length,source:Zc(e.selector),workflowMatches:o.length})):Xc(a)}function fI({current:e,observed:t,setup:r}){return Object.entries(r.results).filter(([n,o])=>yI({alias:n,current:e,observed:t,row:o,setup:r})).map(([n])=>n)}function yI({alias:e,current:t,observed:r,row:n,setup:o}){let a=Zg({alias:e,constraints:o.constraints});if(a==null||Zc(a)!==Zc(t.selector))return!1;let i=Yc({selector:a,state:o.state}).filter(c=>g(c.row)===g(n)).map(c=>c.key),s=i[0];if(i.length!==1||s==null)return!1;let l=Yc({selector:a,state:r}).find(c=>c.key===s)?.row;return l!=null&&g(l)===g(t.row)}function mI({selector:e,state:t}){return Yc({selector:e,state:t}).map(r=>r.row)}function Yc({selector:e,state:t}){let r=t[e.source],n=e.path.reduce((o,a)=>o!=null&&!Array.isArray(o)&&typeof o=="object"?o[a]:void 0,r);return n==null||Array.isArray(n)||typeof n!="object"?[]:Object.entries(n).map(([o,a])=>({key:o,row:a}))}function Zc(e){return`${e.source}.${e.path.join(".")}`}function Qc({browser:e,client:t,request:r}){return gI({browser:e,client:t,request:r}).andThen(n=>SI({client:t,prepared:n,request:r}).map(o=>({established:o,prepared:n})).orElse(o=>bI(n).andThen(()=>hI(o))))}function gI({browser:e,client:t,request:r}){return t.usesBrowser?an.fromPromise(vg({attachBrowser:t.attachBrowser,baseUrl:r.options.baseUrl,browser:e,browserStateSeed:{runId:r.runId},viewport:ki(r.test.viewport)}),he):an.fromSafePromise(Promise.resolve(void 0))}function SI({client:e,prepared:t,request:r}){let n=Date.now(),o=Xo({plan:r.test.startingState,seed:r.startingStateSeed}),a={...r.test,startingState:o};return Kr({generate:Cr(r.options.generate,r.startingStateSeed),params:r.params,state:r.lockfile.state,test:a}).andThen(i=>RI({client:e,prepared:t,request:r,setup:i,startingState:o,worldStart:n}))}function bI(e){return an.fromPromise(e==null?Promise.resolve():e.context.close(),he)}function RI({client:e,prepared:t,request:r,setup:n,startingState:o,worldStart:a}){let i=[...new Set(o.operations.map(({source:l})=>l))],s=vI({activeSources:i,sources:r.lockfile.state.sources});return tS({activeSources:s.http,onProgress:r.onProgress}),e.setupState({plan:mp({parameters:ho({env:n.env,test:r.test}),plan:o}),afterHttpSetup:l=>EI({browserSources:s.browser,client:e,prepared:t,request:r,results:l,startingState:o})}).andThen(({checkpoint:l,setup:c})=>{mr(r.onProgress,{activeSources:i,kind:"settingUpState",stage:"verifying"});let d=Gg({authentication:e.authentication,setup:c,state:r.lockfile.state});return wI({authentication:l,client:e,logicalSetup:c,request:r,setup:n,signInActor:d,startingState:o,worldStart:a})})}function vI({activeSources:e,sources:t}){let r=new Set(t.filter(({transport:n})=>n==="browser").map(({name:n})=>n));return{browser:e.filter(n=>r.has(n)),http:e.filter(n=>!r.has(n))}}function tS({activeSources:e,onProgress:t}){e.length!==0&&mr(t,{activeSources:[...e],kind:"settingUpState",stage:"materializing"})}function wI({authentication:e,client:t,logicalSetup:r,request:n,setup:o,signInActor:a,startingState:i,worldStart:s}){return n.onPhase?.("world",Date.now()-s),n.onEvent?.({kind:"state-setup",results:r.results}),an.fromSafePromise(Promise.resolve(kI({authentication:e,client:t,logical:_n(i),logicalSetup:r,params:ho({env:o.env,test:n.test}),runId:n.runId,setup:o,signInActor:a})))}function EI({browserSources:e,client:t,prepared:r,request:n,results:o,startingState:a}){return n.test.actor.kind==="user"&&mr(n.onProgress,{kind:"signingIn"}),Jg({actor:n.test.actor,authentication:t.authentication,constraints:a.constraints,results:o,state:n.lockfile.state}).andThen(i=>xI({authentication:i,prepared:r,request:n})).map(i=>(tS({activeSources:e,onProgress:n.onProgress}),i))}function xI({authentication:e,prepared:t,request:r}){return t==null?an.fromSafePromise(Promise.resolve(e)):an.fromPromise(wg({baseUrl:r.options.baseUrl,prepared:t,session:e?.session}),he).map(()=>e)}function kI({authentication:e,client:t,logical:r,logicalSetup:n,params:o,runId:a,setup:i,signInActor:s}){let l=Qg(e),c=n.results;return{attachBrowser:t.attachBrowser,auth:e?.session,browserStateSeed:{runId:a},env:Xg({base:i.env,results:c}),logical:r,readActor:eS({authentication:t.authentication,readState:t.readState,setup:n}),readLogicalState:t.readState,releaseBrowser:t.releaseBrowser,signInActor:s,snapshot:{...i.snapshot,scalars:new Map([...i.snapshot.scalars,...l])},stateEffectBindings:{...c,...e==null?{}:{[Er]:e.row},[dt]:o},teardown:t.teardown}}function bo(e){return{aborted:!0,contradictions:[],failed:!1,findings:[],ran:[],teardown:e}}function td(e,t){return new rS(TI(e,t))}function CI(e,t){return new rS(AI(e,t))}async function AI(e,t){let r=PI(e),n=Jc({lockfile:e.lockfile,options:e.options,runId:e.runId,signal:t}),o=async({established:s,prepared:l})=>{try{return So(await OI({browser:i,closeBrowser:a.close,established:s,params:e,prepared:l,signal:t}))}catch(c){await s.teardown().match(ge,ge),c instanceof qt&&await c.session.close().catch(ge),await a.close();let d=c instanceof qt?c.cause:c;return go(Tn(d)?d:Or(d))}},a=Ai({cacheDir:void 0,headed:!0}),i=await a.acquire();return Qc({browser:i,client:n,request:r}).match(o,async s=>(await rd(n.teardown),await a.close(),go(s)))}function PI(e){return{capture:!1,lockfile:e.lockfile,onEvent:void 0,onPhase:void 0,onProgress:void 0,options:e.options,params:void 0,runId:e.runId,sequence:e.sequence,startingStateSeed:e.runId,test:e.test}}async function OI({browser:e,closeBrowser:t,established:r,params:n,prepared:o,signal:a}){let{result:i,session:s}=await nS({browser:e,capture:null,established:r,lockfile:n.lockfile,onEvent:void 0,onPhase:void 0,onProgress:void 0,options:n.options,parameterOverrides:void 0,prepared:o,sequence:n.sequence,signal:a,stopAfterStep:n.stopAfterStep,test:n.test,viewport:null});return i.failed?(await r.teardown().match(ge,ge),await s.close().catch(ge),await t(),{contradictions:i.contradictions,kind:"failed"}):(n.onReady(),await MI(e,s.context),await r.teardown().match(ge,ge),await t(),{kind:"handed-over",ran:i.ran.length})}function MI(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 TI({browser:e,hub:t,request:r},n){if(n.aborted)return So(bo("skipped"));let o=Jc({lockfile:r.lockfile,options:r.options,runId:r.runId,signal:n}),a=async({established:i,prepared:s})=>{try{return await LI({browser:e,established:i,hub:t,prepared:s,request:r,signal:n})}catch(l){return go(Tn(l)?l:Or(l))}};return Qc({browser:e,client:o,request:r}).match(a,i=>II(i,o.teardown))}async function II(e,t){return e.kind!=="aborted"?go(e):So(bo(await rd(t)))}function rd(e){return e().match(()=>"done",()=>"failed")}async function LI(e){let t=await BI(e);if(t.kind==="completed"){let n=Date.now();mr(e.request.onProgress,{kind:"finishing",stage:"cleaningUp"});let o=await e.established.teardown().match(()=>(e.request.onPhase?.("teardown",Date.now()-n),So({aborted:!1,...t.result})),a=>go(a));return await t.session.close().catch(ge),o}let r=await rd(e.established.teardown);if(t.session!=null&&await t.session.close().catch(ge),t.kind==="aborted")return So(bo(r));throw t.error}async function nS(e){let{lockfile:t,signal:r}=e,n=Date.now();mr(e.onProgress,{kind:"startingBrowser"});let o=await FI(e);e.onPhase?.("browser",Date.now()-n);let a=NI(e);if(a.kind==="error")throw new qt({cause:a.error,session:o});try{let{checks:i,initialState:s,sequence:l}=a,c=Date.now(),d=await li({classify:ti,driver:o.driver,facts:{facts:hl(i.facts,ne(e.test)),overlays:et(t),overrides:i.overrides},initialState:s,onProgress:e.onProgress,sequence:l,stopAfterStep:e.stopAfterStep,onEvent:u=>{u.kind==="step"&&o.emitStepOutcome({checks:u.checks,stepError:u.stepError,stepIndex:u.index}),e.onEvent?.(u)}},r);return e.onPhase?.("drive",Date.now()-c),{result:d,session:o}}catch(i){throw new qt({cause:i,session:o})}}function NI(e){let{established:t,lockfile:r}=e;try{let n=Wr(r),o={base:t.env,deferred:Xe,logical:t.logical,ordinal:0,snapshot:t.snapshot},a=Kg({corpus:e.sequence==null?lr(r,e.test):e.sequence.map(i=>i.transition),parameterOverrides:e.parameterOverrides,parameters:Gn({params:ho({env:t.env,test:e.test}),test:e.test,testRef:ne(e.test)}),preferred:e.sequence,state:o});return{checks:n,initialState:o,kind:"prepared",sequence:a}}catch(n){return{error:Tn(n)?n:Gs(n),kind:"error"}}}var qt=class extends Error{cause;session;constructor({cause:t,session:r}){super("sequence drive failed"),this.cause=t,this.session=r}};async function FI(e){let{established:t,lockfile:r,signal:n}=e;try{return await $c({attachBrowser:t.attachBrowser,baseUrl:e.options.baseUrl,browser:e.browser,browserStateSeed:t.browserStateSeed,capture:e.capture,eventualStatePaths:r.state.eventualPaths,fixturesDir:e.options.fixturesDir,networkHeaders:void 0,prepared:e.prepared,readActor:t.readActor,readLogicalState:t.readLogicalState,releaseBrowser:t.releaseBrowser,session:t.auth,signal:n,signInActor:t.signInActor,stateEffectBindings:t.stateEffectBindings,viewport:e.viewport})}catch(o){throw new ed(o)}}var ed=class extends Error{kind;constructor(t){let r=he(t);super(r.message),this.kind=r.kind}};async function BI({browser:e,established:t,hub:r,prepared:n,request:o,signal:a}){try{me(a);let{result:i,session:s}=await nS({browser:e,capture:o.capture?{hub:r,runId:o.runId}:null,established:t,lockfile:o.lockfile,onEvent:o.onEvent,onPhase:o.onPhase,onProgress:o.onProgress,options:o.options,parameterOverrides:o.params,prepared:n,sequence:o.sequence,signal:a,stopAfterStep:void 0,test:o.test,viewport:ki(o.test.viewport)});return{kind:"completed",result:i,session:s}}catch(i){return DI(i)}}function DI(e){let t=e instanceof qt?e.cause:e,r=e instanceof qt?e.session:void 0;return ro(t)?{kind:"aborted",session:r}:{error:t,kind:"threw",session:r}}import BD from"path";import{err as sv,ok as DD,ResultAsync as $D}from"neverthrow";import iv from"path";import{z as He}from"zod";import $I from"path";function oS({debugDir:e,runId:t,worker:r}){let n=$I.join(e,t,"behavior.jsonl");return r.open({file:n,headerLine:lp(),runId:t}),{close:o=>r.close({noticeLineIfNoRrweb:o?.noticeIfNoRrweb==null?"":JSON.stringify(VI(o.noticeIfNoRrweb)),runId:t}),emit:o=>{let a={...o,timestamp:jI(o.timeNanos)};r.line({line:JSON.stringify(a),runId:t,timeNanos:o.timeNanos})},emitRrwebBatch:o=>{r.rrwebBatch({data:o,runId:t})}}}function hr(e){return String(BigInt(Math.round(e))*1000000n)}function VI(e){return{kind:"notice",message:e,source:"capture",timeNanos:"0"}}function jI(e){return Number(BigInt(e)/1000000n)}import{existsSync as _I}from"fs";import{createRequire as WI}from"module";import{fileURLToPath as UI}from"url";import{Worker as qI}from"worker_threads";var zI=WI(import.meta.url);function aS(e){let t=new qI(HI(),{workerData:e});t.unref();let r=new Map,n={next:0};t.on("message",a=>{let i=r.get(a.seq);i!=null&&(r.delete(a.seq),i())});let o=a=>{t.postMessage(a)};return{close:({noticeLineIfNoRrweb:a,runId:i})=>{let s=n.next;return n.next+=1,new Promise(l=>{r.set(s,l),o({noticeLineIfNoRrweb:a,runId:i,seq:s,t:"close"})})},line:({line:a,runId:i,timeNanos:s})=>{o({line:a,runId:i,t:"line",timeNanos:s})},open:({file:a,headerLine:i,runId:s})=>{o({file:a,headerLine:i,runId:s,t:"open"})},rrwebBatch:({data:a,runId:i})=>{o({data:a,runId:i,t:"rrweb-batch"})},terminate:async()=>{await t.terminate()}}}function HI(){try{return zI.resolve("@ripplo/runtime/capture-worker")}catch{let e=["../../dist/capture-worker.js","./capture-worker.js"].map(r=>UI(new URL(r,import.meta.url))),t=e.find(r=>_I(r));if(t==null)throw new Error(`capture-worker.js not found; looked at: ${e.join(", ")}`);return t}}import{readFile as KI}from"fs/promises";import{createRequire as JI}from"module";import{fileURLToPath as GI}from"url";var YI=JI(import.meta.url);function nd(e,t){try{return YI.resolve(e)}catch{return GI(new URL(`assets/${t}`,import.meta.url))}}function od(e){let t;return()=>(t??=KI(e,"utf8"),t)}var ZI=od(nd("@ripplo/browser-trace/bundle","browser-trace.js"));async function iS(e,t){await e.addInitScript(`globalThis.__ripploRunId = ${JSON.stringify(t)};`),await e.addInitScript(await ZI())}var XI=Object.defineProperty,QI=(e,t,r)=>t in e?XI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,R=(e,t,r)=>QI(e,typeof t!="symbol"?t+"":t,r),sS,eL=Object.defineProperty,tL=(e,t,r)=>t in e?eL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lS=(e,t,r)=>tL(e,typeof t!="symbol"?t+"":t,r),de=(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))(de||{}),cS={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},dS={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Li={},rL=()=>!!globalThis.Zone;function lu(e){if(Li[e])return Li[e];let t=globalThis[e],r=t.prototype,n=e in cS?cS[e]:void 0,o=!!(n&&n.every(s=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,s))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),a=e in dS?dS[e]:void 0,i=!!(a&&a.every(s=>{var l;return typeof r[s]=="function"&&((l=r[s])==null?void 0:l.toString().includes("[native code]"))}));if(o&&i&&!rL())return Li[e]=t.prototype,t.prototype;try{let s=document.createElement("iframe");document.body.appendChild(s);let l=s.contentWindow;if(!l)return t.prototype;let c=l[e].prototype;return document.body.removeChild(s),c?Li[e]=c:r}catch{return r}}var ad={};function Et(e,t,r){var n;let o=`${e}.${String(r)}`;if(ad[o])return ad[o].call(t);let a=lu(e),i=(n=Object.getOwnPropertyDescriptor(a,r))==null?void 0:n.get;return i?(ad[o]=i,i.call(t)):t[r]}var id={};function sb(e,t,r){let n=`${e}.${String(r)}`;if(id[n])return id[n].bind(t);let a=lu(e)[r];return typeof a!="function"?t[r]:(id[n]=a,a.bind(t))}function nL(e){return Et("Node",e,"ownerDocument")}function oL(e){return Et("Node",e,"childNodes")}function aL(e){return Et("Node",e,"parentNode")}function iL(e){return Et("Node",e,"parentElement")}function sL(e){return Et("Node",e,"textContent")}function lL(e,t){return sb("Node",e,"contains")(t)}function cL(e){return sb("Node",e,"getRootNode")()}function dL(e){return!e||!("host"in e)?null:Et("ShadowRoot",e,"host")}function uL(e){return e.styleSheets}function pL(e){return!e||!("shadowRoot"in e)?null:Et("Element",e,"shadowRoot")}function fL(e,t){return Et("Element",e,"querySelector")(t)}function yL(e,t){return Et("Element",e,"querySelectorAll")(t)}function mL(){return lu("MutationObserver").constructor}function hL(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 Se={ownerDocument:nL,childNodes:oL,parentNode:aL,parentElement:iL,textContent:sL,contains:lL,getRootNode:cL,host:dL,styleSheets:uL,shadowRoot:pL,querySelector:fL,querySelectorAll:yL,mutationObserver:mL,patch:hL};function lb(e){return e.nodeType===e.ELEMENT_NODE}function ko(e){let t=e&&"host"in e&&"mode"in e&&Se.host(e)||null;return!!(t&&"shadowRoot"in t&&Se.shadowRoot(t)===e)}function Co(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function gL(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 SL(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 bd(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=>cb(o,r)).join("");return gL(n)}catch{return null}}function cb(e,t){if(RL(e)){let r;try{r=bd(e.styleSheet)||SL(e)}catch{r=e.cssText}return e.styleSheet.href?us(r,e.styleSheet.href):r}else{let r=e.cssText;return vL(e)&&e.selectorText.includes(":")&&(r=bL(r)),t?us(r,t):r}}function bL(e){let t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function RL(e){return"styleSheet"in e}function vL(e){return"selectorText"in e}var ls=class{constructor(){lS(this,"idNodeMap",new Map),lS(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 wL(){return new ls}function cs({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:a}){let i=o||"",s=n&&Sr(n);return(t[r.toLowerCase()]||s&&t[s])&&(a?i=a(i,e):i="*".repeat(i.length)),i}function Sr(e){return e.toLowerCase()}var uS="__rrweb_original__";function EL(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 a=t.getImageData,i=uS in a?a[uS]:a;if(new Uint32Array(i.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 ds(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Sr(t):null}function db(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 xL(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var kL=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,CL=/^(?:[a-z+]+:)?\/\//i,AL=/^www\..*/i,PL=/^(data:)([^,]*),(.*)/i;function us(e,t){return(e||"").replace(kL,(r,n,o,a,i,s)=>{let l=o||i||s,c=n||a||"";if(!l)return r;if(CL.test(l)||AL.test(l))return`url(${c}${l}${c})`;if(PL.test(l))return`url(${c}${l}${c})`;if(l[0]==="/")return`url(${c}${xL(t)+l}${c})`;let d=t.split("/"),u=l.split("/");d.pop();for(let p of u)p!=="."&&(p===".."?d.pop():d.push(p));return`url(${c}${d.join("/")}${c})`})}function Ni(e,t=!1){return t?e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function OL(e,t,r=!1){let n=Array.from(t.childNodes),o=[],a=0;if(n.length>1&&e&&typeof e=="string"){let i=Ni(e,r),s=i.length/e.length;for(let l=1;l<n.length;l++)if(n[l].textContent&&typeof n[l].textContent=="string"){let c=Ni(n[l].textContent,r),d=100,u=3;for(;u<c.length&&(c[u].match(/[a-zA-Z0-9]/)||c.indexOf(c.substring(0,u),1)!==-1);u++);for(;u<c.length;u++){let p=c.substring(0,u),y=i.split(p),m=-1;if(y.length===2)m=y[0].length;else if(y.length>2&&y[0]===""&&n[l-1].textContent!=="")m=i.indexOf(p,1);else if(y.length===1){if(p=p.substring(0,p.length-1),y=i.split(p),y.length<=1)return o.push(e),o;u=d+1}else u===c.length-1&&(m=i.indexOf(p));if(y.length>=2&&u>d){let h=n[l-1].textContent;if(h&&typeof h=="string"){let f=Ni(h).length;m=i.indexOf(p,f)}m===-1&&(m=y[0].length)}if(m!==-1){let h=Math.floor(m/s);for(;h>0&&h<e.length;){if(a+=1,a>50*n.length)return o.push(e),o;let f=Ni(e.substring(0,h),r);if(f.length===m){o.push(e.substring(0,h)),e=e.substring(h),i=i.substring(m);break}else f.length<m?h+=Math.max(1,Math.floor((m-f.length)/s)):h-=Math.max(1,Math.floor((f.length-m)*s))}break}}}}return o.push(e),o}function ML(e,t){return OL(e,t).join("/* rr_split */")}var TL=1,IL=new RegExp("[^a-z0-9-_:]"),Po=-2;function ub(){return TL++}function LL(e){if(e instanceof HTMLFormElement)return"form";let t=Sr(e.tagName);return IL.test(t)?"div":t}var sn,pS,NL=/^[^ \t\n\r\u000c]+/,FL=/^[, \t\n\r\u000c]+/;function BL(e,t){if(t.trim()==="")return t;let r=0;function n(a){let i,s=a.exec(t.substring(r));return s?(i=s[0],r+=i.length,i):""}let o=[];for(;n(FL),!(r>=t.length);){let a=n(NL);if(a.slice(-1)===",")a=dn(e,a.substring(0,a.length-1)),o.push(a);else{let i="";a=dn(e,a);let s=!1;for(;;){let l=t.charAt(r);if(l===""){o.push((a+i).trim());break}else if(s)l===")"&&(s=!1);else if(l===","){r+=1,o.push((a+i).trim());break}else l==="("&&(s=!0);i+=l,r+=1}}}return o.join(", ")}var fS=new WeakMap;function dn(e,t){return!t||t.trim()===""?t:cu(e,t)}function DL(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function cu(e,t){let r=fS.get(e);if(r||(r=e.createElement("a"),fS.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function pb(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)?dn(e,n):r==="srcset"?BL(e,n):r==="style"?us(n,cu(e)):t==="object"&&r==="data"?dn(e,n):n)}function fb(e,t,r){return["video","audio"].includes(e)&&t==="autoplay"}function $L(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 ps(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?ps(Se.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?ps(Se.parentNode(e),t,r):!1}function yb(e,t,r,n){let o;if(lb(e)){if(o=e,!Se.childNodes(o).length)return!1}else{if(Se.parentElement(e)===null)return!1;o=Se.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(ps(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 VL(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,a;try{a=n.document.readyState}catch{return}if(a!=="complete"){let s=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),o=!0,t()});return}let i="about:blank";if(n.location.href!==i||e.src===i||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function jL(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let a=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(a),n=!0,t()})}function _L(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:i,inlineStylesheet:s,maskInputOptions:l={},maskTextFn:c,maskInputFn:d,dataURLOptions:u={},inlineImages:p,recordCanvas:y,keepIframeSrcFn:m,newlyAddedElement:h=!1,cssCaptured:f=!1}=t,b=WL(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:de.Document,childNodes:[],compatMode:e.compatMode}:{type:de.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:de.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return qL(e,{doc:r,blockClass:o,blockSelector:a,inlineStylesheet:s,maskInputOptions:l,maskInputFn:d,dataURLOptions:u,inlineImages:p,recordCanvas:y,keepIframeSrcFn:m,newlyAddedElement:h,rootId:b});case e.TEXT_NODE:return UL(e,{doc:r,needsMask:i,maskTextFn:c,rootId:b,cssCaptured:f});case e.CDATA_SECTION_NODE:return{type:de.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:de.Comment,textContent:Se.textContent(e)||"",rootId:b};default:return!1}}function WL(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function UL(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:a}=t,i=Se.parentNode(e),s=i&&i.tagName,l="",c=s==="STYLE"?!0:void 0,d=s==="SCRIPT"?!0:void 0;return d?l="SCRIPT_PLACEHOLDER":a||(l=Se.textContent(e),c&&l&&(l=us(l,cu(t.doc)))),!c&&!d&&l&&r&&(l=n?n(l,Se.parentElement(e)):l.replace(/[\S]/g,"*")),{type:de.Text,textContent:l||"",rootId:o}}function qL(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:a,maskInputOptions:i={},maskInputFn:s,dataURLOptions:l={},inlineImages:c,recordCanvas:d,keepIframeSrcFn:u,newlyAddedElement:p=!1,rootId:y}=t,m=$L(e,n,o),h=LL(e),f={},b=e.attributes.length;for(let S=0;S<b;S++){let E=e.attributes[S];fb(h,E.name,E.value)||(f[E.name]=pb(r,h,Sr(E.name),E.value))}if(h==="link"&&a){let S=Array.from(r.styleSheets).find(L=>L.href===e.href),E=null;S&&(E=bd(S)),E&&(delete f.rel,delete f.href,f._cssText=E)}if(h==="style"&&e.sheet){let S=bd(e.sheet);S&&(e.childNodes.length>1&&(S=ML(S,e)),f._cssText=S)}if(["input","textarea","select"].includes(h)){let S=e.value,E=e.checked;f.type!=="radio"&&f.type!=="checkbox"&&f.type!=="submit"&&f.type!=="button"&&S?f.value=cs({element:e,type:ds(e),tagName:h,value:S,maskInputOptions:i,maskInputFn:s}):E&&(f.checked=E)}if(h==="option"&&(e.selected&&!i.select?f.selected=!0:delete f.selected),h==="dialog"&&e.open&&(f.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),h==="canvas"&&d){if(e.__context==="2d")EL(e)||(f.rr_dataURL=e.toDataURL(l.type,l.quality));else if(!("__context"in e)){let S=e.toDataURL(l.type,l.quality),E=r.createElement("canvas");E.width=e.width,E.height=e.height;let L=E.toDataURL(l.type,l.quality);S!==L&&(f.rr_dataURL=S)}}if(h==="img"&&c){sn||(sn=r.createElement("canvas"),pS=sn.getContext("2d"));let S=e,E=S.currentSrc||S.getAttribute("src")||"<unknown-src>",L=S.crossOrigin,_=()=>{S.removeEventListener("load",_);try{sn.width=S.naturalWidth,sn.height=S.naturalHeight,pS.drawImage(S,0,0),f.rr_dataURL=sn.toDataURL(l.type,l.quality)}catch(re){if(S.crossOrigin!=="anonymous"){S.crossOrigin="anonymous",S.complete&&S.naturalWidth!==0?_():S.addEventListener("load",_);return}else console.warn(`Cannot inline img src=${E}! Error: ${re}`)}S.crossOrigin==="anonymous"&&(L?f.crossOrigin=L:S.removeAttribute("crossorigin"))};S.complete&&S.naturalWidth!==0?_():S.addEventListener("load",_)}if(["audio","video"].includes(h)){let S=f;S.rr_mediaState=e.paused?"paused":"played",S.rr_mediaCurrentTime=e.currentTime,S.rr_mediaPlaybackRate=e.playbackRate,S.rr_mediaMuted=e.muted,S.rr_mediaLoop=e.loop,S.rr_mediaVolume=e.volume}if(p||(e.scrollLeft&&(f.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(f.rr_scrollTop=e.scrollTop)),m){let{width:S,height:E}=e.getBoundingClientRect();f={class:f.class,rr_width:`${S}px`,rr_height:`${E}px`}}h==="iframe"&&!u(f.src)&&(e.contentDocument||(f.rr_src=f.src),delete f.src);let w;try{customElements.get(h)&&(w=!0)}catch{}return{type:de.Element,tagName:h,attributes:f,childNodes:[],isSVG:DL(e)||void 0,needBlock:m,rootId:y,isCustom:w}}function z(e){return e==null?"":e.toLowerCase()}function mb(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 zL(e,t){if(t.comment&&e.type===de.Comment)return!0;if(e.type===de.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"&&db(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(z(e.attributes.name).match(/^msapplication-tile(image|color)$/)||z(e.attributes.name)==="application-name"||z(e.attributes.rel)==="icon"||z(e.attributes.rel)==="apple-touch-icon"||z(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&z(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(z(e.attributes.property).match(/^(og|twitter|fb):/)||z(e.attributes.name).match(/^(og|twitter):/)||z(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(z(e.attributes.name)==="robots"||z(e.attributes.name)==="googlebot"||z(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(z(e.attributes.name)==="author"||z(e.attributes.name)==="generator"||z(e.attributes.name)==="framework"||z(e.attributes.name)==="publisher"||z(e.attributes.name)==="progid"||z(e.attributes.property).match(/^article:/)||z(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(z(e.attributes.name)==="google-site-verification"||z(e.attributes.name)==="yandex-verification"||z(e.attributes.name)==="csrf-token"||z(e.attributes.name)==="p:domain_verify"||z(e.attributes.name)==="verify-v1"||z(e.attributes.name)==="verification"||z(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function un(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:a,maskTextClass:i,maskTextSelector:s,skipChild:l=!1,inlineStylesheet:c=!0,maskInputOptions:d={},maskTextFn:u,maskInputFn:p,slimDOMOptions:y,dataURLOptions:m={},inlineImages:h=!1,recordCanvas:f=!1,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:S=5e3,onStylesheetLoad:E,stylesheetLoadTimeout:L=5e3,keepIframeSrcFn:_=()=>!1,newlyAddedElement:re=!1,cssCaptured:U=!1}=t,{needsMask:oe}=t,{preserveWhiteSpace:pe=!0}=t;oe||(oe=yb(e,i,s,oe===void 0));let Ae=_L(e,{doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:oe,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,dataURLOptions:m,inlineImages:h,recordCanvas:f,keepIframeSrcFn:_,newlyAddedElement:re,cssCaptured:U});if(!Ae)return console.warn(e,"not serialized"),null;let Ke;n.hasNode(e)?Ke=n.getId(e):zL(Ae,y)||!pe&&Ae.type===de.Text&&!Ae.textContent.replace(/^\s+|\s+$/gm,"").length?Ke=Po:Ke=ub();let N=Object.assign(Ae,{id:Ke});if(n.add(e,N),Ke===Po)return null;b&&b(e);let vn=!l;if(N.type===de.Element){vn=vn&&!N.needBlock,delete N.needBlock;let se=Se.shadowRoot(e);se&&Co(se)&&(N.isShadowHost=!0)}if((N.type===de.Document||N.type===de.Element)&&vn){y.headWhitespace&&N.type===de.Element&&N.tagName==="head"&&(pe=!1);let se={doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:oe,maskTextClass:i,maskTextSelector:s,skipChild:l,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:y,dataURLOptions:m,inlineImages:h,recordCanvas:f,preserveWhiteSpace:pe,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:E,stylesheetLoadTimeout:L,keepIframeSrcFn:_,cssCaptured:!1};if(!(N.type===de.Element&&N.tagName==="textarea"&&N.attributes.value!==void 0)){N.type===de.Element&&N.attributes._cssText!==void 0&&typeof N.attributes._cssText=="string"&&(se.cssCaptured=!0);for(let Ht of Array.from(Se.childNodes(e))){let Je=un(Ht,se);Je&&N.childNodes.push(Je)}}let Pe=null;if(lb(e)&&(Pe=Se.shadowRoot(e)))for(let Ht of Array.from(Se.childNodes(Pe))){let Je=un(Ht,se);Je&&(Co(Pe)&&(Je.isShadow=!0),N.childNodes.push(Je))}}let wn=Se.parentNode(e);return wn&&ko(wn)&&Co(wn)&&(N.isShadow=!0),N.type===de.Element&&N.tagName==="iframe"&&VL(e,()=>{let se=e.contentDocument;if(se&&w){let Pe=un(se,{doc:se,mirror:n,blockClass:o,blockSelector:a,needsMask:oe,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:y,dataURLOptions:m,inlineImages:h,recordCanvas:f,preserveWhiteSpace:pe,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:E,stylesheetLoadTimeout:L,keepIframeSrcFn:_});Pe&&w(e,Pe)}},S),N.type===de.Element&&N.tagName==="link"&&typeof N.attributes.rel=="string"&&(N.attributes.rel==="stylesheet"||N.attributes.rel==="preload"&&typeof N.attributes.href=="string"&&db(N.attributes.href)==="css")&&jL(e,()=>{if(E){let se=un(e,{doc:r,mirror:n,blockClass:o,blockSelector:a,needsMask:oe,maskTextClass:i,maskTextSelector:s,skipChild:!1,inlineStylesheet:c,maskInputOptions:d,maskTextFn:u,maskInputFn:p,slimDOMOptions:y,dataURLOptions:m,inlineImages:h,recordCanvas:f,preserveWhiteSpace:pe,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:S,onStylesheetLoad:E,stylesheetLoadTimeout:L,keepIframeSrcFn:_});se&&E(e,se)}},L),N}function HL(e,t){let{mirror:r=new ls,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:a="rr-mask",maskTextSelector:i=null,inlineStylesheet:s=!0,inlineImages:l=!1,recordCanvas:c=!1,maskAllInputs:d=!1,maskTextFn:u,maskInputFn:p,slimDOM:y=!1,dataURLOptions:m,preserveWhiteSpace:h,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:E,keepIframeSrcFn:L=()=>!1}=t||{},_=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}:d===!1?{password:!0}:d,re=mb(y);return un(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:a,maskTextSelector:i,skipChild:!1,inlineStylesheet:s,maskInputOptions:_,maskTextFn:u,maskInputFn:p,slimDOMOptions:re,dataURLOptions:m,inlineImages:l,recordCanvas:c,preserveWhiteSpace:h,onSerialize:f,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:S,stylesheetLoadTimeout:E,keepIframeSrcFn:L,newlyAddedElement:!1})}var KL=/(max|min)-device-(width|height)/,pY=new RegExp(KL.source,"g");function JL(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function GL(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 du={exports:{}},J=String,hb=function(){return{isColorSupported:!1,reset:J,bold:J,dim:J,italic:J,underline:J,inverse:J,hidden:J,strikethrough:J,black:J,red:J,green:J,yellow:J,blue:J,magenta:J,cyan:J,white:J,gray:J,bgBlack:J,bgRed:J,bgGreen:J,bgYellow:J,bgBlue:J,bgMagenta:J,bgCyan:J,bgWhite:J}};du.exports=hb();du.exports.createColors=hb;var YL=du.exports,ZL={},XL=Object.freeze(Object.defineProperty({__proto__:null,default:ZL},Symbol.toStringTag,{value:"Module"})),qe=GL(XL),yS=YL,mS=qe,Rd=class gb extends Error{constructor(t,r,n,o,a,i){super(t),this.name="CssSyntaxError",this.reason=t,a&&(this.file=a),o&&(this.source=o),i&&(this.plugin=i),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,gb)}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=yS.isColorSupported),mS&&t&&(r=mS(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),a=Math.min(this.line+2,n.length),i=String(a).length,s,l;if(t){let{bold:c,gray:d,red:u}=yS.createColors(!0);s=p=>c(u(p)),l=p=>d(p)}else s=l=c=>c;return n.slice(o,a).map((c,d)=>{let u=o+1+d,p=" "+(" "+u).slice(-i)+" | ";if(u===this.line){let y=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+l(p)+c+`
7
+ `+y+s("^")}return" "+l(p)+c}).join(`
8
+ `)}toString(){let t=this.showSourceCode();return t&&(t=`
9
+
10
+ `+t+`
11
+ `),this.name+": "+this.message+t}},uu=Rd;Rd.default=Rd;var $o={};$o.isClean=Symbol("isClean");$o.my=Symbol("my");var hS={after:`
12
+ `,beforeClose:`
13
+ `,beforeComment:`
14
+ `,beforeDecl:`
15
+ `,beforeOpen:" ",beforeRule:`
16
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function QL(e){return e[0].toUpperCase()+e.slice(1)}var vd=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 a=(t.raws.between||"")+(r?";":"");this.builder(n+o+a,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,a=0;for(;o&&o.type!=="root";)a+=1,o=o.parent;if(n.includes(`
17
+ `)){let i=this.raw(t,null,"indent");if(i.length)for(let s=0;s<a;s++)n+=i}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 a=t.nodes[o],i=this.raw(a,"before");i&&this.builder(i),this.stringify(a,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 a=t.parent;if(n==="before"&&(!a||a.type==="root"&&a.first===t||a&&a.type==="document"))return"";if(!a)return hS[n];let i=t.root();if(i.rawCache||(i.rawCache={}),typeof i.rawCache[n]<"u")return i.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let s="raw"+QL(n);this[s]?o=this[s](i,t):i.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=hS[n]),i.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 a=n.raws.before.split(`
22
+ `);return r=a[a.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)}},Sb=vd;vd.default=vd;var e0=Sb;function wd(e,t){new e0(t).stringify(e)}var ks=wd;wd.default=wd;var{isClean:Fi,my:t0}=$o,r0=uu,n0=Sb,o0=ks;function Ed(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],a=typeof o;n==="parent"&&a==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(i=>Ed(i,r)):(a==="object"&&o!==null&&(o=Ed(o)),r[n]=o)}return r}var xd=class{constructor(t={}){this.raws={},this[Fi]=!1,this[t0]=!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=Ed(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 r0(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[Fi]){this[Fi]=!1;let t=this;for(;t=t.parent;)t[Fi]=!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,a=this.source.start.line;for(let i=0;i<t;i++)n[i]===`
23
+ `?(o=1,a+=1):o+=1;return{column:o,line:a}}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(),a=o.indexOf(t.word);a!==-1&&(r=this.positionInside(a,o),n=this.positionInside(a+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 n0().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 a=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i)||i==="parent"||i==="proxyCache")continue;let s=this[i];if(Array.isArray(s))n[i]=s.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof s=="object"&&s.toJSON)n[i]=s.toJSON(null,r);else if(i==="source"){let l=r.get(s.input);l==null&&(l=a,r.set(s.input,a),a++),n[i]={end:s.end,inputId:l,start:s.start}}else n[i]=s}return o&&(n.inputs=[...r.keys()].map(i=>i.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=o0){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let a in n)o[a]=n[a];return t.warn(r,o)}get proxyOf(){return this}},Cs=xd;xd.default=xd;var a0=Cs,kd=class extends a0{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]==="$"}},As=kd;kd.default=kd;var i0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",s0=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},l0=(e=21)=>{let t="",r=e;for(;r--;)t+=i0[Math.random()*64|0];return t},c0={nanoid:l0,customAlphabet:s0},{SourceMapConsumer:gS,SourceMapGenerator:SS}=qe,{existsSync:d0,readFileSync:u0}=qe,{dirname:sd,join:p0}=qe;function f0(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var Cd=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=sd(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new gS(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,/,a=/^data:application\/json,/;if(o.test(t)||a.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return f0(t.substr(RegExp.lastMatch.length));let i=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}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=sd(t),d0(t))return this.mapFile=t,u0(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 gS)return SS.fromSourceMap(r).toString();if(r instanceof SS)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=p0(sd(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)}},bb=Cd;Cd.default=Cd;var{SourceMapConsumer:y0,SourceMapGenerator:m0}=qe,{fileURLToPath:bS,pathToFileURL:Bi}=qe,{isAbsolute:Ad,resolve:Pd}=qe,{nanoid:h0}=c0,ld=qe,RS=uu,g0=bb,cd=Symbol("fromOffsetCache"),S0=!!(y0&&m0),vS=!!(Pd&&Ad),fs=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&&(!vS||/^\w+:\/\//.test(r.from)||Ad(r.from)?this.file=r.from:this.file=Pd(r.from)),vS&&S0){let n=new g0(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 "+h0(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let a,i,s;if(r&&typeof r=="object"){let c=r,d=n;if(typeof c.offset=="number"){let u=this.fromOffset(c.offset);r=u.line,n=u.col}else r=c.line,n=c.column;if(typeof d.offset=="number"){let u=this.fromOffset(d.offset);i=u.line,s=u.col}else i=d.line,s=d.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,i,s);return l?a=new RS(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):a=new RS(t,i===void 0?r:{column:n,line:r},i===void 0?n:{column:s,line:i},this.css,this.file,o.plugin),a.input={column:n,endColumn:s,endLine:i,line:r,source:this.css},this.file&&(Bi&&(a.input.url=Bi(this.file).toString()),a.input.file=this.file),a}fromOffset(t){let r,n;if(this[cd])n=this[cd];else{let a=this.css.split(`
24
+ `);n=new Array(a.length);let i=0;for(let s=0,l=a.length;s<l;s++)n[s]=i,i+=a[s].length+1;this[cd]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let a=n.length-2,i;for(;o<a;)if(i=o+(a-o>>1),t<n[i])a=i-1;else if(t>=n[i+1])o=i+1;else{o=i;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Pd(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let a=this.map.consumer(),i=a.originalPositionFor({column:r,line:t});if(!i.source)return!1;let s;typeof n=="number"&&(s=a.originalPositionFor({column:o,line:n}));let l;Ad(i.source)?l=Bi(i.source):l=new URL(i.source,this.map.consumer().sourceRoot||Bi(this.map.mapFile));let c={column:i.column,endColumn:s&&s.column,endLine:s&&s.line,line:i.line,url:l.toString()};if(l.protocol==="file:")if(bS)c.file=bS(l);else throw new Error("file: protocol is not available in this PostCSS build");let d=a.sourceContentFor(i.source);return d&&(c.source=d),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=fs;fs.default=fs;ld&&ld.registerInput&&ld.registerInput(fs);var{SourceMapConsumer:Rb,SourceMapGenerator:rs}=qe,{dirname:ns,relative:vb,resolve:wb,sep:Eb}=qe,{pathToFileURL:wS}=qe,b0=Ps,R0=!!(Rb&&rs),v0=!!(ns&&wb&&vb&&Eb),w0=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||ns(t.file),o;this.mapOpts.sourcesContent===!1?(o=new Rb(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(),v0&&R0&&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=rs.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new rs({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 rs({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:""},a,i;this.stringify(this.root,(s,l,c)=>{if(this.css+=s,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))),a=s.match(/\n/g),a?(t+=a.length,i=s.lastIndexOf(`
28
+ `),r=s.length-i):r+=s.length,l&&c!=="start"){let d=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==d.last||d.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?ns(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=ns(wb(n,this.mapOpts.annotation)));let o=vb(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 b0(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(wS){let n=wS(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;Eb==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},xb=w0,E0=Cs,Od=class extends E0{constructor(t){super(t),this.type="comment"}},Os=Od;Od.default=Od;var{isClean:kb,my:Cb}=$o,Ab=As,Pb=Os,x0=Cs,Ob,pu,fu,Mb;function Tb(e){return e.map(t=>(t.nodes&&(t.nodes=Tb(t.nodes)),delete t.source,t))}function Ib(e){if(e[kb]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)Ib(t)}var vt=class Lb extends x0{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"?(a,i)=>o(a.toProxy(),i):o)):r==="every"||r==="some"?n=>t[r]((o,...a)=>n(o.toProxy(),...a)):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 i of o)this.proxyOf.nodes.splice(n+1,0,i);let a;for(let i in this.indexes)a=this.indexes[i],n<a&&(this.indexes[i]=a+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,a=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let s of a)this.proxyOf.nodes.splice(n,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<=i&&(this.indexes[s]=i+a.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=Tb(Ob(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 Ab(t)]}else if(t.selector)t=[new pu(t)];else if(t.name)t=[new fu(t)];else if(t.text)t=[new Pb(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[Cb]||Lb.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[kb]&&Ib(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(a){throw r.addToError(a)}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]}};vt.registerParse=e=>{Ob=e};vt.registerRule=e=>{pu=e};vt.registerAtRule=e=>{fu=e};vt.registerRoot=e=>{Mb=e};var br=vt;vt.default=vt;vt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,fu.prototype):e.type==="rule"?Object.setPrototypeOf(e,pu.prototype):e.type==="decl"?Object.setPrototypeOf(e,Ab.prototype):e.type==="comment"?Object.setPrototypeOf(e,Pb.prototype):e.type==="root"&&Object.setPrototypeOf(e,Mb.prototype),e[Cb]=!0,e.nodes&&e.nodes.forEach(t=>{vt.rebuild(t)})};var k0=br,Nb,Fb,Oo=class extends k0{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new Nb(new Fb,this,t).stringify()}};Oo.registerLazyResult=e=>{Nb=e};Oo.registerProcessor=e=>{Fb=e};var yu=Oo;Oo.default=Oo;var ES={},Bb=function(t){ES[t]||(ES[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},Md=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}},Db=Md;Md.default=Md;var C0=Db,Td=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 C0(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},mu=Td;Td.default=Td;var dd=39,xS=34,Di=92,kS=47,$i=10,Ro=32,Vi=12,ji=9,_i=13,A0=91,P0=93,O0=40,M0=41,T0=123,I0=125,L0=59,N0=42,F0=58,B0=64,Wi=/[\t\n\f\r "#'()/;[\\\]{}]/g,Ui=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,D0=/.[\r\n"'(/\\]/,CS=/[\da-f]/i,$0=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,a,i,s,l,c,d,u,p,y,m,h=n.length,f=0,b=[],w=[];function S(){return f}function E(U){throw t.error("Unclosed "+U,f)}function L(){return w.length===0&&f>=h}function _(U){if(w.length)return w.pop();if(f>=h)return;let oe=U?U.ignoreUnclosed:!1;switch(a=n.charCodeAt(f),a){case $i:case Ro:case ji:case _i:case Vi:{i=f;do i+=1,a=n.charCodeAt(i);while(a===Ro||a===$i||a===ji||a===_i||a===Vi);m=["space",n.slice(f,i)],f=i-1;break}case A0:case P0:case T0:case I0:case F0:case L0:case M0:{let pe=String.fromCharCode(a);m=[pe,pe,f];break}case O0:{if(p=b.length?b.pop()[1]:"",y=n.charCodeAt(f+1),p==="url"&&y!==dd&&y!==xS&&y!==Ro&&y!==$i&&y!==ji&&y!==Vi&&y!==_i){i=f;do{if(d=!1,i=n.indexOf(")",i+1),i===-1)if(o||oe){i=f;break}else E("bracket");for(u=i;n.charCodeAt(u-1)===Di;)u-=1,d=!d}while(d);m=["brackets",n.slice(f,i+1),f,i],f=i}else i=n.indexOf(")",f+1),l=n.slice(f,i+1),i===-1||D0.test(l)?m=["(","(",f]:(m=["brackets",l,f,i],f=i);break}case dd:case xS:{s=a===dd?"'":'"',i=f;do{if(d=!1,i=n.indexOf(s,i+1),i===-1)if(o||oe){i=f+1;break}else E("string");for(u=i;n.charCodeAt(u-1)===Di;)u-=1,d=!d}while(d);m=["string",n.slice(f,i+1),f,i],f=i;break}case B0:{Wi.lastIndex=f+1,Wi.test(n),Wi.lastIndex===0?i=n.length-1:i=Wi.lastIndex-2,m=["at-word",n.slice(f,i+1),f,i],f=i;break}case Di:{for(i=f,c=!0;n.charCodeAt(i+1)===Di;)i+=1,c=!c;if(a=n.charCodeAt(i+1),c&&a!==kS&&a!==Ro&&a!==$i&&a!==ji&&a!==_i&&a!==Vi&&(i+=1,CS.test(n.charAt(i)))){for(;CS.test(n.charAt(i+1));)i+=1;n.charCodeAt(i+1)===Ro&&(i+=1)}m=["word",n.slice(f,i+1),f,i],f=i;break}default:{a===kS&&n.charCodeAt(f+1)===N0?(i=n.indexOf("*/",f+2)+1,i===0&&(o||oe?i=n.length:E("comment")),m=["comment",n.slice(f,i+1),f,i],f=i):(Ui.lastIndex=f+1,Ui.test(n),Ui.lastIndex===0?i=n.length-1:i=Ui.lastIndex-2,m=["word",n.slice(f,i+1),f,i],b.push(m),f=i);break}}return f++,m}function re(U){w.push(U)}return{back:re,endOfFile:L,nextToken:_,position:S}},$b=br,ys=class extends $b{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)}},hu=ys;ys.default=ys;$b.registerAtRule(ys);var Vb=br,jb,_b,fn=class extends Vb{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 a of o)a.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 jb(new _b,this,t).stringify()}};fn.registerLazyResult=e=>{jb=e};fn.registerProcessor=e=>{_b=e};var Vo=fn;fn.default=fn;Vb.registerRoot(fn);var Mo={comma(e){return Mo.split(e,[","],!0)},space(e){let t=[" ",`
29
+ `," "];return Mo.split(e,t)},split(e,t,r){let n=[],o="",a=!1,i=0,s=!1,l="",c=!1;for(let d of e)c?c=!1:d==="\\"?c=!0:s?d===l&&(s=!1):d==='"'||d==="'"?(s=!0,l=d):d==="("?i+=1:d===")"?i>0&&(i-=1):i===0&&t.includes(d)&&(a=!0),a?(o!==""&&n.push(o.trim()),o="",a=!1):o+=d;return(r||o!=="")&&n.push(o.trim()),n}},Wb=Mo;Mo.default=Mo;var Ub=br,V0=Wb,ms=class extends Ub{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return V0.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)}},gu=ms;ms.default=ms;Ub.registerRule(ms);var j0=As,_0=$0,W0=Os,U0=hu,q0=Vo,AS=gu,PS={empty:!0,space:!0};function z0(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var H0=class{constructor(t){this.input=t,this.root=new q0,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 U0;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,a,i=!1,s=!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==="{"){s=!0;break}else if(n==="}"){if(l.length>0){for(a=l.length-1,o=l[a];o&&o[0]==="space";)o=l[--a];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()){i=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),i&&(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=""),s&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let a=r-1;a>=0&&(o=t[a],!(o[0]!=="space"&&(n+=1,n===2)));a--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,a;for(let[i,s]of t.entries()){if(n=s,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!a)this.doubleColon(n);else{if(a[0]==="word"&&a[1]==="progid")continue;return i}a=n}return!1}comment(t){let r=new W0;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=_0(this.input)}decl(t,r){let n=new j0;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]||z0(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 a;for(;t.length;)if(a=t.shift(),a[0]===":"){n.raws.between+=a[1];break}else a[0]==="word"&&/\w/.test(a[1])&&this.unknownWord([a]),n.raws.between+=a[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let i=[],s;for(;t.length&&(s=t[0][0],!(s!=="space"&&s!=="comment"));)i.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(a=t[c],a[1].toLowerCase()==="!important"){n.important=!0;let d=this.stringFrom(t,c);d=this.spacesFromEnd(t)+d,d!==" !important"&&(n.raws.important=d);break}else if(a[1].toLowerCase()==="important"){let d=t.slice(0),u="";for(let p=c;p>0;p--){let y=d[p][0];if(u.trim().indexOf("!")===0&&y!=="space")break;u=d.pop()[1]+u}u.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=u,t=d)}if(a[0]!=="space"&&a[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=i.map(c=>c[1]).join(""),i=[]),this.raw(n,"value",i.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 AS;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,a=null,i=[],s=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")a||(a=c),i.push(n==="("?")":"]");else if(s&&o&&n==="{")a||(a=c),i.push("}");else if(i.length===0)if(n===";")if(o){this.decl(l,s);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===i[i.length-1]&&(i.pop(),i.length===0&&(a=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),i.length>0&&this.unclosedBracket(a),r&&o){if(!s)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,s)}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 a,i,s=n.length,l="",c=!0,d,u;for(let p=0;p<s;p+=1)a=n[p],i=a[0],i==="space"&&p===s-1&&!o?c=!1:i==="comment"?(u=n[p-1]?n[p-1][0]:"empty",d=n[p+1]?n[p+1][0]:"empty",!PS[u]&&!PS[d]?l.slice(-1)===","?c=!1:l+=a[1]:c=!1):l+=a[1];if(!c){let p=n.reduce((y,m)=>y+m[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new AS;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})}},K0=H0,J0=br,G0=K0,Y0=Ps;function hs(e,t){let r=new Y0(e,t),n=new G0(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 Su=hs;hs.default=hs;J0.registerParse(hs);var{isClean:st,my:Z0}=$o,X0=xb,Q0=ks,eN=br,tN=yu,rN=Bb,OS=mu,nN=Su,oN=Vo,aN={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},iN={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},sN={Once:!0,postcssPlugin:!0,prepare:!0},yn=0;function vo(e){return typeof e=="object"&&typeof e.then=="function"}function qb(e){let t=!1,r=aN[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,yn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,yn,r+"Exit"]:[r,r+"Exit"]}function MS(e){let t;return e.type==="document"?t=["Document",yn,"DocumentExit"]:e.type==="root"?t=["Root",yn,"RootExit"]:t=qb(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Id(e){return e[st]=!1,e.nodes&&e.nodes.forEach(t=>Id(t)),e}var Ld={},mn=class zb{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=Id(r);else if(r instanceof zb||r instanceof OS)o=Id(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let a=nN;n.syntax&&(a=n.syntax.parse),n.parser&&(a=n.parser),a.parse&&(a=a.parse);try{o=a(r,n)}catch(i){this.processed=!0,this.error=i}o&&!o[Z0]&&eN.rebuild(o)}this.result=new OS(t,o,n),this.helpers={...Ld,postcss:Ld,result:this.result},this.plugins=this.processor.plugins.map(a=>typeof a=="object"&&a.prepare?{...a,...a.prepare(this.result)}:a)}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,a=n.postcssVersion,i=this.result.processor.version,s=a.split("."),l=i.split(".");(s[0]!==l[0]||parseInt(s[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+i+", but "+o+" uses "+a+". 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(!iN[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!sN[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(vo(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[st];){t[st]=!0;let r=[MS(t)];for(;r.length>0;){let n=this.visitTick(r);if(vo(n))try{await n}catch(o){let a=r[r.length-1].node;throw this.handleError(o,a)}}}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(a=>n(a,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 vo(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=Q0;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new X0(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(vo(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[st];)t[st]=!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||rN("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 a;try{a=o(r,this.helpers)}catch(i){throw this.handleError(i,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(vo(a))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[i,s]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=i;try{return s(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let i=r.iterator,s;for(;s=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!s[st]){s[st]=!0,t.push(MS(s));return}r.iterator=0,delete n.indexes[i]}let a=r.events;for(;r.eventIndex<a.length;){let i=a[r.eventIndex];if(r.eventIndex+=1,i===yn){n.nodes&&n.nodes.length&&(n[st]=!0,r.iterator=n.getIterator());return}else if(this.listeners[i]){r.visitors=this.listeners[i];return}}t.pop()}walkSync(t){t[st]=!0;let r=qb(t);for(let n of r)if(n===yn)t.nodes&&t.each(o=>{o[st]||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"}};mn.registerPostcss=e=>{Ld=e};var Hb=mn;mn.default=mn;oN.registerLazyResult(mn);tN.registerLazyResult(mn);var lN=xb,cN=ks,dN=Bb,uN=Su,pN=mu,Nd=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,a=cN;this.result=new pN(this._processor,o,this._opts),this.result.css=r;let i=this;Object.defineProperty(this.result,"root",{get(){return i.root}});let s=new lN(a,o,this._opts,r);if(s.isMap()){let[l,c]=s.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else s.clearAnnotation(),this.result.css=s.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||dN("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=uN;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"}},fN=Nd;Nd.default=Nd;var yN=fN,mN=Hb,hN=yu,gN=Vo,To=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 yN(this,t,r):new mN(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},SN=To;To.default=To;gN.registerProcessor(To);hN.registerProcessor(To);var bN=As,RN=bb,vN=Os,wN=hu,EN=Ps,xN=Vo,kN=gu;function Io(e,t){if(Array.isArray(e))return e.map(o=>Io(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let a={...o,__proto__:EN.prototype};a.map&&(a.map={...a.map,__proto__:RN.prototype}),t.push(a)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Io(o,t))),n.source){let{inputId:o,...a}=n.source;n.source=a,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new xN(n);if(n.type==="decl")return new bN(n);if(n.type==="rule")return new kN(n);if(n.type==="comment")return new vN(n);if(n.type==="atrule")return new wN(n);throw new Error("Unknown node type: "+e.type)}var CN=Io;Io.default=Io;var AN=uu,Kb=As,PN=Hb,ON=br,bu=SN,MN=ks,TN=CN,Jb=yu,IN=Db,Gb=Os,Yb=hu,LN=mu,NN=Ps,FN=Su,BN=Wb,Zb=gu,Xb=Vo,DN=Cs;function V(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new bu(e)}V.plugin=function(t,r){let n=!1;function o(...i){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 s=r(...i);return s.postcssPlugin=t,s.postcssVersion=new bu().version,s}let a;return Object.defineProperty(o,"postcss",{get(){return a||(a=o()),a}}),o.process=function(i,s,l){return V([o(l)]).process(i,s)},o};V.stringify=MN;V.parse=FN;V.fromJSON=TN;V.list=BN;V.comment=e=>new Gb(e);V.atRule=e=>new Yb(e);V.decl=e=>new Kb(e);V.rule=e=>new Zb(e);V.root=e=>new Xb(e);V.document=e=>new Jb(e);V.CssSyntaxError=AN;V.Declaration=Kb;V.Container=ON;V.Processor=bu;V.Document=Jb;V.Comment=Gb;V.Warning=IN;V.AtRule=Yb;V.Result=LN;V.Input=NN;V.Rule=Zb;V.Root=Xb;V.Node=DN;PN.registerPostcss(V);var $N=V;V.default=V;var Z=JL($N);Z.stringify;Z.fromJSON;Z.plugin;Z.parse;Z.list;Z.document;Z.comment;Z.atRule;Z.rule;Z.decl;Z.root;Z.CssSyntaxError;Z.Declaration;Z.Container;Z.Processor;Z.Document;Z.Comment;Z.Warning;Z.AtRule;Z.Result;Z.Input;Z.Rule;Z.Root;Z.Node;var VN=Object.defineProperty,jN=(e,t,r)=>t in e?VN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ie=(e,t,r)=>jN(e,typeof t!="symbol"?t+"":t,r);function _N(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function WN(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 Ru={exports:{}},G=String,Qb=function(){return{isColorSupported:!1,reset:G,bold:G,dim:G,italic:G,underline:G,inverse:G,hidden:G,strikethrough:G,black:G,red:G,green:G,yellow:G,blue:G,magenta:G,cyan:G,white:G,gray:G,bgBlack:G,bgRed:G,bgGreen:G,bgYellow:G,bgBlue:G,bgMagenta:G,bgCyan:G,bgWhite:G}};Ru.exports=Qb();Ru.exports.createColors=Qb;var UN=Ru.exports,qN={},zN=Object.freeze(Object.defineProperty({__proto__:null,default:qN},Symbol.toStringTag,{value:"Module"})),ze=WN(zN),TS=UN,IS=ze,Fd=class eR extends Error{constructor(t,r,n,o,a,i){super(t),this.name="CssSyntaxError",this.reason=t,a&&(this.file=a),o&&(this.source=o),i&&(this.plugin=i),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,eR)}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=TS.isColorSupported),IS&&t&&(r=IS(r));let n=r.split(/\r?\n/),o=Math.max(this.line-3,0),a=Math.min(this.line+2,n.length),i=String(a).length,s,l;if(t){let{bold:c,gray:d,red:u}=TS.createColors(!0);s=p=>c(u(p)),l=p=>d(p)}else s=l=c=>c;return n.slice(o,a).map((c,d)=>{let u=o+1+d,p=" "+(" "+u).slice(-i)+" | ";if(u===this.line){let y=l(p.replace(/\d/g," "))+c.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+l(p)+c+`
35
+ `+y+s("^")}return" "+l(p)+c}).join(`
36
+ `)}toString(){let t=this.showSourceCode();return t&&(t=`
37
+
38
+ `+t+`
39
+ `),this.name+": "+this.message+t}},vu=Fd;Fd.default=Fd;var jo={};jo.isClean=Symbol("isClean");jo.my=Symbol("my");var LS={after:`
40
+ `,beforeClose:`
41
+ `,beforeComment:`
42
+ `,beforeDecl:`
43
+ `,beforeOpen:" ",beforeRule:`
44
+ `,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:" ",semicolon:!1};function HN(e){return e[0].toUpperCase()+e.slice(1)}var Bd=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 a=(t.raws.between||"")+(r?";":"");this.builder(n+o+a,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,a=0;for(;o&&o.type!=="root";)a+=1,o=o.parent;if(n.includes(`
45
+ `)){let i=this.raw(t,null,"indent");if(i.length)for(let s=0;s<a;s++)n+=i}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 a=t.nodes[o],i=this.raw(a,"before");i&&this.builder(i),this.stringify(a,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 a=t.parent;if(n==="before"&&(!a||a.type==="root"&&a.first===t||a&&a.type==="document"))return"";if(!a)return LS[n];let i=t.root();if(i.rawCache||(i.rawCache={}),typeof i.rawCache[n]<"u")return i.rawCache[n];if(n==="before"||n==="after")return this.beforeAfter(t,n);{let s="raw"+HN(n);this[s]?o=this[s](i,t):i.walk(l=>{if(o=l.raws[r],typeof o<"u")return!1})}return typeof o>"u"&&(o=LS[n]),i.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 a=n.raws.before.split(`
50
+ `);return r=a[a.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)}},tR=Bd;Bd.default=Bd;var KN=tR;function Dd(e,t){new KN(t).stringify(e)}var Ms=Dd;Dd.default=Dd;var{isClean:qi,my:JN}=jo,GN=vu,YN=tR,ZN=Ms;function $d(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],a=typeof o;n==="parent"&&a==="object"?t&&(r[n]=t):n==="source"?r[n]=o:Array.isArray(o)?r[n]=o.map(i=>$d(i,r)):(a==="object"&&o!==null&&(o=$d(o)),r[n]=o)}return r}var Vd=class{constructor(t={}){this.raws={},this[qi]=!1,this[JN]=!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=$d(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 GN(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[qi]){this[qi]=!1;let t=this;for(;t=t.parent;)t[qi]=!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,a=this.source.start.line;for(let i=0;i<t;i++)n[i]===`
51
+ `?(o=1,a+=1):o+=1;return{column:o,line:a}}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(),a=o.indexOf(t.word);a!==-1&&(r=this.positionInside(a,o),n=this.positionInside(a+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 YN().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 a=0;for(let i in this){if(!Object.prototype.hasOwnProperty.call(this,i)||i==="parent"||i==="proxyCache")continue;let s=this[i];if(Array.isArray(s))n[i]=s.map(l=>typeof l=="object"&&l.toJSON?l.toJSON(null,r):l);else if(typeof s=="object"&&s.toJSON)n[i]=s.toJSON(null,r);else if(i==="source"){let l=r.get(s.input);l==null&&(l=a,r.set(s.input,a),a++),n[i]={end:s.end,inputId:l,start:s.start}}else n[i]=s}return o&&(n.inputs=[...r.keys()].map(i=>i.toJSON())),n}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=ZN){t.stringify&&(t=t.stringify);let r="";return t(this,n=>{r+=n}),r}warn(t,r,n){let o={node:this};for(let a in n)o[a]=n[a];return t.warn(r,o)}get proxyOf(){return this}},Ts=Vd;Vd.default=Vd;var XN=Ts,jd=class extends XN{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]==="$"}},Is=jd;jd.default=jd;var QN="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",eF=(e,t=21)=>(r=t)=>{let n="",o=r;for(;o--;)n+=e[Math.random()*e.length|0];return n},tF=(e=21)=>{let t="",r=e;for(;r--;)t+=QN[Math.random()*64|0];return t},rF={nanoid:tF,customAlphabet:eF},{SourceMapConsumer:NS,SourceMapGenerator:FS}=ze,{existsSync:nF,readFileSync:oF}=ze,{dirname:ud,join:aF}=ze;function iF(e){return Buffer?Buffer.from(e,"base64").toString():window.atob(e)}var _d=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=ud(this.mapFile)),o&&(this.text=o)}consumer(){return this.consumerCache||(this.consumerCache=new NS(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,/,a=/^data:application\/json,/;if(o.test(t)||a.test(t))return decodeURIComponent(t.substr(RegExp.lastMatch.length));if(r.test(t)||n.test(t))return iF(t.substr(RegExp.lastMatch.length));let i=t.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+i)}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=ud(t),nF(t))return this.mapFile=t,oF(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 NS)return FS.fromSourceMap(r).toString();if(r instanceof FS)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=aF(ud(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)}},rR=_d;_d.default=_d;var{SourceMapConsumer:sF,SourceMapGenerator:lF}=ze,{fileURLToPath:BS,pathToFileURL:zi}=ze,{isAbsolute:Wd,resolve:Ud}=ze,{nanoid:cF}=rF,pd=ze,DS=vu,dF=rR,fd=Symbol("fromOffsetCache"),uF=!!(sF&&lF),$S=!!(Ud&&Wd),gs=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&&(!$S||/^\w+:\/\//.test(r.from)||Wd(r.from)?this.file=r.from:this.file=Ud(r.from)),$S&&uF){let n=new dF(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 "+cF(6)+">"),this.map&&(this.map.file=this.from)}error(t,r,n,o={}){let a,i,s;if(r&&typeof r=="object"){let c=r,d=n;if(typeof c.offset=="number"){let u=this.fromOffset(c.offset);r=u.line,n=u.col}else r=c.line,n=c.column;if(typeof d.offset=="number"){let u=this.fromOffset(d.offset);i=u.line,s=u.col}else i=d.line,s=d.column}else if(!n){let c=this.fromOffset(r);r=c.line,n=c.col}let l=this.origin(r,n,i,s);return l?a=new DS(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):a=new DS(t,i===void 0?r:{column:n,line:r},i===void 0?n:{column:s,line:i},this.css,this.file,o.plugin),a.input={column:n,endColumn:s,endLine:i,line:r,source:this.css},this.file&&(zi&&(a.input.url=zi(this.file).toString()),a.input.file=this.file),a}fromOffset(t){let r,n;if(this[fd])n=this[fd];else{let a=this.css.split(`
52
+ `);n=new Array(a.length);let i=0;for(let s=0,l=a.length;s<l;s++)n[s]=i,i+=a[s].length+1;this[fd]=n}r=n[n.length-1];let o=0;if(t>=r)o=n.length-1;else{let a=n.length-2,i;for(;o<a;)if(i=o+(a-o>>1),t<n[i])a=i-1;else if(t>=n[i+1])o=i+1;else{o=i;break}}return{col:t-n[o]+1,line:o+1}}mapResolve(t){return/^\w+:\/\//.test(t)?t:Ud(this.map.consumer().sourceRoot||this.map.root||".",t)}origin(t,r,n,o){if(!this.map)return!1;let a=this.map.consumer(),i=a.originalPositionFor({column:r,line:t});if(!i.source)return!1;let s;typeof n=="number"&&(s=a.originalPositionFor({column:o,line:n}));let l;Wd(i.source)?l=zi(i.source):l=new URL(i.source,this.map.consumer().sourceRoot||zi(this.map.mapFile));let c={column:i.column,endColumn:s&&s.column,endLine:s&&s.line,line:i.line,url:l.toString()};if(l.protocol==="file:")if(BS)c.file=BS(l);else throw new Error("file: protocol is not available in this PostCSS build");let d=a.sourceContentFor(i.source);return d&&(c.source=d),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}},Ls=gs;gs.default=gs;pd&&pd.registerInput&&pd.registerInput(gs);var{SourceMapConsumer:nR,SourceMapGenerator:os}=ze,{dirname:as,relative:oR,resolve:aR,sep:iR}=ze,{pathToFileURL:VS}=ze,pF=Ls,fF=!!(nR&&os),yF=!!(as&&aR&&oR&&iR),mF=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||as(t.file),o;this.mapOpts.sourcesContent===!1?(o=new nR(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(),yF&&fF&&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=os.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new os({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 os({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:""},a,i;this.stringify(this.root,(s,l,c)=>{if(this.css+=s,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))),a=s.match(/\n/g),a?(t+=a.length,i=s.lastIndexOf(`
56
+ `),r=s.length-i):r+=s.length,l&&c!=="start"){let d=l.parent||{raws:{}};(!(l.type==="decl"||l.type==="atrule"&&!l.nodes)||l!==d.last||d.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?as(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(n=as(aR(n,this.mapOpts.annotation)));let o=oR(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 pF(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(VS){let n=VS(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;iR==="\\"&&(t=t.replace(/\\/g,"/"));let n=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,n),n}},sR=mF,hF=Ts,qd=class extends hF{constructor(t){super(t),this.type="comment"}},Ns=qd;qd.default=qd;var{isClean:lR,my:cR}=jo,dR=Is,uR=Ns,gF=Ts,pR,wu,Eu,fR;function yR(e){return e.map(t=>(t.nodes&&(t.nodes=yR(t.nodes)),delete t.source,t))}function mR(e){if(e[lR]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)mR(t)}var wt=class hR extends gF{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"?(a,i)=>o(a.toProxy(),i):o)):r==="every"||r==="some"?n=>t[r]((o,...a)=>n(o.toProxy(),...a)):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 i of o)this.proxyOf.nodes.splice(n+1,0,i);let a;for(let i in this.indexes)a=this.indexes[i],n<a&&(this.indexes[i]=a+o.length);return this.markDirty(),this}insertBefore(t,r){let n=this.index(t),o=n===0?"prepend":!1,a=this.normalize(r,this.proxyOf.nodes[n],o).reverse();n=this.index(t);for(let s of a)this.proxyOf.nodes.splice(n,0,s);let i;for(let s in this.indexes)i=this.indexes[s],n<=i&&(this.indexes[s]=i+a.length);return this.markDirty(),this}normalize(t,r){if(typeof t=="string")t=yR(pR(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 dR(t)]}else if(t.selector)t=[new wu(t)];else if(t.name)t=[new Eu(t)];else if(t.text)t=[new uR(t)];else throw new Error("Unknown node type in node creation");return t.map(o=>(o[cR]||hR.rebuild(o),o=o.proxyOf,o.parent&&o.parent.removeChild(o),o[lR]&&mR(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(a){throw r.addToError(a)}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]}};wt.registerParse=e=>{pR=e};wt.registerRule=e=>{wu=e};wt.registerAtRule=e=>{Eu=e};wt.registerRoot=e=>{fR=e};var Rr=wt;wt.default=wt;wt.rebuild=e=>{e.type==="atrule"?Object.setPrototypeOf(e,Eu.prototype):e.type==="rule"?Object.setPrototypeOf(e,wu.prototype):e.type==="decl"?Object.setPrototypeOf(e,dR.prototype):e.type==="comment"?Object.setPrototypeOf(e,uR.prototype):e.type==="root"&&Object.setPrototypeOf(e,fR.prototype),e[cR]=!0,e.nodes&&e.nodes.forEach(t=>{wt.rebuild(t)})};var SF=Rr,gR,SR,Lo=class extends SF{constructor(t){super({type:"document",...t}),this.nodes||(this.nodes=[])}toResult(t={}){return new gR(new SR,this,t).stringify()}};Lo.registerLazyResult=e=>{gR=e};Lo.registerProcessor=e=>{SR=e};var xu=Lo;Lo.default=Lo;var jS={},bR=function(t){jS[t]||(jS[t]=!0,typeof console<"u"&&console.warn&&console.warn(t))},zd=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}},RR=zd;zd.default=zd;var bF=RR,Hd=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 bF(t,r);return this.messages.push(n),n}warnings(){return this.messages.filter(t=>t.type==="warning")}get content(){return this.css}},ku=Hd;Hd.default=Hd;var yd=39,_S=34,Hi=92,WS=47,Ki=10,wo=32,Ji=12,Gi=9,Yi=13,RF=91,vF=93,wF=40,EF=41,xF=123,kF=125,CF=59,AF=42,PF=58,OF=64,Zi=/[\t\n\f\r "#'()/;[\\\]{}]/g,Xi=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,MF=/.[\r\n"'(/\\]/,US=/[\da-f]/i,TF=function(t,r={}){let n=t.css.valueOf(),o=r.ignoreErrors,a,i,s,l,c,d,u,p,y,m,h=n.length,f=0,b=[],w=[];function S(){return f}function E(U){throw t.error("Unclosed "+U,f)}function L(){return w.length===0&&f>=h}function _(U){if(w.length)return w.pop();if(f>=h)return;let oe=U?U.ignoreUnclosed:!1;switch(a=n.charCodeAt(f),a){case Ki:case wo:case Gi:case Yi:case Ji:{i=f;do i+=1,a=n.charCodeAt(i);while(a===wo||a===Ki||a===Gi||a===Yi||a===Ji);m=["space",n.slice(f,i)],f=i-1;break}case RF:case vF:case xF:case kF:case PF:case CF:case EF:{let pe=String.fromCharCode(a);m=[pe,pe,f];break}case wF:{if(p=b.length?b.pop()[1]:"",y=n.charCodeAt(f+1),p==="url"&&y!==yd&&y!==_S&&y!==wo&&y!==Ki&&y!==Gi&&y!==Ji&&y!==Yi){i=f;do{if(d=!1,i=n.indexOf(")",i+1),i===-1)if(o||oe){i=f;break}else E("bracket");for(u=i;n.charCodeAt(u-1)===Hi;)u-=1,d=!d}while(d);m=["brackets",n.slice(f,i+1),f,i],f=i}else i=n.indexOf(")",f+1),l=n.slice(f,i+1),i===-1||MF.test(l)?m=["(","(",f]:(m=["brackets",l,f,i],f=i);break}case yd:case _S:{s=a===yd?"'":'"',i=f;do{if(d=!1,i=n.indexOf(s,i+1),i===-1)if(o||oe){i=f+1;break}else E("string");for(u=i;n.charCodeAt(u-1)===Hi;)u-=1,d=!d}while(d);m=["string",n.slice(f,i+1),f,i],f=i;break}case OF:{Zi.lastIndex=f+1,Zi.test(n),Zi.lastIndex===0?i=n.length-1:i=Zi.lastIndex-2,m=["at-word",n.slice(f,i+1),f,i],f=i;break}case Hi:{for(i=f,c=!0;n.charCodeAt(i+1)===Hi;)i+=1,c=!c;if(a=n.charCodeAt(i+1),c&&a!==WS&&a!==wo&&a!==Ki&&a!==Gi&&a!==Yi&&a!==Ji&&(i+=1,US.test(n.charAt(i)))){for(;US.test(n.charAt(i+1));)i+=1;n.charCodeAt(i+1)===wo&&(i+=1)}m=["word",n.slice(f,i+1),f,i],f=i;break}default:{a===WS&&n.charCodeAt(f+1)===AF?(i=n.indexOf("*/",f+2)+1,i===0&&(o||oe?i=n.length:E("comment")),m=["comment",n.slice(f,i+1),f,i],f=i):(Xi.lastIndex=f+1,Xi.test(n),Xi.lastIndex===0?i=n.length-1:i=Xi.lastIndex-2,m=["word",n.slice(f,i+1),f,i],b.push(m),f=i);break}}return f++,m}function re(U){w.push(U)}return{back:re,endOfFile:L,nextToken:_,position:S}},vR=Rr,Ss=class extends vR{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)}},Cu=Ss;Ss.default=Ss;vR.registerAtRule(Ss);var wR=Rr,ER,xR,hn=class extends wR{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 a of o)a.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 ER(new xR,this,t).stringify()}};hn.registerLazyResult=e=>{ER=e};hn.registerProcessor=e=>{xR=e};var _o=hn;hn.default=hn;wR.registerRoot(hn);var No={comma(e){return No.split(e,[","],!0)},space(e){let t=[" ",`
57
+ `," "];return No.split(e,t)},split(e,t,r){let n=[],o="",a=!1,i=0,s=!1,l="",c=!1;for(let d of e)c?c=!1:d==="\\"?c=!0:s?d===l&&(s=!1):d==='"'||d==="'"?(s=!0,l=d):d==="("?i+=1:d===")"?i>0&&(i-=1):i===0&&t.includes(d)&&(a=!0),a?(o!==""&&n.push(o.trim()),o="",a=!1):o+=d;return(r||o!=="")&&n.push(o.trim()),n}},kR=No;No.default=No;var CR=Rr,IF=kR,bs=class extends CR{constructor(t){super(t),this.type="rule",this.nodes||(this.nodes=[])}get selectors(){return IF.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)}},Au=bs;bs.default=bs;CR.registerRule(bs);var LF=Is,NF=TF,FF=Ns,BF=Cu,DF=_o,qS=Au,zS={empty:!0,space:!0};function $F(e){for(let t=e.length-1;t>=0;t--){let r=e[t],n=r[3]||r[2];if(n)return n}}var VF=class{constructor(t){this.input=t,this.root=new DF,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 BF;r.name=t[1].slice(1),r.name===""&&this.unnamedAtrule(r,t),this.init(r,t[2]);let n,o,a,i=!1,s=!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==="{"){s=!0;break}else if(n==="}"){if(l.length>0){for(a=l.length-1,o=l[a];o&&o[0]==="space";)o=l[--a];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()){i=!0;break}}r.raws.between=this.spacesAndCommentsFromEnd(l),l.length?(r.raws.afterName=this.spacesAndCommentsFromStart(l),this.raw(r,"params",l),i&&(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=""),s&&(r.nodes=[],this.current=r)}checkMissedSemicolon(t){let r=this.colon(t);if(r===!1)return;let n=0,o;for(let a=r-1;a>=0&&(o=t[a],!(o[0]!=="space"&&(n+=1,n===2)));a--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}colon(t){let r=0,n,o,a;for(let[i,s]of t.entries()){if(n=s,o=n[0],o==="("&&(r+=1),o===")"&&(r-=1),r===0&&o===":")if(!a)this.doubleColon(n);else{if(a[0]==="word"&&a[1]==="progid")continue;return i}a=n}return!1}comment(t){let r=new FF;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=NF(this.input)}decl(t,r){let n=new LF;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]||$F(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 a;for(;t.length;)if(a=t.shift(),a[0]===":"){n.raws.between+=a[1];break}else a[0]==="word"&&/\w/.test(a[1])&&this.unknownWord([a]),n.raws.between+=a[1];(n.prop[0]==="_"||n.prop[0]==="*")&&(n.raws.before+=n.prop[0],n.prop=n.prop.slice(1));let i=[],s;for(;t.length&&(s=t[0][0],!(s!=="space"&&s!=="comment"));)i.push(t.shift());this.precheckMissedSemicolon(t);for(let c=t.length-1;c>=0;c--){if(a=t[c],a[1].toLowerCase()==="!important"){n.important=!0;let d=this.stringFrom(t,c);d=this.spacesFromEnd(t)+d,d!==" !important"&&(n.raws.important=d);break}else if(a[1].toLowerCase()==="important"){let d=t.slice(0),u="";for(let p=c;p>0;p--){let y=d[p][0];if(u.trim().indexOf("!")===0&&y!=="space")break;u=d.pop()[1]+u}u.trim().indexOf("!")===0&&(n.important=!0,n.raws.important=u,t=d)}if(a[0]!=="space"&&a[0]!=="comment")break}t.some(c=>c[0]!=="space"&&c[0]!=="comment")&&(n.raws.between+=i.map(c=>c[1]).join(""),i=[]),this.raw(n,"value",i.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 qS;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,a=null,i=[],s=t[1].startsWith("--"),l=[],c=t;for(;c;){if(n=c[0],l.push(c),n==="("||n==="[")a||(a=c),i.push(n==="("?")":"]");else if(s&&o&&n==="{")a||(a=c),i.push("}");else if(i.length===0)if(n===";")if(o){this.decl(l,s);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===i[i.length-1]&&(i.pop(),i.length===0&&(a=null));c=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(r=!0),i.length>0&&this.unclosedBracket(a),r&&o){if(!s)for(;l.length&&(c=l[l.length-1][0],!(c!=="space"&&c!=="comment"));)this.tokenizer.back(l.pop());this.decl(l,s)}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 a,i,s=n.length,l="",c=!0,d,u;for(let p=0;p<s;p+=1)a=n[p],i=a[0],i==="space"&&p===s-1&&!o?c=!1:i==="comment"?(u=n[p-1]?n[p-1][0]:"empty",d=n[p+1]?n[p+1][0]:"empty",!zS[u]&&!zS[d]?l.slice(-1)===","?c=!1:l+=a[1]:c=!1):l+=a[1];if(!c){let p=n.reduce((y,m)=>y+m[1],"");t.raws[r]={raw:p,value:l}}t[r]=l}rule(t){t.pop();let r=new qS;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})}},jF=VF,_F=Rr,WF=jF,UF=Ls;function Rs(e,t){let r=new UF(e,t),n=new WF(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 Pu=Rs;Rs.default=Rs;_F.registerParse(Rs);var{isClean:lt,my:qF}=jo,zF=sR,HF=Ms,KF=Rr,JF=xu,GF=bR,HS=ku,YF=Pu,ZF=_o,XF={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},QF={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},eB={Once:!0,postcssPlugin:!0,prepare:!0},gn=0;function Eo(e){return typeof e=="object"&&typeof e.then=="function"}function AR(e){let t=!1,r=XF[e.type];return e.type==="decl"?t=e.prop.toLowerCase():e.type==="atrule"&&(t=e.name.toLowerCase()),t&&e.append?[r,r+"-"+t,gn,r+"Exit",r+"Exit-"+t]:t?[r,r+"-"+t,r+"Exit",r+"Exit-"+t]:e.append?[r,gn,r+"Exit"]:[r,r+"Exit"]}function KS(e){let t;return e.type==="document"?t=["Document",gn,"DocumentExit"]:e.type==="root"?t=["Root",gn,"RootExit"]:t=AR(e),{eventIndex:0,events:t,iterator:0,node:e,visitorIndex:0,visitors:[]}}function Kd(e){return e[lt]=!1,e.nodes&&e.nodes.forEach(t=>Kd(t)),e}var Jd={},Sn=class PR{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=Kd(r);else if(r instanceof PR||r instanceof HS)o=Kd(r.root),r.map&&(typeof n.map>"u"&&(n.map={}),n.map.inline||(n.map.inline=!1),n.map.prev=r.map);else{let a=YF;n.syntax&&(a=n.syntax.parse),n.parser&&(a=n.parser),a.parse&&(a=a.parse);try{o=a(r,n)}catch(i){this.processed=!0,this.error=i}o&&!o[qF]&&KF.rebuild(o)}this.result=new HS(t,o,n),this.helpers={...Jd,postcss:Jd,result:this.result},this.plugins=this.processor.plugins.map(a=>typeof a=="object"&&a.prepare?{...a,...a.prepare(this.result)}:a)}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,a=n.postcssVersion,i=this.result.processor.version,s=a.split("."),l=i.split(".");(s[0]!==l[0]||parseInt(s[1])>parseInt(l[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+i+", but "+o+" uses "+a+". 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(!QF[n]&&/^[A-Z]/.test(n))throw new Error(`Unknown event ${n} in ${r.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!eB[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(Eo(n))try{await n}catch(o){throw this.handleError(o)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[lt];){t[lt]=!0;let r=[KS(t)];for(;r.length>0;){let n=this.visitTick(r);if(Eo(n))try{await n}catch(o){let a=r[r.length-1].node;throw this.handleError(o,a)}}}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(a=>n(a,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 Eo(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=HF;t.syntax&&(r=t.syntax.stringify),t.stringifier&&(r=t.stringifier),r.stringify&&(r=r.stringify);let o=new zF(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(Eo(r))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[lt];)t[lt]=!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||GF("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 a;try{a=o(r,this.helpers)}catch(i){throw this.handleError(i,r.proxyOf)}if(r.type!=="root"&&r.type!=="document"&&!r.parent)return!0;if(Eo(a))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[i,s]=o[r.visitorIndex];r.visitorIndex+=1,r.visitorIndex===o.length&&(r.visitors=[],r.visitorIndex=0),this.result.lastPlugin=i;try{return s(n.toProxy(),this.helpers)}catch(l){throw this.handleError(l,n)}}if(r.iterator!==0){let i=r.iterator,s;for(;s=n.nodes[n.indexes[i]];)if(n.indexes[i]+=1,!s[lt]){s[lt]=!0,t.push(KS(s));return}r.iterator=0,delete n.indexes[i]}let a=r.events;for(;r.eventIndex<a.length;){let i=a[r.eventIndex];if(r.eventIndex+=1,i===gn){n.nodes&&n.nodes.length&&(n[lt]=!0,r.iterator=n.getIterator());return}else if(this.listeners[i]){r.visitors=this.listeners[i];return}}t.pop()}walkSync(t){t[lt]=!0;let r=AR(t);for(let n of r)if(n===gn)t.nodes&&t.each(o=>{o[lt]||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"}};Sn.registerPostcss=e=>{Jd=e};var OR=Sn;Sn.default=Sn;ZF.registerLazyResult(Sn);JF.registerLazyResult(Sn);var tB=sR,rB=Ms,nB=bR,oB=Pu,aB=ku,Gd=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,a=rB;this.result=new aB(this._processor,o,this._opts),this.result.css=r;let i=this;Object.defineProperty(this.result,"root",{get(){return i.root}});let s=new tB(a,o,this._opts,r);if(s.isMap()){let[l,c]=s.generate();l&&(this.result.css=l),c&&(this.result.map=c)}else s.clearAnnotation(),this.result.css=s.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||nB("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=oB;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"}},iB=Gd;Gd.default=Gd;var sB=iB,lB=OR,cB=xu,dB=_o,Fo=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 sB(this,t,r):new lB(this,t,r)}use(t){return this.plugins=this.plugins.concat(this.normalize([t])),this}},uB=Fo;Fo.default=Fo;dB.registerProcessor(Fo);cB.registerProcessor(Fo);var pB=Is,fB=rR,yB=Ns,mB=Cu,hB=Ls,gB=_o,SB=Au;function Bo(e,t){if(Array.isArray(e))return e.map(o=>Bo(o));let{inputs:r,...n}=e;if(r){t=[];for(let o of r){let a={...o,__proto__:hB.prototype};a.map&&(a.map={...a.map,__proto__:fB.prototype}),t.push(a)}}if(n.nodes&&(n.nodes=e.nodes.map(o=>Bo(o,t))),n.source){let{inputId:o,...a}=n.source;n.source=a,o!=null&&(n.source.input=t[o])}if(n.type==="root")return new gB(n);if(n.type==="decl")return new pB(n);if(n.type==="rule")return new SB(n);if(n.type==="comment")return new yB(n);if(n.type==="atrule")return new mB(n);throw new Error("Unknown node type: "+e.type)}var bB=Bo;Bo.default=Bo;var RB=vu,MR=Is,vB=OR,wB=Rr,Ou=uB,EB=Ms,xB=bB,TR=xu,kB=RR,IR=Ns,LR=Cu,CB=ku,AB=Ls,PB=Pu,OB=kR,NR=Au,FR=_o,MB=Ts;function j(...e){return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new Ou(e)}j.plugin=function(t,r){let n=!1;function o(...i){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 s=r(...i);return s.postcssPlugin=t,s.postcssVersion=new Ou().version,s}let a;return Object.defineProperty(o,"postcss",{get(){return a||(a=o()),a}}),o.process=function(i,s,l){return j([o(l)]).process(i,s)},o};j.stringify=EB;j.parse=PB;j.fromJSON=xB;j.list=OB;j.comment=e=>new IR(e);j.atRule=e=>new LR(e);j.decl=e=>new MR(e);j.rule=e=>new NR(e);j.root=e=>new FR(e);j.document=e=>new TR(e);j.CssSyntaxError=RB;j.Declaration=MR;j.Container=wB;j.Processor=Ou;j.Document=TR;j.Comment=IR;j.Warning=kB;j.AtRule=LR;j.Result=CB;j.Input=AB;j.Rule=NR;j.Root=FR;j.Node=MB;vB.registerPostcss(j);var TB=j;j.default=j;var X=_N(TB);X.stringify;X.fromJSON;X.plugin;X.parse;X.list;X.document;X.comment;X.atRule;X.rule;X.decl;X.root;X.CssSyntaxError;X.Declaration;X.Container;X.Processor;X.Document;X.Comment;X.Warning;X.AtRule;X.Result;X.Input;X.Rule;X.Root;X.Node;var Yd=class e{constructor(...t){Ie(this,"parentElement",null),Ie(this,"parentNode",null),Ie(this,"ownerDocument"),Ie(this,"firstChild",null),Ie(this,"lastChild",null),Ie(this,"previousSibling",null),Ie(this,"nextSibling",null),Ie(this,"ELEMENT_NODE",1),Ie(this,"TEXT_NODE",3),Ie(this,"nodeType"),Ie(this,"nodeName"),Ie(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 JS={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},GS={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Qi={},IB=()=>!!globalThis.Zone;function Mu(e){if(Qi[e])return Qi[e];let t=globalThis[e],r=t.prototype,n=e in JS?JS[e]:void 0,o=!!(n&&n.every(s=>{var l,c;return!!((c=(l=Object.getOwnPropertyDescriptor(r,s))==null?void 0:l.get)!=null&&c.toString().includes("[native code]"))})),a=e in GS?GS[e]:void 0,i=!!(a&&a.every(s=>{var l;return typeof r[s]=="function"&&((l=r[s])==null?void 0:l.toString().includes("[native code]"))}));if(o&&i&&!IB())return Qi[e]=t.prototype,t.prototype;try{let s=document.createElement("iframe");document.body.appendChild(s);let l=s.contentWindow;if(!l)return t.prototype;let c=l[e].prototype;return document.body.removeChild(s),c?Qi[e]=c:r}catch{return r}}var md={};function xt(e,t,r){var n;let o=`${e}.${String(r)}`;if(md[o])return md[o].call(t);let a=Mu(e),i=(n=Object.getOwnPropertyDescriptor(a,r))==null?void 0:n.get;return i?(md[o]=i,i.call(t)):t[r]}var hd={};function BR(e,t,r){let n=`${e}.${String(r)}`;if(hd[n])return hd[n].bind(t);let a=Mu(e)[r];return typeof a!="function"?t[r]:(hd[n]=a,a.bind(t))}function LB(e){return xt("Node",e,"ownerDocument")}function NB(e){return xt("Node",e,"childNodes")}function FB(e){return xt("Node",e,"parentNode")}function BB(e){return xt("Node",e,"parentElement")}function DB(e){return xt("Node",e,"textContent")}function $B(e,t){return BR("Node",e,"contains")(t)}function VB(e){return BR("Node",e,"getRootNode")()}function jB(e){return!e||!("host"in e)?null:xt("ShadowRoot",e,"host")}function _B(e){return e.styleSheets}function WB(e){return!e||!("shadowRoot"in e)?null:xt("Element",e,"shadowRoot")}function UB(e,t){return xt("Element",e,"querySelector")(t)}function qB(e,t){return xt("Element",e,"querySelectorAll")(t)}function DR(){return Mu("MutationObserver").constructor}function vr(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:LB,childNodes:NB,parentNode:FB,parentElement:BB,textContent:DB,contains:$B,getRootNode:VB,host:jB,styleSheets:_B,shadowRoot:WB,querySelector:UB,querySelectorAll:qB,mutationObserver:DR,patch:vr};function Re(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var ln=`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.`,YS={map:{},getId(){return console.error(ln),-1},getNode(){return console.error(ln),null},removeNodeFromMap(){console.error(ln)},has(){return console.error(ln),!1},reset(){console.error(ln)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(YS=new Proxy(YS,{get(e,t,r){return t==="map"&&console.error(ln),Reflect.get(e,t,r)}}));function Do(e,t,r={}){let n=null,o=0;return function(...a){let i=Date.now();!o&&r.leading===!1&&(o=i);let s=t-(i-o),l=this;s<=0||s>t?(n&&(clearTimeout(n),n=null),o=i,e.apply(l,a)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(l,a)},s))}}function Fs(e,t,r,n,o=window){let a=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(i){setTimeout(()=>{r.set.call(this,i)},0),a&&a.set&&a.set.call(this,i)}}),()=>Fs(e,t,a||{},!0)}var vs=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(vs=()=>new Date().getTime());function $R(e){var t,r,n,o;let a=e.document;return{left:a.scrollingElement?a.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:a.documentElement.scrollLeft||a?.body&&((t=C.parentElement(a.body))==null?void 0:t.scrollLeft)||((r=a?.body)==null?void 0:r.scrollLeft)||0,top:a.scrollingElement?a.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:a?.documentElement.scrollTop||a?.body&&((n=C.parentElement(a.body))==null?void 0:n.scrollTop)||((o=a?.body)==null?void 0:o.scrollTop)||0}}function VR(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function jR(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _R(e){return e?e.nodeType===e.ELEMENT_NODE?e:C.parentElement(e):null}function ve(e,t,r,n){if(!e)return!1;let o=_R(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(ps(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function zB(e,t){return t.getId(e)!==-1}function gd(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===Po}function WR(e,t){if(ko(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?WR(n,t):!0}function Zd(e){return!!e.changedTouches}function HB(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 UR(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function qR(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Xd(e){return e?e instanceof Yd&&"shadowRoot"in e?!!e.shadowRoot:!!C.shadowRoot(e):!1}var Qd=class{constructor(){R(this,"id",1),R(this,"styleIDMap",new WeakMap),R(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 zR(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 KB(e){let t=e,r;for(;r=zR(t);)t=r;return t}function JB(e){let t=C.ownerDocument(e);if(!t)return!1;let r=KB(e);return C.contains(t,r)}function HR(e){let t=C.ownerDocument(e);return t?C.contains(t,e)||JB(e):!1}var T=(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))(T||{}),P=(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))(P||{}),xe=(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))(xe||{}),Rt=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Rt||{}),bn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(bn||{}),cn=(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))(cn||{});var KR=(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))(KR||{});function ZS(e){return"__ln"in e}var eu=class{constructor(){R(this,"length",0),R(this,"head",null),R(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&&ZS(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&&ZS(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--)}},XS=(e,t)=>`${e}@${t}`,tu=class{constructor(){R(this,"frozen",!1),R(this,"locked",!1),R(this,"texts",[]),R(this,"attributes",[]),R(this,"attributeMap",new WeakMap),R(this,"removes",[]),R(this,"mapRemoves",[]),R(this,"movedMap",{}),R(this,"addedSet",new Set),R(this,"movedSet",new Set),R(this,"droppedSet",new Set),R(this,"removesSubTreeCache",new Set),R(this,"mutationCb"),R(this,"blockClass"),R(this,"blockSelector"),R(this,"maskTextClass"),R(this,"maskTextSelector"),R(this,"inlineStylesheet"),R(this,"maskInputOptions"),R(this,"maskTextFn"),R(this,"maskInputFn"),R(this,"keepIframeSrcFn"),R(this,"recordCanvas"),R(this,"inlineImages"),R(this,"slimDOMOptions"),R(this,"dataURLOptions"),R(this,"doc"),R(this,"mirror"),R(this,"iframeManager"),R(this,"stylesheetManager"),R(this,"shadowDomManager"),R(this,"canvasManager"),R(this,"processedNodeManager"),R(this,"unattachedDoc"),R(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),R(this,"emit",()=>{if(this.frozen||this.locked)return;let t=[],r=new Set,n=new eu,o=l=>{let c=l,d=Po;for(;d===Po;)c=c&&c.nextSibling,d=c&&this.mirror.getId(c);return d},a=l=>{let c=C.parentNode(l);if(!c||!HR(l))return;let d=!1;if(l.nodeType===Node.TEXT_NODE){let m=c.tagName;if(m==="TEXTAREA")return;m==="STYLE"&&this.addedSet.has(c)&&(d=!0)}let u=ko(c)?this.mirror.getId(zR(l)):this.mirror.getId(c),p=o(l);if(u===-1||p===-1)return n.addNode(l);let y=un(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:m=>{UR(m,this.mirror)&&this.iframeManager.addIframe(m),qR(m,this.mirror)&&this.stylesheetManager.trackLinkElement(m),Xd(l)&&this.shadowDomManager.addShadowRoot(C.shadowRoot(l),this.doc)},onIframeLoad:(m,h)=>{this.iframeManager.attachIframe(m,h),this.shadowDomManager.observeAttachShadow(m)},onStylesheetLoad:(m,h)=>{this.stylesheetManager.attachLinkElement(m,h)},cssCaptured:d});y&&(t.push({parentId:u,nextId:p,node:y}),r.add(y.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let l of this.movedSet)QS(this.removesSubTreeCache,l,this.mirror)&&!this.movedSet.has(C.parentNode(l))||a(l);for(let l of this.addedSet)!eb(this.droppedSet,l)&&!QS(this.removesSubTreeCache,l,this.mirror)||eb(this.movedSet,l)?a(l):this.droppedSet.add(l);let i=null;for(;n.length;){let l=null;if(i){let c=this.mirror.getId(C.parentNode(i.value)),d=o(i.value);c!==-1&&d!==-1&&(l=i)}if(!l){let c=n.tail;for(;c;){let d=c;if(c=c.previous,d){let u=this.mirror.getId(C.parentNode(d.value));if(o(d.value)===-1)continue;if(u!==-1){l=d;break}else{let y=d.value,m=C.parentNode(y);if(m&&m.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let h=C.host(m);if(this.mirror.getId(h)!==-1){l=d;break}}}}}}if(!l){for(;n.head;)n.removeNode(n.head.value);break}i=l.previous,n.removeNode(l.value),a(l.value)}let s={texts:this.texts.map(l=>{let c=l.node,d=C.parentNode(c);return d&&d.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(d),{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 d=JSON.stringify(l.styleDiff),u=JSON.stringify(l._unchangedStyles);d.length<c.style.length&&(d+u).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};!s.texts.length&&!s.attributes.length&&!s.removes.length&&!s.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(s))}),R(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=cs({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ds(t),value:n,maskInputFn:this.maskInputFn})}),R(this,"processMutation",t=>{if(!gd(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{let r=C.textContent(t.target);!ve(t.target,this.blockClass,this.blockSelector,!1)&&r!==t.oldValue&&this.texts.push({value:yb(t.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,_R(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 i=ds(r);o=cs({element:r,maskInputOptions:this.maskInputOptions,tagName:r.tagName,type:i,value:o,maskInputFn:this.maskInputFn})}if(ve(t.target,this.blockClass,this.blockSelector,!1)||o===t.oldValue)return;let a=this.attributeMap.get(t.target);if(r.tagName==="IFRAME"&&n==="src"&&!this.keepIframeSrcFn(o))if(!r.contentDocument)n="rr_src";else return;if(a||(a={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(t.target,a)),n==="type"&&r.tagName==="INPUT"&&(t.oldValue||"").toLowerCase()==="password"&&r.setAttribute("data-rr-is-password","true"),!fb(r.tagName,n))if(a.attributes[n]=pb(this.doc,Sr(r.tagName),Sr(n),o),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let i=this.unattachedDoc.createElement("span");t.oldValue&&i.setAttribute("style",t.oldValue);for(let s of Array.from(r.style)){let l=r.style.getPropertyValue(s),c=r.style.getPropertyPriority(s);l!==i.style.getPropertyValue(s)||c!==i.style.getPropertyPriority(s)?c===""?a.styleDiff[s]=l:a.styleDiff[s]=[l,c]:a._unchangedStyles[s]=[l,c]}for(let s of Array.from(i.style))r.style.getPropertyValue(s)===""&&(a.styleDiff[s]=!1)}else n==="open"&&r.tagName==="DIALOG"&&(r.matches("dialog:modal")?a.attributes.rr_open_mode="modal":a.attributes.rr_open_mode="non-modal");break}case"childList":{if(ve(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=ko(t.target)?this.mirror.getId(C.host(t.target)):this.mirror.getId(t.target);ve(t.target,this.blockClass,this.blockSelector,!1)||gd(r,this.mirror,this.slimDOMOptions)||!zB(r,this.mirror)||(this.addedSet.has(r)?(ru(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(t.target)&&n===-1||WR(t.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[XS(n,o)]?ru(this.movedSet,r):(this.removes.push({parentId:o,id:n,isShadow:ko(t.target)&&Co(t.target)?!0:void 0}),GB(r,this.removesSubTreeCache))),this.mapRemoves.push(r))});break}}}),R(this,"genAdds",(t,r)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)&&!(this.addedSet.has(t)||this.movedSet.has(t))){if(this.mirror.hasNode(t)){if(gd(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[XS(this.mirror.getId(t),n)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);ve(t,this.blockClass,this.blockSelector,!1)||(C.childNodes(t).forEach(n=>this.genAdds(n)),Xd(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 ru(e,t){e.delete(t),C.childNodes(t).forEach(r=>ru(e,r))}function GB(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 QS(e,t,r){return e.size===0?!1:YB(e,t)}function YB(e,t,r){let n=C.parentNode(t);return n?e.has(n):!1}function eb(e,t){return e.size===0?!1:JR(e,t)}function JR(e,t){let r=C.parentNode(t);return r?e.has(r)?!0:JR(e,r):!1}var Ao;function ZB(e){Ao=e}function XB(){Ao=void 0}var I=e=>Ao?(...r)=>{try{return e(...r)}catch(n){if(Ao&&Ao(n)===!0)return;throw n}}:e,gr=[];function Wo(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 GR(e,t){let r=new tu;gr.push(r),r.init(e);let n=new(DR())(I(r.processMutations.bind(r)));return n.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),n}function QB({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,a=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,i=[],s,l=Do(I(u=>{let p=Date.now()-s;e(i.map(y=>(y.timeOffset-=p,y)),u),i=[],s=null}),a),c=I(Do(I(u=>{let p=Wo(u),{clientX:y,clientY:m}=Zd(u)?u.changedTouches[0]:u;s||(s=vs()),i.push({x:y,y:m,id:n.getId(p),timeOffset:vs()-s}),l(typeof DragEvent<"u"&&u instanceof DragEvent?P.Drag:u instanceof MouseEvent?P.MouseMove:P.TouchMove)}),o,{trailing:!1})),d=[Re("mousemove",c,r),Re("touchmove",c,r),Re("drag",c,r)];return I(()=>{d.forEach(u=>u())})}function eD({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:a}){if(a.mouseInteraction===!1)return()=>{};let i=a.mouseInteraction===!0||a.mouseInteraction===void 0?{}:a.mouseInteraction,s=[],l=null,c=d=>u=>{let p=Wo(u);if(ve(p,n,o,!0))return;let y=null,m=d;if("pointerType"in u){switch(u.pointerType){case"mouse":y=Rt.Mouse;break;case"touch":y=Rt.Touch;break;case"pen":y=Rt.Pen;break}y===Rt.Touch?xe[d]===xe.MouseDown?m="TouchStart":xe[d]===xe.MouseUp&&(m="TouchEnd"):Rt.Pen}else Zd(u)&&(y=Rt.Touch);y!==null?(l=y,(m.startsWith("Touch")&&y===Rt.Touch||m.startsWith("Mouse")&&y===Rt.Mouse)&&(y=null)):xe[d]===xe.Click&&(y=l,l=null);let h=Zd(u)?u.changedTouches[0]:u;if(!h)return;let f=r.getId(p),{clientX:b,clientY:w}=h;I(e)({type:xe[m],id:f,x:b,y:w,...y!==null&&{pointerType:y}})};return Object.keys(xe).filter(d=>Number.isNaN(Number(d))&&!d.endsWith("_Departed")&&i[d]!==!1).forEach(d=>{let u=Sr(d),p=c(d);if(window.PointerEvent)switch(xe[d]){case xe.MouseDown:case xe.MouseUp:u=u.replace("mouse","pointer");break;case xe.TouchStart:case xe.TouchEnd:return}s.push(Re(u,p,t))}),I(()=>{s.forEach(d=>d())})}function YR({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:a}){let i=I(Do(I(s=>{let l=Wo(s);if(!l||ve(l,n,o,!0))return;let c=r.getId(l);if(l===t&&t.defaultView){let d=$R(t.defaultView);e({id:c,x:d.left,y:d.top})}else e({id:c,x:l.scrollLeft,y:l.scrollTop})}),a.scroll||100));return Re("scroll",i,t)}function tD({viewportResizeCb:e},{win:t}){let r=-1,n=-1,o=I(Do(I(()=>{let a=VR(),i=jR();(r!==a||n!==i)&&(e({width:Number(i),height:Number(a)}),r=a,n=i)}),200));return Re("resize",o,t)}var rD=["INPUT","TEXTAREA","SELECT"],tb=new WeakMap;function nD({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:a,ignoreSelector:i,maskInputOptions:s,maskInputFn:l,sampling:c,userTriggeredOnInput:d}){function u(w){let S=Wo(w),E=w.isTrusted,L=S&&S.tagName;if(S&&L==="OPTION"&&(S=C.parentElement(S)),!S||!L||rD.indexOf(L)<0||ve(S,n,o,!0)||S.classList.contains(a)||i&&S.matches(i))return;let _=S.value,re=!1,U=ds(S)||"";U==="radio"||U==="checkbox"?re=S.checked:(s[L.toLowerCase()]||s[U])&&(_=cs({element:S,maskInputOptions:s,tagName:L,type:U,value:_,maskInputFn:l})),p(S,d?{text:_,isChecked:re,userTriggered:E}:{text:_,isChecked:re});let oe=S.name;U==="radio"&&oe&&re&&t.querySelectorAll(`input[type="radio"][name="${oe}"]`).forEach(pe=>{if(pe!==S){let Ae=pe.value;p(pe,d?{text:Ae,isChecked:!re,userTriggered:!1}:{text:Ae,isChecked:!re})}})}function p(w,S){let E=tb.get(w);if(!E||E.text!==S.text||E.isChecked!==S.isChecked){tb.set(w,S);let L=r.getId(w);I(e)({...S,id:L})}}let m=(c.input==="last"?["change"]:["input","change"]).map(w=>Re(w,I(u),t)),h=t.defaultView;if(!h)return()=>{m.forEach(w=>w())};let f=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),b=[[h.HTMLInputElement.prototype,"value"],[h.HTMLInputElement.prototype,"checked"],[h.HTMLSelectElement.prototype,"value"],[h.HTMLTextAreaElement.prototype,"value"],[h.HTMLSelectElement.prototype,"selectedIndex"],[h.HTMLOptionElement.prototype,"selected"]];return f&&f.set&&m.push(...b.map(w=>Fs(w[0],w[1],{set(){I(u)({target:this,isTrusted:!1})}},!1,h))),I(()=>{m.forEach(w=>w())})}function ws(e){let t=[];function r(n,o){if(es("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||es("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||es("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||es("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let i=Array.from(n.parentRule.cssRules).indexOf(n);o.unshift(i)}else if(n.parentStyleSheet){let i=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(i)}return o}return r(e,t)}function zt(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function oD({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((d,u,p)=>{let[y,m]=p,{id:h,styleId:f}=zt(u,t,r.styleMirror);return(h&&h!==-1||f&&f!==-1)&&e({id:h,styleId:f,adds:[{rule:y,index:m}]}),d.apply(u,p)})}),n.CSSStyleSheet.prototype.addRule=function(d,u,p=this.cssRules.length){let y=`${d} { ${u} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[y,p])};let a=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:I((d,u,p)=>{let[y]=p,{id:m,styleId:h}=zt(u,t,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,removes:[{index:y}]}),d.apply(u,p)})}),n.CSSStyleSheet.prototype.removeRule=function(d){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[d])};let i;n.CSSStyleSheet.prototype.replace&&(i=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(i,{apply:I((d,u,p)=>{let[y]=p,{id:m,styleId:h}=zt(u,t,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,replace:y}),d.apply(u,p)})}));let s;n.CSSStyleSheet.prototype.replaceSync&&(s=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(s,{apply:I((d,u,p)=>{let[y]=p,{id:m,styleId:h}=zt(u,t,r.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,replaceSync:y}),d.apply(u,p)})}));let l={};ts("CSSGroupingRule")?l.CSSGroupingRule=n.CSSGroupingRule:(ts("CSSMediaRule")&&(l.CSSMediaRule=n.CSSMediaRule),ts("CSSConditionRule")&&(l.CSSConditionRule=n.CSSConditionRule),ts("CSSSupportsRule")&&(l.CSSSupportsRule=n.CSSSupportsRule));let c={};return Object.entries(l).forEach(([d,u])=>{c[d]={insertRule:u.prototype.insertRule,deleteRule:u.prototype.deleteRule},u.prototype.insertRule=new Proxy(c[d].insertRule,{apply:I((p,y,m)=>{let[h,f]=m,{id:b,styleId:w}=zt(y.parentStyleSheet,t,r.styleMirror);return(b&&b!==-1||w&&w!==-1)&&e({id:b,styleId:w,adds:[{rule:h,index:[...ws(y),f||0]}]}),p.apply(y,m)})}),u.prototype.deleteRule=new Proxy(c[d].deleteRule,{apply:I((p,y,m)=>{let[h]=m,{id:f,styleId:b}=zt(y.parentStyleSheet,t,r.styleMirror);return(f&&f!==-1||b&&b!==-1)&&e({id:f,styleId:b,removes:[{index:[...ws(y),h]}]}),p.apply(y,m)})})}),I(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=a,i&&(n.CSSStyleSheet.prototype.replace=i),s&&(n.CSSStyleSheet.prototype.replaceSync=s),Object.entries(l).forEach(([d,u])=>{u.prototype.insertRule=c[d].insertRule,u.prototype.deleteRule=c[d].deleteRule})})}function ZR({mirror:e,stylesheetManager:t},r){var n,o,a;let i=null;r.nodeName==="#document"?i=e.getId(r):i=e.getId(C.host(r));let s=r.nodeName==="#document"?(n=r.defaultView)==null?void 0:n.Document:(a=(o=r.ownerDocument)==null?void 0:o.defaultView)==null?void 0:a.ShadowRoot,l=s?.prototype?Object.getOwnPropertyDescriptor(s?.prototype,"adoptedStyleSheets"):void 0;return i===null||i===-1||!s||!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 d;let u=(d=l.set)==null?void 0:d.call(this,c);if(i!==null&&i!==-1)try{t.adoptStyleSheets(c,i)}catch{}return u}}),I(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})}))}function aD({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let a=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:I((s,l,c)=>{var d;let[u,p,y]=c;if(r.has(u))return a.apply(l,[u,p,y]);let{id:m,styleId:h}=zt((d=l.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(m&&m!==-1||h&&h!==-1)&&e({id:m,styleId:h,set:{property:u,value:p,priority:y},index:ws(l.parentRule)}),s.apply(l,c)})});let i=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(i,{apply:I((s,l,c)=>{var d;let[u]=c;if(r.has(u))return i.apply(l,[u]);let{id:p,styleId:y}=zt((d=l.parentRule)==null?void 0:d.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||y&&y!==-1)&&e({id:p,styleId:y,remove:{property:u},index:ws(l.parentRule)}),s.apply(l,c)})}),I(()=>{o.CSSStyleDeclaration.prototype.setProperty=a,o.CSSStyleDeclaration.prototype.removeProperty=i})}function iD({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:a}){let i=I(l=>Do(I(c=>{let d=Wo(c);if(!d||ve(d,t,r,!0))return;let{currentTime:u,volume:p,muted:y,playbackRate:m,loop:h}=d;e({type:l,id:n.getId(d),currentTime:u,volume:p,muted:y,playbackRate:m,loop:h})}),o.media||500)),s=[Re("play",i(cn.Play),a),Re("pause",i(cn.Pause),a),Re("seeked",i(cn.Seeked),a),Re("volumechange",i(cn.VolumeChange),a),Re("ratechange",i(cn.RateChange),a)];return I(()=>{s.forEach(l=>l())})}function sD({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,a=r.FontFace;r.FontFace=function(l,c,d){let u=new a(l,c,d);return o.set(u,{family:l,buffer:typeof c!="string",descriptors:d,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),u};let i=vr(t.fonts,"add",function(s){return function(l){return setTimeout(I(()=>{let c=o.get(l);c&&(e(c),o.delete(l))}),0),s.apply(this,[l])}});return n.push(()=>{r.FontFace=a}),n.push(i),I(()=>{n.forEach(s=>s())})}function lD(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:a}=e,i=!0,s=I(()=>{let l=t.getSelection();if(!l||i&&l?.isCollapsed)return;i=l.isCollapsed||!1;let c=[],d=l.rangeCount||0;for(let u=0;u<d;u++){let p=l.getRangeAt(u),{startContainer:y,startOffset:m,endContainer:h,endOffset:f}=p;ve(y,n,o,!0)||ve(h,n,o,!0)||c.push({start:r.getId(y),startOffset:m,end:r.getId(h),endOffset:f})}a({ranges:c})});return s(),Re("selectionchange",s)}function cD({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:vr(r.customElements,"define",function(o){return function(a,i,s){try{t({define:{name:a}})}catch{console.warn(`Custom element callback failed for ${a}`)}return o.apply(this,[a,i,s])}})}function dD(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:a,viewportResizeCb:i,inputCb:s,mediaInteractionCb:l,styleSheetRuleCb:c,styleDeclarationCb:d,canvasMutationCb:u,fontCb:p,selectionCb:y,customElementCb:m}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),r(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),n(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),o(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),a(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),i(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),s(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),l(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),c(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),d(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),u(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),p(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),y(...h)},e.customElementCb=(...h)=>{t.customElement&&t.customElement(...h),m(...h)}}function uD(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};dD(e,t);let n;e.recordDOM&&(n=GR(e,e.doc));let o=QB(e),a=eD(e),i=YR(e),s=tD(e,{win:r}),l=nD(e),c=iD(e),d=()=>{},u=()=>{},p=()=>{},y=()=>{};e.recordDOM&&(d=oD(e,{win:r}),u=ZR(e,e.doc),p=aD(e,{win:r}),e.collectFonts&&(y=sD(e)));let m=lD(e),h=cD(e),f=[];for(let b of e.plugins)f.push(b.observer(b.callback,r,b.options));return I(()=>{gr.forEach(b=>b.reset()),n?.disconnect(),o(),a(),i(),s(),l(),c(),d(),u(),p(),y(),m(),h(),f.forEach(b=>b())})}function es(e){return typeof window[e]<"u"}function ts(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var Es=class{constructor(t){R(this,"iframeIdToRemoteIdMap",new WeakMap),R(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=t}getId(t,r,n,o){let a=n||this.getIdToRemoteIdMap(t),i=o||this.getRemoteIdToIdMap(t),s=a.get(r);return s||(s=this.generateIdFn(),a.set(r,s),i.set(s,r)),s}getIds(t,r){let n=this.getIdToRemoteIdMap(t),o=this.getRemoteIdToIdMap(t);return r.map(a=>this.getId(t,a,n,o))}getRemoteId(t,r,n){let o=n||this.getRemoteIdToIdMap(t);if(typeof r!="number")return r;let a=o.get(r);return a||-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}},nu=class{constructor(t){R(this,"iframes",new WeakMap),R(this,"crossOriginIframeMap",new WeakMap),R(this,"crossOriginIframeMirror",new Es(ub)),R(this,"crossOriginIframeStyleMirror"),R(this,"crossOriginIframeRootIdMap",new WeakMap),R(this,"mirror"),R(this,"mutationCb"),R(this,"wrappedEmit"),R(this,"loadListener"),R(this,"stylesheetManager"),R(this,"recordCrossOriginIframes"),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Es(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 a=this.transformCrossOriginEvent(o,r.data.event);a&&this.wrappedEmit(a,r.data.isCheckout)}transformCrossOriginEvent(t,r){var n;switch(r.type){case T.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:T.IncrementalSnapshot,data:{source:P.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case T.Meta:case T.Load:case T.DomContentLoaded:return!1;case T.Plugin:return r;case T.Custom:return this.replaceIds(r.data.payload,t,["id","parentId","previousId","nextId"]),r;case T.IncrementalSnapshot:switch(r.data.source){case P.Mutation:return r.data.adds.forEach(o=>{this.replaceIds(o,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(o.node,t);let a=this.crossOriginIframeRootIdMap.get(t);a&&this.patchRootIdOnNode(o.node,a)}),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 P.Drag:case P.TouchMove:case P.MouseMove:return r.data.positions.forEach(o=>{this.replaceIds(o,t,["id"])}),r;case P.ViewportResize:return!1;case P.MediaInteraction:case P.MouseInteraction:case P.Scroll:case P.CanvasMutation:case P.Input:return this.replaceIds(r.data,t,["id"]),r;case P.StyleSheetRule:case P.StyleDeclaration:return this.replaceIds(r.data,t,["id"]),this.replaceStyleIds(r.data,t,["styleId"]),r;case P.Font:return r;case P.Selection:return r.data.ranges.forEach(o=>{this.replaceIds(o,t,["start","end"])}),r;case P.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 a of o)!Array.isArray(r[a])&&typeof r[a]!="number"||(Array.isArray(r[a])?r[a]=t.getIds(n,r[a]):r[a]=t.getId(n,r[a]));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!==KR.Document&&!t.rootId&&(t.rootId=r),"childNodes"in t&&t.childNodes.forEach(n=>{this.patchRootIdOnNode(n,r)})}},ou=class{constructor(t){R(this,"shadowDoms",new WeakSet),R(this,"mutationCb"),R(this,"scrollCb"),R(this,"bypassOptions"),R(this,"mirror"),R(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(!Co(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);let n=GR({...this.bypassOptions,doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},t);this.restoreHandlers.push(()=>n.disconnect()),this.restoreHandlers.push(YR({...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(ZR({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(vr(t.prototype,"attachShadow",function(o){return function(a){let i=o.call(this,a),s=C.shadowRoot(this);return s&&HR(this)&&n.addShadowRoot(s,r),i}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}},pn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pD=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(xo=0;xo<pn.length;xo++)pD[pn.charCodeAt(xo)]=xo;var xo,fD=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=pn[t[r]>>2],o+=pn[(t[r]&3)<<4|t[r+1]>>4],o+=pn[(t[r+1]&15)<<2|t[r+2]>>6],o+=pn[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 rb=new Map;function yD(e,t){let r=rb.get(e);return r||(r=new Map,rb.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var XR=(e,t,r)=>{if(!e||!(ev(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=yD(r,n),a=o.indexOf(e);return a===-1&&(a=o.length,o.push(e)),a};function is(e,t,r){if(e instanceof Array)return e.map(n=>is(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=fD(e);return{rr_type:n,base64:o}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[is(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:[is(e.data,t,r),e.width,e.height]};if(ev(e,t)||typeof e=="object"){let n=e.constructor.name,o=XR(e,t,r);return{rr_type:n,index:o}}}}return e}var QR=(e,t,r)=>e.map(n=>is(n,t,r)),ev=(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 mD(e,t,r,n){let o=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let i of a)try{if(typeof t.CanvasRenderingContext2D.prototype[i]!="function")continue;let s=vr(t.CanvasRenderingContext2D.prototype,i,function(l){return function(...c){return ve(this.canvas,r,n,!0)||setTimeout(()=>{let d=QR(c,t,this);e(this.canvas,{type:bn["2D"],property:i,args:d})},0),l.apply(this,c)}});o.push(s)}catch{let s=Fs(t.CanvasRenderingContext2D.prototype,i,{set(l){e(this.canvas,{type:bn["2D"],property:i,args:[l],setter:!0})}});o.push(s)}return()=>{o.forEach(i=>i())}}function hD(e){return e==="experimental-webgl"?"webgl":e}function nb(e,t,r,n){let o=[];try{let a=vr(e.HTMLCanvasElement.prototype,"getContext",function(i){return function(s,...l){if(!ve(this,t,r,!0)){let c=hD(s);if("__context"in this||(this.__context=c),n&&["webgl","webgl2"].includes(c))if(l[0]&&typeof l[0]=="object"){let d=l[0];d.preserveDrawingBuffer||(d.preserveDrawingBuffer=!0)}else l.splice(0,1,{preserveDrawingBuffer:!0})}return i.apply(this,[s,...l])}});o.push(a)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(a=>a())}}function ob(e,t,r,n,o,a){let i=[],s=Object.getOwnPropertyNames(e);for(let l of s)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(l))try{if(typeof e[l]!="function")continue;let c=vr(e,l,function(d){return function(...u){let p=d.apply(this,u);if(XR(p,a,this),"tagName"in this.canvas&&!ve(this.canvas,n,o,!0)){let y=QR(u,a,this),m={type:t,property:l,args:y};r(this.canvas,m)}return p}});i.push(c)}catch{let c=Fs(e,l,{set(d){r(this.canvas,{type:t,property:l,args:[d],setter:!0})}});i.push(c)}return i}function gD(e,t,r,n){let o=[];return o.push(...ob(t.WebGLRenderingContext.prototype,bn.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...ob(t.WebGL2RenderingContext.prototype,bn.WebGL2,e,r,n,t)),()=>{o.forEach(a=>a())}}var tv="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",SD=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),ab=typeof window<"u"&&window.Blob&&new Blob([SD(tv)],{type:"text/javascript;charset=utf-8"});function bD(e){let t;try{if(t=ab&&(window.URL||window.webkitURL).createObjectURL(ab),!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,"+tv,{name:e?.name})}finally{t&&(window.URL||window.webkitURL).revokeObjectURL(t)}}var au=class{constructor(t){R(this,"pendingCanvasMutations",new Map),R(this,"rafStamps",{latestId:0,invokeId:null}),R(this,"mirror"),R(this,"mutationCb"),R(this,"resetObservers"),R(this,"frozen",!1),R(this,"locked",!1),R(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:a,recordCanvas:i,dataURLOptions:s}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,i&&r==="all"&&this.initCanvasMutationObserver(n,o,a),i&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,a,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,o,a){let i=nb(r,n,o,!0),s=new Map,l=new bD;l.onmessage=m=>{let{id:h}=m.data;if(s.set(h,!1),!("base64"in m.data))return;let{base64:f,type:b,width:w,height:S}=m.data;this.mutationCb({id:h,type:bn["2D"],commands:[{property:"clearRect",args:[0,0,w,S]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:f}],type:b}]},0,0]}]})};let c=1e3/t,d=0,u,p=()=>{let m=[];return r.document.querySelectorAll("canvas").forEach(h=>{ve(h,n,o,!0)||m.push(h)}),m},y=m=>{if(d&&m-d<c){u=requestAnimationFrame(y);return}d=m,p().forEach(async h=>{var f;let b=this.mirror.getId(h);if(s.get(b)||h.width===0||h.height===0)return;if(s.set(b,!0),["webgl","webgl2"].includes(h.__context)){let S=h.getContext(h.__context);((f=S?.getContextAttributes())==null?void 0:f.preserveDrawingBuffer)===!1&&S.clear(S.COLOR_BUFFER_BIT)}let w=await createImageBitmap(h);l.postMessage({id:b,bitmap:w,width:h.width,height:h.height,dataURLOptions:a.dataURLOptions},[w])}),u=requestAnimationFrame(y)};u=requestAnimationFrame(y),this.resetObservers=()=>{i(),cancelAnimationFrame(u)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let o=nb(t,r,n,!1),a=mD(this.processMutation.bind(this),t,r,n),i=gD(this.processMutation.bind(this),t,r,n);this.resetObservers=()=>{o(),a(),i()}}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(i=>{let{type:s,...l}=i;return l}),{type:a}=n[0];this.mutationCb({id:r,type:a,commands:o}),this.pendingCanvasMutations.delete(t)}},iu=class{constructor(t){R(this,"trackedLinkElements",new WeakSet),R(this,"mutationCb"),R(this,"adoptedStyleSheetCb"),R(this,"styleMirror",new Qd),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 a of t){let i;this.styleMirror.has(a)?i=this.styleMirror.getId(a):(i=this.styleMirror.add(a),o.push({styleId:i,rules:Array.from(a.rules||CSSRule,(s,l)=>({rule:cb(s,a.href),index:l}))})),n.styleIds.push(i)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}},su=class{constructor(){R(this,"nodeMap",new WeakMap),R(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(){}},te,ss,Sd,xs=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=((sS=e.contentWindow)==null?void 0:sS.Array.from)||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var Ue=wL();function wr(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:a=null,ignoreClass:i="rr-ignore",ignoreSelector:s=null,maskTextClass:l="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:u,maskInputOptions:p,slimDOMOptions:y,maskInputFn:m,maskTextFn:h,hooks:f,packFn:b,sampling:w={},dataURLOptions:S={},mousemoveWait:E,recordDOM:L=!0,recordCanvas:_=!1,recordCrossOriginIframes:re=!1,recordAfter:U=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:oe=!1,collectFonts:pe=!1,inlineImages:Ae=!1,plugins:Ke,keepIframeSrcFn:N=()=>!1,ignoreCSSAttributes:vn=new Set([]),errorHandler:wn}=e;ZB(wn);let se=re?window.parent===window:!0,Pe=!1;if(!se)try{window.parent.document&&(Pe=!1)}catch{Pe=!0}if(se&&!t)throw new Error("emit function is required");if(!se&&!Pe)return()=>{};E!==void 0&&w.mousemove===void 0&&(w.mousemove=E),Ue.reset();let Ht=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}:p!==void 0?p:{password:!0},Je=mb(y);HB();let Iu,Bs=0,Lu=B=>{for(let Le of Ke||[])Le.eventProcessor&&(B=Le.eventProcessor(B));return b&&!Pe&&(B=b(B)),B};te=(B,Le)=>{var Q;let ee=B;if(ee.timestamp=vs(),(Q=gr[0])!=null&&Q.isFrozen()&&ee.type!==T.FullSnapshot&&!(ee.type===T.IncrementalSnapshot&&ee.data.source===P.Mutation)&&gr.forEach(ke=>ke.unfreeze()),se)t?.(Lu(ee),Le);else if(Pe){let ke={type:"rrweb",event:Lu(ee),origin:window.location.origin,isCheckout:Le};window.parent.postMessage(ke,"*")}if(ee.type===T.FullSnapshot)Iu=ee,Bs=0;else if(ee.type===T.IncrementalSnapshot){if(ee.data.source===P.Mutation&&ee.data.isAttachIframe)return;Bs++;let ke=n&&Bs>=n,W=r&&ee.timestamp-Iu.timestamp>r;(ke||W)&&ss(!0)}};let qo=B=>{te({type:T.IncrementalSnapshot,data:{source:P.Mutation,...B}})},Nu=B=>te({type:T.IncrementalSnapshot,data:{source:P.Scroll,...B}}),Fu=B=>te({type:T.IncrementalSnapshot,data:{source:P.CanvasMutation,...B}}),gv=B=>te({type:T.IncrementalSnapshot,data:{source:P.AdoptedStyleSheet,...B}}),Kt=new iu({mutationCb:qo,adoptedStyleSheetCb:gv}),Jt=new nu({mirror:Ue,mutationCb:qo,stylesheetManager:Kt,recordCrossOriginIframes:re,wrappedEmit:te});for(let B of Ke||[])B.getMirror&&B.getMirror({nodeMirror:Ue,crossOriginIframeMirror:Jt.crossOriginIframeMirror,crossOriginIframeStyleMirror:Jt.crossOriginIframeStyleMirror});let Ds=new su;Sd=new au({recordCanvas:_,mutationCb:Fu,win:window,blockClass:o,blockSelector:a,mirror:Ue,sampling:w.canvas,dataURLOptions:S});let zo=new ou({mutationCb:qo,scrollCb:Nu,bypassOptions:{blockClass:o,blockSelector:a,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:Ht,dataURLOptions:S,maskTextFn:h,maskInputFn:m,recordCanvas:_,inlineImages:Ae,sampling:w,slimDOMOptions:Je,iframeManager:Jt,stylesheetManager:Kt,canvasManager:Sd,keepIframeSrcFn:N,processedNodeManager:Ds},mirror:Ue});ss=(B=!1)=>{if(!L)return;te({type:T.Meta,data:{href:window.location.href,width:jR(),height:VR()}},B),Kt.reset(),zo.init(),gr.forEach(Q=>Q.lock());let Le=HL(document,{mirror:Ue,blockClass:o,blockSelector:a,maskTextClass:l,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:Ht,maskTextFn:h,maskInputFn:m,slimDOM:Je,dataURLOptions:S,recordCanvas:_,inlineImages:Ae,onSerialize:Q=>{UR(Q,Ue)&&Jt.addIframe(Q),qR(Q,Ue)&&Kt.trackLinkElement(Q),Xd(Q)&&zo.addShadowRoot(C.shadowRoot(Q),document)},onIframeLoad:(Q,ee)=>{Jt.attachIframe(Q,ee),zo.observeAttachShadow(Q)},onStylesheetLoad:(Q,ee)=>{Kt.attachLinkElement(Q,ee)},keepIframeSrcFn:N});if(!Le)return console.warn("Failed to snapshot the document");te({type:T.FullSnapshot,data:{node:Le,initialOffset:$R(window)}},B),gr.forEach(Q=>Q.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Kt.adoptStyleSheets(document.adoptedStyleSheets,Ue.getId(document))};try{let B=[],Le=ee=>{var ke;return I(uD)({mutationCb:qo,mousemoveCb:(W,$s)=>te({type:T.IncrementalSnapshot,data:{source:$s,positions:W}}),mouseInteractionCb:W=>te({type:T.IncrementalSnapshot,data:{source:P.MouseInteraction,...W}}),scrollCb:Nu,viewportResizeCb:W=>te({type:T.IncrementalSnapshot,data:{source:P.ViewportResize,...W}}),inputCb:W=>te({type:T.IncrementalSnapshot,data:{source:P.Input,...W}}),mediaInteractionCb:W=>te({type:T.IncrementalSnapshot,data:{source:P.MediaInteraction,...W}}),styleSheetRuleCb:W=>te({type:T.IncrementalSnapshot,data:{source:P.StyleSheetRule,...W}}),styleDeclarationCb:W=>te({type:T.IncrementalSnapshot,data:{source:P.StyleDeclaration,...W}}),canvasMutationCb:Fu,fontCb:W=>te({type:T.IncrementalSnapshot,data:{source:P.Font,...W}}),selectionCb:W=>{te({type:T.IncrementalSnapshot,data:{source:P.Selection,...W}})},customElementCb:W=>{te({type:T.IncrementalSnapshot,data:{source:P.CustomElement,...W}})},blockClass:o,ignoreClass:i,ignoreSelector:s,maskTextClass:l,maskTextSelector:c,maskInputOptions:Ht,inlineStylesheet:d,sampling:w,recordDOM:L,recordCanvas:_,inlineImages:Ae,userTriggeredOnInput:oe,collectFonts:pe,doc:ee,maskInputFn:m,maskTextFn:h,keepIframeSrcFn:N,blockSelector:a,slimDOMOptions:Je,dataURLOptions:S,mirror:Ue,iframeManager:Jt,stylesheetManager:Kt,shadowDomManager:zo,processedNodeManager:Ds,canvasManager:Sd,ignoreCSSAttributes:vn,plugins:((ke=Ke?.filter(W=>W.observer))==null?void 0:ke.map(W=>({observer:W.observer,options:W.options,callback:$s=>te({type:T.Plugin,data:{plugin:W.name,payload:$s}})})))||[]},f)};Jt.addLoadListener(ee=>{try{B.push(Le(ee.contentDocument))}catch(ke){console.warn(ke)}});let Q=()=>{ss(),B.push(Le(document)),xs=!0};return["interactive","complete"].includes(document.readyState)?Q():(B.push(Re("DOMContentLoaded",()=>{te({type:T.DomContentLoaded,data:{}}),U==="DOMContentLoaded"&&Q()})),B.push(Re("load",()=>{te({type:T.Load,data:{}}),U==="load"&&Q()},window))),()=>{B.forEach(ee=>{try{ee()}catch(ke){String(ke).toLowerCase().includes("cross-origin")||console.warn(ke)}}),Ds.destroy(),xs=!1,XB()}}catch(B){console.warn(B)}}wr.addCustomEvent=(e,t)=>{if(!xs)throw new Error("please add custom event after start recording");te({type:T.Custom,data:{tag:e,payload:t}})};wr.freezePage=()=>{gr.forEach(e=>e.freeze())};wr.takeFullSnapshot=e=>{if(!xs)throw new Error("please take full snapshot after start recording");ss(e)};wr.mirror=Ue;var ib;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(ib||(ib={}));var zY=5*1e3;var{addCustomEvent:HY}=wr,{freezePage:KY}=wr,{takeFullSnapshot:JY}=wr;var nv="__ripploEmitRrwebEvent";function ov(){return{eventTypes:rv(T),incrementalSources:rv(P)}}function rv(e){return Object.fromEntries(Object.entries(e).filter(t=>typeof t[1]=="number").map(([t,r])=>[r,t]))}var av=od(nd("@ripplo/rrweb-bundle/bundle","rrweb.js"));async function Uo({clientVersion:e,debugDir:t,writeOtlpPortFile:r}){let n=new Map,o=aS(ov()),a=await Pc({localDir:iv.join(iv.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)}}),i=await av();return{attach:async(l,c)=>{let d=oS({debugDir:t,runId:c,worker:o});d.emit({clientVersion:e,kind:"meta",source:"capture",timeNanos:"0"}),n.set(c,d),await iS(l,c),await l.addInitScript(`globalThis.__ripploCapturePort = ${String(a.port)};`),await l.addInitScript(i),await vD(l,d),await xD(l,d);let u=[];return{emitAction:p=>{AD(d,p)},emitStepOutcome:p=>{PD(d,p)},finish:()=>kD(d,{pages:u,registry:n,runId:c}),onPage:p=>{u.push(p),CD(d,i,p)}}},debugDir:t,close:async()=>{await a.stop(),await o.terminate()},injectSpan:(l,c)=>{n.get(l)?.emit(c)}}}async function RD(e){await Promise.all(e.map(t=>t.evaluate("globalThis.__ripploFlushRrweb ? globalThis.__ripploFlushRrweb() : undefined").catch(()=>{})))}async function vD(e,t){await e.exposeBinding(nv,(r,n)=>{let o=typeof n=="string"?n:JSON.stringify(n);t.emitRrwebBatch(Buffer.from(o,"utf8"))})}var wD="__ripploEventPush",ED=He.discriminatedUnion("kind",[He.object({kind:He.literal("console"),level:He.string(),text:He.string(),timestamp:He.number()}),He.object({kind:He.literal("error"),message:He.string(),stack:He.string().optional(),timestamp:He.number()})]);async function xD(e,t){await e.exposeBinding(wD,(r,n)=>{let o=ED.safeParse(n);if(!o.success)return;let a=o.data;if(a.kind==="console"){t.emit({kind:"console",level:a.level,source:"browser",text:a.text,timeNanos:hr(a.timestamp)});return}t.emit({kind:"error",message:a.message,source:"browser",stack:a.stack,timeNanos:hr(a.timestamp)})})}async function kD(e,t){await RD(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 CD(e,t,r){r.on("requestfinished",n=>{ND(e,n).catch(()=>{})}),r.url()!=="about:blank"&&r.addScriptTag({content:t}).catch(()=>{})}function AD(e,t){e.emit({action:t.kind,kind:"action",source:"test",target:TD(t),timeNanos:hr(Date.now()),value:ID(t)})}function PD(e,t){t.checks.forEach(r=>{e.emit(OD(r,t.stepIndex))}),t.stepError!=null&&e.emit(MD(t.stepError,t.stepIndex))}function OD(e,t){let r={...e.body,kind:"check",origin:Xa(e.target,t),source:"verifier",stepIndex:t,timeNanos:hr(e.atMs)};return Du(r,"check event"),r}function MD(e,t){return{error:e.error,kind:"stepError",source:"verifier",stepIndex:t,timeNanos:hr(e.atMs)}}function TD(e){if(e.url!=null)return kt(e.url);if(e.locator!=null)return Yo(e.locator)}function ID(e){return e.value!=null?Cn(e.value):e.key}var LD=/^http:\/\/127\.0\.0\.1:\d+\/rrweb\//;async function ND(e,t){if(LD.test(t.url()))return;let r=await t.response();if(r==null)return;let n=t.resourceType(),o=n==="fetch"||n==="xhr",a=t.timing(),i=t.headers().traceparent?.split("-"),s=a.startTime;e.emit({durationMs:Math.max(0,a.responseEnd),kind:"network",method:t.method(),requestBody:o?t.postData()??void 0:void 0,resourceType:n,responseBody:o?await FD(r):void 0,source:"browser",spanId:i?.[2],status:r.status(),timeNanos:hr(s>0?s:Date.now()),traceId:i?.[1],url:r.url()})}async function FD(e){try{return await e.text()}catch{return}}function VD(e,t){return new $D(jD(e,t))}async function jD(e,t){let r=await Eg(e.profileDir).catch(()=>{});if(r==null)return sv(he(new Error("launch")));try{return DD(await _D({context:r,params:e,signal:t}))}catch(n){return sv(he(n))}finally{await r.close().catch(ge)}}async function _D({context:e,params:t,signal:r}){let n=e.pages()[0]??await e.newPage(),o=await Uo({clientVersion:t.clientVersion,debugDir:t.debugDir,writeOtlpPortFile:!0}),a=await o.attach(e,t.runId);return a.onPage(n),e.on("page",i=>{a.onPage(i)}),await n.goto(t.startUrl).catch(ge),t.onReady(),await WD(e,r),await a.finish(),await o.close(),{behaviorPath:BD.join(t.debugDir,t.runId,"behavior.jsonl")}}function WD(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))})}import{err as UD,ok as qD,ResultAsync as zD}from"neverthrow";function HD({cacheDir:e,clientVersion:t,debugDir:r,headed:n,writeOtlpPortFile:o}){let a=Ai({cacheDir:e,headed:n}),i,s,l=async()=>(i??=Uo({clientVersion:t,debugDir:r,writeOtlpPortFile:o}),s=await i,s),c=async(p,y)=>{if(y.aborted)return qD(bo("skipped"));try{let m=await l();if(p.options.headed&&!n)return await Vc(!0,async f=>td({browser:f,hub:m,request:p},y));let h=await a.acquire();return await td({browser:h,hub:m,request:p},y)}catch(m){return UD(he(m))}};return{close:async()=>{await a.close();let p=i;i=void 0,s=void 0,p!=null&&await p.then(y=>y.close()).catch(()=>{})},prewarm:async()=>{await l(),await a.acquire()},injectSpan:(p,y)=>{s?.injectSpan(p,y)},runOnce:(p,y)=>new zD(c(p,y))}}import{z as O}from"zod";function KD(e){let t=e.split(`
65
+ `).map(o=>c1(o)).filter(o=>o!=null),r=n1(t),n=t.map(o=>ZD(o,r)).filter(o=>o!=null).filter(o=>o.kind==="input"||o.element!=null);return JD(n)}function JD(e){return e.filter((t,r)=>{let n=e[r+1];return!(t.kind==="input"&&n?.kind==="input"&&GD(t.element,n.element))})}function GD(e,t){return e?.testId===t?.testId&&e?.ariaLabel===t?.ariaLabel&&e?.placeholder===t?.placeholder}var YD={2:"click",3:"contextmenu",4:"dblclick"};function ZD(e,t){return e.rrwebType==="IncrementalSnapshot:MouseInteraction"?XD(e,t):e.rrwebType==="IncrementalSnapshot:Input"?QD(e,t):null}function XD(e,t){let r=m1.safeParse(e.event.data);if(!r.success)return null;let n=YD[r.data.type];if(n==null)return null;let o=lv(r.data.id,t.nodes);return{element:cv(o,t),kind:n,timeNanos:e.timeNanos,value:void 0}}function QD(e,t){let r=h1.safeParse(e.event.data);return r.success?{element:cv(r.data.id,t),kind:"input",timeNanos:e.timeNanos,value:r.data.text??e1(r.data.isChecked)}:null}function e1(e){return e==null?void 0:String(e)}var t1=new Set(["button","a","input","select","textarea","summary"]);function lv(e,t){let r=t.get(e);if(r!=null)return r1(r)?e:r.parentId==null?void 0:lv(r.parentId,t)}function r1(e){return e.attrs["data-testid"]!=null||e.attrs["aria-label"]!=null||e.attrs.role!=null||t1.has(e.tag??"")}function cv(e,t){let r=e==null?void 0:t.nodes.get(e);if(!(r==null||e==null))return{ariaLabel:Rn(r,"aria-label"),href:Rn(r,"href"),name:Rn(r,"name"),placeholder:Rn(r,"placeholder"),role:Rn(r,"role"),tag:r.tag,testId:Rn(r,"data-testid"),text:dv(e,t)}}function Rn(e,t){let r=e.attrs[t];return typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(r):void 0}function dv(e,t){let r=t.nodes.get(e);if(r==null)return;let n=r.text?.trim()??"",a=(t.children.get(e)??[]).map(s=>dv(s,t)??""),i=[n,...a].filter(s=>s.length>0).join(" ");return i.length===0?void 0:i.slice(0,100)}function n1(e){let t=e.flatMap(o=>o1(o).flatMap(a=>Tu(a,void 0))),r=e.flatMap(o=>a1(o).flatMap(a=>Tu(a.node,a.parentId??void 0))),n=s1(new Map([...t,...r]),e);return{children:i1(n),nodes:n}}function o1(e){if(e.rrwebType!=="FullSnapshot")return[];let t=p1.safeParse(e.event.data);return t.success?[t.data.node]:[]}function a1(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=uv.safeParse(e.event.data);return t.success?t.data.adds.flatMap(r=>{let n=f1.safeParse(r);return n.success?[n.data]:[]}):[]}function i1(e){let t=new Map;return e.forEach((r,n)=>{r.parentId!=null&&t.set(r.parentId,[...t.get(r.parentId)??[],n])}),t}function Tu(e,t){let r=u1.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(i=>Tu(i,n.id))]}function s1(e,t){return t.flatMap(n=>l1(n)).reduce((n,o)=>{let a=n.get(o.id);return a==null?n:new Map(n).set(o.id,{...a,attrs:{...a.attrs,...o.attributes}})},e)}function l1(e){if(e.rrwebType!=="IncrementalSnapshot:Mutation")return[];let t=uv.safeParse(e.event.data);return t.success?t.data.attributes.flatMap(r=>{let n=y1.safeParse(r);return n.success?[n.data]:[]}):[]}function c1(e){if(e.trim().length===0)return null;let t=g1.safeParse(d1(e));return t.success?t.data:null}function d1(e){try{return JSON.parse(e)}catch{return null}}var u1=O.object({attributes:O.record(O.string(),O.unknown()).optional(),childNodes:O.array(O.unknown()).optional(),id:O.number(),tagName:O.string().optional(),textContent:O.string().optional()}),p1=O.object({node:O.unknown()}),f1=O.object({node:O.unknown(),parentId:O.number().nullable().default(null)}),y1=O.object({attributes:O.record(O.string(),O.unknown()),id:O.number()}),uv=O.object({adds:O.array(O.unknown()).default([]),attributes:O.array(O.unknown()).default([])}),m1=O.object({id:O.number(),type:O.number()}),h1=O.object({id:O.number(),isChecked:O.boolean().optional(),text:O.string().optional()}),g1=O.object({event:O.object({data:O.unknown()}),kind:O.literal("rrweb"),rrwebType:O.string(),timeNanos:O.string()});function pv(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 S1(e,t){let r=await mv({attemptIndex:0,capture:!1,params:e,stepRuns:e.stepRuns},t);if(r.kind!=="completed")return fv(r,void 0);let n=yv(r.contradictions);if(n!=null)return{error:n,kind:"error"};let o=b1(r.contradictions);if(o==null)return{kind:"clean",ranCount:r.ranCount,timing:{confirm:void 0,detect:r.timing}};let a=uo(o.contradictions);return e.seenSignature!=null&&await e.seenSignature(a.signature)?{kind:"seen",ranCount:r.ranCount,signature:a.signature,timing:{confirm:void 0,detect:r.timing},title:a.title,verifierLayer:a.layer}:R1({detect:r.timing,digest:a,discoveryKind:o.kind,params:e,signal:t})}function b1(e){let t=ao(e);if(t.length>0)return{contradictions:t,kind:"finding"};let r=io(e);return r.length>0?{contradictions:r,kind:"coverage-gap"}:null}function fv(e,t){return e.kind==="error"?{error:e.error,kind:"error"}:{kind:"aborted",ranCount:e.ranCount,timing:{confirm:t==null?void 0:e.timing,detect:t??e.timing}}}function yv(e){let t=e.find(r=>r.kind==="stepError"&&oa(r.record.error));return t!=null&&t.kind==="stepError"?t.record.error:void 0}async function R1({detect:e,digest:t,discoveryKind:r,params:n,signal:o}){let a=await mv({attemptIndex:1,capture:!0,params:n,stepRuns:n.stepRuns},o);if(a.kind!=="completed")return fv(a,e);let i=yv(a.contradictions);if(i!=null)return{error:i,kind:"error"};let s={confirm:a.timing,detect:e},l=r==="finding"?ao(a.contradictions):io(a.contradictions);return l.length===0||uo(l).signature!==t.signature?{kind:"flaky",ranCount:a.ranCount,timing:s}:{baseState:n.baseState.name,captureEvents:a.events,kind:r,ranCount:a.ranCount,runId:a.runId,signature:t.signature,sourceTest:t.sourceTest,timing:s,title:t.title,verifierLayer:t.layer}}async function mv({attemptIndex:e,capture:t,params:r,stepRuns:n},o){let a=r.runIdFor(e),i=[],s=[];return(await r.session.runOnce({capture:t,lockfile:r.lockfile,onEvent:t?c=>{i.push(c)}:void 0,onProgress:void 0,options:r.options,params:void 0,runId:a,sequence:v1(r,n),startingStateSeed:r.startingStateSeed,test:r.baseState.test,onPhase:(c,d)=>{s.push({ms:d,phase:c})}},o)).match(c=>c.aborted?{kind:"aborted",ranCount:c.ran.length,timing:pv(s)}:{contradictions:c.contradictions,events:i,kind:"completed",ranCount:c.ran.length,runId:a,timing:pv(s)},c=>({error:c,kind:"error"}))}function v1(e,t){let r=rn({corpus:e.corpus,planned:t});if(r==null)throw new Error("explore-transition-unavailable");return r}function hv(e,t){let r=mi(e);if(r.kind==="model-empty")return{kind:"unplannable"};let n=r.value,o=n.startingPointTests.get(t.envelopeRef);if(o==null)return{kind:"unplannable"};let a=rn({corpus:n.corpus,planned:t.steps});return a==null?{kind:"unplannable"}:{baseTest:o,kind:"ok",sequence:a}}async function w1({capture:e,lockfile:t,onEvent:r,options:n,repro:o,runId:a,session:i,signal:s}){let l=hv(t,o);return l.kind==="unplannable"?{kind:"unplannable"}:(await i.runOnce({capture:e,lockfile:t,onEvent:r,onPhase:void 0,onProgress:void 0,options:n,params:void 0,runId:a,sequence:l.sequence,startingStateSeed:o.seed,test:l.baseTest},s)).match(d=>{if(d.aborted)return{kind:"aborted"};let u=si(d.contradictions);return u.length>0?{contradictions:u,kind:"still-fails"}:{kind:"resolved"}},d=>({kind:"state-unavailable",reason:d.kind}))}export{Za as a,oa as b,Ap as c,Qs as d,Qt as e,Me as f,hy as g,Pa as h,Ma as i,Ta as j,by as k,Bt as l,je as m,ne as n,Y as o,ga as p,wa as q,ii as r,ey as s,ka as t,dy as u,Sh as v,bh as w,Rh as x,vh as y,Eh as z,kh as A,Ch as B,Ph as C,Ry as D,Ia as E,La as F,Th as G,Bh as H,Dh as I,bm as J,$h as K,Vh as L,kc as M,jh as N,_h as O,Wh as P,Uh as Q,pi as R,mi as S,hi as T,Jh as U,CI as V,nd as W,od as X,Pc as Y,VD as Z,HD as _,KD as $,S1 as aa,hv as ba,w1 as ca};
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
+ */