arcy.js 0.1.3 → 0.1.5

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.
@@ -1,20 +1,20 @@
1
1
  (function(){'use strict';/* arcy.js — https://arcyai.com */
2
- var be="__arcyPicker";function Se(e){return {v:1,core:e,selector:null,selectorCandidates:[],ordinal:1,precision:3,dynamicText:false}}function L(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}function Te(e,t){let n=e;for(;n!==null;){if(n.matches(t))return n;n=L(n);}return null}function ve(e,t){let n=t;for(;n!==null;){if(n===e)return true;n=L(n);}return false}var Ce=100;function O(e,t=0){let n=[],r=e.querySelectorAll("*");for(let i=0;i<r.length;i+=1){let o=r[i];n.push(o),o.shadowRoot!==null&&t<Ce&&n.push(...O(o.shadowRoot,t+1));}return n}function $(e,t,n=0){let r=Array.from(e.querySelectorAll(t)),i=e.querySelectorAll("*");for(let o=0;o<i.length;o+=1){let a=i[o];a.shadowRoot!==null&&n<Ce&&r.push(...$(a.shadowRoot,t,n+1));}return r}var Ae=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],j="[masked]";function N(e){return Ae.some(t=>(t.lastIndex=0,t.test(e)))}var re=4096,ut=100,ft=64;function q(e){if(!e)return;let t=e.slice(0,re);if(e.length>re){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,re-ut):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of Ae)n=n.replace(r,j);return n.slice(0,80)}}function z(e){return !(e.length===0||e.length>64||e.includes(":")||e.startsWith("radix-")||/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}var dt=new Set(["button","input","select","textarea","label","summary"]),mt=new Set(["button","link","menuitem","tab","option"]);function oe(e){let t=e.tagName.toLowerCase();if(dt.has(t)||t==="a"&&e.hasAttribute("href"))return true;let n=e.getAttribute("role");if(n!==null&&mt.has(n))return true;let r=e.getAttribute("contenteditable");return r===""||r==="true"}function ie(e){let t=e;for(;t!==null&&t!==t.ownerDocument.documentElement;){if(oe(t))return t;t=L(t);}return e}var pt=["data-testid","data-test","data-cy","id","name","aria-label"],gt=["data-testid","data-test","data-cy"],ht=64;function wt(e){for(let t of gt){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>ht)&&!N(r))return r}}var yt=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function Et(e){let t=L(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let i of pt){let o=t.getAttribute(i);if(o===null||i==="id"&&!z(o))continue;let a=q(o);if(a!==void 0)return {tag:n,attr:i,value:a}}let r=t.getAttribute("role");if(r!==null&&yt.has(r))return {tag:n,attr:"role",value:r};t=L(t);}}function bt(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function Y(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:bt(e)},n=q(e.textContent);n!==void 0&&(t.text=n);let r=q(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let i=q(e.getAttribute("placeholder"));i!==void 0&&(t.placeholder=i);let o=e.getAttribute("id");o!==null&&z(o)&&!N(o)&&(t.id=o);let a=e.getAttribute("role");if(a!==null){let u=a.trim();u!==""&&u.length<=ft&&!N(u)&&(t.role=u);}let s=wt(e);s!==void 0&&(t.testId=s);let l=Et(e);return l!==void 0&&(t.ancestorTag=l.tag,t.ancestorAttr=l.attr,t.ancestorValue=l.value),t}function St(e){return e.getClientRects().length>0}var Tt=50,vt=40,Ct=10,At=15,Rt=15,xt=10,_t=10,It=10,Nt=5,kt=5,Lt=.6,Pt=.7,Dt={1:.3,2:.45,3:.6,4:.75,5:.9};function K(e){return e.split(j).join(" ").replace(/\s+/g," ").trim()}function Mt(e,t){if(t===void 0)return 0;let n=K(e),r=K(t);return n===""||r===""?0:r===n?1:r.includes(n)||n.includes(r)?Lt:0}function U(e,t){return t===e?1:0}function se(e){return e.includes(j)&&K(e)===""}function Ft(e,t,n){let r=0,i=0,o=(a,s)=>{r+=a,i+=a*s;};if(e.testId!==void 0&&o(Tt,U(e.testId,t.testId)),e.text!==void 0&&K(e.text)!==""&&o(n?Ct:vt,Mt(e.text,t.text)),e.ariaLabel!==void 0&&!se(e.ariaLabel)&&o(At,U(e.ariaLabel,t.ariaLabel)),e.placeholder!==void 0&&!se(e.placeholder)&&o(_t,U(e.placeholder,t.placeholder)),e.id!==void 0&&o(Rt,U(e.id,t.id)),e.role!==void 0&&o(Nt,U(e.role,t.role)),o(xt,t.tag===e.tag?1:0),o(kt,t.siblingIndex===e.siblingIndex?1:0),e.ancestorAttr!==void 0&&e.ancestorValue!==void 0&&!se(e.ancestorValue)){let a=0;t.ancestorAttr===e.ancestorAttr&&t.ancestorValue===e.ancestorValue&&(a=t.ancestorTag===e.ancestorTag?1:Pt),o(It,a);}return r===0?0:i/r}function Ot(e,t){if(e.selector===null)return null;try{return $(t,e.selector)}catch{return null}}function $t(e,t){let n=e.core.tag,r=[];for(let i of O(t))(i.tagName.toLowerCase()===n||oe(i))&&r.push(i);return r}function Re(e,t){if(t.length===0)return {status:"not_found",reason:"no_candidates",matchCount:0};let n=Dt[e.precision],r=false,i=[];for(let a of t){if(!St(a))continue;r=true;let s=Ft(e.core,Y(a),e.dynamicText);s>=n&&i.push({element:a,score:s});}if(i=i.filter((a,s)=>{let l=i[s+1];return l===void 0?true:!(ve(a.element,l.element)&&a.score<=l.score)}),i.length===0)return {status:"not_found",reason:r?"below_threshold":"not_visible",matchCount:0};let o=e.ordinal>=1?i[e.ordinal-1]:void 0;return o===void 0?{status:"not_found",reason:"ordinal_out_of_range",matchCount:i.length}:{status:"matched",element:o.element,score:o.score,matchCount:i.length}}function xe(e,t){try{let n=Ot(e,t);if(n!==null&&n.length>0){let r=Re(e,n);if(r.status==="matched"||r.reason==="ordinal_out_of_range")return r}return Re(e,$t(e,t))}catch{return {status:"not_found",reason:"error",matchCount:0}}}var Ut=1,Z=2,Ht=5,Bt=["data-testid","data-test","data-cy"],Wt=["name","for","aria-label"],Xt=new Set(["flex","grid","block","hidden","inline","contents","table","isolate","static","fixed","absolute","relative","sticky","visible","invisible","truncate","italic","uppercase","lowercase","capitalize","antialiased","container","border","rounded","shadow","ring","outline","transition","underline","grow","shrink","sr-only"]),Vt=/^-?(?:p|px|py|pt|pr|pb|pl|m|mx|my|mt|mr|mb|ml|gap|space|w|h|min-w|min-h|max-w|max-h|inset|top|right|bottom|left|z|text|font|leading|tracking|bg|border|rounded|shadow|opacity|flex|grid|col|row|order|basis|justify|items|content|self|place|overflow|object|aspect|size|translate|scale|rotate|duration|delay|ease|transition|ring|outline|fill|stroke|divide|decoration|cursor|select|list|align|whitespace|break|animate|blur|backdrop)-(.+)$/,Gt=new Set(["xs","sm","md","lg","xl","full","auto","none","center","start","end","between","around","evenly","baseline","stretch","wrap","nowrap","reverse","col","row","bold","semibold","medium","normal","light","thin","black","white","transparent","current","scroll","clip","ellipsis","pointer","left","right","top","bottom","middle","justify","screen","fit","min","max","visible","hidden","dashed","dotted","solid","double","in","out","border","background","foreground","muted","primary","secondary","accent","destructive","card","popover","input"]);function qt(e){let t=e.startsWith("!")?e.slice(1):e;if(t.includes(":")||t.includes("[")||t.includes("]")||t.includes("/")||Xt.has(t))return true;let n=Vt.exec(t);if(n===null)return false;let r=n[1];return /\d/.test(r)?true:r.split("-").every(i=>Gt.has(i))}var jt=["css-","sc-","jss-"];function zt(e){for(let n of jt)if(e.startsWith(n))return true;let t=e.split(/[_-]/).pop()??"";return t.length>=5&&/\d/.test(t)&&/[a-z]/.test(t)&&/[A-Z]/.test(t)}function Yt(e){let t=O(e),n=new Map;for(let r of t){let i=r.classList;for(let o=0;o<i.length;o+=1){let a=i[o];n.set(a,(n.get(a)??0)+1);}}return {counts:n,total:t.length}}var Kt=10,Zt=.02;function Jt(e){return Math.max(Kt,Math.ceil(e*Zt))}var Qt=80;function ae(e,t){let n=e.getAttribute(t);return n===null||n.trim()===""||n.length>Qt||/[\n\r\t\f]/.test(n)||N(n)?null:n}function ce(e,t){return `[${e}="${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"]`}function _e(e){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(e);let t=e.replace(/[^a-zA-Z0-9_\u00A0-\uFFFF-]/g,n=>"\\"+n);return /^\d/.test(t)?t=`\\3${t[0]} ${t.slice(1)}`:/^-\d/.test(t)?t=`-\\3${t[1]} ${t.slice(2)}`:t==="-"&&(t="\\-"),t}function en(e,t,n){let r;try{r=$(e,t);}catch{return null}return r.includes(n)?r.length:null}var tn="http://www.w3.org/1999/xhtml";function Ie(e){try{return nn(e)}catch{return {candidates:[],autoSelector:null}}}function nn(e){let t=e.ownerDocument,n=e.namespaceURI===null||e.namespaceURI===tn?e.tagName.toLowerCase():e.tagName,r=[];for(let c of Bt){let f=ae(e,c);f!==null&&r.push({selector:ce(c,f),tier:Ut});}let i=e.getAttribute("id");i!==null&&z(i)&&!N(i)&&r.push({selector:`#${_e(i)}`,tier:Z});for(let c of Wt){let f=ae(e,c);f!==null&&r.push({selector:ce(c,f),tier:Z});}let o=ae(e,"role");if(o!==null&&r.push({selector:`${n}${ce("role",o)}`,tier:Z}),e.classList.length>0){let{counts:c,total:f}=Yt(t),m=Jt(f),p=e.classList,g=new Set;for(let d=0;d<p.length;d+=1){let h=p[d];g.has(h)||(g.add(h),!(qt(h)||zt(h)||N(h))&&((c.get(h)??0)>m||r.push({selector:`${n}.${_e(h)}`,tier:Ht})));}}let a=[];for(let c of r){let f=en(t,c.selector,e);f!==null&&a.push({selector:c.selector,tier:c.tier,matchCount:f});}a.sort((c,f)=>c.tier-f.tier||c.matchCount-f.matchCount);let s=a.slice(0,5),l=s[0],u=l!==void 0&&l.tier<=Z&&l.matchCount===1?l.selector:null;return {candidates:s.map(c=>c.selector),autoSelector:u}}function x(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}function rn(e){try{let n=e.currentScript?.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let i=0;i<r.length;i++){let o=r[i].nonce;if(typeof o=="string"&&o.length>0)return o}return null}catch{return null}}var on=typeof document<"u"?rn(document):null;function an(){return on}function Ne(e){let t=an();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch{}}var Le="arcy-widget",k="data-arcy",cn="2147483000",ln=[["position","fixed"],["inset","0"],["z-index",cn],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],un=[["margin","0"],["padding","0"]],ke="data-arcy-style",H=new Map;function fn(e=Le){let t=H.get(e);return t!==void 0&&t.host.isConnected}function Pe(e={}){if(typeof document>"u")return null;let t=e.id??Le,n=e.container;if(fn(t))return x("This ARCY surface is already on this page. Ignoring the second mount."),null;H.delete(t);let r=n??document.body??document.documentElement;if(!r)return x("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let i=document.querySelectorAll(`[${k}]`);for(let o=0;o<i.length;o+=1)if(i[o]?.id===t)return x("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let i=document.createElement("div");i.id=t,i.setAttribute(k,"");for(let[l,u]of ln)i.style.setProperty(l,u,"important");for(let[l,u]of un)i.style.setProperty(l,u);let o=i,a=!1;try{i.attachShadow&&(o=i.attachShadow({mode:"closed"}),a=!0);}catch{}r.appendChild(i),mn(i);let s={host:i,root:o,isolated:a,destroy(){try{i.parentNode&&i.parentNode.removeChild(i);}catch{}H.get(t)===s&&H.delete(t);}};return H.set(t,s),s}catch(i){return x(`The widget could not mount. ${String(i)}`),null}}var dn=["pointerdown","pointerup","pointercancel","mousedown","mouseup","click","dblclick","auxclick","contextmenu","touchstart","touchend","touchcancel","focusin","focusout","keydown","keyup","keypress","beforeinput","input","change","compositionstart","compositionupdate","compositionend","cut","copy","paste"];function mn(e){let t=n=>{try{n.stopPropagation();}catch{}};for(let n of dn)try{e.addEventListener(n,t);}catch{}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||pn(e.ownerDocument,e);});}catch{}}function pn(e,t){try{let n=e.activeElement;if(!n||n===t||t.contains(n)||n===e.body||n===e.documentElement)return;let r=n.blur;typeof r=="function"&&r.call(n);}catch{}}function De(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${ke}]`);if(n)return n.textContent=`${n.textContent??""}
3
- ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Ne(r),r.setAttribute(ke,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return x(`The widget could not apply its styles. ${String(n)}`),false}}var Be="[modern-screenshot]",_=typeof window<"u",gn=_&&"Worker"in window,fe=_?window.navigator?.userAgent:"",We=fe.includes("Chrome"),J=fe.includes("AppleWebKit")&&!We,de=fe.includes("Firefox"),hn=e=>e&&"__CONTEXT__"in e,wn=e=>e.constructor.name==="CSSFontFaceRule",yn=e=>e.constructor.name==="CSSImportRule",En=e=>e.constructor.name==="CSSLayerBlockRule",A=e=>e.nodeType===1,V=e=>typeof e.className=="object",Xe=e=>e.tagName==="image",bn=e=>e.tagName==="use",B=e=>A(e)&&typeof e.style<"u"&&!V(e),Sn=e=>e.nodeType===8,Tn=e=>e.nodeType===3,D=e=>e.tagName==="IMG",Q=e=>e.tagName==="VIDEO",vn=e=>e.tagName==="CANVAS",Cn=e=>e.tagName==="TEXTAREA",An=e=>e.tagName==="INPUT",Rn=e=>e.tagName==="STYLE",xn=e=>e.tagName==="SCRIPT",_n=e=>e.tagName==="SELECT",In=e=>e.tagName==="SLOT",Nn=e=>e.tagName==="IFRAME",kn=(...e)=>console.warn(Be,...e);function Ln(e){let t=e?.createElement?.("canvas");return t&&(t.height=t.width=1),!!t&&"toDataURL"in t&&!!t.toDataURL("image/webp").includes("image/webp")}var le=e=>e.startsWith("data:");function Ve(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(_&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!_)return e;let n=ee().implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function ee(e){return (e&&A(e)?e?.ownerDocument:e)??window.document}var te="http://www.w3.org/2000/svg";function Pn(e,t,n){let r=ee(n).createElementNS(te,"svg");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"viewBox",`0 0 ${e} ${t}`),r}function Dn(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function Mn(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(new Error(`Failed read blob to ${t}`)),i.readAsDataURL(e);})}var Fn=e=>Mn(e,"dataUrl");function P(e,t){let n=ee(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function W(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:o,onWarn:a}=t??{},s=typeof e=="string"?P(e,ee(i)):e,l=null,u=null;function c(){n(s),l&&clearTimeout(l),u?.();}if(r&&(l=setTimeout(c,r)),Q(s)){let f=s.currentSrc||s.src;if(!f)return s.poster?W(s.poster,t).then(n):c();if(s.readyState>=2)return c();let m=c,p=g=>{a?.("Failed video load",f,g),o?.(g),c();};u=()=>{s.removeEventListener("loadeddata",m),s.removeEventListener("error",p);},s.addEventListener("loadeddata",m,{once:true}),s.addEventListener("error",p,{once:true});}else {let f=Xe(s)?s.href.baseVal:s.currentSrc||s.src;if(!f)return c();let m=async()=>{if(D(s)&&"decode"in s)try{await s.decode();}catch(g){a?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||f,g);}c();},p=g=>{a?.("Failed image load",s.dataset.originalSrc||f,g),c();};if(D(s)&&s.complete)return m();u=()=>{s.removeEventListener("load",m),s.removeEventListener("error",p);},s.addEventListener("load",m,{once:true}),s.addEventListener("error",p,{once:true});}})}async function On(e,t){B(e)&&(D(e)||Q(e)?await W(e,t):await Promise.all(["img","video"].flatMap(n=>Array.from(e.querySelectorAll(n)).map(r=>W(r,t)))));}var Ge=(function(){let t=0,n=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return ()=>(t+=1,`u${n()}${t}`)})();function qe(e){return e?.split(",").map(t=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}var Me=0;function $n(e){let t=`${Be}[#${Me}]`;return Me++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...n)=>e&&kn(...n)}}function Un(e){return {cache:e?"no-cache":"force-cache"}}async function je(e,t){return hn(e)?e:Hn(e,{...t,autoDestruct:true})}async function Hn(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},o=!!t?.debug,a=t?.features??true,s=e.ownerDocument??(_?window.document:void 0),l=e.ownerDocument?.defaultView??(_?window:void 0),u=new Map,c={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:o,fetch:{requestInit:Un(t?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:false,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:false,...t,__CONTEXT__:true,log:$n(o),node:e,ownerDocument:s,ownerWindow:l,dpi:n===1?null:96*n,svgStyleElement:ze(s),svgDefsElement:s?.createElementNS(te,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:gn&&r&&i?i:0})].map(()=>{try{let p=new Worker(r);return p.onmessage=async g=>{let{url:d,result:h}=g.data;h?u.get(d)?.resolve?.(h):u.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));},p.onmessageerror=g=>{let{url:d}=g.data;u.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));},p}catch(p){return c.log.warn("Failed to new Worker",p),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Ln(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:u,drawImageCount:0,tasks:[],features:a,isEnable:p=>p==="restoreScrollPosition"?typeof a=="boolean"?false:a[p]??false:typeof a=="boolean"?a:a[p]??true,shadowRoots:[]};c.log.time("wait until load"),await On(e,{timeout:c.timeout,onWarn:c.log.warn}),c.log.timeEnd("wait until load");let{width:f,height:m}=Bn(e,c);return c.width=f,c.height=m,c}function ze(e){if(!e)return;let t=e.createElement("style"),n=t.ownerDocument.createTextNode(`
2
+ var be="__arcyPicker";function Se(e){return {v:1,core:e,selector:null,selectorCandidates:[],ordinal:1,precision:3,dynamicText:false}}function D(e){if(e.parentElement!==null)return e.parentElement;let t=e.parentNode;return t!==null&&"host"in t?t.host:null}function Te(e,t){let n=e;for(;n!==null;){if(n.matches(t))return n;n=D(n);}return null}function Ae(e,t){let n=t;for(;n!==null;){if(n===e)return true;n=D(n);}return false}var Ce=100;function F(e,t=0){let n=[],r=e.querySelectorAll("*");for(let i=0;i<r.length;i+=1){let o=r[i];n.push(o),o.shadowRoot!==null&&t<Ce&&n.push(...F(o.shadowRoot,t+1));}return n}function U(e,t,n=0){let r=Array.from(e.querySelectorAll(t)),i=e.querySelectorAll("*");for(let o=0;o<i.length;o+=1){let a=i[o];a.shadowRoot!==null&&n<Ce&&r.push(...U(a.shadowRoot,t,n+1));}return r}var Re=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],q="[masked]";function N(e){return Re.some(t=>(t.lastIndex=0,t.test(e)))}var re=4096,ft=100,dt=64;function j(e){if(!e)return;let t=e.slice(0,re);if(e.length>re){let r=t.search(/\s\S*$/);t=r===-1?t.slice(0,re-ft):t.slice(0,r);}let n=t.replace(/\s+/g," ").trim();if(n){for(let r of Re)n=n.replace(r,q);return n.slice(0,80)}}function z(e){return !(e.length===0||e.length>64||e.includes(":")||e.startsWith("radix-")||/^\d+$/.test(e)||/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e))}var mt=new Set(["button","input","select","textarea","label","summary"]),pt=new Set(["button","link","menuitem","tab","option"]);function oe(e){let t=e.tagName.toLowerCase();if(mt.has(t)||t==="a"&&e.hasAttribute("href"))return true;let n=e.getAttribute("role");if(n!==null&&pt.has(n))return true;let r=e.getAttribute("contenteditable");return r===""||r==="true"}function ie(e){let t=e;for(;t!==null&&t!==t.ownerDocument.documentElement;){if(oe(t))return t;t=D(t);}return e}var gt=["data-testid","data-test","data-cy","id","name","aria-label"],ht=["data-testid","data-test","data-cy"],Et=64;function yt(e){for(let t of ht){let n=e.getAttribute(t);if(n===null)continue;let r=n.trim();if(!(r===""||r.length>Et)&&!N(r))return r}}var wt=new Set(["navigation","main","banner","contentinfo","search","form","region","dialog"]);function bt(e){let t=D(e);for(;t!==null;){let n=t.tagName.toLowerCase();if(n==="body"||n==="html")return;for(let i of gt){let o=t.getAttribute(i);if(o===null||i==="id"&&!z(o))continue;let a=j(o);if(a!==void 0)return {tag:n,attr:i,value:a}}let r=t.getAttribute("role");if(r!==null&&wt.has(r))return {tag:n,attr:"role",value:r};t=D(t);}}function St(e){let t=0,n=e.previousElementSibling;for(;n!==null;)n.tagName===e.tagName&&(t+=1),n=n.previousElementSibling;return t}function Y(e){let t={tag:e.tagName.toLowerCase(),siblingIndex:St(e)},n=j(e.textContent);n!==void 0&&(t.text=n);let r=j(e.getAttribute("aria-label"));r!==void 0&&(t.ariaLabel=r);let i=j(e.getAttribute("placeholder"));i!==void 0&&(t.placeholder=i);let o=e.getAttribute("id");o!==null&&z(o)&&!N(o)&&(t.id=o);let a=e.getAttribute("role");if(a!==null){let u=a.trim();u!==""&&u.length<=dt&&!N(u)&&(t.role=u);}let s=yt(e);s!==void 0&&(t.testId=s);let l=bt(e);return l!==void 0&&(t.ancestorTag=l.tag,t.ancestorAttr=l.attr,t.ancestorValue=l.value),t}function Tt(e){return e.getClientRects().length>0}var At=50,Ct=40,Rt=10,vt=15,xt=15,_t=10,It=10,Nt=10,kt=5,Dt=5,Lt=.6,Mt=.7,Pt={1:.3,2:.45,3:.6,4:.75,5:.9};function K(e){return e.split(q).join(" ").replace(/\s+/g," ").trim()}function Ot(e,t){if(t===void 0)return 0;let n=K(e),r=K(t);return n===""||r===""?0:r===n?1:r.includes(n)||n.includes(r)?Lt:0}function $(e,t){return t===e?1:0}function se(e){return e.includes(q)&&K(e)===""}function Ft(e,t,n){let r=0,i=0,o=(a,s)=>{r+=a,i+=a*s;};if(e.testId!==void 0&&o(At,$(e.testId,t.testId)),e.text!==void 0&&K(e.text)!==""&&o(n?Rt:Ct,Ot(e.text,t.text)),e.ariaLabel!==void 0&&!se(e.ariaLabel)&&o(vt,$(e.ariaLabel,t.ariaLabel)),e.placeholder!==void 0&&!se(e.placeholder)&&o(It,$(e.placeholder,t.placeholder)),e.id!==void 0&&o(xt,$(e.id,t.id)),e.role!==void 0&&o(kt,$(e.role,t.role)),o(_t,t.tag===e.tag?1:0),o(Dt,t.siblingIndex===e.siblingIndex?1:0),e.ancestorAttr!==void 0&&e.ancestorValue!==void 0&&!se(e.ancestorValue)){let a=0;t.ancestorAttr===e.ancestorAttr&&t.ancestorValue===e.ancestorValue&&(a=t.ancestorTag===e.ancestorTag?1:Mt),o(Nt,a);}return r===0?0:i/r}function Ut(e,t){if(e.selector===null)return null;try{return U(t,e.selector)}catch{return null}}function $t(e,t){let n=e.core.tag,r=[];for(let i of F(t))(i.tagName.toLowerCase()===n||oe(i))&&r.push(i);return r}function ve(e,t){if(t.length===0)return {status:"not_found",reason:"no_candidates",matchCount:0};let n=Pt[e.precision],r=false,i=[];for(let a of t){if(!Tt(a))continue;r=true;let s=Ft(e.core,Y(a),e.dynamicText);s>=n&&i.push({element:a,score:s});}if(i=i.filter((a,s)=>{let l=i[s+1];return l===void 0?true:!(Ae(a.element,l.element)&&a.score<=l.score)}),i.length===0)return {status:"not_found",reason:r?"below_threshold":"not_visible",matchCount:0};let o=e.ordinal>=1?i[e.ordinal-1]:void 0;return o===void 0?{status:"not_found",reason:"ordinal_out_of_range",matchCount:i.length}:{status:"matched",element:o.element,score:o.score,matchCount:i.length}}function xe(e,t){try{let n=Ut(e,t);if(n!==null&&n.length>0){let r=ve(e,n);if(r.status==="matched"||r.reason==="ordinal_out_of_range")return r}return ve(e,$t(e,t))}catch{return {status:"not_found",reason:"error",matchCount:0}}}var Ht=1,Z=2,Bt=5,Wt=["data-testid","data-test","data-cy"],Xt=["name","for","aria-label"],Gt=new Set(["flex","grid","block","hidden","inline","contents","table","isolate","static","fixed","absolute","relative","sticky","visible","invisible","truncate","italic","uppercase","lowercase","capitalize","antialiased","container","border","rounded","shadow","ring","outline","transition","underline","grow","shrink","sr-only"]),Vt=/^-?(?:p|px|py|pt|pr|pb|pl|m|mx|my|mt|mr|mb|ml|gap|space|w|h|min-w|min-h|max-w|max-h|inset|top|right|bottom|left|z|text|font|leading|tracking|bg|border|rounded|shadow|opacity|flex|grid|col|row|order|basis|justify|items|content|self|place|overflow|object|aspect|size|translate|scale|rotate|duration|delay|ease|transition|ring|outline|fill|stroke|divide|decoration|cursor|select|list|align|whitespace|break|animate|blur|backdrop)-(.+)$/,jt=new Set(["xs","sm","md","lg","xl","full","auto","none","center","start","end","between","around","evenly","baseline","stretch","wrap","nowrap","reverse","col","row","bold","semibold","medium","normal","light","thin","black","white","transparent","current","scroll","clip","ellipsis","pointer","left","right","top","bottom","middle","justify","screen","fit","min","max","visible","hidden","dashed","dotted","solid","double","in","out","border","background","foreground","muted","primary","secondary","accent","destructive","card","popover","input"]);function qt(e){let t=e.startsWith("!")?e.slice(1):e;if(t.includes(":")||t.includes("[")||t.includes("]")||t.includes("/")||Gt.has(t))return true;let n=Vt.exec(t);if(n===null)return false;let r=n[1];return /\d/.test(r)?true:r.split("-").every(i=>jt.has(i))}var zt=["css-","sc-","jss-"];function Yt(e){for(let n of zt)if(e.startsWith(n))return true;let t=e.split(/[_-]/).pop()??"";return t.length>=5&&/\d/.test(t)&&/[a-z]/.test(t)&&/[A-Z]/.test(t)}function Kt(e){let t=F(e),n=new Map;for(let r of t){let i=r.classList;for(let o=0;o<i.length;o+=1){let a=i[o];n.set(a,(n.get(a)??0)+1);}}return {counts:n,total:t.length}}var Zt=10,Jt=.02;function Qt(e){return Math.max(Zt,Math.ceil(e*Jt))}var en=80;function ae(e,t){let n=e.getAttribute(t);return n===null||n.trim()===""||n.length>en||/[\n\r\t\f]/.test(n)||N(n)?null:n}function ce(e,t){return `[${e}="${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"]`}function _e(e){if(typeof CSS<"u"&&typeof CSS.escape=="function")return CSS.escape(e);let t=e.replace(/[^a-zA-Z0-9_\u00A0-\uFFFF-]/g,n=>"\\"+n);return /^\d/.test(t)?t=`\\3${t[0]} ${t.slice(1)}`:/^-\d/.test(t)?t=`-\\3${t[1]} ${t.slice(2)}`:t==="-"&&(t="\\-"),t}function tn(e,t,n){let r;try{r=U(e,t);}catch{return null}return r.includes(n)?r.length:null}var nn="http://www.w3.org/1999/xhtml";function Ie(e){try{return rn(e)}catch{return {candidates:[],autoSelector:null}}}function rn(e){let t=e.ownerDocument,n=e.namespaceURI===null||e.namespaceURI===nn?e.tagName.toLowerCase():e.tagName,r=[];for(let c of Wt){let f=ae(e,c);f!==null&&r.push({selector:ce(c,f),tier:Ht});}let i=e.getAttribute("id");i!==null&&z(i)&&!N(i)&&r.push({selector:`#${_e(i)}`,tier:Z});for(let c of Xt){let f=ae(e,c);f!==null&&r.push({selector:ce(c,f),tier:Z});}let o=ae(e,"role");if(o!==null&&r.push({selector:`${n}${ce("role",o)}`,tier:Z}),e.classList.length>0){let{counts:c,total:f}=Kt(t),m=Qt(f),p=e.classList,g=new Set;for(let d=0;d<p.length;d+=1){let h=p[d];g.has(h)||(g.add(h),!(qt(h)||Yt(h)||N(h))&&((c.get(h)??0)>m||r.push({selector:`${n}.${_e(h)}`,tier:Bt})));}}let a=[];for(let c of r){let f=tn(t,c.selector,e);f!==null&&a.push({selector:c.selector,tier:c.tier,matchCount:f});}a.sort((c,f)=>c.tier-f.tier||c.matchCount-f.matchCount);let s=a.slice(0,5),l=s[0],u=l!==void 0&&l.tier<=Z&&l.matchCount===1?l.selector:null;return {candidates:s.map(c=>c.selector),autoSelector:u}}function x(e){typeof console<"u"&&console.warn&&console.warn(`[arcy] ${e}`);}function on(e){try{let n=e.currentScript?.nonce;if(typeof n=="string"&&n.length>0)return n;let r=e.getElementsByTagName("script");for(let i=0;i<r.length;i++){let o=r[i].nonce;if(typeof o=="string"&&o.length>0)return o}return null}catch{return null}}var sn=typeof document<"u"?on(document):null;function cn(){return sn}function Ne(e){let t=cn();if(t)try{e.nonce=t,e.setAttribute("nonce",t);}catch{}}var De="arcy-widget",k="data-arcy",ln="2147483000",un=[["position","fixed"],["inset","0"],["z-index",ln],["pointer-events","none"],["background","transparent"],["border","0"],["box-shadow","none"],["outline","0"]],fn=[["margin","0"],["padding","0"]],ke="data-arcy-style",H=new Map;function dn(e=De){let t=H.get(e);return t!==void 0&&t.host.isConnected}function Le(e={}){if(typeof document>"u")return null;let t=e.id??De,n=e.container;if(dn(t))return x("This ARCY surface is already on this page. Ignoring the second mount."),null;H.delete(t);let r=n??document.body??document.documentElement;if(!r)return x("The page has no <body> to mount into yet. The widget will not render."),null;if(!n){let i=document.querySelectorAll(`[${k}]`);for(let o=0;o<i.length;o+=1)if(i[o]?.id===t)return x("Another copy of ARCY is already on this page. Ignoring this one."),null}try{let i=document.createElement("div");i.id=t,i.setAttribute(k,"");for(let[l,u]of un)i.style.setProperty(l,u,"important");for(let[l,u]of fn)i.style.setProperty(l,u);let o=i,a=!1;try{i.attachShadow&&(o=i.attachShadow({mode:"closed"}),a=!0);}catch{}r.appendChild(i),pn(i);let s={host:i,root:o,isolated:a,destroy(){try{i.parentNode&&i.parentNode.removeChild(i);}catch{}H.get(t)===s&&H.delete(t);}};return H.set(t,s),s}catch(i){return x(`The widget could not mount. ${String(i)}`),null}}var mn=["pointerdown","pointerup","pointercancel","mousedown","mouseup","click","dblclick","auxclick","contextmenu","touchstart","touchend","touchcancel","focusin","focusout","keydown","keyup","keypress","beforeinput","input","change","compositionstart","compositionupdate","compositionend","cut","copy","paste"];function pn(e){let t=n=>{try{n.stopPropagation();}catch{}};for(let n of mn)try{e.addEventListener(n,t);}catch{}try{e.addEventListener("mousedown",n=>{n.defaultPrevented||gn(e.ownerDocument,e);});}catch{}}function gn(e,t){try{let n=e.activeElement;if(!n||n===t||t.contains(n)||n===e.body||n===e.documentElement)return;let r=n.blur;typeof r=="function"&&r.call(n);}catch{}}function Me(e,t){if(!e.isolated)return false;try{let n=e.root.querySelector(`[${ke}]`);if(n)return n.textContent=`${n.textContent??""}
3
+ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Ne(r),r.setAttribute(ke,""),r.textContent=t,e.root.appendChild(r),!0}catch(n){return x(`The widget could not apply its styles. ${String(n)}`),false}}var Be="[modern-screenshot]",_=typeof window<"u",hn=_&&"Worker"in window,fe=_?window.navigator?.userAgent:"",We=fe.includes("Chrome"),J=fe.includes("AppleWebKit")&&!We,de=fe.includes("Firefox"),En=e=>e&&"__CONTEXT__"in e,yn=e=>e.constructor.name==="CSSFontFaceRule",wn=e=>e.constructor.name==="CSSImportRule",bn=e=>e.constructor.name==="CSSLayerBlockRule",R=e=>e.nodeType===1,G=e=>typeof e.className=="object",Xe=e=>e.tagName==="image",Sn=e=>e.tagName==="use",B=e=>R(e)&&typeof e.style<"u"&&!G(e),Tn=e=>e.nodeType===8,An=e=>e.nodeType===3,M=e=>e.tagName==="IMG",Q=e=>e.tagName==="VIDEO",Cn=e=>e.tagName==="CANVAS",Rn=e=>e.tagName==="TEXTAREA",vn=e=>e.tagName==="INPUT",xn=e=>e.tagName==="STYLE",_n=e=>e.tagName==="SCRIPT",In=e=>e.tagName==="SELECT",Nn=e=>e.tagName==="SLOT",kn=e=>e.tagName==="IFRAME",Dn=(...e)=>console.warn(Be,...e);function Ln(e){let t=e?.createElement?.("canvas");return t&&(t.height=t.width=1),!!t&&"toDataURL"in t&&!!t.toDataURL("image/webp").includes("image/webp")}var le=e=>e.startsWith("data:");function Ge(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(_&&e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i)||!_)return e;let n=ee().implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),t&&(r.href=t),i.href=e,i.href}function ee(e){return (e&&R(e)?e?.ownerDocument:e)??window.document}var te="http://www.w3.org/2000/svg";function Mn(e,t,n){let r=ee(n).createElementNS(te,"svg");return r.setAttributeNS(null,"width",e.toString()),r.setAttributeNS(null,"height",t.toString()),r.setAttributeNS(null,"viewBox",`0 0 ${e} ${t}`),r}function Pn(e,t){let n=new XMLSerializer().serializeToString(e);return t&&(n=n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu,"")),`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`}function On(e,t){return new Promise((n,r)=>{let i=new FileReader;i.onload=()=>n(i.result),i.onerror=()=>r(i.error),i.onabort=()=>r(new Error(`Failed read blob to ${t}`)),i.readAsDataURL(e);})}var Fn=e=>On(e,"dataUrl");function L(e,t){let n=ee(t).createElement("img");return n.decoding="sync",n.loading="eager",n.src=e,n}function W(e,t){return new Promise(n=>{let{timeout:r,ownerDocument:i,onError:o,onWarn:a}=t??{},s=typeof e=="string"?L(e,ee(i)):e,l=null,u=null;function c(){n(s),l&&clearTimeout(l),u?.();}if(r&&(l=setTimeout(c,r)),Q(s)){let f=s.currentSrc||s.src;if(!f)return s.poster?W(s.poster,t).then(n):c();if(s.readyState>=2)return c();let m=c,p=g=>{a?.("Failed video load",f,g),o?.(g),c();};u=()=>{s.removeEventListener("loadeddata",m),s.removeEventListener("error",p);},s.addEventListener("loadeddata",m,{once:true}),s.addEventListener("error",p,{once:true});}else {let f=Xe(s)?s.href.baseVal:s.currentSrc||s.src;if(!f)return c();let m=async()=>{if(M(s)&&"decode"in s)try{await s.decode();}catch(g){a?.("Failed to decode image, trying to render anyway",s.dataset.originalSrc||f,g);}c();},p=g=>{a?.("Failed image load",s.dataset.originalSrc||f,g),c();};if(M(s)&&s.complete)return m();u=()=>{s.removeEventListener("load",m),s.removeEventListener("error",p);},s.addEventListener("load",m,{once:true}),s.addEventListener("error",p,{once:true});}})}async function Un(e,t){B(e)&&(M(e)||Q(e)?await W(e,t):await Promise.all(["img","video"].flatMap(n=>Array.from(e.querySelectorAll(n)).map(r=>W(r,t)))));}var Ve=(function(){let t=0,n=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return ()=>(t+=1,`u${n()}${t}`)})();function je(e){return e?.split(",").map(t=>t.trim().replace(/"|'/g,"").toLowerCase()).filter(Boolean)}var Pe=0;function $n(e){let t=`${Be}[#${Pe}]`;return Pe++,{time:n=>e&&console.time(`${t} ${n}`),timeEnd:n=>e&&console.timeEnd(`${t} ${n}`),warn:(...n)=>e&&Dn(...n)}}function Hn(e){return {cache:e?"no-cache":"force-cache"}}async function qe(e,t){return En(e)?e:Bn(e,{...t,autoDestruct:true})}async function Bn(e,t){let{scale:n=1,workerUrl:r,workerNumber:i=1}=t||{},o=!!t?.debug,a=t?.features??true,s=e.ownerDocument??(_?window.document:void 0),l=e.ownerDocument?.defaultView??(_?window:void 0),u=new Map,c={width:0,height:0,quality:1,type:"image/png",scale:n,backgroundColor:null,style:null,filter:null,maximumCanvasSize:0,timeout:3e4,progress:null,debug:o,fetch:{requestInit:Hn(t?.fetch?.bypassingCache),placeholderImage:"data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",bypassingCache:false,...t?.fetch},fetchFn:null,font:{},drawImageInterval:100,workerUrl:null,workerNumber:i,onCloneEachNode:null,onCloneNode:null,onEmbedNode:null,onCreateForeignObjectSvg:null,includeStyleProperties:null,autoDestruct:false,...t,__CONTEXT__:true,log:$n(o),node:e,ownerDocument:s,ownerWindow:l,dpi:n===1?null:96*n,svgStyleElement:ze(s),svgDefsElement:s?.createElementNS(te,"defs"),svgStyles:new Map,defaultComputedStyles:new Map,workers:[...Array.from({length:hn&&r&&i?i:0})].map(()=>{try{let p=new Worker(r);return p.onmessage=async g=>{let{url:d,result:h}=g.data;h?u.get(d)?.resolve?.(h):u.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));},p.onmessageerror=g=>{let{url:d}=g.data;u.get(d)?.reject?.(new Error(`Error receiving message from worker: ${d}`));},p}catch(p){return c.log.warn("Failed to new Worker",p),null}}).filter(Boolean),fontFamilies:new Map,fontCssTexts:new Map,acceptOfImage:`${[Ln(s)&&"image/webp","image/svg+xml","image/*","*/*"].filter(Boolean).join(",")};q=0.8`,requests:u,drawImageCount:0,tasks:[],features:a,isEnable:p=>p==="restoreScrollPosition"?typeof a=="boolean"?false:a[p]??false:typeof a=="boolean"?a:a[p]??true,shadowRoots:[]};c.log.time("wait until load"),await Un(e,{timeout:c.timeout,onWarn:c.log.warn}),c.log.timeEnd("wait until load");let{width:f,height:m}=Wn(e,c);return c.width=f,c.height=m,c}function ze(e){if(!e)return;let t=e.createElement("style"),n=t.ownerDocument.createTextNode(`
4
4
  .______background-clip--text {
5
5
  background-clip: text;
6
6
  -webkit-background-clip: text;
7
7
  }
8
- `);return t.appendChild(n),t}function Bn(e,t){let{width:n,height:r}=t;if(A(e)&&(!n||!r)){let i=e.getBoundingClientRect();n=n||i.width||Number(e.getAttribute("width"))||0,r=r||i.height||Number(e.getAttribute("height"))||0;}return {width:n,height:r}}async function Wn(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:o}=t;n.time("image to canvas");let a=await W(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:l}=Xn(e.ownerDocument,t),u=()=>{try{l?.drawImage(a,0,0,s.width,s.height);}catch(c){t.log.warn("Failed to drawImage",c);}};if(u(),t.isEnable("fixSvgXmlDecode"))for(let c=0;c<i;c++)await new Promise(f=>{setTimeout(()=>{l?.clearRect(0,0,s.width,s.height),u(),f();},c+o);});return t.drawImageCount=0,n.timeEnd("image to canvas"),s}function Xn(e,t){let{width:n,height:r,scale:i,backgroundColor:o,maximumCanvasSize:a}=t,s=e.createElement("canvas");s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,a&&(s.width>a||s.height>a)&&(s.width>a&&s.height>a?s.width>s.height?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a):s.width>a?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a));let l=s.getContext("2d");return l&&o&&(l.fillStyle=o,l.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:l}}function Ye(e,t){if(e.ownerDocument)try{let o=e.toDataURL();if(o!=="data:,")return P(o,e.ownerDocument)}catch(o){t.log.warn("Failed to clone canvas",o);}let n=e.cloneNode(false),r=e.getContext("2d"),i=n.getContext("2d");try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(o){t.log.warn("Failed to clone canvas",o);}return n}function Vn(e,t){try{if(e?.contentDocument?.documentElement)return me(e.contentDocument.documentElement,t)}catch(n){t.log.warn("Failed to clone iframe",n);}return e.cloneNode(false)}function Gn(e){let t=e.cloneNode(false);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager"),t}async function qn(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return P(e.poster,e.ownerDocument);let n=e.cloneNode(false);n.crossOrigin="anonymous",e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=true;if(await W(n,{onError:()=>i=false,onWarn:t.log.warn}),!i)return e.poster?P(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(a=>{n.addEventListener("seeked",a,{once:true});});let o=r.createElement("canvas");o.width=e.offsetWidth,o.height=e.offsetHeight;try{let a=o.getContext("2d");a&&a.drawImage(n,0,0,o.width,o.height);}catch(a){return t.log.warn("Failed to clone video",a),e.poster?P(e.poster,e.ownerDocument):n}return Ye(o,t)}return n}function jn(e,t){return vn(e)?Ye(e,t):Nn(e)?Vn(e,t):D(e)?Gn(e):Q(e)?qn(e,t):e.cloneNode(false)}function zn(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement("iframe"),t.id=`__SANDBOX__${Ge()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",n.body.appendChild(t),t.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',e.sandbox=t);}catch(r){e.log.warn("Failed to getSandBox",r);}}return t}var Yn=["width","height","-webkit-text-fill-color"],Kn=["stroke","fill"];function Ke(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),o=V(e)&&i!=="svg",a=o?Kn.map(d=>[d,e.getAttribute(d)]).filter(([,d])=>d!==null):[],s=[o&&"svg",i,a.map((d,h)=>`${d}=${h}`).join(","),t].filter(Boolean).join(":");if(r.has(s))return r.get(s);let u=zn(n)?.contentWindow;if(!u)return new Map;let c=u?.document,f,m;o?(f=c.createElementNS(te,"svg"),m=f.ownerDocument.createElementNS(f.namespaceURI,i),a.forEach(([d,h])=>{m.setAttributeNS(null,d,h);}),f.appendChild(m)):f=m=c.createElement(i),m.textContent=" ",c.body.appendChild(f);let p=u.getComputedStyle(m,t),g=new Map;for(let d=p.length,h=0;h<d;h++){let E=p.item(h);Yn.includes(E)||g.set(E,p.getPropertyValue(E));}return c.body.removeChild(f),r.set(s,g),g}function Ze(e,t,n){let r=new Map,i=[],o=new Map;if(n)for(let s of n)a(s);else for(let s=e.length,l=0;l<s;l++){let u=e.item(l);a(u);}for(let s=i.length,l=0;l<s;l++)o.get(i[l])?.forEach((u,c)=>r.set(c,u));function a(s){let l=e.getPropertyValue(s),u=e.getPropertyPriority(s),c=s.lastIndexOf("-"),f=c>-1?s.substring(0,c):void 0;if(f){let m=o.get(f);m||(m=new Map,o.set(f,m)),m.set(s,[l,u]);}t.get(s)===l&&!u||(f?i.push(f):r.set(s,[l,u]));}return r}function Zn(e,t,n,r){let{ownerWindow:i,includeStyleProperties:o,currentParentNodeStyle:a}=r,s=t.style,l=i.getComputedStyle(e),u=Ke(e,null,r);a?.forEach((f,m)=>{u.delete(m);});let c=Ze(l,u,o);c.delete("transition-property"),c.delete("all"),c.delete("d"),c.delete("content"),n&&(c.delete("position"),c.delete("margin-top"),c.delete("margin-right"),c.delete("margin-bottom"),c.delete("margin-left"),c.delete("margin-block-start"),c.delete("margin-block-end"),c.delete("margin-inline-start"),c.delete("margin-inline-end"),c.set("box-sizing",["border-box",""])),c.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text"),We&&(c.has("font-kerning")||c.set("font-kerning",["normal",""]),(c.get("overflow-x")?.[0]==="hidden"||c.get("overflow-y")?.[0]==="hidden")&&c.get("text-overflow")?.[0]==="ellipsis"&&e.scrollWidth===e.clientWidth&&c.set("text-overflow",["clip",""]));for(let f=s.length,m=0;m<f;m++)s.removeProperty(s.item(m));return c.forEach(([f,m],p)=>{s.setProperty(p,f,m);}),c}function Jn(e,t){(Cn(e)||An(e)||_n(e))&&t.setAttribute("value",e.value);}var Qn=["::before","::after"],er=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"];function tr(e,t,n,r,i){let{ownerWindow:o,svgStyleElement:a,svgStyles:s,currentNodeStyle:l}=r;if(!a||!o)return;function u(c){let f=o.getComputedStyle(e,c),m=f.getPropertyValue("content");if(!m||m==="none")return;i?.(m),m=m.replace(/(')|(")|(counter\(.+\))/g,"");let p=[Ge()],g=Ke(e,c,r);l?.forEach((S,v)=>{g.delete(v);});let d=Ze(f,g,r.includeStyleProperties);d.delete("content"),d.delete("-webkit-locale"),d.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text");let h=[`content: '${m}';`];if(d.forEach(([S,v],C)=>{h.push(`${C}: ${S}${v?" !important":""};`);}),h.length===1)return;try{t.className=[t.className,...p].join(" ");}catch(S){r.log.warn("Failed to copyPseudoClass",S);return}let E=h.join(`
9
- `),b=s.get(E);b||(b=[],s.set(E,b)),b.push(`.${p[0]}${c}`);}Qn.forEach(u),n&&er.forEach(u);}var Fe=new Set(["symbol"]);async function Oe(e,t,n,r,i){if(A(n)&&(Rn(n)||xn(n))||r.filter&&!r.filter(n))return;Fe.has(t.nodeName)||Fe.has(n.nodeName)?r.currentParentNodeStyle=void 0:r.currentParentNodeStyle=r.currentNodeStyle;let o=await me(n,r,false,i);r.isEnable("restoreScrollPosition")&&nr(e,o),t.appendChild(o);}async function $e(e,t,n,r){let i=e.firstChild;A(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let o=i;o;o=o.nextSibling)if(!Sn(o))if(A(o)&&In(o)&&typeof o.assignedNodes=="function"){let a=o.assignedNodes();for(let s=0;s<a.length;s++)await Oe(e,t,a[s],n,r);}else await Oe(e,t,o,n,r);}function nr(e,t){if(!B(e)||!B(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,o=new DOMMatrix(i),{a,b:s,c:l,d:u}=o;o.a=1,o.b=0,o.c=0,o.d=1,o.translateSelf(-r,-n),o.a=a,o.b=s,o.c=l,o.d=u,t.style.transform=o.toString();}function rr(e,t){let{backgroundColor:n,width:r,height:i,style:o}=t,a=e.style;if(n&&a.setProperty("background-color",n,"important"),r&&a.setProperty("width",`${r}px`,"important"),i&&a.setProperty("height",`${i}px`,"important"),o)for(let s in o)a[s]=o[s];}var or=/^[\w-:]+$/;async function me(e,t,n=false,r){let{ownerDocument:i,ownerWindow:o,fontFamilies:a,onCloneEachNode:s}=t;if(i&&Tn(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&o&&A(e)&&(B(e)||V(e))){let u=await jn(e,t);if(t.isEnable("removeAbnormalAttributes")){let d=u.getAttributeNames();for(let h=d.length,E=0;E<h;E++){let b=d[E];or.test(b)||u.removeAttribute(b);}}let c=t.currentNodeStyle=Zn(e,u,n,t);n&&rr(u,t);let f=false;if(t.isEnable("copyScrollbar")){let d=[c.get("overflow-x")?.[0],c.get("overflow-y")?.[0]];f=d.includes("scroll")||(d.includes("auto")||d.includes("overlay"))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth);}let m=c.get("text-transform")?.[0],p=qe(c.get("font-family")?.[0]),g=p?d=>{m==="uppercase"?d=d.toUpperCase():m==="lowercase"?d=d.toLowerCase():m==="capitalize"&&(d=d[0].toUpperCase()+d.substring(1)),p.forEach(h=>{let E=a.get(h);E||a.set(h,E=new Set),d.split("").forEach(b=>E.add(b));});}:void 0;return tr(e,u,f,t,g),Jn(e,u),Q(e)||await $e(e,u,t,g),await s?.(u),u}let l=e.cloneNode(false);return await $e(e,l,t),await s?.(l),l}function ir(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove();}catch(t){e.log.warn("Failed to destroyContext",t);}e.sandbox=void 0;}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[];}function sr(e){let{url:t,timeout:n,responseType:r,...i}=e,o=new AbortController,a=n?setTimeout(()=>o.abort(),n):void 0;return fetch(t,{signal:o.signal,...i}).then(s=>{if(!s.ok)throw new Error("Failed fetch, not 2xx response",{cause:s});switch(r){case "arrayBuffer":return s.arrayBuffer();case "dataUrl":return s.blob().then(Fn);default:return s.text()}}).finally(()=>clearTimeout(a))}function X(e,t){let{url:n,requestType:r="text",responseType:i="text",imageDom:o}=t,a=n,{timeout:s,acceptOfImage:l,requests:u,fetchFn:c,fetch:{requestInit:f,bypassingCache:m,placeholderImage:p},font:g,workers:d,fontFamilies:h}=e;r==="image"&&(J||de)&&e.drawImageCount++;let E=u.get(n);if(!E){m&&m instanceof RegExp&&m.test(a)&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let b=r.startsWith("font")&&g&&g.minify,S=new Set;b&&r.split(";")[1].split(",").forEach(I=>{h.has(I)&&h.get(I).forEach(G=>S.add(G));});let v=b&&S.size,C={url:a,timeout:s,responseType:v?"arrayBuffer":i,headers:r==="image"?{accept:l}:void 0,...f};E={type:r,resolve:void 0,reject:void 0,response:null},E.response=(async()=>{if(c&&r==="image"){let T=await c(n);if(T)return T}return !J&&n.startsWith("http")&&d.length?new Promise((T,I)=>{d[u.size&d.length-1].postMessage({rawUrl:n,...C}),E.resolve=T,E.reject=I;}):sr(C)})().catch(T=>{if(u.delete(n),r==="image"&&p)return e.log.warn("Failed to fetch image base64, trying to use placeholder image",a),typeof p=="string"?p:p(o);throw T}),u.set(n,E);}return E.response}async function Je(e,t,n,r){if(!Qe(e))return e;for(let[i,o]of ar(e,t))try{let a=await X(n,{url:o,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(cr(i),`$1${a}$3`);}catch(a){n.log.warn("Failed to fetch css data url",i,a);}return e}function Qe(e){return /url\((['"]?)([^'"]+?)\1\)/.test(e)}var et=/url\((['"]?)([^'"]+?)\1\)/g;function ar(e,t){let n=[];return e.replace(et,(r,i,o)=>(n.push([o,Ve(o,t)]),r)),n.filter(([r])=>!le(r))}function cr(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}var lr=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function ur(e,t){return lr.map(n=>{let r=e.getPropertyValue(n);return !r||r==="none"?null:((J||de)&&t.drawImageCount++,Je(r,null,t,true).then(i=>{!i||r===i||e.setProperty(n,i,e.getPropertyPriority(n));}))}).filter(Boolean)}function fr(e,t){if(D(e)){let n=e.currentSrc||e.src;if(!le(n))return [X(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.srcset="",e.dataset.originalSrc=n,e.src=r||"");})];(J||de)&&t.drawImageCount++;}else if(V(e)&&!le(e.href.baseVal)){let n=e.href.baseVal;return [X(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.dataset.originalSrc=n,e.href.baseVal=r||"");})]}return []}function dr(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute("href")??e.getAttribute("xlink:href");if(!i)return [];let[o,a]=i.split("#");if(a){let s=`#${a}`,l=t.shadowRoots.reduce((u,c)=>u??c.querySelector(`svg ${s}`),n?.querySelector(`svg ${s}`));if(o&&e.setAttribute("href",s),r?.querySelector(s))return [];if(l)return r?.appendChild(l.cloneNode(true)),[];if(o)return [X(t,{url:o,responseType:"text"}).then(u=>{r?.insertAdjacentHTML("beforeend",u);})]}return []}function tt(e,t){let{tasks:n}=t;A(e)&&((D(e)||Xe(e))&&n.push(...fr(e,t)),bn(e)&&n.push(...dr(e,t))),B(e)&&n.push(...ur(e.style,t)),e.childNodes.forEach(r=>{tt(r,t);});}async function mr(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:o,tasks:a,font:s}=t;if(!(!n||!r||!i.size))if(s&&s.cssText){let l=He(s.cssText,t);r.appendChild(n.createTextNode(`${l}
10
- `));}else {let l=Array.from(n.styleSheets).filter(p=>{try{return "cssRules"in p&&!!p.cssRules.length}catch(g){return t.log.warn(`Error while reading CSS rules from ${p.href}`,g),false}}),u=n.implementation.createHTMLDocument(""),c=u.createElement("style");u.head.appendChild(c);let f=c.sheet;await Promise.all(l.flatMap(p=>Array.from(p.cssRules).map(async g=>{if(yn(g)){let d=g.href,h="";try{h=await X(t,{url:d,requestType:"text",responseType:"text"});}catch(b){t.log.warn(`Error fetch remote css import from ${d}`,b);}let E=h.replace(et,(b,S,v)=>b.replace(v,Ve(v,d)));for(let b of gr(E))try{f.insertRule(b,f.cssRules.length);}catch(S){t.log.warn("Error inserting rule from remote css import",{rule:b,error:S});}}}))),f.cssRules.length&&l.push(f);let m=[];l.forEach(p=>{ue(p.cssRules,m);}),m.filter(p=>wn(p)&&Qe(p.style.getPropertyValue("src"))&&qe(p.style.getPropertyValue("font-family"))?.some(g=>i.has(g))).forEach(p=>{let g=p,d=o.get(g.cssText);d?r.appendChild(n.createTextNode(`${d}
8
+ `);return t.appendChild(n),t}function Wn(e,t){let{width:n,height:r}=t;if(R(e)&&(!n||!r)){let i=e.getBoundingClientRect();n=n||i.width||Number(e.getAttribute("width"))||0,r=r||i.height||Number(e.getAttribute("height"))||0;}return {width:n,height:r}}async function Xn(e,t){let{log:n,timeout:r,drawImageCount:i,drawImageInterval:o}=t;n.time("image to canvas");let a=await W(e,{timeout:r,onWarn:t.log.warn}),{canvas:s,context2d:l}=Gn(e.ownerDocument,t),u=()=>{try{l?.drawImage(a,0,0,s.width,s.height);}catch(c){t.log.warn("Failed to drawImage",c);}};if(u(),t.isEnable("fixSvgXmlDecode"))for(let c=0;c<i;c++)await new Promise(f=>{setTimeout(()=>{l?.clearRect(0,0,s.width,s.height),u(),f();},c+o);});return t.drawImageCount=0,n.timeEnd("image to canvas"),s}function Gn(e,t){let{width:n,height:r,scale:i,backgroundColor:o,maximumCanvasSize:a}=t,s=e.createElement("canvas");s.width=Math.floor(n*i),s.height=Math.floor(r*i),s.style.width=`${n}px`,s.style.height=`${r}px`,a&&(s.width>a||s.height>a)&&(s.width>a&&s.height>a?s.width>s.height?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a):s.width>a?(s.height*=a/s.width,s.width=a):(s.width*=a/s.height,s.height=a));let l=s.getContext("2d");return l&&o&&(l.fillStyle=o,l.fillRect(0,0,s.width,s.height)),{canvas:s,context2d:l}}function Ye(e,t){if(e.ownerDocument)try{let o=e.toDataURL();if(o!=="data:,")return L(o,e.ownerDocument)}catch(o){t.log.warn("Failed to clone canvas",o);}let n=e.cloneNode(false),r=e.getContext("2d"),i=n.getContext("2d");try{return r&&i&&i.putImageData(r.getImageData(0,0,e.width,e.height),0,0),n}catch(o){t.log.warn("Failed to clone canvas",o);}return n}function Vn(e,t){try{if(e?.contentDocument?.documentElement)return me(e.contentDocument.documentElement,t)}catch(n){t.log.warn("Failed to clone iframe",n);}return e.cloneNode(false)}function jn(e){let t=e.cloneNode(false);return e.currentSrc&&e.currentSrc!==e.src&&(t.src=e.currentSrc,t.srcset=""),t.loading==="lazy"&&(t.loading="eager"),t}async function qn(e,t){if(e.ownerDocument&&!e.currentSrc&&e.poster)return L(e.poster,e.ownerDocument);let n=e.cloneNode(false);n.crossOrigin="anonymous",e.currentSrc&&e.currentSrc!==e.src&&(n.src=e.currentSrc);let r=n.ownerDocument;if(r){let i=true;if(await W(n,{onError:()=>i=false,onWarn:t.log.warn}),!i)return e.poster?L(e.poster,e.ownerDocument):n;n.currentTime=e.currentTime,await new Promise(a=>{n.addEventListener("seeked",a,{once:true});});let o=r.createElement("canvas");o.width=e.offsetWidth,o.height=e.offsetHeight;try{let a=o.getContext("2d");a&&a.drawImage(n,0,0,o.width,o.height);}catch(a){return t.log.warn("Failed to clone video",a),e.poster?L(e.poster,e.ownerDocument):n}return Ye(o,t)}return n}function zn(e,t){return Cn(e)?Ye(e,t):kn(e)?Vn(e,t):M(e)?jn(e):Q(e)?qn(e,t):e.cloneNode(false)}function Yn(e){let t=e.sandbox;if(!t){let{ownerDocument:n}=e;try{n&&(t=n.createElement("iframe"),t.id=`__SANDBOX__${Ve()}`,t.width="0",t.height="0",t.style.visibility="hidden",t.style.position="fixed",n.body.appendChild(t),t.srcdoc='<!DOCTYPE html><meta charset="UTF-8"><title></title><body>',e.sandbox=t);}catch(r){e.log.warn("Failed to getSandBox",r);}}return t}var Kn=["width","height","-webkit-text-fill-color"],Zn=["stroke","fill"];function Ke(e,t,n){let{defaultComputedStyles:r}=n,i=e.nodeName.toLowerCase(),o=G(e)&&i!=="svg",a=o?Zn.map(d=>[d,e.getAttribute(d)]).filter(([,d])=>d!==null):[],s=[o&&"svg",i,a.map((d,h)=>`${d}=${h}`).join(","),t].filter(Boolean).join(":");if(r.has(s))return r.get(s);let u=Yn(n)?.contentWindow;if(!u)return new Map;let c=u?.document,f,m;o?(f=c.createElementNS(te,"svg"),m=f.ownerDocument.createElementNS(f.namespaceURI,i),a.forEach(([d,h])=>{m.setAttributeNS(null,d,h);}),f.appendChild(m)):f=m=c.createElement(i),m.textContent=" ",c.body.appendChild(f);let p=u.getComputedStyle(m,t),g=new Map;for(let d=p.length,h=0;h<d;h++){let w=p.item(h);Kn.includes(w)||g.set(w,p.getPropertyValue(w));}return c.body.removeChild(f),r.set(s,g),g}function Ze(e,t,n){let r=new Map,i=[],o=new Map;if(n)for(let s of n)a(s);else for(let s=e.length,l=0;l<s;l++){let u=e.item(l);a(u);}for(let s=i.length,l=0;l<s;l++)o.get(i[l])?.forEach((u,c)=>r.set(c,u));function a(s){let l=e.getPropertyValue(s),u=e.getPropertyPriority(s),c=s.lastIndexOf("-"),f=c>-1?s.substring(0,c):void 0;if(f){let m=o.get(f);m||(m=new Map,o.set(f,m)),m.set(s,[l,u]);}t.get(s)===l&&!u||(f?i.push(f):r.set(s,[l,u]));}return r}function Jn(e,t,n,r){let{ownerWindow:i,includeStyleProperties:o,currentParentNodeStyle:a}=r,s=t.style,l=i.getComputedStyle(e),u=Ke(e,null,r);a?.forEach((f,m)=>{u.delete(m);});let c=Ze(l,u,o);c.delete("transition-property"),c.delete("all"),c.delete("d"),c.delete("content"),n&&(c.delete("position"),c.delete("margin-top"),c.delete("margin-right"),c.delete("margin-bottom"),c.delete("margin-left"),c.delete("margin-block-start"),c.delete("margin-block-end"),c.delete("margin-inline-start"),c.delete("margin-inline-end"),c.set("box-sizing",["border-box",""])),c.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text"),We&&(c.has("font-kerning")||c.set("font-kerning",["normal",""]),(c.get("overflow-x")?.[0]==="hidden"||c.get("overflow-y")?.[0]==="hidden")&&c.get("text-overflow")?.[0]==="ellipsis"&&e.scrollWidth===e.clientWidth&&c.set("text-overflow",["clip",""]));for(let f=s.length,m=0;m<f;m++)s.removeProperty(s.item(m));return c.forEach(([f,m],p)=>{s.setProperty(p,f,m);}),c}function Qn(e,t){(Rn(e)||vn(e)||In(e))&&t.setAttribute("value",e.value);}var er=["::before","::after"],tr=["::-webkit-scrollbar","::-webkit-scrollbar-button","::-webkit-scrollbar-thumb","::-webkit-scrollbar-track","::-webkit-scrollbar-track-piece","::-webkit-scrollbar-corner","::-webkit-resizer"];function nr(e,t,n,r,i){let{ownerWindow:o,svgStyleElement:a,svgStyles:s,currentNodeStyle:l}=r;if(!a||!o)return;function u(c){let f=o.getComputedStyle(e,c),m=f.getPropertyValue("content");if(!m||m==="none")return;i?.(m),m=m.replace(/(')|(")|(counter\(.+\))/g,"");let p=[Ve()],g=Ke(e,c,r);l?.forEach((S,A)=>{g.delete(A);});let d=Ze(f,g,r.includeStyleProperties);d.delete("content"),d.delete("-webkit-locale"),d.get("background-clip")?.[0]==="text"&&t.classList.add("______background-clip--text");let h=[`content: '${m}';`];if(d.forEach(([S,A],C)=>{h.push(`${C}: ${S}${A?" !important":""};`);}),h.length===1)return;try{t.className=[t.className,...p].join(" ");}catch(S){r.log.warn("Failed to copyPseudoClass",S);return}let w=h.join(`
9
+ `),b=s.get(w);b||(b=[],s.set(w,b)),b.push(`.${p[0]}${c}`);}er.forEach(u),n&&tr.forEach(u);}var Oe=new Set(["symbol"]);async function Fe(e,t,n,r,i){if(R(n)&&(xn(n)||_n(n))||r.filter&&!r.filter(n))return;Oe.has(t.nodeName)||Oe.has(n.nodeName)?r.currentParentNodeStyle=void 0:r.currentParentNodeStyle=r.currentNodeStyle;let o=await me(n,r,false,i);r.isEnable("restoreScrollPosition")&&rr(e,o),t.appendChild(o);}async function Ue(e,t,n,r){let i=e.firstChild;R(e)&&e.shadowRoot&&(i=e.shadowRoot?.firstChild,n.shadowRoots.push(e.shadowRoot));for(let o=i;o;o=o.nextSibling)if(!Tn(o))if(R(o)&&Nn(o)&&typeof o.assignedNodes=="function"){let a=o.assignedNodes();for(let s=0;s<a.length;s++)await Fe(e,t,a[s],n,r);}else await Fe(e,t,o,n,r);}function rr(e,t){if(!B(e)||!B(t))return;let{scrollTop:n,scrollLeft:r}=e;if(!n&&!r)return;let{transform:i}=t.style,o=new DOMMatrix(i),{a,b:s,c:l,d:u}=o;o.a=1,o.b=0,o.c=0,o.d=1,o.translateSelf(-r,-n),o.a=a,o.b=s,o.c=l,o.d=u,t.style.transform=o.toString();}function or(e,t){let{backgroundColor:n,width:r,height:i,style:o}=t,a=e.style;if(n&&a.setProperty("background-color",n,"important"),r&&a.setProperty("width",`${r}px`,"important"),i&&a.setProperty("height",`${i}px`,"important"),o)for(let s in o)a[s]=o[s];}var ir=/^[\w-:]+$/;async function me(e,t,n=false,r){let{ownerDocument:i,ownerWindow:o,fontFamilies:a,onCloneEachNode:s}=t;if(i&&An(e))return r&&/\S/.test(e.data)&&r(e.data),i.createTextNode(e.data);if(i&&o&&R(e)&&(B(e)||G(e))){let u=await zn(e,t);if(t.isEnable("removeAbnormalAttributes")){let d=u.getAttributeNames();for(let h=d.length,w=0;w<h;w++){let b=d[w];ir.test(b)||u.removeAttribute(b);}}let c=t.currentNodeStyle=Jn(e,u,n,t);n&&or(u,t);let f=false;if(t.isEnable("copyScrollbar")){let d=[c.get("overflow-x")?.[0],c.get("overflow-y")?.[0]];f=d.includes("scroll")||(d.includes("auto")||d.includes("overlay"))&&(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth);}let m=c.get("text-transform")?.[0],p=je(c.get("font-family")?.[0]),g=p?d=>{m==="uppercase"?d=d.toUpperCase():m==="lowercase"?d=d.toLowerCase():m==="capitalize"&&(d=d[0].toUpperCase()+d.substring(1)),p.forEach(h=>{let w=a.get(h);w||a.set(h,w=new Set),d.split("").forEach(b=>w.add(b));});}:void 0;return nr(e,u,f,t,g),Qn(e,u),Q(e)||await Ue(e,u,t,g),await s?.(u),u}let l=e.cloneNode(false);return await Ue(e,l,t),await s?.(l),l}function sr(e){if(e.ownerDocument=void 0,e.ownerWindow=void 0,e.svgStyleElement=void 0,e.svgDefsElement=void 0,e.svgStyles.clear(),e.defaultComputedStyles.clear(),e.sandbox){try{e.sandbox.remove();}catch(t){e.log.warn("Failed to destroyContext",t);}e.sandbox=void 0;}e.workers=[],e.fontFamilies.clear(),e.fontCssTexts.clear(),e.requests.clear(),e.tasks=[],e.shadowRoots=[];}function ar(e){let{url:t,timeout:n,responseType:r,...i}=e,o=new AbortController,a=n?setTimeout(()=>o.abort(),n):void 0;return fetch(t,{signal:o.signal,...i}).then(s=>{if(!s.ok)throw new Error("Failed fetch, not 2xx response",{cause:s});switch(r){case "arrayBuffer":return s.arrayBuffer();case "dataUrl":return s.blob().then(Fn);default:return s.text()}}).finally(()=>clearTimeout(a))}function X(e,t){let{url:n,requestType:r="text",responseType:i="text",imageDom:o}=t,a=n,{timeout:s,acceptOfImage:l,requests:u,fetchFn:c,fetch:{requestInit:f,bypassingCache:m,placeholderImage:p},font:g,workers:d,fontFamilies:h}=e;r==="image"&&(J||de)&&e.drawImageCount++;let w=u.get(n);if(!w){m&&m instanceof RegExp&&m.test(a)&&(a+=(/\?/.test(a)?"&":"?")+new Date().getTime());let b=r.startsWith("font")&&g&&g.minify,S=new Set;b&&r.split(";")[1].split(",").forEach(I=>{h.has(I)&&h.get(I).forEach(V=>S.add(V));});let A=b&&S.size,C={url:a,timeout:s,responseType:A?"arrayBuffer":i,headers:r==="image"?{accept:l}:void 0,...f};w={type:r,resolve:void 0,reject:void 0,response:null},w.response=(async()=>{if(c&&r==="image"){let T=await c(n);if(T)return T}return !J&&n.startsWith("http")&&d.length?new Promise((T,I)=>{d[u.size&d.length-1].postMessage({rawUrl:n,...C}),w.resolve=T,w.reject=I;}):ar(C)})().catch(T=>{if(u.delete(n),r==="image"&&p)return e.log.warn("Failed to fetch image base64, trying to use placeholder image",a),typeof p=="string"?p:p(o);throw T}),u.set(n,w);}return w.response}async function Je(e,t,n,r){if(!Qe(e))return e;for(let[i,o]of cr(e,t))try{let a=await X(n,{url:o,requestType:r?"image":"text",responseType:"dataUrl"});e=e.replace(lr(i),`$1${a}$3`);}catch(a){n.log.warn("Failed to fetch css data url",i,a);}return e}function Qe(e){return /url\((['"]?)([^'"]+?)\1\)/.test(e)}var et=/url\((['"]?)([^'"]+?)\1\)/g;function cr(e,t){let n=[];return e.replace(et,(r,i,o)=>(n.push([o,Ge(o,t)]),r)),n.filter(([r])=>!le(r))}function lr(e){let t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}var ur=["background-image","border-image-source","-webkit-border-image","-webkit-mask-image","list-style-image"];function fr(e,t){return ur.map(n=>{let r=e.getPropertyValue(n);return !r||r==="none"?null:((J||de)&&t.drawImageCount++,Je(r,null,t,true).then(i=>{!i||r===i||e.setProperty(n,i,e.getPropertyPriority(n));}))}).filter(Boolean)}function dr(e,t){if(M(e)){let n=e.currentSrc||e.src;if(!le(n))return [X(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.srcset="",e.dataset.originalSrc=n,e.src=r||"");})];(J||de)&&t.drawImageCount++;}else if(G(e)&&!le(e.href.baseVal)){let n=e.href.baseVal;return [X(t,{url:n,imageDom:e,requestType:"image",responseType:"dataUrl"}).then(r=>{r&&(e.dataset.originalSrc=n,e.href.baseVal=r||"");})]}return []}function mr(e,t){let{ownerDocument:n,svgDefsElement:r}=t,i=e.getAttribute("href")??e.getAttribute("xlink:href");if(!i)return [];let[o,a]=i.split("#");if(a){let s=`#${a}`,l=t.shadowRoots.reduce((u,c)=>u??c.querySelector(`svg ${s}`),n?.querySelector(`svg ${s}`));if(o&&e.setAttribute("href",s),r?.querySelector(s))return [];if(l)return r?.appendChild(l.cloneNode(true)),[];if(o)return [X(t,{url:o,responseType:"text"}).then(u=>{r?.insertAdjacentHTML("beforeend",u);})]}return []}function tt(e,t){let{tasks:n}=t;R(e)&&((M(e)||Xe(e))&&n.push(...dr(e,t)),Sn(e)&&n.push(...mr(e,t))),B(e)&&n.push(...fr(e.style,t)),e.childNodes.forEach(r=>{tt(r,t);});}async function pr(e,t){let{ownerDocument:n,svgStyleElement:r,fontFamilies:i,fontCssTexts:o,tasks:a,font:s}=t;if(!(!n||!r||!i.size))if(s&&s.cssText){let l=He(s.cssText,t);r.appendChild(n.createTextNode(`${l}
10
+ `));}else {let l=Array.from(n.styleSheets).filter(p=>{try{return "cssRules"in p&&!!p.cssRules.length}catch(g){return t.log.warn(`Error while reading CSS rules from ${p.href}`,g),false}}),u=n.implementation.createHTMLDocument(""),c=u.createElement("style");u.head.appendChild(c);let f=c.sheet;await Promise.all(l.flatMap(p=>Array.from(p.cssRules).map(async g=>{if(wn(g)){let d=g.href,h="";try{h=await X(t,{url:d,requestType:"text",responseType:"text"});}catch(b){t.log.warn(`Error fetch remote css import from ${d}`,b);}let w=h.replace(et,(b,S,A)=>b.replace(A,Ge(A,d)));for(let b of hr(w))try{f.insertRule(b,f.cssRules.length);}catch(S){t.log.warn("Error inserting rule from remote css import",{rule:b,error:S});}}}))),f.cssRules.length&&l.push(f);let m=[];l.forEach(p=>{ue(p.cssRules,m);}),m.filter(p=>yn(p)&&Qe(p.style.getPropertyValue("src"))&&je(p.style.getPropertyValue("font-family"))?.some(g=>i.has(g))).forEach(p=>{let g=p,d=o.get(g.cssText);d?r.appendChild(n.createTextNode(`${d}
11
11
  `)):a.push(Je(g.cssText,g.parentStyleSheet?g.parentStyleSheet.href:null,t).then(h=>{h=He(h,t),o.set(g.cssText,h),r.appendChild(n.createTextNode(`${h}
12
- `));}));});}}var pr=/(\/\*[\s\S]*?\*\/)/g,Ue=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function gr(e){if(e==null)return [];let t=[],n=e.replace(pr,"");for(;;){let o=Ue.exec(n);if(!o)break;t.push(o[0]);}n=n.replace(Ue,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let o=r.exec(n);if(o)i.lastIndex=r.lastIndex;else if(o=i.exec(n),o)r.lastIndex=i.lastIndex;else break;t.push(o[0]);}return t}var hr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,wr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function He(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(wr,i=>{for(;;){let[o,,a]=hr.exec(i)||[];if(!a)return "";if(a===r)return `src: ${o};`}}):e}function ue(e,t=[]){for(let n of Array.from(e))En(n)?t.push(...ue(n.cssRules)):"cssRules"in n?ue(n.cssRules,t):t.push(n);return t}var yr=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function Er(e){return yr.test(e.innerHTML)}async function br(e,t){let n=await je(e,t);if(A(n.node)&&V(n.node)&&!Er(n.node))return n.node;let{ownerDocument:r,log:i,tasks:o,svgStyleElement:a,svgDefsElement:s,svgStyles:l,font:u,progress:c,autoDestruct:f,onCloneNode:m,onEmbedNode:p,onCreateForeignObjectSvg:g}=n;i.time("clone node");let d=await me(n.node,n,true);if(a&&r){let v="";l.forEach((C,T)=>{v+=`${C.join(`,
12
+ `));}));});}}var gr=/(\/\*[\s\S]*?\*\/)/g,$e=/((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;function hr(e){if(e==null)return [];let t=[],n=e.replace(gr,"");for(;;){let o=$e.exec(n);if(!o)break;t.push(o[0]);}n=n.replace($e,"");let r=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,i=new RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})","gi");for(;;){let o=r.exec(n);if(o)i.lastIndex=r.lastIndex;else if(o=i.exec(n),o)r.lastIndex=i.lastIndex;else break;t.push(o[0]);}return t}var Er=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,yr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function He(e,t){let{font:n}=t,r=n?n?.preferredFormat:void 0;return r?e.replace(yr,i=>{for(;;){let[o,,a]=Er.exec(i)||[];if(!a)return "";if(a===r)return `src: ${o};`}}):e}function ue(e,t=[]){for(let n of Array.from(e))bn(n)?t.push(...ue(n.cssRules)):"cssRules"in n?ue(n.cssRules,t):t.push(n);return t}var wr=/\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;function br(e){return wr.test(e.innerHTML)}async function Sr(e,t){let n=await qe(e,t);if(R(n.node)&&G(n.node)&&!br(n.node))return n.node;let{ownerDocument:r,log:i,tasks:o,svgStyleElement:a,svgDefsElement:s,svgStyles:l,font:u,progress:c,autoDestruct:f,onCloneNode:m,onEmbedNode:p,onCreateForeignObjectSvg:g}=n;i.time("clone node");let d=await me(n.node,n,true);if(a&&r){let A="";l.forEach((C,T)=>{A+=`${C.join(`,
13
13
  `)} {
14
14
  ${T}
15
15
  }
16
- `;}),a.appendChild(r.createTextNode(v));}i.timeEnd("clone node"),await m?.(d),u!==false&&A(d)&&(i.time("embed web font"),await mr(d,n),i.timeEnd("embed web font")),i.time("embed node"),tt(d,n);let h=o.length,E=0,b=async()=>{for(;;){let v=o.pop();if(!v)break;try{await v;}catch(C){n.log.warn("Failed to run task",C);}c?.(++E,h);}};c?.(E,h),await Promise.all([...Array.from({length:4})].map(b)),i.timeEnd("embed node"),await p?.(d);let S=Sr(d,n);return s&&S.insertBefore(s,S.children[0]),a&&S.insertBefore(a,S.children[0]),f&&ir(n),await g?.(S),S}function Sr(e,t){let{width:n,height:r}=t,i=Pn(n,r,e.ownerDocument),o=i.ownerDocument.createElementNS(i.namespaceURI,"foreignObject");return o.setAttributeNS(null,"x","0%"),o.setAttributeNS(null,"y","0%"),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.append(e),i.appendChild(o),i}async function nt(e,t){let n=await je(e,t),r=await br(n),i=Dn(r,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=ze(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(te,"defs"),n.svgStyles.clear());let o=P(i,r.ownerDocument);return await Wn(o,n)}var Tr=.25,vr=160,Cr=28,Ar=1600,Rr=1200,xr=2,_r=26e5,Ir=36e5,Nr=8e3,kr=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],ot="[masked]",Lr="#f04e23";function pe(e){let t=e;for(let n of kr)n.lastIndex=0,t=t.replace(n,ot);return t}function rt(e){return Math.min(Math.max(e*Tr,Cr),vr)}function Pr(e,t,n){let r=rt(e.width),i=rt(e.height),o=Math.max(0,e.left-r),a=Math.max(0,e.top-i),s=Math.min(t,e.left+e.width+r),l=Math.min(n,e.top+e.height+i),u=Math.min(s-o,Ar),c=Math.min(l-a,Rr);return s-o>u&&(o+=(s-o-u)/2),l-a>c&&(a+=(l-a-c)/2),{left:o,top:a,width:Math.max(0,u),height:Math.max(0,c)}}function Dr(e){if(e instanceof HTMLTextAreaElement)return true;if(!(e instanceof HTMLInputElement))return false;let t=e.type;return t!=="checkbox"&&t!=="radio"&&t!=="hidden"&&t!=="file"}function Mr(e){return !(e instanceof Element&&e.hasAttribute(k))}function Fr(e){let t=e.ownerDocument??e,n=t.defaultView,r=t.createTreeWalker(e,(n?.NodeFilter??NodeFilter).SHOW_ELEMENT|(n?.NodeFilter??NodeFilter).SHOW_TEXT),i=[],o=r.currentNode;for(;o;){if(o.nodeType===3){let a=o.nodeValue;if(a&&a.trim()){let s=pe(a);s!==a&&(o.nodeValue=s);}}else if(o instanceof Element||o.tagName){let a=o;if(a.hasAttribute(k))i.push(a);else if(Dr(a)){let s=a instanceof HTMLInputElement&&a.type==="password",l=a.getAttribute("value")??a.value??"",u=s&&l?ot:pe(l);a instanceof HTMLTextAreaElement?(a.textContent=u,a.value=u):(a.setAttribute("value",u),a.value=u);let c=a.getAttribute("placeholder");c&&a.setAttribute("placeholder",pe(c));}}o=r.nextNode();}for(let a of i)a.parentNode?.removeChild(a);}function Or(e,t,n,r){e.save(),e.strokeStyle=Lr,e.lineWidth=2*r;let i=r;e.strokeRect((t.left-n.left)*r+i,(t.top-n.top)*r+i,t.width*r-i*2,t.height*r-i*2),e.restore();}function $r(e,t){let n=Math.min(e.devicePixelRatio||1,xr),r=t.width*t.height;return r<=0?1:Math.max(.5,Math.min(n,Math.sqrt(_r/r)))}function Ur(e,t){let n=t.createElement("canvas");n.width=Math.max(1,Math.round(e.width/2)),n.height=Math.max(1,Math.round(e.height/2));let r=n.getContext("2d");return r?(r.drawImage(e,0,0,n.width,n.height),n):null}async function it(e){try{let t=e.ownerDocument,n=t.defaultView;if(!n||!t.documentElement||!e.isConnected)return null;let r=e.getBoundingClientRect(),i={left:r.left,top:r.top,width:r.width,height:r.height};if(i.width<=0||i.height<=0)return null;let o=Pr(i,n.innerWidth,n.innerHeight);if(o.width<=0||o.height<=0)return null;let a=$r(n,o),s=-(o.left+(n.scrollX||0)),l=-(o.top+(n.scrollY||0)),u=await nt(t.documentElement,{width:o.width,height:o.height,scale:a,backgroundColor:"#ffffff",timeout:Nr,filter:Mr,onCloneNode:m=>{Fr(m);},font:{preferredFormat:"woff2"},style:{transform:`translate(${s}px, ${l}px)`,transformOrigin:"top left",width:`${n.innerWidth}px`,minHeight:`${n.innerHeight}px`,margin:"0",overflow:"visible"}}),c=u.getContext("2d");if(!c)return null;Or(c,i,o,a);let f=u.toDataURL("image/png");if(f.length>Ir){let m=Ur(u,t);if(!m)return null;f=m.toDataURL("image/png");}return f}catch{return null}}var Hr="arcy-picker",R="arcy-picker-banner",at="arcy-picker-highlight",Br=`
17
- .${R} {
16
+ `;}),a.appendChild(r.createTextNode(A));}i.timeEnd("clone node"),await m?.(d),u!==false&&R(d)&&(i.time("embed web font"),await pr(d,n),i.timeEnd("embed web font")),i.time("embed node"),tt(d,n);let h=o.length,w=0,b=async()=>{for(;;){let A=o.pop();if(!A)break;try{await A;}catch(C){n.log.warn("Failed to run task",C);}c?.(++w,h);}};c?.(w,h),await Promise.all([...Array.from({length:4})].map(b)),i.timeEnd("embed node"),await p?.(d);let S=Tr(d,n);return s&&S.insertBefore(s,S.children[0]),a&&S.insertBefore(a,S.children[0]),f&&sr(n),await g?.(S),S}function Tr(e,t){let{width:n,height:r}=t,i=Mn(n,r,e.ownerDocument),o=i.ownerDocument.createElementNS(i.namespaceURI,"foreignObject");return o.setAttributeNS(null,"x","0%"),o.setAttributeNS(null,"y","0%"),o.setAttributeNS(null,"width","100%"),o.setAttributeNS(null,"height","100%"),o.append(e),i.appendChild(o),i}async function nt(e,t){let n=await qe(e,t),r=await Sr(n),i=Pn(r,n.isEnable("removeControlCharacter"));n.autoDestruct||(n.svgStyleElement=ze(n.ownerDocument),n.svgDefsElement=n.ownerDocument?.createElementNS(te,"defs"),n.svgStyles.clear());let o=L(i,r.ownerDocument);return await Xn(o,n)}var rt=8e3;var Ar=.25,Cr=160,Rr=28,vr=1600,xr=1200,_r=2,Ir=26e5,Nr=36e5,kr=rt,Dr=[/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,/\b\d{3}-\d{2}-\d{4}\b/g,/\b\d(?:[ -]?\d){12,18}\b/g],it="[masked]",Lr="#f04e23";function pe(e){let t=e;for(let n of Dr)n.lastIndex=0,t=t.replace(n,it);return t}function ot(e){return Math.min(Math.max(e*Ar,Rr),Cr)}function Mr(e,t,n){let r=ot(e.width),i=ot(e.height),o=Math.max(0,e.left-r),a=Math.max(0,e.top-i),s=Math.min(t,e.left+e.width+r),l=Math.min(n,e.top+e.height+i),u=Math.min(s-o,vr),c=Math.min(l-a,xr);return s-o>u&&(o+=(s-o-u)/2),l-a>c&&(a+=(l-a-c)/2),{left:o,top:a,width:Math.max(0,u),height:Math.max(0,c)}}function Pr(e){if(e instanceof HTMLTextAreaElement)return true;if(!(e instanceof HTMLInputElement))return false;let t=e.type;return t!=="checkbox"&&t!=="radio"&&t!=="hidden"&&t!=="file"}function Or(e){return !(e instanceof Element&&e.hasAttribute(k))}function Fr(e){let t=e.ownerDocument??e,n=t.defaultView,r=t.createTreeWalker(e,(n?.NodeFilter??NodeFilter).SHOW_ELEMENT|(n?.NodeFilter??NodeFilter).SHOW_TEXT),i=[],o=r.currentNode;for(;o;){if(o.nodeType===3){let a=o.nodeValue;if(a&&a.trim()){let s=pe(a);s!==a&&(o.nodeValue=s);}}else if(o instanceof Element||o.tagName){let a=o;if(a.hasAttribute(k))i.push(a);else if(Pr(a)){let s=a instanceof HTMLInputElement&&a.type==="password",l=a.getAttribute("value")??a.value??"",u=s&&l?it:pe(l);a instanceof HTMLTextAreaElement?(a.textContent=u,a.value=u):(a.setAttribute("value",u),a.value=u);let c=a.getAttribute("placeholder");c&&a.setAttribute("placeholder",pe(c));}}o=r.nextNode();}for(let a of i)a.parentNode?.removeChild(a);}function Ur(e,t,n,r){e.save(),e.strokeStyle=Lr,e.lineWidth=2*r;let i=r;e.strokeRect((t.left-n.left)*r+i,(t.top-n.top)*r+i,t.width*r-i*2,t.height*r-i*2),e.restore();}function $r(e,t){let n=Math.min(e.devicePixelRatio||1,_r),r=t.width*t.height;return r<=0?1:Math.max(.5,Math.min(n,Math.sqrt(Ir/r)))}function Hr(e,t){let n=t.createElement("canvas");n.width=Math.max(1,Math.round(e.width/2)),n.height=Math.max(1,Math.round(e.height/2));let r=n.getContext("2d");return r?(r.drawImage(e,0,0,n.width,n.height),n):null}async function st(e){try{let t=e.ownerDocument,n=t.defaultView;if(!n||!t.documentElement||!e.isConnected)return null;let r=e.getBoundingClientRect(),i={left:r.left,top:r.top,width:r.width,height:r.height};if(i.width<=0||i.height<=0)return null;let o=Mr(i,n.innerWidth,n.innerHeight);if(o.width<=0||o.height<=0)return null;let a=$r(n,o),s=-(o.left+(n.scrollX||0)),l=-(o.top+(n.scrollY||0)),u=await nt(t.documentElement,{width:o.width,height:o.height,scale:a,backgroundColor:"#ffffff",timeout:kr,filter:Or,onCloneNode:m=>{Fr(m);},font:{preferredFormat:"woff2"},style:{transform:`translate(${s}px, ${l}px)`,transformOrigin:"top left",width:`${n.innerWidth}px`,minHeight:`${n.innerHeight}px`,margin:"0",overflow:"visible"}}),c=u.getContext("2d");if(!c)return null;Ur(c,i,o,a);let f=u.toDataURL("image/png");if(f.length>Nr){let m=Hr(u,t);if(!m)return null;f=m.toDataURL("image/png");}return f}catch{return null}}var Br="arcy-picker",v="arcy-picker-banner",ct="arcy-picker-highlight",Wr=`
17
+ .${v} {
18
18
  display: flex;
19
19
  align-items: center;
20
20
  gap: 10px;
@@ -26,17 +26,17 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Ne(r),r.setAtt
26
26
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.28);
27
27
  white-space: nowrap;
28
28
  }
29
- .${R}__title {
29
+ .${v}__title {
30
30
  font-weight: 600;
31
31
  margin-right: 2px;
32
32
  }
33
- .${R}__status {
33
+ .${v}__status {
34
34
  max-width: 260px;
35
35
  overflow: hidden;
36
36
  text-overflow: ellipsis;
37
37
  color: #d0d5dd;
38
38
  }
39
- .${R} button {
39
+ .${v} button {
40
40
  appearance: none;
41
41
  border: 1px solid rgba(255, 255, 255, 0.25);
42
42
  border-radius: 999px;
@@ -46,14 +46,14 @@ ${t}`,!0;let r=e.host.ownerDocument.createElement("style");return Ne(r),r.setAtt
46
46
  padding: 4px 12px;
47
47
  cursor: pointer;
48
48
  }
49
- .${R} button:hover {
49
+ .${v} button:hover {
50
50
  background: rgba(255, 255, 255, 0.1);
51
51
  }
52
- .${R} button.is-active {
52
+ .${v} button.is-active {
53
53
  background: #f04e23;
54
54
  border-color: #f04e23;
55
55
  }
56
- .${at} {
56
+ .${ct} {
57
57
  border-radius: 3px;
58
58
  }
59
- `;function st(e,t,n=[]){e.style.setProperty("position","absolute","important"),e.style.setProperty("pointer-events",t,"important");for(let[r,i]of n)e.style.setProperty(r,i,"important");}var Wr=[["box-sizing","border-box"],["border","2px solid #f04e23"],["background","rgba(240, 78, 35, 0.08)"]],Xr=[["left","50%"],["bottom","24px"]],Vr=[["transform","translateX(-50%)"]];function Gr(e){let{text:t,tag:n}=e.core;return t?`Sent "${t}" to ARCY`:`Sent <${n}> to ARCY`}function ct(e){let t=Pe({id:Hr});if(!t)return null;let n=t.host.ownerDocument,r="pick",i=false,o=null,a=0;De(t,Br);let s=n.createElement("div");s.className=at,st(s,"none");for(let[w,y]of Wr)s.style.setProperty(w,y);d();let l=n.createElement("div");l.className=R,st(l,"auto",Xr);for(let[w,y]of Vr)l.style.setProperty(w,y);let u=n.createElement("span");u.className=`${R}__title`,u.textContent="ARCY element picker";let c=n.createElement("button");c.type="button",c.textContent="Pick";let f=n.createElement("button");f.type="button",f.textContent="Browse";let m=n.createElement("span");m.className=`${R}__status`,m.textContent="Click the element you want this step to target.";let p=n.createElement("button");p.type="button",p.textContent="Exit",l.append(u,c,f,m,p),t.root.append(s,l);function g(w){r=w,c.classList.toggle("is-active",w==="pick"),f.classList.toggle("is-active",w==="browse"),m.textContent=w==="pick"?"Click the element you want this step to target.":"Browsing. Clicks work normally; switch back to pick.",w==="browse"&&d();}function d(){s.style.setProperty("display","none","important");}function h(w){try{let y=w.getBoundingClientRect();if(y.width===0&&y.height===0){d();return}s.style.setProperty("left",`${y.left}px`,"important"),s.style.setProperty("top",`${y.top}px`,"important"),s.style.setProperty("width",`${y.width}px`,"important"),s.style.setProperty("height",`${y.height}px`,"important"),s.style.setProperty("display","block","important");}catch{d();}}function E(w){return w instanceof Element&&Te(w,`[${k}]`)!==null}function b(w){if(typeof w.composedPath=="function"){let y=w.composedPath();if(y.length>0)return y[0]}return w.target}function S(){return t!==null&&t.host.isConnected?false:(ne(),true)}let v=w=>{try{if(S()||r!=="pick")return;let y=b(w);if(E(y)||!(y instanceof Element)){o=null,d();return}o=ie(y),h(o);}catch{}},C=()=>{try{if(S()||r!=="pick")return;o&&o.isConnected?h(o):d();}catch{}},T=w=>{try{if(S()||r!=="pick"||E(b(w)))return;w.preventDefault(),w.stopPropagation(),w.stopImmediatePropagation();}catch{}},I=w=>{try{if(S()||r!=="pick")return;let y=b(w);if(E(y)||(w.preventDefault(),w.stopPropagation(),w.stopImmediatePropagation(),!(y instanceof Element)))return;let M=ie(y),F=Se(Y(M)),we=Ie(M);F.selector=we.autoSelector,F.selectorCandidates=we.candidates,m.textContent=Gr(F),o=M,h(M);let ye=0;try{ye=xe(F,n).matchCount;}catch{}if(e.onPick(F,ye),e.screenshotsEnabled===!1)return;let lt=++a;it(M).then(Ee=>{if(!(!Ee||i||lt!==a))try{e.onScreenshot?.(Ee);}catch{}});}catch(y){x(`The element picker could not read that element. ${String(y)}`);}};function G(w){if(!(w instanceof Element))return false;let y=w.tagName;return y==="INPUT"||y==="TEXTAREA"||y==="SELECT"?true:w.isContentEditable===true}let ge=w=>{try{if(S())return;let y=w;if(!y.altKey||y.code!=="KeyS"&&y.key.toLowerCase()!=="s"||G(b(y)))return;y.preventDefault(),g(r==="pick"?"browse":"pick");}catch{}};function ne(){if(!i){i=true;try{n.removeEventListener("pointerdown",T,!0),n.removeEventListener("mousedown",T,!0),n.removeEventListener("mouseup",T,!0),n.removeEventListener("auxclick",T,!0),n.removeEventListener("click",I,!0),n.removeEventListener("mousemove",v,!0),n.removeEventListener("keydown",ge,!0),n.defaultView?.removeEventListener("scroll",C,!0),n.defaultView?.removeEventListener("resize",C);}catch{}t?.destroy(),t=null;}}let he=w=>{try{w.preventDefault();}catch{}};return l.addEventListener("pointerdown",he),l.addEventListener("mousedown",he),c.addEventListener("click",()=>g("pick")),f.addEventListener("click",()=>g("browse")),p.addEventListener("click",()=>{ne();try{e.onExit();}catch{}}),n.addEventListener("pointerdown",T,true),n.addEventListener("mousedown",T,true),n.addEventListener("mouseup",T,true),n.addEventListener("auxclick",T,true),n.addEventListener("click",I,true),n.addEventListener("mousemove",v,true),n.addEventListener("keydown",ge,true),n.defaultView?.addEventListener("scroll",C,true),n.defaultView?.addEventListener("resize",C),g("pick"),{destroy:ne}}var jr={contract:2,mount:e=>{try{return ct(e)}catch{return null}}};if(typeof window<"u")try{window[be]=jr;}catch{}})();
59
+ `;function at(e,t,n=[]){e.style.setProperty("position","absolute","important"),e.style.setProperty("pointer-events",t,"important");for(let[r,i]of n)e.style.setProperty(r,i,"important");}var Xr=[["box-sizing","border-box"],["border","2px solid #f04e23"],["background","rgba(240, 78, 35, 0.08)"]],Gr=[["left","50%"],["bottom","24px"]],Vr=[["transform","translateX(-50%)"]];function jr(e){let{text:t,tag:n}=e.core;return t?`Sent "${t}" to ARCY`:`Sent <${n}> to ARCY`}function lt(e){let t=Le({id:Br});if(!t)return null;let n=t.host.ownerDocument,r="pick",i=false,o=null,a=0;Me(t,Wr);let s=n.createElement("div");s.className=ct,at(s,"none");for(let[E,y]of Xr)s.style.setProperty(E,y);d();let l=n.createElement("div");l.className=v,at(l,"auto",Gr);for(let[E,y]of Vr)l.style.setProperty(E,y);let u=n.createElement("span");u.className=`${v}__title`,u.textContent="ARCY element picker";let c=n.createElement("button");c.type="button",c.textContent="Pick";let f=n.createElement("button");f.type="button",f.textContent="Browse";let m=n.createElement("span");m.className=`${v}__status`,m.textContent="Click the element you want this step to target.";let p=n.createElement("button");p.type="button",p.textContent="Exit",l.append(u,c,f,m,p),t.root.append(s,l);function g(E){r=E,c.classList.toggle("is-active",E==="pick"),f.classList.toggle("is-active",E==="browse"),m.textContent=E==="pick"?"Click the element you want this step to target.":"Browsing. Clicks work normally; switch back to pick.",E==="browse"&&d();}function d(){s.style.setProperty("display","none","important");}function h(E){try{let y=E.getBoundingClientRect();if(y.width===0&&y.height===0){d();return}s.style.setProperty("left",`${y.left}px`,"important"),s.style.setProperty("top",`${y.top}px`,"important"),s.style.setProperty("width",`${y.width}px`,"important"),s.style.setProperty("height",`${y.height}px`,"important"),s.style.setProperty("display","block","important");}catch{d();}}function w(E){return E instanceof Element&&Te(E,`[${k}]`)!==null}function b(E){if(typeof E.composedPath=="function"){let y=E.composedPath();if(y.length>0)return y[0]}return E.target}function S(){return t!==null&&t.host.isConnected?false:(ne(),true)}let A=E=>{try{if(S()||r!=="pick")return;let y=b(E);if(w(y)||!(y instanceof Element)){o=null,d();return}o=ie(y),h(o);}catch{}},C=()=>{try{if(S()||r!=="pick")return;o&&o.isConnected?h(o):d();}catch{}},T=E=>{try{if(S()||r!=="pick"||w(b(E)))return;E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation();}catch{}},I=E=>{try{if(S()||r!=="pick")return;let y=b(E);if(w(y)||(E.preventDefault(),E.stopPropagation(),E.stopImmediatePropagation(),!(y instanceof Element)))return;let P=ie(y),O=Se(Y(P)),Ee=Ie(P);O.selector=Ee.autoSelector,O.selectorCandidates=Ee.candidates,m.textContent=jr(O),o=P,h(P);let ye=0;try{ye=xe(O,n).matchCount;}catch{}if(e.onPick(O,ye),e.screenshotsEnabled===!1)return;let ut=++a;st(P).then(we=>{if(!(!we||i||ut!==a))try{e.onScreenshot?.(we);}catch{}});}catch(y){x(`The element picker could not read that element. ${String(y)}`);}};function V(E){if(!(E instanceof Element))return false;let y=E.tagName;return y==="INPUT"||y==="TEXTAREA"||y==="SELECT"?true:E.isContentEditable===true}let ge=E=>{try{if(S())return;let y=E;if(!y.altKey||y.code!=="KeyS"&&y.key.toLowerCase()!=="s"||V(b(y)))return;y.preventDefault(),g(r==="pick"?"browse":"pick");}catch{}};function ne(){if(!i){i=true;try{n.removeEventListener("pointerdown",T,!0),n.removeEventListener("mousedown",T,!0),n.removeEventListener("mouseup",T,!0),n.removeEventListener("auxclick",T,!0),n.removeEventListener("click",I,!0),n.removeEventListener("mousemove",A,!0),n.removeEventListener("keydown",ge,!0),n.defaultView?.removeEventListener("scroll",C,!0),n.defaultView?.removeEventListener("resize",C);}catch{}t?.destroy(),t=null;}}let he=E=>{try{E.preventDefault();}catch{}};return l.addEventListener("pointerdown",he),l.addEventListener("mousedown",he),c.addEventListener("click",()=>g("pick")),f.addEventListener("click",()=>g("browse")),p.addEventListener("click",()=>{ne();try{e.onExit();}catch{}}),n.addEventListener("pointerdown",T,true),n.addEventListener("mousedown",T,true),n.addEventListener("mouseup",T,true),n.addEventListener("auxclick",T,true),n.addEventListener("click",I,true),n.addEventListener("mousemove",A,true),n.addEventListener("keydown",ge,true),n.defaultView?.addEventListener("scroll",C,true),n.defaultView?.addEventListener("resize",C),g("pick"),{destroy:ne}}var zr={contract:2,mount:e=>{try{return lt(e)}catch{return null}}};if(typeof window<"u")try{window[be]=zr;}catch{}})();
@@ -2703,25 +2703,45 @@ var CHAT_CSS = TOOLTIP_CSS + `
2703
2703
  min-height: 34px;
2704
2704
  }
2705
2705
 
2706
+ /* Painted in the operator's brand, not in neutral grey (D1478). These pills
2707
+ are the first thing a visitor is invited to touch, and a grey outline on a
2708
+ welcome screen reads as chrome rather than as an offer. Tinted rather than
2709
+ filled, the same brand-on-brand-wash pair the transcript already uses for a
2710
+ pressed rating: up to five of these sit in one row, and five solid brand
2711
+ buttons would fight both each other and the send button below them. The
2712
+ brand colour therefore lands on the border, on the wash behind the label,
2713
+ and on the label itself, all derived from the one token the operator set. */
2706
2714
  .${STARTER_CLASS} {
2707
2715
  appearance: none;
2708
2716
  text-align: left;
2709
2717
  font: inherit;
2710
2718
  font-size: 12.5px;
2719
+ font-weight: 500;
2711
2720
  cursor: pointer;
2712
2721
  padding: 7px 13px;
2713
2722
  border-radius: 999px;
2714
- border: 1px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 14%, transparent);
2715
- background: transparent;
2716
- color: inherit;
2723
+ border: 1px solid color-mix(in srgb, var(--_arcy-brand-bg, #101828) 28%, transparent);
2724
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 8%, transparent);
2725
+ color: var(--_arcy-brand-bg, #101828);
2717
2726
  max-width: 100%;
2718
2727
  transition: background 120ms ease, border-color 120ms ease;
2719
2728
  -webkit-tap-highlight-color: transparent;
2720
2729
  }
2721
2730
 
2722
2731
  .${STARTER_CLASS}:hover {
2723
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 9%, transparent);
2724
- border-color: color-mix(in srgb, var(--_arcy-main-text, #101828) 30%, transparent);
2732
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 16%, transparent);
2733
+ border-color: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 48%, transparent);
2734
+ }
2735
+
2736
+ .${STARTER_CLASS}:active {
2737
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 24%, transparent);
2738
+ }
2739
+
2740
+ /* Brand rather than "currentColor", so the ring stays the same colour on a
2741
+ pill whose label the host page has managed to restyle. */
2742
+ .${STARTER_CLASS}:focus-visible {
2743
+ outline: 2px solid var(--_arcy-brand-bg, #101828);
2744
+ outline-offset: 2px;
2725
2745
  }
2726
2746
 
2727
2747
  @media (prefers-reduced-motion: reduce) {
@@ -3055,9 +3075,6 @@ function mount(context) {
3055
3075
  flowOffers: result.flowsOffered
3056
3076
  });
3057
3077
  context.touchConversation?.();
3058
- if (result.isFallback) {
3059
- context.track?.("fallback_triggered", {}, { question: text });
3060
- }
3061
3078
  for (const offer of result.flowsOffered) {
3062
3079
  context.track?.(
3063
3080
  "flow_suggested",
@@ -3496,7 +3513,7 @@ function mount(context) {
3496
3513
  historyDrawer.close();
3497
3514
  },
3498
3515
  onSelect: (conversationId) => {
3499
- if ((context.getConversationId?.() ?? "") === conversationId) {
3516
+ if ((context.getConversationId?.() ?? "") === conversationId && !transcript.isEmpty()) {
3500
3517
  historyDrawer.close();
3501
3518
  return;
3502
3519
  }
@@ -3720,11 +3737,13 @@ function mount(context) {
3720
3737
  renderWelcome();
3721
3738
  };
3722
3739
  let catalogRequested = false;
3740
+ let catalogAudience = null;
3723
3741
  const requestFlowCatalog = () => {
3724
3742
  if (catalogRequested) return true;
3725
3743
  const sessionToken = context.getSessionToken?.();
3726
3744
  if (!sessionToken) return false;
3727
3745
  catalogRequested = true;
3746
+ catalogAudience = widget()?.audience || null;
3728
3747
  void fetchFlowCatalog({
3729
3748
  apiBase: context.apiBase,
3730
3749
  sessionToken,
@@ -3795,6 +3814,11 @@ function mount(context) {
3795
3814
  fillCard.reposition();
3796
3815
  },
3797
3816
  refreshChrome() {
3817
+ const audience = widget()?.audience || null;
3818
+ if (catalogRequested && audience !== null && catalogAudience !== null && audience !== catalogAudience && transcript.isEmpty()) {
3819
+ catalogRequested = false;
3820
+ starterFlowsPending = true;
3821
+ }
3798
3822
  if (!requestFlowCatalog() && starterFlowsPending) {
3799
3823
  settleStarterFlows([]);
3800
3824
  }
@@ -8,6 +8,7 @@ var DESIGN_MODE_READY = "arcy:design-mode:ready";
8
8
  var DESIGN_MODE_PICK = "arcy:design-mode:pick";
9
9
  var DESIGN_MODE_EXIT = "arcy:design-mode:exit";
10
10
  var DESIGN_MODE_SCREENSHOT = "arcy:design-mode:screenshot";
11
+ var SCREENSHOT_RENDER_BUDGET_MS = 8e3;
11
12
  var TAG_MAX = 64;
12
13
  var ROUTE_MAX = 2048;
13
14
  var SELECTOR_MAX = 512;
@@ -119,4 +120,4 @@ function readDesignModeMessage(data) {
119
120
  }
120
121
  }
121
122
 
122
- export { DESIGN_MODE_EXIT, DESIGN_MODE_PICK, DESIGN_MODE_PROTOCOL, DESIGN_MODE_READY, DESIGN_MODE_SCREENSHOT, readDesignModeMessage };
123
+ export { DESIGN_MODE_EXIT, DESIGN_MODE_PICK, DESIGN_MODE_PROTOCOL, DESIGN_MODE_READY, DESIGN_MODE_SCREENSHOT, SCREENSHOT_RENDER_BUDGET_MS, readDesignModeMessage };
@@ -15,6 +15,7 @@ var DESIGN_MODE_READY = "arcy:design-mode:ready";
15
15
  var DESIGN_MODE_PICK = "arcy:design-mode:pick";
16
16
  var DESIGN_MODE_EXIT = "arcy:design-mode:exit";
17
17
  var DESIGN_MODE_SCREENSHOT = "arcy:design-mode:screenshot";
18
+ var SCREENSHOT_RENDER_BUDGET_MS = 8e3;
18
19
  var TAG_MAX = 64;
19
20
  var ROUTE_MAX = 2048;
20
21
  var SELECTOR_MAX = 512;
@@ -132,4 +133,5 @@ exports.DESIGN_MODE_PROTOCOL = DESIGN_MODE_PROTOCOL;
132
133
  exports.DESIGN_MODE_READY = DESIGN_MODE_READY;
133
134
  exports.DESIGN_MODE_SCREENSHOT = DESIGN_MODE_SCREENSHOT;
134
135
  exports.MASK = MASK;
136
+ exports.SCREENSHOT_RENDER_BUDGET_MS = SCREENSHOT_RENDER_BUDGET_MS;
135
137
  exports.readDesignModeMessage = readDesignModeMessage;
@@ -145,6 +145,24 @@ declare const DESIGN_MODE_EXIT = "arcy:design-mode:exit";
145
145
  * so this needed no `DESIGN_MODE_PROTOCOL` bump to add.
146
146
  */
147
147
  declare const DESIGN_MODE_SCREENSHOT = "arcy:design-mode:screenshot";
148
+ /**
149
+ * How long the widget may spend rasterizing before it gives up on a
150
+ * screenshot, in milliseconds. Part of the wire contract, not an internal
151
+ * detail of `screenshot.ts`, because the receiver has to wait at least this
152
+ * long before deciding no screenshot is coming (D1476).
153
+ *
154
+ * It lives here so both halves read one number. When they did not, the
155
+ * dashboard closed the picker tab two seconds after the pick while the
156
+ * rasterizer was still working, and every screenshot on a page of ordinary
157
+ * weight was lost: the tab died mid-render and the message was never posted.
158
+ * The gap opened the day the rasterizer changed (ADR 0157). The old one
159
+ * copied a property list onto absolutely positioned boxes and finished in
160
+ * well under a second; the one that replaced it clones the whole document
161
+ * with its computed styles, its pseudo-elements and its web fonts embedded as
162
+ * data URLs, which on a real marketing page takes several. Nobody revisited
163
+ * the two seconds, because nothing in either file mentioned the other.
164
+ */
165
+ declare const SCREENSHOT_RENDER_BUDGET_MS = 8000;
148
166
  interface DesignModeReady {
149
167
  type: typeof DESIGN_MODE_READY;
150
168
  protocol: number;
@@ -194,4 +212,4 @@ type DesignModeMessage = DesignModeReady | DesignModePick | DesignModeExit | Des
194
212
  */
195
213
  declare function readDesignModeMessage(data: unknown): DesignModeMessage | null;
196
214
 
197
- export { DESIGN_MODE_EXIT, DESIGN_MODE_PICK, DESIGN_MODE_PROTOCOL, DESIGN_MODE_READY, DESIGN_MODE_SCREENSHOT, type DesignModeExit, type DesignModeMessage, type DesignModePick, type DesignModeReady, type DesignModeScreenshot, MASK, readDesignModeMessage };
215
+ export { DESIGN_MODE_EXIT, DESIGN_MODE_PICK, DESIGN_MODE_PROTOCOL, DESIGN_MODE_READY, DESIGN_MODE_SCREENSHOT, type DesignModeExit, type DesignModeMessage, type DesignModePick, type DesignModeReady, type DesignModeScreenshot, MASK, SCREENSHOT_RENDER_BUDGET_MS, readDesignModeMessage };
@@ -1,2 +1,2 @@
1
- export { DESIGN_MODE_EXIT, DESIGN_MODE_PICK, DESIGN_MODE_PROTOCOL, DESIGN_MODE_READY, DESIGN_MODE_SCREENSHOT, readDesignModeMessage } from './chunk-7VVKR3AO.js';
1
+ export { DESIGN_MODE_EXIT, DESIGN_MODE_PICK, DESIGN_MODE_PROTOCOL, DESIGN_MODE_READY, DESIGN_MODE_SCREENSHOT, SCREENSHOT_RENDER_BUDGET_MS, readDesignModeMessage } from './chunk-GDGE3HLE.js';
2
2
  export { MASK } from './chunk-NY3NXM2V.js';
@@ -398,6 +398,21 @@ var ActiveRun = class {
398
398
  /** ADR 0166: true while a fill question is awaiting the end user's
399
399
  * answer. Suspends trigger evaluation for the duration. */
400
400
  this.inputPending = false;
401
+ /**
402
+ * True from the moment a step is entered until its own action has
403
+ * settled. Suspends trigger evaluation for exactly that window, the same
404
+ * posture `inputPending` takes around a fill question.
405
+ *
406
+ * **This is what makes a step's type mean anything.** The builder's
407
+ * default condition for a new trigger is `always_true` with no wait
408
+ * (`flow-draft.ts`'s `newTrigger`), so the ordinary way to say "then go to
409
+ * step 2" is a trigger that is true the instant the step mounts. Without
410
+ * this flag `startWatch`'s initial pass fired that trigger before the step
411
+ * had clicked, filled or navigated anything, and the action never ran at
412
+ * all: a two-step flow counted to step 2 and quietly ended, having done
413
+ * nothing. A step acts first; its triggers are how it is left.
414
+ */
415
+ this.actionPending = false;
401
416
  /** Extra capture-phase listeners `startWatch` installs alongside the
402
417
  * click listener (D1297): typing, focus moves and checkbox flips change
403
418
  * nothing a MutationObserver can see, yet `text_input`, `is_focused`
@@ -534,6 +549,7 @@ var ActiveRun = class {
534
549
  }
535
550
  this.activityListeners = [];
536
551
  this.inputPending = false;
552
+ this.actionPending = false;
537
553
  this.trueSince.clear();
538
554
  this.clicked.clear();
539
555
  this.initialValues.clear();
@@ -623,7 +639,7 @@ var ActiveRun = class {
623
639
  }
624
640
  checkTriggers(step, ctx) {
625
641
  if (this.stopped) return;
626
- if (this.inputPending) return;
642
+ const mayFire = !this.inputPending && !this.actionPending;
627
643
  const now = this.now();
628
644
  for (const trigger of [...step.triggers].sort((a, b) => a.position - b.position)) {
629
645
  const parsed = this.parsedTrigger(trigger);
@@ -637,7 +653,7 @@ var ActiveRun = class {
637
653
  const since = this.trueSince.get(key) ?? now;
638
654
  if (!this.trueSince.has(key)) this.trueSince.set(key, since);
639
655
  const waitMs = (trigger.waitSeconds ?? 0) * 1e3;
640
- if (now - since >= waitMs) {
656
+ if (now - since >= waitMs && mayFire) {
641
657
  this.fireTrigger(trigger);
642
658
  return;
643
659
  }
@@ -723,8 +739,7 @@ var ActiveRun = class {
723
739
  }
724
740
  this.checkTriggers(step, this.conditionContext());
725
741
  }
726
- async runExecutor(step) {
727
- const startIndex = this.stepIndex;
742
+ async runExecutor(step, startIndex) {
728
743
  try {
729
744
  const outcome = await this.executor(step, {
730
745
  doc: this.doc,
@@ -736,6 +751,7 @@ var ActiveRun = class {
736
751
  }
737
752
  });
738
753
  if (this.stopped || this.stepIndex !== startIndex) return;
754
+ this.actionPending = false;
739
755
  if (outcome.status === "advance") {
740
756
  this.emit("flow_step_completed");
741
757
  if (step.isCompletion) {
@@ -780,11 +796,14 @@ var ActiveRun = class {
780
796
  );
781
797
  return;
782
798
  }
799
+ this.scheduleCheck(step);
783
800
  } catch {
801
+ this.actionPending = false;
784
802
  }
785
803
  }
786
804
  enterStep() {
787
805
  const step = this.currentStep();
806
+ const stepIndex = this.stepIndex;
788
807
  if (!step || this.stopped) {
789
808
  this.finish(step ? "completed" : "error", step ? void 0 : { reason: "missing_step" });
790
809
  return;
@@ -799,8 +818,9 @@ var ActiveRun = class {
799
818
  });
800
819
  const begin = () => {
801
820
  if (this.stopped) return;
821
+ this.actionPending = true;
802
822
  this.startWatch(step);
803
- void this.runExecutor(step);
823
+ void this.runExecutor(step, stepIndex);
804
824
  };
805
825
  this.waitForPageReady(begin);
806
826
  }