@mindstudio-ai/browser-agent 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var __MindStudioBrowserAgent=(()=>{var jt=Object.defineProperty;var
|
|
2
|
-
`);let o=r.length>0?t+1:t;return i+=Kt(e.children,o),i}function qn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e instanceof Error)return e.stack||e.message||String(e);if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function q(e){return new Promise(t=>setTimeout(t,e))}var Ri=["log","info","warn","error","debug"];function jn(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of Ri){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),Q({type:"console",level:e,args:n.map(qn),url:location.href})}}}}function zn(){window.addEventListener("error",e=>{zt({type:"error",message:e.message,stack:e.error&&e.error.stack||"",source:e.filename,line:e.lineno,column:e.colno,url:location.href})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason||{};zt({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})})}function Vn(){if(!window.fetch||window.fetch.__ms_patched)return;let e=window.fetch;window.fetch=function(t,n){let r=(n?.method||"GET").toUpperCase(),i=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(i.includes("/__mindstudio_dev__/"))return e.apply(this,[t,n]);let o=Date.now();return mt(),e.apply(this,[t,n]).then(a=>{Xe();let c={type:"network",method:r,url:i,status:a.status,statusText:a.statusText,duration:Date.now()-o,ok:a.ok};if(a.ok)Q(c);else try{a.clone().text().then(l=>{c.body=l.slice(0,1e3),Q(c)}).catch(()=>Q(c))}catch{Q(c)}return a},a=>{throw Xe(),Q({type:"network",method:r,url:i,error:a.message||String(a),duration:Date.now()-o,ok:!1}),a})},window.fetch.__ms_patched=!0}function Xn(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);Q({type:"interaction",event:"click",target:ee(t),text:n,url:location.href})},!0))}function Yn(){if(XMLHttpRequest.prototype.open.__ms_patched)return;let e=window.XMLHttpRequest,t=e.prototype.open,n=e.prototype.send;e.prototype.open=function(r,i,...o){return this.__ms_method=r.toUpperCase(),this.__ms_url=String(i),t.apply(this,[r,i,...o])},e.prototype.send=function(r){let i=this.__ms_method||"GET",o=this.__ms_url||"";if(o.includes("/__mindstudio_dev__/"))return n.apply(this,[r]);let a=Date.now();return mt(),this.addEventListener("loadend",function(){Xe(),Q({type:"network",method:i,url:o,status:this.status,statusText:this.statusText,duration:Date.now()-a,ok:this.status>=200&&this.status<300,...this.status>=400?{body:(this.responseText||"").slice(0,1e3)}:{},via:"xhr"})}),n.apply(this,[r])},XMLHttpRequest.prototype.open.__ms_patched=!0}function we(e){let t=null;if(e.ref){let n=pt(),r=n.get(e.ref);if(r&&r.isConnected)if(de(r))t={element:r,matched:`${ee(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${Jt(r)}). It may be inside a closed dialog or collapsed section.`);else{let i=[...n.entries()].filter(([,o])=>o.isConnected&&de(o)).slice(0,10).map(([o,a])=>`${ee(a)} [ref=${o}]`).join(", ");throw new Error(`Element [ref=${e.ref}] not found. `+(i?`Available refs: ${i}`:"No refs available \u2014 take a snapshot first."))}}if(!t&&(e.text||e.role&&e.text)){let n=e.text,r=e.role,i=Gn(n,r);if(i.length===0){let o=Gn(n,r,!0);if(o.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${Jt(o[0])}). Wait for it to become visible or check if a dialog/modal needs to be opened first.`);let a=r?`${r} "${n}"`:`"${n}"`,c=Kn(r);throw new Error(`No element found matching ${a}. `+(c?`Visible ${r||"element"}s: ${c}`:"The page may still be loading \u2014 try a wait command first."))}if(i.length>1){let o=i.filter(Jn),a=o.length===1?o[0]:i[0];t={element:a,matched:ee(a)}}else t={element:i[0],matched:ee(i[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=_i(n);if(r.length===0){let i=Kn(n);throw new Error(`No visible element with role "${n}" found. `+(i?`Visible ${n}s: ${i}`:"The page may still be loading \u2014 try a wait command first."))}t={element:r[0],matched:ee(r[0])}}if(!t&&e.label){let n=e.label,r=Pi(n);if(!r){let i=[...document.querySelectorAll("label")].filter(de).map(o=>`"${(o.textContent||"").trim().slice(0,40)}"`).slice(0,8).join(", ");throw new Error(`No input found with label "${n}". `+(i?`Visible labels: ${i}`:"No labels found on the page."))}t={element:r,matched:`${ee(r)} via label "${n}"`}}if(!t&&e.selector){let n=e.selector,r=document.querySelector(n);if(!r)throw new Error(`No element found for selector "${n}".`);if(!de(r))throw new Error(`Found element for selector "${n}" but it is hidden (${Jt(r)}).`);t={element:r,matched:`${ee(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t}function Gn(e,t,n=!1){let r=[],i=e.toLowerCase();for(let o of document.querySelectorAll("*")){if(!n&&!de(o)||n&&!o.isConnected||t&&Ee(o)!==t)continue;if(Re(o).toLowerCase().includes(i)){r.push(o);continue}o.children.length||(o.textContent||"").trim().toLowerCase().includes(i)&&r.push(o)}return r}function _i(e){let t=[];for(let n of document.querySelectorAll("*"))de(n)&&Ee(n)===e&&t.push(n);return t}function Pi(e){let t=e.toLowerCase();for(let n of document.querySelectorAll("label")){if(!(n.textContent||"").trim().toLowerCase().includes(t))continue;let i=n.getAttribute("for");if(i){let a=document.getElementById(i);if(a&&de(a))return a}let o=n.querySelector("input, textarea, select");if(o&&de(o))return o}return null}function de(e){if(!e.isConnected)return!1;try{let t=getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden")return!1}catch{return!1}return!0}function Jn(e){if(e.matches('a, button, input, textarea, select, [role="button"], [role="link"], [tabindex]'))return!0;try{return getComputedStyle(e).cursor==="pointer"}catch{return!1}}function Jt(e){try{let t=getComputedStyle(e);if(t.display==="none")return"display: none";if(t.visibility==="hidden")return"visibility: hidden"}catch{}return e.getAttribute("aria-hidden")==="true"?'aria-hidden="true"':"hidden"}function Kn(e){let t=[];for(let n of document.querySelectorAll("*"))if(de(n)&&(e?Ee(n)===e&&t.push(n):Jn(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${Re(n).slice(0,40)||ee(n)}"`).join(", ")}function Zt(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i={bubbles:!0,cancelable:!0,clientX:n,clientY:r,button:0};e.dispatchEvent(new PointerEvent("pointerdown",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mousedown",i)),e instanceof HTMLElement&&e.focus(),e.dispatchEvent(new PointerEvent("pointerup",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mouseup",i)),e.dispatchEvent(new MouseEvent("click",i))}var Fi=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,Ii=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function er(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),Zt(e),n.clear&&(Zn(e,""),e.dispatchEvent(new Event("input",{bubbles:!0})));for(let r=0;r<t.length;r++){let i=t[r];e.dispatchEvent(new KeyboardEvent("keydown",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keypress",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),Zn(e,e.value+i),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keyup",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),await q(Di(i))}e.dispatchEvent(new Event("change",{bubbles:!0}))}function Di(e){let t=Math.random()*50-25;return e===" "?120+t:/[.,!?;:\-]/.test(e)?140+t:/[A-Z]/.test(e)?115+t:85+t}function Zn(e,t){let n=e instanceof HTMLTextAreaElement?Ii:Fi;n?n.call(e,t):e.value=t}async function tr(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...we(e),elapsed:Date.now()-n}}catch{await q(100)}let i=e.text?`"${e.text}"`:e.role?`role "${e.role}"`:e.selector?`selector "${e.selector}"`:"element";throw new Error(`Timed out waiting for ${i} after ${t}ms`)}var Qn=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function nr(e,t){if(!(e instanceof HTMLSelectElement))throw new Error("select command requires a <select> element");let n=t.toLowerCase(),r=null;for(let i of e.options)if(i.text.toLowerCase().includes(n)||i.value.toLowerCase()===n||i.label.toLowerCase().includes(n)){r=i;break}if(!r){let i=[...e.options].map(o=>`"${o.text}"`).join(", ");throw new Error(`No option matching "${t}" in select. Available options: ${i}`)}return Qn?Qn.call(e,r.value):e.value=r.value,e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new Event("input",{bubbles:!0})),r.text}async function rr(e){try{let n=!/\b(return|;|\{)\b/.test(e.trim())?`return (${e})`:e,i=new Function(n)();return i instanceof Promise?await i:i}catch(t){throw new Error(`evaluate failed: ${t instanceof Error?t.message:String(t)}`)}}var Oi=Object.defineProperty,K=(e,t)=>()=>(e&&(t=e(e=0)),t),et=(e,t)=>{for(var n in t)Oi(e,n,{get:t[n],enumerable:!0})};function Wi(e){if(e===!0)return"soft";if(e===!1)return"disabled";if(typeof e=="string"){let t=e.toLowerCase().trim();if(t==="auto")return"auto";if(t==="full")return"full";if(t==="soft"||t==="disabled")return t}return"soft"}function Bi(e="soft"){switch(C.session.__counterEpoch=(C.session.__counterEpoch||0)+1,e){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.baseStyle=new te(50),C.defaultStyle=new te(30),C.image=new te(100),C.background=new te(100),C.resource=new te(150),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var te,C,re=K(()=>{te=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let n=this.keys().next().value;n!==void 0&&this.delete(n)}return super.set(e,t)}},C={image:new te(100),background:new te(100),resource:new te(150),defaultStyle:new te(30),baseStyle:new te(50),computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function hn(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function Ui(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function St(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function qi(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let n=t||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(e,n).href}catch{return e}}var Ct=K(()=>{});function ji(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(a,c,l){if(i>=n)return;let s=Date.now();(r.get(c)||0)>s||(r.set(c,s+t),i++,a==="warn"&&console&&console.warn?console.warn(`${e} ${l}`):console&&console.error&&console.error(`${e} ${l}`))}return{warnOnce(a,c){o("warn",a,c)},errorOnce(a,c){o("error",a,c)},reset(){r.clear(),i=0}}}function zi(e){return/^data:|^blob:|^about:blank$/i.test(e)}function Vi(e,t){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=t.includes("{url}")?t.split("{url}")[0]:t,i=new URL(r||".",n),o=new URL(e,n);if(o.origin===i.origin)return!0;let a=o.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function Xi(e,t){if(!t||zi(e)||Vi(e,t))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(e,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!t}}function Yi(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",St(e)).replace("{url}",encodeURIComponent(e));if(/[?&]url=?$/.test(t))return`${t}${encodeURIComponent(e)}`;if(t.endsWith("?"))return`${t}url=${encodeURIComponent(e)}`;if(t.endsWith("/"))return`${t}${St(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function or(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(e)})}function Gi(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function ne(e,t={}){let n=t.as??"blob",r=t.timeout??3e3,i=t.useProxy||"",o=t.errorTTL??8e3,a=t.headers||{},c=!!t.silent;if(/^data:/i.test(e))try{if(n==="text")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,m="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(m)?atob(y):decodeURIComponent(y),b=new Uint8Array([...x].map(E=>E.charCodeAt(0))),w=new Blob([b],{type:(m||"").split(";")[0]||""});return{ok:!0,data:w,status:200,url:e,fromCache:!1,mime:w.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let m=await fetch(e);if(!m.ok)return{ok:!1,data:null,status:m.status,url:e,fromCache:!1,reason:"http_error"};let y=await m.blob(),x=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await or(y),status:m.status,url:e,fromCache:!1,mime:x}:n==="text"?{ok:!0,data:await y.text(),status:m.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:m.status,url:e,fromCache:!1,mime:x}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let l=Gi(e,{as:n,timeout:r,useProxy:i,errorTTL:o}),s=Ke.get(l);if(s&&s.until>Date.now())return{...s.result,fromCache:!0};s&&Ke.delete(l);let u=gt.get(l);if(u)return u;let d=Xi(e,i)?Yi(e,i):e,f=t.credentials;if(!f)try{let m=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,m);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}let p=new AbortController,g=setTimeout(()=>p.abort("timeout"),r),h=(async()=>{try{let m=await fetch(d,{signal:p.signal,credentials:f,headers:a});if(!m.ok){let b={ok:!1,data:null,status:m.status,url:d,fromCache:!1,reason:"http_error"};if(o>0&&Ke.set(l,{until:Date.now()+o,result:b}),!c){let w=`${m.status} ${m.statusText||""}`.trim();tn.warnOnce(`http:${m.status}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${e}`)}return t.onError&&t.onError(b),b}if(n==="text")return{ok:!0,data:await m.text(),status:m.status,url:d,fromCache:!1};let y=await m.blob(),x=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await or(y),status:m.status,url:d,fromCache:!1,mime:x}:{ok:!0,data:y,status:m.status,url:d,fromCache:!1,mime:x}}catch(m){let y=m&&typeof m=="object"&&"name"in m&&m.name==="AbortError"?String(m.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&o>0&&Ke.set(l,{until:Date.now()+o,result:x}),!c){let b=`${y}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,w=y==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${e}`:y==="abort"?`Request aborted while fetching ${n} ${e}`:`Network/CORS issue while fetching ${n} ${e}. A proxy may be required`;tn.errorOnce(b,w)}return t.onError&&t.onError(x),x}finally{clearTimeout(g),gt.delete(l)}})();return gt.set(l,h),h}var tn,gt,Ke,He=K(()=>{Ct(),tn=ji("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),gt=new Map,Ke=new Map});async function $r(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=hn(e);if(!n)return e;let r=qi(n),i=St(r);if(C.background.has(i)){let o=C.background.get(i);return o?`url("${o}")`:"none"}try{let o=await ne(i,{as:"dataURL",useProxy:t.useProxy});return o.ok?(C.background.set(i,o.data),`url("${o.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var Ki=K(()=>{re(),Ct(),He()});function Ji(e){if(e=String(e).toLowerCase(),yn.has(e)){let o={};return C.defaultStyle.set(e,o),o}if(C.defaultStyle.has(e))return C.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let n=document.createElement(e);n.style.all="initial",t.appendChild(n);let r=getComputedStyle(n),i={};for(let o of r){if(gn(o))continue;let a=r.getPropertyValue(o);i[o]=a}return t.removeChild(n),C.defaultStyle.set(e,i),i}function gn(e){let t=String(e).toLowerCase();return!!(Rr.has(t)||Nr.test(t)||Tr.test(t))}function nn(e,t){if(t=String(t||"").toLowerCase(),yn.has(t))return"";let n=[],r=Ji(t),i=(e.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(t);for(let[o,a]of Object.entries(e)){if(gn(o)||i&&(o==="width"||o==="min-width"||o==="max-width"))continue;let c=r[o];a&&a!==c&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function Zi(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),typeof e.querySelectorAll=="function"&&e.querySelectorAll("*").forEach(n=>t.add(n.tagName.toLowerCase())),Array.from(t))}function Qi(e){let t=new Map;for(let r of e){let i=C.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([a,c])=>`${a}:${c};`).sort().join("");o&&(t.has(o)||t.set(o,[]),t.get(o).push(r))}let n="";for(let[r,i]of t.entries())n+=`${i.join(",")} { ${r} }
|
|
3
|
-
`;return n}function ea(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let i of t)n.set(i,`c${r++}`);return n}function ta(e){try{let t=e?.ownerDocument;if(!t)return typeof window<"u"?window:null;let n=t.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let r=0;r<window.frames.length;r++)try{if(window.frames[r]?.document===t)return window.frames[r]}catch{}}catch{}return typeof window<"u"?window:null}function pe(e,t=null){let n=()=>{let o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(!(e instanceof Element)){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=C.computedStyle.get(e);r||(r=new Map,C.computedStyle.set(e,r));let i=r.get(t);if(!i){let o=ta(e),a=null;try{a=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}i=a||n(),r.set(t,i)}return i}function ir(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function rn(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&n++,o===")"&&n--,o===","&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var Lr,yn,na,Tr,Nr,Rr,_r=K(()=>{re(),Lr=new Set(["meta","script","noscript","title","link","template"]),yn=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),na=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"],Tr=/(?:^|-)(animation|transition)(?:-|$)/i,Nr=/^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,Rr=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"])});function Fe(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function ra(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let e=navigator.userAgent||"",t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function ke(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),n=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),r=/applewebkit/i.test(e),i=/mobile/i.test(e),o=!/safari/i.test(e),a=r&&i&&o,c=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),s=/ipad|iphone|ipod/.test(t)&&r;return n||a||c||l||s}function oa(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var tt=K(()=>{});function F(e,t,n){let r=e&&typeof e=="object"&&(e.options||e);r&&r.debug&&(n!==void 0?console.warn("[snapdom]",t,n):console.warn("[snapdom]",t))}var Pr=K(()=>{}),ie=K(()=>{Ki(),_r(),tt(),Ct(),Pr()}),Fr={};et(Fr,{toCanvas:()=>kt});function ia(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function aa(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function la(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function sa(e){let t=[],n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&r++,o===")"&&(r=Math.max(0,r-1)),o===";"&&r===0?(t.push(n),n=""):n+=o}return n.trim()&&t.push(n),t.map(i=>i.trim()).filter(Boolean)}function ca(e){let t=[],n="",r=0;for(let o=0;o<e.length;o++){let a=e[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===","&&r===0?(t.push(n.trim()),n=""):n+=a}n.trim()&&t.push(n.trim());let i=[];for(let o of t){if(/\binset\b/i.test(o))continue;let a=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[c="0px",l="0px",s="0px"]=a,u=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!u&&u!==",";i.push(`drop-shadow(${c} ${l} ${s}${d?` ${u}`:""})`)}return i.join(" ")}function Ir(e){let t=sa(e),n=null,r=null,i=null,o=[];for(let c of t){let l=c.indexOf(":");if(l<0)continue;let s=c.slice(0,l).trim().toLowerCase(),u=c.slice(l+1).trim();s==="box-shadow"?i=u:s==="filter"?n=u:s==="-webkit-filter"?r=u:o.push([s,u])}if(i){let c=ca(i);c&&(n=n?`${n} ${c}`:c,r=r?`${r} ${c}`:c)}let a=[...o];return n&&a.push(["filter",n]),r&&a.push(["-webkit-filter",r]),a.map(([c,l])=>`${c}:${l}`).join(";")}function ua(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${Ir(r)}}`)}function da(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,ua(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${Ir(r)}${n}`),e}function fa(e){if(!ke()||!ia(e))return e;try{let t=aa(e),n=da(t);return la(n)}catch{return e}}async function kt(e,t){let{width:n,height:r,scale:i=1,dpr:o=1,meta:a={},backgroundColor:c}=t;e=fa(e);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=e,await l.decode();let s=l.naturalWidth,u=l.naturalHeight,d=Number.isFinite(a.w0)?a.w0:s,f=Number.isFinite(a.h0)?a.h0:u,p,g,h=Number.isFinite(n),m=Number.isFinite(r);if(h&&m)p=Math.max(1,n),g=Math.max(1,r);else if(h){let b=n/Math.max(1,d);p=n,g=f*b}else if(m){let b=r/Math.max(1,f);g=r,p=d*b}else p=s,g=u;p=p*i,g=g*i;let y=document.createElement("canvas");y.width=p*o,y.height=g*o,y.style.width=`${p}px`,y.style.height=`${g}px`;let x=y.getContext("2d");return o!==1&&x.scale(o,o),c&&(x.save(),x.fillStyle=c,x.fillRect(0,0,p,g),x.restore()),x.drawImage(l,0,0,p,g),y}var Mt=K(()=>{tt()}),yt={};et(yt,{rasterize:()=>Dr});async function Dr(e,t){let n=await kt(e,t),r=new Image;return r.src=n.toDataURL(`image/${t.format}`,t.quality),await r.decode(),r.style.width=`${n.width/t.dpr}px`,r.style.height=`${n.height/t.dpr}px`,r}var wt=K(()=>{Mt()}),on={};et(on,{toImg:()=>ar,toSvg:()=>ar});async function ar(e,t){let{scale:n=1,width:r,height:i,meta:o={}}=t,a=Number.isFinite(r),c=Number.isFinite(i),l=Number.isFinite(n)&&n!==1||a||c;if(ke()&&l)return await Dr(e,{...t,format:"png",quality:1,meta:o});let s=new Image;if(s.decoding="sync",s.loading="eager",s.src=e,await s.decode(),a&&c)s.style.width=`${r}px`,s.style.height=`${i}px`;else if(a){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,f=r/Math.max(1,u);s.style.width=`${r}px`,s.style.height=`${Math.round(d*f)}px`}else if(c){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,f=i/Math.max(1,d);s.style.height=`${i}px`,s.style.width=`${Math.round(u*f)}px`}else{let u=Math.round(s.naturalWidth*n),d=Math.round(s.naturalHeight*n);if(s.style.width=`${u}px`,s.style.height=`${d}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let f=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${d}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,s.src=e}catch(f){F(t,"SVG width/height patch in toImg failed",f)}}return s}var lr=K(()=>{ie(),wt()}),Hr={};et(Hr,{toBlob:()=>Or});async function Or(e,t){let n=t.type;if(n==="svg"){let i=decodeURIComponent(e.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let r=await kt(e,t);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,t.quality))}var Wr=K(()=>{Mt()}),Br={};et(Br,{download:()=>ma});async function sr(e,t){let n=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:t})}catch(r){if(r.name!=="AbortError")return!1}return!0}async function ma(e,t){let n=(t?.format||t?.type||"").toLowerCase(),r=n==="jpg"?"jpeg":n||"png",i=t?.filename||`snapdom.${r}`,o={...t||{},format:r,type:r};o.dpr=1;let a=ra();if(r==="svg"){let s=await Or(e,{...o,type:"svg"});if(a&&await sr(s,i))return;let u=URL.createObjectURL(s),d=document.createElement("a");d.href=u,d.download=i,document.body.appendChild(d),d.click(),URL.revokeObjectURL(u),d.remove();return}let c=await kt(e,o);if(a){let s=`image/${r}`,u=await new Promise(d=>c.toBlob(d,s,t?.quality));if(u&&await sr(u,i))return}let l=document.createElement("a");l.href=c.toDataURL(`image/${r}`,t?.quality),l.download=i,document.body.appendChild(l),l.click(),l.remove()}var pa=K(()=>{Wr(),Mt(),tt()});ie();ie();re();var cr=new WeakMap,an=new Map,ln=0;function Je(){ln++}var ur=!1;function ha(e=document.documentElement){if(!ur){ur=!0;try{new MutationObserver(()=>Je()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Je()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",Je),t.ready?.then(()=>Je()).catch(()=>{}))}catch{}}}function ga(e,t={}){let n={},r=e.getPropertyValue("visibility"),i=t.excludeStyleProps;for(let d=0;d<e.length;d++){let f=e[d];if(gn(f)||i&&(i instanceof RegExp&&i.test(f)||typeof i=="function"&&i(f)))continue;let p=e.getPropertyValue(f);(f==="background-image"||f==="content")&&p.includes("url(")&&!p.includes("data:")&&(p="none"),n[f]=p}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let d of o)if(!n[d])try{let f=e.getPropertyValue(d);f&&(n[d]=f)}catch{}let a=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let d of a)if(!n[d])try{let f=e.getPropertyValue(d);f&&(n[d]=f)}catch{}if(t.embedFonts){let d=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let f of d)if(!n[f])try{let p=e.getPropertyValue(f);p&&(n[f]=p)}catch{}}r==="hidden"&&(n.opacity="0");let c=parseFloat(e.getPropertyValue("border-top-width")||0)||0,l=parseFloat(e.getPropertyValue("border-right-width")||0)||0,s=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,u=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(c===0&&l===0&&s===0&&u===0){let d=(e.getPropertyValue("border-image-source")||"").trim(),f=d&&d!=="none",p=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let g of p)delete n[g];f||(n.border="none")}return n}var dr=new WeakMap;function ya(e){let t=dr.get(e);return t||(t=Object.entries(e).sort((n,r)=>n[0]<r[0]?-1:n[0]>r[0]?1:0).map(([n,r])=>`${n}:${r}`).join(";"),dr.set(e,t),t)}function wa(e,t=null,n={}){let r=cr.get(e);if(r&&r.epoch===ln)return r.snapshot;let i=t||getComputedStyle(e),o=ga(i,n);return ka(e,i,o),cr.set(e,{epoch:ln,snapshot:o}),o}function ba(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:an,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||{}}:{session:C.session,persist:{snapshotKeyCache:an,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||t||{}}}function xa(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],o=n.getPropertyValue(i);o&&t.style.setProperty(i,o)}}async function Ie(e,t,n,r){if(e.tagName==="STYLE")return;let i=ba(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&ha(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(Je(),an.clear(),i.session.__bumpedForDisabled=!0);let{session:a,persist:c}=i;a.styleCache.has(e)||a.styleCache.set(e,getComputedStyle(e));let l=a.styleCache.get(e);e.getAttribute?.("style")&&xa(e,t,l);let s=wa(e,l,i.options),u=ya(s),d=c.snapshotKeyCache.get(u);if(!d){let f=e.tagName?.toLowerCase()||"div";d=nn(s,f),c.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function va(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Sa(e){return e.backgroundImage&&e.backgroundImage!=="none"||e.backgroundColor&&e.backgroundColor!=="rgba(0, 0, 0, 0)"&&e.backgroundColor!=="transparent"||(parseFloat(e.borderTopWidth)||0)>0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||"visible")!=="visible"}function Ea(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function Ca(e,t){if(e.textContent&&/\S/.test(e.textContent))return!0;let n=e.firstElementChild,r=e.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let i=e.scrollHeight;if(i===0)return!1;let o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingBottom)||0;return i>o+a}function ka(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let r=e.tagName&&e.tagName.toLowerCase();if(!r||!["div","section","article","main","aside","header","footer","nav"].includes(r))return;let i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let o=t.display||"";if(o.includes("flex")||o.includes("grid")||va(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||Sa(t)||Ea(e))return;let c=t.overflowX||t.overflow||"visible",l=t.overflowY||t.overflow||"visible";if(c!=="visible"||l!=="visible")return;let s=t.clip;s&&s!=="auto"&&s!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||Ca(e,t)&&(delete n.height,delete n["block-size"])}_r();var Ur=["fill","stroke","color","background-color","stop-color"],fr=new Map;function Ma(e,t){let n=t+"::"+e.toLowerCase(),r=fr.get(n);if(r)return r;let i=document,o=t==="http://www.w3.org/2000/svg"?i.createElementNS(t,e):i.createElement(e),a=i.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(o),i.documentElement.appendChild(a);let c=getComputedStyle(o),l={};for(let s of Ur)l[s]=c.getPropertyValue(s)||"";return a.remove(),fr.set(n,l),l}function Aa(e,t){if(!(e instanceof Element)||!(t instanceof Element))return;let n=e.getAttribute?.("style"),r=!!(n&&n.includes("var("));if(!r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let c=o[a];if(c&&typeof c.value=="string"&&c.value.includes("var(")){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let o=e.style;if(o&&o.length)for(let a=0;a<o.length;a++){let c=o[a],l=o.getPropertyValue(c);if(!l||!l.includes("var("))continue;let s=i&&i.getPropertyValue(c);if(s)try{t.style.setProperty(c,s.trim(),o.getPropertyPriority(c))}catch{}}}if(r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let c=o[a];if(!c||typeof c.value!="string"||!c.value.includes("var("))continue;let l=c.name,s=i&&i.getPropertyValue(l);if(s)try{t.style.setProperty(l,s.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let o=e.namespaceURI||"html",a=Ma(e.tagName,o);for(let c of Ur){let l=i.getPropertyValue(c)||"",s=a[c]||"";if(l&&l!==s)try{t.style.setProperty(c,l.trim())}catch{}}}}ie();ie();re();He();function Qt(e,t,n){return Promise.all(e.map(r=>new Promise(i=>{function o(){Fe(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,i):o()},{fast:n})}o()})))}function $a(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function La(e,t,n=!0){return e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let i=n?$a(r):r;return`:where(${t} ${i})`}).join(", ")}function Ta(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${t}:is(${r.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${t} ${r.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,i,o)=>{let a=La(o,t,!0);return`${r}${i}${a}{`}),e):""}function Na(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function Ra(e){let t="";try{e.querySelectorAll("style").forEach(r=>{t+=(r.textContent||"")+`
|
|
1
|
+
"use strict";var __MindStudioBrowserAgent=(()=>{var jt=Object.defineProperty;var yi=Object.getOwnPropertyDescriptor;var wi=Object.getOwnPropertyNames;var bi=Object.prototype.hasOwnProperty;var xi=(e,t)=>{for(var n in t)jt(e,n,{get:t[n],enumerable:!0})},vi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wi(t))!bi.call(e,i)&&i!==n&&jt(e,i,{get:()=>t[i],enumerable:!(r=yi(t,i))||r.enumerable});return e};var Si=e=>vi(jt({},"__esModule",{value:!0}),e);var ac={};xi(ac,{executeSteps:()=>Ft,getRefMap:()=>pt,resolveElement:()=>we,takeSnapshot:()=>Ye,takeSnapshotSync:()=>Gt});var Pn="/__mindstudio_dev__/logs";var Se=[],Ne=null,ft=!1,ze=[],Fn=null;function Dn(e){Fn=e}function In(){if(Se.length===0)return;let e=Se;Se=[];let t=Fn?.();if(t&&t.readyState===WebSocket.OPEN)try{t.send(JSON.stringify({type:"log",entries:e}));return}catch{}try{let n=new XMLHttpRequest;n.open("POST",Pn,!0),n.setRequestHeader("Content-Type","application/json"),n.send(JSON.stringify(e))}catch{}}function Ei(){Ne||(Ne=setTimeout(()=>{Ne=null,In()},2e3))}function Ci(){Ne&&(clearTimeout(Ne),Ne=null),In()}function Q(e){Se.push(e),ft&&ze.push(e),Ei()}function zt(e){Se.push(e),ft&&ze.push(e),Ci()}function Hn(){ft=!0,ze=[]}function On(){ft=!1;let e=ze;return ze=[],e}function Wn(){window.addEventListener("beforeunload",()=>{Se.length>0&&navigator.sendBeacon&&navigator.sendBeacon(Pn,JSON.stringify(Se))})}var ki={a:"link",button:"button",input:"textbox",textarea:"textbox",select:"combobox",option:"option",h1:"heading",h2:"heading",h3:"heading",h4:"heading",h5:"heading",h6:"heading",nav:"navigation",main:"main",header:"banner",footer:"contentinfo",aside:"complementary",dialog:"dialog",details:"group",summary:"button",img:"img",ul:"list",ol:"list",li:"listitem",table:"table",tr:"row",th:"columnheader",td:"cell",form:"form",article:"article",section:"region",label:"label",fieldset:"group",legend:"legend",p:"paragraph",blockquote:"blockquote",pre:"code",code:"code",hr:"separator",progress:"progressbar"};function Ee(e){let t=e.getAttribute("role");if(t)return t==="presentation"||t==="none"?null:t;let n=e.tagName.toLowerCase();if(n==="a")return e.hasAttribute("href")?"link":null;if(n==="section")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"region":null;if(n==="form")return e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")?"form":null;if(n==="img")return e.alt===""?null:"img";if(n==="input")switch(e.type){case"checkbox":return"checkbox";case"radio":return"radio";case"range":return"slider";case"submit":case"button":case"reset":return"button";case"hidden":return null;default:return"textbox"}return ki[n]??null}function Bn(e){if(e.hasAttribute("onclick")||e.hasAttribute("tabindex")&&e.getAttribute("tabindex")!=="-1")return!0;try{if(getComputedStyle(e).cursor==="pointer")return!0}catch{}return!1}function Re(e){let t=e.getAttribute("aria-label");if(t)return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let a=n.split(/\s+/).map(c=>{let l=document.getElementById(c);return l?Ce(l):""}).filter(Boolean).join(" ");if(a)return a}let r=e.tagName.toLowerCase();if(r==="input"||r==="textarea"||r==="select"){let a=Mi(e);if(a)return a}if(r==="img"){let a=e.alt;if(a)return a.trim()}if(r==="fieldset"){let a=e.querySelector("legend");if(a)return Ce(a)}let i=Ce(e);if(i)return i;let o=e.getAttribute("title");return o?o.trim():""}function Ce(e){if(!e.children.length)return(e.textContent||"").trim();let t=[];for(let n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE){let r=(n.textContent||"").trim();r&&t.push(r)}else if(n.nodeType===Node.ELEMENT_NODE){let r=n;if($i(r))continue;let i=Ai(r),o=Ce(r);o&&(i&&t.length>0&&t.push(" "),t.push(o),i&&t.push(" "))}return t.join("").replace(/\s+/g," ").trim()}function Mi(e){if(e.id){let n=document.querySelector(`label[for="${CSS.escape(e.id)}"]`);if(n)return Ce(n)}let t=e.closest("label");if(t){let n=t.cloneNode(!0),r=n.querySelector("input, textarea, select");r&&r.remove();let i=n.textContent?.trim();if(i)return i}return null}function Ai(e){try{return!getComputedStyle(e).display.includes("inline")}catch{let t=e.tagName.toLowerCase();return["div","p","h1","h2","h3","h4","h5","h6","li","section","article","header","footer","nav","main","aside","blockquote","pre","form","fieldset","table","tr","br"].includes(t)}}function $i(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||e.getAttribute("aria-hidden")==="true")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden")return!0}catch{}return!1}function Vt(e,t){try{let n=getComputedStyle(e,t).content;if(!n||n==="none"||n==="normal")return"";let r=n.match(/^["'](.*)["']$/);return r?r[1]:""}catch{return""}}var Ve=0;function mt(){Ve++}function Xe(){Ve=Math.max(0,Ve-1)}function Un(e=5e3,t=200){return new Promise((n,r)=>{let i=Date.now()+e,o=null;function a(){if(Date.now()>i){o&&clearTimeout(o),n();return}Ve===0?o||(o=setTimeout(()=>{Ve===0?n():(o=null,a())},t)):(o&&(clearTimeout(o),o=null),setTimeout(a,50))}a()})}var Xt=0,Yt=new Map;function pt(){return Yt}async function Ye(){return await Un(),Gt()}function Gt(){Xt=0,Yt=new Map;let e=document.body;if(!e)return"(empty page)";let t=qn(e);return Kt(t,0).trimEnd()}function ee(e){let t=Ee(e),n=Re(e),r=n.length>60?n.slice(0,57)+"...":n;if(t&&r)return`${t} "${r}"`;if(t)return t;if(r)return`"${r}"`;let i=e.tagName.toLowerCase();return e.id?`${i}#${e.id}`:i}function qn(e){if(Ti(e))return[];let t=Ee(e),n=!t&&Bn(e),r=t||(n?"clickable":null),i="";if(r){i=Re(e);let u=Vt(e,"::before"),d=Vt(e,"::after");(u||d)&&(i=[u,i,d].filter(Boolean).join(" ")),i.length>80&&(i=i.slice(0,77)+"...")}let o=Ni(e),a=t==="button"||t==="link"||t==="textbox"||t==="combobox"||t==="checkbox"||t==="radio"||t==="slider"||t==="tab"||t==="menuitem"||n,c=r&&i&&!a,l=null;(a||c)&&(Xt++,l=`e${Xt}`,Yt.set(l,e));let s=Li(e);if(r){let u=s.length===0?"":Kt(s,0).trim();return[{tag:r,name:i,attrs:o,ref:l,children:u&&u===i?[]:s,element:e}]}if(s.length===0){let u=Ce(e);if(u)return[{tag:null,name:u.length>80?u.slice(0,77)+"...":u,attrs:[],ref:null,children:[],element:e}]}return s}function Li(e){let t=[];for(let n of Array.from(e.childNodes))n.nodeType===Node.ELEMENT_NODE&&t.push(...qn(n));return t}function Ti(e){let t=e.tagName.toLowerCase();if(t==="script"||t==="style"||t==="noscript"||t==="template"||t==="head"||e.getAttribute("aria-hidden")==="true"||e.id==="__mindstudio-browser-agent"||e.id==="__mindstudio-cursor"||e.id==="__mindstudio-cursor-ripple"||e.id==="__mindstudio-notes-overlay"||e.id==="__mindstudio-notes-cursor")return!0;try{let n=getComputedStyle(e);if(n.display==="none"||n.visibility==="hidden"&&n.position!=="static")return!0}catch{}return!1}function Ni(e){let t=[],n=e.tagName.toLowerCase();if((n==="dialog"&&e.open||n==="details"&&e.open)&&t.push("open"),e.disabled&&t.push("disabled"),n==="input"){let o=e;(o.type==="checkbox"||o.type==="radio")&&o.checked&&t.push("checked")}if(n==="input"){let o=e;o.type!=="checkbox"&&o.type!=="radio"&&o.type!=="hidden"&&o.type!=="submit"&&o.type!=="button"&&o.type!=="reset"&&(t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`))}if(n==="textarea"){let o=e;t.push(`value="${o.value}"`),o.placeholder&&t.push(`placeholder="${o.placeholder}"`)}if(n==="select"){let o=e,a=o.options[o.selectedIndex];a&&t.push(`value="${a.text}"`)}let r=n.match(/^h([1-6])$/);r&&t.push(`level=${r[1]}`);let i=e.getAttribute("aria-expanded");return i==="true"&&t.push("expanded"),i==="false"&&t.push("collapsed"),e.getAttribute("aria-selected")==="true"&&t.push("selected"),e.getAttribute("aria-pressed")==="true"&&t.push("pressed"),t}function Kt(e,t){let n="";for(let r of e)n+=Ri(r,t);return n}function Ri(e,t){let n=" ".repeat(t),r=[];e.tag&&r.push(e.tag),e.name&&r.push(`"${e.name}"`);for(let a of e.attrs)r.push(`[${a}]`);e.ref&&r.push(`[ref=${e.ref}]`);let i="";r.length>0&&(i+=`${n}${r.join(" ")}
|
|
2
|
+
`);let o=r.length>0?t+1:t;return i+=Kt(e.children,o),i}function jn(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e instanceof Error)return e.stack||e.message||String(e);if(typeof e=="object")try{return JSON.stringify(e)}catch{return String(e)}return String(e)}function q(e){return new Promise(t=>setTimeout(t,e))}var _i=["log","info","warn","error","debug"];function zn(){if(!console.__ms_patched){console.__ms_patched=!0;for(let e of _i){let t=console[e];console[e]=(...n)=>{t&&t.apply(console,n),Q({type:"console",level:e,args:n.map(jn),url:location.href})}}}}function Vn(){window.addEventListener("error",e=>{zt({type:"error",message:e.message,stack:e.error&&e.error.stack||"",source:e.filename,line:e.lineno,column:e.colno,url:location.href})}),window.addEventListener("unhandledrejection",e=>{let t=e.reason||{};zt({type:"error",message:t.message||String(t),stack:t.stack||"",url:location.href})})}function Xn(){if(!window.fetch||window.fetch.__ms_patched)return;let e=window.fetch;window.fetch=function(t,n){let r=(n?.method||"GET").toUpperCase(),i=typeof t=="string"?t:t instanceof URL?t.href:t.url||String(t);if(i.includes("/__mindstudio_dev__/"))return e.apply(this,[t,n]);let o=Date.now();return mt(),e.apply(this,[t,n]).then(a=>{Xe();let c={type:"network",method:r,url:i,status:a.status,statusText:a.statusText,duration:Date.now()-o,ok:a.ok};if(a.ok)Q(c);else try{a.clone().text().then(l=>{c.body=l.slice(0,1e3),Q(c)}).catch(()=>Q(c))}catch{Q(c)}return a},a=>{throw Xe(),Q({type:"network",method:r,url:i,error:a.message||String(a),duration:Date.now()-o,ok:!1}),a})},window.fetch.__ms_patched=!0}function Yn(){document.__ms_click_patched||(document.__ms_click_patched=!0,document.addEventListener("click",e=>{let t=e.target,n=(t?.textContent||"").trim().slice(0,100);Q({type:"interaction",event:"click",target:ee(t),text:n,url:location.href})},!0))}function Gn(){if(XMLHttpRequest.prototype.open.__ms_patched)return;let e=window.XMLHttpRequest,t=e.prototype.open,n=e.prototype.send;e.prototype.open=function(r,i,...o){return this.__ms_method=r.toUpperCase(),this.__ms_url=String(i),t.apply(this,[r,i,...o])},e.prototype.send=function(r){let i=this.__ms_method||"GET",o=this.__ms_url||"";if(o.includes("/__mindstudio_dev__/"))return n.apply(this,[r]);let a=Date.now();return mt(),this.addEventListener("loadend",function(){Xe(),Q({type:"network",method:i,url:o,status:this.status,statusText:this.statusText,duration:Date.now()-a,ok:this.status>=200&&this.status<300,...this.status>=400?{body:(this.responseText||"").slice(0,1e3)}:{},via:"xhr"})}),n.apply(this,[r])},XMLHttpRequest.prototype.open.__ms_patched=!0}function we(e){let t=null;if(e.ref){let n=pt(),r=n.get(e.ref);if(r&&r.isConnected)if(de(r))t={element:r,matched:`${ee(r)} [ref=${e.ref}]`};else throw new Error(`Element [ref=${e.ref}] exists but is hidden (${Jt(r)}). It may be inside a closed dialog or collapsed section.`);else{let i=[...n.entries()].filter(([,o])=>o.isConnected&&de(o)).slice(0,10).map(([o,a])=>`${ee(a)} [ref=${o}]`).join(", ");throw new Error(`Element [ref=${e.ref}] not found. `+(i?`Available refs: ${i}`:"No refs available \u2014 take a snapshot first."))}}if(!t&&(e.text||e.role&&e.text)){let n=e.text,r=e.role,i=Kn(n,r);if(i.length===0){let o=Kn(n,r,!0);if(o.length>0)throw new Error(`Found ${r?r+" ":""}"${n}" but it is hidden (${Jt(o[0])}). Wait for it to become visible or check if a dialog/modal needs to be opened first.`);let a=r?`${r} "${n}"`:`"${n}"`,c=Jn(r);throw new Error(`No element found matching ${a}. `+(c?`Visible ${r||"element"}s: ${c}`:"The page may still be loading \u2014 try a wait command first."))}if(i.length>1){let o=i.filter(Zn),a=o.length===1?o[0]:i[0];t={element:a,matched:ee(a)}}else t={element:i[0],matched:ee(i[0])}}if(!t&&e.role&&!e.text){let n=e.role,r=Pi(n);if(r.length===0){let i=Jn(n);throw new Error(`No visible element with role "${n}" found. `+(i?`Visible ${n}s: ${i}`:"The page may still be loading \u2014 try a wait command first."))}t={element:r[0],matched:ee(r[0])}}if(!t&&e.label){let n=e.label,r=Fi(n);if(!r){let i=[...document.querySelectorAll("label")].filter(de).map(o=>`"${(o.textContent||"").trim().slice(0,40)}"`).slice(0,8).join(", ");throw new Error(`No input found with label "${n}". `+(i?`Visible labels: ${i}`:"No labels found on the page."))}t={element:r,matched:`${ee(r)} via label "${n}"`}}if(!t&&e.selector){let n=e.selector,r=document.querySelector(n);if(!r)throw new Error(`No element found for selector "${n}".`);if(!de(r))throw new Error(`Found element for selector "${n}" but it is hidden (${Jt(r)}).`);t={element:r,matched:`${ee(r)} via selector "${n}"`}}if(!t)throw new Error("No targeting field provided (need ref, text, role, label, or selector)");return t}function Kn(e,t,n=!1){let r=[],i=e.toLowerCase();for(let o of document.querySelectorAll("*")){if(!n&&!de(o)||n&&!o.isConnected||t&&Ee(o)!==t)continue;if(Re(o).toLowerCase().includes(i)){r.push(o);continue}o.children.length||(o.textContent||"").trim().toLowerCase().includes(i)&&r.push(o)}return r}function Pi(e){let t=[];for(let n of document.querySelectorAll("*"))de(n)&&Ee(n)===e&&t.push(n);return t}function Fi(e){let t=e.toLowerCase();for(let n of document.querySelectorAll("label")){if(!(n.textContent||"").trim().toLowerCase().includes(t))continue;let i=n.getAttribute("for");if(i){let a=document.getElementById(i);if(a&&de(a))return a}let o=n.querySelector("input, textarea, select");if(o&&de(o))return o}return null}function de(e){if(!e.isConnected)return!1;try{let t=getComputedStyle(e);if(t.display==="none"||t.visibility==="hidden")return!1}catch{return!1}return!0}function Zn(e){if(e.matches('a, button, input, textarea, select, [role="button"], [role="link"], [tabindex]'))return!0;try{return getComputedStyle(e).cursor==="pointer"}catch{return!1}}function Jt(e){try{let t=getComputedStyle(e);if(t.display==="none")return"display: none";if(t.visibility==="hidden")return"visibility: hidden"}catch{}return e.getAttribute("aria-hidden")==="true"?'aria-hidden="true"':"hidden"}function Jn(e){let t=[];for(let n of document.querySelectorAll("*"))if(de(n)&&(e?Ee(n)===e&&t.push(n):Zn(n)&&t.push(n),t.length>=10))break;return t.length===0?"":t.map(n=>`"${Re(n).slice(0,40)||ee(n)}"`).join(", ")}function Zt(e){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i={bubbles:!0,cancelable:!0,clientX:n,clientY:r,button:0};e.dispatchEvent(new PointerEvent("pointerdown",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mousedown",i)),e instanceof HTMLElement&&e.focus(),e.dispatchEvent(new PointerEvent("pointerup",{...i,pointerId:1})),e.dispatchEvent(new MouseEvent("mouseup",i)),e.dispatchEvent(new MouseEvent("click",i))}var Di=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set,Ii=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value")?.set;async function tr(e,t,n={}){if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement))throw new Error("type command requires an input or textarea element");e.focus(),Zt(e),n.clear&&(Qn(e,""),e.dispatchEvent(new Event("input",{bubbles:!0})));for(let r=0;r<t.length;r++){let i=t[r];e.dispatchEvent(new KeyboardEvent("keydown",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keypress",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),Qn(e,e.value+i),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new KeyboardEvent("keyup",{key:i,code:`Key${i.toUpperCase()}`,bubbles:!0})),await q(Hi(i))}e.dispatchEvent(new Event("change",{bubbles:!0}))}function Hi(e){let t=Math.random()*50-25;return e===" "?120+t:/[.,!?;:\-]/.test(e)?140+t:/[A-Z]/.test(e)?115+t:85+t}function Qn(e,t){let n=e instanceof HTMLTextAreaElement?Ii:Di;n?n.call(e,t):e.value=t}async function nr(e){let t=e.timeout||5e3,n=Date.now(),r=n+t;for(;Date.now()<r;)try{return{...we(e),elapsed:Date.now()-n}}catch{await q(100)}let i=e.text?`"${e.text}"`:e.role?`role "${e.role}"`:e.selector?`selector "${e.selector}"`:"element";throw new Error(`Timed out waiting for ${i} after ${t}ms`)}var er=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;function rr(e,t){if(!(e instanceof HTMLSelectElement))throw new Error("select command requires a <select> element");let n=t.toLowerCase(),r=null;for(let i of e.options)if(i.text.toLowerCase().includes(n)||i.value.toLowerCase()===n||i.label.toLowerCase().includes(n)){r=i;break}if(!r){let i=[...e.options].map(o=>`"${o.text}"`).join(", ");throw new Error(`No option matching "${t}" in select. Available options: ${i}`)}return er?er.call(e,r.value):e.value=r.value,e.dispatchEvent(new Event("change",{bubbles:!0})),e.dispatchEvent(new Event("input",{bubbles:!0})),r.text}async function or(e){try{let n=!/\b(return|;|\{)\b/.test(e.trim())?`return (${e})`:e,i=new Function(n)();return i instanceof Promise?await i:i}catch(t){throw new Error(`evaluate failed: ${t instanceof Error?t.message:String(t)}`)}}var Wi=Object.defineProperty,K=(e,t)=>()=>(e&&(t=e(e=0)),t),et=(e,t)=>{for(var n in t)Wi(e,n,{get:t[n],enumerable:!0})};function Bi(e){if(e===!0)return"soft";if(e===!1)return"disabled";if(typeof e=="string"){let t=e.toLowerCase().trim();if(t==="auto")return"auto";if(t==="full")return"full";if(t==="soft"||t==="disabled")return t}return"soft"}function Ui(e="soft"){switch(C.session.__counterEpoch=(C.session.__counterEpoch||0)+1,e){case"auto":{C.session.styleMap=new Map,C.session.nodeMap=new Map;return}case"soft":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap,C.computedStyle=new WeakMap,C.baseStyle=new te(50),C.defaultStyle=new te(30),C.image=new te(100),C.background=new te(100),C.resource=new te(150),C.font=new Set;return}default:{C.session.styleMap=new Map,C.session.nodeMap=new Map,C.session.styleCache=new WeakMap;return}}}var te,C,re=K(()=>{te=class extends Map{constructor(e=100,...t){super(...t),this._maxSize=e}set(e,t){if(this.size>=this._maxSize&&!this.has(e)){let n=this.keys().next().value;n!==void 0&&this.delete(n)}return super.set(e,t)}},C={image:new te(100),background:new te(100),resource:new te(150),defaultStyle:new te(30),baseStyle:new te(50),computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function hn(e){let t=e.match(/url\((['"]?)(.*?)(\1)\)/);if(!t)return null;let n=t[2].trim();return n.startsWith("#")?null:n}function qi(e){if(!e||e==="none")return"";let t=e.replace(/translate[XY]?\([^)]*\)/g,"");return t=t.replace(/matrix\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==6?`matrix(${r})`:(i[4]="0",i[5]="0",`matrix(${i.join(", ")})`)}),t=t.replace(/matrix3d\(([^)]+)\)/g,(n,r)=>{let i=r.split(",").map(o=>o.trim());return i.length!==16?`matrix3d(${r})`:(i[12]="0",i[13]="0",`matrix3d(${i.join(", ")})`)}),t.trim().replace(/\s{2,}/g," ")}function St(e){if(/%[0-9A-Fa-f]{2}/.test(e))return e;try{return encodeURI(e)}catch{return e}}function ji(e,t){if(!e||/^(data|blob|about|#)/i.test(e.trim()))return e;try{let n=t||typeof document<"u"&&(document.baseURI||document.location?.href)||"http://localhost/";return new URL(e,n).href}catch{return e}}var Ct=K(()=>{});function zi(e="[snapDOM]",{ttlMs:t=5*6e4,maxEntries:n=12}={}){let r=new Map,i=0;function o(a,c,l){if(i>=n)return;let s=Date.now();(r.get(c)||0)>s||(r.set(c,s+t),i++,a==="warn"&&console&&console.warn?console.warn(`${e} ${l}`):console&&console.error&&console.error(`${e} ${l}`))}return{warnOnce(a,c){o("warn",a,c)},errorOnce(a,c){o("error",a,c)},reset(){r.clear(),i=0}}}function Vi(e){return/^data:|^blob:|^about:blank$/i.test(e)}function Xi(e,t){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=t.includes("{url}")?t.split("{url}")[0]:t,i=new URL(r||".",n),o=new URL(e,n);if(o.origin===i.origin)return!0;let a=o.searchParams;if(a&&(a.has("url")||a.has("target")))return!0}catch{}return!1}function Yi(e,t){if(!t||Vi(e)||Xi(e,t))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",r=new URL(e,n);return typeof location<"u"?r.origin!==location.origin:!0}catch{return!!t}}function Gi(e,t){if(!t)return e;if(t.includes("{url}"))return t.replace("{urlRaw}",St(e)).replace("{url}",encodeURIComponent(e));if(/[?&]url=?$/.test(t))return`${t}${encodeURIComponent(e)}`;if(t.endsWith("?"))return`${t}url=${encodeURIComponent(e)}`;if(t.endsWith("/"))return`${t}${St(e)}`;let n=t.includes("?")?"&":"?";return`${t}${n}url=${encodeURIComponent(e)}`}function ir(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result||"")),r.onerror=()=>n(new Error("read_failed")),r.readAsDataURL(e)})}function Ki(e,t){return[t.as||"blob",t.timeout??3e3,t.useProxy||"",t.errorTTL??8e3,e].join("|")}async function ne(e,t={}){let n=t.as??"blob",r=t.timeout??3e3,i=t.useProxy||"",o=t.errorTTL??8e3,a=t.headers||{},c=!!t.silent;if(/^data:/i.test(e))try{if(n==="text")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(e),status:200,url:e,fromCache:!1,mime:String(e).slice(5).split(";")[0]||""};let[,m="",y=""]=String(e).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(m)?atob(y):decodeURIComponent(y),b=new Uint8Array([...x].map(E=>E.charCodeAt(0))),w=new Blob([b],{type:(m||"").split(";")[0]||""});return{ok:!0,data:w,status:200,url:e,fromCache:!1,mime:w.type||""}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(e))try{let m=await fetch(e);if(!m.ok)return{ok:!1,data:null,status:m.status,url:e,fromCache:!1,reason:"http_error"};let y=await m.blob(),x=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await ir(y),status:m.status,url:e,fromCache:!1,mime:x}:n==="text"?{ok:!0,data:await y.text(),status:m.status,url:e,fromCache:!1,mime:x}:{ok:!0,data:y,status:m.status,url:e,fromCache:!1,mime:x}}catch{return{ok:!1,data:null,status:0,url:e,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(e))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:e,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:e,fromCache:!1};let l=Ki(e,{as:n,timeout:r,useProxy:i,errorTTL:o}),s=Ke.get(l);if(s&&s.until>Date.now())return{...s.result,fromCache:!0};s&&Ke.delete(l);let u=gt.get(l);if(u)return u;let d=Yi(e,i)?Gi(e,i):e,f=t.credentials;if(!f)try{let m=typeof location<"u"&&location.href?location.href:"http://localhost/",y=new URL(e,m);f=typeof location<"u"&&y.origin===location.origin?"include":"omit"}catch{f="omit"}let p=new AbortController,g=setTimeout(()=>p.abort("timeout"),r),h=(async()=>{try{let m=await fetch(d,{signal:p.signal,credentials:f,headers:a});if(!m.ok){let b={ok:!1,data:null,status:m.status,url:d,fromCache:!1,reason:"http_error"};if(o>0&&Ke.set(l,{until:Date.now()+o,result:b}),!c){let w=`${m.status} ${m.statusText||""}`.trim();tn.warnOnce(`http:${m.status}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${e}`)}return t.onError&&t.onError(b),b}if(n==="text")return{ok:!0,data:await m.text(),status:m.status,url:d,fromCache:!1};let y=await m.blob(),x=y.type||m.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await ir(y),status:m.status,url:d,fromCache:!1,mime:x}:{ok:!0,data:y,status:m.status,url:d,fromCache:!1,mime:x}}catch(m){let y=m&&typeof m=="object"&&"name"in m&&m.name==="AbortError"?String(m.message||"").includes("timeout")?"timeout":"abort":"network",x={ok:!1,data:null,status:0,url:d,fromCache:!1,reason:y};if(!/^blob:/i.test(e)&&o>0&&Ke.set(l,{until:Date.now()+o,result:x}),!c){let b=`${y}:${n}:${new URL(e,location?.href??"http://localhost/").origin}`,w=y==="timeout"?`Timeout after ${r}ms. Consider increasing timeout or using a proxy for ${e}`:y==="abort"?`Request aborted while fetching ${n} ${e}`:`Network/CORS issue while fetching ${n} ${e}. A proxy may be required`;tn.errorOnce(b,w)}return t.onError&&t.onError(x),x}finally{clearTimeout(g),gt.delete(l)}})();return gt.set(l,h),h}var tn,gt,Ke,He=K(()=>{Ct(),tn=zi("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),gt=new Map,Ke=new Map});async function Lr(e,t={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(e)||e.trim()==="none")return e;let n=hn(e);if(!n)return e;let r=ji(n),i=St(r);if(C.background.has(i)){let o=C.background.get(i);return o?`url("${o}")`:"none"}try{let o=await ne(i,{as:"dataURL",useProxy:t.useProxy});return o.ok?(C.background.set(i,o.data),`url("${o.data}")`):(C.background.set(i,null),"none")}catch{return C.background.set(i,null),"none"}}var Ji=K(()=>{re(),Ct(),He()});function Zi(e){if(e=String(e).toLowerCase(),yn.has(e)){let o={};return C.defaultStyle.set(e,o),o}if(C.defaultStyle.has(e))return C.defaultStyle.get(e);let t=document.getElementById("snapdom-sandbox");t||(t=document.createElement("div"),t.id="snapdom-sandbox",t.setAttribute("data-snapdom-sandbox","true"),t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.width="0px",t.style.height="0px",t.style.overflow="hidden",document.body.appendChild(t));let n=document.createElement(e);n.style.all="initial",t.appendChild(n);let r=getComputedStyle(n),i={};for(let o of r){if(gn(o))continue;let a=r.getPropertyValue(o);i[o]=a}return t.removeChild(n),C.defaultStyle.set(e,i),i}function gn(e){let t=String(e).toLowerCase();return!!(_r.has(t)||Rr.test(t)||Nr.test(t))}function nn(e,t){if(t=String(t||"").toLowerCase(),yn.has(t))return"";let n=[],r=Zi(t),i=(e.display||"").toLowerCase()==="inline"||new Set(["span","small","em","strong","b","i","u","s","code","cite","mark","sub","sup"]).has(t);for(let[o,a]of Object.entries(e)){if(gn(o)||i&&(o==="width"||o==="min-width"||o==="max-width"))continue;let c=r[o];a&&a!==c&&n.push(`${o}:${a}`)}return n.sort(),n.join(";")}function Qi(e){let t=new Set;return e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(e.tagName&&t.add(e.tagName.toLowerCase()),typeof e.querySelectorAll=="function"&&e.querySelectorAll("*").forEach(n=>t.add(n.tagName.toLowerCase())),Array.from(t))}function ea(e){let t=new Map;for(let r of e){let i=C.defaultStyle.get(r);if(!i)continue;let o=Object.entries(i).map(([a,c])=>`${a}:${c};`).sort().join("");o&&(t.has(o)||t.set(o,[]),t.get(o).push(r))}let n="";for(let[r,i]of t.entries())n+=`${i.join(",")} { ${r} }
|
|
3
|
+
`;return n}function ta(e){let t=Array.from(new Set(e.values())).filter(Boolean).sort(),n=new Map,r=1;for(let i of t)n.set(i,`c${r++}`);return n}function na(e){try{let t=e?.ownerDocument;if(!t)return typeof window<"u"?window:null;let n=t.defaultView;if(n&&typeof n.getComputedStyle=="function")return n;if(typeof window<"u"&&window.frames)for(let r=0;r<window.frames.length;r++)try{if(window.frames[r]?.document===t)return window.frames[r]}catch{}}catch{}return typeof window<"u"?window:null}function pe(e,t=null){let n=()=>{let o={length:0,getPropertyValue:()=>"",item:()=>""};return o[Symbol.iterator]=function*(){},o};if(!(e instanceof Element)){let o=typeof window<"u"?window:null;if(o&&typeof o.getComputedStyle=="function")try{return o.getComputedStyle(e,t)||n()}catch{return n()}return n()}let r=C.computedStyle.get(e);r||(r=new Map,C.computedStyle.set(e,r));let i=r.get(t);if(!i){let o=na(e),a=null;try{a=o&&typeof o.getComputedStyle=="function"?o.getComputedStyle(e,t):null}catch{}if(!a&&typeof window<"u"&&typeof window.getComputedStyle=="function")try{e.ownerDocument===document&&(a=window.getComputedStyle(e,t))}catch{}i=a||n(),r.set(t,i)}return i}function ar(e){let t={};for(let n of e)t[n]=e.getPropertyValue(n);return t}function rn(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&n++,o===")"&&n--,o===","&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t}var Tr,yn,ra,Nr,Rr,_r,Pr=K(()=>{re(),Tr=new Set(["meta","script","noscript","title","link","template"]),yn=new Set(["meta","link","style","title","noscript","script","template","g","defs","use","marker","mask","clipPath","pattern","path","polygon","polyline","line","circle","ellipse","rect","filter","lineargradient","radialgradient","stop"]),ra=["div","span","p","a","img","ul","li","button","input","select","textarea","label","section","article","header","footer","nav","main","aside","h1","h2","h3","h4","h5","h6","table","thead","tbody","tr","td","th"],Nr=/(?:^|-)(animation|transition)(?:-|$)/i,Rr=/^(--.+|view-timeline|scroll-timeline|animation-trigger|offset-|position-try|app-region|interactivity|overlay|view-transition|-webkit-locale|-webkit-user-(?:drag|modify)|-webkit-tap-highlight-color|-webkit-text-security)$/i,_r=new Set(["cursor","pointer-events","touch-action","user-select","print-color-adjust","speak","reading-flow","reading-order","anchor-name","anchor-scope","container-name","container-type","timeline-scope"])});function Fe(e,{fast:t=!1}={}){if(t)return e();"requestIdleCallback"in window?requestIdleCallback(e,{timeout:50}):setTimeout(e,1)}function oa(){if(typeof navigator>"u")return!1;if(navigator.userAgentData)return navigator.userAgentData.platform==="iOS";let e=navigator.userAgent||"",t=/iPhone|iPad|iPod/.test(e),n=navigator.maxTouchPoints>2&&/Macintosh/.test(e);return t||n}function ke(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"",t=e.toLowerCase(),n=t.includes("safari")&&!t.includes("chrome")&&!t.includes("crios")&&!t.includes("fxios")&&!t.includes("android"),r=/applewebkit/i.test(e),i=/mobile/i.test(e),o=!/safari/i.test(e),a=r&&i&&o,c=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(e),l=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(t),s=/ipad|iphone|ipod/.test(t)&&r;return n||a||c||l||s}function ia(){if(typeof navigator>"u")return!1;let e=(navigator.userAgent||"").toLowerCase();return e.includes("firefox")||e.includes("fxios")}var tt=K(()=>{});function F(e,t,n){let r=e&&typeof e=="object"&&(e.options||e);r&&r.debug&&(n!==void 0?console.warn("[snapdom]",t,n):console.warn("[snapdom]",t))}var Fr=K(()=>{}),ie=K(()=>{Ji(),Pr(),tt(),Ct(),Fr()}),Dr={};et(Dr,{toCanvas:()=>kt});function aa(e){return typeof e=="string"&&/^data:image\/svg\+xml/i.test(e)}function la(e){let t=e.indexOf(",");return t>=0?decodeURIComponent(e.slice(t+1)):""}function sa(e){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`}function ca(e){let t=[],n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];o==="("&&r++,o===")"&&(r=Math.max(0,r-1)),o===";"&&r===0?(t.push(n),n=""):n+=o}return n.trim()&&t.push(n),t.map(i=>i.trim()).filter(Boolean)}function ua(e){let t=[],n="",r=0;for(let o=0;o<e.length;o++){let a=e[o];a==="("&&r++,a===")"&&(r=Math.max(0,r-1)),a===","&&r===0?(t.push(n.trim()),n=""):n+=a}n.trim()&&t.push(n.trim());let i=[];for(let o of t){if(/\binset\b/i.test(o))continue;let a=o.match(/-?\d+(?:\.\d+)?px/gi)||[],[c="0px",l="0px",s="0px"]=a,u=o.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),d=!!u&&u!==",";i.push(`drop-shadow(${c} ${l} ${s}${d?` ${u}`:""})`)}return i.join(" ")}function Ir(e){let t=ca(e),n=null,r=null,i=null,o=[];for(let c of t){let l=c.indexOf(":");if(l<0)continue;let s=c.slice(0,l).trim().toLowerCase(),u=c.slice(l+1).trim();s==="box-shadow"?i=u:s==="filter"?n=u:s==="-webkit-filter"?r=u:o.push([s,u])}if(i){let c=ua(i);c&&(n=n?`${n} ${c}`:c,r=r?`${r} ${c}`:c)}let a=[...o];return n&&a.push(["filter",n]),r&&a.push(["-webkit-filter",r]),a.map(([c,l])=>`${c}:${l}`).join(";")}function da(e){return e.replace(/([^{}]+)\{([^}]*)\}/g,(t,n,r)=>`${n}{${Ir(r)}}`)}function fa(e){return e=e.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(t,n)=>t.replace(n,da(n))),e=e.replace(/style=(['"])([\s\S]*?)\1/gi,(t,n,r)=>`style=${n}${Ir(r)}${n}`),e}function ma(e){if(!ke()||!aa(e))return e;try{let t=la(e),n=fa(t);return sa(n)}catch{return e}}async function kt(e,t){let{width:n,height:r,scale:i=1,dpr:o=1,meta:a={},backgroundColor:c}=t;e=ma(e);let l=new Image;l.loading="eager",l.decoding="sync",l.crossOrigin="anonymous",l.src=e,await l.decode();let s=l.naturalWidth,u=l.naturalHeight,d=Number.isFinite(a.w0)?a.w0:s,f=Number.isFinite(a.h0)?a.h0:u,p,g,h=Number.isFinite(n),m=Number.isFinite(r);if(h&&m)p=Math.max(1,n),g=Math.max(1,r);else if(h){let b=n/Math.max(1,d);p=n,g=f*b}else if(m){let b=r/Math.max(1,f);g=r,p=d*b}else p=s,g=u;p=p*i,g=g*i;let y=document.createElement("canvas");y.width=p*o,y.height=g*o,y.style.width=`${p}px`,y.style.height=`${g}px`;let x=y.getContext("2d");return o!==1&&x.scale(o,o),c&&(x.save(),x.fillStyle=c,x.fillRect(0,0,p,g),x.restore()),x.drawImage(l,0,0,p,g),y}var Mt=K(()=>{tt()}),yt={};et(yt,{rasterize:()=>Hr});async function Hr(e,t){let n=await kt(e,t),r=new Image;return r.src=n.toDataURL(`image/${t.format}`,t.quality),await r.decode(),r.style.width=`${n.width/t.dpr}px`,r.style.height=`${n.height/t.dpr}px`,r}var wt=K(()=>{Mt()}),on={};et(on,{toImg:()=>lr,toSvg:()=>lr});async function lr(e,t){let{scale:n=1,width:r,height:i,meta:o={}}=t,a=Number.isFinite(r),c=Number.isFinite(i),l=Number.isFinite(n)&&n!==1||a||c;if(ke()&&l)return await Hr(e,{...t,format:"png",quality:1,meta:o});let s=new Image;if(s.decoding="sync",s.loading="eager",s.src=e,await s.decode(),a&&c)s.style.width=`${r}px`,s.style.height=`${i}px`;else if(a){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,f=r/Math.max(1,u);s.style.width=`${r}px`,s.style.height=`${Math.round(d*f)}px`}else if(c){let u=Number.isFinite(o.w0)?o.w0:s.naturalWidth,d=Number.isFinite(o.h0)?o.h0:s.naturalHeight,f=i/Math.max(1,d);s.style.height=`${i}px`,s.style.width=`${Math.round(u*f)}px`}else{let u=Math.round(s.naturalWidth*n),d=Math.round(s.naturalHeight*n);if(s.style.width=`${u}px`,s.style.height=`${d}px`,typeof e=="string"&&e.startsWith("data:image/svg+xml"))try{let f=decodeURIComponent(e.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${d}"`);e=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,s.src=e}catch(f){F(t,"SVG width/height patch in toImg failed",f)}}return s}var sr=K(()=>{ie(),wt()}),Or={};et(Or,{toBlob:()=>Wr});async function Wr(e,t){let n=t.type;if(n==="svg"){let i=decodeURIComponent(e.split(",")[1]);return new Blob([i],{type:"image/svg+xml"})}let r=await kt(e,t);return new Promise(i=>r.toBlob(o=>i(o),`image/${n}`,t.quality))}var Br=K(()=>{Mt()}),Ur={};et(Ur,{download:()=>pa});async function cr(e,t){let n=new File([e],t,{type:e.type});if(!navigator.canShare?.({files:[n]}))return!1;try{await navigator.share({files:[n],title:t})}catch(r){if(r.name!=="AbortError")return!1}return!0}async function pa(e,t){let n=(t?.format||t?.type||"").toLowerCase(),r=n==="jpg"?"jpeg":n||"png",i=t?.filename||`snapdom.${r}`,o={...t||{},format:r,type:r};o.dpr=1;let a=oa();if(r==="svg"){let s=await Wr(e,{...o,type:"svg"});if(a&&await cr(s,i))return;let u=URL.createObjectURL(s),d=document.createElement("a");d.href=u,d.download=i,document.body.appendChild(d),d.click(),URL.revokeObjectURL(u),d.remove();return}let c=await kt(e,o);if(a){let s=`image/${r}`,u=await new Promise(d=>c.toBlob(d,s,t?.quality));if(u&&await cr(u,i))return}let l=document.createElement("a");l.href=c.toDataURL(`image/${r}`,t?.quality),l.download=i,document.body.appendChild(l),l.click(),l.remove()}var ha=K(()=>{Br(),Mt(),tt()});ie();ie();re();var ur=new WeakMap,an=new Map,ln=0;function Je(){ln++}var dr=!1;function ga(e=document.documentElement){if(!dr){dr=!0;try{new MutationObserver(()=>Je()).observe(e,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Je()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let t=document.fonts;t&&(t.addEventListener?.("loadingdone",Je),t.ready?.then(()=>Je()).catch(()=>{}))}catch{}}}function ya(e,t={}){let n={},r=e.getPropertyValue("visibility"),i=t.excludeStyleProps;for(let d=0;d<e.length;d++){let f=e[d];if(gn(f)||i&&(i instanceof RegExp&&i.test(f)||typeof i=="function"&&i(f)))continue;let p=e.getPropertyValue(f);(f==="background-image"||f==="content")&&p.includes("url(")&&!p.includes("data:")&&(p="none"),n[f]=p}let o=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let d of o)if(!n[d])try{let f=e.getPropertyValue(d);f&&(n[d]=f)}catch{}let a=["-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","paint-order"];for(let d of a)if(!n[d])try{let f=e.getPropertyValue(d);f&&(n[d]=f)}catch{}if(t.embedFonts){let d=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let f of d)if(!n[f])try{let p=e.getPropertyValue(f);p&&(n[f]=p)}catch{}}r==="hidden"&&(n.opacity="0");let c=parseFloat(e.getPropertyValue("border-top-width")||0)||0,l=parseFloat(e.getPropertyValue("border-right-width")||0)||0,s=parseFloat(e.getPropertyValue("border-bottom-width")||0)||0,u=parseFloat(e.getPropertyValue("border-left-width")||0)||0;if(c===0&&l===0&&s===0&&u===0){let d=(e.getPropertyValue("border-image-source")||"").trim(),f=d&&d!=="none",p=["border","border-top","border-right","border-bottom","border-left","border-width","border-style","border-color","border-top-width","border-top-style","border-top-color","border-right-width","border-right-style","border-right-color","border-bottom-width","border-bottom-style","border-bottom-color","border-left-width","border-left-style","border-left-color","border-block","border-block-width","border-block-style","border-block-color","border-inline","border-inline-width","border-inline-style","border-inline-color"];for(let g of p)delete n[g];f||(n.border="none")}return n}var fr=new WeakMap;function wa(e){let t=fr.get(e);return t||(t=Object.entries(e).sort((n,r)=>n[0]<r[0]?-1:n[0]>r[0]?1:0).map(([n,r])=>`${n}:${r}`).join(";"),fr.set(e,t),t)}function ba(e,t=null,n={}){let r=ur.get(e);if(r&&r.epoch===ln)return r.snapshot;let i=t||getComputedStyle(e),o=ya(i,n);return Ma(e,i,o),ur.set(e,{epoch:ln,snapshot:o}),o}function xa(e,t){return e&&e.session&&e.persist?e:e&&(e.styleMap||e.styleCache||e.nodeMap)?{session:e,persist:{snapshotKeyCache:an,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:t||{}}:{session:C.session,persist:{snapshotKeyCache:an,defaultStyle:C.defaultStyle,baseStyle:C.baseStyle,image:C.image,resource:C.resource,background:C.background,font:C.font},options:e||t||{}}}function va(e,t,n){if(!(!e.style||e.style.length===0))for(let r=0;r<e.style.length;r++){let i=e.style[r],o=n.getPropertyValue(i);o&&t.style.setProperty(i,o)}}async function De(e,t,n,r){if(e.tagName==="STYLE")return;let i=xa(n,r),o=i.options&&i.options.cache||"auto";o!=="disabled"&&ga(document.documentElement),o==="disabled"&&!i.session.__bumpedForDisabled&&(Je(),an.clear(),i.session.__bumpedForDisabled=!0);let{session:a,persist:c}=i;a.styleCache.has(e)||a.styleCache.set(e,getComputedStyle(e));let l=a.styleCache.get(e);e.getAttribute?.("style")&&va(e,t,l);let s=ba(e,l,i.options),u=wa(s),d=c.snapshotKeyCache.get(u);if(!d){let f=e.tagName?.toLowerCase()||"div";d=nn(s,f),c.snapshotKeyCache.set(u,d)}a.styleMap.set(t,d)}function Sa(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function Ea(e){return e.backgroundImage&&e.backgroundImage!=="none"||e.backgroundColor&&e.backgroundColor!=="rgba(0, 0, 0, 0)"&&e.backgroundColor!=="transparent"||(parseFloat(e.borderTopWidth)||0)>0||(parseFloat(e.borderBottomWidth)||0)>0||(parseFloat(e.paddingTop)||0)>0||(parseFloat(e.paddingBottom)||0)>0?!0:(e.overflowBlock||e.overflowY||"visible")!=="visible"}function Ca(e){let t=e.parentElement;if(!t)return!1;let n=getComputedStyle(t).display||"";return n.includes("flex")||n.includes("grid")}function ka(e,t){if(e.textContent&&/\S/.test(e.textContent))return!0;let n=e.firstElementChild,r=e.lastElementChild;if(n&&n.tagName==="BR"||r&&r.tagName==="BR")return!0;let i=e.scrollHeight;if(i===0)return!1;let o=parseFloat(t.paddingTop)||0,a=parseFloat(t.paddingBottom)||0;return i>o+a}function Ma(e,t,n){if(e instanceof HTMLElement&&e.style&&e.style.height)return;let r=e.tagName&&e.tagName.toLowerCase();if(!r||!["div","section","article","main","aside","header","footer","nav"].includes(r))return;let i=parseFloat(t.height);if(Number.isFinite(i)&&e.scrollHeight>0&&Math.abs(i-e.scrollHeight)>2||t.aspectRatio&&t.aspectRatio!=="none"&&t.aspectRatio!=="auto")return;let o=t.display||"";if(o.includes("flex")||o.includes("grid")||Sa(e))return;let a=t.position;if(a==="absolute"||a==="fixed"||a==="sticky"||t.transform!=="none"||Ea(t)||Ca(e))return;let c=t.overflowX||t.overflow||"visible",l=t.overflowY||t.overflow||"visible";if(c!=="visible"||l!=="visible")return;let s=t.clip;s&&s!=="auto"&&s!=="rect(auto, auto, auto, auto)"||t.visibility==="hidden"||t.opacity==="0"||ka(e,t)&&(delete n.height,delete n["block-size"])}Pr();var qr=["fill","stroke","color","background-color","stop-color"],mr=new Map;function Aa(e,t){let n=t+"::"+e.toLowerCase(),r=mr.get(n);if(r)return r;let i=document,o=t==="http://www.w3.org/2000/svg"?i.createElementNS(t,e):i.createElement(e),a=i.createElement("div");a.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",a.appendChild(o),i.documentElement.appendChild(a);let c=getComputedStyle(o),l={};for(let s of qr)l[s]=c.getPropertyValue(s)||"";return a.remove(),mr.set(n,l),l}function $a(e,t){if(!(e instanceof Element)||!(t instanceof Element))return;let n=e.getAttribute?.("style"),r=!!(n&&n.includes("var("));if(!r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let c=o[a];if(c&&typeof c.value=="string"&&c.value.includes("var(")){r=!0;break}}}let i=null;if(r)try{i=getComputedStyle(e)}catch{}if(r){let o=e.style;if(o&&o.length)for(let a=0;a<o.length;a++){let c=o[a],l=o.getPropertyValue(c);if(!l||!l.includes("var("))continue;let s=i&&i.getPropertyValue(c);if(s)try{t.style.setProperty(c,s.trim(),o.getPropertyPriority(c))}catch{}}}if(r&&e.attributes?.length){let o=e.attributes;for(let a=0;a<o.length;a++){let c=o[a];if(!c||typeof c.value!="string"||!c.value.includes("var("))continue;let l=c.name,s=i&&i.getPropertyValue(l);if(s)try{t.style.setProperty(l,s.trim())}catch{}}}if(!r){if(!i)try{i=getComputedStyle(e)}catch{i=null}if(!i)return;let o=e.namespaceURI||"html",a=Aa(e.tagName,o);for(let c of qr){let l=i.getPropertyValue(c)||"",s=a[c]||"";if(l&&l!==s)try{t.style.setProperty(c,l.trim())}catch{}}}}ie();ie();re();He();function Qt(e,t,n){return Promise.all(e.map(r=>new Promise(i=>{function o(){Fe(a=>{!(a&&typeof a.timeRemaining=="function")||a.timeRemaining()>0?t(r,i):o()},{fast:n})}o()})))}function La(e){return e=e.trim(),!e||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(e)?e:`${e}:not([data-sd-slotted])`}function Ta(e,t,n=!0){return e.split(",").map(r=>r.trim()).filter(Boolean).map(r=>{if(r.startsWith(":where(")||r.startsWith("@"))return r;let i=n?La(r):r;return`:where(${t} ${i})`}).join(", ")}function Na(e,t){return e?(e=e.replace(/:host\(([^)]+)\)/g,(n,r)=>`:where(${t}:is(${r.trim()}))`),e=e.replace(/:host\b/g,`:where(${t})`),e=e.replace(/:host-context\(([^)]+)\)/g,(n,r)=>`:where(:where(${r.trim()}) ${t})`),e=e.replace(/::slotted\(([^)]+)\)/g,(n,r)=>`:where(${t} ${r.trim()})`),e=e.replace(/(^|})(\s*)([^@}{]+){/g,(n,r,i,o)=>{let a=Ta(o,t,!0);return`${r}${i}${a}{`}),e):""}function Ra(e){return e.shadowScopeSeq=(e.shadowScopeSeq||0)+1,`s${e.shadowScopeSeq}`}function _a(e){let t="";try{e.querySelectorAll("style").forEach(r=>{t+=(r.textContent||"")+`
|
|
4
4
|
`});let n=e.adoptedStyleSheets||[];for(let r of n)try{if(r&&r.cssRules)for(let i of r.cssRules)t+=i.cssText+`
|
|
5
|
-
`}catch{}}catch{}return t}function
|
|
6
|
-
`:""}function Ha(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted","")))}async function Oa(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<t&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function Wa(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let l=getComputedStyle(e);n=parseFloat(l.borderLeftWidth)||0,r=parseFloat(l.borderRightWidth)||0,i=parseFloat(l.borderTopWidth)||0,o=parseFloat(l.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(n+r))),c=Math.max(0,Math.round(t.height-(i+o)));return{contentWidth:a,contentHeight:c,rect:t}}function fe(e){let t=0,n=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(n=e.offsetHeight),t===0||n===0)try{let r=getComputedStyle(e);if(t===0){let i=parseFloat(r.width);!isNaN(i)&&i>0&&(t=i)}if(n===0){let i=parseFloat(r.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(t===0||n===0)try{if(t===0){let r=parseFloat(e.getAttribute("width"));!isNaN(r)&&r>0&&(t=r)}if(n===0){let r=parseFloat(e.getAttribute("height"));!isNaN(r)&&r>0&&(n=r)}}catch{}if((t===0||n===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),n===0&&e.naturalHeight>0&&(n=e.naturalHeight)}catch{}return{width:t,height:n}}function Ba(e,t,n){let r=e.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function Ua(e,t,n){let r=await Oa(e,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=Wa(e),c=n?.snap;if(!c&&typeof window<"u"&&window.snapdom&&(c=window.snapdom),!c||typeof c.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let l={...n,scale:1},s=Ba(r,i,o),u;try{u=await c.toPng(r.documentElement,l)}finally{s()}u.style.display="block",u.style.width=`${i}px`,u.style.height=`${o}px`;let d=document.createElement("div");return t.nodeMap.set(d,e),Ie(e,d,t,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(u),d}function qa(e){let{width:t,height:n}=fe(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let o=i?parseFloat(i.width):NaN,a=i?parseFloat(i.height):NaN,c=Math.round(t||r.width||0),l=Math.round(n||r.height||0),s=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,c||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,l||16),d=(e.type||"text").toLowerCase()==="checkbox",f=!!e.checked,p=!!e.indeterminate,g=Math.max(Math.min(s,u),12),h=document.createElement("div");h.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),h.style.cssText=`display:inline-block;width:${g}px;height:${g}px;vertical-align:middle;flex-shrink:0;line-height:0;`;let m=document.createElementNS("http://www.w3.org/2000/svg","svg");m.setAttribute("width",String(g)),m.setAttribute("height",String(g)),m.setAttribute("viewBox",`0 0 ${g} ${g}`),h.appendChild(m);function y(){let x="#0a6ed1";try{i&&(x=i.accentColor||i.color||x)}catch{}let b=2,w=b/2,E=g-b;if(m.innerHTML="",d){let S=document.createElementNS("http://www.w3.org/2000/svg","rect");if(S.setAttribute("x",String(w)),S.setAttribute("y",String(w)),S.setAttribute("width",String(E)),S.setAttribute("height",String(E)),S.setAttribute("rx","2"),S.setAttribute("ry","2"),S.setAttribute("fill",f?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(b)),m.appendChild(S),f){let v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",`M ${w+2} ${g/2} L ${g/2-1} ${g-w-2} L ${g-w-2} ${w+2}`),v.setAttribute("stroke","white"),v.setAttribute("stroke-width",String(Math.max(1.5,b))),v.setAttribute("fill","none"),v.setAttribute("stroke-linecap","round"),v.setAttribute("stroke-linejoin","round"),m.appendChild(v)}else if(p){let v=document.createElementNS("http://www.w3.org/2000/svg","rect"),k=Math.max(6,E-4);v.setAttribute("x",String((g-k)/2)),v.setAttribute("y",String((g-b)/2)),v.setAttribute("width",String(k)),v.setAttribute("height",String(b)),v.setAttribute("fill",x),v.setAttribute("rx","1"),m.appendChild(v)}}else{let S=document.createElementNS("http://www.w3.org/2000/svg","circle");if(S.setAttribute("cx",String(g/2)),S.setAttribute("cy",String(g/2)),S.setAttribute("r",String((g-b)/2)),S.setAttribute("fill",f?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(b)),m.appendChild(S),f){let v=document.createElementNS("http://www.w3.org/2000/svg","circle"),k=Math.max(2,(g-b*2)*.35);v.setAttribute("cx",String(g/2)),v.setAttribute("cy",String(g/2)),v.setAttribute("r",String(k)),v.setAttribute("fill","white"),m.appendChild(v)}}h.style.setProperty("width",`${g}px`,"important"),h.style.setProperty("height",`${g}px`,"important"),h.style.setProperty("min-width",`${g}px`,"important"),h.style.setProperty("min-height",`${g}px`,"important")}return y(),{el:h,applyVisual:y}}var Ge=new te(80);async function Ze(e){if(C.resource?.has(e))return C.resource.get(e);if(Ge.has(e))return Ge.get(e);let t=(async()=>{let n=await ne(e,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return C.resource?.set(e,n.data),n.data})();Ge.set(e,t);try{let n=await t;return Ge.set(e,n),n}catch(n){throw Ge.delete(e),n}}var ja=/\bblob:[^)"'\s]+/g;async function mr(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(ja)||[]));if(t.length===0)return e;let n=e;for(let r of t)try{let i=await Ze(r);n=n.split(r).join(i)}catch{}return n}function ht(e){return typeof e=="string"&&e.startsWith("blob:")}function za(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let n=t.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function Va(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}async function Xa(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll("img"):[];for(let l of r)try{let s=l.getAttribute("src")||l.currentSrc||"";if(ht(s)){let d=await Ze(s);l.setAttribute("src",d)}let u=l.getAttribute("srcset");if(u&&u.includes("blob:")){let d=za(u),f=!1;for(let p of d)if(ht(p.url))try{p.url=await Ze(p.url),f=!0}catch(g){F(n,"blobUrlToDataUrl for srcset item failed",g)}f&&l.setAttribute("srcset",Va(d))}}catch(s){F(n,"resolveBlobUrls for img failed",s)}let i=e.querySelectorAll?e.querySelectorAll("image"):[];for(let l of i)try{let s="http://www.w3.org/1999/xlink",u=l.getAttribute("href")||l.getAttributeNS?.(s,"href");if(ht(u)){let d=await Ze(u);l.setAttribute("href",d),l.removeAttributeNS?.(s,"href")}}catch(s){F(n,"resolveBlobUrls for SVG image href failed",s)}let o=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let l of o)try{let s=l.getAttribute("style");if(s&&s.includes("blob:")){let u=await mr(s);l.setAttribute("style",u)}}catch(s){F(n,"replaceBlobUrls in inline style failed",s)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let l of a)try{let s=l.textContent||"";s.includes("blob:")&&(l.textContent=await mr(s))}catch(s){F(n,"replaceBlobUrls in style tag failed",s)}let c=["poster"];for(let l of c){let s=e.querySelectorAll?e.querySelectorAll(`[${l}^='blob:']`):[];for(let u of s)try{let d=u.getAttribute(l);ht(d)&&u.setAttribute(l,await Ze(d))}catch(d){F(n,`resolveBlobUrls for ${l} failed`,d)}}}tt();async function bt(e,t,n){if(!e)throw new Error("Invalid node");let r=new Set,i=null,o=null;if(e.nodeType===Node.ELEMENT_NODE){let u=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||Lr.has(u))return null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=fe(e),p=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${p}px;height:${g}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if(e.matches?.(u)){if(n.excludeMode==="hide"){let d=document.createElement("div"),{width:f,height:p}=fe(e),g=f||e.getBoundingClientRect().width||0,h=p||e.getBoundingClientRect().height||0;return d.style.cssText=`display:inline-block;width:${g}px;height:${h}px;visibility:hidden;`,d}else if(n.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${u}`,d)}if(typeof n.filter=="function")try{if(!n.filter(e)){if(n.filterMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=fe(e),p=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${p}px;height:${g}px;visibility:hidden;`,u}else if(n.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(e.tagName==="IFRAME"){let u=!1;try{u=!!(e.contentDocument||e.contentWindow?.document)}catch(d){F(t,"iframe same-origin probe failed",d)}if(u)try{return await Ua(e,t,n)}catch(d){console.warn("[SnapDOM] iframe rasterization failed, fallback:",d)}if(n.placeholders){let{width:d,height:f}=fe(e),p=document.createElement("div");return p.style.cssText=`width:${d}px;height:${f}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,Ie(e,p,t,n),p}else{let{width:d,height:f}=fe(e),p=document.createElement("div");return p.style.cssText=`display:inline-block;width:${d}px;height:${f}px;visibility:hidden;`,Ie(e,p,t,n),p}}if(e.getAttribute("data-capture")==="placeholder"){let u=e.cloneNode(!1);t.nodeMap.set(u,e),Ie(e,u,t,n);let d=document.createElement("div");return d.textContent=e.getAttribute("data-placeholder-text")||"",d.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",u.appendChild(d),u}if(e.tagName==="CANVAS"){let u="";try{let g=e.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){let h=document.createElement("canvas");h.width=e.width,h.height=e.height;let m=h.getContext("2d");m&&(m.drawImage(e,0,0),u=h.toDataURL("image/png"))}}}catch(g){F(t,"Canvas toDataURL failed, using empty/fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch(g){F(t,"img decoding/loading hints failed",g)}u&&(d.src=u),d.width=e.width,d.height=e.height;let{width:f,height:p}=fe(e);return f>0&&(d.style.width=`${f}px`),p>0&&(d.style.height=`${p}px`),t.nodeMap.set(d,e),Ie(e,d,t,n),d}let a;try{if(a=e.cloneNode(!1),Aa(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Pa(e,a);try{let{width:u,height:d}=fe(e),f=Math.round(u||0),p=Math.round(d||0);f&&(a.dataset.snapdomWidth=String(f)),p&&(a.dataset.snapdomHeight=String(p))}catch(u){F(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),f=y=>{let x=u.match(new RegExp(`${y}\\s*:\\s*([^;]+)`,"i")),b=x?x[1].trim():d.getPropertyValue(y);return/%|auto/i.test(String(b||""))},p=parseInt(a.dataset.snapdomWidth||"0",10),g=parseInt(a.dataset.snapdomHeight||"0",10),h=f("width")||!p,m=f("height")||!g;h&&p&&(a.style.width=`${p}px`),m&&g&&(a.style.height=`${g}px`),p&&(a.style.minWidth=`${p}px`),g&&(a.style.minHeight=`${g}px`)}catch(u){F(t,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",e,u),u}let c=null;if(e instanceof HTMLTextAreaElement){let{width:u,height:d}=fe(e),f=u||e.getBoundingClientRect().width||0,p=d||e.getBoundingClientRect().height||0;f&&(a.style.width=`${f}px`),p&&(a.style.height=`${p}px`)}if(e instanceof HTMLInputElement){let u=(e.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&oa()){let{el:d,applyVisual:f}=qa(e);t.nodeMap.set(d,e),c=f,a=d}else a.value=e.value,a.setAttribute("value",e.value),e.checked!==void 0&&(a.checked=e.checked,e.checked&&a.setAttribute("checked",""),e.indeterminate&&(a.indeterminate=e.indeterminate))}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(o=e.value),Ie(e,a,t,n),c&&c(),e.shadowRoot){let u=function(b,w){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return w(null);bt(b,t,n).then(E=>{w(E||null)}).catch(()=>{w(null)})};try{let b=e.shadowRoot.querySelectorAll("slot");for(let w of b){let E=[];try{E=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{E=w.assignedNodes?.()||[]}for(let S of E)r.add(S)}}catch{}let d=Na(t),f=`[data-sd="${d}"]`;try{a.setAttribute("data-sd",d)}catch{}let p=Ra(e.shadowRoot),g=Ta(p,f),h=Fa(p),m=Da(e,h,f);_a(a,m+g,d);let y=document.createDocumentFragment(),x=await Qt(Array.from(e.shadowRoot.childNodes),u,n.fast);y.append(...x.filter(b=>!!b)),a.appendChild(y)}if(e.tagName==="SLOT"){let u=function(h,m){bt(h,t,n).then(y=>{y&&Ha(y),m(y||null)}).catch(()=>{m(null)})},d=e.assignedNodes?.({flatten:!0})||[],f=d.length>0?d:Array.from(e.childNodes),p=document.createDocumentFragment(),g=await Qt(Array.from(f),u,n.fast);return p.append(...g.filter(h=>!!h)),p}function l(u,d){if(r.has(u))return d(null);bt(u,t,n).then(f=>{d(f||null)}).catch(()=>{d(null)})}let s=await Qt(Array.from(e.childNodes),l,n.fast);if(a.append(...s.filter(u=>!!u)),i!==null&&a instanceof HTMLSelectElement){a.value=i;for(let u of a.options)u.value===i?u.setAttribute("selected",""):u.removeAttribute("selected")}return o!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=o),a}ie();Ct();re();var Ya=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],_e=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),sn=[];function Ga(e){let t=Array.isArray(e)?e:[e];for(let n of t)n instanceof RegExp?sn.push(n):typeof n=="string"?sn.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function me(e){let t=typeof e=="string"?e:"",n=[...Ya,...sn];for(let r of n)if(r instanceof RegExp&&r.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function Ka(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var pr=new Map;function Ja(e=""){let t=Object.create(null),n=String(e||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function Za(e,t,n){let r=String(e||""),i=r.toLowerCase(),o=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let a=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?c="rounded":/\bsharp\b/.test(o)?c="sharp":/\boutlined\b/.test(o)&&(c="outlined");let l=a===1,s=null;if(l&&(c==="outlined"&&_e.materialIconsFilled?s={url:_e.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&_e.materialIconsRound?s={url:_e.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&_e.materialIconsSharp&&(s={url:_e.materialIconsSharp,alias:"snapdom-mi-sharp"})),!s)return{familyForMeasure:r,familyForCanvas:r};if(!pr.has(s.alias))try{let d=new FontFace(s.alias,`url(${s.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),pr.set(s.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${s.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function Qa(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function el(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!n&&t.toLowerCase()!=="currentcolor")return t;let r=e.color?.trim();return r&&r!=="inherit"?r:"#000"}async function tl(e,{family:t="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:a=""}={}){let c=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,s=Ja(o),{familyForMeasure:u,familyForCanvas:d}=await Za(c,a,s);await Qa(d.replace(/^["']+|["']+$/g,""),r);let f=document.createElement("span");f.textContent=e,f.style.position="absolute",f.style.visibility="hidden",f.style.left="-99999px",f.style.whiteSpace="nowrap",f.style.fontFamily=u,f.style.fontWeight=String(n||"normal"),f.style.fontSize=`${r}px`,f.style.lineHeight="1",f.style.margin="0",f.style.padding="0",f.style.fontFeatureSettings="'liga' 1",f.style.fontVariantLigatures="normal",f.style.color=i,document.body.appendChild(f);let p=f.getBoundingClientRect(),g=Math.max(1,Math.ceil(p.width)),h=Math.max(1,Math.ceil(p.height));document.body.removeChild(f);let m=document.createElement("canvas");m.width=g*l,m.height=h*l;let y=m.getContext("2d");y.scale(l,l),y.font=`${n?`${n} `:""}${r}px ${d}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=i;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:m.toDataURL(),width:g,height:h}}async function nl(e,t){if(!(e instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',r=Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(r.length===0)return 0;let i=t instanceof Element?Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],o=0;for(let a=0;a<r.length;a++){let c=r[a],l=i[a]||null;try{let s=getComputedStyle(l||c),u=s.fontFamily||"Material Icons";if(!Ka(u))continue;let d=(l||c).textContent.trim();if(!d)continue;let f=parseInt(s.fontSize,10)||24,p=s.fontWeight&&s.fontWeight!=="normal"?s.fontWeight:"normal",g=el(s),h=s.fontVariationSettings&&s.fontVariationSettings!=="normal"?s.fontVariationSettings:"",m=(l||c).className||"",{dataUrl:y,width:x,height:b}=await tl(d,{family:u,weight:p,fontSize:f,color:g,variation:h,className:m});c.textContent="";let w=c.ownerDocument.createElement("img");w.src=y,w.alt=d,w.style.height=`${f}px`,w.style.width=`${Math.max(1,Math.round(x/b*f))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(c).verticalAlign||"baseline",c.appendChild(w),o++}catch{}}return o}He();async function rl(e,t,n,r=32,i="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.textContent=e,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${t}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${r}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let c=a.getBoundingClientRect(),l=Math.ceil(c.width),s=Math.ceil(c.height);document.body.removeChild(a);let u=document.createElement("canvas");u.width=Math.max(1,l*o),u.height=Math.max(1,s*o);let d=u.getContext("2d");return d.scale(o,o),d.font=n?`${n} ${r}px "${t}"`:`${r}px "${t}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=i,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:l,height:s}}var ol=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),il=["katex","mathjax","mathml"];function At(e){if(!e)return"";for(let t of e.split(",")){let n=t.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!ol.has(n.toLowerCase()))return n}return""}function xt(e){let t=String(e??"400").trim().toLowerCase();if(t==="normal")return 400;if(t==="bold")return 700;let n=parseInt(t,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function vt(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function al(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function ll(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=xt(n[1]),o=xt(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=xt(t);return{min:r,max:r}}function sl(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function cl(e){let t=String(e||"100%").trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let o=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=t.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function ul(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function dl(e,t,n=[]){if(!e)return!1;try{let r=new URL(e,location.href);if(r.origin===location.origin)return!0;let i=r.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>i.endsWith(a))||n.some(a=>i===a.toLowerCase()||i.endsWith("."+a.toLowerCase())))return!0;let o=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(o)||/\.woff2?(\b|$)/.test(o)||il.some(a=>o.includes(a)))return!0;for(let a of t){let c=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),s=ul(a);if(o.includes(c)||o.includes(l)||s&&o.includes(s))return!0}return!1}catch{return!1}}function fl(e){let t=new Set;for(let n of e||[]){let r=String(n).split("__")[0]?.trim();r&&t.add(r)}return t}function hr(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,i)=>{let o=(i||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return n;let a=o;try{a=new URL(o,t||location.href).href}catch{}return`url("${a}")`})}var cn=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Et=4;async function ml(e,t,n){if(!e)return e;let r=new Set;function i(c,l){try{return new URL(c,l||location.href).href}catch{return c}}async function o(c,l,s=0){if(s>Et)return console.warn(`[snapDOM] @import depth exceeded (${Et}) at ${l}`),c;let u="",d=0,f;for(;f=cn.exec(c);){u+=c.slice(d,f.index),d=cn.lastIndex;let p=(f[2]||f[4]||"").trim(),g=i(p,l);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let h="";try{let m=await ne(g,{as:"text",useProxy:n,silent:!0});m.ok&&typeof m.data=="string"&&(h=m.data)}catch{}h?(h=hr(h,g),h=await o(h,g,s+1),u+=`
|
|
5
|
+
`}catch{}}catch{}return t}function Pa(e,t,n){if(!t)return;let r=document.createElement("style");r.setAttribute("data-sd",n),r.textContent=t,e.insertBefore(r,e.firstChild||null)}function Fa(e,t){try{let n=e.currentSrc||e.src||"";if(!n)return;t.setAttribute("src",n),t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.loading="eager",t.decoding="sync"}catch{}}function Da(e){let t=new Set;if(!e)return t;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,r;for(;r=n.exec(e);)t.add(r[1]);return t}function Ia(e,t){try{let n=getComputedStyle(e).getPropertyValue(t).trim();if(n)return n}catch{}try{let n=getComputedStyle(document.documentElement).getPropertyValue(t).trim();if(n)return n}catch{}return""}function Ha(e,t,n){let r=[];for(let i of t){let o=Ia(e,i);o&&r.push(`${i}: ${o};`)}return r.length?`${n}{${r.join("")}}
|
|
6
|
+
`:""}function Oa(e){e&&(e.nodeType===Node.ELEMENT_NODE&&e.setAttribute("data-sd-slotted",""),e.querySelectorAll&&e.querySelectorAll("*").forEach(t=>t.setAttribute("data-sd-slotted","")))}async function Wa(e,t=3){let n=()=>{try{return e.contentDocument||e.contentWindow?.document||null}catch{return null}},r=n(),i=0;for(;i<t&&(!r||!r.body&&!r.documentElement);)await new Promise(o=>setTimeout(o,0)),r=n(),i++;return r&&(r.body||r.documentElement)?r:null}function Ba(e){let t=e.getBoundingClientRect(),n=0,r=0,i=0,o=0;try{let l=getComputedStyle(e);n=parseFloat(l.borderLeftWidth)||0,r=parseFloat(l.borderRightWidth)||0,i=parseFloat(l.borderTopWidth)||0,o=parseFloat(l.borderBottomWidth)||0}catch{}let a=Math.max(0,Math.round(t.width-(n+r))),c=Math.max(0,Math.round(t.height-(i+o)));return{contentWidth:a,contentHeight:c,rect:t}}function fe(e){let t=0,n=0;if(e.offsetWidth>0&&(t=e.offsetWidth),e.offsetHeight>0&&(n=e.offsetHeight),t===0||n===0)try{let r=getComputedStyle(e);if(t===0){let i=parseFloat(r.width);!isNaN(i)&&i>0&&(t=i)}if(n===0){let i=parseFloat(r.height);!isNaN(i)&&i>0&&(n=i)}}catch{}if(t===0||n===0)try{if(t===0){let r=parseFloat(e.getAttribute("width"));!isNaN(r)&&r>0&&(t=r)}if(n===0){let r=parseFloat(e.getAttribute("height"));!isNaN(r)&&r>0&&(n=r)}}catch{}if((t===0||n===0)&&(e.naturalWidth||e.naturalHeight))try{t===0&&e.naturalWidth>0&&(t=e.naturalWidth),n===0&&e.naturalHeight>0&&(n=e.naturalHeight)}catch{}return{width:t,height:n}}function Ua(e,t,n){let r=e.createElement("style");return r.setAttribute("data-sd-iframe-pin",""),r.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${t}px !important;height: ${n}px !important;min-width: ${t}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(e.head||e.documentElement).appendChild(r),()=>{try{r.remove()}catch{}}}async function qa(e,t,n){let r=await Wa(e,3);if(!r)throw new Error("iframe document not accessible/ready");let{contentWidth:i,contentHeight:o,rect:a}=Ba(e),c=n?.snap;if(!c&&typeof window<"u"&&window.snapdom&&(c=window.snapdom),!c||typeof c.toPng!="function")throw new Error("[snapdom] iframe capture requires snapdom.toPng. Use snapdom(el) or pass options.snap. With ESM, assign window.snapdom = snapdom after import if using iframes.");let l={...n,scale:1},s=Ua(r,i,o),u;try{u=await c.toPng(r.documentElement,l)}finally{s()}u.style.display="block",u.style.width=`${i}px`,u.style.height=`${o}px`;let d=document.createElement("div");return t.nodeMap.set(d,e),De(e,d,t,n),d.style.overflow="hidden",d.style.display="block",d.style.width||(d.style.width=`${Math.round(a.width)}px`),d.style.height||(d.style.height=`${Math.round(a.height)}px`),d.appendChild(u),d}function ja(e){let{width:t,height:n}=fe(e),r=e.getBoundingClientRect(),i;try{i=window.getComputedStyle(e)}catch{}let o=i?parseFloat(i.width):NaN,a=i?parseFloat(i.height):NaN,c=Math.round(t||r.width||0),l=Math.round(n||r.height||0),s=Number.isFinite(o)&&o>0?Math.round(o):Math.max(12,c||16),u=Number.isFinite(a)&&a>0?Math.round(a):Math.max(12,l||16),d=(e.type||"text").toLowerCase()==="checkbox",f=!!e.checked,p=!!e.indeterminate,g=Math.max(Math.min(s,u),12),h=document.createElement("div");h.setAttribute("data-snapdom-input-replacement",e.type||"checkbox"),h.style.cssText=`display:inline-block;width:${g}px;height:${g}px;vertical-align:middle;flex-shrink:0;line-height:0;`;let m=document.createElementNS("http://www.w3.org/2000/svg","svg");m.setAttribute("width",String(g)),m.setAttribute("height",String(g)),m.setAttribute("viewBox",`0 0 ${g} ${g}`),h.appendChild(m);function y(){let x="#0a6ed1";try{i&&(x=i.accentColor||i.color||x)}catch{}let b=2,w=b/2,E=g-b;if(m.innerHTML="",d){let S=document.createElementNS("http://www.w3.org/2000/svg","rect");if(S.setAttribute("x",String(w)),S.setAttribute("y",String(w)),S.setAttribute("width",String(E)),S.setAttribute("height",String(E)),S.setAttribute("rx","2"),S.setAttribute("ry","2"),S.setAttribute("fill",f?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(b)),m.appendChild(S),f){let v=document.createElementNS("http://www.w3.org/2000/svg","path");v.setAttribute("d",`M ${w+2} ${g/2} L ${g/2-1} ${g-w-2} L ${g-w-2} ${w+2}`),v.setAttribute("stroke","white"),v.setAttribute("stroke-width",String(Math.max(1.5,b))),v.setAttribute("fill","none"),v.setAttribute("stroke-linecap","round"),v.setAttribute("stroke-linejoin","round"),m.appendChild(v)}else if(p){let v=document.createElementNS("http://www.w3.org/2000/svg","rect"),k=Math.max(6,E-4);v.setAttribute("x",String((g-k)/2)),v.setAttribute("y",String((g-b)/2)),v.setAttribute("width",String(k)),v.setAttribute("height",String(b)),v.setAttribute("fill",x),v.setAttribute("rx","1"),m.appendChild(v)}}else{let S=document.createElementNS("http://www.w3.org/2000/svg","circle");if(S.setAttribute("cx",String(g/2)),S.setAttribute("cy",String(g/2)),S.setAttribute("r",String((g-b)/2)),S.setAttribute("fill",f?x:"none"),S.setAttribute("stroke",x),S.setAttribute("stroke-width",String(b)),m.appendChild(S),f){let v=document.createElementNS("http://www.w3.org/2000/svg","circle"),k=Math.max(2,(g-b*2)*.35);v.setAttribute("cx",String(g/2)),v.setAttribute("cy",String(g/2)),v.setAttribute("r",String(k)),v.setAttribute("fill","white"),m.appendChild(v)}}h.style.setProperty("width",`${g}px`,"important"),h.style.setProperty("height",`${g}px`,"important"),h.style.setProperty("min-width",`${g}px`,"important"),h.style.setProperty("min-height",`${g}px`,"important")}return y(),{el:h,applyVisual:y}}var Ge=new te(80);async function Ze(e){if(C.resource?.has(e))return C.resource.get(e);if(Ge.has(e))return Ge.get(e);let t=(async()=>{let n=await ne(e,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${e}`);return C.resource?.set(e,n.data),n.data})();Ge.set(e,t);try{let n=await t;return Ge.set(e,n),n}catch(n){throw Ge.delete(e),n}}var za=/\bblob:[^)"'\s]+/g;async function pr(e){if(!e||e.indexOf("blob:")===-1)return e;let t=Array.from(new Set(e.match(za)||[]));if(t.length===0)return e;let n=e;for(let r of t)try{let i=await Ze(r);n=n.split(r).join(i)}catch{}return n}function ht(e){return typeof e=="string"&&e.startsWith("blob:")}function Va(e){return(e||"").split(",").map(t=>t.trim()).filter(Boolean).map(t=>{let n=t.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function Xa(e){return e.map(t=>t.desc?`${t.url} ${t.desc.trim()}`:t.url).join(", ")}async function Ya(e,t=null){if(!e)return;let n=t,r=e.querySelectorAll?e.querySelectorAll("img"):[];for(let l of r)try{let s=l.getAttribute("src")||l.currentSrc||"";if(ht(s)){let d=await Ze(s);l.setAttribute("src",d)}let u=l.getAttribute("srcset");if(u&&u.includes("blob:")){let d=Va(u),f=!1;for(let p of d)if(ht(p.url))try{p.url=await Ze(p.url),f=!0}catch(g){F(n,"blobUrlToDataUrl for srcset item failed",g)}f&&l.setAttribute("srcset",Xa(d))}}catch(s){F(n,"resolveBlobUrls for img failed",s)}let i=e.querySelectorAll?e.querySelectorAll("image"):[];for(let l of i)try{let s="http://www.w3.org/1999/xlink",u=l.getAttribute("href")||l.getAttributeNS?.(s,"href");if(ht(u)){let d=await Ze(u);l.setAttribute("href",d),l.removeAttributeNS?.(s,"href")}}catch(s){F(n,"resolveBlobUrls for SVG image href failed",s)}let o=e.querySelectorAll?e.querySelectorAll("[style*='blob:']"):[];for(let l of o)try{let s=l.getAttribute("style");if(s&&s.includes("blob:")){let u=await pr(s);l.setAttribute("style",u)}}catch(s){F(n,"replaceBlobUrls in inline style failed",s)}let a=e.querySelectorAll?e.querySelectorAll("style"):[];for(let l of a)try{let s=l.textContent||"";s.includes("blob:")&&(l.textContent=await pr(s))}catch(s){F(n,"replaceBlobUrls in style tag failed",s)}let c=["poster"];for(let l of c){let s=e.querySelectorAll?e.querySelectorAll(`[${l}^='blob:']`):[];for(let u of s)try{let d=u.getAttribute(l);ht(d)&&u.setAttribute(l,await Ze(d))}catch(d){F(n,`resolveBlobUrls for ${l} failed`,d)}}}tt();async function bt(e,t,n){if(!e)throw new Error("Invalid node");let r=new Set,i=null,o=null;if(e.nodeType===Node.ELEMENT_NODE){let u=(e.localName||e.tagName||"").toLowerCase();if(e.id==="snapdom-sandbox"||e.hasAttribute("data-snapdom-sandbox")||Tr.has(u))return null}if(e.nodeType===Node.TEXT_NODE||e.nodeType!==Node.ELEMENT_NODE)return e.cloneNode(!0);if(e.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=fe(e),p=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${p}px;height:${g}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let u of n.exclude)try{if(e.matches?.(u)){if(n.excludeMode==="hide"){let d=document.createElement("div"),{width:f,height:p}=fe(e),g=f||e.getBoundingClientRect().width||0,h=p||e.getBoundingClientRect().height||0;return d.style.cssText=`display:inline-block;width:${g}px;height:${h}px;visibility:hidden;`,d}else if(n.excludeMode==="remove")return null}}catch(d){console.warn(`Invalid selector in exclude option: ${u}`,d)}if(typeof n.filter=="function")try{if(!n.filter(e)){if(n.filterMode==="hide"){let u=document.createElement("div"),{width:d,height:f}=fe(e),p=d||e.getBoundingClientRect().width||0,g=f||e.getBoundingClientRect().height||0;return u.style.cssText=`display:inline-block;width:${p}px;height:${g}px;visibility:hidden;`,u}else if(n.filterMode==="remove")return null}}catch(u){console.warn("Error in filter function:",u)}if(e.tagName==="IFRAME"){let u=!1;try{u=!!(e.contentDocument||e.contentWindow?.document)}catch(d){F(t,"iframe same-origin probe failed",d)}if(u)try{return await qa(e,t,n)}catch(d){console.warn("[SnapDOM] iframe rasterization failed, fallback:",d)}if(n.placeholders){let{width:d,height:f}=fe(e),p=document.createElement("div");return p.style.cssText=`width:${d}px;height:${f}px;background-image:repeating-linear-gradient(45deg,#ddd,#ddd 5px,#f9f9f9 5px,#f9f9f9 10px);display:flex;align-items:center;justify-content:center;font-size:12px;color:#555;border:1px solid #aaa;`,De(e,p,t,n),p}else{let{width:d,height:f}=fe(e),p=document.createElement("div");return p.style.cssText=`display:inline-block;width:${d}px;height:${f}px;visibility:hidden;`,De(e,p,t,n),p}}if(e.getAttribute("data-capture")==="placeholder"){let u=e.cloneNode(!1);t.nodeMap.set(u,e),De(e,u,t,n);let d=document.createElement("div");return d.textContent=e.getAttribute("data-placeholder-text")||"",d.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",u.appendChild(d),u}if(e.tagName==="CANVAS"){let u="";try{let g=e.getContext("2d",{willReadFrequently:!0});try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){try{g&&g.getImageData(0,0,1,1)}catch{}if(await new Promise(h=>requestAnimationFrame(h)),u=e.toDataURL("image/png"),!u||u==="data:,"){let h=document.createElement("canvas");h.width=e.width,h.height=e.height;let m=h.getContext("2d");m&&(m.drawImage(e,0,0),u=h.toDataURL("image/png"))}}}catch(g){F(t,"Canvas toDataURL failed, using empty/fallback",g)}let d=document.createElement("img");try{d.decoding="sync",d.loading="eager"}catch(g){F(t,"img decoding/loading hints failed",g)}u&&(d.src=u),d.width=e.width,d.height=e.height;let{width:f,height:p}=fe(e);return f>0&&(d.style.width=`${f}px`),p>0&&(d.style.height=`${p}px`),t.nodeMap.set(d,e),De(e,d,t,n),d}let a;try{if(a=e.cloneNode(!1),$a(e,a),t.nodeMap.set(a,e),e.tagName==="IMG"){Fa(e,a);try{let{width:u,height:d}=fe(e),f=Math.round(u||0),p=Math.round(d||0);f&&(a.dataset.snapdomWidth=String(f)),p&&(a.dataset.snapdomHeight=String(p))}catch(u){F(t,"getUnscaledDimensions for IMG failed",u)}try{let u=e.getAttribute("style")||"",d=window.getComputedStyle(e),f=y=>{let x=u.match(new RegExp(`${y}\\s*:\\s*([^;]+)`,"i")),b=x?x[1].trim():d.getPropertyValue(y);return/%|auto/i.test(String(b||""))},p=parseInt(a.dataset.snapdomWidth||"0",10),g=parseInt(a.dataset.snapdomHeight||"0",10),h=f("width")||!p,m=f("height")||!g;h&&p&&(a.style.width=`${p}px`),m&&g&&(a.style.height=`${g}px`),p&&(a.style.minWidth=`${p}px`),g&&(a.style.minHeight=`${g}px`)}catch(u){F(t,"IMG dimension freeze failed",u)}}}catch(u){throw console.error("[Snapdom] Failed to clone node:",e,u),u}let c=null;if(e instanceof HTMLTextAreaElement){let{width:u,height:d}=fe(e),f=u||e.getBoundingClientRect().width||0,p=d||e.getBoundingClientRect().height||0;f&&(a.style.width=`${f}px`),p&&(a.style.height=`${p}px`)}if(e instanceof HTMLInputElement){let u=(e.type||"text").toLowerCase();if((u==="checkbox"||u==="radio")&&ia()){let{el:d,applyVisual:f}=ja(e);t.nodeMap.set(d,e),c=f,a=d}else a.value=e.value,a.setAttribute("value",e.value),e.checked!==void 0&&(a.checked=e.checked,e.checked&&a.setAttribute("checked",""),e.indeterminate&&(a.indeterminate=e.indeterminate))}if(e instanceof HTMLSelectElement&&(i=e.value),e instanceof HTMLTextAreaElement&&(o=e.value),De(e,a,t,n),c&&c(),e.shadowRoot){let u=function(b,w){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return w(null);bt(b,t,n).then(E=>{w(E||null)}).catch(()=>{w(null)})};try{let b=e.shadowRoot.querySelectorAll("slot");for(let w of b){let E=[];try{E=w.assignedNodes?.({flatten:!0})||w.assignedNodes?.()||[]}catch{E=w.assignedNodes?.()||[]}for(let S of E)r.add(S)}}catch{}let d=Ra(t),f=`[data-sd="${d}"]`;try{a.setAttribute("data-sd",d)}catch{}let p=_a(e.shadowRoot),g=Na(p,f),h=Da(p),m=Ha(e,h,f);Pa(a,m+g,d);let y=document.createDocumentFragment(),x=await Qt(Array.from(e.shadowRoot.childNodes),u,n.fast);y.append(...x.filter(b=>!!b)),a.appendChild(y)}if(e.tagName==="SLOT"){let u=function(h,m){bt(h,t,n).then(y=>{y&&Oa(y),m(y||null)}).catch(()=>{m(null)})},d=e.assignedNodes?.({flatten:!0})||[],f=d.length>0?d:Array.from(e.childNodes),p=document.createDocumentFragment(),g=await Qt(Array.from(f),u,n.fast);return p.append(...g.filter(h=>!!h)),p}function l(u,d){if(r.has(u))return d(null);bt(u,t,n).then(f=>{d(f||null)}).catch(()=>{d(null)})}let s=await Qt(Array.from(e.childNodes),l,n.fast);if(a.append(...s.filter(u=>!!u)),i!==null&&a instanceof HTMLSelectElement){a.value=i;for(let u of a.options)u.value===i?u.setAttribute("selected",""):u.removeAttribute("selected")}return o!==null&&a instanceof HTMLTextAreaElement&&(a.textContent=o),a}ie();Ct();re();var Ga=[/font\s*awesome/i,/material\s*icons/i,/ionicons/i,/glyphicons/i,/feather/i,/bootstrap\s*icons/i,/remix\s*icons/i,/heroicons/i,/layui/i,/lucide/i],_e=Object.assign({materialIconsFilled:"https://fonts.gstatic.com/s/materialicons/v48/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.woff2",materialIconsOutlined:"https://fonts.gstatic.com/s/materialiconsoutlined/v110/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUcel5euIg.woff2",materialIconsRound:"https://fonts.gstatic.com/s/materialiconsround/v109/LDItaoyNOAY6Uewc665JcIzCKsKc_M9flwmPq_HTTw.woff2",materialIconsSharp:"https://fonts.gstatic.com/s/materialiconssharp/v110/oPWQ_lt5nv4pWNJpghLP75WiFR4kLh3kvmvRImcycg.woff2"},typeof window<"u"&&window.__SNAPDOM_ICON_FONTS__||{}),sn=[];function Ka(e){let t=Array.isArray(e)?e:[e];for(let n of t)n instanceof RegExp?sn.push(n):typeof n=="string"?sn.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function me(e){let t=typeof e=="string"?e:"",n=[...Ga,...sn];for(let r of n)if(r instanceof RegExp&&r.test(t))return!0;return!!(/icon/i.test(t)||/glyph/i.test(t)||/symbols/i.test(t)||/feather/i.test(t)||/fontawesome/i.test(t))}function Ja(e=""){let t=String(e).toLowerCase();return/\bmaterial\s*icons\b/.test(t)||/\bmaterial\s*symbols\b/.test(t)}var hr=new Map;function Za(e=""){let t=Object.create(null),n=String(e||""),r=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,i;for(;i=r.exec(n);)t[i[1].toUpperCase()]=Number(i[2]);return t}async function Qa(e,t,n){let r=String(e||""),i=r.toLowerCase(),o=String(t||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(i)&&!/\bsymbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};if(!/\bmaterial\s*symbols\b/.test(i))return{familyForMeasure:r,familyForCanvas:r};let a=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(o)||/\bround\b/.test(o)?c="rounded":/\bsharp\b/.test(o)?c="sharp":/\boutlined\b/.test(o)&&(c="outlined");let l=a===1,s=null;if(l&&(c==="outlined"&&_e.materialIconsFilled?s={url:_e.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&_e.materialIconsRound?s={url:_e.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&_e.materialIconsSharp&&(s={url:_e.materialIconsSharp,alias:"snapdom-mi-sharp"})),!s)return{familyForMeasure:r,familyForCanvas:r};if(!hr.has(s.alias))try{let d=new FontFace(s.alias,`url(${s.url})`,{style:"normal",weight:"400"});document.fonts.add(d),await d.load(),hr.set(s.alias,!0)}catch{return{familyForMeasure:r,familyForCanvas:r}}let u=`"${s.alias}"`;return{familyForMeasure:u,familyForCanvas:u}}async function el(e="Material Icons",t=24){try{await Promise.all([document.fonts.load(`400 ${t}px "${String(e).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function tl(e){let t=e.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(t)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(t);if(t&&!n&&t.toLowerCase()!=="currentcolor")return t;let r=e.color?.trim();return r&&r!=="inherit"?r:"#000"}async function nl(e,{family:t="Material Icons",weight:n="normal",fontSize:r=32,color:i="#000",variation:o="",className:a=""}={}){let c=String(t||"").replace(/^['"]+|['"]+$/g,""),l=window.devicePixelRatio||1,s=Za(o),{familyForMeasure:u,familyForCanvas:d}=await Qa(c,a,s);await el(d.replace(/^["']+|["']+$/g,""),r);let f=document.createElement("span");f.textContent=e,f.style.position="absolute",f.style.visibility="hidden",f.style.left="-99999px",f.style.whiteSpace="nowrap",f.style.fontFamily=u,f.style.fontWeight=String(n||"normal"),f.style.fontSize=`${r}px`,f.style.lineHeight="1",f.style.margin="0",f.style.padding="0",f.style.fontFeatureSettings="'liga' 1",f.style.fontVariantLigatures="normal",f.style.color=i,document.body.appendChild(f);let p=f.getBoundingClientRect(),g=Math.max(1,Math.ceil(p.width)),h=Math.max(1,Math.ceil(p.height));document.body.removeChild(f);let m=document.createElement("canvas");m.width=g*l,m.height=h*l;let y=m.getContext("2d");y.scale(l,l),y.font=`${n?`${n} `:""}${r}px ${d}`,y.textAlign="left",y.textBaseline="top",y.fillStyle=i;try{y.fontKerning="normal"}catch{}return y.fillText(e,0,0),{dataUrl:m.toDataURL(),width:g,height:h}}async function rl(e,t){if(!(e instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',r=Array.from(e.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim());if(r.length===0)return 0;let i=t instanceof Element?Array.from(t.querySelectorAll(n)).filter(a=>a&&a.textContent&&a.textContent.trim()):[],o=0;for(let a=0;a<r.length;a++){let c=r[a],l=i[a]||null;try{let s=getComputedStyle(l||c),u=s.fontFamily||"Material Icons";if(!Ja(u))continue;let d=(l||c).textContent.trim();if(!d)continue;let f=parseInt(s.fontSize,10)||24,p=s.fontWeight&&s.fontWeight!=="normal"?s.fontWeight:"normal",g=tl(s),h=s.fontVariationSettings&&s.fontVariationSettings!=="normal"?s.fontVariationSettings:"",m=(l||c).className||"",{dataUrl:y,width:x,height:b}=await nl(d,{family:u,weight:p,fontSize:f,color:g,variation:h,className:m});c.textContent="";let w=c.ownerDocument.createElement("img");w.src=y,w.alt=d,w.style.height=`${f}px`,w.style.width=`${Math.max(1,Math.round(x/b*f))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(c).verticalAlign||"baseline",c.appendChild(w),o++}catch{}}return o}He();async function ol(e,t,n,r=32,i="#000"){t=t.replace(/^['"]+|['"]+$/g,"");let o=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let a=document.createElement("span");a.textContent=e,a.style.position="absolute",a.style.visibility="hidden",a.style.fontFamily=`"${t}"`,a.style.fontWeight=n||"normal",a.style.fontSize=`${r}px`,a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.padding="0",a.style.margin="0",document.body.appendChild(a);let c=a.getBoundingClientRect(),l=Math.ceil(c.width),s=Math.ceil(c.height);document.body.removeChild(a);let u=document.createElement("canvas");u.width=Math.max(1,l*o),u.height=Math.max(1,s*o);let d=u.getContext("2d");return d.scale(o,o),d.font=n?`${n} ${r}px "${t}"`:`${r}px "${t}"`,d.textAlign="left",d.textBaseline="top",d.fillStyle=i,d.fillText(e,0,0),{dataUrl:u.toDataURL(),width:l,height:s}}var il=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]),al=["katex","mathjax","mathml"];function At(e){if(!e)return"";for(let t of e.split(",")){let n=t.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!il.has(n.toLowerCase()))return n}return""}function xt(e){let t=String(e??"400").trim().toLowerCase();if(t==="normal")return 400;if(t==="bold")return 700;let n=parseInt(t,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function vt(e){let t=String(e??"normal").trim().toLowerCase();return t.startsWith("italic")?"italic":t.startsWith("oblique")?"oblique":"normal"}function ll(e){let t=String(e??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return t?Math.max(50,Math.min(200,parseFloat(t[1]))):100}function sl(e){let t=String(e||"400").trim(),n=t.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let i=xt(n[1]),o=xt(n[2]);return{min:Math.min(i,o),max:Math.max(i,o)}}let r=xt(t);return{min:r,max:r}}function cl(e){let t=String(e||"normal").trim().toLowerCase();return t==="italic"?{kind:"italic"}:t.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function ul(e){let t=String(e||"100%").trim(),n=t.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let o=parseFloat(n[1]),a=parseFloat(n[2]);return{min:Math.min(o,a),max:Math.max(o,a)}}let r=t.match(/(\d+(?:\.\d+)?)\s*%/),i=r?parseFloat(r[1]):100;return{min:i,max:i}}function dl(e){return!e||typeof e!="string"?"":e.replace(/\s+(variable|vf|v[0-9]+)$/i,"").trim().toLowerCase().replace(/\s+/g,"-")}function fl(e,t,n=[]){if(!e)return!1;try{let r=new URL(e,location.href);if(r.origin===location.origin)return!0;let i=r.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com","cdn.jsdelivr.net","unpkg.com","cdnjs.cloudflare.com","esm.sh"].some(a=>i.endsWith(a))||n.some(a=>i===a.toLowerCase()||i.endsWith("."+a.toLowerCase())))return!0;let o=(r.pathname+r.search).toLowerCase();if(/\bfont(s)?\b/.test(o)||/\.woff2?(\b|$)/.test(o)||al.some(a=>o.includes(a)))return!0;for(let a of t){let c=a.toLowerCase().replace(/\s+/g,"+"),l=a.toLowerCase().replace(/\s+/g,"-"),s=dl(a);if(o.includes(c)||o.includes(l)||s&&o.includes(s))return!0}return!1}catch{return!1}}function ml(e){let t=new Set;for(let n of e||[]){let r=String(n).split("__")[0]?.trim();r&&t.add(r)}return t}function gr(e,t){return e&&e.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,r,i)=>{let o=(i||"").trim();if(!o||/^data:|^blob:|^https?:|^file:|^about:/i.test(o))return n;let a=o;try{a=new URL(o,t||location.href).href}catch{}return`url("${a}")`})}var cn=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,Et=4;async function pl(e,t,n){if(!e)return e;let r=new Set;function i(c,l){try{return new URL(c,l||location.href).href}catch{return c}}async function o(c,l,s=0){if(s>Et)return console.warn(`[snapDOM] @import depth exceeded (${Et}) at ${l}`),c;let u="",d=0,f;for(;f=cn.exec(c);){u+=c.slice(d,f.index),d=cn.lastIndex;let p=(f[2]||f[4]||"").trim(),g=i(p,l);if(r.has(g)){console.warn(`[snapDOM] Skipping circular @import: ${g}`);continue}r.add(g);let h="";try{let m=await ne(g,{as:"text",useProxy:n,silent:!0});m.ok&&typeof m.data=="string"&&(h=m.data)}catch{}h?(h=gr(h,g),h=await o(h,g,s+1),u+=`
|
|
7
7
|
/* inlined: ${g} */
|
|
8
8
|
${h}
|
|
9
|
-
`):u+=f[0]}return u+=c.slice(d),u}let a=hr(e,t||location.href);return a=await o(a,t||location.href,0),a}var qr=/url\((["']?)([^"')]+)\1\)/g,pl=/@font-face[^{}]*\{[^}]*\}/g;function jr(e){if(!e)return[];let t=[],n=e.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let i=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let o=i[1],a=i[2],c=l=>{if(!l.includes("?"))return parseInt(l,16);let s=parseInt(l.replace(/\?/g,"0"),16),u=parseInt(l.replace(/\?/g,"F"),16);return[s,u]};if(a){let l=c(o),s=c(a),u=Array.isArray(l)?l[0]:l,d=Array.isArray(s)?s[1]:s;t.push([Math.min(u,d),Math.max(u,d)])}else{let l=c(o);Array.isArray(l)?t.push([l[0],l[1]]):t.push([l,l])}}return t}function zr(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[r,i]of t)if(n>=r&&n<=i)return!0;return!1}function wn(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(qr)){let i=(r[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,t||location.href).href}catch{}n.push(i)}}return n}async function Vr(e,t,n=""){let r=e;for(let i of e.matchAll(qr)){let o=hn(i[0]);if(!o)continue;let a=o;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!me(a)){if(C.resource?.has(a)){C.font?.add(a),r=r.replace(i[0],`url(${C.resource.get(a)})`);continue}if(!C.font?.has(a))try{let c=await ne(a,{as:"dataURL",useProxy:n,silent:!0});if(c.ok&&typeof c.data=="string"){let l=c.data;C.resource?.set(a,l),C.font?.add(a),r=r.replace(i[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return r}function hl(e){if(!e.length)return null;let t=(a,c)=>e.some(([l,s])=>!(s<a||l>c)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),o=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":o?"cyrillic":i?"greek":r?"latin-ext":n?"latin":null}function gr(e={}){let t=new Set((e.families||[]).map(i=>String(i).toLowerCase())),n=new Set((e.domains||[]).map(i=>String(i).toLowerCase())),r=new Set((e.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(t.size&&t.has(i.family.toLowerCase()))return!0;if(n.size)for(let a of i.srcUrls)try{if(n.has(new URL(a).host.toLowerCase()))return!0}catch{}if(r.size){let a=hl(o);if(a&&r.has(a))return!0}return!1}}function gl(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let o of e.match(t)||[]){let a=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",c=At(a),l=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),s=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),d=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),f=(o.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),p=wn(f,location.href),g=p.length?p.map(m=>String(m).toLowerCase()).sort().join("|"):f.toLowerCase(),h=[String(c||"").toLowerCase(),l,s,u,d.toLowerCase(),g].join("|");n.has(h)||(n.add(h),r.push(o))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||"")}function yl(e,t,n,r,i){let o=Array.from(e||[]).sort().join("|"),a=t?JSON.stringify({families:(t.families||[]).map(u=>String(u).toLowerCase()).sort(),domains:(t.domains||[]).map(u=>String(u).toLowerCase()).sort(),subsets:(t.subsets||[]).map(u=>String(u).toLowerCase()).sort()}):"",c=(n||[]).map(u=>`${(u.family||"").toLowerCase()}::${u.weight||"normal"}::${u.style||"normal"}::${u.src||""}`).sort().join("|"),l=r||"",s=(i||[]).map(u=>String(u).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${c}::px=${l}::fd=${s}`}async function Xr(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let o=(a,c)=>{try{return new URL(a,c||location.href).href}catch{return a}};for(let a of i){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let c=a.href?o(a.href,t):t;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${c}`);continue}if(c&&r.visitedSheets.has(c)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${c}`);continue}c&&r.visitedSheets.add(c);let l={...r,depth:(r.depth||0)+1};await Xr(a.styleSheet,c,n,l);continue}if(a.type===CSSRule.FONT_FACE_RULE){let c=(a.style.getPropertyValue("font-family")||"").trim(),l=At(c);if(!l||me(l))continue;let s=(a.style.getPropertyValue("font-weight")||"400").trim(),u=(a.style.getPropertyValue("font-style")||"normal").trim(),d=(a.style.getPropertyValue("font-stretch")||"100%").trim(),f=(a.style.getPropertyValue("src")||"").trim(),p=(a.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(l,u,s,d))continue;let g=jr(p);if(!zr(r.usedCodepoints,g))continue;let h={family:l,weightSpec:s,styleSpec:u,stretchSpec:d,unicodeRange:p,srcRaw:f,srcUrls:wn(f,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(h,g))continue;if(/url\(/i.test(f)){let m=await Vr(f,t||location.href,r.useProxy);await n(`@font-face{font-family:${l};src:${m};font-style:${u};font-weight:${s};font-stretch:${d};${p?`unicode-range:${p};`:""}}`)}else await n(`@font-face{font-family:${l};src:${f};font-style:${u};font-weight:${s};font-stretch:${d};${p?`unicode-range:${p};`:""}}`)}}}async function wl({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i="",fontStylesheetDomains:o=[]}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let a=new Map;for(let m of e){let[y,x,b,w]=String(m).split("__");if(!y)continue;let E=a.get(y)||[];E.push({w:parseInt(x,10),s:b,st:parseInt(w,10)}),a.set(y,E)}function c(m,y,x,b){if(!a.has(m))return!1;let w=a.get(m),E=ll(x),S=sl(y),v=cl(b),k=E.min!==E.max,T=E.min,W=$=>S.kind==="normal"&&$==="normal"||S.kind!=="normal"&&($==="italic"||$==="oblique"),D=!1;for(let $ of w){let A=k?$.w>=E.min&&$.w<=E.max:$.w===T,H=W(vt($.s)),V=$.st>=v.min&&$.st<=v.max;if(A&&H&&V){D=!0;break}}if(D)return!0;if(!k)for(let $ of w){let A=W(vt($.s)),H=$.st>=v.min&&$.st<=v.max;if(Math.abs(T-$.w)<=300&&A&&H)return!0}if(!k&&S.kind==="normal"&&w.some($=>vt($.s)!=="normal"))for(let $ of w){let A=Math.abs(T-$.w)<=300,H=$.st>=v.min&&$.st<=v.max;if(A&&H)return!0}return!1}let l=gr(n),s=yl(e,n,r,i,o);if(C.resource?.has(s))return C.resource.get(s);let u=fl(e),d=[],f=cn;for(let m of document.querySelectorAll("style")){let y=m.textContent||"";for(let x of y.matchAll(f)){let b=(x[2]||x[4]||"").trim();!b||me(b)||document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||d.push(b)}}d.length&&await Promise.all(d.map(m=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${m}"]`))return y(null);let x=document.createElement("link");x.rel="stylesheet",x.href=m,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>y(x),x.onerror=()=>y(null),document.head.appendChild(x)})));let p="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(m=>!!m.href);for(let m of g)try{if(me(m.href))continue;let y="",x=!1;try{x=new URL(m.href,location.href).origin===location.origin}catch{}if(!x){let w=Array.isArray(o)?o:[];if(!dl(m.href,u,w))continue}if(x){let w=Array.from(document.styleSheets).find(E=>E.href===m.href);if(w)try{let E=w.cssRules||[];y=Array.from(E).map(S=>S.cssText).join("")}catch{}}if(!y){let w=await ne(m.href,{as:"text",useProxy:i});if(w?.ok&&typeof w.data=="string"&&(y=w.data),me(m.href))continue}y=await ml(y,m.href,i);let b="";for(let w of y.match(pl)||[]){let E=(w.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),S=At(E);if(!S||me(S))continue;let v=(w.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),k=(w.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),T=(w.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(w.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),D=(w.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),$=wn(D,m.href);if(!c(S,k,v,T))continue;let A=jr(W);if(!zr(t,A))continue;let H={family:S,weightSpec:v,styleSpec:k,stretchSpec:T,unicodeRange:W,srcRaw:D,srcUrls:$,href:m.href};if(n&&l(H,A))continue;let V=/url\(/i.test(D)?await Vr(w,m.href,i):w;b+=V}b.trim()&&(p+=b)}catch{console.warn("[snapDOM] Failed to process stylesheet:",m.href)}let h={requiredIndex:a,usedCodepoints:t,faceMatchesRequired:c,simpleExcluder:n?gr(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let m of document.styleSheets)if(!(m.href&&g.some(y=>y.href===m.href)))try{let y=m.href||location.origin+"/";y&&h.visitedSheets.add(y),await Xr(m,y,async x=>{p+=x},h)}catch{}try{for(let m of document.fonts||[]){if(!m||!m.family||m.status!=="loaded"||!m._snapdomSrc)continue;let y=String(m.family).replace(/^['"]+|['"]+$/g,"");if(me(y)||!a.has(y)||n?.families&&n.families.some(b=>String(b).toLowerCase()===y.toLowerCase()))continue;let x=m._snapdomSrc;if(!String(x).startsWith("data:")){if(C.resource?.has(m._snapdomSrc))x=C.resource.get(m._snapdomSrc),C.font?.add(m._snapdomSrc);else if(!C.font?.has(m._snapdomSrc))try{let b=await ne(m._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(b.ok&&typeof b.data=="string")x=b.data,C.resource?.set(m._snapdomSrc,x),C.font?.add(m._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",m._snapdomSrc);continue}}p+=`@font-face{font-family:'${y}';src:url(${x});font-style:${m.style||"normal"};font-weight:${m.weight||"normal"};}`}}catch{}for(let m of r){if(!m||typeof m!="object")continue;let y=String(m.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||me(y)||!a.has(y)||n?.families&&n.families.some(v=>String(v).toLowerCase()===y.toLowerCase()))continue;let x=m.weight!=null?String(m.weight):"normal",b=m.style!=null?String(m.style):"normal",w=m.stretchPct!=null?`${m.stretchPct}%`:"100%",E=String(m.src||""),S=E;if(!S.startsWith("data:")){if(C.resource?.has(E))S=C.resource.get(E),C.font?.add(E);else if(!C.font?.has(E))try{let v=await ne(E,{as:"dataURL",useProxy:i,silent:!0});if(v.ok&&typeof v.data=="string")S=v.data,C.resource?.set(E,S),C.font?.add(E);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",E);continue}}p+=`@font-face{font-family:'${y}';src:url(${S});font-style:${b};font-weight:${x};font-stretch:${w};}`}return p&&(p=gl(p),C.resource?.set(s,p)),p}function Yr(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=a=>{let c=At(a.fontFamily);if(!c)return;let l=(s,u,d)=>`${c}__${xt(s)}__${vt(u)}__${al(d)}`;t.add(l(a.fontWeight,a.fontStyle,a.fontStretch))};r(getComputedStyle(e));let i=getComputedStyle(e,"::before");i&&i.content&&i.content!=="none"&&r(i);let o=getComputedStyle(e,"::after");for(o&&o.content&&o.content!=="none"&&r(o);n.nextNode();){let a=n.currentNode,c=getComputedStyle(a);r(c);let l=getComputedStyle(a,"::before");l&&l.content&&l.content!=="none"&&r(l);let s=getComputedStyle(a,"::after");s&&s.content&&s.content!=="none"&&r(s)}return t}function bl(e){let t=new Set,n=i=>{if(i)for(let o of i)t.add(o.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let i=r.currentNode;if(i.nodeType===Node.TEXT_NODE)n(i.nodeValue||"");else if(i.nodeType===Node.ELEMENT_NODE){let o=i;for(let a of["::before","::after"]){let c=getComputedStyle(o,a)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let l=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(l)for(let s of l)try{t.add(parseInt(s.slice(1),16))}catch{}}}}}return t}async function Gr(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let i=document.createElement("div");i.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let o of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${o}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",i.appendChild(a)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)r(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}re();function xl(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function vl(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function yr(e,t=!1){let n="",r=Math.max(1,e);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return t?n.toUpperCase():n}function wr(e,t=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,e)),i="";for(let[o,a]of n)for(;r>=o;)i+=a,r-=o;return t?i:i.toLowerCase()}function br(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,e));case"decimal-leading-zero":return(e<10?"0":"")+String(Math.max(0,e));case"lower-alpha":return yr(e,!1);case"upper-alpha":return yr(e,!0);case"lower-roman":return wr(e,!1);case"upper-roman":return wr(e,!0);default:return String(Math.max(0,e))}}function Sl(e){let t=()=>C?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,o=f=>f&&f.tagName==="LI",a=f=>{let p=0,g=f?.parentElement;if(!g)return 0;for(let h of g.children){if(h===f)break;h.tagName==="LI"&&p++}return p},c=f=>{let p=new Map;for(let[g,h]of f)p.set(g,h.slice());return p},l=(f,p,g)=>{let h=c(f),m;try{m=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(m&&m!=="none")for(let x of m.split(",")){let b=x.trim().split(/\s+/),w=b[0],E=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!w)continue;let S=p.get(w);if(S&&S.length){let v=S.slice();v.push(E),h.set(w,v)}else h.set(w,[E])}let y;try{y=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(y&&y!=="none")for(let x of y.split(",")){let b=x.trim().split(/\s+/),w=b[0],E=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!w)continue;let S=h.get(w)||[];S.length===0&&S.push(0),S[S.length-1]+=E,h.set(w,S)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let x=g.parentElement,b=1;if(x&&x.tagName==="OL"){let E=x.getAttribute("start"),S=Number.isFinite(Number(E))?Number(E):1,v=a(g),k=g.getAttribute("value");b=Number.isFinite(Number(k))?Number(k):S+v}else b=1+a(g);let w=h.get("list-item")||[];w.length===0&&w.push(0),w[w.length-1]=b,h.set("list-item",w)}}catch{}return h},s=(f,p,g)=>{let h=l(g,p,f);r.set(f,h);let m=h;for(let y of f.children)m=s(y,h,m);return h},u=new Map;s(i,u,u);function d(){let f=t();if(f!==n){n=f;let p=new Map;s(i,p,p)}}return{get(f,p){d();let g=r.get(f)?.get(p);return g&&g.length?g[g.length-1]:0},getStack(f,p){d();let g=r.get(f)?.get(p);return g?g.slice():[]}}}function El(e,t,n){if(!e||e==="none")return e;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,i=e.replace(r,(o,a,c)=>{let l=String(c).split(",").map(s=>s.trim());if(a==="counter"){let s=l[0]?.replace(/^["']|["']$/g,""),u=(l[1]||"decimal").toLowerCase(),d=n.get(t,s);return br(d,u)}else{let s=l[0]?.replace(/^["']|["']$/g,""),u=l[1]?.replace(/^["']|["']$/g,"")??"",d=(l[2]||"decimal").toLowerCase(),f=n.getStack(t,s);return f.length?f.map(p=>br(p,d)).join(u):""}});return vl(i)}catch{return"- "}}He();re();var Pe=new WeakMap,xr=300;function Cl(e,t){let n=Kr(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=Sr(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):Sr(e)}function un(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Kr(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${t.length}|`,r=0;for(let o=0;o<t.length;o++){let a=t[o];if(a.tagName==="STYLE"){let c=a.textContent?a.textContent.length:0;n+=`S${c}|`;let l=a.sheet,s=l?un(l):null;s&&(r+=s.length)}else{let c=a.getAttribute("href")||"",l=a.getAttribute("media")||"all";n+=`L${c}|m:${l}|`;let s=a.sheet,u=s?un(s):null;u&&(r+=u.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function vr(e,t,n){let r=un(e);if(!r)return!1;for(let i=0;i<r.length;i++){if(n.budget<=0)return!1;let o=r[i],a=o&&o.cssText?o.cssText:"";n.budget--;for(let c of t)if(a.includes(c))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let c=0;c<o.cssRules.length&&n.budget>0;c++){let l=o.cssRules[c],s=l&&l.cssText?l.cssText:"";n.budget--;for(let u of t)if(s.includes(u))return!0}if(n.budget<=0)return!1}return!1}function Sr(e=document){let t=Kr(e),n=Pe.get(e);if(n&&n.fingerprint===t)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=e.querySelectorAll("style");for(let a=0;a<i.length;a++){let c=i[a].textContent||"";for(let l of r)if(c.includes(l))return Pe.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:xr};try{for(let c of o)if(vr(c,r,a))return Pe.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),c={budget:xr};for(let l=0;l<a.length&&c.budget>0;l++){let s=a[l],u=null;if(s.tagName,u=s.sheet||null,u&&vr(u,r,c))return Pe.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Pe.set(e,{fingerprint:t,result:!0}),!0):(Pe.set(e,{fingerprint:t,result:!1}),!1)}var De=new WeakMap,Er=-1;function kl(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Ml(e){if(!e)return"";let t=[],n=/"([^"]*)"/g,r;for(;r=n.exec(e);)t.push(r[1]);return t.length?t.join(""):kl(e)}function dn(e,t){let n=e.parentElement,r=n?De.get(n):null;return r?{get(i,o){let a=t.get(i,o),c=r.get(o);return typeof c=="number"?Math.max(a,c):a},getStack(i,o){let a=t.getStack(i,o);if(!a.length)return a;let c=r.get(o);if(typeof c=="number"){let l=a.slice();return l[l.length-1]=Math.max(l[l.length-1],c),l}return a}}:t}function fn(e,t,n){let r=new Map;function i(l){let s=[];if(!l||l==="none")return s;for(let u of String(l).split(",")){let d=u.trim().split(/\s+/),f=d[0],p=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;f&&s.push({name:f,num:p})}return s}let o=i(t?.counterReset),a=i(t?.counterIncrement);function c(l){if(r.has(l))return r.get(l).slice();let s=n.getStack(e,l);s=s.length?s.slice():[];let u=o.find(f=>f.name===l);if(u){let f=Number.isFinite(u.num)?u.num:0;s=s.length?[...s,f]:[f]}let d=a.find(f=>f.name===l);if(d){let f=Number.isFinite(d.num)?d.num:1;s.length===0&&(s=[0]),s[s.length-1]+=f}return r.set(l,s.slice()),s}return{get(l,s){let u=c(s);return u.length?u[u.length-1]:0},getStack(l,s){return c(s)},__incs:a}}function Al(e,t,n){let r;try{r=pe(e,t)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=dn(e,n),a=fn(e,r,o),c=xl(i)?El(i,e,a):i;return{text:Ml(c),incs:a.__incs||[]}}async function mn(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.ownerDocument||document;if(!Cl(i,n))return;let o=C?.session?.__counterEpoch??0;if(Er!==o&&(De=new WeakMap,n&&(n.__counterCtx=null),Er=o),!n.__counterCtx)try{n.__counterCtx=Sl(e.ownerDocument||document)}catch(l){F(n,"buildCounterContext failed",l)}let a=n.__counterCtx;for(let l of["::before","::after","::first-letter"])try{let s=pe(e,l);if(!s||s.content==="none"&&s.backgroundImage==="none"&&s.backgroundColor==="transparent"&&(s.borderStyle==="none"||parseFloat(s.borderWidth)===0)&&(!s.transform||s.transform==="none")&&s.display==="inline")continue;if(l==="::first-letter"){let P=pe(e);if(!(s.color!==P.color||s.fontSize!==P.fontSize||s.fontWeight!==P.fontWeight))continue;let R=Array.from(t.childNodes).find(je=>je.nodeType===Node.TEXT_NODE&&je.textContent?.trim().length>0);if(!R)continue;let B=R.textContent,O=B.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],he=B.slice(O?.length||0);if(!O||/[\uD800-\uDFFF]/.test(O))continue;let ue=document.createElement("span");ue.textContent=O,ue.dataset.snapdomPseudo="::first-letter";let Le=ir(s),Te=nn(Le,"span");n.styleMap.set(ue,Te);let ve=document.createTextNode(he);t.replaceChild(ve,R),t.insertBefore(ue,ve);continue}let u=s.content??"",d=u===""||u==="none"||u==="normal",{text:f,incs:p}=Al(e,l,a),g=s.backgroundImage,h=s.backgroundColor,m=s.fontFamily,y=parseInt(s.fontSize)||32,x=parseInt(s.fontWeight)||!1,b=s.color||"#000",w=s.borderStyle,E=parseFloat(s.borderWidth),S=s.transform,v=me(m),k=!d&&f!=="",T=g&&g!=="none",W=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",D=w&&w!=="none"&&E>0,$=S&&S!=="none";if(!(k||T||W||D||$)){if(p&&p.length&&e.parentElement){let P=De.get(e.parentElement)||new Map;for(let{name:R}of p){if(!R)continue;let B=dn(e,a),O=fn(e,pe(e,l),B).get(e,R);P.set(R,O)}De.set(e.parentElement,P)}continue}let A=document.createElement("span");A.dataset.snapdomPseudo=l,A.style.pointerEvents="none";let H=ir(s),V=nn(H,"span");if(n.styleMap.set(A,V),v&&f&&f.length===1){let{dataUrl:P,width:R,height:B}=await rl(f,m,x,y,b),O=document.createElement("img");O.src=P,O.style=`height:${y}px;width:${R/B*y}px;object-fit:contain;`,A.appendChild(O),t.dataset.snapdomHasIcon="true"}else if(f&&f.startsWith("url(")){let P=hn(f);if(P?.trim())try{let R=await ne(St(P),{as:"dataURL",useProxy:r.useProxy});if(R?.ok&&typeof R.data=="string"){let B=document.createElement("img");B.src=R.data,B.style=`width:${y}px;height:auto;object-fit:contain;`,A.appendChild(B)}}catch(R){console.error(`[snapdom] Error in pseudo ${l} for`,e,R)}}else!v&&k&&(A.textContent=f);A.style.backgroundImage="none","maskImage"in A.style&&(A.style.maskImage="none"),"webkitMaskImage"in A.style&&(A.style.webkitMaskImage="none");try{A.style.backgroundRepeat=s.backgroundRepeat,A.style.backgroundSize=s.backgroundSize,s.backgroundPositionX&&s.backgroundPositionY?(A.style.backgroundPositionX=s.backgroundPositionX,A.style.backgroundPositionY=s.backgroundPositionY):A.style.backgroundPosition=s.backgroundPosition,A.style.backgroundOrigin=s.backgroundOrigin,A.style.backgroundClip=s.backgroundClip,A.style.backgroundAttachment=s.backgroundAttachment,A.style.backgroundBlendMode=s.backgroundBlendMode}catch{}if(T)try{let P=rn(g),R=await Promise.all(P.map($r));A.style.backgroundImage=R.join(", ")}catch(P){console.warn(`[snapdom] Failed to inline background-image for ${l}`,P)}W&&(A.style.backgroundColor=h);let at=A.childNodes.length>0||A.textContent?.trim()!==""||T||W||D||$;if(p&&p.length&&e.parentElement){let P=De.get(e.parentElement)||new Map,R=dn(e,a),B=fn(e,pe(e,l),R);for(let{name:O}of p){if(!O)continue;let he=B.get(e,O);P.set(O,he)}De.set(e.parentElement,P)}if(!at)continue;l==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore(A,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild(A))}catch(s){console.warn(`[snapdom] Failed to capture ${l} for`,e,s)}let c=Array.from(t.children).filter(l=>!l.dataset.snapdomPseudo);if(n.nodeMap)for(let l of c){let s=n.nodeMap.get(l);s instanceof Element&&await mn(s,l,n,r)}else{let l=Array.from(e.children);for(let s=0;s<Math.min(l.length,c.length);s++)await mn(l[s],c[s],n,r)}}function $l(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],c=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",s=w=>{if(!w||!w.getAttribute)return null;let E=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(l,"href"):null);if(E)return E;let S=w.attributes;if(!S)return null;for(let v=0;v<S.length;v++){let k=S[v];if(!k||!k.name)continue;if(k.name==="href")return k.value;let T=k.name.indexOf(":");if(T!==-1&&k.name.slice(T+1)==="href")return k.value}return null},u=new Set(Array.from(e.querySelectorAll("[id]")).map(w=>w.id)),d=new Set,f=!1,p=(w,E=null)=>{if(!w)return;o.lastIndex=0;let S;for(;S=o.exec(w);){f=!0;let v=(S[1]||"").trim();v&&(u.has(v)||(d.add(v),E&&!E.has(v)&&E.add(v)))}},g=w=>{let E=w.querySelectorAll("use");for(let v of E){let k=s(v);if(!k||!k.startsWith("#"))continue;f=!0;let T=k.slice(1).trim();T&&!u.has(T)&&d.add(T)}let S=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let v of S){p(v.getAttribute("style")||"");for(let k of a)p(v.getAttribute(k))}};for(let w of i)g(w);if(!f)return;let h=e.querySelector("svg.inline-defs-container");h||(h=n.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(h,e.firstChild||null));let m=h.querySelector("defs")||null,y=w=>{if(!w||u.has(w))return null;let E=c(w),S=v=>{let k=r.querySelector(v);return k&&!e.contains(k)?k:null};return S(`svg defs > *#${E}`)||S(`svg > symbol#${E}`)||S(`*#${E}`)};if(!d.size)return;let x=new Set(d),b=new Set;for(;x.size;){let w=x.values().next().value;if(x.delete(w),!w||u.has(w)||b.has(w))continue;let E=y(w);if(!E){b.add(w);continue}m||(m=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(m));let S=E.cloneNode(!0);S.id||S.setAttribute("id",w),m.appendChild(S),b.add(w),u.add(w);let v=[S,...S.querySelectorAll("*")];for(let k of v){let T=s(k);if(T&&T.startsWith("#")){let D=T.slice(1).trim();D&&!u.has(D)&&!b.has(D)&&x.add(D)}let W=k.getAttribute?.("style")||"";W&&p(W,x);for(let D of a){let $=k.getAttribute?.(D);$&&p($,x)}}}}re();function Ll(e,t){if(!e||!t)return;let n=e.scrollTop||0;if(!n)return;getComputedStyle(t).position==="static"&&(t.style.position="relative");let r=e.getBoundingClientRect(),i=e.clientHeight,o="data-snap-ph",a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let c=a.currentNode,l=getComputedStyle(c),s=l.position;if(s!=="sticky"&&s!=="-webkit-sticky")continue;let u=Cr(l.top),d=Cr(l.bottom);if(u==null&&d==null)continue;let f=Tl(c,e),p=Nl(t,f,o);if(!p)continue;let g=c.getBoundingClientRect(),h=g.width,m=g.height,y=g.left-r.left;if(!(h>0&&m>0)||!Number.isFinite(y))continue;let x=u!=null?u+n:n+(i-m-d);if(!Number.isFinite(x))continue;let b=Number.parseInt(l.zIndex,10),w=Number.isFinite(b),E=w?Math.max(b,1)+1:2,S=w?b-1:0,v=p.cloneNode(!1);v.setAttribute(o,"1"),v.style.position="sticky",v.style.left=`${y}px`,v.style.top=`${x}px`,v.style.width=`${h}px`,v.style.height=`${m}px`,v.style.visibility="hidden",v.style.zIndex=String(S),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",p.parentElement?.insertBefore(v,p),p.style.position="absolute",p.style.left=`${y}px`,p.style.top=`${x}px`,p.style.bottom="auto",p.style.zIndex=String(E),p.style.pointerEvents="none"}}function Cr(e){if(!e||e==="auto")return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function Tl(e,t){let n=[];for(let r=e;r&&r!==t;){let i=r.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,r)),r=i}return n.reverse()}function Nl(e,t,n){let r=e;for(let i=0;i<t.length;i++)if(r=Rl(r,n)[t[i]],!r)return null;return r instanceof HTMLElement?r:null}function Rl(e,t){let n=[],r=e.children;for(let i=0;i<r.length;i++){let o=r[i];o.hasAttribute(t)||n.push(o)}return n}function _l(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,o=t.borderWidth,a=n!=="none"&&parseFloat(r)>0,c=i==="none"||parseFloat(o)===0;a&&c&&(e.style.border=`${r} solid transparent`)}async function Pl(e,t={}){let n={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap,options:t},r,i="",o="";_l(e);try{$l(e)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await bt(e,n,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{await mn(e,r,n,t)}catch(l){console.warn("inlinePseudoElements failed:",l)}await Xa(r,n);try{let l=r.querySelectorAll("style[data-sd]");for(let s of l)o+=s.textContent||"",s.remove()}catch(l){F(n,"Failed to extract shadow CSS from style[data-sd]",l)}let a=ea(n.styleMap);i=Array.from(a.entries()).map(([l,s])=>`.${s}{${l}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[l,s]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",s.replace(/;/g,"; "));continue}let u=a.get(s);u&&l.classList.add(u);let d=l.style?.backgroundImage,f=l.dataset?.snapdomHasIcon;d&&d!=="none"&&(l.style.backgroundImage=d),f&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,s]of n.nodeMap.entries()){let u=s.scrollLeft,d=s.scrollTop;if((u||d)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let f=document.createElement("div");for(f.style.transform=`translate(${-u}px, ${-d}px)`,f.style.willChange="transform",f.style.display="inline-block",f.style.width="100%";l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}}let c=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Ll(e,c),e===n.nodeMap.get(r)){let l=n.styleCache.get(e)||pe(e);n.styleCache.set(e,l);let s=Ui(l.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=s||""}for(let[l,s]of n.nodeMap.entries())s.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}He();var Jr="http://www.w3.org/1999/xlink";function Fl(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Jr,"href"):null)}function Il(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,n=parseInt(e.dataset?.snapdomHeight||"",10)||0,r=parseInt(e.getAttribute("width")||"",10)||0,i=parseInt(e.getAttribute("height")||"",10)||0,o=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,c=t||o||r||e.width||e.naturalWidth||100,l=n||a||i||e.height||e.naturalHeight||100;return{width:c,height:l}}async function Dl(e,t={}){let n=Array.from(e.querySelectorAll("img")),r=async a=>{if(!a.getAttribute("src")){let f=a.currentSrc||a.src||"";f&&a.setAttribute("src",f)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let c=a.src||"";if(!c)return;let l=await ne(c,{as:"dataURL",useProxy:t.useProxy});if(l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")){a.src=l.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:s,height:u}=Il(a),{fallbackURL:d}=t||{};if(d)try{let f=typeof d=="function"?await d({width:s,height:u,src:c,element:a}):d;if(f){let p=await ne(f,{as:"dataURL",useProxy:t.useProxy});if(p?.ok&&typeof p.data=="string"){a.src=p.data,a.width||(a.width=s),a.height||(a.height=u);return}}}catch{}if(t.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${s}px`,`height:${u}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${u}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",a.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${s}px;height:${u}px;visibility:hidden;`,a.replaceWith(f)}};for(let a=0;a<n.length;a+=4){let c=n.slice(a,a+4).map(r);await Promise.allSettled(c)}let i=Array.from(e.querySelectorAll("image")),o=async a=>{let c=Fl(a);if(!c||c.startsWith("data:")||c.startsWith("blob:"))return;let l=await ne(c,{as:"dataURL",useProxy:t.useProxy});l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")&&(a.setAttribute("href",l.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(Jr,"href"))};for(let a=0;a<i.length;a+=4){let c=i.slice(a,a+4).map(o);await Promise.allSettled(c)}}ie();async function Hl(e,t,n,r={}){let i=[[e,t]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],c=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[s,u]=i.shift();if(!u)continue;let d=n.get(s)||pe(s);n.has(s)||n.set(s,d);let f=(()=>{let h=d.getPropertyValue("border-image"),m=d.getPropertyValue("border-image-source");return h&&h!=="none"||m&&m!=="none"})();for(let h of c){let m=d.getPropertyValue(h);m&&u.style.setProperty(h,m)}for(let h of o){let m=d.getPropertyValue(h);if(h==="background-image"&&(!m||m==="none")){let b=d.getPropertyValue("background");b&&/url\s*\(/.test(b)&&(m=rn(b).find(w=>/url\s*\(/.test(w))||m)}if(!m||m==="none")continue;let y=rn(m),x=await Promise.all(y.map(b=>$r(b,r)));x.some(b=>b&&b!=="none"&&!/^url\(undefined/.test(b))&&u.style.setProperty(h,x.join(", "))}for(let h of a){let m=d.getPropertyValue(h);!m||m==="initial"||u.style.setProperty(h,m)}if(f)for(let h of l){let m=d.getPropertyValue(h);!m||m==="initial"||u.style.setProperty(h,m)}let p=s.shadowRoot?Array.from(s.shadowRoot.children).filter(h=>h.tagName!=="STYLE"):Array.from(s.children),g=Array.from(u.children).filter(h=>!(h.dataset?.snapdomPseudo||h.tagName==="STYLE"&&h.dataset?.sd));for(let h=0;h<Math.min(p.length,g.length);h++)i.push([p[h],g[h]])}}ie();re();function Ol(e){if(!e)return()=>{};let t=[];function n(r){let i=Wl(r);i&&t.push(i);for(let o of r.children||[])n(o)}return n(e),()=>t.forEach(r=>r())}function Wl(e){if(!e)return()=>{};let t=Bl(e);if(t<=0)return()=>{};if(!jl(e))return()=>{};let n=getComputedStyle(e),r=Math.round(Ul(n)*t+ql(n)),i=e.textContent??"",o=i;if(e.scrollHeight<=r+.5)return()=>{};let a=0,c=i.length,l=-1;for(;a<=c;){let s=a+c>>1;e.textContent=i.slice(0,s)+"\u2026",e.scrollHeight<=r+.5?(l=s,a=s+1):c=s-1}return e.textContent=(l>=0?i.slice(0,l):"")+"\u2026",()=>{e.textContent=o}}function Bl(e){let t=getComputedStyle(e),n=t.getPropertyValue("-webkit-line-clamp")||t.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function Ul(e){let t=(e.lineHeight||"").trim(),n=parseFloat(e.fontSize)||16;return!t||t==="normal"?Math.round(n*1.2):t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*n):t.endsWith("%")?Math.round(parseFloat(t)/100*n):Math.round(n*1.2)}function ql(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function jl(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var Qe=[];function Zr(e){if(!e)return null;if(Array.isArray(e)){let[t,n]=e;return typeof t=="function"?t(n):t}if(typeof e=="object"&&"plugin"in e){let{plugin:t,options:n}=e;return typeof t=="function"?t(n):t}return typeof e=="function"?e():e}function zl(...e){let t=e.flat();for(let n of t){let r=Zr(n);r&&(Qe.some(i=>i&&i.name&&r.name&&i.name===r.name)||Qe.push(r))}}function Qr(e){return(e&&Array.isArray(e.plugins)?e.plugins:Qe)||Qe}async function be(e,t,n){let r=n,i=Qr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,r);typeof c<"u"&&(r=c)}return r}async function Vl(e,t,n){let r=[],i=Qr(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,n);typeof c<"u"&&r.push(c)}return r}function Xl(e){let t=[];if(Array.isArray(e))for(let n of e){let r=Zr(n);if(!r||!r.name)continue;let i=t.findIndex(o=>o&&o.name===r.name);i>=0&&t.splice(i,1),t.push(r)}for(let n of Qe)n&&n.name&&!t.some(r=>r.name===n.name)&&t.push(n);return Object.freeze(t)}function Yl(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=Xl(t)),e}ie();function Gl(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){F(n,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){F(n,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){F(n,"stripRootShadows outline",o)}let i=(r.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=i.length?i:"none"}catch(o){F(n,"stripRootShadows filter",o)}}function Kl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let r of n)r.remove()}function Jl(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set(["xml","xlink"]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let a of Array.from(o.attributes)){let c=a.name;if(c.includes("@")){o.removeAttribute(c);continue}if(c.includes(":")){let l=c.split(":",1)[0];if(!r.has(l)){o.removeAttribute(c);continue}}if(n&&(c.startsWith("x-")||c.startsWith("v-")||c.startsWith(":")||c.startsWith("on:")||c.startsWith("bind:")||c.startsWith("let:")||c.startsWith("class:"))){o.removeAttribute(c);continue}}}}function Zl(e,t={}){e&&(Jl(e,t),Kl(e))}function Ql(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function es(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function ts(e,t){if(!(e instanceof Element)||Ql(e)||es(e))return!1;let n=t.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=t.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||t.transform&&t.transform!=="none")}function ns(e,t,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let a=i.childElementCount>o.childElementCount,c=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,c),a&&ts(i,c)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let u=c.overflowY||c.overflowBlock||"visible",d=c.overflowX||c.overflowInline||"visible";(u!=="visible"||d!=="visible")&&(o.style.overflow="visible")}let l=Array.from(i.children),s=Array.from(o.children);for(let u=0;u<Math.min(l.length,s.length);u++)r(l[u],s[u])}r(e,t)}function rs(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function os(e,t){if(!(e instanceof Element))return!1;if(e.getAttribute("data-capture")==="exclude"&&t?.excludeMode==="remove")return!0;if(Array.isArray(t?.exclude))for(let n of t.exclude)try{if(e.matches(n))return t.excludeMode==="remove"}catch(r){F(t,"exclude selector match failed",r)}return!1}function is(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,o=-1/0,a=!1,c=Array.from(e.children);for(let p of c){if(os(p,t)||!rs(p))continue;let g=p.getBoundingClientRect(),h=g.top-r.top,m=g.bottom-r.top;m<=h||(h<i&&(i=h),m>o&&(o=m),a=!0)}let l=a?Math.max(0,o-i):0,s=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return s+u+d+f+l}var M=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,as=/::-webkit-scrollbar(-[a-z]+)?\b/i;function pn(e,t=new Set){let n="";if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=pn(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=pn(i.cssRules,t);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(as.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),n+=a)}}}catch{}}return n}function ls(e){if(!e||!e.styleSheets)return"";let t=new Set,n="";for(let r of Array.from(e.styleSheets))try{let i=r.cssRules;i&&(n+=pn(i,t))}catch{}return n}function ss(e){let t=e.boxShadow||"";if(!t||t==="none")return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(c=>c.trim()),r=0,i=0,o=0,a=0;for(let c of n){let l=c.match(/-?\d+(\.\d+)?px/g)?.map(h=>parseFloat(h))||[];if(l.length<2)continue;let[s,u,d=0,f=0]=l,p=Math.abs(s)+d+f,g=Math.abs(u)+d+f;i=Math.max(i,p+Math.max(s,0)),a=Math.max(a,p+Math.max(-s,0)),o=Math.max(o,g+Math.max(u,0)),r=Math.max(r,g+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(o),left:Math.ceil(a)}}function cs(e){let t=(e.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=t?Math.ceil(parseFloat(t[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function us(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0);return{top:t,right:t,bottom:t,left:t}}function ds(e){let t=`${e.filter||""} ${e.webkitFilter||""}`.trim();if(!t||t==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,o=0,a=0,c=!1;for(let l of n){c=!0;let s=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(h=>parseFloat(h))||[],[u=0,d=0,f=0]=s,p=Math.abs(u)+f,g=Math.abs(d)+f;i=Math.max(i,p+Math.max(u,0)),a=Math.max(a,p+Math.max(-u,0)),o=Math.max(o,g+Math.max(d,0)),r=Math.max(r,g+Math.max(-d,0))}return{bleed:{top:M(r),right:M(i),bottom:M(o),left:M(a)},has:c}}function fs(e,t){if(!e||!t||!t.style)return null;let n=getComputedStyle(e);try{t.style.transformOrigin="0 0"}catch{}try{"translate"in t.style&&(t.style.translate="none"),"rotate"in t.style&&(t.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let o=eo(e);if(o.a===1&&o.b===0&&o.c===0&&o.d===1)return t.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let i=r.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let o=i[1].split(",").map(a=>parseFloat(a.trim()));if(o.length===6&&o.every(Number.isFinite)){let[a,c,l,s]=o,u=Math.sqrt(a*a+c*c)||0,d=0,f=0,p=0,g=0,h=0,m=0;u>0&&(d=a/u,f=c/u,p=d*l+f*s,g=l-d*p,h=s-f*p,m=Math.sqrt(g*g+h*h)||0,m>0?p=p/m:p=0);let y=u,x=0,b=p*m,w=m;try{t.style.transform=`matrix(${y}, ${x}, ${b}, ${w}, 0, 0)`}catch{}return{a:y,b:x,c:b,d:w}}}try{let o=String(r).trim();return t.style.transform=o+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function kr(e,t,n,r,i){let o=n.a,a=n.b,c=n.c,l=n.d,s=n.e||0,u=n.f||0;function d(y,x){let b=y-r,w=x-i,E=o*b+c*w,S=a*b+l*w;return E+=r+s,S+=i+u,[E,S]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],p=1/0,g=1/0,h=-1/0,m=-1/0;for(let[y,x]of f)y<p&&(p=y),x<g&&(g=x),y>h&&(h=y),x>m&&(m=x);return{minX:p,minY:g,maxX:h,maxY:m,width:h-p,height:m-g}}function ms(e,t,n){let r=(e.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],a=(c,l)=>{let s=c.toLowerCase();return s==="left"||s==="top"?0:s==="center"?l/2:s==="right"||s==="bottom"?l:s.endsWith("px")?parseFloat(s)||0:s.endsWith("%")?(parseFloat(s)||0)*l/100:/^-?\d+(\.\d+)?$/.test(s)&&parseFloat(s)||0};return{ox:a(i,t),oy:a(o,n)}}function ps(e){let t={rotate:"0deg",scale:null,translate:null},n=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(n){let i=l=>{try{return typeof n.has=="function"&&!n.has(l)||typeof n.get!="function"?null:n.get(l)}catch{return null}},o=i("rotate");if(o)if(o.angle){let l=o.angle;t.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else o.unit?t.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:t.rotate=String(o);else{let l=getComputedStyle(e);t.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let a=i("scale");if(a){let l="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,s="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:l;t.scale=`${l} ${s}`}else{let l=getComputedStyle(e);t.scale=l.scale&&l.scale!=="none"?l.scale:null}let c=i("translate");if(c){let l="x"in c&&"value"in c.x?c.x.value:Array.isArray(c)?c[0]?.value:0,s="y"in c&&"value"in c.y?c.y.value:Array.isArray(c)?c[1]?.value:0,u="x"in c&&c.x?.unit?c.x.unit:"px",d="y"in c&&c.y?.unit?c.y.unit:"px";t.translate=`${l}${u} ${s}${d}`}else{let l=getComputedStyle(e);t.translate=l.translate&&l.translate!=="none"?l.translate:null}return t}let r=getComputedStyle(e);return t.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",t.scale=r.scale&&r.scale!=="none"?r.scale:null,t.translate=r.translate&&r.translate!=="none"?r.translate:null,t}var en=null;function hs(){if(en)return en;let e=document.createElement("div");return e.id="snapdom-measure-slot",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(e),en=e,e}function gs(e){let t=hs(),n=document.createElement("div");n.style.transformOrigin="0 0",e.baseTransform&&(n.style.transform=e.baseTransform),e.rotate&&(n.style.rotate=e.rotate),e.scale&&(n.style.scale=e.scale),e.translate&&(n.style.translate=e.translate),t.appendChild(n);let r=eo(n);return t.removeChild(n),r}function ys(e){let t=getComputedStyle(e),n=t.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let r=t.rotate&&t.rotate!=="none"&&t.rotate!=="0deg",i=t.scale&&t.scale!=="none"&&t.scale!=="1",o=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(r||i||o)}function eo(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}async function to(e,t){if(!e)throw new Error("Element cannot be null or undefined");Bi(t.cache);let n=t.fast,r=t.outerTransforms!==!1,i=!!t.outerShadows,o={element:e,options:t,plugins:t.plugins},a,c,l,s="",u="",d,f,p=null;await be("beforeSnap",o),await be("beforeClone",o);let g=Ol(o.element);try{({clone:a,classCSS:c,styleCache:l}=await Pl(o.element,o.options)),!r&&a&&(p=fs(o.element,a)),!i&&a&&Gl(o.element,a,o.options)}finally{g()}if(o={clone:a,classCSS:c,styleCache:l,...o},await be("afterClone",o),Zl(o.clone),o.options?.excludeMode==="remove")try{ns(o.element,o.clone,o.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await nl(o.clone,o.element)}catch{}await new Promise(b=>{Fe(async()=>{await Dl(o.clone,o.options),b()},{fast:n})}),await new Promise(b=>{Fe(async()=>{await Hl(o.element,o.clone,o.styleCache,o.options),b()},{fast:n})}),t.embedFonts&&await new Promise(b=>{Fe(async()=>{let w=Yr(o.element),E=bl(o.element);if(ke()){let S=new Set(Array.from(w).map(v=>String(v).split("__")[0]).filter(Boolean));await Gr(S,1)}s=await wl({required:w,usedCodepoints:E,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),b()},{fast:n})});let h=Zi(o.clone).sort(),m=h.join(",");C.baseStyle.has(m)?u=C.baseStyle.get(m):await new Promise(b=>{Fe(()=>{u=Qi(h),C.baseStyle.set(m,u),b()},{fast:n})});let y=ls(o.element?.ownerDocument||document);o={fontsCSS:s,baseCSS:u,scrollbarCSS:y,...o},await be("beforeRender",o),await new Promise(b=>{Fe(()=>{let w=pe(o.element),E=o.element.getBoundingClientRect(),S=Math.max(1,M(o.element.offsetWidth||parseFloat(w.width)||E.width||1)),v=Math.max(1,M(o.element.offsetHeight||parseFloat(w.height)||E.height||1)),k=o.element.ownerDocument||document;if(o.element===k.body||o.element===k.documentElement){let X=Math.max(o.element.scrollHeight||0,k.documentElement?.scrollHeight||0,k.body?.scrollHeight||0),G=Math.max(o.element.scrollWidth||0,k.documentElement?.scrollWidth||0,k.body?.scrollWidth||0);X>0&&(v=Math.max(v,M(X))),G>0&&(S=Math.max(S,M(G)));try{let Y=k.createElement("div");Y.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+S+"px!important;overflow:visible!important;visibility:hidden!important;";let st=k.createElement("style");st.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,Y.appendChild(st),Y.appendChild(o.clone.cloneNode(!0)),k.body.appendChild(Y);let ct=Y.scrollHeight,ut=Y.scrollWidth;k.body.removeChild(Y),ct>0&&(v=Math.max(v,M(ct))),ut>0&&(S=Math.max(S,M(ut)))}catch{}}if(o.options?.excludeMode==="remove"){let X=is(o.element,o.options);Number.isFinite(X)&&X>0&&(v=Math.max(1,Math.min(v,M(X+1))))}let T=(X,G=NaN)=>{let Y=typeof X=="string"?parseFloat(X):X;return Number.isFinite(Y)?Y:G},W=T(o.options.width),D=T(o.options.height),$=S,A=v,H=Number.isFinite(W),V=Number.isFinite(D),at=v>0?S/v:1;H&&V?($=Math.max(1,M(W)),A=Math.max(1,M(D))):H?($=Math.max(1,M(W)),A=Math.max(1,M($/(at||1)))):V?(A=Math.max(1,M(D)),$=Math.max(1,M(A*(at||1)))):($=S,A=v);let P=0,R=0,B=S,O=v;if(!r&&p&&Number.isFinite(p.a)){let X={a:p.a,b:p.b||0,c:p.c||0,d:p.d||1,e:0,f:0},G=kr(S,v,X,0,0);P=M(G.minX),R=M(G.minY),B=M(G.maxX),O=M(G.maxY)}else if(r&&Mr(o.element)){let X=w.transform&&w.transform!=="none"?w.transform:"",G=ps(o.element),Y=gs({baseTransform:X,rotate:G.rotate||"0deg",scale:G.scale,translate:G.translate}),{ox:st,oy:ct}=ms(w,S,v),ut=Y.is2D?Y:new DOMMatrix(Y.toString()),dt=kr(S,v,ut,st,ct);P=M(dt.minX),R=M(dt.minY),B=M(dt.maxX),O=M(dt.maxY)}let he=ss(w),ue=cs(w),Le=us(w),Te=ds(w),ve=i?{top:M(he.top+ue.top+Le.top+Te.bleed.top),right:M(he.right+ue.right+Le.right+Te.bleed.right),bottom:M(he.bottom+ue.bottom+Le.bottom+Te.bleed.bottom),left:M(he.left+ue.left+Le.left+Te.bleed.left)}:{top:0,right:0,bottom:0,left:0};P=M(P-ve.left),R=M(R-ve.top),B=M(B+ve.right),O=M(O+ve.bottom);let je=Math.max(1,M(B-P)),Ln=Math.max(1,M(O-R)),ii=H||V?M($/S):1,ai=V||H?M(A/v):1,li=Math.max(1,M(je*ii)),si=Math.max(1,M(Ln*ai)),Tn="http://www.w3.org/2000/svg",ci=ke()&&Mr(o.element)?1:0,ge=M(ci+(r?0:1)),ye=document.createElementNS(Tn,"foreignObject"),ui=M(P),di=M(R);ye.setAttribute("x",String(M(-(ui-ge)))),ye.setAttribute("y",String(M(-(di-ge)))),ye.setAttribute("width",String(M(S+ge*2))),ye.setAttribute("height",String(M(v+ge*2))),ye.style.overflow="visible";let Nn=document.createElement("style");Nn.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,ye.appendChild(Nn);let lt=document.createElement("div");lt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),lt.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${M(S)}px;height:${M(v)}px`,lt.appendChild(o.clone),ye.appendChild(lt);let fi=new XMLSerializer().serializeToString(ye),Ut=M(je+ge*2),qt=M(Ln+ge*2),Rn=H||V;t.meta={w0:S,h0:v,vbW:Ut,vbH:qt,targetW:$,targetH:A};let mi=ke()&&Rn?Ut:M(li+ge*2),pi=ke()&&Rn?qt:M(si+ge*2),hi=parseFloat(pe(k.documentElement)?.fontSize)||16;f=`<svg xmlns="${Tn}" width="${mi}" height="${pi}" viewBox="0 0 ${Ut} ${qt}" font-size="${hi}px">`+fi+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,o={svgString:f,dataURL:d,...o},b()},{fast:n})}),await be("afterRender",o);let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),o.dataURL}function Mr(e){return ys(e)}re();function ws(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let n=Wi(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:typeof e.useProxy=="string"?e.useProxy:"",width:e.width??null,height:e.height??null,format:t,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(t)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null}}tt();Pr();ie();He();re();function bs(...e){return zl(...e),_}var _=Object.assign(vs,{plugins:bs}),no=Symbol("snapdom.internal"),xs=Symbol("snapdom.internal.silent"),Ar=!1;async function vs(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=ws(t);if(Yl(n,t&&t.plugins),ke()&&(n.embedFonts===!0||Es(e))){if(n.embedFonts)try{let i=Yr(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await Gr(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await Ss(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&Ga(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>_.toPng(r,i),toSvg:(r,i)=>_.toSvg(r,i)}),_.capture(e,n,no)}_.capture=async(e,t,n)=>{if(n!==no)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await to(e,t),i={img:async(h,m)=>{let{toImg:y}=await Promise.resolve().then(()=>(lr(),on));return y(r,{...h,...m||{}})},svg:async(h,m)=>{let{toSvg:y}=await Promise.resolve().then(()=>(lr(),on));return y(r,{...h,...m||{}})},canvas:async(h,m)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(Mt(),Fr));return y(r,{...h,...m||{}})},blob:async(h,m)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Wr(),Hr));return y(r,{...h,...m||{}})},png:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(wt(),yt));return y(r,{...h,...m||{},format:"png"})},jpeg:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(wt(),yt));return y(r,{...h,...m||{},format:"jpeg"})},webp:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(wt(),yt));return y(r,{...h,...m||{},format:"webp"})},download:async(h,m)=>{let{download:y}=await Promise.resolve().then(()=>(pa(),Br));return y(r,{...h,...m||{}})}},o={};for(let h of["img","svg","canvas","blob","png","jpeg","webp"])o[h]=async m=>i[h](t,{...m||{},[xs]:!0});o.jpg=o.jpeg;let a={...t,export:{url:r},exports:o},c=await Vl("defineExports",a),l=Object.assign({},...c.filter(h=>h&&typeof h=="object")),s={...i,...l};s.jpeg&&!s.jpg&&(s.jpg=(h,m)=>s.jpeg(h,m));function u(h,m){let y={...t,...m||{}};return(h==="jpeg"||h==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let d=!1,f=Promise.resolve();async function p(h,m){let y=async()=>{let x=s[h];if(!x)throw new Error(`[snapdom] Unknown export type: ${h}`);let b=u(h,m),w={...t,export:{type:h,options:b,url:r}};await be("beforeExport",w);let E=await x(w,b);return await be("afterExport",w,E),d||(d=!0,await be("afterSnap",t)),E};return f=f.then(y)}let g={url:r,toRaw:()=>r,to:(h,m)=>p(h,m),toImg:h=>p("img",h),toSvg:h=>p("svg",h),toCanvas:h=>p("canvas",h),toBlob:h=>p("blob",h),toPng:h=>p("png",h),toJpg:h=>p("jpg",h),toWebp:h=>p("webp",h),download:h=>p("download",h)};for(let h of Object.keys(s)){let m="to"+h.charAt(0).toUpperCase()+h.slice(1);g[m]||(g[m]=y=>p(h,y))}return g};_.toRaw=(e,t)=>_(e,t).then(n=>n.toRaw());_.toImg=(e,t)=>_(e,t).then(n=>n.toImg());_.toSvg=(e,t)=>_(e,t).then(n=>n.toSvg());_.toCanvas=(e,t)=>_(e,t).then(n=>n.toCanvas());_.toBlob=(e,t)=>_(e,t).then(n=>n.toBlob());_.toPng=(e,t)=>_(e,{...t,format:"png"}).then(n=>n.toPng());_.toJpg=(e,t)=>_(e,{...t,format:"jpeg"}).then(n=>n.toJpg());_.toWebp=(e,t)=>_(e,{...t,format:"webp"}).then(n=>n.toWebp());_.download=(e,t)=>_(e,t).then(n=>n.download());async function Ss(e,t){if(Ar)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await to(e,n)}catch(i){F(t,"safariWarmup pre-capture failed",i)}await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i))),r&&await new Promise(i=>{let o=new Image;try{o.decoding="sync",o.loading="eager"}catch(a){F(t,"safariWarmup img hints failed",a)}o.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",o.src=r,document.body.appendChild(o),(async()=>{try{typeof o.decode=="function"&&await o.decode()}catch(c){F(t,"safariWarmup img.decode failed",c)}let a=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-a<900;)await new Promise(c=>setTimeout(c,200));await new Promise(c=>requestAnimationFrame(c));try{let c=document.createElement("canvas");c.width=Math.max(1,o.naturalWidth||10),c.height=Math.max(1,o.naturalHeight||10);let l=c.getContext("2d");l&&l.drawImage(o,0,0)}catch{}await new Promise(c=>requestAnimationFrame(c));try{o.remove()}catch(c){F(t,"safariWarmup img.remove failed",c)}i()})()}),e.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){F(t,"safariWarmup canvas poke failed",o)}}),Ar=!0}function Es(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let n=t.currentNode,r=getComputedStyle(n),i=r.backgroundImage&&r.backgroundImage!=="none",o=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(i||o||n.tagName==="CANVAS")return!0}return!1}var ro=!1,bn=null;function oo(e){if(e.dataset.fontProxied||!e.rel||!e.rel.includes("stylesheet"))return!1;let t=e.href||"";try{return new URL(t).origin!==window.location.origin}catch{return!1}}function io(e){let t=`/__mindstudio_dev__/font-proxy?url=${encodeURIComponent(e.href)}`,n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.fontProxied="true",e.media&&(n.media=e.media),n.onload=()=>{e.remove()},n.onerror=()=>{n.remove()},e.parentNode?.insertBefore(n,e.nextSibling)}function ao(){let e=document.querySelectorAll('link[rel~="stylesheet"]');for(let t of e)oo(t)&&io(t)}function Cs(){bn||(bn=new MutationObserver(e=>{for(let t of e)for(let n of t.addedNodes)n instanceof HTMLLinkElement&&oo(n)&&io(n)}),bn.observe(document.documentElement,{childList:!0,subtree:!0}))}function lo(){ro||(ro=!0,ao(),Cs())}async function so(){ao();try{await document.fonts.ready}catch{}}var ks=750,Ms=400,As=600,Me=2,fo=["#__mindstudio-cursor","#__mindstudio-cursor-ripple","#__mindstudio-notes-cursor","#__mindstudio-camera","#__mindstudio-flash"],$s="#DD2590",Ls=`<svg width="44" height="44" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9
|
+
`):u+=f[0]}return u+=c.slice(d),u}let a=gr(e,t||location.href);return a=await o(a,t||location.href,0),a}var jr=/url\((["']?)([^"')]+)\1\)/g,hl=/@font-face[^{}]*\{[^}]*\}/g;function zr(e){if(!e)return[];let t=[],n=e.split(",").map(r=>r.trim()).filter(Boolean);for(let r of n){let i=r.match(/^U\+([0-9A-Fa-f?]+)(?:-([0-9A-Fa-f?]+))?$/);if(!i)continue;let o=i[1],a=i[2],c=l=>{if(!l.includes("?"))return parseInt(l,16);let s=parseInt(l.replace(/\?/g,"0"),16),u=parseInt(l.replace(/\?/g,"F"),16);return[s,u]};if(a){let l=c(o),s=c(a),u=Array.isArray(l)?l[0]:l,d=Array.isArray(s)?s[1]:s;t.push([Math.min(u,d),Math.max(u,d)])}else{let l=c(o);Array.isArray(l)?t.push([l[0],l[1]]):t.push([l,l])}}return t}function Vr(e,t){if(!t.length||!e||e.size===0)return!0;for(let n of e)for(let[r,i]of t)if(n>=r&&n<=i)return!0;return!1}function wn(e,t){let n=[];if(!e)return n;for(let r of e.matchAll(jr)){let i=(r[2]||"").trim();if(!(!i||i.startsWith("data:"))){if(!/^https?:/i.test(i))try{i=new URL(i,t||location.href).href}catch{}n.push(i)}}return n}async function Xr(e,t,n=""){let r=e;for(let i of e.matchAll(jr)){let o=hn(i[0]);if(!o)continue;let a=o;if(!a.startsWith("http")&&!a.startsWith("data:"))try{a=new URL(a,t||location.href).href}catch{}if(!me(a)){if(C.resource?.has(a)){C.font?.add(a),r=r.replace(i[0],`url(${C.resource.get(a)})`);continue}if(!C.font?.has(a))try{let c=await ne(a,{as:"dataURL",useProxy:n,silent:!0});if(c.ok&&typeof c.data=="string"){let l=c.data;C.resource?.set(a,l),C.font?.add(a),r=r.replace(i[0],`url(${l})`)}}catch{console.warn("[snapDOM] Failed to fetch font resource:",a)}}}return r}function gl(e){if(!e.length)return null;let t=(a,c)=>e.some(([l,s])=>!(s<a||l>c)),n=t(0,255)||t(305,305),r=t(256,591)||t(7680,7935),i=t(880,1023),o=t(1024,1279);return t(7840,7929)||t(258,259)||t(416,417)||t(431,432)?"vietnamese":o?"cyrillic":i?"greek":r?"latin-ext":n?"latin":null}function yr(e={}){let t=new Set((e.families||[]).map(i=>String(i).toLowerCase())),n=new Set((e.domains||[]).map(i=>String(i).toLowerCase())),r=new Set((e.subsets||[]).map(i=>String(i).toLowerCase()));return(i,o)=>{if(t.size&&t.has(i.family.toLowerCase()))return!0;if(n.size)for(let a of i.srcUrls)try{if(n.has(new URL(a).host.toLowerCase()))return!0}catch{}if(r.size){let a=gl(o);if(a&&r.has(a))return!0}return!1}}function yl(e){if(!e)return e;let t=/@font-face[^{}]*\{[^}]*\}/gi,n=new Set,r=[];for(let o of e.match(t)||[]){let a=o.match(/font-family:\s*([^;]+);/i)?.[1]||"",c=At(a),l=(o.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),s=(o.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),u=(o.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),d=(o.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),f=(o.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),p=wn(f,location.href),g=p.length?p.map(m=>String(m).toLowerCase()).sort().join("|"):f.toLowerCase(),h=[String(c||"").toLowerCase(),l,s,u,d.toLowerCase(),g].join("|");n.has(h)||(n.add(h),r.push(o))}if(r.length===0)return e;let i=0;return e.replace(t,()=>r[i++]||"")}function wl(e,t,n,r,i){let o=Array.from(e||[]).sort().join("|"),a=t?JSON.stringify({families:(t.families||[]).map(u=>String(u).toLowerCase()).sort(),domains:(t.domains||[]).map(u=>String(u).toLowerCase()).sort(),subsets:(t.subsets||[]).map(u=>String(u).toLowerCase()).sort()}):"",c=(n||[]).map(u=>`${(u.family||"").toLowerCase()}::${u.weight||"normal"}::${u.style||"normal"}::${u.src||""}`).sort().join("|"),l=r||"",s=(i||[]).map(u=>String(u).toLowerCase()).sort().join("|");return`fonts-embed-css::req=${o}::ex=${a}::lf=${c}::px=${l}::fd=${s}`}async function Yr(e,t,n,r){let i;try{i=e.cssRules||[]}catch{return}let o=(a,c)=>{try{return new URL(a,c||location.href).href}catch{return a}};for(let a of i){if(a.type===CSSRule.IMPORT_RULE&&a.styleSheet){let c=a.href?o(a.href,t):t;if(r.depth>=Et){console.warn(`[snapDOM] CSSOM import depth exceeded (${Et}) at ${c}`);continue}if(c&&r.visitedSheets.has(c)){console.warn(`[snapDOM] Skipping circular CSSOM import: ${c}`);continue}c&&r.visitedSheets.add(c);let l={...r,depth:(r.depth||0)+1};await Yr(a.styleSheet,c,n,l);continue}if(a.type===CSSRule.FONT_FACE_RULE){let c=(a.style.getPropertyValue("font-family")||"").trim(),l=At(c);if(!l||me(l))continue;let s=(a.style.getPropertyValue("font-weight")||"400").trim(),u=(a.style.getPropertyValue("font-style")||"normal").trim(),d=(a.style.getPropertyValue("font-stretch")||"100%").trim(),f=(a.style.getPropertyValue("src")||"").trim(),p=(a.style.getPropertyValue("unicode-range")||"").trim();if(!r.faceMatchesRequired(l,u,s,d))continue;let g=zr(p);if(!Vr(r.usedCodepoints,g))continue;let h={family:l,weightSpec:s,styleSpec:u,stretchSpec:d,unicodeRange:p,srcRaw:f,srcUrls:wn(f,t||location.href),href:t||location.href};if(r.simpleExcluder&&r.simpleExcluder(h,g))continue;if(/url\(/i.test(f)){let m=await Xr(f,t||location.href,r.useProxy);await n(`@font-face{font-family:${l};src:${m};font-style:${u};font-weight:${s};font-stretch:${d};${p?`unicode-range:${p};`:""}}`)}else await n(`@font-face{font-family:${l};src:${f};font-style:${u};font-weight:${s};font-stretch:${d};${p?`unicode-range:${p};`:""}}`)}}}async function bl({required:e,usedCodepoints:t,exclude:n=void 0,localFonts:r=[],useProxy:i="",fontStylesheetDomains:o=[]}={}){e instanceof Set||(e=new Set),t instanceof Set||(t=new Set);let a=new Map;for(let m of e){let[y,x,b,w]=String(m).split("__");if(!y)continue;let E=a.get(y)||[];E.push({w:parseInt(x,10),s:b,st:parseInt(w,10)}),a.set(y,E)}function c(m,y,x,b){if(!a.has(m))return!1;let w=a.get(m),E=sl(x),S=cl(y),v=ul(b),k=E.min!==E.max,T=E.min,W=$=>S.kind==="normal"&&$==="normal"||S.kind!=="normal"&&($==="italic"||$==="oblique"),I=!1;for(let $ of w){let A=k?$.w>=E.min&&$.w<=E.max:$.w===T,H=W(vt($.s)),V=$.st>=v.min&&$.st<=v.max;if(A&&H&&V){I=!0;break}}if(I)return!0;if(!k)for(let $ of w){let A=W(vt($.s)),H=$.st>=v.min&&$.st<=v.max;if(Math.abs(T-$.w)<=300&&A&&H)return!0}if(!k&&S.kind==="normal"&&w.some($=>vt($.s)!=="normal"))for(let $ of w){let A=Math.abs(T-$.w)<=300,H=$.st>=v.min&&$.st<=v.max;if(A&&H)return!0}return!1}let l=yr(n),s=wl(e,n,r,i,o);if(C.resource?.has(s))return C.resource.get(s);let u=ml(e),d=[],f=cn;for(let m of document.querySelectorAll("style")){let y=m.textContent||"";for(let x of y.matchAll(f)){let b=(x[2]||x[4]||"").trim();!b||me(b)||document.querySelector(`link[rel="stylesheet"][href="${b}"]`)||d.push(b)}}d.length&&await Promise.all(d.map(m=>new Promise(y=>{if(document.querySelector(`link[rel="stylesheet"][href="${m}"]`))return y(null);let x=document.createElement("link");x.rel="stylesheet",x.href=m,x.setAttribute("data-snapdom","injected-import"),x.onload=()=>y(x),x.onerror=()=>y(null),document.head.appendChild(x)})));let p="",g=Array.from(document.querySelectorAll('link[rel="stylesheet"]')).filter(m=>!!m.href);for(let m of g)try{if(me(m.href))continue;let y="",x=!1;try{x=new URL(m.href,location.href).origin===location.origin}catch{}if(!x){let w=Array.isArray(o)?o:[];if(!fl(m.href,u,w))continue}if(x){let w=Array.from(document.styleSheets).find(E=>E.href===m.href);if(w)try{let E=w.cssRules||[];y=Array.from(E).map(S=>S.cssText).join("")}catch{}}if(!y){let w=await ne(m.href,{as:"text",useProxy:i});if(w?.ok&&typeof w.data=="string"&&(y=w.data),me(m.href))continue}y=await pl(y,m.href,i);let b="";for(let w of y.match(hl)||[]){let E=(w.match(/font-family:\s*([^;]+);/i)?.[1]||"").trim(),S=At(E);if(!S||me(S))continue;let v=(w.match(/font-weight:\s*([^;]+);/i)?.[1]||"400").trim(),k=(w.match(/font-style:\s*([^;]+);/i)?.[1]||"normal").trim(),T=(w.match(/font-stretch:\s*([^;]+);/i)?.[1]||"100%").trim(),W=(w.match(/unicode-range:\s*([^;]+);/i)?.[1]||"").trim(),I=(w.match(/src\s*:\s*([^;}]+)[;}]/i)?.[1]||"").trim(),$=wn(I,m.href);if(!c(S,k,v,T))continue;let A=zr(W);if(!Vr(t,A))continue;let H={family:S,weightSpec:v,styleSpec:k,stretchSpec:T,unicodeRange:W,srcRaw:I,srcUrls:$,href:m.href};if(n&&l(H,A))continue;let V=/url\(/i.test(I)?await Xr(w,m.href,i):w;b+=V}b.trim()&&(p+=b)}catch{console.warn("[snapDOM] Failed to process stylesheet:",m.href)}let h={requiredIndex:a,usedCodepoints:t,faceMatchesRequired:c,simpleExcluder:n?yr(n):null,useProxy:i,visitedSheets:new Set,depth:0};for(let m of document.styleSheets)if(!(m.href&&g.some(y=>y.href===m.href)))try{let y=m.href||location.origin+"/";y&&h.visitedSheets.add(y),await Yr(m,y,async x=>{p+=x},h)}catch{}try{for(let m of document.fonts||[]){if(!m||!m.family||m.status!=="loaded"||!m._snapdomSrc)continue;let y=String(m.family).replace(/^['"]+|['"]+$/g,"");if(me(y)||!a.has(y)||n?.families&&n.families.some(b=>String(b).toLowerCase()===y.toLowerCase()))continue;let x=m._snapdomSrc;if(!String(x).startsWith("data:")){if(C.resource?.has(m._snapdomSrc))x=C.resource.get(m._snapdomSrc),C.font?.add(m._snapdomSrc);else if(!C.font?.has(m._snapdomSrc))try{let b=await ne(m._snapdomSrc,{as:"dataURL",useProxy:i,silent:!0});if(b.ok&&typeof b.data=="string")x=b.data,C.resource?.set(m._snapdomSrc,x),C.font?.add(m._snapdomSrc);else continue}catch{console.warn("[snapDOM] Failed to fetch dynamic font src:",m._snapdomSrc);continue}}p+=`@font-face{font-family:'${y}';src:url(${x});font-style:${m.style||"normal"};font-weight:${m.weight||"normal"};}`}}catch{}for(let m of r){if(!m||typeof m!="object")continue;let y=String(m.family||"").replace(/^['"]+|['"]+$/g,"");if(!y||me(y)||!a.has(y)||n?.families&&n.families.some(v=>String(v).toLowerCase()===y.toLowerCase()))continue;let x=m.weight!=null?String(m.weight):"normal",b=m.style!=null?String(m.style):"normal",w=m.stretchPct!=null?`${m.stretchPct}%`:"100%",E=String(m.src||""),S=E;if(!S.startsWith("data:")){if(C.resource?.has(E))S=C.resource.get(E),C.font?.add(E);else if(!C.font?.has(E))try{let v=await ne(E,{as:"dataURL",useProxy:i,silent:!0});if(v.ok&&typeof v.data=="string")S=v.data,C.resource?.set(E,S),C.font?.add(E);else continue}catch{console.warn("[snapDOM] Failed to fetch localFonts src:",E);continue}}p+=`@font-face{font-family:'${y}';src:url(${S});font-style:${b};font-weight:${x};font-stretch:${w};}`}return p&&(p=yl(p),C.resource?.set(s,p)),p}function Gr(e){let t=new Set;if(!e)return t;let n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,null),r=a=>{let c=At(a.fontFamily);if(!c)return;let l=(s,u,d)=>`${c}__${xt(s)}__${vt(u)}__${ll(d)}`;t.add(l(a.fontWeight,a.fontStyle,a.fontStretch))};r(getComputedStyle(e));let i=getComputedStyle(e,"::before");i&&i.content&&i.content!=="none"&&r(i);let o=getComputedStyle(e,"::after");for(o&&o.content&&o.content!=="none"&&r(o);n.nextNode();){let a=n.currentNode,c=getComputedStyle(a);r(c);let l=getComputedStyle(a,"::before");l&&l.content&&l.content!=="none"&&r(l);let s=getComputedStyle(a,"::after");s&&s.content&&s.content!=="none"&&r(s)}return t}function xl(e){let t=new Set,n=i=>{if(i)for(let o of i)t.add(o.codePointAt(0))},r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,null);for(;r.nextNode();){let i=r.currentNode;if(i.nodeType===Node.TEXT_NODE)n(i.nodeValue||"");else if(i.nodeType===Node.ELEMENT_NODE){let o=i;for(let a of["::before","::after"]){let c=getComputedStyle(o,a)?.getPropertyValue("content");if(!(!c||c==="none"))if(/^"/.test(c)||/^'/.test(c))n(c.slice(1,-1));else{let l=c.match(/\\[0-9A-Fa-f]{1,6}/g);if(l)for(let s of l)try{t.add(parseInt(s.slice(1),16))}catch{}}}}}return t}async function Kr(e,t=2){try{await document.fonts.ready}catch{}let n=Array.from(e||[]).filter(Boolean);if(n.length===0)return;let r=()=>{let i=document.createElement("div");i.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;opacity:0!important;pointer-events:none!important;contain:layout size style;";for(let o of n){let a=document.createElement("span");a.textContent="AaBbGg1234\xC1\xC9\xCD\xD3\xDA\xE7\xF1\u2014\u221E",a.style.fontFamily=`"${o}"`,a.style.fontWeight="700",a.style.fontStyle="italic",a.style.fontSize="32px",a.style.lineHeight="1",a.style.whiteSpace="nowrap",a.style.margin="0",a.style.padding="0",i.appendChild(a)}document.body.appendChild(i),i.offsetWidth,document.body.removeChild(i)};for(let i=0;i<Math.max(1,t);i++)r(),await new Promise(o=>requestAnimationFrame(()=>requestAnimationFrame(o)))}re();function vl(e){return/\bcounter\s*\(|\bcounters\s*\(/.test(e||"")}function Sl(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function wr(e,t=!1){let n="",r=Math.max(1,e);for(;r>0;)r--,n=String.fromCharCode(97+r%26)+n,r=Math.floor(r/26);return t?n.toUpperCase():n}function br(e,t=!0){let n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]],r=Math.max(1,Math.min(3999,e)),i="";for(let[o,a]of n)for(;r>=o;)i+=a,r-=o;return t?i:i.toLowerCase()}function xr(e,t){switch((t||"decimal").toLowerCase()){case"decimal":return String(Math.max(0,e));case"decimal-leading-zero":return(e<10?"0":"")+String(Math.max(0,e));case"lower-alpha":return wr(e,!1);case"upper-alpha":return wr(e,!0);case"lower-roman":return br(e,!1);case"upper-roman":return br(e,!0);default:return String(Math.max(0,e))}}function El(e){let t=()=>C?.session?.__counterEpoch??0,n=t(),r=new WeakMap,i=e instanceof Document?e.documentElement:e,o=f=>f&&f.tagName==="LI",a=f=>{let p=0,g=f?.parentElement;if(!g)return 0;for(let h of g.children){if(h===f)break;h.tagName==="LI"&&p++}return p},c=f=>{let p=new Map;for(let[g,h]of f)p.set(g,h.slice());return p},l=(f,p,g)=>{let h=c(f),m;try{m=g.style?.counterReset||getComputedStyle(g).counterReset}catch{}if(m&&m!=="none")for(let x of m.split(",")){let b=x.trim().split(/\s+/),w=b[0],E=Number.isFinite(Number(b[1]))?Number(b[1]):0;if(!w)continue;let S=p.get(w);if(S&&S.length){let v=S.slice();v.push(E),h.set(w,v)}else h.set(w,[E])}let y;try{y=g.style?.counterIncrement||getComputedStyle(g).counterIncrement}catch{}if(y&&y!=="none")for(let x of y.split(",")){let b=x.trim().split(/\s+/),w=b[0],E=Number.isFinite(Number(b[1]))?Number(b[1]):1;if(!w)continue;let S=h.get(w)||[];S.length===0&&S.push(0),S[S.length-1]+=E,h.set(w,S)}try{if(getComputedStyle(g).display==="list-item"&&o(g)){let x=g.parentElement,b=1;if(x&&x.tagName==="OL"){let E=x.getAttribute("start"),S=Number.isFinite(Number(E))?Number(E):1,v=a(g),k=g.getAttribute("value");b=Number.isFinite(Number(k))?Number(k):S+v}else b=1+a(g);let w=h.get("list-item")||[];w.length===0&&w.push(0),w[w.length-1]=b,h.set("list-item",w)}}catch{}return h},s=(f,p,g)=>{let h=l(g,p,f);r.set(f,h);let m=h;for(let y of f.children)m=s(y,h,m);return h},u=new Map;s(i,u,u);function d(){let f=t();if(f!==n){n=f;let p=new Map;s(i,p,p)}}return{get(f,p){d();let g=r.get(f)?.get(p);return g&&g.length?g[g.length-1]:0},getStack(f,p){d();let g=r.get(f)?.get(p);return g?g.slice():[]}}}function Cl(e,t,n){if(!e||e==="none")return e;try{let r=/\b(counter|counters)\s*\(([^)]+)\)/g,i=e.replace(r,(o,a,c)=>{let l=String(c).split(",").map(s=>s.trim());if(a==="counter"){let s=l[0]?.replace(/^["']|["']$/g,""),u=(l[1]||"decimal").toLowerCase(),d=n.get(t,s);return xr(d,u)}else{let s=l[0]?.replace(/^["']|["']$/g,""),u=l[1]?.replace(/^["']|["']$/g,"")??"",d=(l[2]||"decimal").toLowerCase(),f=n.getStack(t,s);return f.length?f.map(p=>xr(p,d)).join(u):""}});return Sl(i)}catch{return"- "}}He();re();var Pe=new WeakMap,vr=300;function kl(e,t){let n=Jr(e);return t?(t.__pseudoPreflightFp!==n&&(t.__pseudoPreflight=Er(e),t.__pseudoPreflightFp=n),!!t.__pseudoPreflight):Er(e)}function un(e){try{return e&&e.cssRules?e.cssRules:null}catch{return null}}function Jr(e){let t=e.querySelectorAll('style,link[rel~="stylesheet"]'),n=`n:${t.length}|`,r=0;for(let o=0;o<t.length;o++){let a=t[o];if(a.tagName==="STYLE"){let c=a.textContent?a.textContent.length:0;n+=`S${c}|`;let l=a.sheet,s=l?un(l):null;s&&(r+=s.length)}else{let c=a.getAttribute("href")||"",l=a.getAttribute("media")||"all";n+=`L${c}|m:${l}|`;let s=a.sheet,u=s?un(s):null;u&&(r+=u.length)}}let i=e.adoptedStyleSheets;return n+=`ass:${Array.isArray(i)?i.length:0}|tr:${r}`,n}function Sr(e,t,n){let r=un(e);if(!r)return!1;for(let i=0;i<r.length;i++){if(n.budget<=0)return!1;let o=r[i],a=o&&o.cssText?o.cssText:"";n.budget--;for(let c of t)if(a.includes(c))return!0;if(o&&o.cssRules&&o.cssRules.length)for(let c=0;c<o.cssRules.length&&n.budget>0;c++){let l=o.cssRules[c],s=l&&l.cssText?l.cssText:"";n.budget--;for(let u of t)if(s.includes(u))return!0}if(n.budget<=0)return!1}return!1}function Er(e=document){let t=Jr(e),n=Pe.get(e);if(n&&n.fingerprint===t)return n.result;let r=["::before","::after","::first-letter",":before",":after",":first-letter","counter(","counters(","counter-increment","counter-reset"],i=e.querySelectorAll("style");for(let a=0;a<i.length;a++){let c=i[a].textContent||"";for(let l of r)if(c.includes(l))return Pe.set(e,{fingerprint:t,result:!0}),!0}let o=e.adoptedStyleSheets;if(Array.isArray(o)&&o.length){let a={budget:vr};try{for(let c of o)if(Sr(c,r,a))return Pe.set(e,{fingerprint:t,result:!0}),!0}catch{}}{let a=e.querySelectorAll('style,link[rel~="stylesheet"]'),c={budget:vr};for(let l=0;l<a.length&&c.budget>0;l++){let s=a[l],u=null;if(s.tagName,u=s.sheet||null,u&&Sr(u,r,c))return Pe.set(e,{fingerprint:t,result:!0}),!0}}return e.querySelector('[style*="counter("], [style*="counters("]')?(Pe.set(e,{fingerprint:t,result:!0}),!0):(Pe.set(e,{fingerprint:t,result:!1}),!1)}var Ie=new WeakMap,Cr=-1;function Ml(e){return(e||"").replace(/"([^"]*)"/g,"$1")}function Al(e){if(!e)return"";let t=[],n=/"([^"]*)"/g,r;for(;r=n.exec(e);)t.push(r[1]);return t.length?t.join(""):Ml(e)}function dn(e,t){let n=e.parentElement,r=n?Ie.get(n):null;return r?{get(i,o){let a=t.get(i,o),c=r.get(o);return typeof c=="number"?Math.max(a,c):a},getStack(i,o){let a=t.getStack(i,o);if(!a.length)return a;let c=r.get(o);if(typeof c=="number"){let l=a.slice();return l[l.length-1]=Math.max(l[l.length-1],c),l}return a}}:t}function fn(e,t,n){let r=new Map;function i(l){let s=[];if(!l||l==="none")return s;for(let u of String(l).split(",")){let d=u.trim().split(/\s+/),f=d[0],p=Number.isFinite(Number(d[1]))?Number(d[1]):void 0;f&&s.push({name:f,num:p})}return s}let o=i(t?.counterReset),a=i(t?.counterIncrement);function c(l){if(r.has(l))return r.get(l).slice();let s=n.getStack(e,l);s=s.length?s.slice():[];let u=o.find(f=>f.name===l);if(u){let f=Number.isFinite(u.num)?u.num:0;s=s.length?[...s,f]:[f]}let d=a.find(f=>f.name===l);if(d){let f=Number.isFinite(d.num)?d.num:1;s.length===0&&(s=[0]),s[s.length-1]+=f}return r.set(l,s.slice()),s}return{get(l,s){let u=c(s);return u.length?u[u.length-1]:0},getStack(l,s){return c(s)},__incs:a}}function $l(e,t,n){let r;try{r=pe(e,t)}catch{}let i=r?.content;if(!i||i==="none"||i==="normal")return{text:"",incs:[]};let o=dn(e,n),a=fn(e,r,o),c=vl(i)?Cl(i,e,a):i;return{text:Al(c),incs:a.__incs||[]}}async function mn(e,t,n,r){if(!(e instanceof Element)||!(t instanceof Element))return;let i=e.ownerDocument||document;if(!kl(i,n))return;let o=C?.session?.__counterEpoch??0;if(Cr!==o&&(Ie=new WeakMap,n&&(n.__counterCtx=null),Cr=o),!n.__counterCtx)try{n.__counterCtx=El(e.ownerDocument||document)}catch(l){F(n,"buildCounterContext failed",l)}let a=n.__counterCtx;for(let l of["::before","::after","::first-letter"])try{let s=pe(e,l);if(!s||s.content==="none"&&s.backgroundImage==="none"&&s.backgroundColor==="transparent"&&(s.borderStyle==="none"||parseFloat(s.borderWidth)===0)&&(!s.transform||s.transform==="none")&&s.display==="inline")continue;if(l==="::first-letter"){let P=pe(e);if(!(s.color!==P.color||s.fontSize!==P.fontSize||s.fontWeight!==P.fontWeight))continue;let R=Array.from(t.childNodes).find(je=>je.nodeType===Node.TEXT_NODE&&je.textContent?.trim().length>0);if(!R)continue;let B=R.textContent,O=B.match(/^([^\p{L}\p{N}\s]*[\p{L}\p{N}](?:['’])?)/u)?.[0],he=B.slice(O?.length||0);if(!O||/[\uD800-\uDFFF]/.test(O))continue;let ue=document.createElement("span");ue.textContent=O,ue.dataset.snapdomPseudo="::first-letter";let Le=ar(s),Te=nn(Le,"span");n.styleMap.set(ue,Te);let ve=document.createTextNode(he);t.replaceChild(ve,R),t.insertBefore(ue,ve);continue}let u=s.content??"",d=u===""||u==="none"||u==="normal",{text:f,incs:p}=$l(e,l,a),g=s.backgroundImage,h=s.backgroundColor,m=s.fontFamily,y=parseInt(s.fontSize)||32,x=parseInt(s.fontWeight)||!1,b=s.color||"#000",w=s.borderStyle,E=parseFloat(s.borderWidth),S=s.transform,v=me(m),k=!d&&f!=="",T=g&&g!=="none",W=h&&h!=="transparent"&&h!=="rgba(0, 0, 0, 0)",I=w&&w!=="none"&&E>0,$=S&&S!=="none";if(!(k||T||W||I||$)){if(p&&p.length&&e.parentElement){let P=Ie.get(e.parentElement)||new Map;for(let{name:R}of p){if(!R)continue;let B=dn(e,a),O=fn(e,pe(e,l),B).get(e,R);P.set(R,O)}Ie.set(e.parentElement,P)}continue}let A=document.createElement("span");A.dataset.snapdomPseudo=l,A.style.pointerEvents="none";let H=ar(s),V=nn(H,"span");if(n.styleMap.set(A,V),v&&f&&f.length===1){let{dataUrl:P,width:R,height:B}=await ol(f,m,x,y,b),O=document.createElement("img");O.src=P,O.style=`height:${y}px;width:${R/B*y}px;object-fit:contain;`,A.appendChild(O),t.dataset.snapdomHasIcon="true"}else if(f&&f.startsWith("url(")){let P=hn(f);if(P?.trim())try{let R=await ne(St(P),{as:"dataURL",useProxy:r.useProxy});if(R?.ok&&typeof R.data=="string"){let B=document.createElement("img");B.src=R.data,B.style=`width:${y}px;height:auto;object-fit:contain;`,A.appendChild(B)}}catch(R){console.error(`[snapdom] Error in pseudo ${l} for`,e,R)}}else!v&&k&&(A.textContent=f);A.style.backgroundImage="none","maskImage"in A.style&&(A.style.maskImage="none"),"webkitMaskImage"in A.style&&(A.style.webkitMaskImage="none");try{A.style.backgroundRepeat=s.backgroundRepeat,A.style.backgroundSize=s.backgroundSize,s.backgroundPositionX&&s.backgroundPositionY?(A.style.backgroundPositionX=s.backgroundPositionX,A.style.backgroundPositionY=s.backgroundPositionY):A.style.backgroundPosition=s.backgroundPosition,A.style.backgroundOrigin=s.backgroundOrigin,A.style.backgroundClip=s.backgroundClip,A.style.backgroundAttachment=s.backgroundAttachment,A.style.backgroundBlendMode=s.backgroundBlendMode}catch{}if(T)try{let P=rn(g),R=await Promise.all(P.map(Lr));A.style.backgroundImage=R.join(", ")}catch(P){console.warn(`[snapdom] Failed to inline background-image for ${l}`,P)}W&&(A.style.backgroundColor=h);let at=A.childNodes.length>0||A.textContent?.trim()!==""||T||W||I||$;if(p&&p.length&&e.parentElement){let P=Ie.get(e.parentElement)||new Map,R=dn(e,a),B=fn(e,pe(e,l),R);for(let{name:O}of p){if(!O)continue;let he=B.get(e,O);P.set(O,he)}Ie.set(e.parentElement,P)}if(!at)continue;l==="::before"?(t.dataset.snapdomHasBefore="1",t.insertBefore(A,t.firstChild)):(t.dataset.snapdomHasAfter="1",t.appendChild(A))}catch(s){console.warn(`[snapdom] Failed to capture ${l} for`,e,s)}let c=Array.from(t.children).filter(l=>!l.dataset.snapdomPseudo);if(n.nodeMap)for(let l of c){let s=n.nodeMap.get(l);s instanceof Element&&await mn(s,l,n,r)}else{let l=Array.from(e.children);for(let s=0;s<Math.min(l.length,c.length);s++)await mn(l[s],c[s],n,r)}}function Ll(e,t){if(!e||!(e instanceof Element))return;let n=e.ownerDocument||document,r=t||n,i=e instanceof SVGSVGElement?[e]:Array.from(e.querySelectorAll("svg"));if(i.length===0)return;let o=/url\(\s*#([^)]+)\)/g,a=["fill","stroke","filter","clip-path","mask","marker","marker-start","marker-mid","marker-end"],c=w=>window.CSS&&CSS.escape?CSS.escape(w):w.replace(/[^a-zA-Z0-9_-]/g,"\\$&"),l="http://www.w3.org/1999/xlink",s=w=>{if(!w||!w.getAttribute)return null;let E=w.getAttribute("href")||w.getAttribute("xlink:href")||(typeof w.getAttributeNS=="function"?w.getAttributeNS(l,"href"):null);if(E)return E;let S=w.attributes;if(!S)return null;for(let v=0;v<S.length;v++){let k=S[v];if(!k||!k.name)continue;if(k.name==="href")return k.value;let T=k.name.indexOf(":");if(T!==-1&&k.name.slice(T+1)==="href")return k.value}return null},u=new Set(Array.from(e.querySelectorAll("[id]")).map(w=>w.id)),d=new Set,f=!1,p=(w,E=null)=>{if(!w)return;o.lastIndex=0;let S;for(;S=o.exec(w);){f=!0;let v=(S[1]||"").trim();v&&(u.has(v)||(d.add(v),E&&!E.has(v)&&E.add(v)))}},g=w=>{let E=w.querySelectorAll("use");for(let v of E){let k=s(v);if(!k||!k.startsWith("#"))continue;f=!0;let T=k.slice(1).trim();T&&!u.has(T)&&d.add(T)}let S=w.querySelectorAll('*[style*="url("],*[fill^="url("], *[stroke^="url("],*[filter^="url("],*[clip-path^="url("],*[mask^="url("],*[marker^="url("],*[marker-start^="url("],*[marker-mid^="url("],*[marker-end^="url("]');for(let v of S){p(v.getAttribute("style")||"");for(let k of a)p(v.getAttribute(k))}};for(let w of i)g(w);if(!f)return;let h=e.querySelector("svg.inline-defs-container");h||(h=n.createElementNS("http://www.w3.org/2000/svg","svg"),h.classList.add("inline-defs-container"),h.setAttribute("aria-hidden","true"),h.setAttribute("style","position:absolute;width:0;height:0;overflow:hidden"),e.insertBefore(h,e.firstChild||null));let m=h.querySelector("defs")||null,y=w=>{if(!w||u.has(w))return null;let E=c(w),S=v=>{let k=r.querySelector(v);return k&&!e.contains(k)?k:null};return S(`svg defs > *#${E}`)||S(`svg > symbol#${E}`)||S(`*#${E}`)};if(!d.size)return;let x=new Set(d),b=new Set;for(;x.size;){let w=x.values().next().value;if(x.delete(w),!w||u.has(w)||b.has(w))continue;let E=y(w);if(!E){b.add(w);continue}m||(m=n.createElementNS("http://www.w3.org/2000/svg","defs"),h.appendChild(m));let S=E.cloneNode(!0);S.id||S.setAttribute("id",w),m.appendChild(S),b.add(w),u.add(w);let v=[S,...S.querySelectorAll("*")];for(let k of v){let T=s(k);if(T&&T.startsWith("#")){let I=T.slice(1).trim();I&&!u.has(I)&&!b.has(I)&&x.add(I)}let W=k.getAttribute?.("style")||"";W&&p(W,x);for(let I of a){let $=k.getAttribute?.(I);$&&p($,x)}}}}re();function Tl(e,t){if(!e||!t)return;let n=e.scrollTop||0;if(!n)return;getComputedStyle(t).position==="static"&&(t.style.position="relative");let r=e.getBoundingClientRect(),i=e.clientHeight,o="data-snap-ph",a=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;a.nextNode();){let c=a.currentNode,l=getComputedStyle(c),s=l.position;if(s!=="sticky"&&s!=="-webkit-sticky")continue;let u=kr(l.top),d=kr(l.bottom);if(u==null&&d==null)continue;let f=Nl(c,e),p=Rl(t,f,o);if(!p)continue;let g=c.getBoundingClientRect(),h=g.width,m=g.height,y=g.left-r.left;if(!(h>0&&m>0)||!Number.isFinite(y))continue;let x=u!=null?u+n:n+(i-m-d);if(!Number.isFinite(x))continue;let b=Number.parseInt(l.zIndex,10),w=Number.isFinite(b),E=w?Math.max(b,1)+1:2,S=w?b-1:0,v=p.cloneNode(!1);v.setAttribute(o,"1"),v.style.position="sticky",v.style.left=`${y}px`,v.style.top=`${x}px`,v.style.width=`${h}px`,v.style.height=`${m}px`,v.style.visibility="hidden",v.style.zIndex=String(S),v.style.overflow="hidden",v.style.background="transparent",v.style.boxShadow="none",v.style.filter="none",p.parentElement?.insertBefore(v,p),p.style.position="absolute",p.style.left=`${y}px`,p.style.top=`${x}px`,p.style.bottom="auto",p.style.zIndex=String(E),p.style.pointerEvents="none"}}function kr(e){if(!e||e==="auto")return null;let t=Number.parseFloat(e);return Number.isFinite(t)?t:null}function Nl(e,t){let n=[];for(let r=e;r&&r!==t;){let i=r.parentElement;if(!i)break;n.push(Array.prototype.indexOf.call(i.children,r)),r=i}return n.reverse()}function Rl(e,t,n){let r=e;for(let i=0;i<t.length;i++)if(r=_l(r,n)[t[i]],!r)return null;return r instanceof HTMLElement?r:null}function _l(e,t){let n=[],r=e.children;for(let i=0;i<r.length;i++){let o=r[i];o.hasAttribute(t)||n.push(o)}return n}function Pl(e){let t=getComputedStyle(e),n=t.outlineStyle,r=t.outlineWidth,i=t.borderStyle,o=t.borderWidth,a=n!=="none"&&parseFloat(r)>0,c=i==="none"||parseFloat(o)===0;a&&c&&(e.style.border=`${r} solid transparent`)}async function Fl(e,t={}){let n={styleMap:C.session.styleMap,styleCache:C.session.styleCache,nodeMap:C.session.nodeMap,options:t},r,i="",o="";Pl(e);try{Ll(e)}catch(l){console.warn("inlineExternal defs or symbol failed:",l)}try{r=await bt(e,n,t)}catch(l){throw console.warn("deepClone failed:",l),l}try{await mn(e,r,n,t)}catch(l){console.warn("inlinePseudoElements failed:",l)}await Ya(r,n);try{let l=r.querySelectorAll("style[data-sd]");for(let s of l)o+=s.textContent||"",s.remove()}catch(l){F(n,"Failed to extract shadow CSS from style[data-sd]",l)}let a=ta(n.styleMap);i=Array.from(a.entries()).map(([l,s])=>`.${s}{${l}}`).join(""),i=o+"[data-snapdom-has-after]::after,[data-snapdom-has-before]::before{content:none!important;display:none!important}"+i;for(let[l,s]of n.styleMap.entries()){if(l.tagName==="STYLE")continue;if(l.getRootNode&&l.getRootNode()instanceof ShadowRoot){l.setAttribute("style",s.replace(/;/g,"; "));continue}let u=a.get(s);u&&l.classList.add(u);let d=l.style?.backgroundImage,f=l.dataset?.snapdomHasIcon;d&&d!=="none"&&(l.style.backgroundImage=d),f&&(l.style.verticalAlign="middle",l.style.display="inline")}for(let[l,s]of n.nodeMap.entries()){let u=s.scrollLeft,d=s.scrollTop;if((u||d)&&l instanceof HTMLElement){l.style.overflow="hidden",l.style.scrollbarWidth="none",l.style.msOverflowStyle="none";let f=document.createElement("div");for(f.style.transform=`translate(${-u}px, ${-d}px)`,f.style.willChange="transform",f.style.display="inline-block",f.style.width="100%";l.firstChild;)f.appendChild(l.firstChild);l.appendChild(f)}}let c=r instanceof HTMLElement&&r.firstElementChild instanceof HTMLElement?r.firstElementChild:r;if(Tl(e,c),e===n.nodeMap.get(r)){let l=n.styleCache.get(e)||pe(e);n.styleCache.set(e,l);let s=qi(l.transform);r.style.margin="0",r.style.top="auto",r.style.left="auto",r.style.right="auto",r.style.bottom="auto",r.style.animation="none",r.style.transition="none",r.style.willChange="auto",r.style.float="none",r.style.clear="none",r.style.transform=s||""}for(let[l,s]of n.nodeMap.entries())s.tagName==="PRE"&&(l.style.marginTop="0",l.style.marginBlockStart="0");return{clone:r,classCSS:i,styleCache:n.styleCache}}He();var Zr="http://www.w3.org/1999/xlink";function Dl(e){return e.getAttribute("href")||e.getAttribute("xlink:href")||(typeof e.getAttributeNS=="function"?e.getAttributeNS(Zr,"href"):null)}function Il(e){let t=parseInt(e.dataset?.snapdomWidth||"",10)||0,n=parseInt(e.dataset?.snapdomHeight||"",10)||0,r=parseInt(e.getAttribute("width")||"",10)||0,i=parseInt(e.getAttribute("height")||"",10)||0,o=parseFloat(e.style?.width||"")||0,a=parseFloat(e.style?.height||"")||0,c=t||o||r||e.width||e.naturalWidth||100,l=n||a||i||e.height||e.naturalHeight||100;return{width:c,height:l}}async function Hl(e,t={}){let n=Array.from(e.querySelectorAll("img")),r=async a=>{if(!a.getAttribute("src")){let f=a.currentSrc||a.src||"";f&&a.setAttribute("src",f)}a.removeAttribute("srcset"),a.removeAttribute("sizes");let c=a.src||"";if(!c)return;let l=await ne(c,{as:"dataURL",useProxy:t.useProxy});if(l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")){a.src=l.data,a.width||(a.width=a.naturalWidth||100),a.height||(a.height=a.naturalHeight||100);return}let{width:s,height:u}=Il(a),{fallbackURL:d}=t||{};if(d)try{let f=typeof d=="function"?await d({width:s,height:u,src:c,element:a}):d;if(f){let p=await ne(f,{as:"dataURL",useProxy:t.useProxy});if(p?.ok&&typeof p.data=="string"){a.src=p.data,a.width||(a.width=s),a.height||(a.height=u);return}}}catch{}if(t.placeholders!==!1){let f=document.createElement("div");f.style.cssText=[`width:${s}px`,`height:${u}px`,"background:#ccc","display:inline-block","text-align:center",`line-height:${u}px`,"color:#666","font-size:12px","overflow:hidden"].join(";"),f.textContent="img",a.replaceWith(f)}else{let f=document.createElement("div");f.style.cssText=`display:inline-block;width:${s}px;height:${u}px;visibility:hidden;`,a.replaceWith(f)}};for(let a=0;a<n.length;a+=4){let c=n.slice(a,a+4).map(r);await Promise.allSettled(c)}let i=Array.from(e.querySelectorAll("image")),o=async a=>{let c=Dl(a);if(!c||c.startsWith("data:")||c.startsWith("blob:"))return;let l=await ne(c,{as:"dataURL",useProxy:t.useProxy});l.ok&&typeof l.data=="string"&&l.data.startsWith("data:")&&(a.setAttribute("href",l.data),a.removeAttribute("xlink:href"),typeof a.removeAttributeNS=="function"&&a.removeAttributeNS(Zr,"href"))};for(let a=0;a<i.length;a+=4){let c=i.slice(a,a+4).map(o);await Promise.allSettled(c)}}ie();async function Ol(e,t,n,r={}){let i=[[e,t]],o=["background-image","mask","mask-image","-webkit-mask","-webkit-mask-image","mask-source","mask-box-image-source","mask-border-source","-webkit-mask-box-image-source","border-image","border-image-source"],a=["mask-position","mask-size","mask-repeat","-webkit-mask-position","-webkit-mask-size","-webkit-mask-repeat","mask-origin","mask-clip","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-position-x","-webkit-mask-position-y"],c=["background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode"],l=["border-image-slice","border-image-width","border-image-outset","border-image-repeat"];for(;i.length;){let[s,u]=i.shift();if(!u)continue;let d=n.get(s)||pe(s);n.has(s)||n.set(s,d);let f=(()=>{let h=d.getPropertyValue("border-image"),m=d.getPropertyValue("border-image-source");return h&&h!=="none"||m&&m!=="none"})();for(let h of c){let m=d.getPropertyValue(h);m&&u.style.setProperty(h,m)}for(let h of o){let m=d.getPropertyValue(h);if(h==="background-image"&&(!m||m==="none")){let b=d.getPropertyValue("background");b&&/url\s*\(/.test(b)&&(m=rn(b).find(w=>/url\s*\(/.test(w))||m)}if(!m||m==="none")continue;let y=rn(m),x=await Promise.all(y.map(b=>Lr(b,r)));x.some(b=>b&&b!=="none"&&!/^url\(undefined/.test(b))&&u.style.setProperty(h,x.join(", "))}for(let h of a){let m=d.getPropertyValue(h);!m||m==="initial"||u.style.setProperty(h,m)}if(f)for(let h of l){let m=d.getPropertyValue(h);!m||m==="initial"||u.style.setProperty(h,m)}let p=s.shadowRoot?Array.from(s.shadowRoot.children).filter(h=>h.tagName!=="STYLE"):Array.from(s.children),g=Array.from(u.children).filter(h=>!(h.dataset?.snapdomPseudo||h.tagName==="STYLE"&&h.dataset?.sd));for(let h=0;h<Math.min(p.length,g.length);h++)i.push([p[h],g[h]])}}ie();re();function Wl(e){if(!e)return()=>{};let t=[];function n(r){let i=Bl(r);i&&t.push(i);for(let o of r.children||[])n(o)}return n(e),()=>t.forEach(r=>r())}function Bl(e){if(!e)return()=>{};let t=Ul(e);if(t<=0)return()=>{};if(!zl(e))return()=>{};let n=getComputedStyle(e),r=Math.round(ql(n)*t+jl(n)),i=e.textContent??"",o=i;if(e.scrollHeight<=r+.5)return()=>{};let a=0,c=i.length,l=-1;for(;a<=c;){let s=a+c>>1;e.textContent=i.slice(0,s)+"\u2026",e.scrollHeight<=r+.5?(l=s,a=s+1):c=s-1}return e.textContent=(l>=0?i.slice(0,l):"")+"\u2026",()=>{e.textContent=o}}function Ul(e){let t=getComputedStyle(e),n=t.getPropertyValue("-webkit-line-clamp")||t.getPropertyValue("line-clamp");n=(n||"").trim();let r=parseInt(n,10);return Number.isFinite(r)&&r>0?r:0}function ql(e){let t=(e.lineHeight||"").trim(),n=parseFloat(e.fontSize)||16;return!t||t==="normal"?Math.round(n*1.2):t.endsWith("px")?parseFloat(t):/^\d+(\.\d+)?$/.test(t)?Math.round(parseFloat(t)*n):t.endsWith("%")?Math.round(parseFloat(t)/100*n):Math.round(n*1.2)}function jl(e){return(parseFloat(e.paddingTop)||0)+(parseFloat(e.paddingBottom)||0)}function zl(e){return e.childElementCount>0?!1:Array.from(e.childNodes).some(t=>t.nodeType===Node.TEXT_NODE)}var Qe=[];function Qr(e){if(!e)return null;if(Array.isArray(e)){let[t,n]=e;return typeof t=="function"?t(n):t}if(typeof e=="object"&&"plugin"in e){let{plugin:t,options:n}=e;return typeof t=="function"?t(n):t}return typeof e=="function"?e():e}function Vl(...e){let t=e.flat();for(let n of t){let r=Qr(n);r&&(Qe.some(i=>i&&i.name&&r.name&&i.name===r.name)||Qe.push(r))}}function eo(e){return(e&&Array.isArray(e.plugins)?e.plugins:Qe)||Qe}async function be(e,t,n){let r=n,i=eo(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,r);typeof c<"u"&&(r=c)}return r}async function Xl(e,t,n){let r=[],i=eo(t);for(let o of i){let a=o&&typeof o[e]=="function"?o[e]:null;if(!a)continue;let c=await a(t,n);typeof c<"u"&&r.push(c)}return r}function Yl(e){let t=[];if(Array.isArray(e))for(let n of e){let r=Qr(n);if(!r||!r.name)continue;let i=t.findIndex(o=>o&&o.name===r.name);i>=0&&t.splice(i,1),t.push(r)}for(let n of Qe)n&&n.name&&!t.some(r=>r.name===n.name)&&t.push(n);return Object.freeze(t)}function Gl(e,t,n=!1){return!e||e.plugins&&!n||(e.plugins=Yl(t)),e}ie();function Kl(e,t,n={}){if(!e||!t||!t.style)return;let r=getComputedStyle(e);try{t.style.boxShadow="none"}catch(o){F(n,"stripRootShadows boxShadow",o)}try{t.style.textShadow="none"}catch(o){F(n,"stripRootShadows textShadow",o)}try{t.style.outline="none"}catch(o){F(n,"stripRootShadows outline",o)}let i=(r.filter||"").replace(/\bblur\([^()]*\)\s*/gi,"").replace(/\bdrop-shadow\([^()]*\)\s*/gi,"").trim().replace(/\s+/g," ");try{t.style.filter=i.length?i:"none"}catch(o){F(n,"stripRootShadows filter",o)}}function Jl(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let r of n)r.remove()}function Zl(e,t={}){let{stripFrameworkDirectives:n=!0}=t,r=new Set(["xml","xlink"]),i=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;i.nextNode();){let o=i.currentNode;for(let a of Array.from(o.attributes)){let c=a.name;if(c.includes("@")){o.removeAttribute(c);continue}if(c.includes(":")){let l=c.split(":",1)[0];if(!r.has(l)){o.removeAttribute(c);continue}}if(n&&(c.startsWith("x-")||c.startsWith("v-")||c.startsWith(":")||c.startsWith("on:")||c.startsWith("bind:")||c.startsWith("let:")||c.startsWith("class:"))){o.removeAttribute(c);continue}}}}function Ql(e,t={}){e&&(Zl(e,t),Jl(e))}function es(e){try{let t=e.getAttribute?.("style")||"";return/\b(height|width|block-size|inline-size)\s*:/.test(t)}catch{return!1}}function ts(e){return e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof HTMLIFrameElement||e instanceof SVGElement||e instanceof HTMLObjectElement||e instanceof HTMLEmbedElement}function ns(e,t){if(!(e instanceof Element)||es(e)||ts(e))return!1;let n=t.position;if(n==="absolute"||n==="fixed"||n==="sticky")return!1;let r=t.display||"";return!(r.includes("flex")||r.includes("grid")||r.startsWith("table")||t.transform&&t.transform!=="none")}function rs(e,t,n=new Map){function r(i,o){if(!(i instanceof Element)||!(o instanceof Element))return;let a=i.childElementCount>o.childElementCount,c=n.get(i)||getComputedStyle(i);if(n.has(i)||n.set(i,c),a&&ns(i,c)){o.style.height||(o.style.height="auto"),o.style.width||(o.style.width="auto"),o.style.removeProperty("block-size"),o.style.removeProperty("inline-size"),o.style.minHeight||(o.style.minHeight="0"),o.style.minWidth||(o.style.minWidth="0"),o.style.maxHeight||(o.style.maxHeight="none"),o.style.maxWidth||(o.style.maxWidth="none");let u=c.overflowY||c.overflowBlock||"visible",d=c.overflowX||c.overflowInline||"visible";(u!=="visible"||d!=="visible")&&(o.style.overflow="visible")}let l=Array.from(i.children),s=Array.from(o.children);for(let u=0;u<Math.min(l.length,s.length);u++)r(l[u],s[u])}r(e,t)}function os(e){let t=getComputedStyle(e);return!(t.display==="none"||t.position==="absolute"||t.position==="fixed")}function is(e,t){if(!(e instanceof Element))return!1;if(e.getAttribute("data-capture")==="exclude"&&t?.excludeMode==="remove")return!0;if(Array.isArray(t?.exclude))for(let n of t.exclude)try{if(e.matches(n))return t.excludeMode==="remove"}catch(r){F(t,"exclude selector match failed",r)}return!1}function as(e,t){let n=getComputedStyle(e),r=e.getBoundingClientRect(),i=1/0,o=-1/0,a=!1,c=Array.from(e.children);for(let p of c){if(is(p,t)||!os(p))continue;let g=p.getBoundingClientRect(),h=g.top-r.top,m=g.bottom-r.top;m<=h||(h<i&&(i=h),m>o&&(o=m),a=!0)}let l=a?Math.max(0,o-i):0,s=parseFloat(n.borderTopWidth)||0,u=parseFloat(n.borderBottomWidth)||0,d=parseFloat(n.paddingTop)||0,f=parseFloat(n.paddingBottom)||0;return s+u+d+f+l}var M=(e,t=3)=>Number.isFinite(e)?Math.round(e*10**t)/10**t:e,ls=/::-webkit-scrollbar(-[a-z]+)?\b/i;function pn(e,t=new Set){let n="";if(!e)return n;for(let r=0;r<e.length;r++){let i=e[r];try{if(i.type===CSSRule.IMPORT_RULE&&i.styleSheet){n+=pn(i.styleSheet.cssRules,t);continue}if(i.type===CSSRule.MEDIA_RULE&&i.cssRules){let o=pn(i.cssRules,t);o&&(n+=`@media ${i.conditionText}{${o}}`);continue}if(i.type===CSSRule.STYLE_RULE){let o=i.selectorText||"";if(ls.test(o)){let a=i.cssText;a&&!t.has(a)&&(t.add(a),n+=a)}}}catch{}}return n}function ss(e){if(!e||!e.styleSheets)return"";let t=new Set,n="";for(let r of Array.from(e.styleSheets))try{let i=r.cssRules;i&&(n+=pn(i,t))}catch{}return n}function cs(e){let t=e.boxShadow||"";if(!t||t==="none")return{top:0,right:0,bottom:0,left:0};let n=t.split(/\),(?=(?:[^()]*\([^()]*\))*[^()]*$)/).map(c=>c.trim()),r=0,i=0,o=0,a=0;for(let c of n){let l=c.match(/-?\d+(\.\d+)?px/g)?.map(h=>parseFloat(h))||[];if(l.length<2)continue;let[s,u,d=0,f=0]=l,p=Math.abs(s)+d+f,g=Math.abs(u)+d+f;i=Math.max(i,p+Math.max(s,0)),a=Math.max(a,p+Math.max(-s,0)),o=Math.max(o,g+Math.max(u,0)),r=Math.max(r,g+Math.max(-u,0))}return{top:Math.ceil(r),right:Math.ceil(i),bottom:Math.ceil(o),left:Math.ceil(a)}}function us(e){let t=(e.filter||"").match(/blur\(\s*([0-9.]+)px\s*\)/),n=t?Math.ceil(parseFloat(t[1])||0):0;return{top:n,right:n,bottom:n,left:n}}function ds(e){if((e.outlineStyle||"none")==="none")return{top:0,right:0,bottom:0,left:0};let t=Math.ceil(parseFloat(e.outlineWidth||"0")||0);return{top:t,right:t,bottom:t,left:t}}function fs(e){let t=`${e.filter||""} ${e.webkitFilter||""}`.trim();if(!t||t==="none")return{bleed:{top:0,right:0,bottom:0,left:0},has:!1};let n=t.match(/drop-shadow\((?:[^()]|\([^()]*\))*\)/gi)||[],r=0,i=0,o=0,a=0,c=!1;for(let l of n){c=!0;let s=l.match(/-?\d+(?:\.\d+)?px/gi)?.map(h=>parseFloat(h))||[],[u=0,d=0,f=0]=s,p=Math.abs(u)+f,g=Math.abs(d)+f;i=Math.max(i,p+Math.max(u,0)),a=Math.max(a,p+Math.max(-u,0)),o=Math.max(o,g+Math.max(d,0)),r=Math.max(r,g+Math.max(-d,0))}return{bleed:{top:M(r),right:M(i),bottom:M(o),left:M(a)},has:c}}function ms(e,t){if(!e||!t||!t.style)return null;let n=getComputedStyle(e);try{t.style.transformOrigin="0 0"}catch{}try{"translate"in t.style&&(t.style.translate="none"),"rotate"in t.style&&(t.style.rotate="none")}catch{}let r=n.transform||"none";if(!r||r==="none")try{let o=to(e);if(o.a===1&&o.b===0&&o.c===0&&o.d===1)return t.style.transform="none",{a:1,b:0,c:0,d:1}}catch{}let i=r.match(/^matrix\(\s*([^)]+)\)$/i);if(i){let o=i[1].split(",").map(a=>parseFloat(a.trim()));if(o.length===6&&o.every(Number.isFinite)){let[a,c,l,s]=o,u=Math.sqrt(a*a+c*c)||0,d=0,f=0,p=0,g=0,h=0,m=0;u>0&&(d=a/u,f=c/u,p=d*l+f*s,g=l-d*p,h=s-f*p,m=Math.sqrt(g*g+h*h)||0,m>0?p=p/m:p=0);let y=u,x=0,b=p*m,w=m;try{t.style.transform=`matrix(${y}, ${x}, ${b}, ${w}, 0, 0)`}catch{}return{a:y,b:x,c:b,d:w}}}try{let o=String(r).trim();return t.style.transform=o+" translate(0px, 0px) rotate(0deg)",null}catch{return null}}function Mr(e,t,n,r,i){let o=n.a,a=n.b,c=n.c,l=n.d,s=n.e||0,u=n.f||0;function d(y,x){let b=y-r,w=x-i,E=o*b+c*w,S=a*b+l*w;return E+=r+s,S+=i+u,[E,S]}let f=[d(0,0),d(e,0),d(0,t),d(e,t)],p=1/0,g=1/0,h=-1/0,m=-1/0;for(let[y,x]of f)y<p&&(p=y),x<g&&(g=x),y>h&&(h=y),x>m&&(m=x);return{minX:p,minY:g,maxX:h,maxY:m,width:h-p,height:m-g}}function ps(e,t,n){let r=(e.transformOrigin||"0 0").trim().split(/\s+/),[i,o]=[r[0]||"0",r[1]||"0"],a=(c,l)=>{let s=c.toLowerCase();return s==="left"||s==="top"?0:s==="center"?l/2:s==="right"||s==="bottom"?l:s.endsWith("px")?parseFloat(s)||0:s.endsWith("%")?(parseFloat(s)||0)*l/100:/^-?\d+(\.\d+)?$/.test(s)&&parseFloat(s)||0};return{ox:a(i,t),oy:a(o,n)}}function hs(e){let t={rotate:"0deg",scale:null,translate:null},n=typeof e.computedStyleMap=="function"?e.computedStyleMap():null;if(n){let i=l=>{try{return typeof n.has=="function"&&!n.has(l)||typeof n.get!="function"?null:n.get(l)}catch{return null}},o=i("rotate");if(o)if(o.angle){let l=o.angle;t.rotate=l.unit==="rad"?l.value*180/Math.PI+"deg":l.value+l.unit}else o.unit?t.rotate=o.unit==="rad"?o.value*180/Math.PI+"deg":o.value+o.unit:t.rotate=String(o);else{let l=getComputedStyle(e);t.rotate=l.rotate&&l.rotate!=="none"?l.rotate:"0deg"}let a=i("scale");if(a){let l="x"in a&&a.x?.value!=null?a.x.value:Array.isArray(a)?a[0]?.value:Number(a)||1,s="y"in a&&a.y?.value!=null?a.y.value:Array.isArray(a)?a[1]?.value:l;t.scale=`${l} ${s}`}else{let l=getComputedStyle(e);t.scale=l.scale&&l.scale!=="none"?l.scale:null}let c=i("translate");if(c){let l="x"in c&&"value"in c.x?c.x.value:Array.isArray(c)?c[0]?.value:0,s="y"in c&&"value"in c.y?c.y.value:Array.isArray(c)?c[1]?.value:0,u="x"in c&&c.x?.unit?c.x.unit:"px",d="y"in c&&c.y?.unit?c.y.unit:"px";t.translate=`${l}${u} ${s}${d}`}else{let l=getComputedStyle(e);t.translate=l.translate&&l.translate!=="none"?l.translate:null}return t}let r=getComputedStyle(e);return t.rotate=r.rotate&&r.rotate!=="none"?r.rotate:"0deg",t.scale=r.scale&&r.scale!=="none"?r.scale:null,t.translate=r.translate&&r.translate!=="none"?r.translate:null,t}var en=null;function gs(){if(en)return en;let e=document.createElement("div");return e.id="snapdom-measure-slot",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",left:"-99999px",top:"0px",width:"0px",height:"0px",overflow:"hidden",opacity:"0",pointerEvents:"none",contain:"size layout style"}),document.documentElement.appendChild(e),en=e,e}function ys(e){let t=gs(),n=document.createElement("div");n.style.transformOrigin="0 0",e.baseTransform&&(n.style.transform=e.baseTransform),e.rotate&&(n.style.rotate=e.rotate),e.scale&&(n.style.scale=e.scale),e.translate&&(n.style.translate=e.translate),t.appendChild(n);let r=to(n);return t.removeChild(n),r}function ws(e){let t=getComputedStyle(e),n=t.transform||"none";if(n!=="none"&&!/^matrix\(\s*1\s*,\s*0\s*,\s*0\s*,\s*1\s*,\s*0\s*,\s*0\s*\)$/i.test(n))return!0;let r=t.rotate&&t.rotate!=="none"&&t.rotate!=="0deg",i=t.scale&&t.scale!=="none"&&t.scale!=="1",o=t.translate&&t.translate!=="none"&&t.translate!=="0px 0px";return!!(r||i||o)}function to(e){let t=getComputedStyle(e).transform;if(!t||t==="none")return new DOMMatrix;try{return new DOMMatrix(t)}catch{return new WebKitCSSMatrix(t)}}async function no(e,t){if(!e)throw new Error("Element cannot be null or undefined");Ui(t.cache);let n=t.fast,r=t.outerTransforms!==!1,i=!!t.outerShadows,o={element:e,options:t,plugins:t.plugins},a,c,l,s="",u="",d,f,p=null;await be("beforeSnap",o),await be("beforeClone",o);let g=Wl(o.element);try{({clone:a,classCSS:c,styleCache:l}=await Fl(o.element,o.options)),!r&&a&&(p=ms(o.element,a)),!i&&a&&Kl(o.element,a,o.options)}finally{g()}if(o={clone:a,classCSS:c,styleCache:l,...o},await be("afterClone",o),Ql(o.clone),o.options?.excludeMode==="remove")try{rs(o.element,o.clone,o.styleCache)}catch(b){console.warn("[snapdom] shrink pass failed:",b)}try{await rl(o.clone,o.element)}catch{}await new Promise(b=>{Fe(async()=>{await Hl(o.clone,o.options),b()},{fast:n})}),await new Promise(b=>{Fe(async()=>{await Ol(o.element,o.clone,o.styleCache,o.options),b()},{fast:n})}),t.embedFonts&&await new Promise(b=>{Fe(async()=>{let w=Gr(o.element),E=xl(o.element);if(ke()){let S=new Set(Array.from(w).map(v=>String(v).split("__")[0]).filter(Boolean));await Kr(S,1)}s=await bl({required:w,usedCodepoints:E,preCached:!1,exclude:o.options.excludeFonts,useProxy:o.options.useProxy,fontStylesheetDomains:o.options.fontStylesheetDomains}),b()},{fast:n})});let h=Qi(o.clone).sort(),m=h.join(",");C.baseStyle.has(m)?u=C.baseStyle.get(m):await new Promise(b=>{Fe(()=>{u=ea(h),C.baseStyle.set(m,u),b()},{fast:n})});let y=ss(o.element?.ownerDocument||document);o={fontsCSS:s,baseCSS:u,scrollbarCSS:y,...o},await be("beforeRender",o),await new Promise(b=>{Fe(()=>{let w=pe(o.element),E=o.element.getBoundingClientRect(),S=Math.max(1,M(o.element.offsetWidth||parseFloat(w.width)||E.width||1)),v=Math.max(1,M(o.element.offsetHeight||parseFloat(w.height)||E.height||1)),k=o.element.ownerDocument||document;if(o.element===k.body||o.element===k.documentElement){let X=Math.max(o.element.scrollHeight||0,k.documentElement?.scrollHeight||0,k.body?.scrollHeight||0),G=Math.max(o.element.scrollWidth||0,k.documentElement?.scrollWidth||0,k.body?.scrollWidth||0);X>0&&(v=Math.max(v,M(X))),G>0&&(S=Math.max(S,M(G)));try{let Y=k.createElement("div");Y.style.cssText="position:absolute!important;left:-9999px!important;top:0!important;width:"+S+"px!important;overflow:visible!important;visibility:hidden!important;";let st=k.createElement("style");st.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,Y.appendChild(st),Y.appendChild(o.clone.cloneNode(!0)),k.body.appendChild(Y);let ct=Y.scrollHeight,ut=Y.scrollWidth;k.body.removeChild(Y),ct>0&&(v=Math.max(v,M(ct))),ut>0&&(S=Math.max(S,M(ut)))}catch{}}if(o.options?.excludeMode==="remove"){let X=as(o.element,o.options);Number.isFinite(X)&&X>0&&(v=Math.max(1,Math.min(v,M(X+1))))}let T=(X,G=NaN)=>{let Y=typeof X=="string"?parseFloat(X):X;return Number.isFinite(Y)?Y:G},W=T(o.options.width),I=T(o.options.height),$=S,A=v,H=Number.isFinite(W),V=Number.isFinite(I),at=v>0?S/v:1;H&&V?($=Math.max(1,M(W)),A=Math.max(1,M(I))):H?($=Math.max(1,M(W)),A=Math.max(1,M($/(at||1)))):V?(A=Math.max(1,M(I)),$=Math.max(1,M(A*(at||1)))):($=S,A=v);let P=0,R=0,B=S,O=v;if(!r&&p&&Number.isFinite(p.a)){let X={a:p.a,b:p.b||0,c:p.c||0,d:p.d||1,e:0,f:0},G=Mr(S,v,X,0,0);P=M(G.minX),R=M(G.minY),B=M(G.maxX),O=M(G.maxY)}else if(r&&Ar(o.element)){let X=w.transform&&w.transform!=="none"?w.transform:"",G=hs(o.element),Y=ys({baseTransform:X,rotate:G.rotate||"0deg",scale:G.scale,translate:G.translate}),{ox:st,oy:ct}=ps(w,S,v),ut=Y.is2D?Y:new DOMMatrix(Y.toString()),dt=Mr(S,v,ut,st,ct);P=M(dt.minX),R=M(dt.minY),B=M(dt.maxX),O=M(dt.maxY)}let he=cs(w),ue=us(w),Le=ds(w),Te=fs(w),ve=i?{top:M(he.top+ue.top+Le.top+Te.bleed.top),right:M(he.right+ue.right+Le.right+Te.bleed.right),bottom:M(he.bottom+ue.bottom+Le.bottom+Te.bleed.bottom),left:M(he.left+ue.left+Le.left+Te.bleed.left)}:{top:0,right:0,bottom:0,left:0};P=M(P-ve.left),R=M(R-ve.top),B=M(B+ve.right),O=M(O+ve.bottom);let je=Math.max(1,M(B-P)),Tn=Math.max(1,M(O-R)),ai=H||V?M($/S):1,li=V||H?M(A/v):1,si=Math.max(1,M(je*ai)),ci=Math.max(1,M(Tn*li)),Nn="http://www.w3.org/2000/svg",ui=ke()&&Ar(o.element)?1:0,ge=M(ui+(r?0:1)),ye=document.createElementNS(Nn,"foreignObject"),di=M(P),fi=M(R);ye.setAttribute("x",String(M(-(di-ge)))),ye.setAttribute("y",String(M(-(fi-ge)))),ye.setAttribute("width",String(M(S+ge*2))),ye.setAttribute("height",String(M(v+ge*2))),ye.style.overflow="visible";let Rn=document.createElement("style");Rn.textContent=(o.scrollbarCSS||"")+o.baseCSS+o.fontsCSS+"svg{overflow:visible;} foreignObject{overflow:visible;}"+o.classCSS,ye.appendChild(Rn);let lt=document.createElement("div");lt.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),lt.style.cssText=`all:initial;box-sizing:border-box;display:block;overflow:visible;width:${M(S)}px;height:${M(v)}px`,lt.appendChild(o.clone),ye.appendChild(lt);let mi=new XMLSerializer().serializeToString(ye),Ut=M(je+ge*2),qt=M(Tn+ge*2),_n=H||V;t.meta={w0:S,h0:v,vbW:Ut,vbH:qt,targetW:$,targetH:A};let pi=ke()&&_n?Ut:M(si+ge*2),hi=ke()&&_n?qt:M(ci+ge*2),gi=parseFloat(pe(k.documentElement)?.fontSize)||16;f=`<svg xmlns="${Nn}" width="${pi}" height="${hi}" viewBox="0 0 ${Ut} ${qt}" font-size="${gi}px">`+mi+"</svg>",d=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(f)}`,o={svgString:f,dataURL:d,...o},b()},{fast:n})}),await be("afterRender",o);let x=document.getElementById("snapdom-sandbox");return x&&x.style.position==="absolute"&&x.remove(),o.dataURL}function Ar(e){return ws(e)}re();function bs(e={}){let t=e.format??"png";t==="jpg"&&(t="jpeg");let n=Bi(e.cache);return{debug:e.debug??!1,fast:e.fast??!0,scale:e.scale??1,exclude:e.exclude??[],excludeMode:e.excludeMode??"hide",filter:e.filter??null,filterMode:e.filterMode??"hide",placeholders:e.placeholders!==!1,embedFonts:e.embedFonts??!1,iconFonts:Array.isArray(e.iconFonts)?e.iconFonts:e.iconFonts?[e.iconFonts]:[],localFonts:Array.isArray(e.localFonts)?e.localFonts:[],excludeFonts:e.excludeFonts??void 0,fontStylesheetDomains:Array.isArray(e.fontStylesheetDomains)?e.fontStylesheetDomains:[],fallbackURL:e.fallbackURL??void 0,cache:n,useProxy:typeof e.useProxy=="string"?e.useProxy:"",width:e.width??null,height:e.height??null,format:t,type:e.type??"svg",quality:e.quality??.92,dpr:e.dpr??(window.devicePixelRatio||1),backgroundColor:e.backgroundColor??(["jpeg","webp"].includes(t)?"#ffffff":null),filename:e.filename??"snapDOM",outerTransforms:e.outerTransforms??!0,outerShadows:e.outerShadows??!1,safariWarmupAttempts:Math.min(3,Math.max(1,(e.safariWarmupAttempts??3)|0)),excludeStyleProps:e.excludeStyleProps??null}}tt();Fr();ie();He();re();function xs(...e){return Vl(...e),_}var _=Object.assign(Ss,{plugins:xs}),ro=Symbol("snapdom.internal"),vs=Symbol("snapdom.internal.silent"),$r=!1;async function Ss(e,t){if(!e)throw new Error("Element cannot be null or undefined");let n=bs(t);if(Gl(n,t&&t.plugins),ke()&&(n.embedFonts===!0||Cs(e))){if(n.embedFonts)try{let i=Gr(e),o=new Set([...i].map(a=>String(a).split("__")[0]).filter(Boolean));await Kr(o,1)}catch{}let r=n.safariWarmupAttempts??3;for(let i=0;i<r;i++)try{await Es(e,t)}catch{}}return n.iconFonts&&n.iconFonts.length>0&&Ka(n.iconFonts),n.snap||(n.snap={toPng:(r,i)=>_.toPng(r,i),toSvg:(r,i)=>_.toSvg(r,i)}),_.capture(e,n,ro)}_.capture=async(e,t,n)=>{if(n!==ro)throw new Error("[snapdom.capture] is internal. Use snapdom(...) instead.");let r=await no(e,t),i={img:async(h,m)=>{let{toImg:y}=await Promise.resolve().then(()=>(sr(),on));return y(r,{...h,...m||{}})},svg:async(h,m)=>{let{toSvg:y}=await Promise.resolve().then(()=>(sr(),on));return y(r,{...h,...m||{}})},canvas:async(h,m)=>{let{toCanvas:y}=await Promise.resolve().then(()=>(Mt(),Dr));return y(r,{...h,...m||{}})},blob:async(h,m)=>{let{toBlob:y}=await Promise.resolve().then(()=>(Br(),Or));return y(r,{...h,...m||{}})},png:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(wt(),yt));return y(r,{...h,...m||{},format:"png"})},jpeg:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(wt(),yt));return y(r,{...h,...m||{},format:"jpeg"})},webp:async(h,m)=>{let{rasterize:y}=await Promise.resolve().then(()=>(wt(),yt));return y(r,{...h,...m||{},format:"webp"})},download:async(h,m)=>{let{download:y}=await Promise.resolve().then(()=>(ha(),Ur));return y(r,{...h,...m||{}})}},o={};for(let h of["img","svg","canvas","blob","png","jpeg","webp"])o[h]=async m=>i[h](t,{...m||{},[vs]:!0});o.jpg=o.jpeg;let a={...t,export:{url:r},exports:o},c=await Xl("defineExports",a),l=Object.assign({},...c.filter(h=>h&&typeof h=="object")),s={...i,...l};s.jpeg&&!s.jpg&&(s.jpg=(h,m)=>s.jpeg(h,m));function u(h,m){let y={...t,...m||{}};return(h==="jpeg"||h==="jpg")&&(y.backgroundColor==null||y.backgroundColor==="transparent")&&(y.backgroundColor="#ffffff"),y}let d=!1,f=Promise.resolve();async function p(h,m){let y=async()=>{let x=s[h];if(!x)throw new Error(`[snapdom] Unknown export type: ${h}`);let b=u(h,m),w={...t,export:{type:h,options:b,url:r}};await be("beforeExport",w);let E=await x(w,b);return await be("afterExport",w,E),d||(d=!0,await be("afterSnap",t)),E};return f=f.then(y)}let g={url:r,toRaw:()=>r,to:(h,m)=>p(h,m),toImg:h=>p("img",h),toSvg:h=>p("svg",h),toCanvas:h=>p("canvas",h),toBlob:h=>p("blob",h),toPng:h=>p("png",h),toJpg:h=>p("jpg",h),toWebp:h=>p("webp",h),download:h=>p("download",h)};for(let h of Object.keys(s)){let m="to"+h.charAt(0).toUpperCase()+h.slice(1);g[m]||(g[m]=y=>p(h,y))}return g};_.toRaw=(e,t)=>_(e,t).then(n=>n.toRaw());_.toImg=(e,t)=>_(e,t).then(n=>n.toImg());_.toSvg=(e,t)=>_(e,t).then(n=>n.toSvg());_.toCanvas=(e,t)=>_(e,t).then(n=>n.toCanvas());_.toBlob=(e,t)=>_(e,t).then(n=>n.toBlob());_.toPng=(e,t)=>_(e,{...t,format:"png"}).then(n=>n.toPng());_.toJpg=(e,t)=>_(e,{...t,format:"jpeg"}).then(n=>n.toJpg());_.toWebp=(e,t)=>_(e,{...t,format:"webp"}).then(n=>n.toWebp());_.download=(e,t)=>_(e,t).then(n=>n.download());async function Es(e,t){if($r)return;let n={...t,fast:!0,embedFonts:!0,scale:.2},r;try{r=await no(e,n)}catch(i){F(t,"safariWarmup pre-capture failed",i)}await new Promise(i=>requestAnimationFrame(()=>requestAnimationFrame(i))),r&&await new Promise(i=>{let o=new Image;try{o.decoding="sync",o.loading="eager"}catch(a){F(t,"safariWarmup img hints failed",a)}o.style.cssText="position:fixed;left:0px;top:0px;width:10px;height:10px;opacity:0.01;pointer-events:none;",o.src=r,document.body.appendChild(o),(async()=>{try{typeof o.decode=="function"&&await o.decode()}catch(c){F(t,"safariWarmup img.decode failed",c)}let a=performance.now();for(;!(o.complete&&o.naturalWidth>0)&&performance.now()-a<900;)await new Promise(c=>setTimeout(c,200));await new Promise(c=>requestAnimationFrame(c));try{let c=document.createElement("canvas");c.width=Math.max(1,o.naturalWidth||10),c.height=Math.max(1,o.naturalHeight||10);let l=c.getContext("2d");l&&l.drawImage(o,0,0)}catch{}await new Promise(c=>requestAnimationFrame(c));try{o.remove()}catch(c){F(t,"safariWarmup img.remove failed",c)}i()})()}),e.querySelectorAll("canvas").forEach(i=>{try{let o=i.getContext("2d",{willReadFrequently:!0});o&&o.getImageData(0,0,1,1)}catch(o){F(t,"safariWarmup canvas poke failed",o)}}),$r=!0}function Cs(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT);for(;t.nextNode();){let n=t.currentNode,r=getComputedStyle(n),i=r.backgroundImage&&r.backgroundImage!=="none",o=r.maskImage&&r.maskImage!=="none"||r.webkitMaskImage&&r.webkitMaskImage!=="none";if(i||o||n.tagName==="CANVAS")return!0}return!1}var oo=!1,bn=null;function io(e){if(e.dataset.fontProxied||!e.rel||!e.rel.includes("stylesheet"))return!1;let t=e.href||"";try{return new URL(t).origin!==window.location.origin}catch{return!1}}function ao(e){let t=`/__mindstudio_dev__/font-proxy?url=${encodeURIComponent(e.href)}`,n=document.createElement("link");n.rel="stylesheet",n.href=t,n.dataset.fontProxied="true",e.media&&(n.media=e.media),n.onload=()=>{e.remove()},n.onerror=()=>{n.remove()},e.parentNode?.insertBefore(n,e.nextSibling)}function lo(){let e=document.querySelectorAll('link[rel~="stylesheet"]');for(let t of e)io(t)&&ao(t)}function ks(){bn||(bn=new MutationObserver(e=>{for(let t of e)for(let n of t.addedNodes)n instanceof HTMLLinkElement&&io(n)&&ao(n)}),bn.observe(document.documentElement,{childList:!0,subtree:!0}))}function so(){oo||(oo=!0,lo(),ks())}async function co(){lo();try{await document.fonts.ready}catch{}}var Ms=750,As=400,$s=600,Me=2,mo=["#__mindstudio-cursor","#__mindstudio-cursor-ripple","#__mindstudio-notes-cursor","#__mindstudio-camera","#__mindstudio-flash"],Ls="#DD2590",Ts=`<svg width="44" height="44" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
10
10
|
<g filter="url(#filter0_d_2_302)">
|
|
11
11
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.5 21C4.57 21 3 19.43 3 17.5V10.5C3 8.57 4.57 7 6.5 7H7.5C7.966 7 8.387 6.49 8.605 6.053C9.239 4.786 10.028 4 12 4H16C17.972 4 18.761 4.786 19.395 6.053C19.613 6.49 20.034 7 20.5 7H21.5C23.43 7 25 8.57 25 10.5V17.5C25 19.43 23.43 21 21.5 21H6.5Z" fill="white"/>
|
|
12
12
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M14 18C11.238 18 9 15.762 9 13C9 10.238 11.238 8 14 8C16.762 8 19 10.238 19 13C19 15.762 16.762 18 14 18ZM21.5 8H20.5C19.5 8 18.816 7.132 18.5 6.5C18 5.5 17.5 5 16 5H14H12C10.5 5 10 5.5 9.5 6.5C9.184 7.132 8.5 8 7.5 8H6.5C5.119 8 4 9.119 4 10.5V17.5C4 18.881 5.119 20 6.5 20H21.5C22.881 20 24 18.881 24 17.5V10.5C24 9.119 22.881 8 21.5 8Z" fill="black"/>
|
|
@@ -23,13 +23,13 @@ ${h}
|
|
|
23
23
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2_302" result="shape"/>
|
|
24
24
|
</filter>
|
|
25
25
|
</defs>
|
|
26
|
-
</svg>`,xn="__mindstudio-camera",
|
|
27
|
-
${
|
|
26
|
+
</svg>`,xn="__mindstudio-camera",po="__mindstudio-flash",oe=null,xe=null;function Ns(){if(document.getElementById(xn))return;let e=document.createElement("div");e.id=xn,e.innerHTML=`
|
|
27
|
+
${Ts}
|
|
28
28
|
<div style="
|
|
29
29
|
position: absolute;
|
|
30
30
|
left: 48px;
|
|
31
31
|
top: 12px;
|
|
32
|
-
background: ${
|
|
32
|
+
background: ${Ls};
|
|
33
33
|
color: white;
|
|
34
34
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
35
35
|
font-size: 11px;
|
|
@@ -40,7 +40,7 @@ ${h}
|
|
|
40
40
|
white-space: nowrap;
|
|
41
41
|
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
42
42
|
">Remy</div>
|
|
43
|
-
`,e.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none","opacity: 0","transition: opacity 300ms ease, left 600ms cubic-bezier(0.4, 0, 0, 1), top 600ms cubic-bezier(0.4, 0, 0, 1)","will-change: left, top, opacity"].join("; ");let t=document.createElement("div");t.id=
|
|
43
|
+
`,e.style.cssText=["position: fixed","z-index: 2147483647","pointer-events: none","opacity: 0","transition: opacity 300ms ease, left 600ms cubic-bezier(0.4, 0, 0, 1), top 600ms cubic-bezier(0.4, 0, 0, 1)","will-change: left, top, opacity"].join("; ");let t=document.createElement("div");t.id=po,t.style.cssText=["position: fixed","top: 0","left: 0","width: 100vw","height: 100vh","background: white","opacity: 0","z-index: 2147483646","pointer-events: none","transition: opacity 600ms ease-out"].join("; "),document.documentElement.appendChild(t),document.documentElement.appendChild(e),oe=e,xe=t}function Rs(e,t){oe&&(oe.style.left=`${e}px`,oe.style.top=`${t}px`,oe.style.opacity="1")}function uo(e,t){oe&&(oe.style.left=`${e}px`,oe.style.top=`${t}px`)}async function _s(){xe&&(xe.style.transition="none",xe.style.opacity="0.7",xe.offsetWidth,xe.style.transition="opacity 600ms ease-out",xe.style.opacity="0",await q(600))}function Ps(){oe&&(oe.style.opacity="0")}function Fs(){document.getElementById(xn)?.remove(),document.getElementById(po)?.remove(),oe=null,xe=null}function fo(e,t){return new Promise(n=>{let r=window.scrollY,i=e-r;if(Math.abs(i)<1){n();return}let o=Math.abs(i),c=Math.max(t,o/2),l=performance.now();function s(u){let d=u-l,f=Math.min(d/c,1),p=f<.5?4*f*f*f:1-Math.pow(-2*f+2,3)/2;window.scrollTo(0,r+i*p),f<1?requestAnimationFrame(s):n()}requestAnimationFrame(s)})}async function $t(e){await co();let t=window.innerWidth,n=window.innerHeight;if(e?.viewportOnly)return Ds(t,n);let r=window.scrollX,i=window.scrollY,o=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",Ns();let a=Math.random()<.5?t+30:-60,c=n*.3+Math.random()*n*.4;Rs(a,c),await q(200);let l=t*.4+Math.random()*t*.15,s=n*.35+Math.random()*n*.15;uo(l,s),await q(700);let u=[],d=0,f=()=>Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);for(;d<f();){let b=f()-n,w=Math.min(d,b);await fo(w,As),uo(l,s),await q(Ms);let E=f(),S=window.scrollY,v=Math.min(n,E-S);await _s();try{let T=await(await _(document.body,{embedFonts:!0,exclude:mo,excludeMode:"remove"})).toCanvas({width:t});if(T){let W=T.height/E,I=Math.round(S*W),$=Math.round(v*W),A=T.width,H=document.createElement("canvas");H.width=A,H.height=$;let V=H.getContext("2d");V&&(V.drawImage(T,0,I,A,$,0,0,A,$),u.push({y:S,canvas:H}))}}catch{}d+=n}if(Ps(),await fo(i,$s),document.documentElement.style.scrollBehavior=o,await q(200),Fs(),u.length===0)throw new Error("Screenshot capture produced no image data");let p=f(),g=u[0].canvas.width/t,h=document.createElement("canvas");h.width=u[0].canvas.width,h.height=Math.round(p*g);let m=h.getContext("2d");if(!m)throw new Error("Failed to create output canvas");for(let b of u)m.drawImage(b.canvas,0,Math.round(b.y*g));let x=h.toDataURL("image/jpeg",.85).replace(/^data:image\/jpeg;base64,/,"");if(!x)throw new Error("Canvas export produced no image data");return{image:x,width:h.width,height:h.height}}async function Ds(e,t){let r=await(await _(document.body,{embedFonts:!0,exclude:mo,excludeMode:"remove"})).toCanvas({width:e,scale:Me});if(!r)throw new Error("SnapDOM viewport capture returned empty result");let i=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),o=document.createElement("canvas");o.width=e*Me,o.height=t*Me;let a=o.getContext("2d");if(!a)throw new Error("Failed to create canvas context");let c=window.scrollY/i*r.height,l=t/i*r.height;a.drawImage(r,0,c,r.width,l,0,0,e*Me,t*Me);let u=o.toDataURL("image/jpeg",.85).replace(/^data:image\/jpeg;base64,/,"");if(!u)throw new Error("Canvas export produced no image data");return{image:u,width:e*Me,height:t*Me}}var vn=!1;function ho(){vn=new URLSearchParams(window.location.search).get("display-mode")==="pip",window.addEventListener("message",t=>{!t.data||typeof t.data.command!="string"||(t.data.command==="display-mode-pip"?vn=!0:t.data.command==="display-mode-full"&&(vn=!1))})}var go="__mindstudio-cursor",Is="__mindstudio-cursor-ripple",yo=.07,Hs=250,Nt=300,Os=2e3,Lt=10,wo=1,Rt="#DD2590",Ws=`<svg width="40" height="41" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
44
44
|
<g filter="url(#filter0_d_4_78)">
|
|
45
45
|
<path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${Rt}"/>
|
|
46
46
|
<path d="M6.9457 5.14539L26.2178 14.3651L27.2985 14.8826L26.1697 15.2813L17.5259 18.3444L12.9812 26.2464L12.3881 27.2792L12.0614 26.1349L6.24434 5.72851L5.94119 4.66488L6.9457 5.14539Z" stroke="${Rt}"/>
|
|
@@ -57,8 +57,8 @@ ${h}
|
|
|
57
57
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_4_78" result="shape"/>
|
|
58
58
|
</filter>
|
|
59
59
|
</defs>
|
|
60
|
-
</svg>`,
|
|
61
|
-
${
|
|
60
|
+
</svg>`,Bs="Remy",N=null,J=null,ae=0,le=0,rt=!1,bo=!1,j=null,Sn=null,vo=!1,Oe=null,nt=null,Tt=null;function xo(e,t,n){return e+(t-e)*n}function So(){window.location.search.includes("mode=iframe")&&(Eo(),ho())}function Eo(){if(document.getElementById(go))return;let e=document.createElement("div");e.id=go,e.innerHTML=`
|
|
61
|
+
${Ws}
|
|
62
62
|
<div style="
|
|
63
63
|
position: absolute;
|
|
64
64
|
left: 33px;
|
|
@@ -74,14 +74,14 @@ ${h}
|
|
|
74
74
|
white-space: nowrap;
|
|
75
75
|
letter-spacing: 0.3px;
|
|
76
76
|
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
|
|
77
|
-
">${
|
|
78
|
-
`,e.style.cssText=["position: fixed","top: 0","left: 0","z-index: 2147483647","pointer-events: none","will-change: left, top, transform, opacity","opacity: 0"].join("; ");let t=document.createElement("div");t.id=Is,t.style.cssText=["position: fixed","z-index: 2147483646","pointer-events: none","width: 0","height: 0","border-radius: 50%",`background: ${Rt}`,"opacity: 0","transform: translate(-50%, -50%)","transition: width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out"].join("; "),document.documentElement.appendChild(t),document.documentElement.appendChild(e),N=e,J=t}function
|
|
79
|
-
width: ${
|
|
77
|
+
">${Bs}</div>
|
|
78
|
+
`,e.style.cssText=["position: fixed","top: 0","left: 0","z-index: 2147483647","pointer-events: none","will-change: left, top, transform, opacity","opacity: 0"].join("; ");let t=document.createElement("div");t.id=Is,t.style.cssText=["position: fixed","z-index: 2147483646","pointer-events: none","width: 0","height: 0","border-radius: 50%",`background: ${Rt}`,"opacity: 0","transform: translate(-50%, -50%)","transition: width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out"].join("; "),document.documentElement.appendChild(t),document.documentElement.appendChild(e),N=e,J=t}function Us(){nt===null&&ko()}function Co(){nt!==null&&(cancelAnimationFrame(nt),nt=null),Oe=null}function ko(){if(N){if(Oe&&Oe.isConnected){let e=Oe.getBoundingClientRect(),t=e.left+e.width/2,n=e.top+e.height/2,r=window.innerWidth,i=window.innerHeight,o=Math.max(Lt,Math.min(t,r-Lt)),a=Math.max(Lt,Math.min(n,i-Lt));if(ae=xo(ae,o,yo),le=xo(le,a,yo),N.style.transition="none",N.style.left=`${ae}px`,N.style.top=`${le}px`,Math.abs(ae-o)<wo&&Math.abs(le-a)<wo&&(ae=o,le=a,N.style.left=`${ae}px`,N.style.top=`${le}px`,Tt)){let c=Tt;Tt=null,c()}}nt=requestAnimationFrame(ko)}}async function _t(e){if(N){if(j&&(clearTimeout(j),j=null),Oe=e,!rt){let t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2;if(!bo){let i=Math.max(window.innerWidth,100),o=Math.max(window.innerHeight,100);Math.random()<.5?(ae=i+20,le=r+(Math.random()-.5)*100):(ae=n+(Math.random()-.5)*100,le=o+20),N.style.transition="none",N.style.left=`${ae}px`,N.style.top=`${le}px`,N.style.opacity="0",N.offsetWidth}N.style.transition=`opacity ${Nt}ms ease`,N.style.opacity="1",rt=!0,bo=!0,await q(Nt)}return Us(),new Promise(t=>{Tt=t})}}async function Mo(){N&&(N.style.transform="scale(0.85) translateY(1px)",J&&(J.style.transition="none",J.style.left=`${ae}px`,J.style.top=`${le}px`,J.style.width="0",J.style.height="0",J.style.opacity="0.35",J.offsetWidth,J.style.transition="width 400ms ease-out, height 400ms ease-out, opacity 400ms ease-out",J.style.width="40px",J.style.height="40px",J.style.opacity="0"),await q(Hs),N&&(N.style.transform="scale(1) translateY(0)"),await q(100))}function En(e){vo=e}function Ao(){j&&(clearTimeout(j),j=null)}function Cn(){N&&Sn!=="visible"&&(Oe=null,j&&clearTimeout(j),j=setTimeout(()=>{Sn!=="visible"&&(N&&(N.style.transition=`opacity ${Nt}ms ease`,N.style.opacity="0",rt=!1),Co(),j=null)},Os))}function Pt(e){vo||(Sn=e,e==="visible"&&!N&&Eo(),N&&(e==="visible"?(j&&(clearTimeout(j),j=null),N.style.transition=`opacity ${Nt}ms ease`,N.style.opacity="1",rt=!0):e==="hidden"?(j&&(clearTimeout(j),j=null),N.style.opacity="0",rt=!1,Co()):Cn()))}var js=150,$o=100;async function kn(e=300,t=2e3){return new Promise(n=>{let r=Date.now()+t,i=Date.now(),o=window.scrollY,a=window.scrollX,c=document.body.scrollTop,l=document.documentElement.scrollTop,s=document.body.scrollHeight,u=document.body.scrollWidth;function d(){if(Date.now()>r){n();return}let f=window.scrollY,p=window.scrollX,g=document.body.scrollTop,h=document.documentElement.scrollTop,m=document.body.scrollHeight,y=document.body.scrollWidth;(f!==o||p!==a||g!==c||h!==l||m!==s||y!==u)&&(o=f,a=p,c=g,l=h,s=m,u=y,i=Date.now()),Date.now()-i>=e?n():requestAnimationFrame(d)}requestAnimationFrame(d)})}var zs=350;async function Mn(e){let t=Vs(e),n=t.map(a=>({el:a,top:a.scrollTop,left:a.scrollLeft})),r=document.documentElement.style.scrollBehavior;document.documentElement.style.scrollBehavior="auto",e.scrollIntoView({block:"center",inline:"nearest",behavior:"instant"}),document.documentElement.style.scrollBehavior=r;let i=t.map(a=>({top:a.scrollTop,left:a.scrollLeft})),o=[];for(let a=0;a<t.length;a++)(n[a].top!==i[a].top||n[a].left!==i[a].left)&&o.push({el:t[a],fromTop:n[a].top,fromLeft:n[a].left,toTop:i[a].top,toLeft:i[a].left});if(o.length===0){await new Promise(a=>requestAnimationFrame(()=>a()));return}for(let a of o)a.el.scrollTop=a.fromTop,a.el.scrollLeft=a.fromLeft;await new Promise(a=>{let c=performance.now();function l(s){let u=s-c,d=Math.min(u/zs,1),f=1-Math.pow(1-d,3);for(let p of o)p.el.scrollTop=p.fromTop+(p.toTop-p.fromTop)*f,p.el.scrollLeft=p.fromLeft+(p.toLeft-p.fromLeft)*f;d<1?requestAnimationFrame(l):a()}requestAnimationFrame(l)})}function Vs(e){let t=[],n=e.parentElement;for(;n;){let r=getComputedStyle(n),i=r.overflowY,o=r.overflowX;(i==="auto"||i==="scroll"||o==="auto"||o==="scroll")&&t.push(n),n=n.parentElement}return t.push(document.scrollingElement||document.documentElement),t}async function Ft(e,t){let n=Date.now(),r=[];En(!0),Ao(),Hn();for(let a=0;a<t.length;a++){let c=t[a],l=c.command;try{a>0&&await q(js+Math.random()*$o-$o/2);let s=await Xs(c);r.push({index:a,command:l,...s})}catch(s){r.push({index:a,command:l,error:s instanceof Error?s.message:String(s)});break}}let i=On(),o=await Ye();return En(!1),Cn(),{id:e,steps:r,snapshot:o,logs:i,duration:Date.now()-n}}async function Xs(e){switch(e.command){case"snapshot":return{result:await Ye()};case"click":{let{element:t,matched:n}=we(e);return await Mn(t),await _t(t),await Mo(),Zt(t),await kn(),await q(1e3),{result:"ok",matched:n}}case"type":{let{element:t,matched:n}=we(e),r=e.text;if(!r&&r!=="")throw new Error('type command requires a "text" field');return await Mn(t),await _t(t),await tr(t,r,{clear:!!e.clear}),await kn(),{result:"ok",matched:n}}case"select":{let{element:t,matched:n}=we(e),r=e.option;if(!r)throw new Error('select command requires an "option" field');await Mn(t),await _t(t);let i=rr(t,r);return await kn(),{result:`selected "${i}"`,matched:n}}case"wait":{let{matched:t,elapsed:n}=await nr(e);return{result:"ok",matched:t,elapsed:n}}case"evaluate":{let t=e.script;if(!t)throw new Error('evaluate command requires a "script" field');return{result:await or(t)}}case"screenshot":{let{image:t,width:n,height:r}=await $t(),i=e.uploadUrl,o=e.uploadFields;if(i&&o){let a=atob(t),c=new Uint8Array(a.length);for(let u=0;u<a.length;u++)c[u]=a.charCodeAt(u);let l=new FormData;for(let[u,d]of Object.entries(o))l.append(u,d);l.append("file",new Blob([c],{type:"image/jpeg"}),"screenshot.jpg");let s=await fetch(i,{method:"POST",body:l});if(!s.ok)throw new Error(`Screenshot upload failed: ${s.status}`);return{result:{width:n,height:r,uploaded:!0}}}return{result:{image:t,width:n,height:r}}}case"reload":return location.reload(),{result:"ok"};default:throw new Error(`Unknown command: ${e.command}`)}}var Ys="/__mindstudio_dev__/ws",Ro=1e3,Gs=1e4,Z=null,Lo=null,Dt=Ro,It=!1;function _o(){Z||(Dn(Po),window.addEventListener("beforeunload",()=>{It=!0,Z&&Z.close()}),Fo())}function Po(){return Z&&Z.readyState===WebSocket.OPEN?Z:null}function Ks(){return`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${Ys}`}function Js(){return window.location.search.includes("mode=iframe")?"iframe":"standalone"}function Fo(){if(!It){try{Z=new WebSocket(Ks())}catch{To();return}Z.onopen=()=>{Z.send(JSON.stringify({type:"hello",mode:Js(),url:location.href,viewport:{w:window.innerWidth,h:window.innerHeight}}))},Z.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{return}switch(t.type){case"ack":Lo=t.clientId,Dt=Ro;break;case"command":Zs(t.id,t.steps);break;case"broadcast":Qs(t.action,t.payload);break}},Z.onclose=()=>{Z=null,Lo=null,It||To()},Z.onerror=()=>{}}}function To(){It||(setTimeout(()=>Fo(),Dt),Dt=Math.min(Dt*2,Gs))}async function Zs(e,t){An("command-started",{id:e,steps:t.map(n=>n.command)});try{let n=await Ft(e,t);No(n),An("command-completed",{id:e,success:!0})}catch{No({id:e,steps:[],snapshot:"",logs:[],duration:0}),An("command-completed",{id:e,success:!1})}}function No(e){let t=Po();t&&t.send(JSON.stringify({type:"result",...e}))}function An(e,t){window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:e,...t},"*")}function Qs(e,t){e==="reload"&&location.reload()}var se="#DD2590";var Do="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",ec=200,Io=`
|
|
79
|
+
width: ${ec}px;
|
|
80
80
|
background: ${se};
|
|
81
81
|
border-radius: 19px 120px 120px;
|
|
82
82
|
font-weight: bold;
|
|
83
83
|
padding: 8px 18px 10px 18px;
|
|
84
|
-
font-family: ${
|
|
84
|
+
font-family: ${Do};
|
|
85
85
|
font-size: 14px;
|
|
86
86
|
line-height: 1.4;
|
|
87
87
|
color: white;
|
|
@@ -89,7 +89,7 @@ ${h}
|
|
|
89
89
|
overflow-wrap: break-word;
|
|
90
90
|
white-space: pre-wrap;
|
|
91
91
|
transition: box-shadow 0.15s;
|
|
92
|
-
`.trim(),ot={inactive:"0 2px 6px rgba(0, 0, 0, 0.15)",selected:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px",editing:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px"},
|
|
92
|
+
`.trim(),ot={inactive:"0 2px 6px rgba(0, 0, 0, 0.15)",selected:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px",editing:"rgba(221, 37, 144, 0.45) 0px 2px 12px, white 0px 0px 0px 3px"},tc=`
|
|
93
93
|
position: absolute;
|
|
94
94
|
top: -8px;
|
|
95
95
|
right: -4px;
|
|
@@ -106,9 +106,9 @@ ${h}
|
|
|
106
106
|
pointer-events: auto;
|
|
107
107
|
display: none;
|
|
108
108
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
109
|
-
font-family: ${
|
|
109
|
+
font-family: ${Do};
|
|
110
110
|
font-weight: bold;
|
|
111
|
-
`.trim(),
|
|
111
|
+
`.trim(),Ho=0;function Oo(){let e=document.createElement("div");return e.dataset.deleteBtn="true",e.innerHTML="\xD7",e.style.cssText=tc,e}function Wo(e,t){let n=`note-${++Ho}`,r=document.createElement("div");r.id=n,r.dataset.noteId=n,r.style.cssText=`
|
|
112
112
|
position: absolute;
|
|
113
113
|
left: ${e}px;
|
|
114
114
|
top: ${t}px;
|
|
@@ -130,7 +130,7 @@ ${h}
|
|
|
130
130
|
${Io}
|
|
131
131
|
box-shadow: ${ot.inactive};
|
|
132
132
|
cursor: grab;
|
|
133
|
-
`;let c=
|
|
133
|
+
`;let c=Oo();return o.appendChild(a),o.appendChild(c),r.appendChild(i),r.appendChild(o),{id:n,type:"pin",x:e,y:t,element:r,bubble:a,deleteBtn:c,state:"inactive"}}function Bo(e,t,n,r){let i=`note-${++Ho}`,o=document.createElement("div");o.id=i,o.dataset.noteId=i,o.style.cssText=`
|
|
134
134
|
position: absolute;
|
|
135
135
|
left: ${e}px;
|
|
136
136
|
top: ${t}px;
|
|
@@ -150,7 +150,7 @@ ${h}
|
|
|
150
150
|
${Io}
|
|
151
151
|
box-shadow: ${ot.inactive};
|
|
152
152
|
cursor: grab;
|
|
153
|
-
`;let s=
|
|
153
|
+
`;let s=Oo();return c.appendChild(l),c.appendChild(s),o.appendChild(a),o.appendChild(c),{id:i,type:"area",x:e,y:t,width:n,height:r,element:o,bubble:l,deleteBtn:s,state:"inactive"}}function Uo(e){e.state="selected",e.bubble.contentEditable="false",e.bubble.style.boxShadow=ot.selected,e.bubble.style.cursor="grab",e.deleteBtn.style.display="block"}function Ht(e){e.state="editing",e.bubble.contentEditable="true",e.bubble.style.boxShadow=ot.editing,e.bubble.style.cursor="text",e.deleteBtn.style.display="block",e.bubble.focus();let t=window.getSelection();t&&(t.selectAllChildren(e.bubble),t.collapseToEnd())}function We(e){return e.bubble.textContent?.trim()||""?(e.state="inactive",e.bubble.contentEditable="false",e.bubble.style.boxShadow=ot.inactive,e.bubble.style.cursor="grab",e.deleteBtn.style.display="none",!0):!1}var nc="__mindstudio-notes-overlay",rc="__mindstudio-notes-cursor",oc=5,ic=`<svg width="25" height="26" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
154
154
|
<g filter="url(#filter0_d_notes)">
|
|
155
155
|
<path d="M12.5448 26L6.72762 5.59339L26 14.8132L17.1816 17.9377L12.5448 26Z" fill="${se}"/>
|
|
156
156
|
<path d="M6.9457 5.14539L26.2178 14.3651L27.2985 14.8826L26.1697 15.2813L17.5259 18.3444L12.9812 26.2464L12.3881 27.2792L12.0614 26.1349L6.24434 5.72851L5.94119 4.66488L6.9457 5.14539Z" stroke="${se}"/>
|
|
@@ -167,23 +167,23 @@ ${h}
|
|
|
167
167
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>
|
|
168
168
|
</filter>
|
|
169
169
|
</defs>
|
|
170
|
-
</svg>`,
|
|
170
|
+
</svg>`,D=null,z=null,$e=[],L=null,Ot=!1,Ue=0,qe=0,Wt=!1,it=!1,U=null,ce=null,jo=0,zo=0;function Vo(){D||(D=document.createElement("div"),D.id=nc,D.style.cssText=`
|
|
171
171
|
position: fixed;
|
|
172
172
|
inset: 0;
|
|
173
173
|
z-index: 2147483646;
|
|
174
174
|
cursor: none;
|
|
175
175
|
touch-action: none;
|
|
176
|
-
`,z=document.createElement("div"),z.id=
|
|
176
|
+
`,z=document.createElement("div"),z.id=rc,z.innerHTML=ic,z.style.cssText=`
|
|
177
177
|
position: fixed;
|
|
178
178
|
top: 0;
|
|
179
179
|
left: 0;
|
|
180
180
|
z-index: 2147483647;
|
|
181
181
|
pointer-events: none;
|
|
182
182
|
will-change: left, top;
|
|
183
|
-
`,
|
|
183
|
+
`,D.addEventListener("pointerdown",Ko),D.addEventListener("pointermove",Go),document.addEventListener("pointermove",Jo,{capture:!0}),document.addEventListener("pointerup",Zo,{capture:!0}),document.addEventListener("pointercancel",Qo,{capture:!0}),document.addEventListener("keydown",ei),document.body.appendChild(D),document.body.appendChild(z))}function Xo(){document.removeEventListener("pointermove",Jo,{capture:!0}),document.removeEventListener("pointerup",Zo,{capture:!0}),document.removeEventListener("pointercancel",Qo,{capture:!0}),document.removeEventListener("keydown",ei),D&&(D.removeEventListener("pointerdown",Ko),D.removeEventListener("pointermove",Go),D.remove(),D=null),z&&(z.remove(),z=null),$e=[],L=null,Be()}function Yo(){z&&(z.style.display="none"),ce=null,it=!1,Be()}function Go(e){if(!z||!D)return;z.style.left=`${e.clientX}px`,z.style.top=`${e.clientY}px`,ti(e.target)?(z.style.display="none",D.style.cursor=""):(z.style.display="",D.style.cursor="none")}function Ko(e){if(!D)return;let t=e.target;if(t.dataset?.deleteBtn==="true"||t.closest("[data-delete-btn]")){let r=t.closest("[data-note-id]");if(r){let i=$e.find(o=>o.id===r.id);if(i){Ae(i),e.preventDefault(),e.stopPropagation();return}}}D.setPointerCapture(e.pointerId);let n=ti(e.target);if(n){if(n.state==="editing")return;if(n.state==="selected"){let r=e.target;if(r.dataset?.bubble==="true"||r.closest("[data-bubble]")){Ht(n),L=n,e.preventDefault();return}qo(n,e),e.preventDefault();return}L&&L!==n&&(We(L)||Ae(L)),Uo(n),L=n,qo(n,e),e.preventDefault();return}if(L&&(L.state==="editing"||L.state==="selected")){We(L)||Ae(L),L=null,it=!0,e.preventDefault();return}Ot=!0,Ue=e.clientX,qe=e.clientY,Wt=!1,it=!1,e.preventDefault()}function Jo(e){if(ce){let r=e.clientX-jo,i=e.clientY-zo;ce.x=r,ce.y=i,ce.element.style.left=`${r}px`,ce.element.style.top=`${i}px`;return}if(!Ot||!D)return;let t=e.clientX-Ue,n=e.clientY-qe;Math.sqrt(t*t+n*n)>oc&&(Wt=!0,U||(U=document.createElement("div"),U.style.cssText=`
|
|
184
184
|
position: fixed;
|
|
185
185
|
border: 4px dashed ${se};
|
|
186
186
|
border-radius: 12px;
|
|
187
187
|
pointer-events: none;
|
|
188
188
|
z-index: 2;
|
|
189
|
-
`,
|
|
189
|
+
`,D.appendChild(U)),U.style.left=`${Math.min(Ue,e.clientX)}px`,U.style.top=`${Math.min(qe,e.clientY)}px`,U.style.width=`${Math.abs(t)}px`,U.style.height=`${Math.abs(n)}px`)}function Zo(e){if(D)try{D.releasePointerCapture(e.pointerId)}catch{}if(ce){ce=null;return}if(it){it=!1,Be();return}if(!Ot||!D){Be();return}if(Wt){U&&(U.remove(),U=null);let t=Math.min(Ue,e.clientX),n=Math.min(qe,e.clientY),r=Math.abs(e.clientX-Ue),i=Math.abs(e.clientY-qe);if(r>10&&i>10){let o=Bo(t,n,r,i);D.appendChild(o.element),$e.push(o),Ht(o),L=o}}else{let t=Wo(e.clientX,e.clientY);D.appendChild(t.element),$e.push(t),Ht(t),L=t}Be()}function Qo(){U&&(U.remove(),U=null),ce=null,Be()}function ei(e){if(L){if(e.key==="Enter"&&!e.shiftKey&&L.state==="editing"){We(L)||Ae(L),L=null,e.preventDefault();return}if(e.key==="Escape"){L.state==="editing"?(We(L)||Ae(L),L=null):L.state==="selected"&&(We(L),L=null),e.preventDefault();return}if(L.state==="selected"&&(e.key==="Delete"||e.key==="Backspace")){Ae(L),L=null,e.preventDefault();return}L.state==="editing"&&(e.key==="Backspace"||e.key==="Delete")&&L.bubble.textContent?.trim()===""&&(Ae(L),L=null,e.preventDefault())}}function qo(e,t){ce=e,jo=t.clientX-e.x,zo=t.clientY-e.y}function ti(e){for(let t of $e)if(t.element.contains(e))return t;return null}function Ae(e){e.element.remove(),$e=$e.filter(t=>t.id!==e.id),L===e&&(L=null)}function Be(){Ot=!1,Ue=0,qe=0,Wt=!1,U&&(U.remove(),U=null)}var Bt=!1;function ni(){Bt||(Bt=!0,Vo())}function ri(){Bt&&(Bt=!1,Xo())}async function oi(){let{image:e}=await $t({viewportOnly:!0});return e}var $n="mindstudio-browser-agent",Ln=null;function ii(){Ln||(Ln=async e=>{if(e.source===window)return;let t=e.data;if(!(!t||t.channel!==$n))switch(t.command){case"notes-enter":ni();break;case"notes-exit":ri();break;case"notes-cursor-hide":Yo();break;case"cursor-show":Pt("visible");break;case"cursor-hide":Pt("hidden");break;case"cursor-auto":Pt(null);break;case"notes-screenshot":{try{let n=await oi();window.parent.postMessage({channel:$n,command:"screenshot-result",image:n},"*")}catch(n){window.parent.postMessage({channel:$n,command:"screenshot-result",error:n instanceof Error?n.message:"Screenshot failed"},"*")}break}}},window.addEventListener("message",Ln))}window.__MINDSTUDIO_BROWSER_AGENT__||(window.__MINDSTUDIO_BROWSER_AGENT__=!0,Wn(),zn(),Vn(),Xn(),Gn(),Yn(),_o(),So(),ii(),so(),window.parent!==window&&window.parent.postMessage({channel:"mindstudio-browser-agent",command:"ready"},"*"));return Si(ac);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mindstudio-ai/browser-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Browser-side agent for MindStudio dev previews — captures logs, provides DOM snapshots, and enables remote interaction.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|