testplane 9.0.7 → 9.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/build/package.json +2 -2
  2. package/build/src/browser/client-bridge/index.d.ts +4 -1
  3. package/build/src/browser/client-bridge/index.js +7 -7
  4. package/build/src/browser/client-bridge/index.js.map +1 -1
  5. package/build/src/browser/client-scripts/browser-utils/build/bundle.compat.js +1 -1
  6. package/build/src/browser/client-scripts/browser-utils/build/bundle.native.js +1 -1
  7. package/build/src/browser/client-scripts/browser-utils/tsc-out/client-scripts/shared/lib.compat.js +14 -8
  8. package/build/src/browser/client-scripts/browser-utils/tsc-out/client-scripts/shared/lib.native.js +14 -8
  9. package/build/src/browser/client-scripts/screen-shooter/build/bundle.compat.js +8 -8
  10. package/build/src/browser/client-scripts/screen-shooter/build/bundle.native.js +8 -8
  11. package/build/src/browser/client-scripts/screen-shooter/tsc-out/client-scripts/screen-shooter/implementation.js +60 -35
  12. package/build/src/browser/client-scripts/screen-shooter/tsc-out/client-scripts/screen-shooter/operations.js +61 -37
  13. package/build/src/browser/client-scripts/screen-shooter/tsc-out/client-scripts/screen-shooter/utils/pseudo-element-rect.js +10 -7
  14. package/build/src/browser/client-scripts/screen-shooter/tsc-out/client-scripts/screen-shooter/utils/scroll.js +34 -7
  15. package/build/src/browser/client-scripts/screen-shooter/tsc-out/client-scripts/shared/lib.compat.js +14 -8
  16. package/build/src/browser/client-scripts/screen-shooter/tsc-out/client-scripts/shared/lib.native.js +14 -8
  17. package/build/src/browser/commands/assert-view/index.js +1 -1
  18. package/build/src/browser/commands/assert-view/index.js.map +1 -1
  19. package/build/src/browser/commands/switchToRepl.js +3 -2
  20. package/build/src/browser/commands/switchToRepl.js.map +1 -1
  21. package/build/src/browser/screen-shooter/elements-screen-shooter.d.ts +3 -2
  22. package/build/src/browser/screen-shooter/elements-screen-shooter.js +49 -44
  23. package/build/src/browser/screen-shooter/elements-screen-shooter.js.map +1 -1
  24. package/build/src/browser/screen-shooter/operations/wait-for-selectors-to-settle.d.ts +3 -1
  25. package/build/src/browser/screen-shooter/operations/wait-for-selectors-to-settle.js +37 -17
  26. package/build/src/browser/screen-shooter/operations/wait-for-selectors-to-settle.js.map +1 -1
  27. package/build/src/bundle/cjs/index.js +203 -17209
  28. package/package.json +2 -2
@@ -1,12 +1,12 @@
1
1
  (function (__geminiNamespace) { (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
2
  "use strict";var __extends=this&&this.__extends||function(){var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e])})(t,e)};return function(t,e){function o(){this.constructor=t}if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");r(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}}();exports.__esModule=!0,exports.OutsideOfViewportError=void 0;var _isomorphic_1=require("/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js"),OutsideOfViewportError=function(r){function t(t){var e=r.call(this,'Can not capture element, because it is completely outside of viewport with no intersection. Try to set "captureElementFromTop=true" assertView option to scroll to it before capture.')||this;return e.name="OutsideOfViewportError",e.errorCode=_isomorphic_1.BrowserSideErrorCode.OUTSIDE_OF_VIEWPORT,e.debugLog=t,e}return __extends(t,r),t}(Error);exports.OutsideOfViewportError=OutsideOfViewportError;
3
3
  },{"/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js":19}],2:[function(require,module,exports){
4
- "use strict";function sampleRandom(e,o){if(e.length<=o)return e.slice();for(var r=e.slice(),t=0;t<o;t++){var i=t+Math.floor(Math.random()*(r.length-t)),s=r[t];r[t]=r[i],r[i]=s}return r.slice(0,o)}function computeShiftMode(e,o){if(0===e.length)return null;for(var r=e.slice().sort(function(e,o){return e-o}),t=0,i=0,s=0,n=0;s<r.length;s++){for(;n+1<r.length&&r[n+1]-r[s]<=o;)n++;n-s+1>i-t+1&&(t=s,i=n)}var c=r.slice(t,i+1),a=Math.floor(c.length/2);return c.length%2==1?c[a]:(c[a-1]+c[a])/2}function computeActualShift(){var e=(0,dom_1.getScreenshooterNamespaceData)().trackedElementsData;if(!e||0===e.length)return null;for(var o=[],r=0,t=e;r<t.length;r++){var i=t[r];if(i.element.isConnected){var s=i.element.getBoundingClientRect(),n=i.rect;s.width<=0||s.height<=0||Math.abs(s.width-n.width)>1||Math.abs(s.height-n.height)>1||o.push(s.top-n.top)}}if(o.length<MIN_ANCHOR_SAMPLE_SIZE)return null;var c=computeShiftMode(o,ANCHOR_SHIFT_TOLERANCE_CSS);return null===c?null:c}function safeCall(e){for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];try{return e.apply(void 0,o)}catch(t){return t instanceof Error?{errorCode:_isomorphic_1.BrowserSideErrorCode.JS,message:t.stack||t.message}:{errorCode:_isomorphic_1.BrowserSideErrorCode.JS,message:"Unknown error: "+String(t)}}}function prepareElementsScreenshot(e,o){return safeCall(prepareElementsScreenshotUnsafe,e,o)}function scrollBy(e,o,r,t){return safeCall(function(){var i=(0,logger_1.createDebugLogger)({debug:t},"scrollBy"),s=(0,operations_1.computePixelRatio)(),n=r?document.querySelector(r):null,c=null!==n&&void 0!==n?n:(0,scroll_1.getCommonScrollParent)(e),a=(0,descriptions_1.getReadableElementDescriptor)(c),l=r?n?"".concat(r," (").concat(a,")"):"".concat(r," (not found, auto-detected ").concat(a,")"):"auto-detected ".concat(a),p=(0,_isomorphic_1.fromDeviceToCssNumber)(o,s);return(0,scroll_1.scrollElementBy)(c,p),{readableSelectorToScrollDescr:l,debugLog:i()}})}function scrollTo(e,o,r,t){return safeCall(function(){var i=(0,logger_1.createDebugLogger)({debug:t},"scrollTo");i("Asked to scroll to with params: selectorsToCapture:",e,"scrollOffset:",o,"selectorToScroll:",r);var s=(0,operations_1.computePixelRatio)(),n=r?document.querySelector(r):null,c=null!==n&&void 0!==n?n:(0,scroll_1.getCommonScrollParent)(e),a=(0,descriptions_1.getReadableElementDescriptor)(c),l=r?n?"".concat(r," (").concat(a,")"):"".concat(r," (not found, auto-detected ").concat(a,")"):"auto-detected ".concat(a),p=(0,_isomorphic_1.fromDeviceToCssNumber)(o,s);return(0,scroll_1.scrollElementToOffset)(c,p),{readableSelectorToScrollDescr:l,debugLog:i()}})}function getCaptureState(e,o,r,t){return safeCall(function(){var i=(0,logger_1.createDebugLogger)({debug:t},"getCaptureState"),s=(0,operations_1.computePixelRatio)(),n=r?document.querySelector(r):null,c=null!==n&&void 0!==n?n:(0,scroll_1.getCommonScrollParent)(e),a=(0,descriptions_1.getReadableElementDescriptor)(c),l=r?n?"".concat(r," (").concat(a,")"):"".concat(r," (not found, auto-detected ").concat(a,")"):"auto-detected ".concat(a),p=(0,operations_1.computeIgnoreAreas)(o),u=(0,operations_1.computeSafeArea)(e,c,i),m=(0,operations_1.computeCaptureSpecs)(e,i),_=m.map(function(e){return{full:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.full),s),clip:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.clip),s),visible:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.visible),s)}}),f=(0,operations_1.computeScrollOffset)(c),d=(0,operations_1.computeViewportOffset)(),h=computeActualShift(),v=null===h?null:(0,_isomorphic_1.fromCssToDeviceNumber)(h,s);return i("scrollOffset:",f),{captureSpecs:_,ignoreAreas:p.map(function(e){return(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),s)}),safeArea:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(u),s),scrollOffset:(0,_isomorphic_1.fromCssToDeviceNumber)(f,s),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(d),s),anchorShift:v,readableSelectorToScrollDescr:l,debugLog:i()}})}function prepareFullPageScreenshot(e){return void 0===e&&(e={}),safeCall(function(){(0,operations_1.prepareFullPageScrollCleanup)();var o=(0,operations_1.computePixelRatio)(e.usePixelRatio);window.scrollTo(0,0);var r=(0,operations_1.computeDocumentSize)(),t=(0,operations_1.computeViewportSize)(),i=(0,operations_1.computeViewportOffset)(),s=(0,operations_1.computeSafeArea)(["body"],document.documentElement);e.disableAnimation&&(0,operations_1.disableAnimations)();var n=!1;if(e.disableHover===_isomorphic_1.DisableHoverMode.Always)(0,operations_1.disablePointerEvents)(),n=!0;else if(e.disableHover===_isomorphic_1.DisableHoverMode.WhenScrollingNeeded){var c=r.height>t.height;c&&((0,operations_1.disablePointerEvents)(),n=!0)}var a=(0,operations_1.computeElementPositionsProbe)().map(function(e){return e?__assign(__assign({},(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),o)),{elementDescr:e.elementDescr}):null});return{documentSize:(0,_isomorphic_1.ceilCoords)((0,_isomorphic_1.fromCssToDevice)(r,o)),viewportSize:(0,_isomorphic_1.fromCssToDevice)(t,o),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(i),o),safeArea:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(s),o),elementPositionsProbe:a,pixelRatio:o,pointerEventsDisabled:n}})}function scrollFullPage(e,o){return void 0===o&&(o={}),safeCall(function(){var r=(0,operations_1.computePixelRatio)(o.usePixelRatio),t=(0,_isomorphic_1.fromDeviceToCssNumber)(e,r)-1;(0,scroll_1.scrollElementBy)(document.documentElement,t);var i=(0,operations_1.computeViewportOffset)(),s=(0,operations_1.computeElementPositionsProbe)().map(function(e){return e?__assign(__assign({},(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),r)),{elementDescr:e.elementDescr}):null});return{viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(i),r),elementPositionsProbe:s}})}function prepareViewportScreenshot(e){return void 0===e&&(e={}),safeCall(function(){var o=(0,operations_1.computePixelRatio)(e.usePixelRatio),r=(0,operations_1.computeViewportSize)(),t=(0,operations_1.computeViewportOffset)(),i=(0,operations_1.computeDocumentSize)(),s=(0,operations_1.computeCanHaveCaret)();e.disableAnimation&&(0,operations_1.disableAnimations)();var n=(0,operations_1.computeIgnoreAreas)(e.ignoreSelectors),c=!1;return e.disableHover===_isomorphic_1.DisableHoverMode.Always&&((0,operations_1.disablePointerEvents)(),c=!0),{viewportSize:(0,_isomorphic_1.fromCssToDevice)(r,o),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(t),o),documentSize:(0,_isomorphic_1.ceilCoords)((0,_isomorphic_1.fromCssToDevice)(i,o)),ignoreAreas:n.map(function(e){return(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),o)}),canHaveCaret:s,pixelRatio:o,pointerEventsDisabled:c}})}function disableFrameAnimations(){return safeCall(operations_1.disableAnimations)}function cleanupFrameAnimations(){window.__cleanupAnimation&&window.__cleanupAnimation()}function disablePointerEvents(){return safeCall(operations_1.disablePointerEvents)}function cleanupPointerEvents(){var e=(0,dom_1.getScreenshooterNamespaceData)();e.cleanupPointerEventsCb&&e.cleanupPointerEventsCb()}function cleanupScrolls(){(0,dom_1.getScreenshooterNamespaceData)().trackedElementsData=[],(0,operations_1.cleanupSavedScrolls)()}function captureAnchorBaseline(e){return safeCall(function(){for(var o=(0,operations_1.computeCaptureSpecs)(e),r=o.length>0?(0,_isomorphic_1.getCoveringRect)(o.map(function(e){return e.full})):null,t=[],i=0;i<e.length;i++){var s=document.querySelector(e[i]);if(s){t.push(s);for(var n=s.querySelectorAll("*"),c=0;c<n.length;c++)t.push(n[c])}}var a=t.filter(function(e){var o=e.getBoundingClientRect();if(o.width<=0||o.height<=0)return!1;if(!r)return!0;var t=(0,_isomorphic_1.fromBcrToRect)(o);return Boolean((0,_isomorphic_1.getIntersection)(r,t))}),l=sampleRandom(a,MAX_ANCHOR_TRACKED_ELEMENTS);(0,dom_1.getScreenshooterNamespaceData)().trackedElementsData=l.map(function(e){var o=e.getBoundingClientRect();return{element:e,rect:(0,_isomorphic_1.fromBcrToRect)(o)}})})}function prepareElementsScreenshotUnsafe(e,o){var r=(0,logger_1.createDebugLogger)(o,"prepareElementsScreenshot");(0,operations_1.saveScrollPositions)(e,o.selectorToScroll);var t=(0,operations_1.scrollToCaptureAreaIfNeeded)(e,o.captureElementFromTop,o.allowViewportOverflow,o.selectorToScroll,r).readableSelectorToScrollDescr;o.disableAnimation&&(0,operations_1.disableAnimations)();var i=(0,operations_1.computePixelRatio)(o.usePixelRatio),s=o.selectorToScroll?document.querySelector(o.selectorToScroll):null,n=null!==s&&void 0!==s?s:(0,scroll_1.getCommonScrollParent)(e),c=(0,operations_1.computeIgnoreAreas)(o.ignoreSelectors),a=(0,operations_1.computeCaptureSpecs)(e,r),l=(0,operations_1.computeViewportSize)(),p=(0,operations_1.computeViewportOffset)(),u=(0,operations_1.computeSafeArea)(e,n,r),m=(0,operations_1.computeScrollOffset)(n),_=(0,operations_1.computeDocumentSize)(),f=(0,operations_1.computeCanHaveCaret)(),d=!1;if(o.disableHover===_isomorphic_1.DisableHoverMode.Always)(0,operations_1.disablePointerEvents)(),d=!0;else if(o.disableHover===_isomorphic_1.DisableHoverMode.WhenScrollingNeeded&&o.compositeImage){var h=(0,_isomorphic_1.getCoveringRect)(a.map(function(e){return e.full})),v=(0,_isomorphic_1.getBottom)(h)>(0,_isomorphic_1.getBottom)(u);v&&(r("adding stylesheet with pointer-events: none on all elements (composite capture needs scrolling). captureArea:",h,"safeArea:",u),(0,operations_1.disablePointerEvents)(),d=!0)}return r("scrollOffset:",m),{ignoreAreas:c.map(function(e){return(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),i)}),captureSpecs:a.map(function(e){return{full:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.full),i),clip:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.clip),i),visible:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.visible),i)}}),viewportSize:(0,_isomorphic_1.fromCssToDevice)(l,i),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(p),i),safeArea:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(u),i),documentSize:(0,_isomorphic_1.ceilCoords)((0,_isomorphic_1.fromCssToDevice)(_,i)),canHaveCaret:f,pixelRatio:i,pointerEventsDisabled:d,debugLog:r(),readableSelectorToScrollDescr:t,scrollOffset:(0,_isomorphic_1.fromCssToDeviceNumber)(m,i)}}var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var o,r=1,t=arguments.length;r<t;r++){o=arguments[r];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},__assign.apply(this,arguments)};exports.__esModule=!0,exports.captureAnchorBaseline=exports.cleanupScrolls=exports.cleanupPointerEvents=exports.disablePointerEvents=exports.cleanupFrameAnimations=exports.disableFrameAnimations=exports.prepareViewportScreenshot=exports.scrollFullPage=exports.prepareFullPageScreenshot=exports.getCaptureState=exports.scrollTo=exports.scrollBy=exports.prepareElementsScreenshot=void 0;var _isomorphic_1=require("/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js"),logger_1=require("../shared/logger"),operations_1=require("./operations"),descriptions_1=require("./utils/descriptions"),dom_1=require("./utils/dom"),scroll_1=require("./utils/scroll"),MIN_ANCHOR_SAMPLE_SIZE=3,MAX_ANCHOR_TRACKED_ELEMENTS=500,ANCHOR_SHIFT_TOLERANCE_CSS=1.5;exports.prepareElementsScreenshot=prepareElementsScreenshot,exports.scrollBy=scrollBy,exports.scrollTo=scrollTo,exports.getCaptureState=getCaptureState,exports.prepareFullPageScreenshot=prepareFullPageScreenshot,exports.scrollFullPage=scrollFullPage,exports.prepareViewportScreenshot=prepareViewportScreenshot,exports.disableFrameAnimations=disableFrameAnimations,exports.cleanupFrameAnimations=cleanupFrameAnimations,exports.disablePointerEvents=disablePointerEvents,exports.cleanupPointerEvents=cleanupPointerEvents,exports.cleanupScrolls=cleanupScrolls,exports.captureAnchorBaseline=captureAnchorBaseline;
5
- },{"../shared/logger":15,"./operations":4,"./utils/descriptions":6,"./utils/dom":7,"./utils/scroll":10,"/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js":19}],3:[function(require,module,exports){
4
+ "use strict";function sampleRandom(e,o){if(e.length<=o)return e.slice();for(var r=e.slice(),t=0;t<o;t++){var i=t+Math.floor(Math.random()*(r.length-t)),s=r[t];r[t]=r[i],r[i]=s}return r.slice(0,o)}function computeShiftMode(e,o){if(0===e.length)return null;for(var r=e.slice().sort(function(e,o){return e-o}),t=0,i=0,s=0,n=0;s<r.length;s++){for(;n+1<r.length&&r[n+1]-r[s]<=o;)n++;n-s+1>i-t+1&&(t=s,i=n)}var a=r.slice(t,i+1),c=Math.floor(a.length/2);return a.length%2==1?a[c]:(a[c-1]+a[c])/2}function computeActualShift(){var e=(0,dom_1.getScreenshooterNamespaceData)().trackedElementsData;if(!e||0===e.length)return null;for(var o=[],r=0,t=e;r<t.length;r++){var i=t[r];if(i.element.isConnected){var s=i.element.getBoundingClientRect(),n=i.rect;s.width<=0||s.height<=0||Math.abs(s.width-n.width)>1||Math.abs(s.height-n.height)>1||o.push(s.top-n.top)}}if(o.length<MIN_ANCHOR_SAMPLE_SIZE)return null;var a=computeShiftMode(o,ANCHOR_SHIFT_TOLERANCE_CSS);return null===a?null:a}function safeCall(e){for(var o=[],r=1;r<arguments.length;r++)o[r-1]=arguments[r];try{return e.apply(void 0,o)}catch(t){return t instanceof Error?{errorCode:_isomorphic_1.BrowserSideErrorCode.JS,message:t.stack||t.message}:{errorCode:_isomorphic_1.BrowserSideErrorCode.JS,message:"Unknown error: "+String(t)}}}function prepareElementsScreenshot(e,o){return safeCall(prepareElementsScreenshotUnsafe,e,o)}function scrollBy(e,o,r,t){return safeCall(function(){var i=(0,logger_1.createDebugLogger)({debug:t},"scrollBy"),s=(0,operations_1.computePixelRatio)(),n=r?lib.queryFirst(r):null,a=null!==n&&void 0!==n?n:(0,scroll_1.getCommonScrollParent)(e),c=(0,descriptions_1.getReadableElementDescriptor)(a),l=r?n?"".concat(r," (").concat(c,")"):"".concat(r," (not found, auto-detected ").concat(c,")"):"auto-detected ".concat(c),p=(0,_isomorphic_1.fromDeviceToCssNumber)(o,s);return(0,scroll_1.scrollElementBy)(a,p),{readableSelectorToScrollDescr:l,debugLog:i()}})}function scrollTo(e,o,r,t){return safeCall(function(){var i=(0,logger_1.createDebugLogger)({debug:t},"scrollTo");i("Asked to scroll to with params: targetsToCapture:",e,"scrollOffset:",o,"targetToScroll:",r);var s=(0,operations_1.computePixelRatio)(),n=r?lib.queryFirst(r):null,a=null!==n&&void 0!==n?n:(0,scroll_1.getCommonScrollParent)(e),c=(0,descriptions_1.getReadableElementDescriptor)(a),l=r?n?"".concat(r," (").concat(c,")"):"".concat(r," (not found, auto-detected ").concat(c,")"):"auto-detected ".concat(c),p=(0,_isomorphic_1.fromDeviceToCssNumber)(o,s);return(0,scroll_1.scrollElementToOffset)(a,p),{readableSelectorToScrollDescr:l,debugLog:i()}})}function getCaptureState(e,o,r,t){return safeCall(function(){var i=(0,logger_1.createDebugLogger)({debug:t},"getCaptureState"),s=(0,operations_1.computePixelRatio)(),n=r?lib.queryFirst(r):null,a=null!==n&&void 0!==n?n:(0,scroll_1.getCommonScrollParent)(e),c=(0,descriptions_1.getReadableElementDescriptor)(a),l=r?n?"".concat(r," (").concat(c,")"):"".concat(r," (not found, auto-detected ").concat(c,")"):"auto-detected ".concat(c),p=(0,operations_1.computeIgnoreAreas)(o),u=(0,operations_1.computeSafeArea)(e,a,i),_=(0,operations_1.computeCaptureSpecs)(e,i),m=_.map(function(e){return{full:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.full),s),clip:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.clip),s),visible:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.visible),s)}}),f=(0,operations_1.computeScrollOffset)(a),d=(0,operations_1.computeViewportOffset)(),h=computeActualShift(),v=null===h?null:(0,_isomorphic_1.fromCssToDeviceNumber)(h,s);return i("scrollOffset:",f),{captureSpecs:m,ignoreAreas:p.map(function(e){return(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),s)}),safeArea:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(u),s),scrollOffset:(0,_isomorphic_1.fromCssToDeviceNumber)(f,s),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(d),s),anchorShift:v,readableSelectorToScrollDescr:l,debugLog:i()}})}function prepareFullPageScreenshot(e){return void 0===e&&(e={}),safeCall(function(){(0,operations_1.prepareFullPageScrollCleanup)();var o=(0,operations_1.computePixelRatio)(e.usePixelRatio);window.scrollTo(0,0);var r=(0,operations_1.computeDocumentSize)(),t=(0,operations_1.computeViewportSize)(),i=(0,operations_1.computeViewportOffset)(),s=(0,operations_1.computeSafeArea)(["body"],document.documentElement);e.disableAnimation&&(0,operations_1.disableAnimations)();var n=!1;if(e.disableHover===_isomorphic_1.DisableHoverMode.Always)(0,operations_1.disablePointerEvents)(),n=!0;else if(e.disableHover===_isomorphic_1.DisableHoverMode.WhenScrollingNeeded){var a=r.height>t.height;a&&((0,operations_1.disablePointerEvents)(),n=!0)}var c=(0,operations_1.computeElementPositionsProbe)().map(function(e){return e?__assign(__assign({},(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),o)),{elementDescr:e.elementDescr}):null});return{documentSize:(0,_isomorphic_1.ceilCoords)((0,_isomorphic_1.fromCssToDevice)(r,o)),viewportSize:(0,_isomorphic_1.fromCssToDevice)(t,o),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(i),o),safeArea:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(s),o),elementPositionsProbe:c,pixelRatio:o,pointerEventsDisabled:n}})}function scrollFullPage(e,o){return void 0===o&&(o={}),safeCall(function(){var r=(0,operations_1.computePixelRatio)(o.usePixelRatio),t=(0,_isomorphic_1.fromDeviceToCssNumber)(e,r)-1;(0,scroll_1.scrollElementBy)(document.documentElement,t);var i=(0,operations_1.computeViewportOffset)(),s=(0,operations_1.computeElementPositionsProbe)().map(function(e){return e?__assign(__assign({},(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),r)),{elementDescr:e.elementDescr}):null});return{viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(i),r),elementPositionsProbe:s}})}function prepareViewportScreenshot(e){return void 0===e&&(e={}),safeCall(function(){var o=(0,operations_1.computePixelRatio)(e.usePixelRatio),r=(0,operations_1.computeViewportSize)(),t=(0,operations_1.computeViewportOffset)(),i=(0,operations_1.computeDocumentSize)(),s=(0,operations_1.computeCanHaveCaret)();e.disableAnimation&&(0,operations_1.disableAnimations)();var n=(0,operations_1.computeIgnoreAreas)(e.ignoreSelectors),a=!1;return e.disableHover===_isomorphic_1.DisableHoverMode.Always&&((0,operations_1.disablePointerEvents)(),a=!0),{viewportSize:(0,_isomorphic_1.fromCssToDevice)(r,o),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(t),o),documentSize:(0,_isomorphic_1.ceilCoords)((0,_isomorphic_1.fromCssToDevice)(i,o)),ignoreAreas:n.map(function(e){return(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),o)}),canHaveCaret:s,pixelRatio:o,pointerEventsDisabled:a}})}function disableFrameAnimations(){return safeCall(operations_1.disableAnimations)}function cleanupFrameAnimations(){window.__cleanupAnimation&&window.__cleanupAnimation()}function disablePointerEvents(){return safeCall(operations_1.disablePointerEvents)}function cleanupPointerEvents(){var e=(0,dom_1.getScreenshooterNamespaceData)();e.cleanupPointerEventsCb&&e.cleanupPointerEventsCb()}function cleanupScrolls(){(0,dom_1.getScreenshooterNamespaceData)().trackedElementsData=[],(0,operations_1.cleanupSavedScrolls)()}function captureAnchorBaseline(e){return safeCall(function(){for(var o=(0,operations_1.computeCaptureSpecs)(e),r=o.length>0?(0,_isomorphic_1.getCoveringRect)(o.map(function(e){return e.full})):null,t=[],i=0;i<e.length;i++){var s=lib.queryFirst((0,pseudo_element_rect_1.parseCaptureTarget)(e[i]).elementTarget);if(s){t.push(s);for(var n=s.querySelectorAll("*"),a=0;a<n.length;a++)t.push(n[a])}}var c=t.filter(function(e){var o=e.getBoundingClientRect();if(o.width<=0||o.height<=0)return!1;if(!r)return!0;var t=(0,_isomorphic_1.fromBcrToRect)(o);return Boolean((0,_isomorphic_1.getIntersection)(r,t))}),l=sampleRandom(c,MAX_ANCHOR_TRACKED_ELEMENTS);(0,dom_1.getScreenshooterNamespaceData)().trackedElementsData=l.map(function(e){var o=e.getBoundingClientRect();return{element:e,rect:(0,_isomorphic_1.fromBcrToRect)(o)}})})}function prepareElementsScreenshotUnsafe(e,o){var r=(0,logger_1.createDebugLogger)(o,"prepareElementsScreenshot");(0,operations_1.saveScrollPositions)(e,o.selectorToScroll);var t=(0,operations_1.scrollToCaptureAreaIfNeeded)(e,o.captureElementFromTop,o.allowViewportOverflow,o.selectorToScroll,r).readableSelectorToScrollDescr;o.disableAnimation&&(0,operations_1.disableAnimations)();var i=(0,operations_1.computePixelRatio)(o.usePixelRatio),s=o.selectorToScroll?lib.queryFirst(o.selectorToScroll):null,n=null!==s&&void 0!==s?s:(0,scroll_1.getCommonScrollParent)(e),a=(0,operations_1.computeIgnoreAreas)(o.ignoreSelectors),c=(0,operations_1.computeCaptureSpecs)(e,r),l=(0,operations_1.computeViewportSize)(),p=(0,operations_1.computeViewportOffset)(),u=(0,operations_1.computeSafeArea)(e,n,r),_=(0,operations_1.computeScrollOffset)(n),m=(0,operations_1.computeDocumentSize)(),f=(0,operations_1.computeCanHaveCaret)(),d=!1;if(o.disableHover===_isomorphic_1.DisableHoverMode.Always)(0,operations_1.disablePointerEvents)(),d=!0;else if(o.disableHover===_isomorphic_1.DisableHoverMode.WhenScrollingNeeded&&o.compositeImage){var h=(0,_isomorphic_1.getCoveringRect)(c.map(function(e){return e.full})),v=(0,_isomorphic_1.getBottom)(h)>(0,_isomorphic_1.getBottom)(u);v&&(r("adding stylesheet with pointer-events: none on all elements (composite capture needs scrolling). captureArea:",h,"safeArea:",u),(0,operations_1.disablePointerEvents)(),d=!0)}return r("scrollOffset:",_),{ignoreAreas:a.map(function(e){return(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e),i)}),captureSpecs:c.map(function(e){return{full:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.full),i),clip:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.clip),i),visible:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(e.visible),i)}}),viewportSize:(0,_isomorphic_1.fromCssToDevice)(l,i),viewportOffset:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.floorCoords)(p),i),safeArea:(0,_isomorphic_1.fromCssToDevice)((0,_isomorphic_1.roundCoords)(u),i),documentSize:(0,_isomorphic_1.ceilCoords)((0,_isomorphic_1.fromCssToDevice)(m,i)),canHaveCaret:f,pixelRatio:i,pointerEventsDisabled:d,debugLog:r(),readableSelectorToScrollDescr:t,scrollOffset:(0,_isomorphic_1.fromCssToDeviceNumber)(_,i)}}var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var o,r=1,t=arguments.length;r<t;r++){o=arguments[r];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},__assign.apply(this,arguments)},__createBinding=this&&this.__createBinding||(Object.create?function(e,o,r,t){t===undefined&&(t=r);var i=Object.getOwnPropertyDescriptor(o,r);i&&("get"in i?o.__esModule:!i.writable&&!i.configurable)||(i={enumerable:!0,get:function(){return o[r]}}),Object.defineProperty(e,t,i)}:function(e,o,r,t){t===undefined&&(t=r),e[t]=o[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,o){Object.defineProperty(e,"default",{enumerable:!0,value:o})}:function(e,o){e["default"]=o}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var o={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&__createBinding(o,e,r);return __setModuleDefault(o,e),o};exports.__esModule=!0,exports.captureAnchorBaseline=exports.cleanupScrolls=exports.cleanupPointerEvents=exports.disablePointerEvents=exports.cleanupFrameAnimations=exports.disableFrameAnimations=exports.prepareViewportScreenshot=exports.scrollFullPage=exports.prepareFullPageScreenshot=exports.getCaptureState=exports.scrollTo=exports.scrollBy=exports.prepareElementsScreenshot=void 0;var _isomorphic_1=require("/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js"),lib=__importStar(require("./../shared/lib.native.js")),logger_1=require("../shared/logger"),operations_1=require("./operations"),descriptions_1=require("./utils/descriptions"),dom_1=require("./utils/dom"),pseudo_element_rect_1=require("./utils/pseudo-element-rect"),scroll_1=require("./utils/scroll"),MIN_ANCHOR_SAMPLE_SIZE=3,MAX_ANCHOR_TRACKED_ELEMENTS=500,ANCHOR_SHIFT_TOLERANCE_CSS=1.5;exports.prepareElementsScreenshot=prepareElementsScreenshot,exports.scrollBy=scrollBy,exports.scrollTo=scrollTo,exports.getCaptureState=getCaptureState,exports.prepareFullPageScreenshot=prepareFullPageScreenshot,exports.scrollFullPage=scrollFullPage,exports.prepareViewportScreenshot=prepareViewportScreenshot,exports.disableFrameAnimations=disableFrameAnimations,exports.cleanupFrameAnimations=cleanupFrameAnimations,exports.disablePointerEvents=disablePointerEvents,exports.cleanupPointerEvents=cleanupPointerEvents,exports.cleanupScrolls=cleanupScrolls,exports.captureAnchorBaseline=captureAnchorBaseline;
5
+ },{"../shared/logger":15,"./../shared/lib.native.js":14,"./operations":4,"./utils/descriptions":6,"./utils/dom":7,"./utils/pseudo-element-rect":9,"./utils/scroll":10,"/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js":19}],3:[function(require,module,exports){
6
6
  "use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,i,n){n===undefined&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&("get"in r?t.__esModule:!r.writable&&!r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){n===undefined&&(n=i),e[n]=t[i]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e["default"]=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)"default"!==i&&Object.prototype.hasOwnProperty.call(e,i)&&__createBinding(t,e,i);return __setModuleDefault(t,e),t};exports.__esModule=!0;var implementation=__importStar(require("./implementation")),globalObj="undefined"==typeof window?globalThis:window;globalObj.__geminiCore||(globalObj.__geminiCore={}),globalObj.__geminiCore[__geminiNamespace]=implementation;
7
7
  },{"./implementation":2}],4:[function(require,module,exports){
8
- "use strict";function computeScrollOffset(e){return(0,scroll_1.isRootLikeElement)(e)?window.scrollY:e.scrollTop}function computeViewportSize(){var e=window.visualViewport;return e&&e.width>0&&e.height>0?{width:e.width,height:e.height}:{width:window.innerWidth,height:window.innerHeight}}function computeViewportOffset(){return{left:window.scrollX,top:window.scrollY}}function getProbeAxisCoordinates(e,t){var o=Math.max(1,Math.floor(e));if(t<=1)return[0];for(var r=o-1,n=o/(t-1),i=[],l=0;l<t;l++)i.push(Math.min(r,Math.round(l*n)));return i}function computeElementPositionsProbe(e){void 0===e&&(e=ELEMENT_POSITIONS_PROBE_GRID_SIZE);for(var t=computeViewportSize(),o=getProbeAxisCoordinates(t.width,e),r=getProbeAxisCoordinates(t.height,e),n=[],i=0;i<r.length;i++)for(var l=0;l<o.length;l++){var s=o[l],a=r[i],c=document.elementFromPoint(s,a);c?n.push(__assign(__assign({},(0,_isomorphic_1.fromBcrToRect)(c.getBoundingClientRect())),{elementDescr:(0,descriptions_1.getReadableElementDescriptor)(c)})):n.push(null)}return n}function computeCaptureSpecs(e,t){if(0===e.length)throw new Error("No selectors to compute capture area");null===t||void 0===t||t("========== <computeCaptureSpecs> =========="),null===t||void 0===t||t("selectors:",e);for(var o=performance.now(),r=[],n=0;n<e.length;n++){var i=(0,pseudo_element_rect_1.parseCaptureSelector)(e[n]),l=document.querySelector(i.elementSelector);l&&r.push({element:l,pseudoElement:i.pseudoElement})}for(var s=[],a=0,c=r;a<c.length;a++){var u=c[a],l=u.element,p=u.pseudoElement,m=function(e,o){var r,n=o?(0,element_rect_1.getPseudoElementCaptureRect)(e,o):(0,element_rect_1.getElementCaptureRect)(e,t);if(!n)return null;var i=(0,clip_rect_1.getClipRect)(e,t);return{full:n,visible:null!==(r=(0,_isomorphic_1.getIntersection)(n,i))&&void 0!==r?r:{top:n.top,left:n.left,width:0,height:0},clip:i}}(l,p);m&&s.push(m)}return null===t||void 0===t||t("captureSpecs:",s),null===t||void 0===t||t("computeCaptureSpecs time taken:",(performance.now()-o).toFixed(1)+"ms"),null===t||void 0===t||t("========== </computeCaptureSpecs> =========="),s}function computeIgnoreAreas(e){void 0===e&&(e=[]);for(var t=[],o=0;o<e.length;o++)for(var r=(0,pseudo_element_rect_1.parseCaptureSelector)(e[o]),n=document.querySelectorAll(r.elementSelector),i=0;i<n.length;i++){var l=r.pseudoElement?(0,element_rect_1.getPseudoElementCaptureRect)(n[i],r.pseudoElement):(0,element_rect_1.getElementCaptureRect)(n[i]);null!==l&&t.push(l)}return t}function computeSafeArea(e,t,o){var r,n;null===o||void 0===o||o("========== <computeSafeArea> ==========");var i=performance.now(),l=computeViewportSize(),s={left:0,top:0,width:l.width,height:l.height},a=e.map(function(e){return document.querySelector((0,pseudo_element_rect_1.parseCaptureSelector)(e).elementSelector)}).filter(function(e){return null!==e}),c=computeCaptureSpecs(e).map(function(e){return e.full});if(0===c.length)return{top:s.top,height:s.height};var u,p=null!==t&&void 0!==t?t:document.documentElement;if(p===document.documentElement)null===o||void 0===o||o("setting base safe area to viewport rect"),u=__assign({},s);else{var m=(0,element_rect_1.getBoundingClientContentRect)(p);null===o||void 0===o||o("setting base safe area to visible part of scroll container:",(0,descriptions_1.getReadableElementDescriptor)(p),"contentRect:",m),u=null!==(r=(0,_isomorphic_1.getIntersection)(m,s))&&void 0!==r?r:__assign({},s);var d=(0,element_rect_1.getVerticalRadiusInsets)(p),f=d.top,h=d.bottom;if(f>0||h>0){var _=u.height,g=Math.min(f,_),v=Math.min(h,_-g);null===o||void 0===o||o("applying radius insets to safe area:",{topInset:g,bottomInset:v}),u=__assign(__assign({},u),{top:u.top+g,height:_-g-v})}}var S=__assign({},u);if(a.every(function(e){return"fixed"===getComputedStyle(e).position||null!==(0,dom_1.findFixedPositionedParent)(e)&&null===(0,scroll_1.getScrollParent)(e)}))return null===o||void 0===o||o("all capture elements are fixed or inside non-scrollable fixed subtree, skipping interferences"),{top:S.top,height:S.height};for(var w=(0,_isomorphic_1.getCoveringRect)(c),E=a.map(function(e){return(0,z_index_1.buildZChain)(e)}),C=w.left,P=C+w.width,x=[],b=document.documentElement.querySelectorAll("*"),y=1===a.length?a[0]:null,A=0;A<b.length;A++)!function(e){var t=b[e];if(p===t||t.contains(p))return"continue";if(y&&(t===y||t.contains(y)))return"continue";var r=getComputedStyle(t),i=r.position,l=t.getBoundingClientRect();if(l.width<1||l.height<1||1===l.width&&1===l.height||"hidden"===r.visibility||"none"===r.display||parseFloat(r.opacity)<1e-4||/opacity\(\s*0(?:\.0+)?%?\s*\)/.test(r.filter))return"continue";if(l.right<=C||l.left>=P)return"continue";if(null===(0,_isomorphic_1.getIntersection)((0,_isomorphic_1.fromBcrToRect)(l),s))return"continue";var c=!1,m=!1,d=(0,element_rect_1.domRectToViewportCss)(l),f=(0,dom_1.findFixedPositionedParent)(t),h=null!==f&&(f===p||f.contains(p));if("fixed"===i||f&&!h)c=!0,m=a.some(function(e){return e.contains(t)});else if("absolute"===i){if(a.some(function(e){return e.contains(t)}))return"continue";var _=(0,dom_1.findContainingBlock)(t);p===document.documentElement||p.contains(_)||(c=!0)}else if("sticky"===i){var g=parseFloat(r.top),v=parseFloat(r.bottom),S=null!==(n=(0,scroll_1.getScrollParent)(t))&&void 0!==n?n:document.documentElement;null===o||void 0===o||o("scrollParent:",(0,descriptions_1.getReadableElementDescriptor)(S));var w=S.getBoundingClientRect();if(g+=(0,scroll_1.isRootLikeElement)(S)?0:w.top,m=a.some(function(e){return e===t||e.contains(t)})&&(S===p||(0,scroll_1.isRootLikeElement)(S)&&(0,scroll_1.isRootLikeElement)(p)),isNaN(g)){if(!isNaN(v)){var A=p===document.documentElement,T=A?s.height:u.top+u.height;d={left:l.left,top:T-v-l.height,width:l.width,height:l.height},c=!0}}else d={left:l.left,top:g,width:l.width,height:l.height},c=!0}if(!c)return"continue";var R=(0,z_index_1.buildZChain)(t);if(m||!E.every(function(e){return(0,z_index_1.isChainBehind)(R,e)})){var I=(0,element_rect_1.getExtRect)(r,d),N=I.left;if(N+I.width<=C||N>=P)return"continue";x.push({element:t,rect:I})}}(A);for(var T=u.top,R=u.height,I=S.height,N=0,D=x;N<D.length;N++){var O=D[N];null===o||void 0===o||o("processing interference:",{element:(0,descriptions_1.getReadableElementDescriptor)(O.element),rect:O.rect});var q=O.rect,M=(0,_isomorphic_1.getBottom)({top:T,height:R}),k=(0,_isomorphic_1.getBottom)(q),B=k-T,F=M-q.top,V=T,z=R;B<F?(V=Math.max(k,T),z=Math.max(0,M-V),null===o||void 0===o||o("decided to shrink top")):F&&(z=Math.min(R,q.top-T),null===o||void 0===o||o("decided to shrink bottom")),z<.3*I?null===o||void 0===o||o("decided to skip, because shrinking is too large"):(null===o||void 0===o||o("resulting safe area top:",V,"resulting safe area height:",z),T=V,R=z)}R<.3*I&&(T=S.top,R=S.height),(0,user_agent_1.isSafariMobile)()&&l.height-(T+R)<40&&(R-=40);var L={top:T,height:R};return null===o||void 0===o||o("final safe area:",L),null===o||void 0===o||o("computeSafeArea time taken:",(performance.now()-i).toFixed(1)+"ms"),null===o||void 0===o||o("========== </computeSafeArea> =========="),L}function computeDocumentSize(){var e=(0,dom_1.getMainDocumentElem)();return{width:e.scrollWidth,height:e.scrollHeight}}function computeCanHaveCaret(){var e=document.activeElement;return e instanceof HTMLElement&&(/^(input|textarea)$/i.test(e.tagName)||e.isContentEditable)}function computePixelRatio(e){return void 0===e&&(e=!0),!1===e?1:window.devicePixelRatio?window.devicePixelRatio:window.screen.deviceXDPI/window.screen.logicalXDPI||1}function scrollToCaptureAreaIfNeeded(e,t,o,r,n){var i=computeViewportSize(),l=__assign({top:0,left:0},i),s=computeCaptureSpecs(e);if(!s)return{};var a=r?document.querySelector(r):null,c=e.map(function(e){return(0,pseudo_element_rect_1.parseCaptureSelector)(e).elementSelector}),u=null!==a&&void 0!==a?a:(0,scroll_1.getCommonScrollParent)(c),p=null!==r&&void 0!==r?r:(0,descriptions_1.getReadableElementDescriptor)(u),m=(0,_isomorphic_1.getCoveringRect)(s.map(function(e){return e.full})),d=computeSafeArea(e,u,n),f=(0,_isomorphic_1.getIntersection)(m,d),h=(0,_isomorphic_1.getIntersection)(m,l),_=Math.min(m.height,d.height),g=!f||f.height<_/2,v=m.top>=d.top;if(null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: intersection check",{captureArea:m,safeArea:d,viewport:l,hasViewportIntersection:Boolean(h),hasSafeAreaIntersection:Boolean(f),isIntersectionWithSafeAreaTooSmall:g,captureElementFromTop:Boolean(t)}),!t&&!h)throw null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: throwing OutsideOfViewportError because captureElementFromTop is disabled and target is outside viewport"),new outside_of_viewport_1.OutsideOfViewportError;if((!t||!g)&&v)return null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: skipping scroll",{reason:t?"target already has enough safe area visibility":"captureElementFromTop is disabled"}),{};if(!t&&o)return null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: skipping scroll because allowViewportOverflow is true and captureElementFromTop is false"),{};null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: scrolling is required",{scrollElement:p,requestedSelectorToScroll:null!==r&&void 0!==r?r:null,selectorMatched:Boolean(a)});var S=__spreadArray([],(0,scroll_1.getScrollParentsChain)(u),!0);S[S.length-1]!==u&&S.push(u);for(var w=1;w<S.length;w++){var E=computeSafeArea(e,S[w-1]),C=S[w].getBoundingClientRect().top,P=C-E.top;null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: scrolling chain element",{scrollElement:(0,descriptions_1.getReadableElementDescriptor)(S[w-1]),childElement:(0,descriptions_1.getReadableElementDescriptor)(S[w]),scrollDelta:P}),(0,scroll_1.scrollElementBy)(S[w-1],P,n)}var x=(0,_isomorphic_1.getCoveringRect)(computeCaptureSpecs(e).map(function(e){return e.full}));if(!x)return{};var b=computeSafeArea(e,u),y=x.top-b.top;return null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: final alignment scroll",{scrollElement:p,finalScrollDelta:y}),(0,scroll_1.scrollElementBy)(u,y,n),{readableSelectorToScrollDescr:p}}function saveElementScrollPosition(e){var t=(0,dom_1.getScreenshooterNamespaceData)();if(t.savedScrollPositions||(t.savedScrollPositions=[]),!t.savedScrollPositions.some(function(t){return t.element===e})){var o=(0,scroll_1.isRootLikeElement)(e)?{element:e,left:window.scrollX,top:window.scrollY}:{element:e,left:e.scrollLeft,top:e.scrollTop};t.savedScrollPositions.push(o)}}function saveScrollPositions(e,t){(0,dom_1.getScreenshooterNamespaceData)().savedScrollPositions=[];var o=t?document.querySelector(t):null,r=e.map(function(e){return(0,pseudo_element_rect_1.parseCaptureSelector)(e).elementSelector}),n=null!==o&&void 0!==o?o:(0,scroll_1.getCommonScrollParent)(r),i=__spreadArray([],(0,scroll_1.getScrollParentsChain)(n),!0);i[i.length-1]!==n&&i.push(n);for(var l=0,s=i;l<s.length;l++){saveElementScrollPosition(s[l])}}function prepareFullPageScrollCleanup(){(0,dom_1.getScreenshooterNamespaceData)().savedScrollPositions=[],saveElementScrollPosition(document.documentElement)}function restoreScrollPosition(e){if((0,scroll_1.isRootLikeElement)(e.element))return(0,scroll_1.performScrollFixForSafariIfNeeded)(e.top),void window.scrollTo(e.left,e.top);var t=e.element;if("function"==typeof t.scrollTo)return void t.scrollTo(e.left,e.top);"number"==typeof t.scrollLeft&&(t.scrollLeft=e.left),"number"==typeof t.scrollTop&&(t.scrollTop=e.top)}function cleanupSavedScrolls(){var e;try{var t=(0,dom_1.getScreenshooterNamespaceData)(),o=null!==(e=t.savedScrollPositions)&&void 0!==e?e:[];t.savedScrollPositions=[];for(var r=0,n=o;r<n.length;r++){var i=n[r];try{restoreScrollPosition(i)}catch(l){}}}catch(l){}}function disableAnimations(){function e(e){var r=document.createElement("style");r.innerHTML=t+["{"," animation-delay: 0ms !important;"," animation-duration: 0ms !important;"," animation-timing-function: step-start !important;"," transition-timing-function: step-start !important;"," scroll-behavior: auto !important;"," transition: none !important;","}"].join("\n"),e.appendChild(r),o.push(r)}var t=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),o=[];(0,dom_1.forEachRoot)(function(t){try{e(t)}catch(o){if(!o||!o.message||-1===o.message.indexOf("This document requires 'TrustedHTML' assignment"))throw o;(0,trusted_types_1.createDefaultTrustedTypesPolicy)(),e(t)}}),window.__cleanupAnimation=function(){for(var e=0;e<o.length;e++)o[e].parentNode.removeChild(o[e]);delete window.__cleanupAnimation}}function disablePointerEvents(){function e(e){var r=document.createElement("style");r.innerHTML=t+["{"," pointer-events: none !important;","}"].join("\n"),e.appendChild(r),o.push(r)}var t=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),o=[];(0,dom_1.forEachRoot)(function(t){try{e(t)}catch(o){if(!o||!o.message||-1===o.message.indexOf("This document requires 'TrustedHTML' assignment"))throw o;(0,trusted_types_1.createDefaultTrustedTypesPolicy)(),e(t)}}),(0,dom_1.getScreenshooterNamespaceData)().cleanupPointerEventsCb=function(){for(var e=0;e<o.length;e++)o[e].parentNode.removeChild(o[e])}}var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},__assign.apply(this,arguments)},__spreadArray=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))};exports.__esModule=!0,exports.disablePointerEvents=exports.disableAnimations=exports.cleanupSavedScrolls=exports.prepareFullPageScrollCleanup=exports.saveScrollPositions=exports.scrollToCaptureAreaIfNeeded=exports.computePixelRatio=exports.computeCanHaveCaret=exports.computeDocumentSize=exports.computeSafeArea=exports.computeIgnoreAreas=exports.computeCaptureSpecs=exports.computeElementPositionsProbe=exports.computeViewportOffset=exports.computeViewportSize=exports.computeScrollOffset=void 0;var _isomorphic_1=require("/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js"),outside_of_viewport_1=require("./errors/outside-of-viewport"),descriptions_1=require("./utils/descriptions"),dom_1=require("./utils/dom"),element_rect_1=require("./utils/element-rect"),clip_rect_1=require("./utils/clip-rect"),scroll_1=require("./utils/scroll"),trusted_types_1=require("./utils/trusted-types"),z_index_1=require("./utils/z-index"),pseudo_element_rect_1=require("./utils/pseudo-element-rect"),user_agent_1=require("./utils/user-agent");exports.computeScrollOffset=computeScrollOffset,exports.computeViewportSize=computeViewportSize,exports.computeViewportOffset=computeViewportOffset;var ELEMENT_POSITIONS_PROBE_GRID_SIZE=5;exports.computeElementPositionsProbe=computeElementPositionsProbe,exports.computeCaptureSpecs=computeCaptureSpecs,exports.computeIgnoreAreas=computeIgnoreAreas,exports.computeSafeArea=computeSafeArea,exports.computeDocumentSize=computeDocumentSize,exports.computeCanHaveCaret=computeCanHaveCaret,exports.computePixelRatio=computePixelRatio,exports.scrollToCaptureAreaIfNeeded=scrollToCaptureAreaIfNeeded,exports.saveScrollPositions=saveScrollPositions,exports.prepareFullPageScrollCleanup=prepareFullPageScrollCleanup,exports.cleanupSavedScrolls=cleanupSavedScrolls,exports.disableAnimations=disableAnimations,exports.disablePointerEvents=disablePointerEvents;
9
- },{"./errors/outside-of-viewport":1,"./utils/clip-rect":5,"./utils/descriptions":6,"./utils/dom":7,"./utils/element-rect":8,"./utils/pseudo-element-rect":9,"./utils/scroll":10,"./utils/trusted-types":11,"./utils/user-agent":12,"./utils/z-index":13,"/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js":19}],5:[function(require,module,exports){
8
+ "use strict";function computeScrollOffset(e){return(0,scroll_1.isRootLikeElement)(e)?window.scrollY:e.scrollTop}function computeViewportSize(){var e=window.visualViewport;return e&&e.width>0&&e.height>0?{width:e.width,height:e.height}:{width:window.innerWidth,height:window.innerHeight}}function computeViewportOffset(){return{left:window.scrollX,top:window.scrollY}}function getProbeAxisCoordinates(e,t){var o=Math.max(1,Math.floor(e));if(t<=1)return[0];for(var r=o-1,n=o/(t-1),i=[],l=0;l<t;l++)i.push(Math.min(r,Math.round(l*n)));return i}function computeElementPositionsProbe(e){void 0===e&&(e=ELEMENT_POSITIONS_PROBE_GRID_SIZE);for(var t=computeViewportSize(),o=getProbeAxisCoordinates(t.width,e),r=getProbeAxisCoordinates(t.height,e),n=[],i=0;i<r.length;i++)for(var l=0;l<o.length;l++){var s=o[l],a=r[i],c=document.elementFromPoint(s,a);c?n.push(__assign(__assign({},(0,_isomorphic_1.fromBcrToRect)(c.getBoundingClientRect())),{elementDescr:(0,descriptions_1.getReadableElementDescriptor)(c)})):n.push(null)}return n}function computeCaptureSpecs(e,t){if(0===e.length)throw new Error("No targets to compute capture area");null===t||void 0===t||t("========== <computeCaptureSpecs> =========="),null===t||void 0===t||t("targets:",e);for(var o=performance.now(),r=[],n=0;n<e.length;n++){var i=(0,pseudo_element_rect_1.parseCaptureTarget)(e[n]),l=lib.queryFirst(i.elementTarget);l&&r.push({element:l,pseudoElement:i.pseudoElement})}for(var s=[],a=0,c=r;a<c.length;a++){var u=c[a],l=u.element,p=u.pseudoElement,d=function(e,o){var r,n=o?(0,element_rect_1.getPseudoElementCaptureRect)(e,o):(0,element_rect_1.getElementCaptureRect)(e,t);if(!n)return null;var i=(0,clip_rect_1.getClipRect)(e,t);return{full:n,visible:null!==(r=(0,_isomorphic_1.getIntersection)(n,i))&&void 0!==r?r:{top:n.top,left:n.left,width:0,height:0},clip:i}}(l,p);d&&s.push(d)}return null===t||void 0===t||t("captureSpecs:",s),null===t||void 0===t||t("computeCaptureSpecs time taken:",(performance.now()-o).toFixed(1)+"ms"),null===t||void 0===t||t("========== </computeCaptureSpecs> =========="),s}function computeIgnoreAreas(e){void 0===e&&(e=[]);for(var t=[],o=0;o<e.length;o++)for(var r=(0,pseudo_element_rect_1.parseCaptureTarget)(e[o]),n=lib.queryAll(r.elementTarget),i=0;i<n.length;i++){var l=r.pseudoElement?(0,element_rect_1.getPseudoElementCaptureRect)(n[i],r.pseudoElement):(0,element_rect_1.getElementCaptureRect)(n[i]);null!==l&&t.push(l)}return t}function computeSafeArea(e,t,o){var r,n;null===o||void 0===o||o("========== <computeSafeArea> ==========");var i=performance.now(),l=computeViewportSize(),s={left:0,top:0,width:l.width,height:l.height},a=e.map(function(e){return lib.queryFirst((0,pseudo_element_rect_1.parseCaptureTarget)(e).elementTarget)}).filter(function(e){return null!==e}),c=computeCaptureSpecs(e).map(function(e){return e.full});if(0===c.length)return{top:s.top,height:s.height};var u,p=null!==t&&void 0!==t?t:document.documentElement;if(p===document.documentElement)null===o||void 0===o||o("setting base safe area to viewport rect"),u=__assign({},s);else{var d=(0,element_rect_1.getBoundingClientContentRect)(p);null===o||void 0===o||o("setting base safe area to visible part of scroll container:",(0,descriptions_1.getReadableElementDescriptor)(p),"contentRect:",d),u=null!==(r=(0,_isomorphic_1.getIntersection)(d,s))&&void 0!==r?r:__assign({},s);var m=(0,element_rect_1.getVerticalRadiusInsets)(p),f=m.top,h=m.bottom;if(f>0||h>0){var _=u.height,g=Math.min(f,_),v=Math.min(h,_-g);null===o||void 0===o||o("applying radius insets to safe area:",{topInset:g,bottomInset:v}),u=__assign(__assign({},u),{top:u.top+g,height:_-g-v})}}var S=__assign({},u);if(a.every(function(e){return"fixed"===getComputedStyle(e).position||null!==(0,dom_1.findFixedPositionedParent)(e)&&null===(0,scroll_1.getScrollParent)(e)}))return null===o||void 0===o||o("all capture elements are fixed or inside non-scrollable fixed subtree, skipping interferences"),{top:S.top,height:S.height};for(var w=(0,_isomorphic_1.getCoveringRect)(c),E=a.map(function(e){return(0,z_index_1.buildZChain)(e)}),b=w.left,C=b+w.width,P=[],x=document.documentElement.querySelectorAll("*"),y=1===a.length?a[0]:null,T=0;T<x.length;T++)!function(e){var t=x[e];if(p===t||t.contains(p))return"continue";if(y&&(t===y||t.contains(y)))return"continue";var r=getComputedStyle(t),i=r.position,l=t.getBoundingClientRect();if(l.width<1||l.height<1||1===l.width&&1===l.height||"hidden"===r.visibility||"none"===r.display||parseFloat(r.opacity)<1e-4||/opacity\(\s*0(?:\.0+)?%?\s*\)/.test(r.filter))return"continue";if(l.right<=b||l.left>=C)return"continue";if(null===(0,_isomorphic_1.getIntersection)((0,_isomorphic_1.fromBcrToRect)(l),s))return"continue";var c=!1,d=!1,m=(0,element_rect_1.domRectToViewportCss)(l),f=(0,dom_1.findFixedPositionedParent)(t),h=null!==f&&(f===p||f.contains(p));if("fixed"===i||f&&!h)c=!0,d=a.some(function(e){return e.contains(t)});else if("absolute"===i){if(a.some(function(e){return e.contains(t)}))return"continue";var _=(0,dom_1.findContainingBlock)(t);p===document.documentElement||p.contains(_)||(c=!0)}else if("sticky"===i){var g=parseFloat(r.top),v=parseFloat(r.bottom),S=null!==(n=(0,scroll_1.getScrollParent)(t))&&void 0!==n?n:document.documentElement;null===o||void 0===o||o("scrollParent:",(0,descriptions_1.getReadableElementDescriptor)(S));var w=S.getBoundingClientRect();if(g+=(0,scroll_1.isRootLikeElement)(S)?0:w.top,d=a.some(function(e){return e===t||e.contains(t)})&&(S===p||(0,scroll_1.isRootLikeElement)(S)&&(0,scroll_1.isRootLikeElement)(p)),isNaN(g)){if(!isNaN(v)){var T=p===document.documentElement,A=T?s.height:u.top+u.height;m={left:l.left,top:A-v-l.height,width:l.width,height:l.height},c=!0}}else m={left:l.left,top:g,width:l.width,height:l.height},c=!0}if(!c)return"continue";var R=(0,z_index_1.buildZChain)(t);if(d||!E.every(function(e){return(0,z_index_1.isChainBehind)(R,e)})){var I=(0,element_rect_1.getExtRect)(r,m),O=I.left;if(O+I.width<=b||O>=C)return"continue";P.push({element:t,rect:I})}}(T);for(var A=u.top,R=u.height,I=S.height,O=0,D=P;O<D.length;O++){var N=D[O];null===o||void 0===o||o("processing interference:",{element:(0,descriptions_1.getReadableElementDescriptor)(N.element),rect:N.rect});var M=N.rect,q=(0,_isomorphic_1.getBottom)({top:A,height:R}),B=(0,_isomorphic_1.getBottom)(M),F=B-A,k=q-M.top,V=A,z=R;F<k?(V=Math.max(B,A),z=Math.max(0,q-V),null===o||void 0===o||o("decided to shrink top")):k&&(z=Math.min(R,M.top-A),null===o||void 0===o||o("decided to shrink bottom")),z<.3*I?null===o||void 0===o||o("decided to skip, because shrinking is too large"):(null===o||void 0===o||o("resulting safe area top:",V,"resulting safe area height:",z),A=V,R=z)}R<.3*I&&(A=S.top,R=S.height),(0,user_agent_1.isSafariMobile)()&&l.height-(A+R)<40&&(R-=40);var L={top:A,height:R};return null===o||void 0===o||o("final safe area:",L),null===o||void 0===o||o("computeSafeArea time taken:",(performance.now()-i).toFixed(1)+"ms"),null===o||void 0===o||o("========== </computeSafeArea> =========="),L}function computeDocumentSize(){var e=(0,dom_1.getMainDocumentElem)();return{width:e.scrollWidth,height:e.scrollHeight}}function computeCanHaveCaret(){var e=document.activeElement;return e instanceof HTMLElement&&(/^(input|textarea)$/i.test(e.tagName)||e.isContentEditable)}function computePixelRatio(e){return void 0===e&&(e=!0),!1===e?1:window.devicePixelRatio?window.devicePixelRatio:window.screen.deviceXDPI/window.screen.logicalXDPI||1}function scrollToCaptureAreaIfNeeded(e,t,o,r,n){var i=computeViewportSize(),l=__assign({top:0,left:0},i),s=computeCaptureSpecs(e);if(!s)return{};var a=r?lib.queryFirst(r):null,c=null!==a&&void 0!==a?a:(0,scroll_1.getCommonScrollParent)(e),u="string"==typeof r?r:(0,descriptions_1.getReadableElementDescriptor)(null!==a&&void 0!==a?a:c),p=(0,_isomorphic_1.getCoveringRect)(s.map(function(e){return e.full})),d=computeSafeArea(e,c,n),m=(0,_isomorphic_1.getIntersection)(p,d),f=(0,_isomorphic_1.getIntersection)(p,l),h=Math.min(p.height,d.height),_=!m||m.height<h/2,g=p.top>=d.top;if(null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: intersection check",{captureArea:p,safeArea:d,viewport:l,hasViewportIntersection:Boolean(f),hasSafeAreaIntersection:Boolean(m),isIntersectionWithSafeAreaTooSmall:_,captureElementFromTop:Boolean(t)}),!t&&!f)throw null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: throwing OutsideOfViewportError because captureElementFromTop is disabled and target is outside viewport"),new outside_of_viewport_1.OutsideOfViewportError;if((!t||!_)&&g)return null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: skipping scroll",{reason:t?"target already has enough safe area visibility":"captureElementFromTop is disabled"}),{};if(!t&&o)return null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: skipping scroll because allowViewportOverflow is true and captureElementFromTop is false"),{};null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: scrolling is required",{scrollElement:u,requestedTargetToScroll:null!==r&&void 0!==r?r:null,targetResolved:Boolean(a)});var v=__spreadArray([],(0,scroll_1.getScrollParentsChain)(c),!0);v[v.length-1]!==c&&v.push(c);for(var S=1;S<v.length;S++){var w=computeSafeArea(e,v[S-1]),E=v[S].getBoundingClientRect().top,b=E-w.top;null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: scrolling chain element",{scrollElement:(0,descriptions_1.getReadableElementDescriptor)(v[S-1]),childElement:(0,descriptions_1.getReadableElementDescriptor)(v[S]),scrollDelta:b}),(0,scroll_1.scrollElementBy)(v[S-1],b,n)}var C=(0,_isomorphic_1.getCoveringRect)(computeCaptureSpecs(e).map(function(e){return e.full}));if(!C)return{};var P=computeSafeArea(e,c),x=C.top-P.top;return null===n||void 0===n||n("scrollToCaptureAreaIfNeeded: final alignment scroll",{scrollElement:u,finalScrollDelta:x}),(0,scroll_1.scrollElementBy)(c,x,n),{readableSelectorToScrollDescr:u}}function saveElementScrollPosition(e){var t=(0,dom_1.getScreenshooterNamespaceData)();if(t.savedScrollPositions||(t.savedScrollPositions=[]),!t.savedScrollPositions.some(function(t){return t.element===e})){var o=(0,scroll_1.isRootLikeElement)(e)?{element:e,left:window.scrollX,top:window.scrollY}:{element:e,left:e.scrollLeft,top:e.scrollTop};t.savedScrollPositions.push(o)}}function saveScrollPositions(e,t){(0,dom_1.getScreenshooterNamespaceData)().savedScrollPositions=[];var o=t?lib.queryFirst(t):null,r=null!==o&&void 0!==o?o:(0,scroll_1.getCommonScrollParent)(e),n=__spreadArray([],(0,scroll_1.getScrollParentsChain)(r),!0);n[n.length-1]!==r&&n.push(r);for(var i=0,l=n;i<l.length;i++){saveElementScrollPosition(l[i])}}function prepareFullPageScrollCleanup(){(0,dom_1.getScreenshooterNamespaceData)().savedScrollPositions=[],saveElementScrollPosition(document.documentElement)}function restoreScrollPosition(e){if((0,scroll_1.isRootLikeElement)(e.element))return(0,scroll_1.performScrollFixForSafariIfNeeded)(e.top),void window.scrollTo(e.left,e.top);var t=e.element;if("function"==typeof t.scrollTo)return void t.scrollTo(e.left,e.top);"number"==typeof t.scrollLeft&&(t.scrollLeft=e.left),"number"==typeof t.scrollTop&&(t.scrollTop=e.top)}function cleanupSavedScrolls(){var e;try{var t=(0,dom_1.getScreenshooterNamespaceData)(),o=null!==(e=t.savedScrollPositions)&&void 0!==e?e:[];t.savedScrollPositions=[];for(var r=0,n=o;r<n.length;r++){var i=n[r];try{restoreScrollPosition(i)}catch(l){}}}catch(l){}}function disableAnimations(){function e(e){var r=document.createElement("style");r.innerHTML=t+["{"," animation-delay: 0ms !important;"," animation-duration: 0ms !important;"," animation-timing-function: step-start !important;"," transition-timing-function: step-start !important;"," scroll-behavior: auto !important;"," transition: none !important;","}"].join("\n"),e.appendChild(r),o.push(r)}var t=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),o=[];(0,dom_1.forEachRoot)(function(t){try{e(t)}catch(o){if(!o||!o.message||-1===o.message.indexOf("This document requires 'TrustedHTML' assignment"))throw o;(0,trusted_types_1.createDefaultTrustedTypesPolicy)(),e(t)}}),window.__cleanupAnimation=function(){for(var e=0;e<o.length;e++)o[e].parentNode.removeChild(o[e]);delete window.__cleanupAnimation}}function disablePointerEvents(){function e(e){var r=document.createElement("style");r.innerHTML=t+["{"," pointer-events: none !important;","}"].join("\n"),e.appendChild(r),o.push(r)}var t=["","::before","::after"].map(function(e){return"*:not(#testplane-q.testplane-w.testplane-e.testplane-r.testplane-t.testplane-y)"+e}).join(", "),o=[];(0,dom_1.forEachRoot)(function(t){try{e(t)}catch(o){if(!o||!o.message||-1===o.message.indexOf("This document requires 'TrustedHTML' assignment"))throw o;(0,trusted_types_1.createDefaultTrustedTypesPolicy)(),e(t)}}),(0,dom_1.getScreenshooterNamespaceData)().cleanupPointerEventsCb=function(){for(var e=0;e<o.length;e++)o[e].parentNode.removeChild(o[e])}}var __assign=this&&this.__assign||function(){return __assign=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++){t=arguments[o];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},__assign.apply(this,arguments)},__createBinding=this&&this.__createBinding||(Object.create?function(e,t,o,r){r===undefined&&(r=o);var n=Object.getOwnPropertyDescriptor(t,o);n&&("get"in n?t.__esModule:!n.writable&&!n.configurable)||(n={enumerable:!0,get:function(){return t[o]}}),Object.defineProperty(e,r,n)}:function(e,t,o,r){r===undefined&&(r=o),e[r]=t[o]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e["default"]=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var o in e)"default"!==o&&Object.prototype.hasOwnProperty.call(e,o)&&__createBinding(t,e,o);return __setModuleDefault(t,e),t},__spreadArray=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var r,n=0,i=t.length;n<i;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))};exports.__esModule=!0,exports.disablePointerEvents=exports.disableAnimations=exports.cleanupSavedScrolls=exports.prepareFullPageScrollCleanup=exports.saveScrollPositions=exports.scrollToCaptureAreaIfNeeded=exports.computePixelRatio=exports.computeCanHaveCaret=exports.computeDocumentSize=exports.computeSafeArea=exports.computeIgnoreAreas=exports.computeCaptureSpecs=exports.computeElementPositionsProbe=exports.computeViewportOffset=exports.computeViewportSize=exports.computeScrollOffset=void 0;var _isomorphic_1=require("/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js"),lib=__importStar(require("./../shared/lib.native.js")),outside_of_viewport_1=require("./errors/outside-of-viewport"),descriptions_1=require("./utils/descriptions"),dom_1=require("./utils/dom"),element_rect_1=require("./utils/element-rect"),clip_rect_1=require("./utils/clip-rect"),scroll_1=require("./utils/scroll"),trusted_types_1=require("./utils/trusted-types"),z_index_1=require("./utils/z-index"),pseudo_element_rect_1=require("./utils/pseudo-element-rect"),user_agent_1=require("./utils/user-agent");exports.computeScrollOffset=computeScrollOffset,exports.computeViewportSize=computeViewportSize,exports.computeViewportOffset=computeViewportOffset;var ELEMENT_POSITIONS_PROBE_GRID_SIZE=5;exports.computeElementPositionsProbe=computeElementPositionsProbe,exports.computeCaptureSpecs=computeCaptureSpecs,exports.computeIgnoreAreas=computeIgnoreAreas,exports.computeSafeArea=computeSafeArea,exports.computeDocumentSize=computeDocumentSize,exports.computeCanHaveCaret=computeCanHaveCaret,exports.computePixelRatio=computePixelRatio,exports.scrollToCaptureAreaIfNeeded=scrollToCaptureAreaIfNeeded,exports.saveScrollPositions=saveScrollPositions,exports.prepareFullPageScrollCleanup=prepareFullPageScrollCleanup,exports.cleanupSavedScrolls=cleanupSavedScrolls,exports.disableAnimations=disableAnimations,exports.disablePointerEvents=disablePointerEvents;
9
+ },{"./../shared/lib.native.js":14,"./errors/outside-of-viewport":1,"./utils/clip-rect":5,"./utils/descriptions":6,"./utils/dom":7,"./utils/element-rect":8,"./utils/pseudo-element-rect":9,"./utils/scroll":10,"./utils/trusted-types":11,"./utils/user-agent":12,"./utils/z-index":13,"/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js":19}],5:[function(require,module,exports){
10
10
  "use strict";function getViewportRect(){return{top:0,left:0,width:window.innerWidth,height:window.innerHeight}}function hasOverflowClipping(e){return"visible"!==e.overflow||"visible"!==e.overflowX||"visible"!==e.overflowY}function getAbsoluteContainingBlocks(e){for(var t=[],n=e;n&&!(0,scroll_1.isRootLikeElement)(n);){if("absolute"===getComputedStyle(n).position){var i=(0,dom_1.findContainingBlock)(n);t.push({absoluteAncestor:n,containingBlock:i})}n=n.parentElement}return t}function getFixedAncestors(e){for(var t=[],n=e;n&&!(0,scroll_1.isRootLikeElement)(n);)"fixed"===getComputedStyle(n).position&&t.push(n),n=n.parentElement;return t}function escapesOverflowClippingViaAbsoluteContainingBlocks(e,t){return t.some(function(t){var n=t.absoluteAncestor,i=t.containingBlock;return!(n===e||!e.contains(n))&&(i!==e&&i.contains(e))})}function escapesOverflowClippingViaFixedAncestors(e,t){return t.some(function(t){return t!==e&&e.contains(t)})}function getClipRect(e,t){for(var n=getViewportRect(),i=getAbsoluteContainingBlocks(e),o=getFixedAncestors(e),r=n,s=e.parentElement;s&&!(0,scroll_1.isRootLikeElement)(s);){if(hasOverflowClipping(getComputedStyle(s))){if(escapesOverflowClippingViaAbsoluteContainingBlocks(s,i)||escapesOverflowClippingViaFixedAncestors(s,o)){s=s.parentElement;continue}var l=(0,element_rect_1.getBoundingClientContentRect)(s);null===t||void 0===t||t("intersecting with:",(0,descriptions_1.getReadableElementDescriptor)(s),"contentBox:",l);var c=(0,_isomorphic_1.getIntersection)(r,l);if(!c)return null===t||void 0===t||t("no intersection found for:",(0,descriptions_1.getReadableElementDescriptor)(s)),{top:r.top,left:r.left,width:0,height:0};r=c}s=s.parentElement}return r}exports.__esModule=!0,exports.getClipRect=void 0;var _isomorphic_1=require("/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js"),element_rect_1=require("./element-rect"),scroll_1=require("./scroll"),dom_1=require("./dom"),descriptions_1=require("./descriptions");exports.getClipRect=getClipRect;
11
11
  },{"./descriptions":6,"./dom":7,"./element-rect":8,"./scroll":10,"/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js":19}],6:[function(require,module,exports){
12
12
  "use strict";function getReadableElementDescriptor(e){if(e===document.documentElement)return"html";var t=e.tagName.toLowerCase();if(e.id)return"".concat(t,"#").concat(e.id);if(e.classList.length){for(var r=[],s=0;s<e.classList.length;s++)r.push(e.classList[s]);return t+"."+r.join(".")}return t}exports.__esModule=!0,exports.getReadableElementDescriptor=void 0,exports.getReadableElementDescriptor=getReadableElementDescriptor;
@@ -15,17 +15,17 @@
15
15
  },{"./../../shared/lib.native.js":14}],8:[function(require,module,exports){
16
16
  "use strict";function domRectToViewportCss(t){return{top:t.top,left:t.left,width:t.width,height:t.height}}function getElementBorderWidths(t){var e=(0,dom_1.getOwnerWindow)(t)||window,o=e.getComputedStyle(t);return{top:parseFloat(o.borderTopWidth),left:parseFloat(o.borderLeftWidth)}}function getIframeContentOrigin(t){var e=getElementBorderWidths(t),o=t.getBoundingClientRect();return{top:o.top+e.top,left:o.left+e.left,width:o.width,height:o.height}}function getNestedBoundingClientRect(t,e){var o=(0,dom_1.getOwnerIframe)(t);if(null===o||(0,dom_1.getOwnerWindow)(o)===window)return null===e||void 0===e||e("getNestedBoundingClientRect ownerIframe is null or window, returning bounding rect untouched"),domRectToViewportCss(t.getBoundingClientRect());null===e||void 0===e||e("getNestedBoundingClientRect ownerIframe is not null or window, returning bounding rect with iframe origin");for(var r=domRectToViewportCss(t.getBoundingClientRect()),n=r.top,i=r.left,d=o;d;){var a=getIframeContentOrigin(d);if(n+=a.top,i+=a.left,(d=(0,dom_1.getOwnerIframe)(d))&&(0,dom_1.getOwnerWindow)(d)===window){var s=getIframeContentOrigin(d);n+=s.top,i+=s.left;break}}return{top:n,left:i,width:r.width,height:r.height}}function parseBoxShadow(t){for(var e=/[-+]?\d*\.?\d+px/g,o=[],r=0,n=(t||"").split(",");r<n.length;r++){var i=n[r],d=i.match(e);d&&o.push({offsetX:parseFloat(d[0]),offsetY:parseFloat(d[1])||0,blurRadius:parseFloat(d[2])||0,spreadRadius:parseFloat(d[3])||0,inset:-1!==i.indexOf("inset")})}return o}function calculateShadowExtent(t){for(var e={top:0,left:0,right:0,bottom:0},o=0,r=t;o<r.length;o++){var n=r[o];if(!n.inset){var i=n.spreadRadius+n.blurRadius;e.left=Math.min(n.offsetX-i,e.left),e.right=Math.max(n.offsetX+i,e.right),e.top=Math.min(n.offsetY-i,e.top),e.bottom=Math.max(n.offsetY+i,e.bottom)}}return e}function calculateShadowRect(t,e){var o=calculateShadowExtent(e);return{left:t.left+o.left,top:t.top+o.top,width:t.width-o.left+o.right,height:t.height-o.top+o.bottom}}function calculateOutlineRect(t,e){return{top:t.top-e,left:t.left-e,width:t.width+2*e,height:t.height+2*e}}function getExtRect(t,e){var o=parseBoxShadow(t.boxShadow),r=parseInt(t.outlineWidth,10),n=isNaN(r)||"none"===t.outlineStyle?0:r;return(0,_isomorphic_1.getCoveringRect)([calculateShadowRect(e,o),calculateOutlineRect(e,n)])}function isHidden(t,e){return"none"===t.display||"hidden"===t.visibility||parseFloat(t.opacity)<1e-4||e.width<1e-4||e.height<1e-4}function getBoundingClientContentRect(t){var e=getComputedStyle(t),o=t.getBoundingClientRect(),r=parseFloat(e.borderLeftWidth)||0,n=parseFloat(e.borderTopWidth)||0,i=parseFloat(e.borderRightWidth)||0,d=parseFloat(e.borderBottomWidth)||0;return{left:o.left+r,top:o.top+n,width:o.width-r-i,height:o.height-n-d}}function getElementCaptureRect(t,e){var o=getComputedStyle(t),r=getNestedBoundingClientRect(t,e);if(null===e||void 0===e||e("getElementCaptureRect clientRect:",r),isHidden(o,r))return null;for(var n=getExtRect(o,r),i=0,d=pseudo_element_rect_1.PSEUDO_ELEMENTS;i<d.length;i++){var a=d[i],s=getComputedStyle(t,a);n=(0,_isomorphic_1.getCoveringRect)([n,getExtRect(s,r)])}return n}function getPseudoElementCaptureRect(t,e){var o=getComputedStyle(t),r=getNestedBoundingClientRect(t);if(isHidden(o,r))return null;var n=(0,pseudo_element_rect_1.getPseudoElementRect)(t,e,r);return n?getExtRect(getComputedStyle(t,e),n):null}function parseBorderRadius(t){var e=t.trim().split(/\s+/),o=e[0],r=e[1],n=parseFloat(null!==r&&void 0!==r?r:o);return isNaN(n)?0:n}function getVerticalRadiusInsets(t){var e=getComputedStyle(t);return{top:Math.max(parseBorderRadius(e.borderTopLeftRadius),parseBorderRadius(e.borderTopRightRadius)),bottom:Math.max(parseBorderRadius(e.borderBottomLeftRadius),parseBorderRadius(e.borderBottomRightRadius))}}exports.__esModule=!0,exports.getVerticalRadiusInsets=exports.getPseudoElementCaptureRect=exports.getElementCaptureRect=exports.getBoundingClientContentRect=exports.getExtRect=exports.domRectToViewportCss=void 0;var _isomorphic_1=require("/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js"),dom_1=require("./dom"),pseudo_element_rect_1=require("./pseudo-element-rect");exports.domRectToViewportCss=domRectToViewportCss,exports.getExtRect=getExtRect,exports.getBoundingClientContentRect=getBoundingClientContentRect,exports.getElementCaptureRect=getElementCaptureRect,exports.getPseudoElementCaptureRect=getPseudoElementCaptureRect,exports.getVerticalRadiusInsets=getVerticalRadiusInsets;
17
17
  },{"./dom":7,"./pseudo-element-rect":9,"/home/runner/work/testplane/testplane/src/browser/client-scripts/screen-shooter/tsc-out/isomorphic/index.js":19}],9:[function(require,module,exports){
18
- "use strict";function parseCaptureSelector(t){var e=t.match(PSEUDO_SELECTOR_REGEXP);if(!e)return{elementSelector:t,pseudoElement:null};var r=e[1].trim();return r?{elementSelector:r,pseudoElement:e[2].toLowerCase()}:{elementSelector:t,pseudoElement:null}}function getElementBorderWidths(t){var e=getComputedStyle(t);return{top:parseFloat(e.borderTopWidth),left:parseFloat(e.borderLeftWidth)}}function parseLengthOrZero(t){var e=parseFloat(t);return isNaN(e)?0:e}function getElementContentBottom(t){var e=document.createRange();try{e.selectNodeContents(t);for(var r=e.getClientRects(),n=-Infinity,o=0;o<r.length;o++){var a=r[o];a.width<1e-4&&a.height<1e-4||(n=Math.max(n,a.bottom))}return n!==-Infinity?n:null}catch(i){return null}finally{"function"==typeof e.detach&&e.detach()}}function getContainingBlockPaddingEdge(t){for(var e=t.parentElement;e;){if("static"!==getComputedStyle(e).position){var r=e.getBoundingClientRect(),n=getElementBorderWidths(e);return{top:r.top+n.top,left:r.left+n.left}}e=e.parentElement}return null}function parseTransformMatrix(t){if(!t||"none"===t)return null;var e=t.match(/matrix\(([^)]+)\)/);if(e){var r=e[1].split(",").map(function(t){return parseFloat(t.trim())});return{a:r[0],b:r[1],c:r[2],d:r[3],tx:r[4],ty:r[5]}}var n=t.match(/matrix3d\(([^)]+)\)/);if(n){var r=n[1].split(",").map(function(t){return parseFloat(t.trim())});return{a:r[0],b:r[1],c:r[4],d:r[5],tx:r[12],ty:r[13]}}return null}function resolveTransformOrigin(t,e,r){function n(t,e){return"%"===t.slice(-1)?parseFloat(t)/100*e:parseFloat(t)||0}var o=t.split(/\s+/);return{x:n(o[0],e),y:n(o[1]||o[0],r)}}function applyTransformToRect(t,e){var r=parseTransformMatrix(e.transform);if(!r)return t;for(var n=resolveTransformOrigin(e.transformOrigin,t.width,t.height),o=t.left+n.x,a=t.top+n.y,i=[[t.left,t.top],[t.left+t.width,t.top],[t.left,t.top+t.height],[t.left+t.width,t.top+t.height]],l=Infinity,p=Infinity,s=-Infinity,f=-Infinity,u=0,d=i;u<d.length;u++){var h=d[u],c=h[0],m=h[1],g=c-o,v=m-a,E=r.a*g+r.c*v+r.tx+o,y=r.b*g+r.d*v+r.ty+a;l=Math.min(l,E),s=Math.max(s,E),p=Math.min(p,y),f=Math.max(f,y)}return{left:l,top:p,width:s-l,height:f-p}}function computeBaseRect(t,e,r,n){var o=parseFloat(r.width),a=parseFloat(r.height);if(isNaN(o)||isNaN(a)||o<1e-4||a<1e-4)return null;var i=r.position;if("fixed"===i){var l=parseFloat(r.top),p=parseFloat(r.left);return{top:isNaN(l)?0:l,left:isNaN(p)?0:p,width:o,height:a}}if("absolute"===i){var s=getComputedStyle(t),f=void 0,u=void 0;if("static"!==s.position){var d=getElementBorderWidths(t);f=n.top+d.top,u=n.left+d.left}else{var h=getContainingBlockPaddingEdge(t);f=h?h.top:0,u=h?h.left:0}var c=parseFloat(r.top),p=parseFloat(r.left);return{top:f+(isNaN(c)?0:c),left:u+(isNaN(p)?0:p),width:o,height:a}}var m=getComputedStyle(t),g=parseLengthOrZero(m.borderTopWidth),v=parseLengthOrZero(m.borderLeftWidth),E=parseLengthOrZero(m.paddingTop),y=parseLengthOrZero(m.paddingLeft),x=parseLengthOrZero(r.marginTop),S=parseLengthOrZero(r.marginLeft),C="relative"===i?parseLengthOrZero(r.top):0,L="relative"===i?parseLengthOrZero(r.left):0,O=n.top+g+E;if("::after"===e&&"block"===r.display){var N=getElementContentBottom(t);null!==N&&(O=Math.max(O,N))}return{top:O+x+C,left:n.left+v+y+S+L,width:o,height:a}}function getPseudoElementRect(t,e,r){var n=getComputedStyle(t,e);if("none"===n.content||"none"===n.display||"hidden"===n.visibility)return null;var o=computeBaseRect(t,e,n,r);return o?applyTransformToRect(o,n):null}exports.__esModule=!0,exports.getPseudoElementRect=exports.parseCaptureSelector=exports.PSEUDO_ELEMENTS=void 0,exports.PSEUDO_ELEMENTS=["::before","::after"];var PSEUDO_SELECTOR_REGEXP=/(.*?)(::before|::after)\s*$/i;exports.parseCaptureSelector=parseCaptureSelector,exports.getPseudoElementRect=getPseudoElementRect;
18
+ "use strict";function parseCaptureTarget(t){if("string"!=typeof t)return{elementTarget:t,pseudoElement:null};var e=t.match(PSEUDO_SELECTOR_REGEXP);if(!e)return{elementTarget:t,pseudoElement:null};var r=e[1].trim();return r?{elementTarget:r,pseudoElement:e[2].toLowerCase()}:{elementTarget:t,pseudoElement:null}}function getElementBorderWidths(t){var e=getComputedStyle(t);return{top:parseFloat(e.borderTopWidth),left:parseFloat(e.borderLeftWidth)}}function parseLengthOrZero(t){var e=parseFloat(t);return isNaN(e)?0:e}function getElementContentBottom(t){var e=document.createRange();try{e.selectNodeContents(t);for(var r=e.getClientRects(),n=-Infinity,a=0;a<r.length;a++){var o=r[a];o.width<1e-4&&o.height<1e-4||(n=Math.max(n,o.bottom))}return n!==-Infinity?n:null}catch(i){return null}finally{"function"==typeof e.detach&&e.detach()}}function getContainingBlockPaddingEdge(t){for(var e=t.parentElement;e;){if("static"!==getComputedStyle(e).position){var r=e.getBoundingClientRect(),n=getElementBorderWidths(e);return{top:r.top+n.top,left:r.left+n.left}}e=e.parentElement}return null}function parseTransformMatrix(t){if(!t||"none"===t)return null;var e=t.match(/matrix\(([^)]+)\)/);if(e){var r=e[1].split(",").map(function(t){return parseFloat(t.trim())});return{a:r[0],b:r[1],c:r[2],d:r[3],tx:r[4],ty:r[5]}}var n=t.match(/matrix3d\(([^)]+)\)/);if(n){var r=n[1].split(",").map(function(t){return parseFloat(t.trim())});return{a:r[0],b:r[1],c:r[4],d:r[5],tx:r[12],ty:r[13]}}return null}function resolveTransformOrigin(t,e,r){function n(t,e){return"%"===t.slice(-1)?parseFloat(t)/100*e:parseFloat(t)||0}var a=t.split(/\s+/);return{x:n(a[0],e),y:n(a[1]||a[0],r)}}function applyTransformToRect(t,e){var r=parseTransformMatrix(e.transform);if(!r)return t;for(var n=resolveTransformOrigin(e.transformOrigin,t.width,t.height),a=t.left+n.x,o=t.top+n.y,i=[[t.left,t.top],[t.left+t.width,t.top],[t.left,t.top+t.height],[t.left+t.width,t.top+t.height]],l=Infinity,p=Infinity,s=-Infinity,f=-Infinity,u=0,d=i;u<d.length;u++){var g=d[u],h=g[0],m=g[1],c=h-a,v=m-o,E=r.a*c+r.c*v+r.tx+a,y=r.b*c+r.d*v+r.ty+o;l=Math.min(l,E),s=Math.max(s,E),p=Math.min(p,y),f=Math.max(f,y)}return{left:l,top:p,width:s-l,height:f-p}}function computeBaseRect(t,e,r,n){var a=parseFloat(r.width),o=parseFloat(r.height);if(isNaN(a)||isNaN(o)||a<1e-4||o<1e-4)return null;var i=r.position;if("fixed"===i){var l=parseFloat(r.top),p=parseFloat(r.left);return{top:isNaN(l)?0:l,left:isNaN(p)?0:p,width:a,height:o}}if("absolute"===i){var s=getComputedStyle(t),f=void 0,u=void 0;if("static"!==s.position){var d=getElementBorderWidths(t);f=n.top+d.top,u=n.left+d.left}else{var g=getContainingBlockPaddingEdge(t);f=g?g.top:0,u=g?g.left:0}var h=parseFloat(r.top),p=parseFloat(r.left);return{top:f+(isNaN(h)?0:h),left:u+(isNaN(p)?0:p),width:a,height:o}}var m=getComputedStyle(t),c=parseLengthOrZero(m.borderTopWidth),v=parseLengthOrZero(m.borderLeftWidth),E=parseLengthOrZero(m.paddingTop),y=parseLengthOrZero(m.paddingLeft),T=parseLengthOrZero(r.marginTop),x=parseLengthOrZero(r.marginLeft),C="relative"===i?parseLengthOrZero(r.top):0,L="relative"===i?parseLengthOrZero(r.left):0,O=n.top+c+E;if("::after"===e&&"block"===r.display){var N=getElementContentBottom(t);null!==N&&(O=Math.max(O,N))}return{top:O+T+C,left:n.left+v+y+x+L,width:a,height:o}}function getPseudoElementRect(t,e,r){var n=getComputedStyle(t,e);if("none"===n.content||"none"===n.display||"hidden"===n.visibility)return null;var a=computeBaseRect(t,e,n,r);return a?applyTransformToRect(a,n):null}exports.__esModule=!0,exports.getPseudoElementRect=exports.parseCaptureTarget=exports.PSEUDO_ELEMENTS=void 0,exports.PSEUDO_ELEMENTS=["::before","::after"];var PSEUDO_SELECTOR_REGEXP=/(.*?)(::before|::after)\s*$/i;exports.parseCaptureTarget=parseCaptureTarget,exports.getPseudoElementRect=getPseudoElementRect;
19
19
  },{}],10:[function(require,module,exports){
20
- "use strict";function getElementSelector(e){var o=e.match(PSEUDO_SELECTOR_REGEXP);return o?o[1].trim()||e:e}function isScrollable(e){var o=getComputedStyle(e).overflowY;return e.scrollHeight>e.clientHeight&&("auto"===o||"scroll"===o||"overlay"===o)}function getScrollParent(e){if("fixed"===getComputedStyle(e).position)return null;for(var o=(0,dom_1.getParentElement)(e);o&&o!==document.documentElement;){if(isScrollable(o))return o;if("fixed"===getComputedStyle(o).position)return null;o=(0,dom_1.getParentElement)(o)}return o===document.documentElement?document.documentElement:null}function getScrollParentsChain(e){for(var o=[],t=getScrollParent(e);t&&t!==document.documentElement;)o.unshift(t),t=getScrollParent(t);return o.unshift(document.documentElement),o}function getCommonScrollParent(e){var o=e.map(function(e){return document.querySelector(getElementSelector(e))}).filter(function(e){return null!==e});if(0===o.length)return document.documentElement;if(1===o.length){var t=getScrollParent(o[0]);return t?normalizeRootLikeElement(t):document.documentElement}for(var r=o.map(function(e){return getScrollParentsChain(e)}),l=Math.min.apply(Math,r.map(function(e){return e.length})),n=document.documentElement,c=0;c<l;c++){if("break"===function(e){if(!r.every(function(o){return o[e]===r[0][e]}))return"break";n=r[0][e]}(c))break}return normalizeRootLikeElement(n)}function getElementScrollTop(e){return isRootLikeElement(e)?window.scrollY:e.scrollTop}function getPageScrollElement(){var e;return null!==(e=document.scrollingElement)&&void 0!==e?e:document.documentElement}function isRootLikeElement(e){var o=getPageScrollElement();return e===document.documentElement||e===document.body||e===o}function normalizeRootLikeElement(e){return isRootLikeElement(e)?document.documentElement:e}function performScrollFixForSafariIfNeeded(e){(0,user_agent_1.isSafariMobile)()&&window.scrollY<100&&e<100&&window.scrollTo(window.scrollX,100)}function scrollElementBy(e,o,t){var r=o,l=isRootLikeElement(e),n=l?getPageScrollElement():e,c=l?window.scrollY:e.scrollTop,i=n.scrollHeight-n.clientHeight,m=Math.max(0,Math.min(c+r,i));l?(null===t||void 0===t||t("scrollElementBy: scrolling window.scrollTo("+window.scrollX+", "+m+")"),performScrollFixForSafariIfNeeded(m),window.scrollTo(window.scrollX,m)):(null===t||void 0===t||t("scrollElementBy: scrolling element.scrollTo("+e.scrollLeft+", "+m+")"),e.scrollTo(e.scrollLeft,m));for(var a=performance.now(),u=0;performance.now()-a<SCROLL_APPLY_MAX_WAIT_MS&&u<SCROLL_APPLY_MAX_ITERATIONS;){if(getElementScrollTop(e)!==c)return;u++}}function scrollElementToOffset(e,o){var t=isRootLikeElement(e),r=t?getPageScrollElement():e,l=t?window.scrollY:e.scrollTop,n=r.scrollHeight-r.clientHeight,c=Math.max(0,Math.min(o,n));t?(performScrollFixForSafariIfNeeded(c),window.scrollTo(window.scrollX,c)):e.scrollTo(e.scrollLeft,c);for(var i=performance.now(),m=0;performance.now()-i<SCROLL_APPLY_MAX_WAIT_MS&&m<SCROLL_APPLY_MAX_ITERATIONS;){if(getElementScrollTop(e)===l)return;m++}}exports.__esModule=!0,exports.scrollElementToOffset=exports.scrollElementBy=exports.performScrollFixForSafariIfNeeded=exports.isRootLikeElement=exports.getCommonScrollParent=exports.getScrollParentsChain=exports.getScrollParent=void 0;var dom_1=require("./dom"),user_agent_1=require("./user-agent"),PSEUDO_SELECTOR_REGEXP=/(.*?)(::before|::after)\s*$/i;exports.getScrollParent=getScrollParent,exports.getScrollParentsChain=getScrollParentsChain,exports.getCommonScrollParent=getCommonScrollParent;var SCROLL_APPLY_MAX_WAIT_MS=50,SCROLL_APPLY_MAX_ITERATIONS=1e4;exports.isRootLikeElement=isRootLikeElement,exports.performScrollFixForSafariIfNeeded=performScrollFixForSafariIfNeeded,exports.scrollElementBy=scrollElementBy,exports.scrollElementToOffset=scrollElementToOffset;
21
- },{"./dom":7,"./user-agent":12}],11:[function(require,module,exports){
20
+ "use strict";function getElementTarget(e){if("string"!=typeof e)return e;var t=e.match(PSEUDO_SELECTOR_REGEXP);return t?t[1].trim()||e:e}function isScrollable(e){var t=getComputedStyle(e).overflowY;return e.scrollHeight>e.clientHeight&&("auto"===t||"scroll"===t||"overlay"===t)}function getScrollParent(e){if("fixed"===getComputedStyle(e).position)return null;for(var t=(0,dom_1.getParentElement)(e);t&&t!==document.documentElement;){if(isScrollable(t))return t;if("fixed"===getComputedStyle(t).position)return null;t=(0,dom_1.getParentElement)(t)}return t===document.documentElement?document.documentElement:null}function getScrollParentsChain(e){for(var t=[],r=getScrollParent(e);r&&r!==document.documentElement;)t.unshift(r),r=getScrollParent(r);return t.unshift(document.documentElement),t}function getCommonScrollParent(e){var t=e.map(function(e){return lib.queryFirst(getElementTarget(e))}).filter(function(e){return null!==e});if(0===t.length)return document.documentElement;if(1===t.length){var r=getScrollParent(t[0]);return r?normalizeRootLikeElement(r):document.documentElement}for(var o=t.map(function(e){return getScrollParentsChain(e)}),n=Math.min.apply(Math,o.map(function(e){return e.length})),l=document.documentElement,i=0;i<n;i++){if("break"===function(e){if(!o.every(function(t){return t[e]===o[0][e]}))return"break";l=o[0][e]}(i))break}return normalizeRootLikeElement(l)}function getElementScrollTop(e){return isRootLikeElement(e)?window.scrollY:e.scrollTop}function getPageScrollElement(){var e;return null!==(e=document.scrollingElement)&&void 0!==e?e:document.documentElement}function isRootLikeElement(e){var t=getPageScrollElement();return e===document.documentElement||e===document.body||e===t}function normalizeRootLikeElement(e){return isRootLikeElement(e)?document.documentElement:e}function performScrollFixForSafariIfNeeded(e){(0,user_agent_1.isSafariMobile)()&&window.scrollY<100&&e<100&&window.scrollTo(window.scrollX,100)}function scrollElementBy(e,t,r){var o=t,n=isRootLikeElement(e),l=n?getPageScrollElement():e,i=n?window.scrollY:e.scrollTop,c=l.scrollHeight-l.clientHeight,a=Math.max(0,Math.min(i+o,c));n?(null===r||void 0===r||r("scrollElementBy: scrolling window.scrollTo("+window.scrollX+", "+a+")"),performScrollFixForSafariIfNeeded(a),window.scrollTo(window.scrollX,a)):(null===r||void 0===r||r("scrollElementBy: scrolling element.scrollTo("+e.scrollLeft+", "+a+")"),e.scrollTo(e.scrollLeft,a));for(var u=performance.now(),m=0;performance.now()-u<SCROLL_APPLY_MAX_WAIT_MS&&m<SCROLL_APPLY_MAX_ITERATIONS;){if(getElementScrollTop(e)!==i)return;m++}}function scrollElementToOffset(e,t){var r=isRootLikeElement(e),o=r?getPageScrollElement():e,n=r?window.scrollY:e.scrollTop,l=o.scrollHeight-o.clientHeight,i=Math.max(0,Math.min(t,l));r?(performScrollFixForSafariIfNeeded(i),window.scrollTo(window.scrollX,i)):e.scrollTo(e.scrollLeft,i);for(var c=performance.now(),a=0;performance.now()-c<SCROLL_APPLY_MAX_WAIT_MS&&a<SCROLL_APPLY_MAX_ITERATIONS;){if(getElementScrollTop(e)===n)return;a++}}var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,o){o===undefined&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&("get"in n?t.__esModule:!n.writable&&!n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){o===undefined&&(o=r),e[o]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e["default"]=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t};exports.__esModule=!0,exports.scrollElementToOffset=exports.scrollElementBy=exports.performScrollFixForSafariIfNeeded=exports.isRootLikeElement=exports.getCommonScrollParent=exports.getScrollParentsChain=exports.getScrollParent=void 0;var lib=__importStar(require("./../../shared/lib.native.js")),dom_1=require("./dom"),user_agent_1=require("./user-agent"),PSEUDO_SELECTOR_REGEXP=/(.*?)(::before|::after)\s*$/i;exports.getScrollParent=getScrollParent,exports.getScrollParentsChain=getScrollParentsChain,exports.getCommonScrollParent=getCommonScrollParent;var SCROLL_APPLY_MAX_WAIT_MS=50,SCROLL_APPLY_MAX_ITERATIONS=1e4;exports.isRootLikeElement=isRootLikeElement,exports.performScrollFixForSafariIfNeeded=performScrollFixForSafariIfNeeded,exports.scrollElementBy=scrollElementBy,exports.scrollElementToOffset=scrollElementToOffset;
21
+ },{"./../../shared/lib.native.js":14,"./dom":7,"./user-agent":12}],11:[function(require,module,exports){
22
22
  "use strict";function createDefaultTrustedTypesPolicy(){var e=window;e.trustedTypes&&e.trustedTypes.createPolicy&&e.trustedTypes.createPolicy("default",{createHTML:function(e){return e}})}exports.__esModule=!0,exports.createDefaultTrustedTypesPolicy=void 0,exports.createDefaultTrustedTypesPolicy=createDefaultTrustedTypesPolicy;
23
23
  },{}],12:[function(require,module,exports){
24
24
  "use strict";function isSafariMobile(){return Boolean(navigator&&"string"==typeof navigator.vendor&&navigator.vendor.match(/apple/i)&&/(iPhone|iPad).*AppleWebKit.*Safari/i.test(navigator.userAgent))}exports.__esModule=!0,exports.isSafariMobile=void 0,exports.isSafariMobile=isSafariMobile;
25
25
  },{}],13:[function(require,module,exports){
26
26
  "use strict";function getCssProp(e,t){return e[t]}function hasCssProp(e,t,n){void 0===n&&(n="none");var r=getCssProp(e,t);return r!==undefined&&r!==n}function isFlexContainer(e){return"flex"===e.display||"inline-flex"===e.display}function isGridContainer(e){return-1!==(e.display||"").indexOf("grid")}function hasContainStackingContext(e){return"layout"===e||"paint"===e||"strict"===e||"content"===e||-1!==e.indexOf("paint")||-1!==e.indexOf("layout")}function createsStackingContext(e){var t=getComputedStyle(e),n=t.position,r=t.zIndex;if("fixed"===n||"sticky"===n)return!0;if("size"===getCssProp(t,"containerType")||"inline-size"===getCssProp(t,"containerType"))return!0;if("auto"!==r&&"static"!==n)return!0;if(parseFloat(t.opacity)<1)return!0;if("none"!==t.transform)return!0;if(hasCssProp(t,"scale"))return!0;if(hasCssProp(t,"rotate"))return!0;if(hasCssProp(t,"translate"))return!0;if("normal"!==t.mixBlendMode)return!0;if("none"!==t.filter)return!0;if(hasCssProp(t,"backdropFilter"))return!0;if(hasCssProp(t,"webkitBackdropFilter"))return!0;if("none"!==t.perspective)return!0;if(hasCssProp(t,"clipPath"))return!0;var i=getCssProp(t,"mask")||getCssProp(t,"webkitMask");if(i!==undefined&&"none"!==i)return!0;var o=getCssProp(t,"maskImage")||getCssProp(t,"webkitMaskImage");if(o!==undefined&&"none"!==o)return!0;var a=getCssProp(t,"maskBorder")||getCssProp(t,"webkitMaskBorder");if(a!==undefined&&"none"!==a)return!0;if("isolate"===t.isolation)return!0;var s=t.willChange||"";if(-1!==s.indexOf("transform")||-1!==s.indexOf("opacity"))return!0;if("touch"===getCssProp(t,"webkitOverflowScrolling"))return!0;if("auto"!==r){var u=(0,dom_1.getParentElement)(e);if(u){var f=getComputedStyle(u);if(isFlexContainer(f)||isGridContainer(f))return!0}}return!!hasContainStackingContext(t.contain||"")}function getClosestStackingContext(e){return e&&e!==document.documentElement?e instanceof ShadowRoot?getClosestStackingContext(e.host):e instanceof Element?createsStackingContext(e)?e:getClosestStackingContext((0,dom_1.getParentElement)(e)):getClosestStackingContext(e.parentNode):document.documentElement}function getStackingContextRoot(e){return getClosestStackingContext((0,dom_1.getParentElement)(e))}function getEffectiveZIndex(e){for(var t=e;t&&t!==document.documentElement;){var n=getComputedStyle(t);if("auto"!==n.zIndex){var r=parseFloat(n.zIndex);return isNaN(r)?0:r}if(createsStackingContext(t))return 0;t=t.parentElement}return 0}function buildZChain(e){for(var t=[],n=e;n&&n!==document.documentElement;){var r=getStackingContextRoot(n),i=getEffectiveZIndex(n);if(t.unshift({ctx:r,z:i}),r===document.documentElement)break;n=r}return t}function isChainBehind(e,t){for(var n=t.length-1;n>=0;n--)for(var r=e.length-1;r>=0;r--)if(e[r].ctx===t[n].ctx)return e[r].z<t[n].z;return!1}exports.__esModule=!0,exports.isChainBehind=exports.buildZChain=void 0;var dom_1=require("./dom");exports.buildZChain=buildZChain,exports.isChainBehind=isChainBehind;
27
27
  },{"./dom":7}],14:[function(require,module,exports){
28
- "use strict";function queryFirst(e){return xpath.isXpathSelector(e)?xpath.queryFirst(e):document.querySelector(e)}function queryAll(e){return xpath.isXpathSelector(e)?xpath.queryAll(e):Array.from(document.querySelectorAll(e))}function getComputedStyle(e,t){return getComputedStyle(e,t)}function matchMedia(e){return matchMedia(e)}function trim(e){return e.trim()}function getRootNode(e){return e.getRootNode()}var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,o){o===undefined&&(o=r);var u=Object.getOwnPropertyDescriptor(t,r);u&&("get"in u?t.__esModule:!u.writable&&!u.configurable)||(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,u)}:function(e,t,r,o){o===undefined&&(o=r),e[o]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e["default"]=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t};exports.__esModule=!0,exports.getRootNode=exports.trim=exports.matchMedia=exports.getComputedStyle=exports.queryAll=exports.queryFirst=void 0;var xpath=__importStar(require("./xpath"));exports.queryFirst=queryFirst,exports.queryAll=queryAll,exports.getComputedStyle=getComputedStyle,exports.matchMedia=matchMedia,exports.trim=trim,exports.getRootNode=getRootNode;
28
+ "use strict";function queryFirst(e){return"string"!=typeof e?e:xpath.isXpathSelector(e)?xpath.queryFirst(e):document.querySelector(e)}function queryAll(e){return"string"!=typeof e?[e]:xpath.isXpathSelector(e)?xpath.queryAll(e):Array.from(document.querySelectorAll(e))}function getComputedStyle(e,t){return getComputedStyle(e,t)}function matchMedia(e){return matchMedia(e)}function trim(e){return e.trim()}function getRootNode(e){return e.getRootNode()}var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,o){o===undefined&&(o=r);var u=Object.getOwnPropertyDescriptor(t,r);u&&("get"in u?t.__esModule:!u.writable&&!u.configurable)||(u={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,u)}:function(e,t,r,o){o===undefined&&(o=r),e[o]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e["default"]=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&__createBinding(t,e,r);return __setModuleDefault(t,e),t};exports.__esModule=!0,exports.getRootNode=exports.trim=exports.matchMedia=exports.getComputedStyle=exports.queryAll=exports.queryFirst=void 0;var xpath=__importStar(require("./xpath"));exports.queryFirst=queryFirst,exports.queryAll=queryAll,exports.getComputedStyle=getComputedStyle,exports.matchMedia=matchMedia,exports.trim=trim,exports.getRootNode=getRootNode;
29
29
  },{"./xpath":16}],15:[function(require,module,exports){
30
30
  "use strict";function makeCreateDebugLogger(){return function(e,r){if(e.debug&&-1!==e.debug.indexOf(r)){var t=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var o=0,g=e;o<g.length;o++){var n=g[o];if("object"==typeof n&&null!==n)try{t.log+=JSON.stringify(n,null,2)+"\n"}catch(u){t.log+="failed to log message due to an error: "+u}else t.log+=String(n)+"\n"}return t.log};return t.enabled=!0,t.log="",t}var o=function(){return""};return o.enabled=!1,o}}exports.__esModule=!0,exports.createDebugLogger=void 0,exports.createDebugLogger=makeCreateDebugLogger();
31
31
  },{}],16:[function(require,module,exports){
@@ -10,13 +10,38 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  exports.__esModule = true;
14
37
  exports.captureAnchorBaseline = exports.cleanupScrolls = exports.cleanupPointerEvents = exports.disablePointerEvents = exports.cleanupFrameAnimations = exports.disableFrameAnimations = exports.prepareViewportScreenshot = exports.scrollFullPage = exports.prepareFullPageScreenshot = exports.getCaptureState = exports.scrollTo = exports.scrollBy = exports.prepareElementsScreenshot = void 0;
15
38
  var _isomorphic_1 = require("@isomorphic");
39
+ var lib = __importStar(require("@lib"));
16
40
  var logger_1 = require("../shared/logger");
17
41
  var operations_1 = require("./operations");
18
42
  var descriptions_1 = require("./utils/descriptions");
19
43
  var dom_1 = require("./utils/dom");
44
+ var pseudo_element_rect_1 = require("./utils/pseudo-element-rect");
20
45
  var scroll_1 = require("./utils/scroll");
21
46
  var MIN_ANCHOR_SAMPLE_SIZE = 3;
22
47
  var MAX_ANCHOR_TRACKED_ELEMENTS = 500;
@@ -115,21 +140,21 @@ function safeCall(callback) {
115
140
  };
116
141
  }
117
142
  }
118
- function prepareElementsScreenshot(selectorsToCapture, opts) {
119
- return safeCall(prepareElementsScreenshotUnsafe, selectorsToCapture, opts);
143
+ function prepareElementsScreenshot(targetsToCapture, opts) {
144
+ return safeCall(prepareElementsScreenshotUnsafe, targetsToCapture, opts);
120
145
  }
121
146
  exports.prepareElementsScreenshot = prepareElementsScreenshot;
122
- function scrollBy(selectorsToCapture, scrollDelta, selectorToScroll, debug) {
147
+ function scrollBy(targetsToCapture, scrollDelta, targetToScroll, debug) {
123
148
  return safeCall(function () {
124
149
  var logger = (0, logger_1.createDebugLogger)({ debug: debug }, "scrollBy");
125
150
  var pixelRatio = (0, operations_1.computePixelRatio)();
126
- var scrollTarget = selectorToScroll ? document.querySelector(selectorToScroll) : null;
127
- var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(selectorsToCapture);
151
+ var scrollTarget = targetToScroll ? lib.queryFirst(targetToScroll) : null;
152
+ var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(targetsToCapture);
128
153
  var readableAutoScrollElementDescr = (0, descriptions_1.getReadableElementDescriptor)(scrollElement);
129
- var readableSelectorToScrollDescr = selectorToScroll
154
+ var readableSelectorToScrollDescr = targetToScroll
130
155
  ? scrollTarget
131
- ? "".concat(selectorToScroll, " (").concat(readableAutoScrollElementDescr, ")")
132
- : "".concat(selectorToScroll, " (not found, auto-detected ").concat(readableAutoScrollElementDescr, ")")
156
+ ? "".concat(targetToScroll, " (").concat(readableAutoScrollElementDescr, ")")
157
+ : "".concat(targetToScroll, " (not found, auto-detected ").concat(readableAutoScrollElementDescr, ")")
133
158
  : "auto-detected ".concat(readableAutoScrollElementDescr);
134
159
  var scrollHeightCss = (0, _isomorphic_1.fromDeviceToCssNumber)(scrollDelta, pixelRatio);
135
160
  (0, scroll_1.scrollElementBy)(scrollElement, scrollHeightCss);
@@ -140,18 +165,18 @@ function scrollBy(selectorsToCapture, scrollDelta, selectorToScroll, debug) {
140
165
  });
141
166
  }
142
167
  exports.scrollBy = scrollBy;
143
- function scrollTo(selectorsToCapture, scrollOffset, selectorToScroll, debug) {
168
+ function scrollTo(targetsToCapture, scrollOffset, targetToScroll, debug) {
144
169
  return safeCall(function () {
145
170
  var logger = (0, logger_1.createDebugLogger)({ debug: debug }, "scrollTo");
146
- logger("Asked to scroll to with params: selectorsToCapture:", selectorsToCapture, "scrollOffset:", scrollOffset, "selectorToScroll:", selectorToScroll);
171
+ logger("Asked to scroll to with params: targetsToCapture:", targetsToCapture, "scrollOffset:", scrollOffset, "targetToScroll:", targetToScroll);
147
172
  var pixelRatio = (0, operations_1.computePixelRatio)();
148
- var scrollTarget = selectorToScroll ? document.querySelector(selectorToScroll) : null;
149
- var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(selectorsToCapture);
173
+ var scrollTarget = targetToScroll ? lib.queryFirst(targetToScroll) : null;
174
+ var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(targetsToCapture);
150
175
  var readableAutoScrollElementDescr = (0, descriptions_1.getReadableElementDescriptor)(scrollElement);
151
- var readableSelectorToScrollDescr = selectorToScroll
176
+ var readableSelectorToScrollDescr = targetToScroll
152
177
  ? scrollTarget
153
- ? "".concat(selectorToScroll, " (").concat(readableAutoScrollElementDescr, ")")
154
- : "".concat(selectorToScroll, " (not found, auto-detected ").concat(readableAutoScrollElementDescr, ")")
178
+ ? "".concat(targetToScroll, " (").concat(readableAutoScrollElementDescr, ")")
179
+ : "".concat(targetToScroll, " (not found, auto-detected ").concat(readableAutoScrollElementDescr, ")")
155
180
  : "auto-detected ".concat(readableAutoScrollElementDescr);
156
181
  var scrollOffsetCss = (0, _isomorphic_1.fromDeviceToCssNumber)(scrollOffset, pixelRatio);
157
182
  (0, scroll_1.scrollElementToOffset)(scrollElement, scrollOffsetCss);
@@ -163,21 +188,21 @@ function scrollTo(selectorsToCapture, scrollOffset, selectorToScroll, debug) {
163
188
  }
164
189
  exports.scrollTo = scrollTo;
165
190
  /** Returns current state: positions of elements to capture, ignore areas, safe area, scroll offset */
166
- function getCaptureState(selectorsToCapture, selectorsToIgnore, selectorToScroll, debug) {
191
+ function getCaptureState(targetsToCapture, targetsToIgnore, targetToScroll, debug) {
167
192
  return safeCall(function () {
168
193
  var logger = (0, logger_1.createDebugLogger)({ debug: debug }, "getCaptureState");
169
194
  var pixelRatio = (0, operations_1.computePixelRatio)();
170
- var scrollTarget = selectorToScroll ? document.querySelector(selectorToScroll) : null;
171
- var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(selectorsToCapture);
195
+ var scrollTarget = targetToScroll ? lib.queryFirst(targetToScroll) : null;
196
+ var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(targetsToCapture);
172
197
  var readableAutoScrollElementDescr = (0, descriptions_1.getReadableElementDescriptor)(scrollElement);
173
- var readableSelectorToScrollDescr = selectorToScroll
198
+ var readableSelectorToScrollDescr = targetToScroll
174
199
  ? scrollTarget
175
- ? "".concat(selectorToScroll, " (").concat(readableAutoScrollElementDescr, ")")
176
- : "".concat(selectorToScroll, " (not found, auto-detected ").concat(readableAutoScrollElementDescr, ")")
200
+ ? "".concat(targetToScroll, " (").concat(readableAutoScrollElementDescr, ")")
201
+ : "".concat(targetToScroll, " (not found, auto-detected ").concat(readableAutoScrollElementDescr, ")")
177
202
  : "auto-detected ".concat(readableAutoScrollElementDescr);
178
- var ignoreAreas = (0, operations_1.computeIgnoreAreas)(selectorsToIgnore);
179
- var safeArea = (0, operations_1.computeSafeArea)(selectorsToCapture, scrollElement, logger);
180
- var captureSpecsAfterCss = (0, operations_1.computeCaptureSpecs)(selectorsToCapture, logger);
203
+ var ignoreAreas = (0, operations_1.computeIgnoreAreas)(targetsToIgnore);
204
+ var safeArea = (0, operations_1.computeSafeArea)(targetsToCapture, scrollElement, logger);
205
+ var captureSpecsAfterCss = (0, operations_1.computeCaptureSpecs)(targetsToCapture, logger);
181
206
  var captureSpecs = captureSpecsAfterCss.map(function (spec) { return ({
182
207
  full: (0, _isomorphic_1.fromCssToDevice)((0, _isomorphic_1.roundCoords)(spec.full), pixelRatio),
183
208
  clip: (0, _isomorphic_1.fromCssToDevice)((0, _isomorphic_1.roundCoords)(spec.clip), pixelRatio),
@@ -318,13 +343,13 @@ exports.cleanupScrolls = cleanupScrolls;
318
343
  * Records up to 500 random non-degenerate descendants of the capture elements as anchor baselines.
319
344
  * Must be called once before the best-effort capture pass; getCaptureState will then return anchorShift.
320
345
  */
321
- function captureAnchorBaseline(selectorsToCapture) {
346
+ function captureAnchorBaseline(targetsToCapture) {
322
347
  return safeCall(function () {
323
- var captureSpecs = (0, operations_1.computeCaptureSpecs)(selectorsToCapture);
348
+ var captureSpecs = (0, operations_1.computeCaptureSpecs)(targetsToCapture);
324
349
  var captureArea = captureSpecs.length > 0 ? (0, _isomorphic_1.getCoveringRect)(captureSpecs.map(function (spec) { return spec.full; })) : null;
325
350
  var allDescendants = [];
326
- for (var si = 0; si < selectorsToCapture.length; si++) {
327
- var el = document.querySelector(selectorsToCapture[si]);
351
+ for (var targetIndex = 0; targetIndex < targetsToCapture.length; targetIndex++) {
352
+ var el = lib.queryFirst((0, pseudo_element_rect_1.parseCaptureTarget)(targetsToCapture[targetIndex]).elementTarget);
328
353
  if (!el)
329
354
  continue;
330
355
  allDescendants.push(el);
@@ -354,21 +379,21 @@ function captureAnchorBaseline(selectorsToCapture) {
354
379
  });
355
380
  }
356
381
  exports.captureAnchorBaseline = captureAnchorBaseline;
357
- function prepareElementsScreenshotUnsafe(selectorsToCapture, opts) {
382
+ function prepareElementsScreenshotUnsafe(targetsToCapture, opts) {
358
383
  var logger = (0, logger_1.createDebugLogger)(opts, "prepareElementsScreenshot");
359
- (0, operations_1.saveScrollPositions)(selectorsToCapture, opts.selectorToScroll);
360
- var readableSelectorToScrollDescr = (0, operations_1.scrollToCaptureAreaIfNeeded)(selectorsToCapture, opts.captureElementFromTop, opts.allowViewportOverflow, opts.selectorToScroll, logger).readableSelectorToScrollDescr;
384
+ (0, operations_1.saveScrollPositions)(targetsToCapture, opts.selectorToScroll);
385
+ var readableSelectorToScrollDescr = (0, operations_1.scrollToCaptureAreaIfNeeded)(targetsToCapture, opts.captureElementFromTop, opts.allowViewportOverflow, opts.selectorToScroll, logger).readableSelectorToScrollDescr;
361
386
  if (opts.disableAnimation) {
362
387
  (0, operations_1.disableAnimations)();
363
388
  }
364
389
  var pixelRatio = (0, operations_1.computePixelRatio)(opts.usePixelRatio);
365
- var scrollTarget = opts.selectorToScroll ? document.querySelector(opts.selectorToScroll) : null;
366
- var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(selectorsToCapture);
390
+ var scrollTarget = opts.selectorToScroll ? lib.queryFirst(opts.selectorToScroll) : null;
391
+ var scrollElement = scrollTarget !== null && scrollTarget !== void 0 ? scrollTarget : (0, scroll_1.getCommonScrollParent)(targetsToCapture);
367
392
  var ignoreAreas = (0, operations_1.computeIgnoreAreas)(opts.ignoreSelectors);
368
- var captureSpecs = (0, operations_1.computeCaptureSpecs)(selectorsToCapture, logger);
393
+ var captureSpecs = (0, operations_1.computeCaptureSpecs)(targetsToCapture, logger);
369
394
  var viewportSize = (0, operations_1.computeViewportSize)();
370
395
  var viewportOffset = (0, operations_1.computeViewportOffset)();
371
- var safeArea = (0, operations_1.computeSafeArea)(selectorsToCapture, scrollElement, logger);
396
+ var safeArea = (0, operations_1.computeSafeArea)(targetsToCapture, scrollElement, logger);
372
397
  var scrollOffset = (0, operations_1.computeScrollOffset)(scrollElement);
373
398
  var documentSize = (0, operations_1.computeDocumentSize)();
374
399
  var canHaveCaret = (0, operations_1.computeCanHaveCaret)();