MCPcopy Create free account
hub / github.com/Yorick-Ryu/deep-share / Ut

Function Ut

lib/snapdom.min.js:8–8  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

6*/
7var co=Object.defineProperty;var D=(t,e)=>()=>(t&&(e=t(t=0)),e);var kt=(t,e)=>{for(var n in e)co(t,n,{get:e[n],enumerable:!0})};function _t(t="soft"){switch(S.session.__counterEpoch=(S.session.__counterEpoch||0)+1,t){case"auto":{S.session.styleMap=new Map,S.session.nodeMap=new Map;return}case"soft":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}case"full":return;case"disabled":{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap,S.computedStyle=new WeakMap,S.baseStyle=new Map,S.defaultStyle=new Map,S.image=new Map,S.background=new Map,S.resource=new Map,S.font=new Set;return}default:{S.session.styleMap=new Map,S.session.nodeMap=new Map,S.session.styleCache=new WeakMap;return}}}var S,H=D(()=>{S={image:new Map,background:new Map,resource:new Map,defaultStyle:new Map,baseStyle:new Map,computedStyle:new WeakMap,font:new Set,session:{styleMap:new Map,styleCache:new WeakMap,nodeMap:new Map}}});function it(t){let e=t.match(/url\((['"]?)(.*?)(\1)\)/);if(!e)return null;let n=e[2].trim();return n.startsWith("#")?null:n}function se(t){if(!t||t==="none")return"";let e=t.replace(/translate[XY]?\([^)]*\)/g,"");return e=e.replace(/matrix\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==6?`matrix(${o})`:(s[4]="0",s[5]="0",`matrix(${s.join(", ")})`)}),e=e.replace(/matrix3d\(([^)]+)\)/g,(n,o)=>{let s=o.split(",").map(r=>r.trim());return s.length!==16?`matrix3d(${o})`:(s[12]="0",s[13]="0",`matrix3d(${s.join(", ")})`)}),e.trim().replace(/\s{2,}/g," ")}function J(t){if(/%[0-9A-Fa-f]{2}/.test(t))return t;try{return encodeURI(t)}catch{return t}}var At=D(()=>{});function lo(t="[snapDOM]",{ttlMs:e=5*6e4,maxEntries:n=12}={}){let o=new Map,s=0;function r(i,l,c){if(s>=n)return;let a=Date.now();(o.get(l)||0)>a||(o.set(l,a+e),s++,i==="warn"&&console&&console.warn?console.warn(`${t} ${c}`):console&&console.error&&console.error(`${t} ${c}`))}return{warnOnce(i,l){r("warn",i,l)},errorOnce(i,l){r("error",i,l)},reset(){o.clear(),s=0}}}function uo(t){return/^data:|^blob:|^about:blank$/i.test(t)}function fo(t,e){try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=e.includes("{url}")?e.split("{url}")[0]:e,s=new URL(o||".",n),r=new URL(t,n);if(r.origin===s.origin)return!0;let i=r.searchParams;if(i&&(i.has("url")||i.has("target")))return!0}catch{}return!1}function mo(t,e){if(!e||uo(t)||fo(t,e))return!1;try{let n=typeof location<"u"&&location.href?location.href:"http://localhost/",o=new URL(t,n);return typeof location<"u"?o.origin!==location.origin:!0}catch{return!!e}}function po(t,e){if(!e)return t;if(e.includes("{url}"))return e.replace("{urlRaw}",J(t)).replace("{url}",encodeURIComponent(t));if(/[?&]url=?$/.test(e))return`${e}${encodeURIComponent(t)}`;if(e.endsWith("?"))return`${e}url=${encodeURIComponent(t)}`;if(e.endsWith("/"))return`${e}${J(t)}`;let n=e.includes("?")?"&":"?";return`${e}${n}url=${encodeURIComponent(t)}`}function Re(t){return new Promise((e,n)=>{let o=new FileReader;o.onload=()=>e(String(o.result||"")),o.onerror=()=>n(new Error("read_failed")),o.readAsDataURL(t)})}function ho(t,e){return[e.as||"blob",e.timeout??3e3,e.useProxy||"",e.errorTTL??8e3,t].join("|")}async function P(t,e={}){let n=e.as??"blob",o=e.timeout??3e3,s=e.useProxy||"",r=e.errorTTL??8e3,i=e.headers||{},l=!!e.silent;if(/^data:/i.test(t))try{if(n==="text")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1};if(n==="dataURL")return{ok:!0,data:String(t),status:200,url:t,fromCache:!1,mime:String(t).slice(5).split(";")[0]||""};let[,d="",g=""]=String(t).match(/^data:([^,]*),(.*)$/)||[],x=/;base64/i.test(d)?atob(g):decodeURIComponent(g),w=new Uint8Array([...x].map(C=>C.charCodeAt(0))),k=new Blob([w],{type:(d||"").split(";")[0]||""});return{ok:!0,data:k,status:200,url:t,fromCache:!1,mime:k.type||""}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"special_url_error"}}if(/^blob:/i.test(t))try{let d=await fetch(t);if(!d.ok)return{ok:!1,data:null,status:d.status,url:t,fromCache:!1,reason:"http_error"};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:t,fromCache:!1,mime:b}:n==="text"?{ok:!0,data:await g.text(),status:d.status,url:t,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:t,fromCache:!1,mime:b}}catch{return{ok:!1,data:null,status:0,url:t,fromCache:!1,reason:"network"}}if(/^about:blank$/i.test(t))return n==="dataURL"?{ok:!0,data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",status:200,url:t,fromCache:!1,mime:"image/png"}:{ok:!0,data:n==="text"?"":new Blob([]),status:200,url:t,fromCache:!1};let c=ho(t,{as:n,timeout:o,useProxy:s,errorTTL:r}),a=Wt.get(c);if(a&&a.until>Date.now())return{...a.result,fromCache:!0};a&&Wt.delete(c);let u=ie.get(c);if(u)return u;let m=mo(t,s)?po(t,s):t,p=e.credentials;if(!p)try{let d=typeof location<"u"&&location.href?location.href:"http://localhost/",g=new URL(t,d);p=typeof location<"u"&&g.origin===location.origin?"include":"omit"}catch{p="omit"}let h=new AbortController,y=setTimeout(()=>h.abort("timeout"),o),f=(async()=>{try{let d=await fetch(m,{signal:h.signal,credentials:p,headers:i});if(!d.ok){let x={ok:!1,data:null,status:d.status,url:m,fromCache:!1,reason:"http_error"};if(r>0&&Wt.set(c,{until:Date.now()+r,result:x}),!l){let w=`${d.status} ${d.statusText||""}`.trim();Ne.warnOnce(`http:${d.status}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,`HTTP error ${w} while fetching ${n} ${t}`)}return e.onError&&e.onError(x),x}if(n==="text")return{ok:!0,data:await d.text(),status:d.status,url:m,fromCache:!1};let g=await d.blob(),b=g.type||d.headers.get("content-type")||"";return n==="dataURL"?{ok:!0,data:await Re(g),status:d.status,url:m,fromCache:!1,mime:b}:{ok:!0,data:g,status:d.status,url:m,fromCache:!1,mime:b}}catch(d){let g=d&&typeof d=="object"&&"name"in d&&d.name==="AbortError"?String(d.message||"").includes("timeout")?"timeout":"abort":"network",b={ok:!1,data:null,status:0,url:m,fromCache:!1,reason:g};if(!/^blob:/i.test(t)&&r>0&&Wt.set(c,{until:Date.now()+r,result:b}),!l){let x=`${g}:${n}:${new URL(t,location?.href??"http://localhost/").origin}`,w=g==="timeout"?`Timeout after ${o}ms. Consider increasing timeout or using a proxy for ${t}`:g==="abort"?`Request aborted while fetching ${n} ${t}`:`Network/CORS issue while fetching ${n} ${t}. A proxy may be required`;Ne.errorOnce(x,w)}return e.onError&&e.onError(b),b}finally{clearTimeout(y),ie.delete(c)}})();return ie.set(c,f),f}var Ne,ie,Wt,at=D(()=>{At();Ne=lo("[snapDOM]",{ttlMs:3*6e4,maxEntries:10}),ie=new Map,Wt=new Map});async function ct(t,e={}){if(/^((repeating-)?(linear|radial|conic)-gradient)\(/i.test(t)||t.trim()==="none")return t;let o=it(t);if(!o)return t;let s=J(o);if(S.background.has(s)){let r=S.background.get(s);return r?`url("${r}")`:"none"}try{let r=await P(s,{as:"dataURL",useProxy:e.useProxy});return r.ok?(S.background.set(s,r.data),`url("${r.data}")`):(S.background.set(s,null),"none")}catch{return S.background.set(s,null),"none"}}var Te=D(()=>{H();At();at()});function ae(){for(let t of go){let e=String(t).toLowerCase();Ot.has(e)||gt.has(e)||ce(e)}}function ce(t){if(t=String(t).toLowerCase(),gt.has(t)){let r={};return S.defaultStyle.set(t,r),r}if(S.defaultStyle.has(t))return S.defaultStyle.get(t);let e=document.getElementById("snapdom-sandbox");e||(e=document.createElement("div"),e.id="snapdom-sandbox",e.setAttribute("data-snapdom-sandbox","true"),e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px",e.style.width="0px",e.style.height="0px",e.style.overflow="hidden",document.body.appendChild(e));let n=document.createElement(t);n.style.all="initial",e.appendChild(n);let o=getComputedStyle(n),s={};for(let r of o){if(Pe(r))continue;let i=o.getPropertyValue(r);s[r]=i}return e.removeChild(n),S.defaultStyle.set(t,s),s}function Pe(t){let e=String(t).toLowerCase();return!!(bo.has(e)||wo.test(e)||yo.test(e))}function yt(t,e){if(e=String(e||"").toLowerCase(),gt.has(e))return"";let n=[],o=ce(e);for(let[s,r]of Object.entries(t)){if(Pe(s))continue;let i=o[s];r&&r!==i&&n.push(`${s}:${r}`)}return n.sort(),n.join(";")}function le(t){let e=new Set;return t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_FRAGMENT_NODE?[]:(t.tagName&&e.add(t.tagName.toLowerCase()),typeof t.querySelectorAll=="function"&&t.querySelectorAll("*").forEach(n=>e.add(n.tagName.toLowerCase())),Array.from(e))}function ue(t){let e=new Map;for(let o of t){let s=S.defaultStyle.get(o);if(!s)continue;let r=Object.entries(s).map(([i,l])=>`${i}:${l};`).sort().join("");r&&(e.has(r)||e.set(r,[]),e.get(r).push(o))}let n="";for(let[o,s]of e.entries())n+=`${s.join(",")} { ${o} }
8`;return n}function fe(t){let e=Array.from(new Set(t.values())).filter(Boolean).sort(),n=new Map,o=1;for(let s of e)n.set(s,`c${o++}`);return n}function lt(t,e=null){if(!(t instanceof Element))return window.getComputedStyle(t,e);let n=S.computedStyle.get(t);if(n||(n=new Map,S.computedStyle.set(t,n)),!n.has(e)){let o=window.getComputedStyle(t,e);n.set(e,o)}return n.get(e)}function Ut(t){let e={};for(let n of t)e[n]=t.getPropertyValue(n);return e}function vt(t){let e=[],n=0,o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&n++,r===")"&&n--,r===","&&n===0&&(e.push(t.slice(o,s).trim()),o=s+1)}return e.push(t.slice(o).trim()),e}var Ot,gt,go,yo,wo,bo,de=D(()=>{H();Ot=new Set(["meta","script","noscript","title","link","template"]),gt=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"]),go=["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"];yo=/(?:^|-)(animation|transition)(?:-|$)/i,wo=/^(--|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,bo=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 X(t,{fast:e=!1}={}){if(e)return t();"requestIdleCallback"in window?requestIdleCallback(t,{timeout:50}):setTimeout(t,1)}function O(){if(typeof navigator>"u")return!1;let t=navigator.userAgent||"",e=t.toLowerCase(),n=e.includes("safari")&&!e.includes("chrome")&&!e.includes("crios")&&!e.includes("fxios")&&!e.includes("android"),o=/applewebkit/i.test(t),s=/mobile/i.test(t),r=!/safari/i.test(t),i=o&&s&&r,l=/(micromessenger|wxwork|wecom|windowswechat|macwechat)/i.test(t),c=/(baiduboxapp|baidubrowser|baidusearch|baiduboxlite)/i.test(e),a=/ipad|iphone|ipod/.test(e)&&o;return n||i||l||c||a}var Bt=D(()=>{});var Y=D(()=>{Te();de();Bt();At()});var ve={};kt(ve,{toCanvas:()=>ut});function $r(t){return typeof t=="string"&&/^data:image\/svg\+xml/i.test(t)}function Ir(t){let e=t.indexOf(",");return e>=0?decodeURIComponent(t.slice(e+1)):""}function Lr(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function Nr(t){let e=[],n="",o=0;for(let s=0;s<t.length;s++){let r=t[s];r==="("&&o++,r===")"&&(o=Math.max(0,o-1)),r===";"&&o===0?(e.push(n),n=""):n+=r}return n.trim()&&e.push(n),e.map(s=>s.trim()).filter(Boolean)}function Rr(t){let e=[],n="",o=0;for(let r=0;r<t.length;r++){let i=t[r];i==="("&&o++,i===")"&&(o=Math.max(0,o-1)),i===","&&o===0?(e.push(n.trim()),n=""):n+=i}n.trim()&&e.push(n.trim());let s=[];for(let r of e){if(/\binset\b/i.test(r))continue;let i=r.match(/-?\d+(?:\.\d+)?px/gi)||[],[l="0px",c="0px",a="0px"]=i,u=r.replace(/-?\d+(?:\.\d+)?px/gi,"").replace(/\binset\b/ig,"").trim().replace(/\s{2,}/g," "),m=!!u&&u!==",";s.push(`drop-shadow(${l} ${c} ${a}${m?` ${u}`:""})`)}return s.join(" ")}function Gn(t){let e=Nr(t),n=null,o=null,s=null,r=[];for(let l of e){let c=l.indexOf(":");if(c<0)continue;let a=l.slice(0,c).trim().toLowerCase(),u=l.slice(c+1).trim();a==="box-shadow"?s=u:a==="filter"?n=u:a==="-webkit-filter"?o=u:r.push([a,u])}if(s){let l=Rr(s);l&&(n=n?`${n} ${l}`:l,o=o?`${o} ${l}`:l)}let i=[...r];return n&&i.push(["filter",n]),o&&i.push(["-webkit-filter",o]),i.map(([l,c])=>`${l}:${c}`).join(";")}function Tr(t){return t.replace(/([^{}]+)\{([^}]*)\}/g,(e,n,o)=>`${n}{${Gn(o)}}`)}function Pr(t){return t=t.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi,(e,n)=>e.replace(n,Tr(n))),t=t.replace(/style=(['"])([\s\S]*?)\1/gi,(e,n,o)=>`style=${n}${Gn(o)}${n}`),t}function _r(t){if(!O()||!$r(t))return t;try{let e=Ir(t),n=Pr(e);return Lr(n)}catch{return t}}async function ut(t,e){let{width:n,height:o,scale:s=1,dpr:r=1,meta:i={},backgroundColor:l}=e;t=_r(t);let c=new Image;c.loading="eager",c.decoding="sync",c.crossOrigin="anonymous",c.src=t,await c.decode();let a=c.naturalWidth,u=c.naturalHeight,m=Number.isFinite(i.w0)?i.w0:a,p=Number.isFinite(i.h0)?i.h0:u,h,y,f=Number.isFinite(n),d=Number.isFinite(o);if(f&&d)h=Math.max(1,n),y=Math.max(1,o);else if(f){let x=n/Math.max(1,m);h=n,y=p*x}else if(d){let x=o/Math.max(1,p);y=o,h=m*x}else h=a,y=u;h=h*s,y=y*s;let g=document.createElement("canvas");g.width=h*r,g.height=y*r,g.style.width=`${h}px`,g.style.height=`${y}px`;let b=g.getContext("2d");return r!==1&&b.scale(r,r),l&&(b.save(),b.fillStyle=l,b.fillRect(0,0,h,y),b.restore()),b.drawImage(c,0,0,h,y),g}var St=D(()=>{Bt()});var tt={};kt(tt,{rasterize:()=>Me});async function Me(t,e){let n=await ut(t,e),o=new Image;return o.src=n.toDataURL(`image/${e.format}`,e.quality),await o.decode(),o.style.width=`${n.width/e.dpr}px`,o.style.height=`${n.height/e.dpr}px`,o}var K=D(()=>{St()});var Lt={};kt(Lt,{toImg:()=>Wr,toSvg:()=>Wr});async function Wr(t,e){let{scale:n=1,width:o,height:s,meta:r={}}=e,i=Number.isFinite(o),l=Number.isFinite(s),c=Number.isFinite(n)&&n!==1||i||l;if(O()&&c)return await Me(t,{...e,format:"png",quality:1,meta:r});let a=new Image;if(a.decoding="sync",a.loading="eager",a.src=t,await a.decode(),i&&l)a.style.width=`${o}px`,a.style.height=`${s}px`;else if(i){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=o/Math.max(1,u);a.style.width=`${o}px`,a.style.height=`${Math.round(m*p)}px`}else if(l){let u=Number.isFinite(r.w0)?r.w0:a.naturalWidth,m=Number.isFinite(r.h0)?r.h0:a.naturalHeight,p=s/Math.max(1,m);a.style.height=`${s}px`,a.style.width=`${Math.round(u*p)}px`}else{let u=Math.round(a.naturalWidth*n),m=Math.round(a.naturalHeight*n);if(a.style.width=`${u}px`,a.style.height=`${m}px`,typeof t=="string"&&t.startsWith("data:image/svg+xml"))try{let h=decodeURIComponent(t.split(",")[1]).replace(/width="[^"]*"/,`width="${u}"`).replace(/height="[^"]*"/,`height="${m}"`);t=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(h)}`,a.src=t}catch{}}return a}var Nt=D(()=>{Y();K()});var Fe={};kt(Fe,{toBlob:()=>Ee});async function Ee(t,e){let n=e.type;if(n==="svg"){let s=decodeURIComponent(t.split(",")[1]);return new Blob([s],{type:"image/svg+xml"})}let o=await ut(t,e);return new Promise(s=>o.toBlob(r=>s(r),`image/${n}`,e.quality))}var Jt=D(()=>{St()});var Qn={};kt(Qn,{download:()=>Or});async function Or(t,e){let n=(e?.format||e?.type||"").toLowerCase(),o=n==="jpg"?"jpeg":n||"png",s=e?.filename||`snapdom.${o}`,r={...e||{},format:o,type:o};if(r.dpr=1,o==="svg"){let c=await Ee(t,{...r,type:"svg"}),a=URL.createObjectURL(c),u=document.createElement("a");u.href=a,u.download=s,u.click(),URL.revokeObjectURL(a);return}let i=await ut(t,r),l=document.createElement("a");l.href=i.toDataURL(`image/${o}`,e?.quality),l.download=s,l.click()}var Jn=D(()=>{Jt();St()});Y();Y();H();var _e=new WeakMap,me=new Map,pe=0;function Mt(){pe++}var We=!1;function xo(t=document.documentElement){if(!We){We=!0;try{new MutationObserver(()=>Mt()).observe(t,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{new MutationObserver(()=>Mt()).observe(document.head,{subtree:!0,childList:!0,characterData:!0,attributes:!0})}catch{}try{let e=document.fonts;e&&(e.addEventListener?.("loadingdone",Mt),e.ready?.then(()=>Mt()).catch(()=>{}))}catch{}}}function So(t,e={}){let n={},o=t.getPropertyValue("visibility");for(let r=0;r<t.length;r++){let i=t[r],l=t.getPropertyValue(i);(i==="background-image"||i==="content")&&l.includes("url(")&&!l.includes("data:")&&(l="none"),n[i]=l}let s=["text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-decoration-skip-ink"];for(let r of s)if(!n[r])try{let i=t.getPropertyValue(r);i&&(n[r]=i)}catch{}if(e.embedFonts){let r=["font-feature-settings","font-variation-settings","font-kerning","font-variant","font-variant-ligatures","font-optical-sizing"];for(let i of r)if(!n[i])try{let l=t.getPropertyValue(i);l&&(n[i]=l)}catch{}}return o==="hidden"&&(n.opacity="0"),n}var Oe=new WeakMap;function Co(t){let e=Oe.get(t);return e||(e=Object.entries(t).sort((o,s)=>o[0]<s[0]?-1:o[0]>s[0]?1:0).map(([o,s])=>`${o}:${s}`).join(";"),Oe.set(t,e),e)}function ko(t,e=null,n={}){let o=_e.get(t);if(o&&o.epoch===pe)return o.snapshot;let s=e||getComputedStyle(t),r=So(s,n);return $o(t,s,r),_e.set(t,{epoch:pe,snapshot:r}),r}function Ao(t,e){return t&&t.session&&t.persist?t:t&&(t.styleMap||t.styleCache||t.nodeMap)?{session:t,persist:{snapshotKeyCache:me,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:e||{}}:{session:S.session,persist:{snapshotKeyCache:me,defaultStyle:S.defaultStyle,baseStyle:S.baseStyle,image:S.image,resource:S.resource,background:S.background,font:S.font},options:t||e||{}}}async function Z(t,e,n,o){if(t.tagName==="STYLE")return;let s=Ao(n,o),r=s.options&&s.options.cache||"auto";if(r!=="disabled"&&xo(document.documentElement),r==="disabled"&&!s.session.__bumpedForDisabled&&(Mt(),me.clear(),s.session.__bumpedForDisabled=!0),gt.has(t.tagName?.toLowerCase())){let p=t.getAttribute?.("style");p&&e.setAttribute("style",p)}let{session:i,persist:l}=s;i.styleCache.has(t)||i.styleCache.set(t,getComputedStyle(t));let c=i.styleCache.get(t),a=ko(t,c,s.options),u=Co(a),m=l.snapshotKeyCache.get(u);if(!m){let p=t.tagName?.toLowerCase()||"div";m=yt(a,p),l.snapshotKeyCache.set(u,m)}i.styleMap.set(e,m)}function vo(t){return t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof HTMLIFrameElement||t instanceof SVGElement||t instanceof HTMLObjectElement||t instanceof HTMLEmbedElement}function Mo(t){return t.backgroundImage&&t.backgroundImage!=="none"||t.backgroundColor&&t.backgroundColor!=="rgba(0, 0, 0, 0)"&&t.backgroundColor!=="transparent"||(parseFloat(t.borderTopWidth)||0)>0||(parseFloat(t.borderBottomWidth)||0)>0||(parseFloat(t.paddingTop)||0)>0||(parseFloat(t.paddingBottom)||0)>0?!0:(t.overflowBlock||t.overflowY||"visible")!=="visible"}function Eo(t){let e=t.parentElement;if(!e)return!1;let n=getComputedStyle(e).display||"";return n.includes("flex")||n.includes("grid")}function Fo(t,e){if(t.textContent&&/\S/.test(t.textContent))return!0;let n=t.firstElementChild,o=t.lastElementChild;if(n&&n.tagName==="BR"||o&&o.tagName==="BR")return!0;let s=t.scrollHeight;if(s===0)return!1;let r=parseFloat(e.paddingTop)||0,i=parseFloat(e.paddingBottom)||0;return s>r+i}function $o(t,e,n){if(t instanceof HTMLElement&&t.style&&t.style.height)return;let o=t.tagName&&t.tagName.toLowerCase();if(!o||o!=="div"&&o!=="section"&&o!=="article"&&o!=="main"&&o!=="aside"&&o!=="header"&&o!=="footer"&&o!=="nav"&&o!=="ol"&&o!=="ul"&&o!=="li")return;let s=e.display||"";if(s.includes("flex")||s.includes("grid")||vo(t))return;let r=e.position;if(r==="absolute"||r==="fixed"||r==="sticky"||e.transform!=="none"||Mo(e)||Eo(t))return;let i=e.overflowX||e.overflow||"visible",l=e.overflowY||e.overflow||"visible";if(i!=="visible"||l!=="visible")return;let c=e.clip;c&&c!=="auto"&&c!=="rect(auto, auto, auto, auto)"||e.visibility==="hidden"||e.opacity==="0"||Fo(t,e)&&(delete n.height,delete n["block-size"])}de();var Be=["fill","stroke","color","background-color","stop-color"],Ue=new Map;function Io(t,e){let n=e+"::"+t.toLowerCase(),o=Ue.get(n);if(o)return o;let s=document,r=e==="http://www.w3.org/2000/svg"?s.createElementNS(e,t):s.createElement(t),i=s.createElement("div");i.style.cssText="position:absolute;left:-99999px;top:-99999px;contain:strict;display:block;",i.appendChild(r),s.documentElement.appendChild(i);let l=getComputedStyle(r),c={};for(let a of Be)c[a]=l.getPropertyValue(a)||"";return i.remove(),Ue.set(n,c),c}function De(t,e){if(!(t instanceof Element)||!(e instanceof Element))return;let n=t.getAttribute?.("style"),o=!!(n&&n.includes("var("));if(!o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(l&&typeof l.value=="string"&&l.value.includes("var(")){o=!0;break}}}let s=null;if(o)try{s=getComputedStyle(t)}catch{}if(o){let r=t.style;if(r&&r.length)for(let i=0;i<r.length;i++){let l=r[i],c=r.getPropertyValue(l);if(!c||!c.includes("var("))continue;let a=s&&s.getPropertyValue(l);if(a)try{e.style.setProperty(l,a.trim(),r.getPropertyPriority(l))}catch{}}}if(o&&t.attributes?.length){let r=t.attributes;for(let i=0;i<r.length;i++){let l=r[i];if(!l||typeof l.value!="string"||!l.value.includes("var("))continue;let c=l.name,a=s&&s.getPropertyValue(c);if(a)try{e.style.setProperty(c,a.trim())}catch{}}}if(!o){if(!s)try{s=getComputedStyle(t)}catch{s=null}if(!s)return;let r=t.namespaceURI||"html",i=Io(t.tagName,r);for(let l of Be){let c=s.getPropertyValue(l)||"",a=i[l]||"";if(c&&c!==a)try{e.style.setProperty(l,c.trim())}catch{}}}}Y();H();at();function Ht(t,e,n){return Promise.all(t.map(o=>new Promise(s=>{function r(){X(i=>{(i&&typeof i.timeRemaining=="function"?i.timeRemaining()>0:!0)?e(o,s):r()},{fast:n})}r()})))}function Lo(t){return t=t.trim(),!t||/:not\(\s*\[data-sd-slotted\]\s*\)\s*$/.test(t)?t:`${t}:not([data-sd-slotted])`}function No(t,e,n=!0){return t.split(",").map(o=>o.trim()).filter(Boolean).map(o=>{if(o.startsWith(":where(")||o.startsWith("@"))return o;let s=n?Lo(o):o;return`:where(${e} ${s})`}).join(", ")}function qe(t,e){return t?(t=t.replace(/:host\(([^)]+)\)/g,(n,o)=>`:where(${e}:is(${o.trim()}))`),t=t.replace(/:host\b/g,`:where(${e})`),t=t.replace(/:host-context\(([^)]+)\)/g,(n,o)=>`:where(:where(${o.trim()}) ${e})`),t=t.replace(/::slotted\(([^)]+)\)/g,(n,o)=>`:where(${e} ${o.trim()})`),t=t.replace(/(^|})(\s*)([^@}{]+){/g,(n,o,s,r)=>{let i=No(r,e,!0);return`${o}${s}${i}{`}),t):""}function ze(t){return t.shadowScopeSeq=(t.shadowScopeSeq||0)+1,`s${t.shadowScopeSeq}`}function je(t){let e="";try{t.querySelectorAll("style").forEach(o=>{e+=(o.textContent||"")+`
9`});let n=t.adoptedStyleSheets||[];for(let o of n)try{if(o&&o.cssRules)for(let s of o.cssRules)e+=s.cssText+`
10`}catch{}}catch{}return e}function Ve(t,e,n){if(!e)return;let o=document.createElement("style");o.setAttribute("data-sd",n),o.textContent=e,t.insertBefore(o,t.firstChild||null)}function Xe(t,e){try{let n=t.currentSrc||t.src||"";if(!n)return;e.setAttribute("src",n),e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.loading="eager",e.decoding="sync"}catch{}}function Ye(t){let e=new Set;if(!t)return e;let n=/var\(\s*(--[A-Za-z0-9_-]+)\b/g,o;for(;o=n.exec(t);)e.add(o[1]);return e}function Ro(t,e){try{let o=getComputedStyle(t).getPropertyValue(e).trim();if(o)return o}catch{}try{let o=getComputedStyle(document.documentElement).getPropertyValue(e).trim();if(o)return o}catch{}return""}function Ke(t,e,n){let o=[];for(let s of e){let r=Ro(t,s);r&&o.push(`${s}: ${r};`)}return o.length?`${n}{${o.join("")}}
11`:""}function Ge(t){t&&(t.nodeType===Node.ELEMENT_NODE&&t.setAttribute("data-sd-slotted",""),t.querySelectorAll&&t.querySelectorAll("*").forEach(e=>e.setAttribute("data-sd-slotted","")))}async function To(t,e=3){let n=()=>{try{return t.contentDocument||t.contentWindow?.document||null}catch{return null}},o=n(),s=0;for(;s<e&&(!o||!o.body&&!o.documentElement);)await new Promise(r=>setTimeout(r,0)),o=n(),s++;return o&&(o.body||o.documentElement)?o:null}function Po(t){let e=t.getBoundingClientRect(),n=0,o=0,s=0,r=0;try{let c=getComputedStyle(t);n=parseFloat(c.borderLeftWidth)||0,o=parseFloat(c.borderRightWidth)||0,s=parseFloat(c.borderTopWidth)||0,r=parseFloat(c.borderBottomWidth)||0}catch{}let i=Math.max(0,Math.round(e.width-(n+o))),l=Math.max(0,Math.round(e.height-(s+r)));return{contentWidth:i,contentHeight:l,rect:e}}function _o(t,e,n){let o=t.createElement("style");return o.setAttribute("data-sd-iframe-pin",""),o.textContent=`html, body {margin: 0 !important;padding: 0 !important;width: ${e}px !important;height: ${n}px !important;min-width: ${e}px !important;min-height: ${n}px !important;box-sizing: border-box !important;overflow: hidden !important;background-clip: border-box !important;}`,(t.head||t.documentElement).appendChild(o),()=>{try{o.remove()}catch{}}}async function Qe(t,e,n){let o=await To(t,3);if(!o)throw new Error("iframe document not accessible/ready");let{contentWidth:s,contentHeight:r,rect:i}=Po(t),l=n?.snap;if(!l||typeof l.toPng!="function")throw new Error("snapdom.toPng not available in iframe or window");let c={...n,scale:1},a=_o(o,s,r),u;try{u=await l.toPng(o.documentElement,c)}finally{a()}u.style.display="block",u.style.width=`${s}px`,u.style.height=`${r}px`;let m=document.createElement("div");return e.nodeMap.set(m,t),Z(t,m,e,n),m.style.overflow="hidden",m.style.display="block",m.style.width||(m.style.width=`${Math.round(i.width)}px`),m.style.height||(m.style.height=`${Math.round(i.height)}px`),m.appendChild(u),m}var Et=new Map;async function Ft(t){if(S.resource?.has(t))return S.resource.get(t);if(Et.has(t))return Et.get(t);let e=(async()=>{let n=await P(t,{as:"dataURL",silent:!0});if(!n.ok||typeof n.data!="string")throw new Error(`[snapDOM] Failed to read blob URL: ${t}`);return S.resource?.set(t,n.data),n.data})();Et.set(t,e);try{let n=await e;return Et.set(t,n),n}catch(n){throw Et.delete(t),n}}var Wo=/\bblob:[^)"'\s]+/g;async function He(t){if(!t||t.indexOf("blob:")===-1)return t;let e=Array.from(new Set(t.match(Wo)||[]));if(e.length===0)return t;let n=t;for(let o of e)try{let s=await Ft(o);n=n.split(o).join(s)}catch{}return n}function Dt(t){return typeof t=="string"&&t.startsWith("blob:")}function Oo(t){return(t||"").split(",").map(e=>e.trim()).filter(Boolean).map(e=>{let n=e.match(/^(\S+)(\s+.+)?$/);return n?{url:n[1],desc:n[2]||""}:null}).filter(Boolean)}function Uo(t){return t.map(e=>e.desc?`${e.url} ${e.desc.trim()}`:e.url).join(", ")}async function Je(t){if(!t)return;let e=t.querySelectorAll?t.querySelectorAll("img"):[];for(let i of e)try{let c=i.getAttribute("src")||i.currentSrc||"";if(Dt(c)){let u=await Ft(c);i.setAttribute("src",u)}let a=i.getAttribute("srcset");if(a&&a.includes("blob:")){let u=Oo(a),m=!1;for(let p of u)if(Dt(p.url))try{p.url=await Ft(p.url),m=!0}catch{}m&&i.setAttribute("srcset",Uo(u))}}catch{}let n=t.querySelectorAll?t.querySelectorAll("image"):[];for(let i of n)try{let l="http://www.w3.org/1999/xlink",c=i.getAttribute("href")||i.getAttributeNS?.(l,"href");if(Dt(c)){let a=await Ft(c);i.setAttribute("href",a),i.removeAttributeNS?.(l,"href")}}catch{}let o=t.querySelectorAll?t.querySelectorAll("[style*='blob:']"):[];for(let i of o)try{let l=i.getAttribute("style");if(l&&l.includes("blob:")){let c=await He(l);i.setAttribute("style",c)}}catch{}let s=t.querySelectorAll?t.querySelectorAll("style"):[];for(let i of s)try{let l=i.textContent||"";l.includes("blob:")&&(i.textContent=await He(l))}catch{}let r=["poster"];for(let i of r){let l=t.querySelectorAll?t.querySelectorAll(`[${i}^='blob:']`):[];for(let c of l)try{let a=c.getAttribute(i);Dt(a)&&c.setAttribute(i,await Ft(a))}catch{}}}async function $t(t,e,n){if(!t)throw new Error("Invalid node");let o=new Set,s=null,r=null;if(t.nodeType===Node.ELEMENT_NODE){let a=(t.localName||t.tagName||"").toLowerCase();if(t.id==="snapdom-sandbox"||t.hasAttribute("data-snapdom-sandbox")||Ot.has(a))return null}if(t.nodeType===Node.TEXT_NODE||t.nodeType!==Node.ELEMENT_NODE)return t.cloneNode(!0);if(t.getAttribute("data-capture")==="exclude"){if(n.excludeMode==="hide"){let a=document.createElement("div"),u=t.getBoundingClientRect();return a.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,a}else if(n.excludeMode==="remove")return null}if(n.exclude&&Array.isArray(n.exclude))for(let a of n.exclude)try{if(t.matches?.(a)){if(n.excludeMode==="hide"){let u=document.createElement("div"),m=t.getBoundingClientRect();return u.style.cssText=`display:inline-block;width:${m.width}px;height:${m.height}px;visibility:hidden;`,u}else if(n.excludeMode==="remove")return null}}catch(u){console.warn(`Invalid selector in exclude option: ${a}`,u)}if(typeof n.filter=="function")try{if(!n.filter(t)){if(n.filterMode==="hide"){let a=document.createElement("div"),u=t.getBoundingClientRect();return a.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,a}else if(n.filterMode==="remove")return null}}catch(a){console.warn("Error in filter function:",a)}if(t.tagName==="IFRAME"){let a=!1;try{a=!!(t.contentDocument||t.contentWindow?.document)}catch{a=!1}if(a)try{return await Qe(t,e,n)}catch(u){console.warn("[SnapDOM] iframe rasterization failed, fallback:",u)}if(n.placeholders){let u=document.createElement("div");return u.style.cssText=`width:${t.offsetWidth}px;height:${t.offsetHeight}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;`,Z(t,u,e,n),u}else{let u=t.getBoundingClientRect(),m=document.createElement("div");return m.style.cssText=`display:inline-block;width:${u.width}px;height:${u.height}px;visibility:hidden;`,Z(t,m,e,n),m}}if(t.getAttribute("data-capture")==="placeholder"){let a=t.cloneNode(!1);e.nodeMap.set(a,t),Z(t,a,e,n);let u=document.createElement("div");return u.textContent=t.getAttribute("data-placeholder-text")||"",u.style.cssText="color:#666;font-size:12px;text-align:center;line-height:1.4;padding:0.5em;box-sizing:border-box;",a.appendChild(u),a}if(t.tagName==="CANVAS"){let a="";try{let m=t.getContext("2d",{willReadFrequently:!0});try{m&&m.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),a=t.toDataURL("image/png"),!a||a==="data:,"){try{m&&m.getImageData(0,0,1,1)}catch{}if(await new Promise(p=>requestAnimationFrame(p)),a=t.toDataURL("image/png"),!a||a==="data:,"){let p=document.createElement("canvas");p.width=t.width,p.height=t.height;let h=p.getContext("2d");h&&(h.drawImage(t,0,0),a=p.toDataURL("image/png"))}}}catch{}let u=document.createElement("img");try{u.decoding="sync",u.loading="eager"}catch{}a&&(u.src=a),u.width=t.width,u.height=t.height;try{let m=getComputedStyle(t);m.width&&(u.style.width=m.width),m.height&&(u.style.height=m.height)}catch{}return e.nodeMap.set(u,t),Z(t,u,e,n),u}let i;try{if(i=t.cloneNode(!1),De(t,i),e.nodeMap.set(i,t),t.tagName==="IMG"){Xe(t,i);try{let a=t.getBoundingClientRect(),u=Math.round(a.width||0),m=Math.round(a.height||0);if(!u||!m){let p=window.getComputedStyle(t),h=parseFloat(p.width)||0,y=parseFloat(p.height)||0,f=parseInt(t.getAttribute("width")||"",10)||0,d=parseInt(t.getAttribute("height")||"",10)||0,g=t.width||t.naturalWidth||0,b=t.height||t.naturalHeight||0;u=Math.round(u||h||f||g||0),m=Math.round(m||y||d||b||0)}u&&(i.dataset.snapdomWidth=String(u)),m&&(i.dataset.snapdomHeight=String(m))}catch{}try{let a=t.getAttribute("style")||"",u=window.getComputedStyle(t),m=d=>{let g=a.match(new RegExp(`${d}\\s*:\\s*([^;]+)`,"i")),b=g?g[1].trim():u.getPropertyValue(d);return/%|auto/i.test(String(b||""))},p=parseInt(i.dataset.snapdomWidth||"0",10),h=parseInt(i.dataset.snapdomHeight||"0",10),y=m("width")||!p,f=m("height")||!h;y&&p&&(i.style.width=`${p}px`),f&&h&&(i.style.height=`${h}px`),p&&(i.style.minWidth=`${p}px`),h&&(i.style.minHeight=`${h}px`)}catch{}}}catch(a){throw console.error("[Snapdom] Failed to clone node:",t,a),a}if(t instanceof HTMLTextAreaElement){let a=t.getBoundingClientRect();i.style.width=`${a.width}px`,i.style.height=`${a.height}px`}if(t instanceof HTMLInputElement&&(i.value=t.value,i.setAttribute("value",t.value),t.checked!==void 0&&(i.checked=t.checked,t.checked&&i.setAttribute("checked",""),t.indeterminate&&(i.indeterminate=t.indeterminate))),t instanceof HTMLSelectElement&&(s=t.value),t instanceof HTMLTextAreaElement&&(r=t.value),Z(t,i,e,n),t.shadowRoot){let d=function(b,x){if(b.nodeType===Node.ELEMENT_NODE&&b.tagName==="STYLE")return x(null);$t(b,e,n).then(w=>{x(w||null)}).catch(()=>{x(null)})};try{let b=t.shadowRoot.querySelectorAll("slot");for(let x of b){let w=[];try{w=x.assignedNodes?.({flatten:!0})||x.assignedNodes?.()||[]}catch{w=x.assignedNodes?.()||[]}for(let k of w)o.add(k)}}catch{}let a=ze(e),u=`[data-sd="${a}"]`;try{i.setAttribute("data-sd",a)}catch{}let m=je(t.shadowRoot),p=qe(m,u),h=Ye(m),y=Ke(t,h,u);Ve(i,y+p,a);let f=document.createDocumentFragment(),g=await Ht(Array.from(t.shadowRoot.childNodes),d,n.fast);f.append(...g.filter(b=>!!b)),i.appendChild(f)}if(t.tagName==="SLOT"){let p=function(y,f){$t(y,e,n).then(d=>{d&&Ge(d),f(d||null)}).catch(()=>{f(null)})},a=t.assignedNodes?.({flatten:!0})||[],u=a.length>0?a:Array.from(t.childNodes),m=document.createDocumentFragment(),h=await Ht(Array.from(u),p,n.fast);return m.append(...h.filter(y=>!!y)),m}function l(a,u){if(o.has(a))return u(null);$t(a,e,n).then(m=>{u(m||null)}).catch(()=>{u(null)})}let c=await Ht(Array.from(t.childNodes),l,n.fast);if(i.append(...c.filter(a=>!!a)),s!==null&&i instanceof HTMLSelectElement){i.value=s;for(let a of i.options)a.value===s?a.setAttribute("selected",""):a.removeAttribute("selected")}return r!==null&&i instanceof HTMLTextAreaElement&&(i.textContent=r),i}Y();At();H();var Bo=[/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],wt=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__||{}),he=[];function tn(t){let e=Array.isArray(t)?t:[t];for(let n of e)n instanceof RegExp?he.push(n):typeof n=="string"?he.push(new RegExp(n,"i")):console.warn("[snapdom] Ignored invalid iconFont value:",n)}function q(t){let e=typeof t=="string"?t:"",n=[...Bo,...he];for(let o of n)if(o instanceof RegExp&&o.test(e))return!0;return!!(/icon/i.test(e)||/glyph/i.test(e)||/symbols/i.test(e)||/feather/i.test(e)||/fontawesome/i.test(e))}function Do(t=""){let e=String(t).toLowerCase();return/\bmaterial\s*icons\b/.test(e)||/\bmaterial\s*symbols\b/.test(e)}var Ze=new Map;function Ho(t=""){let e=Object.create(null),n=String(t||""),o=/['"]?\s*([A-Za-z]{3,4})\s*['"]?\s*([+-]?\d+(?:\.\d+)?)\s*/g,s;for(;s=o.exec(n);)e[s[1].toUpperCase()]=Number(s[2]);return e}async function qo(t,e,n){let o=String(t||""),s=o.toLowerCase(),r=String(e||"").toLowerCase();if(/\bmaterial\s*icons\b/.test(s)&&!/\bsymbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};if(!/\bmaterial\s*symbols\b/.test(s))return{familyForMeasure:o,familyForCanvas:o};let l=n&&(n.FILL??n.fill),c="outlined";/\brounded\b/.test(r)||/\bround\b/.test(r)?c="rounded":/\bsharp\b/.test(r)?c="sharp":/\boutlined\b/.test(r)&&(c="outlined");let a=l===1,u=null;if(a&&(c==="outlined"&&wt.materialIconsFilled?u={url:wt.materialIconsFilled,alias:"snapdom-mi-filled"}:c==="rounded"&&wt.materialIconsRound?u={url:wt.materialIconsRound,alias:"snapdom-mi-round"}:c==="sharp"&&wt.materialIconsSharp&&(u={url:wt.materialIconsSharp,alias:"snapdom-mi-sharp"})),!u)return{familyForMeasure:o,familyForCanvas:o};if(!Ze.has(u.alias))try{let p=new FontFace(u.alias,`url(${u.url})`,{style:"normal",weight:"400"});document.fonts.add(p),await p.load(),Ze.set(u.alias,!0)}catch{return{familyForMeasure:o,familyForCanvas:o}}let m=`"${u.alias}"`;return{familyForMeasure:m,familyForCanvas:m}}async function zo(t="Material Icons",e=24){try{await Promise.all([document.fonts.load(`400 ${e}px "${String(t).replace(/["']/g,"")}"`),document.fonts.ready])}catch{}}function jo(t){let e=t.getPropertyValue("-webkit-text-fill-color")?.trim()||"",n=/^transparent$/i.test(e)||/rgba?\(\s*0\s*,\s*0\s*,\s*0\s*,\s*0\s*\)/i.test(e);if(e&&!n&&e.toLowerCase()!=="currentcolor")return e;let o=t.color?.trim();return o&&o!=="inherit"?o:"#000"}async function Vo(t,{family:e="Material Icons",weight:n="normal",fontSize:o=32,color:s="#000",variation:r="",className:i=""}={}){let l=String(e||"").replace(/^['"]+|['"]+$/g,""),c=window.devicePixelRatio||1,a=Ho(r),{familyForMeasure:u,familyForCanvas:m}=await qo(l,i,a);await zo(m.replace(/^["']+|["']+$/g,""),o);let p=document.createElement("span");p.textContent=t,p.style.position="absolute",p.style.visibility="hidden",p.style.left="-99999px",p.style.whiteSpace="nowrap",p.style.fontFamily=u,p.style.fontWeight=String(n||"normal"),p.style.fontSize=`${o}px`,p.style.lineHeight="1",p.style.margin="0",p.style.padding="0",p.style.fontFeatureSettings="'liga' 1",p.style.fontVariantLigatures="normal",p.style.color=s,document.body.appendChild(p);let h=p.getBoundingClientRect(),y=Math.max(1,Math.ceil(h.width)),f=Math.max(1,Math.ceil(h.height));document.body.removeChild(p);let d=document.createElement("canvas");d.width=y*c,d.height=f*c;let g=d.getContext("2d");g.scale(c,c),g.font=`${n?`${n} `:""}${o}px ${m}`,g.textAlign="left",g.textBaseline="top",g.fillStyle=s;try{g.fontKerning="normal"}catch{}return g.fillText(t,0,0),{dataUrl:d.toDataURL(),width:y,height:f}}async function en(t,e){if(!(t instanceof Element))return 0;let n='.material-icons, [class*="material-symbols"]',o=Array.from(t.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim());if(o.length===0)return 0;let s=e instanceof Element?Array.from(e.querySelectorAll(n)).filter(i=>i&&i.textContent&&i.textContent.trim()):[],r=0;for(let i=0;i<o.length;i++){let l=o[i],c=s[i]||null;try{let a=getComputedStyle(c||l),u=a.fontFamily||"Material Icons";if(!Do(u))continue;let m=(c||l).textContent.trim();if(!m)continue;let p=parseInt(a.fontSize,10)||24,h=a.fontWeight&&a.fontWeight!=="normal"?a.fontWeight:"normal",y=jo(a),f=a.fontVariationSettings&&a.fontVariationSettings!=="normal"?a.fontVariationSettings:"",d=(c||l).className||"",{dataUrl:g,width:b,height:x}=await Vo(m,{family:u,weight:h,fontSize:p,color:y,variation:f,className:d});l.textContent="";let w=l.ownerDocument.createElement("img");w.src=g,w.alt=m,w.style.height=`${p}px`,w.style.width=`${Math.max(1,Math.round(b/x*p))}px`,w.style.objectFit="contain",w.style.verticalAlign=getComputedStyle(l).verticalAlign||"baseline",l.appendChild(w),r++}catch{}}return r}at();async function rn(t,e,n,o=32,s="#000"){e=e.replace(/^['"]+|['"]+$/g,"");let r=window.devicePixelRatio||1;try{await document.fonts.ready}catch{}let i=document.createElement("span");i.textContent=t,i.style.position="absolute",i.style.visibility="hidden",i.style.fontFamily=`"${e}"`,i.style.fontWeight=n||"normal",i.style.fontSize=`${o}px`,i.style.lineHeight="1",i.style.whiteSpace="nowrap",i.style.padding="0",i.style.margin="0",document.body.appendChild(i);let l=i.getBoundingClientRect(),c=Math.ceil(l.width),a=Math.ceil(l.height);document.body.removeChild(i);let u=document.createElement("canvas");u.width=Math.max(1,c*r),u.height=Math.max(1,a*r);let m=u.getContext("2d");return m.scale(r,r),m.font=n?`${n} ${o}px "${e}"`:`${o}px "${e}"`,m.textAlign="left",m.textBaseline="top",m.fillStyle=s,m.fillText(t,0,0),{dataUrl:u.toDataURL(),width:c,height:a}}var Xo=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","emoji","math","fangsong","ui-serif","ui-sans-serif","ui-monospace","ui-rounded"]);function Vt(t){if(!t)return"";for(let e of t.split(",")){let n=e.trim().replace(/^['"]+|['"]+$/g,"");if(n&&!Xo.has(n.toLowerCase()))return n}return""}function qt(t){let e=String(t??"400").trim().toLowerCase();if(e==="normal")return 400;if(e==="bold")return 700;let n=parseInt(e,10);return Number.isFinite(n)?Math.min(900,Math.max(100,n)):400}function zt(t){let e=String(t??"normal").trim().toLowerCase();return e.startsWith("italic")?"italic":e.startsWith("oblique")?"oblique":"normal"}function Yo(t){let e=String(t??"100%").match(/(\d+(?:\.\d+)?)\s*%/);return e?Math.max(50,Math.min(200,parseFloat(e[1]))):100}function Ko(t){let e=String(t||"400").trim(),n=e.match(/^(\d{2,3})\s+(\d{2,3})$/);if(n){let s=qt(n[1]),r=qt(n[2]);return{min:Math.min(s,r),max:Math.max(s,r)}}let o=qt(e);return{min:o,max:o}}function Go(t){let e=String(t||"normal").trim().toLowerCase();return e==="italic"?{kind:"italic"}:e.startsWith("oblique")?{kind:"oblique"}:{kind:"normal"}}function Qo(t){let e=String(t||"100%").trim(),n=e.match(/(\d+(?:\.\d+)?)\s*%\s+(\d+(?:\.\d+)?)\s*%/);if(n){let r=parseFloat(n[1]),i=parseFloat(n[2]);return{min:Math.min(r,i),max:Math.max(r,i)}}let o=e.match(/(\d+(?:\.\d+)?)\s*%/),s=o?parseFloat(o[1]):100;return{min:s,max:s}}function Jo(t,e){if(!t)return!1;try{let n=new URL(t,location.href);if(n.origin===location.origin)return!0;let s=n.host.toLowerCase();if(["fonts.googleapis.com","fonts.gstatic.com","use.typekit.net","p.typekit.net","kit.fontawesome.com","use.fontawesome.com"].some(l=>s.endsWith(l)))return!0;let i=(n.pathname+n.search).toLowerCase();if(/\bfont(s)?\b/.test(i)||/\.woff2?(\b|$)/.test(i))return!0;for(let l of e){let c=l.toLowerCase().replace(/\s+/g,"+"),a=l.toLowerCase().replace(/\s+/g,"-");if(i.includes(c)||i.includes(a))return!0}return!1}catch{return!1}}function Zo(t){let e=new Set;for(let n of t||[]){let o=String(n).split("__")[0]?.trim();o&&e.add(o)}return e}function nn(t,e){return t&&t.replace(/url\(\s*(['"]?)([^)'"]+)\1\s*\)/g,(n,o,s)=>{let r=(s||"").trim();if(!r||/^data:|^blob:|^https?:|^file:|^about:/i.test(r))return n;let i=r;try{i=new URL(r,e||location.href).href}catch{}return`url("${i}")`})}var ge=/@import\s+(?:url\(\s*(['"]?)([^)"']+)\1\s*\)|(['"])([^"']+)\3)([^;]*);/g,jt=4;async function tr(t,e,n){if(!t)return t;let o=new Set;function s(l,c){try{return new URL(l,c||location.href).href}catch{return l}}async function r(l,c,a=0){if(a>jt)return console.warn(`[snapDOM] @import depth exceeded (${jt}) at ${c}`),l;let u="",m=0,p;for(;p=ge.exec(l);){u+=l.slice(m,p.index),m=ge.lastIndex;let h=(p[2]||p[4]||"").trim(),y=s(h,c);if(o.has(y)){console.warn(`[snapDOM] Skipping circular @import: ${y}`);continue}o.add(y);let f="";try{let d=await P(y,{as:"text",useProxy:n,silent:!0});d.ok&&typeof d.data=="string"&&(f=d.data)}catch{}f?(f=nn(f,y),f=await r(f,y,a+1),u+=`

Callers 1

SeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected