Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@applitools/dom-capture

Package Overview
Dependencies
Maintainers
22
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@applitools/dom-capture - npm Package Compare versions

Comparing version 7.3.0 to 8.0.0

dist/captureDomPollForIE.js

5

CHANGELOG.md

@@ -7,2 +7,7 @@

## 8.0.0 - 2020/10/6
- move shared logic to `dom-shared`
- Breaking change for Node.js consumers: export `getCaptureDom`, `getCaptureDomPoll`, `getPollResult`, `getCaptureDomForIE`, `getCaptureDomPollForIE`, `getPollResultForIE`
## 7.3.0 - 2020/9/14

@@ -9,0 +14,0 @@

4

dist/captureDom.js

@@ -1,7 +0,7 @@

/* @applitools/dom-capture@7.3.0 */
/* @applitools/dom-capture@8.0.0 */
function __captureDom() {
var captureDom=function(){"use strict";var e={styleProps:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],rectProps:["width","height","top","left"],ignoredTagNames:["HEAD","SCRIPT"]};const t=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var o=function(e){const o=e?e.match(t):void 0;return o?o[1]:o};var n=async function({bgImages:e,timeout:t=5e3,Image:o=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const n=new o;n.onload=()=>t({url:e,width:n.naturalWidth,height:n.naturalHeight}),n.onerror=()=>t(),n.src=e}),(n=t,new Promise(e=>{setTimeout(e,n)}))]);var n}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function r(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var s=function e(t){if(!t.ownerDocument)return"";let o="",n=t,s=t.ownerDocument,a=s.defaultView.frameElement;for(;n!==s;)o=`${n.tagName}[${r(n)}]/${o}`,n=n.parentNode;return a&&(o=`${e(a)},${o}`),o.replace(/\/$/,"")};var a=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)};var c=function(e,t){return new URL(e,t).href};var i=function({parseCss:e,CSSImportRule:t,absolutizeUrl:o,getCssFromCache:n,unfetchedToken:r}){return function s(a,c){let i,u="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=o(e.href,c),a=n(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:o}=s(a,t);o&&(i=new Set(o)),u=`${e}${u}`}else i=new Set([t]),u=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,d;return u=`${u}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:u,unfetchedResources:i}}};var u=function(e){var t=document.implementation.createHTMLDocument(""),o=t.createElement("style");return o.textContent=e,t.body.appendChild(o),o.sheet};var l=function(e,{fetchTimeLimit:t}={}){return async function(o){const n=new AbortController,r=[e(o,{cache:"force-cache",signal:n.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+o+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+o+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>n.abort())),Promise.race(r)}},d=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},f=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var m=function(e){return e&&e.startsWith("data:")};var h=function({getCssFromCache:e,absolutizeUrl:t}){return function(o,n){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(o))r=Array.from(o.childNodes).map(e=>e.nodeValue).join(""),s=n;else if(f(o)){const c=d(o);m(c)?(s=n,r=c.match(/,(.+)/)[1]):(s=t(c,n),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var g=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:o}){return function(n,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(n,r);let i,u="";if(a){const{bundledCss:e,unfetchedResources:o}=t(a,s);u+=e,i=new Set(o)}else c&&(u+=`${o}${s}${o}`,i=new Set([s]));return{bundledCss:u,unfetchedResources:i}}};var p={NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11}};const{NODE_TYPES:y}=p;var w=function(e){return async function(t=document){const o={},n=Date.now(),r=[];return function t(o,n,r,s){function i(t){switch(s.push(async function(t,o,n){let r,s;f(t)&&(s=c(d(t),o),r=await e(s),void 0!==r&&(n[s]=r));r&&await async function t(o,n,r){try{const s=u(o),a=[];for(const o of Array.from(s.cssRules))o instanceof CSSImportRule&&a.push((async()=>{const s=c(o.href,n),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+n,e)}}(r,s,n)}(t,n,r)),t.nodeType){case y.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?m(t):l(t)}}async function l(e){Array.prototype.map.call(e.childNodes,i)}async function m(e){if(l(e),e.contentDocument)try{const o=a(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,o,r,s)}catch(e){console.log(e)}}i(o.documentElement)}(t,t.location.href,o,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-n),function(e){return o[e]}}};const{NODE_TYPES:C}=p;return async function({styleProps:t,rectProps:r,ignoredTagNames:d}=e,f=document,m=!1,p=3e4){const y={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function N(e){e.startTime=Date.now()}function b(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const T=[];N(y.total);const v=new Set,E=[];N(y.prefetchCss);const S=w(l(fetch,{fetchTimeLimit:p})),$=await S(f);b(y.prefetchCss);const D=i({parseCss:u,CSSImportRule:CSSImportRule,getCssFromCache:$,absolutizeUrl:c,unfetchedToken:"#####"}),P=h({getCssFromCache:$,absolutizeUrl:c}),R=g({extractCssFromNode:P,getBundledCssFromCssText:D,unfetchedToken:"#####"});N(y.doCaptureDoc);const k=function e(c,i=c.location&&c.location.href){const u=new Set;let l="";const f=m(c.documentElement||c);return f.css=l,T.push(n({bgImages:u}).then(e=>f.images=e)),f;function m(e){const{bundledCss:t,unfetchedResources:o}=R(e,i);if(l+=t,o)for(const e of o)v.add(e);switch(e.nodeType){case C.TEXT:return function(e){return{tagName:"#text",text:e.textContent}}(e);case C.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?g(e):h(e);case C.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,m).filter(Boolean)};default:return null}}function h(n){const s=Array.prototype.map.call(n.childNodes,m).filter(Boolean),a=n.shadowRoot&&e(n.shadowRoot,i),c=n.tagName.toUpperCase();if(d.indexOf(c)>-1)return null;const l=window.getComputedStyle(n),f=n.getBoundingClientRect(),h={};for(const e of t)h[e]=l.getPropertyValue(e);h["border-width"]||(h["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const g={};for(const e of r)g[e]=f[e];const p=Array.from(n.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),y=o(l.getPropertyValue("background-image"));y&&u.add(y);const w={tagName:c,style:x(h),rect:x(g),attributes:x(p),childNodes:s};return a&&(w.shadowRoot=a),w}function g(t){const o=h(t);let n;try{n=t.contentDocument}catch(e){return r(),o}try{n?o.childNodes=[e(n,a(t)?t.baseURI:n.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return o;function r(){const e=s(t);E.push(e),o.childNodes=[`@@@@@${e}@@@@@`]}}}(f);b(y.doCaptureDoc),N(y.waitForImages),await Promise.all(T),b(y.waitForImages),k.version="1.3.0",k.scriptVersion="7.3.0";const U=E.length?E.join("\n")+"\n":"",A=v.size?Array.from(v).join("\n")+"\n":"",F=JSON.stringify({separator:"-----",cssStartToken:"#####",cssEndToken:"#####",iframeStartToken:'"@@@@@',iframeEndToken:'@@@@@"'});b(y.total);const I=`${F}\n${A}-----\n${U}-----\n${JSON.stringify(k)}${m?"\n-----\n"+JSON.stringify(y):""}`;return console.log("[captureFrame]",JSON.stringify(y)),I;function x(e){return Object.keys(e).length?e:void 0}}}();
var captureDom=function(){"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const r=[];let o=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),o+c>n?(r.push(s),o=c):o+=c}return r};const n="WIP",r="SUCCESS",o="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const u=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:o,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:r,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(u.status===r||u.status===s||u.status===o&&u.done)&&(e[a]=null),u};var c=function(e,t){return new URL(e,t).href};var u=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var i={chunkify:t,pollify:function(e,t,n){return r=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,r)}},poll:a,absolutizeUrl:c,isInlineFrame:u,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}};const l=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var f=function(e){const t=e?e.match(l):void 0;return t?t[1]:t};var d=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const r=new n;r.onload=()=>t({url:e,width:r.naturalWidth,height:r.naturalHeight}),r.onerror=()=>t(),r.src=e}),(r=t,new Promise(e=>{setTimeout(e,r)}))]);var r}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function m(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var h=function e(t){if(!t.ownerDocument)return"";let n="",r=t,o=t.ownerDocument,s=o.defaultView.frameElement;for(;r!==o;)n=`${r.tagName}[${m(r)}]/${n}`,r=r.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var g=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:r,unfetchedToken:o}){return function s(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=r(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${e}${i}`}else u=new Set([t]),i=`\n${o}${t}${o}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return i=`${i}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}};var p=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var y=function(e,{fetchTimeLimit:t}={}){return async function(n){const r=new AbortController,o=[e(n,{cache:"force-cache",signal:r.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||o.push(new Promise(e=>setTimeout(e,t)).then(()=>r.abort())),Promise.race(o)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},w=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var E=function(e){return e&&e.startsWith("data:")};var T=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,r){let o,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))o=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=r;else if(w(n)){const c=C(n);E(c)?(s=r,o=c.match(/,(.+)/)[1]):(s=t(c,r),o=e(s)),a=void 0===o}return{cssText:o,styleBaseUrl:s,isUnfetched:a}}};var N=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(r,o){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(r,o);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},b={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const{absolutizeUrl:S,isInlineFrame:v}=i,{NODE_TYPES:A}=b;var D=function(e){return async function(t=document){const n={},r=Date.now(),o=[];return function t(n,r,o,s){function a(t){switch(s.push(async function(t,n,r){let o,s;w(t)&&(s=S(C(t),n),o=await e(s),void 0!==o&&(r[s]=o));o&&await async function t(n,r,o){try{const s=p(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,r),a=await e(s);o[s]=a,void 0!==a&&await t(a,s,o)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+r,e)}}(o,s,r)}(t,r,o)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?u(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function u(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,o,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,o),await Promise.all(o),console.log("[prefetchAllCss]",Date.now()-r),function(e){return n[e]}}};const{absolutizeUrl:R,isInlineFrame:P}=i,{NODE_TYPES:$,DEFAULT_STYLE_PROPS:U,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=b;return async function({doc:e=document,styleProps:t=U,rectProps:n=_,ignoredTagNames:r=F,addStats:o=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(o=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function u(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const i=[];c(a.total);const l=new Set,m=[],C="@@@@@",w="#####",E="-----";c(a.prefetchCss);const b=D(y(fetch,{fetchTimeLimit:s})),S=await b(e);u(a.prefetchCss);const v=g({parseCss:p,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:R,unfetchedToken:w}),A=T({getCssFromCache:S,absolutizeUrl:R}),k=N({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:w});c(a.doCaptureDoc);const I=Y(e);u(a.doCaptureDoc),c(a.waitForImages),await Promise.all(i),u(a.waitForImages),I.version="1.3.0",I.scriptVersion="8.0.0";const L=m.length?m.join("\n")+"\n":"",O=l.size?Array.from(l).join("\n")+"\n":"",x=JSON.stringify({separator:E,cssStartToken:w,cssEndToken:w,iframeStartToken:'"'+C,iframeEndToken:C+'"'});function M(){return o?`\n${E}\n${JSON.stringify(a)}`:""}u(a.total);const B=`${x}\n${O}${E}\n${L}${E}\n${JSON.stringify(I)}${M()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function z(e){return{tagName:"#text",text:e.textContent}}function Y(e,o=e.location&&e.location.href){const s=new Set;let a="";const c=u(e.documentElement||e);return c.css=a,i.push(d({bgImages:s}).then(e=>c.images=e)),c;function u(e){const{bundledCss:t,unfetchedResources:n}=k(e,o);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case $.TEXT:return z(e);case $.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=g(e);let n;try{n=e.contentDocument}catch(e){return r(),t}try{n?t.childNodes=[Y(n,P(e)?e.baseURI:n.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return t;function r(){const n=h(e);m.push(n),t.childNodes=[`${C}${n}${C}`]}}(e):g(e);case $.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,u).filter(Boolean)};default:return null}}function g(e){const a=Array.prototype.map.call(e.childNodes,u).filter(Boolean),c=e.shadowRoot&&Y(e.shadowRoot,o),i=e.tagName.toUpperCase();if(r.indexOf(i)>-1)return null;const l=window.getComputedStyle(e),d=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=d[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=f(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:i,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}}}();
return captureDom.apply(this, arguments);
}

@@ -1,7 +0,7 @@

/* @applitools/dom-capture@7.3.0 */
/* @applitools/dom-capture@8.0.0 */
function __captureDomAndPoll() {
var captureDomAndPoll=function(){"use strict";var e={styleProps:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],rectProps:["width","height","top","left"],ignoredTagNames:["HEAD","SCRIPT"]};const t=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var n=function(e){const n=e?e.match(t):void 0;return n?n[1]:n};var o=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e}),(o=t,new Promise(e=>{setTimeout(e,o)}))]);var o}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function r(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var s=function e(t){if(!t.ownerDocument)return"";let n="",o=t,s=t.ownerDocument,a=s.defaultView.frameElement;for(;o!==s;)n=`${o.tagName}[${r(o)}]/${n}`,o=o.parentNode;return a&&(n=`${e(a)},${n}`),n.replace(/\/$/,"")};var a=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)};var c=function(e,t){return new URL(e,t).href};var i=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let i,u="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(i=new Set(n)),u=`${e}${u}`}else i=new Set([t]),u=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,d;return u=`${u}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:u,unfetchedResources:i}}};var u=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var l=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>o.abort())),Promise.race(r)}},d=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},f=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var m=function(e){return e&&e.startsWith("data:")};var h=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=o;else if(f(n)){const c=d(n);m(c)?(s=o,r=c.match(/,(.+)/)[1]):(s=t(c,o),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var g=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let i,u="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);u+=e,i=new Set(n)}else c&&(u+=`${n}${s}${n}`,i=new Set([s]));return{bundledCss:u,unfetchedResources:i}}};var p={NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11}};const{NODE_TYPES:w}=p;var y=function(e){return async function(t=document){const n={},o=Date.now(),r=[];return function t(n,o,r,s){function i(t){switch(s.push(async function(t,n,o){let r,s;f(t)&&(s=c(d(t),n),r=await e(s),void 0!==r&&(o[s]=r));r&&await async function t(n,o,r){try{const s=u(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=c(n.href,o),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+o,e)}}(r,s,o)}(t,o,r)),t.nodeType){case w.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?m(t):l(t)}}async function l(e){Array.prototype.map.call(e.childNodes,i)}async function m(e){if(l(e),e.contentDocument)try{const n=a(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}i(n.documentElement)}(t,t.location.href,n,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-o),function(e){return n[e]}}};const{NODE_TYPES:C}=p;var _=async function({styleProps:t,rectProps:r,ignoredTagNames:d}=e,f=document,m=!1,p=3e4){const w={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function _(e){e.startTime=Date.now()}function S(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const E=[];_(w.total);const T=new Set,N=[];_(w.prefetchCss);const b=y(l(fetch,{fetchTimeLimit:p})),P=await b(f);S(w.prefetchCss);const v=i({parseCss:u,CSSImportRule:CSSImportRule,getCssFromCache:P,absolutizeUrl:c,unfetchedToken:"#####"}),O=h({getCssFromCache:P,absolutizeUrl:c}),R=g({extractCssFromNode:O,getBundledCssFromCssText:v,unfetchedToken:"#####"});_(w.doCaptureDoc);const D=function e(c,i=c.location&&c.location.href){const u=new Set;let l="";const f=m(c.documentElement||c);return f.css=l,E.push(o({bgImages:u}).then(e=>f.images=e)),f;function m(e){const{bundledCss:t,unfetchedResources:n}=R(e,i);if(l+=t,n)for(const e of n)T.add(e);switch(e.nodeType){case C.TEXT:return function(e){return{tagName:"#text",text:e.textContent}}(e);case C.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?g(e):h(e);case C.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,m).filter(Boolean)};default:return null}}function h(o){const s=Array.prototype.map.call(o.childNodes,m).filter(Boolean),a=o.shadowRoot&&e(o.shadowRoot,i),c=o.tagName.toUpperCase();if(d.indexOf(c)>-1)return null;const l=window.getComputedStyle(o),f=o.getBoundingClientRect(),h={};for(const e of t)h[e]=l.getPropertyValue(e);h["border-width"]||(h["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const g={};for(const e of r)g[e]=f[e];const p=Array.from(o.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),w=n(l.getPropertyValue("background-image"));w&&u.add(w);const y={tagName:c,style:k(h),rect:k(g),attributes:k(p),childNodes:s};return a&&(y.shadowRoot=a),y}function g(t){const n=h(t);let o;try{o=t.contentDocument}catch(e){return r(),n}try{o?n.childNodes=[e(o,a(t)?t.baseURI:o.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return n;function r(){const e=s(t);N.push(e),n.childNodes=[`@@@@@${e}@@@@@`]}}}(f);S(w.doCaptureDoc),_(w.waitForImages),await Promise.all(E),S(w.waitForImages),D.version="1.3.0",D.scriptVersion="7.3.0";const I=N.length?N.join("\n")+"\n":"",L=T.size?Array.from(T).join("\n")+"\n":"",A=JSON.stringify({separator:"-----",cssStartToken:"#####",cssEndToken:"#####",iframeStartToken:'"@@@@@',iframeEndToken:'@@@@@"'});S(w.total);const $=`${A}\n${L}-----\n${I}-----\n${JSON.stringify(D)}${m?"\n-----\n"+JSON.stringify(w):""}`;return console.log("[captureFrame]",JSON.stringify(w)),$;function k(e){return Object.keys(e).length?e:void 0}};const S="WIP",E="SUCCESS",T="SUCCESS_CHUNKED",N="ERROR";var b=function(e){const t=function(e,{maxChunkSize:t=0}={}){if(e){if(e.value){if(t&&(e.stringified||(e.stringified=JSON.stringify(e.value)),e.stringified.length>t)){const n=e.nextChunkIndex||0;return e.nextChunkIndex=n+t,{status:T,value:e.stringified.substring(n,e.nextChunkIndex),done:e.nextChunkIndex>=e.stringified.length}}return{status:E,value:e.value}}return e.error?{status:N,error:e.error}:{status:S}}return{status:N,error:"unexpected poll request received - cannot find state of current operation"}}(window.__EYES__APPLITOOLS__?window.__EYES__APPLITOOLS__.captureDomResult:null,e);return(t.status===E||t.status===N||t.status===T&&t.done)&&(window.__EYES__APPLITOOLS__.captureDomResult=null),JSON.stringify(t)};return function(...e){return window.__EYES__APPLITOOLS__||(window.__EYES__APPLITOOLS__={}),window.__EYES__APPLITOOLS__.captureDomResult||(window.__EYES__APPLITOOLS__.captureDomResult={},_(...e).then(e=>window.__EYES__APPLITOOLS__.captureDomResult.value=e).catch(e=>window.__EYES__APPLITOOLS__.captureDomResult.error=e.message)),b(e[4])}}();
var captureDomAndPoll=function(){"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const n="WIP",o="SUCCESS",r="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const i=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:r,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:o,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(i.status===o||i.status===s||i.status===r&&i.done)&&(e[a]=null),i};var c=function(e,t){return new URL(e,t).href};var i=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var u={chunkify:t,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,o)}},poll:a,absolutizeUrl:c,isInlineFrame:i,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}},l={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const f=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var d=function(e){const t=e?e.match(f):void 0;return t?t[1]:t};var m=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e}),(o=t,new Promise(e=>{setTimeout(e,o)}))]);var o}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function h(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var g=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r;)n=`${o.tagName}[${h(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var p=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let i,u="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(i=new Set(n)),u=`${e}${u}`}else i=new Set([t]),u=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return u=`${u}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:u,unfetchedResources:i}}};var y=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var w=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>o.abort())),Promise.race(r)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},E=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var T=function(e){return e&&e.startsWith("data:")};var N=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=o;else if(E(n)){const c=C(n);T(c)?(s=o,r=c.match(/,(.+)/)[1]):(s=t(c,o),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var b=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let i,u="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);u+=e,i=new Set(n)}else c&&(u+=`${n}${s}${n}`,i=new Set([s]));return{bundledCss:u,unfetchedResources:i}}};const{absolutizeUrl:S,isInlineFrame:v}=u,{NODE_TYPES:A}=l;var D=function(e){return async function(t=document){const n={},o=Date.now(),r=[];return function t(n,o,r,s){function a(t){switch(s.push(async function(t,n,o){let r,s;E(t)&&(s=S(C(t),n),r=await e(s),void 0!==r&&(o[s]=r));r&&await async function t(n,o,r){try{const s=y(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,o),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+o,e)}}(r,s,o)}(t,o,r)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?i(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function i(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-o),function(e){return n[e]}}};const{absolutizeUrl:P,isInlineFrame:R}=u,{NODE_TYPES:U,DEFAULT_STYLE_PROPS:$,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=l;var k=async function({doc:e=document,styleProps:t=$,rectProps:n=_,ignoredTagNames:o=F,addStats:r=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(r=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function i(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const u=[];c(a.total);const l=new Set,f=[],h="@@@@@",C="#####",E="-----";c(a.prefetchCss);const T=D(w(fetch,{fetchTimeLimit:s})),S=await T(e);i(a.prefetchCss);const v=p({parseCss:y,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:P,unfetchedToken:C}),A=N({getCssFromCache:S,absolutizeUrl:P}),k=b({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:C});c(a.doCaptureDoc);const O=z(e);i(a.doCaptureDoc),c(a.waitForImages),await Promise.all(u),i(a.waitForImages),O.version="1.3.0",O.scriptVersion="8.0.0";const I=f.length?f.join("\n")+"\n":"",L=l.size?Array.from(l).join("\n")+"\n":"",M=JSON.stringify({separator:E,cssStartToken:C,cssEndToken:C,iframeStartToken:'"'+h,iframeEndToken:h+'"'});function x(){return r?`\n${E}\n${JSON.stringify(a)}`:""}i(a.total);const B=`${M}\n${L}${E}\n${I}${E}\n${JSON.stringify(O)}${x()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function Y(e){return{tagName:"#text",text:e.textContent}}function z(e,r=e.location&&e.location.href){const s=new Set;let a="";const c=i(e.documentElement||e);return c.css=a,u.push(m({bgImages:s}).then(e=>c.images=e)),c;function i(e){const{bundledCss:t,unfetchedResources:n}=k(e,r);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case U.TEXT:return Y(e);case U.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=p(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[z(n,R(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=g(e);f.push(n),t.childNodes=[`${h}${n}${h}`]}}(e):p(e);case U.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,i).filter(Boolean)};default:return null}}function p(e){const a=Array.prototype.map.call(e.childNodes,i).filter(Boolean),c=e.shadowRoot&&z(e.shadowRoot,r),u=e.tagName.toUpperCase();if(o.indexOf(u)>-1)return null;const l=window.getComputedStyle(e),f=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=f[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=d(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:u,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}};const{pollify:O}=u,{EYES_NAMESPACE:I,DOM_CAPTURE_KEY:L}=l;window[I]=window[I]||{};const M=O(k,window[I],L);return function(e){return JSON.stringify(M(e)(e))}}();
return captureDomAndPoll.apply(this, arguments);
}

@@ -1,2 +0,2 @@

/* @applitools/dom-capture@7.3.0 */
"use strict";var e={styleProps:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],rectProps:["width","height","top","left"],ignoredTagNames:["HEAD","SCRIPT"]};const t=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var o=function(e){const o=e?e.match(t):void 0;return o?o[1]:o};var n=async function({bgImages:e,timeout:t=5e3,Image:o=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const n=new o;n.onload=()=>t({url:e,width:n.naturalWidth,height:n.naturalHeight}),n.onerror=()=>t(),n.src=e}),(n=t,new Promise(e=>{setTimeout(e,n)}))]);var n}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function r(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var s=function e(t){if(!t.ownerDocument)return"";let o="",n=t,s=t.ownerDocument,a=s.defaultView.frameElement;for(;n!==s;)o=`${n.tagName}[${r(n)}]/${o}`,n=n.parentNode;return a&&(o=`${e(a)},${o}`),o.replace(/\/$/,"")};var a=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)};var c=function(e,t){return new URL(e,t).href};var i=function({parseCss:e,CSSImportRule:t,absolutizeUrl:o,getCssFromCache:n,unfetchedToken:r}){return function s(a,c){let i,u="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=o(e.href,c),a=n(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:o}=s(a,t);o&&(i=new Set(o)),u=`${e}${u}`}else i=new Set([t]),u=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,d;return u=`${u}${l=a,d=c,`\n/** ${d} **/\n${l}`}`,{bundledCss:u,unfetchedResources:i}}};var u=function(e){var t=document.implementation.createHTMLDocument(""),o=t.createElement("style");return o.textContent=e,t.body.appendChild(o),o.sheet};var l=function(e,{fetchTimeLimit:t}={}){return async function(o){const n=new AbortController,r=[e(o,{cache:"force-cache",signal:n.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+o+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+o+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>n.abort())),Promise.race(r)}},d=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},f=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var m=function(e){return e&&e.startsWith("data:")};var h=function({getCssFromCache:e,absolutizeUrl:t}){return function(o,n){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(o))r=Array.from(o.childNodes).map(e=>e.nodeValue).join(""),s=n;else if(f(o)){const c=d(o);m(c)?(s=n,r=c.match(/,(.+)/)[1]):(s=t(c,n),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var g=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:o}){return function(n,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(n,r);let i,u="";if(a){const{bundledCss:e,unfetchedResources:o}=t(a,s);u+=e,i=new Set(o)}else c&&(u+=`${o}${s}${o}`,i=new Set([s]));return{bundledCss:u,unfetchedResources:i}}};var p={NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11}};const{NODE_TYPES:y}=p;var w=function(e){return async function(t=document){const o={},n=Date.now(),r=[];return function t(o,n,r,s){function i(t){switch(s.push(async function(t,o,n){let r,s;f(t)&&(s=c(d(t),o),r=await e(s),void 0!==r&&(n[s]=r));r&&await async function t(o,n,r){try{const s=u(o),a=[];for(const o of Array.from(s.cssRules))o instanceof CSSImportRule&&a.push((async()=>{const s=c(o.href,n),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+n,e)}}(r,s,n)}(t,n,r)),t.nodeType){case y.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?m(t):l(t)}}async function l(e){Array.prototype.map.call(e.childNodes,i)}async function m(e){if(l(e),e.contentDocument)try{const o=a(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,o,r,s)}catch(e){console.log(e)}}i(o.documentElement)}(t,t.location.href,o,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-n),function(e){return o[e]}}};const{NODE_TYPES:C}=p;var N=async function({styleProps:t,rectProps:r,ignoredTagNames:d}=e,f=document,m=!1,p=3e4){const y={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function N(e){e.startTime=Date.now()}function b(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const T=[];N(y.total);const v=new Set,E=[];N(y.prefetchCss);const S=w(l(fetch,{fetchTimeLimit:p})),$=await S(f);b(y.prefetchCss);const D=i({parseCss:u,CSSImportRule:CSSImportRule,getCssFromCache:$,absolutizeUrl:c,unfetchedToken:"#####"}),P=h({getCssFromCache:$,absolutizeUrl:c}),R=g({extractCssFromNode:P,getBundledCssFromCssText:D,unfetchedToken:"#####"});N(y.doCaptureDoc);const k=function e(c,i=c.location&&c.location.href){const u=new Set;let l="";const f=m(c.documentElement||c);return f.css=l,T.push(n({bgImages:u}).then(e=>f.images=e)),f;function m(e){const{bundledCss:t,unfetchedResources:o}=R(e,i);if(l+=t,o)for(const e of o)v.add(e);switch(e.nodeType){case C.TEXT:return function(e){return{tagName:"#text",text:e.textContent}}(e);case C.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?g(e):h(e);case C.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,m).filter(Boolean)};default:return null}}function h(n){const s=Array.prototype.map.call(n.childNodes,m).filter(Boolean),a=n.shadowRoot&&e(n.shadowRoot,i),c=n.tagName.toUpperCase();if(d.indexOf(c)>-1)return null;const l=window.getComputedStyle(n),f=n.getBoundingClientRect(),h={};for(const e of t)h[e]=l.getPropertyValue(e);h["border-width"]||(h["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const g={};for(const e of r)g[e]=f[e];const p=Array.from(n.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),y=o(l.getPropertyValue("background-image"));y&&u.add(y);const w={tagName:c,style:x(h),rect:x(g),attributes:x(p),childNodes:s};return a&&(w.shadowRoot=a),w}function g(t){const o=h(t);let n;try{n=t.contentDocument}catch(e){return r(),o}try{n?o.childNodes=[e(n,a(t)?t.baseURI:n.location.href)]:r()}catch(e){console.log("error in iframeToJSON",e)}return o;function r(){const e=s(t);E.push(e),o.childNodes=[`@@@@@${e}@@@@@`]}}}(f);b(y.doCaptureDoc),N(y.waitForImages),await Promise.all(T),b(y.waitForImages),k.version="1.3.0",k.scriptVersion="7.3.0";const U=E.length?E.join("\n")+"\n":"",A=v.size?Array.from(v).join("\n")+"\n":"",F=JSON.stringify({separator:"-----",cssStartToken:"#####",cssEndToken:"#####",iframeStartToken:'"@@@@@',iframeEndToken:'@@@@@"'});b(y.total);const I=`${F}\n${A}-----\n${U}-----\n${JSON.stringify(k)}${m?"\n-----\n"+JSON.stringify(y):""}`;return console.log("[captureFrame]",JSON.stringify(y)),I;function x(e){return Object.keys(e).length?e:void 0}};module.exports=N;
/* @applitools/dom-capture@8.0.0 */
"use strict";function e(e,t=0){const n=e.charCodeAt(t);if(n>=55296&&n<56320){return 1024*(n-55296)+(e.charCodeAt(t+1)-56320)+65536}return 56320<=n&&n<=57343?-1:n}var t=function(t,n){const o=[];let r=0;for(let s=0;s<t.length;++s){const a=e(t,s);let c=0;a>0&&(c=a<128?1:a<2048?2:a<65536?3:a<2097152?4:a<67108864?5:6),r+c>n?(o.push(s),r=c):r+=c}return o};const n="WIP",o="SUCCESS",r="SUCCESS_CHUNKED",s="ERROR";var a=function(e,a,c={}){const u=function(e,{chunkByteLength:a=0}={}){if(e){if(e.value){if(a){if(!e.chunks){const n=JSON.stringify(e.value);e.chunks=t(n,a),e.chunks.length>0&&(e.from=0,e.value=n)}if(e.from>=0)return{status:r,value:e.value.substring(e.from,e.from=e.chunks.shift()),done:!e.from}}return{status:o,value:e.value}}return e.error?{status:s,error:e.error}:{status:n}}return{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((e=e||{})[a],c);return(u.status===o||u.status===s||u.status===r&&u.done)&&(e[a]=null),u};var c=function(e,t){return new URL(e,t).href};var u=function(e){return!/^https?:.+/.test(e.src)||e.contentDocument&&e.contentDocument.location&&(["about:blank","about:srcdoc"].includes(e.contentDocument.location.href)||""===e.getAttribute("src")&&e.contentDocument.location.href===c(e.getAttribute("src"),e.ownerDocument.location.href))};var i={chunkify:t,pollify:function(e,t,n){return o=>function(){return t[n]||(t[n]={},e.apply(null,arguments).then(e=>t[n].value=e).catch(e=>t[n].error=e.message)),a(t,n,o)}},poll:a,absolutizeUrl:c,isInlineFrame:u,isAccessibleFrame:function(e){try{const t=e.contentDocument;return Boolean(t&&t.defaultView&&t.defaultView.frameElement)}catch(e){return!1}}};const l=/url\((?!['"]?:)['"]?([^'")]*)['"]?\)/;var f=function(e){const t=e?e.match(l):void 0;return t?t[1]:t};var d=async function({bgImages:e,timeout:t=5e3,Image:n=window.Image}){return(await Promise.all(Array.from(e).map(e=>{return Promise.race([new Promise(t=>{const o=new n;o.onload=()=>t({url:e,width:o.naturalWidth,height:o.naturalHeight}),o.onerror=()=>t(),o.src=e}),(o=t,new Promise(e=>{setTimeout(e,o)}))]);var o}))).reduce((e,t)=>(t&&(e[t.url]={width:t.width,height:t.height}),e),{})};function m(e){return Array.prototype.filter.call(e.parentNode.childNodes,t=>t.tagName===e.tagName).indexOf(e)+1}var h=function e(t){if(!t.ownerDocument)return"";let n="",o=t,r=t.ownerDocument,s=r.defaultView.frameElement;for(;o!==r;)n=`${o.tagName}[${m(o)}]/${n}`,o=o.parentNode;return s&&(n=`${e(s)},${n}`),n.replace(/\/$/,"")};var g=function({parseCss:e,CSSImportRule:t,absolutizeUrl:n,getCssFromCache:o,unfetchedToken:r}){return function s(a,c){let u,i="";try{const l=e(a);for(const e of Array.from(l.cssRules))if(e instanceof t){const t=n(e.href,c),a=o(t);if(void 0!==a){const{bundledCss:e,unfetchedResources:n}=s(a,t);n&&(u=new Set(n)),i=`${e}${i}`}else u=new Set([t]),i=`\n${r}${t}${r}`}}catch(e){console.log("error during getBundledCssFromCssText, styleBaseUrl="+c,e)}var l,f;return i=`${i}${l=a,f=c,`\n/** ${f} **/\n${l}`}`,{bundledCss:i,unfetchedResources:u}}};var p=function(e){var t=document.implementation.createHTMLDocument(""),n=t.createElement("style");return n.textContent=e,t.body.appendChild(n),n.sheet};var y=function(e,{fetchTimeLimit:t}={}){return async function(n){const o=new AbortController,r=[e(n,{cache:"force-cache",signal:o.signal}).then(e=>{if(e.ok)return e.text();console.log("/failed to fetch (status "+e.status+") css from: "+n+"/")}).catch(e=>{console.log("/failed to fetch (error "+e.toString()+") css from: "+n+"/")})];return Number.isNaN(Number(t))||r.push(new Promise(e=>setTimeout(e,t)).then(()=>o.abort())),Promise.race(r)}},C=function(e){const t=Array.from(e.attributes).find(e=>"href"===e.name.toLowerCase());return t&&t.value},w=function(e){if(e.nodeName&&"LINK"===e.nodeName.toUpperCase()&&e.attributes){const t=new Map(Array.from(e.attributes,e=>[e.name.toLowerCase(),e.value.toLowerCase()]));return"stylesheet"===t.get("rel")||"style"===t.get("as")&&["preload","prefetch"].includes(t.get("rel"))}return!1};var E=function(e){return e&&e.startsWith("data:")};var T=function({getCssFromCache:e,absolutizeUrl:t}){return function(n,o){let r,s,a;if(function(e){return e.nodeName&&"STYLE"===e.nodeName.toUpperCase()}(n))r=Array.from(n.childNodes).map(e=>e.nodeValue).join(""),s=o;else if(w(n)){const c=C(n);E(c)?(s=o,r=c.match(/,(.+)/)[1]):(s=t(c,o),r=e(s)),a=void 0===r}return{cssText:r,styleBaseUrl:s,isUnfetched:a}}};var N=function({extractCssFromNode:e,getBundledCssFromCssText:t,unfetchedToken:n}){return function(o,r){const{styleBaseUrl:s,cssText:a,isUnfetched:c}=e(o,r);let u,i="";if(a){const{bundledCss:e,unfetchedResources:n}=t(a,s);i+=e,u=new Set(n)}else c&&(i+=`${n}${s}${n}`,u=new Set([s]));return{bundledCss:i,unfetchedResources:u}}},b={EYES_NAMESPACE:"__EYES__APPLITOOLS__",DOM_CAPTURE_KEY:"domCaptureResult",NODE_TYPES:{ELEMENT:1,TEXT:3,DOCUMENT_FRAGMENT:11},DEFAULT_STYLE_PROPS:["background-repeat","background-origin","background-position","background-color","background-image","background-size","border-width","border-color","border-style","color","display","font-size","font-weight","line-height","margin","opacity","overflow","padding","visibility"],DEFAULT_RECT_PROPS:["width","height","top","left"],DEFAULT_IGNORED_TAG_NAMES:["HEAD","SCRIPT"]};const{absolutizeUrl:S,isInlineFrame:v}=i,{NODE_TYPES:A}=b;var D=function(e){return async function(t=document){const n={},o=Date.now(),r=[];return function t(n,o,r,s){function a(t){switch(s.push(async function(t,n,o){let r,s;w(t)&&(s=S(C(t),n),r=await e(s),void 0!==r&&(o[s]=r));r&&await async function t(n,o,r){try{const s=p(n),a=[];for(const n of Array.from(s.cssRules))n instanceof CSSImportRule&&a.push((async()=>{const s=S(n.href,o),a=await e(s);r[s]=a,void 0!==a&&await t(a,s,r)})());await Promise.all(a)}catch(e){console.log("error during fetchBundledCss, resourceUrl="+o,e)}}(r,s,o)}(t,o,r)),t.nodeType){case A.ELEMENT:return"IFRAME"===t.tagName.toUpperCase()?u(t):c(t)}}async function c(e){Array.prototype.map.call(e.childNodes,a)}async function u(e){if(c(e),e.contentDocument)try{const n=v(e)?e.baseURI:e.contentDocument.location.href;t(e.contentDocument,n,r,s)}catch(e){console.log(e)}}a(n.documentElement)}(t,t.location.href,n,r),await Promise.all(r),console.log("[prefetchAllCss]",Date.now()-o),function(e){return n[e]}}};const{absolutizeUrl:R,isInlineFrame:P}=i,{NODE_TYPES:$,DEFAULT_STYLE_PROPS:U,DEFAULT_RECT_PROPS:_,DEFAULT_IGNORED_TAG_NAMES:F}=b;var k=async function({doc:e=document,styleProps:t=U,rectProps:n=_,ignoredTagNames:o=F,addStats:r=!1,fetchTimeLimit:s=3e4}={}){arguments[1]&&(e=arguments[1]),arguments[2]&&(r=arguments[2]),arguments[3]&&(s=arguments[3]);const a={total:{},prefetchCss:{},doCaptureDoc:{},waitForImages:{}};function c(e){e.startTime=Date.now()}function u(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime}const i=[];c(a.total);const l=new Set,m=[],C="@@@@@",w="#####",E="-----";c(a.prefetchCss);const b=D(y(fetch,{fetchTimeLimit:s})),S=await b(e);u(a.prefetchCss);const v=g({parseCss:p,CSSImportRule:CSSImportRule,getCssFromCache:S,absolutizeUrl:R,unfetchedToken:w}),A=T({getCssFromCache:S,absolutizeUrl:R}),k=N({extractCssFromNode:A,getBundledCssFromCssText:v,unfetchedToken:w});c(a.doCaptureDoc);const I=Y(e);u(a.doCaptureDoc),c(a.waitForImages),await Promise.all(i),u(a.waitForImages),I.version="1.3.0",I.scriptVersion="8.0.0";const L=m.length?m.join("\n")+"\n":"",O=l.size?Array.from(l).join("\n")+"\n":"",x=JSON.stringify({separator:E,cssStartToken:w,cssEndToken:w,iframeStartToken:'"'+C,iframeEndToken:C+'"'});function M(){return r?`\n${E}\n${JSON.stringify(a)}`:""}u(a.total);const B=`${x}\n${O}${E}\n${L}${E}\n${JSON.stringify(I)}${M()}`;return console.log("[captureFrame]",JSON.stringify(a)),B;function V(e){return Object.keys(e).length?e:void 0}function z(e){return{tagName:"#text",text:e.textContent}}function Y(e,r=e.location&&e.location.href){const s=new Set;let a="";const c=u(e.documentElement||e);return c.css=a,i.push(d({bgImages:s}).then(e=>c.images=e)),c;function u(e){const{bundledCss:t,unfetchedResources:n}=k(e,r);if(a+=t,n)for(const e of n)l.add(e);switch(e.nodeType){case $.TEXT:return z(e);case $.ELEMENT:return"IFRAME"===e.tagName.toUpperCase()?function(e){const t=g(e);let n;try{n=e.contentDocument}catch(e){return o(),t}try{n?t.childNodes=[Y(n,P(e)?e.baseURI:n.location.href)]:o()}catch(e){console.log("error in iframeToJSON",e)}return t;function o(){const n=h(e);m.push(n),t.childNodes=[`${C}${n}${C}`]}}(e):g(e);case $.DOCUMENT_FRAGMENT:return{childNodes:Array.prototype.map.call(e.childNodes,u).filter(Boolean)};default:return null}}function g(e){const a=Array.prototype.map.call(e.childNodes,u).filter(Boolean),c=e.shadowRoot&&Y(e.shadowRoot,r),i=e.tagName.toUpperCase();if(o.indexOf(i)>-1)return null;const l=window.getComputedStyle(e),d=e.getBoundingClientRect(),m={};for(const e of t)m[e]=l.getPropertyValue(e);m["border-width"]||(m["border-width"]=`${l.getPropertyValue("border-top-width")} ${l.getPropertyValue("border-right-width")} ${l.getPropertyValue("border-bottom-width")} ${l.getPropertyValue("border-left-width")}`);const h={};for(const e of n)h[e]=d[e];const g=Array.from(e.attributes).map(e=>({key:e.name,value:e.value})).reduce((e,t)=>(e[t.key]=t.value,e),{}),p=f(l.getPropertyValue("background-image"));p&&s.add(p);const y={tagName:i,style:V(m),rect:V(h),attributes:V(g),childNodes:a};return c&&(y.shadowRoot=c),y}}};module.exports=k;
/* @applitools/dom-capture@7.3.0 */
function __poll() {
var poll=function(){"use strict";const t="WIP",n="SUCCESS",e="SUCCESS_CHUNKED",r="ERROR";return function(u){const i=function(u,{maxChunkSize:i=0}={}){if(u){if(u.value){if(i&&(u.stringified||(u.stringified=JSON.stringify(u.value)),u.stringified.length>i)){const t=u.nextChunkIndex||0;return u.nextChunkIndex=t+i,{status:e,value:u.stringified.substring(t,u.nextChunkIndex),done:u.nextChunkIndex>=u.stringified.length}}return{status:n,value:u.value}}return u.error?{status:r,error:u.error}:{status:t}}return{status:r,error:"unexpected poll request received - cannot find state of current operation"}}(window.__EYES__APPLITOOLS__?window.__EYES__APPLITOOLS__.captureDomResult:null,u);return(i.status===n||i.status===r||i.status===e&&i.done)&&(window.__EYES__APPLITOOLS__.captureDomResult=null),JSON.stringify(i)}}();
var poll=function(){"use strict";function t(t,n=0){const e=t.charCodeAt(n);if(55296<=e&&e<56320){return 1024*(e-55296)+(t.charCodeAt(n+1)-56320)+65536}return 56320<=e&&e<=57343?-1:e}var n=function(n,e){const r=[];let u=0,s=0;for(let o=0;o<n.length;++o){const c=t(n,o);let l=0;c>0&&(l=c<128?1:c<2048?2:c<65536?3:c<2097152?4:c<67108864?5:6),u+l>e?(r.push(n.substring(s,o)),s=o,u=l):u+=l}return r.push(n.substring(s)),r};const e="WIP",r="SUCCESS",u="SUCCESS_CHUNKED",s="ERROR";var o=function(t,o,c={}){const l=function(t,{chunkByteLength:o=268435456}={}){return t?t.value?o&&(t.chunks||(t.chunks=n(JSON.stringify(t.value),o),t.splitted=t.chunks.length>1),t.splitted)?{status:u,value:t.chunks.shift(),done:0===t.chunks.length}:{status:r,value:t.value}:t.error?{status:s,error:t.error}:{status:e}:{status:s,error:"unexpected poll request received - cannot find state of current operation"}}((t=t||{})[o],c);return(l.status===r||l.status===s||l.status===u&&l.done)&&(t[o]=null),l};var c={chunkify:n,pollify:function(t,n={},e="state"){return r=>function(){return n[e]||(n[e]={},t.apply(null,arguments).then(t=>n[e].value=t).catch(t=>n[e].error=t.message)),o(n,e,r)}},poll:o};const{poll:l}=c;return function(t){return JSON.stringify(l(window.__EYES__APPLITOOLS__,"domCaptureResult",t))}}();
return poll.apply(this, arguments);
}
'use strict';
const makeGetScript = require('./src/getScript');
const getCaptureDomScript = makeGetScript('captureDom');
const getCaptureDomAndPollScript = makeGetScript('captureDomAndPoll');
const getPollScript = makeGetScript('poll');
const getCaptureDomForIEScript = makeGetScript('captureDomForIE');
const getCaptureDomAndPollForIE = makeGetScript('captureDomAndPollForIE');
const getPollForIE = makeGetScript('pollForIE');
const getCaptureDom = makeGetScript('captureDom');
const getCaptureDomPoll = makeGetScript('captureDomAndPoll');
const getPollResult = makeGetScript('pollResult');
const getCaptureDomForIE = makeGetScript('captureDomForIE');
const getCaptureDomPollForIE = makeGetScript('captureDomAndPollForIE');
const getPollResultForIE = makeGetScript('pollResultForIE');
module.exports = {
getCaptureDomScript,
getCaptureDomAndPollScript,
getPollScript,
getCaptureDomForIEScript,
getCaptureDomAndPollForIE,
getPollForIE,
getCaptureDom,
getCaptureDomPoll,
getPollResult,
getCaptureDomForIE,
getCaptureDomPollForIE,
getPollResultForIE,
};
{
"name": "@applitools/dom-capture",
"version": "7.3.0",
"version": "8.0.0",
"main": "index.js",

@@ -15,3 +15,3 @@ "license": "SEE LICENSE IN LICENSE",

"surge": "surge test/fixtures applitools-dom-capture-origin-1.surge.sh && surge test/fixtures applitools-dom-capture-origin-2.surge.sh",
"preversion": "BONGO_SKIP_VERIFY_VERSIONS=1 BONGO_SKIP_VERIFY_COMMITS=1 BONGO_SKIP_VERIFY_INSTALLED_VERSIONS=1 bongo preversion && yarn build && yarn test",
"preversion": "bongo preversion && yarn build && yarn test",
"version": "yarn build && bongo version",

@@ -29,4 +29,4 @@ "postversion": "bongo postversion --skip-release-notification"

"@applitools/monitoring-commons": "^1.0.15",
"@applitools/sdk-release-kit": "0.2.2",
"@applitools/sdk-shared": "0.1.0",
"@applitools/sdk-release-kit": "^0.3.3",
"@applitools/sdk-shared": "^0.1.4",
"@babel/core": "^7.7.7",

@@ -63,3 +63,4 @@ "@babel/preset-env": "^7.7.7",

"dependencies": {
"@applitools/functional-commons": "1.5.4"
"@applitools/dom-shared": "1.0.4",
"@applitools/functional-commons": "1.6.0"
},

@@ -66,0 +67,0 @@ "repository": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc