delta-qa-vision 0.0.1.beta2
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.
- checksums.yaml +7 -0
- data/LICENSE +202 -0
- data/NOTICE +4 -0
- data/README.md +259 -0
- data/lib/delta_qa/vision/delta-qa-capture.js +78 -0
- data/lib/delta_qa/vision/errors.rb +111 -0
- data/lib/delta_qa/vision/ferrum.rb +217 -0
- data/lib/delta_qa/vision/frameworks.rb +57 -0
- data/lib/delta_qa/vision/gate.rb +140 -0
- data/lib/delta_qa/vision/playwright.rb +166 -0
- data/lib/delta_qa/vision/relay.rb +668 -0
- data/lib/delta_qa/vision/resize_wait.rb +34 -0
- data/lib/delta_qa/vision/selenium.rb +237 -0
- data/lib/delta_qa/vision.rb +109 -0
- metadata +59 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*! @csstools/css-tokenizer 4.0.2 (MIT) — bundled in the Delta-QA capture script.
|
|
2
|
+
|
|
3
|
+
The MIT License (MIT)
|
|
4
|
+
|
|
5
|
+
Copyright 2022 Romain Menke, Antonio Laguna <antonio@laguna.es>
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
8
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
9
|
+
the Software without restriction, including without limitation the rights to
|
|
10
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
11
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
12
|
+
subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
19
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
20
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
21
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
22
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
/*! dom-accessibility-api 0.7.1 (MIT) — bundled in the Delta-QA capture script.
|
|
25
|
+
|
|
26
|
+
MIT License
|
|
27
|
+
|
|
28
|
+
Copyright (c) 2020 Sebastian Silbermann
|
|
29
|
+
|
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
31
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
32
|
+
in the Software without restriction, including without limitation the rights
|
|
33
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
34
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
35
|
+
furnished to do so, subject to the following conditions:
|
|
36
|
+
|
|
37
|
+
The above copyright notice and this permission notice shall be included in all
|
|
38
|
+
copies or substantial portions of the Software.
|
|
39
|
+
|
|
40
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
41
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
42
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
43
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
44
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
45
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
46
|
+
SOFTWARE.
|
|
47
|
+
*/
|
|
48
|
+
/*! parse-srcset 1.0.2 (MIT) — bundled in the Delta-QA capture script.
|
|
49
|
+
|
|
50
|
+
The MIT License (MIT)
|
|
51
|
+
|
|
52
|
+
Copyright (c) 2014 Alex Bell
|
|
53
|
+
|
|
54
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
55
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
56
|
+
in the Software without restriction, including without limitation the rights
|
|
57
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
58
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
59
|
+
furnished to do so, subject to the following conditions:
|
|
60
|
+
|
|
61
|
+
The above copyright notice and this permission notice shall be included in all
|
|
62
|
+
copies or substantial portions of the Software.
|
|
63
|
+
|
|
64
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
65
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
66
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
67
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
68
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
69
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
70
|
+
SOFTWARE.
|
|
71
|
+
*/
|
|
72
|
+
var DeltaQaCapture=(function(e){var t;Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),l=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e},u=((e,t,i)=>(i=e==null?{}:n(o(e)),l(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(c(((e,n)=>{(function(e,r){typeof t==`function`&&t.amd?t([],r):typeof n==`object`&&n.exports?n.exports=r():e.parseSrcset=r()})(e,function(){return function(e){function t(e){return e===` `||e===` `||e===`
|
|
73
|
+
`||e===`\f`||e===`\r`}function n(t){var n,r=t.exec(e.substring(h));if(r)return n=r[0],h+=n.length,n}for(var r=e.length,i=/^[ \t\n\r\u000c]+/,a=/^[, \t\n\r\u000c]+/,o=/^[^ \t\n\r\u000c]+/,s=/[,]+$/,c=/^\d+$/,l=/^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,u,d,f,p,m,h=0,g=[];;){if(n(a),h>=r)return g;u=n(o),d=[],u.slice(-1)===`,`?(u=u.replace(s,``),v()):_()}function _(){for(n(i),f=``,p=`in descriptor`;;){if(m=e.charAt(h),p===`in descriptor`)if(t(m))f&&(d.push(f),f=``,p=`after descriptor`);else if(m===`,`){h+=1,f&&d.push(f),v();return}else if(m===`(`)f+=m,p=`in parens`;else if(m===``){f&&d.push(f),v();return}else f+=m;else if(p===`in parens`)if(m===`)`)f+=m,p=`in descriptor`;else if(m===``){d.push(f),v();return}else f+=m;else if(p===`after descriptor`&&!t(m))if(m===``){v();return}else p=`in descriptor`,--h;h+=1}}function v(){var t=!1,n,r,i,a,o={},s,f,p,m,h;for(a=0;a<d.length;a++)s=d[a],f=s[s.length-1],p=s.substring(0,s.length-1),m=parseInt(p,10),h=parseFloat(p),c.test(p)&&f===`w`?((n||r)&&(t=!0),m===0?t=!0:n=m):l.test(p)&&f===`x`?((n||r||i)&&(t=!0),h<0?t=!0:r=h):c.test(p)&&f===`h`?((i||r)&&(t=!0),m===0?t=!0:i=m):t=!0;t?console&&console.log&&console.log(`Invalid srcset descriptor found in '`+e+`' at '`+s+`'.`):(o.url=u,n&&(o.w=n),r&&(o.d=r),i&&(o.h=i),g.push(o))}}})}))());function d(e){let t=[e];for(let e=0;e<t.length;e++)t[e].querySelectorAll(`*`).forEach(e=>{e.shadowRoot&&t.push(e.shadowRoot)});return t}function f(e){return e.filter(e=>e.nodeType===Node.DOCUMENT_NODE||Object.prototype.toString.call(e)===`[object ShadowRoot]`)}function p(e){let t=[];for(let n of e)n.querySelectorAll(`iframe, frame`).forEach(e=>{let n;try{n=e.contentDocument}catch{n=null}n&&t.push(n)});return t}function m(e){let t=e;return t.__dqaReflet??(t.__dqaReflet=[])}function h(e,t,n,r){let i=t.hasAttribute(n),a=t.getAttribute(n);(r===null?!i:i&&a===r)||(m(e).push({el:t,name:n,had:i,before:a}),r===null?t.removeAttribute(n):t.setAttribute(n,r))}function g(e,t,n){m(e).push({el:t,text:t.textContent}),t.textContent=n}function _(e,t,n){m(e).push({node:t,data:t.data}),v(t,n)}function v(e,t){if(t.length!==e.length)throw Error(`a noted text keeps its length: `+e.length+` -> `+t.length);for(let n=0;n<t.length;n++)e.insertData(n,t[n]),e.deleteData(n+1,1)}function y(e){let t=m(e);for(let e=t.length-1;e>=0;e--){let n=t[e];`node`in n?v(n.node,n.data):`text`in n?n.el.textContent=n.text:n.had?n.el.setAttribute(n.name,n.before):n.el.removeAttribute(n.name)}e.__dqaReflet=[]}var b=`data-deltaqa-chosen`,x=`data-deltaqa-unchosen`;function S(e){let t=e.currentSrc;return t!==``&&!t.startsWith(`blob:`)&&ee(e)}function ee(e){return te(e).some(e=>/^\s*auto/i.test(e.getAttribute(`sizes`)??``))}function te(e){let t=e.parentElement;return[...t!==null&&t.localName===`picture`?Array.from(t.children).filter(e=>e.localName===`source`):[],e]}function ne(e,t=d(e)){for(let n of t)n.querySelectorAll(`img`).forEach(t=>{S(t)&&(h(e,t,b,t.currentSrc),te(t).filter(e=>e!==t).forEach(t=>h(e,t,x,``)))})}var re=[`stylesheet`,`icon`,`apple-touch-icon`,`apple-touch-icon-precomposed`,`mask-icon`],ie=[`style`,`font`,`image`],ae=[`body`,`table`,`thead`,`tbody`,`tfoot`,`tr`,`td`,`th`];function oe(e){let t=new Set,n=[],r=e.baseURI,i=e=>{let n=pe(e,r);n!==null&&t.add(n)},a=e=>{fe(e,r,n),e.querySelectorAll(`*`).forEach(e=>{se(e,i,r,n),e.shadowRoot&&a(e.shadowRoot)})};return a(e),{urls:Array.from(t),styles:n}}function se(e,t,n,r){let i=e.getAttribute(`style`);i!==null&&i.trim()!==``&&r.push({text:i,base:n});let a=e.localName;switch(ae.includes(a)&&t(e.getAttribute(`background`)),a){case`img`:{t(e.getAttribute(`src`));let n=e.currentSrc;n&&t(n),(!n||ee(e)&&!S(e))&&ce(e).forEach(t);break}case`input`:(e.getAttribute(`type`)||``).toLowerCase()===`image`&&t(e.getAttribute(`src`));break;case`video`:t(e.getAttribute(`poster`));break;case`link`:le(e)&&t(e.getAttribute(`href`));break;case`style`:de(e,n,r);break;case`image`:case`feImage`:t(ue(e));break;case`use`:{let n=ue(e);n!==null&&!n.trim().startsWith(`#`)&&t(n);break}}}function ce(e){return te(e).flatMap(e=>(0,u.default)(e.getAttribute(`srcset`)??``).map(e=>e.url))}function le(e){let t=(e.getAttribute(`rel`)||``).toLowerCase().split(/\s+/);return t.includes(`preload`)?ie.includes((e.getAttribute(`as`)||``).toLowerCase()):t.some(e=>re.includes(e))}function ue(e){return e.getAttribute(`href`)??e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)}function de(e,t,n){let r=e.textContent??``;r!==``&&n.push({text:r,base:t});let i=e.sheet?Array.from(e.sheet.cssRules,e=>e.cssText).join(`
|
|
74
|
+
`):``;i!==``&&i!==r&&n.push({text:i,base:t})}function fe(e,t,n){let r=e.adoptedStyleSheets||[];for(let e of Array.from(r)){let r=Array.from(e.cssRules,e=>e.cssText).join(`
|
|
75
|
+
`);r!==``&&n.push({text:r,base:t})}}function pe(e,t){if(e==null)return null;let n=e.trim();if(n===``||!URL.canParse(n,t))return null;let r=new URL(n,t);return r.protocol!==`http:`&&r.protocol!==`https:`?null:(r.hash=``,r.href)}function C(e,t,n=0){if(e.length<n+t.length)return!1;for(let r=0;r<t.length;r++)if(e[n+r]!==t.charCodeAt(r))return!1;return!0}function me(e){let t=13,n=e[10];n&128&&(t+=3*(1<<(n&7)+1));let r=0;for(;t<e.length;){let n=e[t++];if(n===59)break;if(n===33)t++,t=he(e,t);else if(n===44){r++;let n=e[t+8];if(t+=9,n&128&&(t+=3*(1<<(n&7)+1)),t++,t=he(e,t),r>1)return r}else break}return r}function he(e,t){for(;t<e.length;){let n=e[t++];if(n===0)return t;t+=n}return t}function ge(e){return C(e,`GIF8`)?e.length>=10&&me(e)>1?{width:w(e,6,2),height:w(e,8,2)}:null:e.length>24&&e[0]===137&&C(e,`PNG`,1)&&C(e,`IHDR`,12)?_e(e)>1?{width:T(e,16),height:T(e,20)}:null:C(e,`RIFF`)&&C(e,`WEBP`,8)?!C(e,`VP8X`,12)||e.length<30||!(e[20]&2)?null:{width:w(e,24,3)+1,height:w(e,27,3)+1}:null}function w(e,t,n){let r=0;for(let i=n-1;i>=0;i--)r=r*256+e[t+i];return r}function T(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}function _e(e){let t=8;for(;t+8<=e.length;){let n=T(e,t),r=String.fromCharCode(e[t+4],e[t+5],e[t+6],e[t+7]);if(r===`acTL`)return t+12<=e.length?T(e,t+8):0;if(r===`IDAT`||r===`IEND`)return 0;t+=12+n}return 0}function ve(e,t){let n=Math.max(1,Math.round(e)),r=Math.max(1,Math.round(t));return`<svg xmlns="http://www.w3.org/2000/svg" width="`+n+`" height="`+r+`" viewBox="0 0 `+n+` `+r+`"><rect width="100%" height="100%" fill="#1a1a1a"/><text x="50%" y="50%" fill="#c8c8c8" font-family="system-ui,-apple-system,sans-serif" font-size="13" font-weight="600" text-anchor="middle" dominant-baseline="middle">Animated image not supported by Delta-QA</text></svg>`}var ye=`blob:`;function be(e){xe(e);let t=new Map,n=e.querySelectorAll(`img`);n.forEach((r,i)=>{let a=r.currentSrc||r.src;if(!a.startsWith(ye)||t.has(a)||!r.complete||r.naturalWidth===0)return;let o=e.createElement(`canvas`);o.width=r.naturalWidth,o.height=r.naturalHeight;let s=o.getContext(`2d`);if(s===null)throw Error(`no 2d context to note the blob: image ${Ce(r,i,n.length)}`);s.drawImage(r,0,0),t.set(a,o.toDataURL())}),t.size>0&&(e.__dqaBlobImages=t)}function xe(e){delete e.__dqaBlobImages}function Se(e,t){let n=e.__dqaBlobImages;if(!n)return t;let r=t;return n.forEach((e,t)=>{r=r.split(t).join(e)}),r}function Ce(e,t,n){return`${e.id?`img#${e.id}`:`img ${t+1} of ${n}`} (${e.naturalWidth}x${e.naturalHeight})`}var we=8,Te=`data-deltaqa-canvas`;function Ee(e,t=d(e)){t.forEach(e=>De(e))}function De(e){e.querySelectorAll(`canvas`).forEach(e=>{let t=e;if(t.__dqaStyleBeforeNote===void 0)return;let n=t.__dqaStyleBeforeNote;n===null?t.removeAttribute(`style`):t.setAttribute(`style`,n),t.removeAttribute(Te),delete t.__dqaStyleBeforeNote})}function Oe(e,t=d(e)){Ee(e,t);let n=e.defaultView||window,r=t.flatMap(e=>Array.from(e.querySelectorAll(`canvas`))),i=[];return r.forEach((e,t)=>{let a=e,o=a.getBoundingClientRect();if(o.width<we||o.height<we)return;let s=n.getComputedStyle(a);if(s.visibility===`hidden`||s.display===`none`)return;let c;try{c=a.toDataURL()}catch(e){if(e?.name!==`SecurityError`)throw e;i.push(Me(a,t,r.length));return}let l=Ae(a,s),u={image:s.backgroundImage,clip:s.backgroundClip,size:s.backgroundSize,position:s.backgroundPosition,repeat:s.backgroundRepeat,origin:s.backgroundOrigin,attachment:s.backgroundAttachment,width:s.width,height:s.height,display:s.display};a.__dqaStyleBeforeNote=a.getAttribute(`style`);let d=(e,t)=>a.style.setProperty(e,t,`important`);d(`background-image`,`url("${c}"), ${u.image}`),d(`background-clip`,`content-box, ${u.clip}`);let f=(e,t,n)=>d(e,u.image===`none`?t:`${t}, ${n}`);f(`background-size`,l.size,u.size),f(`background-position`,l.position,u.position),f(`background-repeat`,`no-repeat`,u.repeat),f(`background-origin`,`content-box`,u.origin),f(`background-attachment`,`scroll`,u.attachment),d(`width`,u.width),d(`height`,u.height),u.display===`inline`&&d(`display`,`inline-block`),a.setAttribute(Te,``)}),i}function ke(e,t){let n=d(e).flatMap(e=>Array.from(e.querySelectorAll(`canvas`))),r=new Set;for(let e of t){let t=n.find(t=>t===e.canvas);if(t===void 0||!t.hasAttribute(Te))continue;let i=e.getContextAttributes();i!==null&&i.preserveDrawingBuffer!==!0&&r.add(t)}return n.flatMap((e,t)=>r.has(e)?[Me(e,t,n.length)]:[])}function Ae(e,t){let n=t.objectPosition;switch(t.objectFit){case`contain`:case`cover`:return{size:t.objectFit,position:n};case`none`:return{size:`auto`,position:n};case`scale-down`:{let r=je(e,t);return{size:e.width<=r.width&&e.height<=r.height?`auto`:`contain`,position:n}}default:return{size:`100% 100%`,position:`0 0`}}}function je(e,t){let n=e=>parseFloat(e),r=e.getBoundingClientRect();return{width:r.width-n(t.borderLeftWidth)-n(t.borderRightWidth)-n(t.paddingLeft)-n(t.paddingRight),height:r.height-n(t.borderTopWidth)-n(t.borderBottomWidth)-n(t.paddingTop)-n(t.paddingBottom)}}function Me(e,t,n){return`${e.id?`canvas#${e.id}`:`canvas ${t+1} of ${n}`} (${e.width}x${e.height})`}var Ne=`data-deltaqa-defined`;function Pe(e,t=d(e)){let n=new Set;for(let e of t)e.querySelectorAll(`*`).forEach(e=>{let t=Fe(e);t!==null&&e.matches(`:defined`)&&n.add(t)});e.documentElement&&h(e,e.documentElement,Ne,n.size?Array.from(n).join(` `):null)}function Fe(e){if(e.localName.includes(`-`))return e.localName;let t=e.getAttribute(`is`);return t?`${t}/${e.localName}`:null}function Ie(e){return p(d(e))}function Le(e){let t=e.defaultView?.frameElement??null;return t!==null&&Ie(t.ownerDocument).includes(e)}function Re(e,t){for(let n=e.defaultView;n&&n!==t&&n.parent!==n;){let e=n.frameElement;if(!e)return!1;n=e.ownerDocument.defaultView}return!0}var ze=new Set(`name.honorific-prefix.given-name.additional-name.family-name.honorific-suffix.nickname.organization-title.username.new-password.current-password.one-time-code.organization.street-address.address-line1.address-line2.address-line3.address-level4.address-level3.address-level2.address-level1.country.country-name.postal-code.cc-name.cc-given-name.cc-additional-name.cc-family-name.cc-number.cc-exp.cc-exp-month.cc-exp-year.cc-csc.cc-type.transaction-currency.transaction-amount.language.bday.bday-day.bday-month.bday-year.sex.url.photo`.split(`.`)),Be=new Set([`tel`,`tel-country-code`,`tel-national`,`tel-area-code`,`tel-local`,`tel-local-prefix`,`tel-local-suffix`,`tel-extension`,`email`,`impp`]),Ve=new Set([`home`,`work`,`mobile`,`fax`,`pager`]),He=/[\t\n\f\r ]+/;function Ue(e){return e.replace(/[A-Z]/g,e=>String.fromCharCode(e.charCodeAt(0)+32))}function We(e){let t=(e??``).split(He).filter(e=>e!==``).map(Ue),n=t.length-1;if(n<0)return``;if(t[n]===`off`||t[n]===`on`)return n===0?t[n]:``;t[n]===`webauthn`&&n--;let r=t[n],i=Be.has(r);return r===void 0||!i&&!ze.has(r)?``:(n--,i&&n>=0&&Ve.has(t[n])&&n--,n>=0&&(t[n]===`shipping`||t[n]===`billing`)&&n--,n===0&&t[0].startsWith(`section-`)&&n--,n<0?r:``)}function Ge(e){let t=(e??``).trim().split(He).map(Ue);for(;t.length>2&&t[t.length-1]===`webauthn`&&t[t.length-2]===`webauthn`;)t.pop();return We(t.join(` `))}function Ke(e){let t=Ge(e.getAttribute(`autocomplete`));return(e.type||``).toLowerCase()===`password`||t===`current-password`||t===`new-password`}var qe=`data-deltaqa-veiled`,Je=`•`,Ye=`data-deltaqa-indeterminate`;function Xe(e,t=d(e),n){let r=Re(e,n);t.forEach(t=>Ze(e,t,r)),$e(e)}function Ze(e,t,n){t.querySelectorAll(`input`).forEach(t=>{let r=(t.type||``).toLowerCase();r===`checkbox`||r===`radio`?(n&&h(e,t,`checked`,t.checked?``:null),n&&r===`checkbox`&&h(e,t,Ye,t.indeterminate?``:null)):t.hasAttribute(qe)||Ke(t)?h(e,t,`value`,Je.repeat(t.value.length)):n&&r!==`file`&&h(e,t,`value`,t.value)}),t.querySelectorAll(`textarea`).forEach(t=>{t.hasAttribute(qe)||Ke(t)?g(e,t,Je.repeat(t.value.length)):n&&t.textContent!==t.value&&g(e,t,t.value)}),n&&t.querySelectorAll(`select`).forEach(t=>{Array.from(t.options).forEach(t=>h(e,t,`selected`,t.selected?``:null))})}var Qe=new Set([`script`,`style`]);function $e(e){for(let t of d(e))t.querySelectorAll(`[data-deltaqa-veiled]`).forEach(t=>{if(t.localName===`input`||t.localName===`textarea`||t.parentElement?.closest(`[data-deltaqa-veiled]`))return;let n=e.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let t=n.nextNode();t;t=n.nextNode()){let n=t;Qe.has(n.parentElement?.localName??``)||n.length===0||_(e,n,Je.repeat(n.length))}})}var et=`data-deltaqa-focus`;function tt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;!t||t===e.body||t===e.documentElement||t.localName===`iframe`||t.localName===`frame`||!t.matches(`:focus`)||h(e,t,et,t.matches(`:focus-visible`)?`visible`:``)}var nt=`data-deltaqa-hover`;function rt(e){e.querySelectorAll(`[${nt}]`).forEach(t=>h(e,t,nt,null));let t=Array.from(e.querySelectorAll(`:hover`)).pop();for(;t&&t.shadowRoot;){let e=Array.from(t.shadowRoot.querySelectorAll(`:hover`)).pop();if(!e)break;t=e}t&&t.localName!==`iframe`&&t.localName!==`frame`&&h(e,t,nt,``)}var it=`data-deltaqa-inline-tmp`,at=`data-deltaqa-frame-inlined`,ot=/\s(?:src(?:doc)?|data)\s*=\s*"[^"]*"/g,st={frame:`src`,object:`data`,embed:`src`};function ct(e,t){e.setAttribute(it,t)}function lt(e){e.removeAttribute(it)}function ut(e,t){let n=new Map;for(let e of t)n.set(e.mark,dt(mt(e.html,e.url),n));return dt(e,n)}function dt(e,t){let n=e;return t.forEach((e,t)=>{n=ft(n,t,e)}),n}function ft(e,t,n){let r=`${it}="${t}"`,i=e.indexOf(r);if(i<0)return e;let a=e.lastIndexOf(`<`,i),o=e.indexOf(`>`,i);if(a<0||o<0)return e;let s=st[/^<([a-zA-Z]+)/.exec(e.substring(a))?.[1].toLowerCase()??``],c=e.substring(a,o).replace(ot,``).replace(r,()=>`srcdoc="${pt(n)}" ${at}=""`+(s?` ${s}="about:blank"`:``));return e.substring(0,a)+c+e.substring(o)}function pt(e){return e.replace(/&/g,`&`).replace(/"/g,`"`)}function mt(e,t){if(!t||t.startsWith(`about:`)||new DOMParser().parseFromString(e,`text/html`).querySelector(`base[href]`))return e;let n=e.toLowerCase(),r=`<base href="${t.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}">`,i=n.indexOf(`<head>`);if(i>=0){let t=i+6;return e.substring(0,t)+r+e.substring(t)}let a=n.indexOf(`<html`);if(a>=0){let t=e.indexOf(`>`,a);if(t>=0)return e.substring(0,t+1)+`<head>`+r+`</head>`+e.substring(t+1)}return r+e}var ht=`data-deltaqa-scroll-top`,gt=`data-deltaqa-scroll-left`;function _t(e,t=d(e)){t.forEach(t=>t.querySelectorAll(`*`).forEach(t=>{h(e,t,ht,t.scrollTop?String(t.scrollTop):null),h(e,t,gt,t.scrollLeft?String(t.scrollLeft):null)}))}var E=`data-deltaqa-style-tmp`,vt=/<\/(?=[A-Za-z])/g;function yt(e){let t=``,n=``;for(let r=0;r<e.length;r++){let i=e[r];n&&i===`\\`?(t+=i+(e[r+1]??``),r++):n&&i===n?(n=``,t+=i):!n&&(i===`"`||i===`'`)?(n=i,t+=i):n&&i===`<`?t+=`\\3c `:t+=i}return t.replace(vt,`<\\/`)}function bt(e){return Array.from(e.cssRules,e=>e.cssText)}function xt(e){let t=new CSSStyleSheet;return t.replaceSync(e),bt(t)}function St(e,t){return e.length===t.length&&e.every((e,n)=>e===t[n])}function Ct(e,t){let n=new Map;if(e.contentType!==`text/html`)return n;for(let r of f(d(e)).flatMap(e=>Array.from(e.styleSheets))){let e=r.ownerNode;if(r.href||!e||e.nodeType!==Node.ELEMENT_NODE)continue;let i=e;if(i.localName!==`style`||t(i))continue;let a=bt(r);if(!r.disabled&&St(a,xt(i.textContent??``)))continue;let o=String(n.size);i.setAttribute(E,o),n.set(o,r.disabled?``:a.join(`
|
|
76
|
+
`))}return n}function wt(e){d(e).forEach(e=>e.querySelectorAll(`style[${E}]`).forEach(e=>e.removeAttribute(E)))}function Tt(e,t){let n=e;return t.forEach((e,t)=>{let r=` ${E}="${t}"`,i=n.indexOf(r),a=i<0?-1:n.indexOf(`>`,i),o=a<0?-1:n.slice(a).search(/<\/style/i);if(o<0)throw Error(`The serialization lost the style tag marked ${t}`);n=n.substring(0,i)+n.substring(i+r.length,a+1)+yt(e)+n.substring(a+o)}),n}function Et(e){let t=f(d(e)).slice(1),n=e.doctype?new XMLSerializer().serializeToString(e.doctype):``,r=e.documentElement;if(!r)return n;if(t.length===0&&e.contentType!==`text/html`)return n+r.outerHTML;let i=r.cloneNode(!1);i.appendChild(e.createTextNode(``));let a=i.outerHTML,o=a.lastIndexOf(`</`);return n+a.slice(0,o)+r.getHTML({serializableShadowRoots:!0,shadowRoots:t})+a.slice(o)}var Dt=`data-deltaqa-adopted`,Ot=`data-deltaqa-adopted-sheets`,kt=`data-deltaqa-adopts`;function At(e){e.querySelectorAll(`style[${Dt}], template[${Ot}]`).forEach(e=>e.remove())}function jt(e,t=d(e)){At(e);let n=e.head||e.body||e.documentElement;for(let t of Array.from(e.adoptedStyleSheets||[])){if(t.disabled)continue;let r=e.createElement(`style`);r.setAttribute(Dt,``),t.media.mediaText&&r.setAttribute(`media`,t.media.mediaText),r.textContent=Array.from(t.cssRules,e=>e.cssText).join(``),n.appendChild(r)}let r=new Map;for(let n of f(t)){if(!(`host`in n))continue;let t=Array.from(n.adoptedStyleSheets||[]).filter(e=>!e.disabled).map(e=>(r.has(e)||r.set(e,r.size),r.get(e)));h(e,n.host,kt,t.length?t.join(` `):null)}if(r.size===0)return;let i=e.createElement(`template`);i.setAttribute(Ot,``),r.forEach((t,n)=>{let r=e.createElement(`style`);n.media.mediaText&&r.setAttribute(`media`,n.media.mediaText),r.textContent=yt(Array.from(n.cssRules,e=>e.cssText).join(`
|
|
77
|
+
`)),i.content.appendChild(r)}),n.appendChild(i)}var Mt=`data-deltaqa-modal`,Nt=`data-deltaqa-popover-open`;function Pt(e,t=d(e)){t.forEach(t=>t.querySelectorAll(`dialog`).forEach(t=>h(e,t,Mt,t.open&&t.matches(`:modal`)?``:null))),t.forEach(t=>t.querySelectorAll(`[popover]`).forEach(t=>h(e,t,Nt,t.matches(`:popover-open`)?``:null)))}function Ft(e){let t=[];if(e.contentType===`text/html`)return``;for(let n of Array.from(e.styleSheets)){if(n.href)continue;let e=n.ownerNode;if(e&&`hasAttribute`in e&&e.hasAttribute(`data-deltaqa-adopted`))continue;let r;try{r=n.cssRules}catch{continue}if(r)for(let e of Array.from(r))t.push(e.cssText)}return t.join(`
|
|
78
|
+
`)}function It(e){let t=new Map,n;try{t=Ct(e,e=>e.hasAttribute(Dt)),n=Et(e)}finally{wt(e)}return Se(e,Tt(n,t))}function Lt(e,t){return Le(e)?[]:Rt(e,t)}function Rt(e,t){if(!e.documentElement)return[];let n=d(e);Xe(e,n,t),jt(e,n);let r=Oe(e,n);return be(e),ne(e,n),_t(e,n),Pt(e,n),rt(e),Pe(e,n),tt(e),Ie(e).forEach(e=>r.push(...Rt(e,t))),r}function zt(e){Le(e)||Bt(e)}function Bt(e){y(e),At(e),Ee(e),xe(e),Ie(e).forEach(e=>Bt(e))}function D(e){return e.getAttribute(`id`)||``}function Vt(e){return e.getAttribute(`name`)||``}var Ht=Object.prototype.toString;function Ut(e){return typeof e==`function`||Ht.call(e)===`[object Function]`}function Wt(e){var t=Number(e);return isNaN(t)?0:t===0||!isFinite(t)?t:(t>0?1:-1)*Math.floor(Math.abs(t))}var Gt=2**53-1;function Kt(e){var t=Wt(e);return Math.min(Math.max(t,0),Gt)}function O(e,t){var n=Array,r=Object(e);if(e==null)throw TypeError(`Array.from requires an array-like object - not null or undefined`);if(t!==void 0&&!Ut(t))throw TypeError(`Array.from: when provided, the second argument must be a function`);for(var i=Kt(r.length),a=Ut(n)?Object(new n(i)):Array(i),o=0,s;o<i;)s=r[o],t?a[o]=t(s,o):a[o]=s,o+=1;return a.length=i,a}function k(e){"@babel/helpers - typeof";return k=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k(e)}function qt(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function Jt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,Zt(r.key),r)}}function Yt(e,t,n){return t&&Jt(e.prototype,t),n&&Jt(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function Xt(e,t,n){return t=Zt(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zt(e){var t=Qt(e,`string`);return k(t)==`symbol`?t:t+``}function Qt(e,t){if(k(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(k(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var $t=typeof Set>`u`?Set:function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];qt(this,e),Xt(this,`items`,void 0),this.items=t}return Yt(e,[{key:`add`,value:function(e){return this.has(e)===!1&&this.items.push(e),this}},{key:`clear`,value:function(){this.items=[]}},{key:`delete`,value:function(e){var t=this.items.length;return this.items=this.items.filter(function(t){return t!==e}),t!==this.items.length}},{key:`forEach`,value:function(e){var t=this;this.items.forEach(function(n){e(n,n,t)})}},{key:`has`,value:function(e){return this.items.indexOf(e)!==-1}},{key:`size`,get:function(){return this.items.length}}])}();function A(e){return e.localName??e.tagName.toLowerCase()}var en={article:`article`,aside:`complementary`,button:`button`,datalist:`listbox`,dd:`definition`,details:`group`,dialog:`dialog`,dt:`term`,fieldset:`group`,figure:`figure`,form:`form`,footer:`contentinfo`,h1:`heading`,h2:`heading`,h3:`heading`,h4:`heading`,h5:`heading`,h6:`heading`,header:`banner`,hr:`separator`,html:`document`,legend:`legend`,li:`listitem`,math:`math`,main:`main`,menu:`list`,nav:`navigation`,ol:`list`,optgroup:`group`,option:`option`,output:`status`,progress:`progressbar`,section:`region`,summary:`button`,table:`table`,tbody:`rowgroup`,textarea:`textbox`,tfoot:`rowgroup`,td:`cell`,th:`columnheader`,thead:`rowgroup`,tr:`row`,ul:`list`},tn={caption:new Set([`aria-label`,`aria-labelledby`]),code:new Set([`aria-label`,`aria-labelledby`]),deletion:new Set([`aria-label`,`aria-labelledby`]),emphasis:new Set([`aria-label`,`aria-labelledby`]),generic:new Set([`aria-label`,`aria-labelledby`,`aria-roledescription`]),insertion:new Set([`aria-label`,`aria-labelledby`]),none:new Set([`aria-label`,`aria-labelledby`]),paragraph:new Set([`aria-label`,`aria-labelledby`]),presentation:new Set([`aria-label`,`aria-labelledby`]),strong:new Set([`aria-label`,`aria-labelledby`]),subscript:new Set([`aria-label`,`aria-labelledby`]),superscript:new Set([`aria-label`,`aria-labelledby`])};function nn(e,t){return[`aria-atomic`,`aria-busy`,`aria-controls`,`aria-current`,`aria-description`,`aria-describedby`,`aria-details`,`aria-dropeffect`,`aria-flowto`,`aria-grabbed`,`aria-hidden`,`aria-keyshortcuts`,`aria-label`,`aria-labelledby`,`aria-live`,`aria-owns`,`aria-relevant`,`aria-roledescription`].some(function(n){var r;return e.hasAttribute(n)&&!((r=tn[t])!=null&&r.has(n))})}function rn(e,t){return nn(e,t)}function an(e){var t=sn(e);if(t===null||cn.indexOf(t)!==-1){var n=on(e);if(cn.indexOf(t||``)===-1||rn(e,n||``))return n}return t}function on(e){var t=en[A(e)];if(t!==void 0)return t;switch(A(e)){case`a`:case`area`:case`link`:if(e.hasAttribute(`href`))return`link`;break;case`img`:return e.getAttribute(`alt`)===``&&!rn(e,`img`)?`presentation`:`img`;case`input`:var n=e.type;switch(n){case`button`:case`image`:case`reset`:case`submit`:return`button`;case`checkbox`:case`radio`:return n;case`range`:return`slider`;case`email`:case`tel`:case`text`:case`url`:return e.hasAttribute(`list`)?`combobox`:`textbox`;case`search`:return e.hasAttribute(`list`)?`combobox`:`searchbox`;case`number`:return`spinbutton`;default:return null}case`select`:return e.hasAttribute(`multiple`)||e.size>1?`listbox`:`combobox`}return null}function sn(e){var t=e.getAttribute(`role`);if(t!==null){var n=t.trim().split(` `)[0];if(n.length>0)return n}return null}var cn=[`presentation`,`none`];function j(e){return e!==null&&e.nodeType===e.ELEMENT_NODE}function ln(e){return j(e)&&A(e)===`caption`}function M(e){return j(e)&&A(e)===`input`}function un(e){return j(e)&&A(e)===`optgroup`}function dn(e){return j(e)&&A(e)===`select`}function fn(e){return j(e)&&A(e)===`table`}function pn(e){return j(e)&&A(e)===`textarea`}function mn(e){var t=(e.ownerDocument===null?e:e.ownerDocument).defaultView;if(t===null)throw TypeError(`no window available`);return t}function hn(e){return j(e)&&A(e)===`fieldset`}function gn(e){return j(e)&&A(e)===`legend`}function _n(e){return j(e)&&A(e)===`slot`}function vn(e){return j(e)&&e.ownerSVGElement!==void 0}function yn(e){return j(e)&&A(e)===`svg`}function bn(e){return vn(e)&&A(e)===`title`}function xn(e,t){if(j(e)&&e.hasAttribute(t)){var n=e.getAttribute(t).split(` `),r=e.getRootNode?e.getRootNode():e.ownerDocument;return n.map(function(e){return r.getElementById(e)}).filter(function(e){return e!==null})}return[]}function N(e,t){return j(e)?t.indexOf(an(e))!==-1:!1}function Sn(e){return e.trim().replace(/\s\s+/g,` `)}function Cn(e,t){if(!j(e))return!1;if(e.hasAttribute(`hidden`)||e.getAttribute(`aria-hidden`)===`true`)return!0;var n=t(e);return n.getPropertyValue(`display`)===`none`||n.getPropertyValue(`visibility`)===`hidden`}function wn(e){return N(e,[`button`,`combobox`,`listbox`,`textbox`])||Tn(e,`range`)}function Tn(e,t){if(!j(e))return!1;switch(t){case`range`:return N(e,[`meter`,`progressbar`,`scrollbar`,`slider`,`spinbutton`]);default:throw TypeError(`No knowledge about abstract role '${t}'. This is likely a bug :(`)}}function En(e,t){var n=O(e.querySelectorAll(t));return xn(e,`aria-owns`).forEach(function(e){n.push.apply(n,O(e.querySelectorAll(t)))}),n}function Dn(e){return dn(e)?e.selectedOptions||En(e,`[selected]`):En(e,`[aria-selected="true"]`)}function On(e){return N(e,cn)}function kn(e){return ln(e)}function An(e){return N(e,[`button`,`cell`,`checkbox`,`columnheader`,`gridcell`,`heading`,`label`,`legend`,`link`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`row`,`rowheader`,`switch`,`tab`,`tooltip`,`treeitem`])}function jn(e){return!1}function Mn(e){return M(e)||pn(e)?e.value:e.textContent||``}function Nn(e){var t=e.getPropertyValue(`content`);return/^["'].*["']$/.test(t)?t.slice(1,-1):``}function Pn(e){var t=A(e);return t===`button`||t===`input`&&e.getAttribute(`type`)!==`hidden`||t===`meter`||t===`output`||t===`progress`||t===`select`||t===`textarea`}function Fn(e){if(Pn(e))return e;var t=null;return e.childNodes.forEach(function(e){if(t===null&&j(e)){var n=Fn(e);n!==null&&(t=n)}}),t}function In(e){if(e.control!==void 0)return e.control;var t=e.getAttribute(`for`);return t===null?Fn(e):e.ownerDocument.getElementById(t)}function Ln(e){var t=e.labels;if(t===null)return t;if(t!==void 0)return O(t);if(!Pn(e))return null;var n=e.ownerDocument;return O(n.querySelectorAll(`label`)).filter(function(t){return In(t)===e})}function Rn(e){var t=e.assignedNodes();return t.length===0?O(e.childNodes):t}function zn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=new $t,r=typeof Map>`u`?void 0:new Map,i=mn(e),a=t.compute,o=a===void 0?`name`:a,s=t.computedStyleSupportsPseudoElements,c=s===void 0?t.getComputedStyle!==void 0:s,l=t.getComputedStyle,u=l===void 0?i.getComputedStyle.bind(i):l,d=t.hidden,f=d!==void 0&&d,p=function(e,t){if(t!==void 0)throw Error(`use uncachedGetComputedStyle directly for pseudo elements`);if(r===void 0)return u(e);var n=r.get(e);if(n)return n;var i=u(e,t);return r.set(e,i),i};function m(e,t){var n=``;if(j(e)&&c&&(n=`${Nn(u(e,`::before`))} ${n}`),(_n(e)?Rn(e):O(e.childNodes).concat(xn(e,`aria-owns`))).forEach(function(e){var r=v(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0}),i=(j(e)?p(e).getPropertyValue(`display`):`inline`)===`inline`?``:` `;n+=`${i}${r}${i}`}),j(e)&&c){var r=Nn(u(e,`::after`));n=`${n} ${r}`}return n.trim()}function h(e,t){var r=e.getAttributeNode(t);return r!==null&&!n.has(r)&&r.value.trim()!==``?(n.add(r),r.value):null}function g(e){return j(e)?h(e,`title`):null}function _(e){if(!j(e))return null;if(hn(e)){n.add(e);for(var t=O(e.childNodes),r=0;r<t.length;r+=1){var i=t[r];if(gn(i))return v(i,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(fn(e)){n.add(e);for(var a=O(e.childNodes),o=0;o<a.length;o+=1){var s=a[o];if(ln(s))return v(s,{isEmbeddedInLabel:!1,isReferenced:!1,recursion:!1})}}else if(yn(e)){n.add(e);for(var c=O(e.childNodes),l=0;l<c.length;l+=1){var u=c[l];if(bn(u))return u.textContent}return null}else if(A(e)===`img`||A(e)===`area`){var d=h(e,`alt`);if(d!==null)return d}else if(un(e)){var f=h(e,`label`);if(f!==null)return f}if(M(e)&&(e.type===`button`||e.type===`submit`||e.type===`reset`)){var p=h(e,`value`);if(p!==null)return p;if(e.type===`submit`)return`Submit`;if(e.type===`reset`)return`Reset`}var g=Ln(e);if(g!==null&&g.length!==0)return n.add(e),O(g).map(function(e){return v(e,{isEmbeddedInLabel:!0,isReferenced:!1,recursion:!0})}).filter(function(e){return e.length>0}).join(` `);if(M(e)&&e.type===`image`){var _=h(e,`alt`);if(_!==null)return _;var y=h(e,`title`);return y===null?`Submit Query`:y}if(N(e,[`button`])){var b=m(e,{isEmbeddedInLabel:!1,isReferenced:!1});if(b!==``)return b}return null}function v(e,t){if(n.has(e))return``;if(!f&&Cn(e,p)&&!t.isReferenced)return n.add(e),``;var r=j(e)?e.getAttributeNode(`aria-labelledby`):null,i=r!==null&&!n.has(r)?xn(e,`aria-labelledby`):[];if(o===`name`&&!t.isReferenced&&i.length>0)return n.add(r),i.map(function(e){return v(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!0,recursion:!1})}).join(` `);var a=t.recursion&&wn(e)&&o===`name`;if(!a){var s=(j(e)&&e.getAttribute(`aria-label`)||``).trim();if(s!==``&&o===`name`)return n.add(e),s;if(!On(e)){var c=_(e);if(c!==null)return n.add(e),c}}if(N(e,[`menu`]))return n.add(e),``;if(a||t.isEmbeddedInLabel||t.isReferenced){if(N(e,[`combobox`,`listbox`])){n.add(e);var l=Dn(e);return l.length===0?M(e)?e.value:``:O(l).map(function(e){return v(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1,recursion:!0})}).join(` `)}if(Tn(e,`range`))return n.add(e),e.hasAttribute(`aria-valuetext`)?e.getAttribute(`aria-valuetext`):e.hasAttribute(`aria-valuenow`)?e.getAttribute(`aria-valuenow`):e.getAttribute(`value`)||``;if(N(e,[`textbox`]))return n.add(e),Mn(e)}if(An(e)||j(e)&&t.isReferenced||kn(e)||jn(e)){var u=m(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1});if(u!==``)return n.add(e),u}if(e.nodeType===e.TEXT_NODE)return n.add(e),e.textContent||``;if(t.recursion)return n.add(e),m(e,{isEmbeddedInLabel:t.isEmbeddedInLabel,isReferenced:!1});var d=g(e);return d===null?(n.add(e),``):(n.add(e),d)}return Sn(v(e,{isEmbeddedInLabel:!1,isReferenced:o===`description`,recursion:!1}))}function Bn(e){return N(e,[`caption`,`code`,`deletion`,`emphasis`,`generic`,`insertion`,`none`,`paragraph`,`presentation`,`strong`,`subscript`,`superscript`])}function Vn(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Bn(e)?``:zn(e,t)}function P(e){return`"`+e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)+`"`}function Hn(e){return e.replace(/\\(.)/g,`$1`)}function F(e){return e.replace(/\s+/g,` `).trim()}function Un(e){let t=``;for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];r.nodeType===Node.TEXT_NODE&&(t+=r.textContent||``)}return F(t)}function Wn(e){let t=e.innerText;return F(t??(e.textContent||``))}var Gn=`[data-deltaqa-veiled]:not(input):not(textarea)`;function Kn(e){return e.closest(Gn)!==null||e.querySelector(Gn)!==null}function qn(e){return e.closest(Gn)!==null}function Jn(e){switch(e.localName){case`a`:return e.hasAttribute(`href`)?`link`:null;case`button`:return`button`;case`input`:switch((e.type||`text`).toLowerCase()){case`button`:case`submit`:case`reset`:case`image`:return`button`;case`checkbox`:return`checkbox`;case`radio`:return`radio`;case`range`:return`slider`;case`search`:return`searchbox`;default:return`textbox`}case`select`:return`combobox`;case`textarea`:return`textbox`;case`img`:return`img`;case`nav`:return`navigation`;case`main`:return`main`;case`header`:return`banner`;case`footer`:return`contentinfo`;case`form`:return`form`;default:return null}}function Yn(e){return e.getAttribute(`role`)||Jn(e)}function I(e){let t=F(Vn(e));return t||!Xn(e)?t:F(e.getAttribute(`placeholder`)||``)}function Xn(e){return e.localName===`textarea`||e.localName===`input`&&[`textbox`,`searchbox`].indexOf(Jn(e)||``)>=0}function Zn(e){if(!e)return!1;if(/(^|[-:])_[A-Za-z]_[0-9A-Za-z]{1,12}_/.test(e))return!0;let t=e.split(/[-_:.\s]+/).filter(e=>e.length>0);for(let e of t)if(e.length>=3&&/[a-z]/i.test(e)&&/[0-9]/.test(e)||e.length>=4&&!/[aeiou]/i.test(e))return!0;let n=0,r=``;for(let t of e){if(t===`-`||t===`_`)continue;let e=/[0-9]/.test(t)?`digit`:/[a-z]/.test(t)?`lower`:/[A-Z]/.test(t)?`upper`:`other`;r&&r!==e&&!(r===`upper`&&e===`lower`)&&n++,r=e}return n>=e.length/4}function Qn(e){return e?e.split(/[-_:.\s]+/).filter(e=>e.length>0&&!/[0-9]/.test(e)).reduce((e,t)=>e.concat(t.split(/(?=[A-Z])/)),[]).filter(e=>e.length>=3&&/[aeiou]/i.test(e)&&!/[^aeiouy]{4,}/i.test(e)):[]}function $n(e){let t=er(e);return t===e||!t?`.`+CSS.escape(e):`[class*=`+P(t)+`]`}function er(e){if(!e)return``;if(!Zn(e))return e;let t=e.split(/([-_:.]+)/),n=``;for(let e of t){if(/^[-_:.]+$/.test(e)){n+=e;continue}if(Zn(e)||Qn(e).length===0)break;n+=e}return n.replace(/[-_:.]+$/,``)}function tr(e){return Qn(e).length>0}var nr=[`data-testid`];function L(e){let t=[],n=e=>{let r=e.querySelectorAll(`*`);for(let e=0;e<r.length;e++){let i=r[e];t.push(i),i.shadowRoot&&n(i.shadowRoot)}};return n(e),t}function rr(e,t){let n=[];try{let r=t.querySelectorAll(e);for(let e=0;e<r.length;e++)n.push(r[e])}catch{return[]}for(let r of L(t))if(r.shadowRoot)try{let t=r.shadowRoot.querySelectorAll(e);for(let e=0;e<t.length;e++)n.push(t[e])}catch{}return n}function ir(e,t){return e.localName===t.localName&&e.namespaceURI===t.namespaceURI}var ar=Object.getOwnPropertyDescriptor(Element.prototype,`children`).get,or=Object.getOwnPropertyDescriptor(Node.prototype,`parentNode`).get;function sr(e){let t=or.call(e);return t&&(t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host)?t:null}function cr(e){let t=sr(e);if(!t)return 1;let n=t.nodeType===Node.ELEMENT_NODE?ar.call(t):t.children,r=0;for(let t=0;t<n.length;t++){let i=n[t];if(ir(i,e)&&(r++,i===e))return r}return r}function lr(e){let t=e.localName,n=Array.prototype.slice.call(e.classList||[]).filter(tr);n.length>0&&(t+=$n(n[0]));let r=e.parentElement;return r&&Array.prototype.slice.call(r.children).filter(t=>ir(t,e)).length>1&&(t+=`:nth-of-type(`+cr(e)+`)`),t}function ur(e){let t=e.ownerDocument,n=lr(e),r=e.parentElement;for(;r&&r!==t.body&&r!==t.documentElement;){if(rr(n,t).length===1)return{kind:`HIERARCHICAL`,value:n,ambiguous:!1,source:`STRUCTURE`};n=lr(r)+` > `+n,r=r.parentElement}let i=rr(n,t);return{kind:`HIERARCHICAL`,value:n,ambiguous:!(i.length===1&&i[0]===e),source:`STRUCTURE`}}function dr(e){let t=[],n=e;for(;n;){t.unshift(n.tagName.toLowerCase()+`[`+cr(n)+`]`);let e=sr(n);e&&e.nodeType!==Node.ELEMENT_NODE?(t.unshift(`#shadow-root`),n=e.host):n=e}return`/`+t.join(`/`)}function fr(e){let t=[],n=e;for(;n&&n.nodeType===Node.ELEMENT_NODE;){if(n!==e&&D(n))return`id("`+D(n)+`")/`+t.join(`/`);t.unshift(n.tagName.toLowerCase()+`[`+cr(n)+`]`),n=n.parentElement}return``}function pr(e){let t={},n=hr(e);for(let r=0;r<e.attributes.length&&r<32;r++){let i=e.attributes[r];if(n&&i.name===`value`)continue;let a=i.name===`class`?Qn(i.value).join(` `):i.value;t[i.name]=a.length>200?a.slice(0,200):a}return t}var mr=new Set([`button`,`submit`,`reset`,`image`,`checkbox`,`radio`,`hidden`]);function hr(e){return e.localName===`textarea`||e.localName===`input`&&!mr.has((e.getAttribute(`type`)||`text`).toLowerCase())}function gr(e){let t=e.getBoundingClientRect(),n=[];for(let r of L(e.ownerDocument)){if(r===e||qn(r))continue;let i=Un(r);if(!i)continue;let a=r.getBoundingClientRect();a.left<=t.right+120&&a.right>=t.left-120&&a.top<=t.bottom+120&&a.bottom>=t.top-120&&n.push(i)}let r=n.join(` `);return r.length>200?r.slice(0,200):r}function R(e){return e.length>200?e.slice(0,200):e}function _r(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView;return{tagName:e.tagName.toLowerCase(),visibleText:Kn(e)?``:vr(Wn(e)),accessibleName:Kn(e)?``:R(I(e)),name:R(Vt(e)),id:R(D(e)),type:R(e.getAttribute(`type`)||``),ariaLabel:R(e.getAttribute(`aria-label`)||``),alt:R(e.getAttribute(`alt`)||``),href:R(e.getAttribute(`href`)||``),attributes:pr(e),neighborTexts:gr(e),absoluteXPath:dr(e),idRelativeXPath:fr(e),bounds:{x:t.left+(n?n.scrollX:0),y:t.top+(n?n.scrollY:0),width:t.width,height:t.height}}}function vr(e){return e.length>100?e.slice(0,100):e}function yr(e,t){let n=br(e,t.ownerDocument);return n.length===1&&n[0]===t}function br(e,t){switch(e.kind){case`CSS`:case`HIERARCHICAL`:return rr(e.value,t);case`TEXT`:{let n=Hn(e.value.replace(/^text="/,``).replace(/"$/,``));return L(t).filter(e=>Un(e)===n)}case`TEXT_CONTAINS`:{let n=/^([a-z][a-z0-9-]*):has-text\("(.*)"\)$/.exec(e.value);if(!n)return[];let r=n[1],i=Hn(n[2]).toLowerCase();return L(t).filter(e=>e.localName===r&&Wn(e).toLowerCase().indexOf(i)>=0)}case`ROLE`:{let n=/^role=([a-z]+)\[name="(.*)"\]$/.exec(e.value);if(!n)return[];let r=n[1],i=Hn(n[2]);return L(t).filter(e=>Yn(e)===r&&I(e)===i)}case`LABEL`:{let n=e.value;return L(t).filter(e=>[`input`,`select`,`textarea`].indexOf(e.localName)>=0&&I(e)===n)}default:return[]}}function xr(e){let t=[],n=(n,r,i)=>{if(!r)return;let a={kind:n,value:r,ambiguous:!1,source:i};yr(a,e)&&t.push(a)},r=D(e);r&&!Zn(r)&&n(`CSS`,`#`+CSS.escape(r),`IDENTIFIER`);for(let t of nr){let r=e.getAttribute(t);r&&n(`CSS`,`[`+t+`=`+P(r)+`]`,`TEST_ATTRIBUTE`)}let i=Kn(e),a=i?``:Un(e);a&&a.length<80&&n(`TEXT`,`text=`+P(a),`TEXT`);let o=i?``:Wn(e);!a&&o&&o.length<80&&n(`TEXT_CONTAINS`,e.localName+`:has-text(`+P(o)+`)`,`TEXT`);let s=Yn(e),c=i?``:I(e);s&&c&&c.length<50&&n(`ROLE`,`role=`+s+`[name=`+P(c)+`]`,`ACCESSIBLE_NAME`),[`input`,`select`,`textarea`].indexOf(e.localName)>=0&&c&&c.length<50&&n(`LABEL`,c,`ACCESSIBLE_NAME`);let l=Vt(e);l&&n(`CSS`,e.localName+`[name=`+P(l)+`]`,`NAME_ATTRIBUTE`);let u=Array.prototype.slice.call(e.classList||[]),d=u.filter(tr).concat(u.filter(e=>!tr(e))),f=e.localName;for(let n of d){f+=$n(n);let r={kind:`CSS`,value:f,ambiguous:!1,source:`CLASS`};if(yr(r,e)){t.push(r);break}}t.push(ur(e));let p={};return{selectors:t.filter(e=>{let t=e.kind+`|`+e.value;return p[t]?!1:(p[t]=!0,!0)}),properties:_r(e),textTruncated:o.length>100}}function z(e){"@babel/helpers - typeof";return z=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},z(e)}function Sr(e,t){if(z(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(z(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function Cr(e){var t=Sr(e,`string`);return z(t)==`symbol`?t:t+``}function B(e,t,n){return(t=Cr(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var wr=class extends Error{constructor(e,t,n,r){((...e)=>(super(...e),B(this,`sourceStart`,void 0),B(this,`sourceEnd`,void 0),B(this,`parserState`,void 0),this))(e),this.name=`ParseError`,this.sourceStart=t,this.sourceEnd=n,this.parserState=r}},V=class extends wr{constructor(e,t,n,r,i){((...e)=>(super(...e),B(this,`token`,void 0),this))(e,t,n,r),this.token=i}},H={UnexpectedNewLineInString:`Unexpected newline while consuming a string token.`,UnexpectedEOFInString:`Unexpected EOF while consuming a string token.`,UnexpectedEOFInComment:`Unexpected EOF while consuming a comment.`,UnexpectedEOFInURL:`Unexpected EOF while consuming a url token.`,UnexpectedEOFInEscapedCodePoint:`Unexpected EOF while consuming an escaped code point.`,UnexpectedCharacterInURL:`Unexpected character while consuming a url token.`,InvalidEscapeSequenceInURL:`Invalid escape sequence while consuming a url token.`,InvalidEscapeSequenceAfterBackslash:`Invalid escape sequence after "\\"`};typeof globalThis<`u`&&`structuredClone`in globalThis;var U=13,W=45,G=10,K=43,q=65533,J=92,Y,X,Tr;function Z(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function Er(e){return e>=97&&e<=122||e>=65&&e<=90||e===95||Dr(e)}function Dr(e){return e<183?e===0:e===183||e===8204||e===8205||e===8255||e===8256||e===8204||192<=e&&e<=214||216<=e&&e<=246||248<=e&&e<=893||895<=e&&e<=8191||8304<=e&&e<=8591||11264<=e&&e<=12271||12289<=e&&e<=55295||63744<=e&&e<=64975||65008<=e&&e<=65533||e===0||e>=55296&&e<=57343||e>=65536}function Or(e){return e===11||e===127||0<=e&&e<=8||14<=e&&e<=31}function Q(e){return e===G||e===U||e===12}function $(e){return e===32||e===G||e===9||e===U||e===12}function kr(e){return e>=55296&&e<=57343}function Ar(e,t){let n=jr(e,t),r=[];for(;!n.endOfFile();)r.push(n.nextToken());return r.push(n.nextToken()),r}function jr(e,t){let n=e.css.valueOf(),r=e.unicodeRangesAllowed??!1,i=0,a=0,o=-1,s=!1,c=t?.onParseError??Mr;function l(){let e=i;for(;;){let e=n.charCodeAt(i);if(e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===W||e===95){i+=1;continue}let t=n.codePointAt(i)??-1;if(t===0||t>=55296&&t<=57343||t===J&&!Q(n.codePointAt(i+1)??-1)||!Dr(t))break;i+=+(t>65535)+1}let t=n.codePointAt(i)??-1;if(t!==0&&!(t>=55296&&t<=57343)&&(t!==J||Q(n.codePointAt(i+1)??-1)))return s=!0,o=i-1,n.slice(e,i);s=!1,i=e,o=-1;let r=``;for(;;){let e=n.codePointAt(i)??-1;if(e===0||kr(e))r+=String.fromCharCode(q),i+=+(e>65535)+1,o=i-1;else if(e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===W||e===95||Dr(e))r+=e>65535?String.fromCodePoint(e):String.fromCharCode(e),i+=+(e>65535)+1,o=i-1;else{if(n.codePointAt(i)!==J||Q(n.codePointAt(i+1)??-1))return r;i+=1,o=i-1,r+=String.fromCodePoint(u())}}}function u(){let e=n.codePointAt(i);if(e===void 0)return c(new wr(H.UnexpectedEOFInEscapedCodePoint,a,o,[`4.3.7. Consume an escaped code point`,`Unexpected EOF`])),q;if(i+=+(e>65535)+1,o=i-1,Z(e)){let t=[e],r;for(;(r=n.codePointAt(i))!==void 0&&Z(r)&&t.length<6;)t.push(r),i+=1,o=i-1;$(n.codePointAt(i)??-1)&&(n.codePointAt(i)===U&&n.codePointAt(i+1)===G&&(i+=1),i+=1,o=i-1);let a=parseInt(String.fromCodePoint(...t),16);return a===0||kr(a)||a>1114111?q:a}return e===0||kr(e)?q:e}function d(){for(;;){let e=n.codePointAt(i);if(e===void 0)return;if(e===41)return i+=1,void(o=i-1);e!==J||Q(n.codePointAt(i+1)??-1)?(i+=1,o=i-1):(i+=1,o=i-1,u())}}function f(){for(i+=2,o=i-1;;){let e=n.codePointAt(i);if(e===void 0){let e=[Y.Comment,n.slice(a,o+1),a,o,void 0];return c(new V(H.UnexpectedEOFInComment,a,o,[`4.3.2. Consume comments`,`Unexpected EOF`],e)),e}if(i+=1,o=i-1,e===42&&n.codePointAt(i)!==void 0&&n.codePointAt(i)===47){i+=1,o=i-1;break}}return[Y.Comment,n.slice(a,o+1),a,o,void 0]}function p(){let e=``,t=n.codePointAt(i);for(i+=1,o=i-1;;){let r=n.charCodeAt(i);if(i>=n.length){let t=[Y.String,n.slice(a,o+1),a,o,{value:e}];return c(new V(H.UnexpectedEOFInString,a,o,[`4.3.5. Consume a string token`,`Unexpected EOF`],t)),t}if(i+=1,o=i-1,Q(r)){--i,o=i-1;let e=[Y.BadString,n.slice(a,o+1),a,o,void 0];return c(new V(H.UnexpectedNewLineInString,a,n.codePointAt(i)===U&&n.codePointAt(i+1)===G?o+2:o+1,[`4.3.5. Consume a string token`,`Unexpected newline`],e)),e}if(r===t)return[Y.String,n.slice(a,o+1),a,o,{value:e}];if(r!==J)if(r!==0)if(r<128)e+=String.fromCharCode(r);else{if(r>=55296&&r<=57343){let t=n.codePointAt(i-1)??-1;t>=65536?(e+=String.fromCodePoint(t),i+=1,o=i-1):e+=String.fromCharCode(q);continue}e+=String.fromCharCode(r)}else e+=String.fromCharCode(q);else{if(n.codePointAt(i)===void 0)continue;if(Q(n.codePointAt(i)??-1)){n.codePointAt(i)===U&&n.codePointAt(i+1)===G&&(i+=1),i+=1,o=i-1;continue}e+=String.fromCodePoint(u())}}}function m(){i+=2,o=i-1;let e=[],t=[],r;for(;(r=n.codePointAt(i))!==void 0&&e.length<6&&Z(r);)e.push(r),i+=1,o=i-1;for(;(r=n.codePointAt(i))!==void 0&&e.length<6&&r===63;)t.length===0&&t.push(...e),e.push(48),t.push(70),i+=1,o=i-1;if(!t.length&&n.codePointAt(i)===W&&Z(n.codePointAt(i+1)??-1))for(i+=1,o=i-1;(r=n.codePointAt(i))!==void 0&&t.length<6&&Z(r);)t.push(r),i+=1,o=i-1;if(!t.length){let t=parseInt(String.fromCodePoint(...e),16);return[Y.UnicodeRange,n.slice(a,o+1),a,o,{startOfRange:t,endOfRange:t}]}let s=parseInt(String.fromCodePoint(...e),16),c=parseInt(String.fromCodePoint(...t),16);return[Y.UnicodeRange,n.slice(a,o+1),a,o,{startOfRange:s,endOfRange:c}]}function h(){for(;$(n.codePointAt(i)??-1);)i+=1,o=i-1;let e=``;for(;;){if(n.codePointAt(i)===void 0){let t=[Y.URL,n.slice(a,o+1),a,o,{value:e}];return c(new V(H.UnexpectedEOFInURL,a,o,[`4.3.6. Consume a url token`,`Unexpected EOF`],t)),t}if(n.codePointAt(i)===41)return i+=1,o=i-1,[Y.URL,n.slice(a,o+1),a,o,{value:e}];if($(n.codePointAt(i)??-1)){for(i+=1,o=i-1;$(n.codePointAt(i)??-1);)i+=1,o=i-1;if(n.codePointAt(i)===void 0){let t=[Y.URL,n.slice(a,o+1),a,o,{value:e}];return c(new V(H.UnexpectedEOFInURL,a,o,[`4.3.6. Consume a url token`,`Consume as much whitespace as possible`,`Unexpected EOF`],t)),t}return n.codePointAt(i)===41?(i+=1,o=i-1,[Y.URL,n.slice(a,o+1),a,o,{value:e}]):(d(),[Y.BadURL,n.slice(a,o+1),a,o,void 0])}let t=n.codePointAt(i);if(t===34||t===39||t===40||Or(t??-1)){d();let e=[Y.BadURL,n.slice(a,o+1),a,o,void 0];return c(new V(H.UnexpectedCharacterInURL,a,o,[`4.3.6. Consume a url token`,`Unexpected U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point`],e)),e}if(t===J){if(t===J&&!Q(n.codePointAt(i+1)??-1)){i+=1,o=i-1,e+=String.fromCodePoint(u());continue}d();let r=[Y.BadURL,n.slice(a,o+1),a,o,void 0];return c(new V(H.InvalidEscapeSequenceInURL,a,o,[`4.3.6. Consume a url token`,`U+005C REVERSE SOLIDUS (\\)`,`The input stream does not start with a valid escape sequence`],r)),r}t===0||kr(t??-1)?(e+=String.fromCharCode(q),i+=1,o=i-1):(e+=String.fromCodePoint(t??q),i+=+((t??-1)>65535)+1,o=i-1)}}function g(){let e;{let t=n.charCodeAt(i);t===W?e=`-`:t===K&&(e=`+`)}let t=X.Integer,r=n.charCodeAt(i);r!==K&&r!==W||(i+=1);let s=n.charCodeAt(i);for(;s>=48&&s<=57;)i+=1,s=n.charCodeAt(i);if(n.charCodeAt(i)===46&&n.charCodeAt(i+1)>=48&&n.charCodeAt(i+1)<=57)for(i+=2,t=X.Number,s=n.charCodeAt(i);s>=48&&s<=57;)i+=1,s=n.charCodeAt(i);let c=n.charCodeAt(i);if(c===101||c===69){let e=n.charCodeAt(i+1);if(e>=48&&e<=57)for(i+=2,t=X.Number,s=n.charCodeAt(i);s>=48&&s<=57;)i+=1,s=n.charCodeAt(i);else if((e===W||e===K)&&n.charCodeAt(i+2)>=48&&n.charCodeAt(i+2)<=57)for(i+=3,t=X.Number,s=n.charCodeAt(i);s>=48&&s<=57;)i+=1,s=n.charCodeAt(i)}o=i-1;let u=parseFloat(n.slice(a,o+1));if(x()){let r=l();return[Y.Dimension,n.slice(a,o+1),a,o,{value:u,signCharacter:e,type:t,unit:r}]}return n.charCodeAt(i)===37?(i+=1,o=i-1,[Y.Percentage,n.slice(a,o+1),a,o,{value:u,signCharacter:e}]):[Y.Number,n.slice(a,o+1),a,o,{value:u,signCharacter:e,type:t}]}function _(){let e=l();if(n.charCodeAt(i)!==40)return[Y.Ident,s?e:n.slice(a,o+1),a,o,{value:e}];if(!(e.length!==3||e.charCodeAt(0)!==117&&e.charCodeAt(0)!==85||e.charCodeAt(1)!==114&&e.charCodeAt(1)!==82||e.charCodeAt(2)!==108&&e.charCodeAt(2)!==76)){i+=1,o=i-1;let t=0;for(;$(n.charCodeAt(i));)t+=1,i+=1,o=i-1;let r=n.charCodeAt(i);return r===34||r===39?(t>0&&(i-=t,o=i-1),[Y.Function,n.slice(a,o+1),a,o,{value:e}]):h()}return i+=1,o=i-1,[Y.Function,n.slice(a,o+1),a,o,{value:e}]}function v(){i+=1,o=i-1;let e=n.charCodeAt(i);if(e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===W||e===95||Dr(e)||e===J&&!Q(n.codePointAt(i+1)??-1)){let e=Tr.Unrestricted;x()&&(e=Tr.ID);let t=l();return[Y.Hash,n.slice(a,o+1),a,o,{value:t,type:e}]}return[Y.Delim,`#`,a,o,{value:`#`}]}function y(){if(i+=1,o=i-1,x()){let e=l();return[Y.AtKeyword,n.slice(a,o+1),a,o,{value:e}]}return[Y.Delim,`@`,a,o,{value:`@`}]}function b(){i+=1,o=i-1;let e=[Y.Delim,`\\`,a,o,{value:`\\`}];return c(new V(H.InvalidEscapeSequenceAfterBackslash,a,o,[`4.3.1. Consume a token`,`U+005C REVERSE SOLIDUS (\\)`,`The input stream does not start with a valid escape sequence`],e)),e}function x(e){let t=e===void 0?n.charCodeAt(i):e;return t===W?n.charCodeAt(i+1)===W||!!Er(n.charCodeAt(i+1))||n.charCodeAt(i+1)===J&&!Q(n.charCodeAt(i+2)):!!Er(t)||n.charCodeAt(i)===J&&!Q(n.charCodeAt(i+1))}function S(e){return e===K||e===W?n.charCodeAt(i+1)>=48&&n.charCodeAt(i+1)<=57||n.charCodeAt(i+1)===46&&n.charCodeAt(i+2)>=48&&n.charCodeAt(i+2)<=57:e===46?n.charCodeAt(i+1)>=48&&n.charCodeAt(i+1)<=57:e>=48&&e<=57}return{nextToken:function(){if(a=i,o=-1,i>=n.length)return[Y.EOF,``,-1,-1,void 0];let e=n.charCodeAt(i);if(e===47&&n.charCodeAt(i+1)===42)return f();if(r&&(e===117||e===85)&&n.codePointAt(i+1)===K&&(n.codePointAt(i+2)===63||Z(n.codePointAt(i+2)??-1)))return m();if(Er(e))return _();if((t=e)>=48&&t<=57)return g();switch(e){case 44:return i+=1,o=i-1,[Y.Comma,`,`,a,o,void 0];case 58:return i+=1,o=i-1,[Y.Colon,`:`,a,o,void 0];case 59:return i+=1,o=i-1,[Y.Semicolon,`;`,a,o,void 0];case 40:return i+=1,o=i-1,[Y.OpenParen,`(`,a,o,void 0];case 41:return i+=1,o=i-1,[Y.CloseParen,`)`,a,o,void 0];case 91:return i+=1,o=i-1,[Y.OpenSquare,`[`,a,o,void 0];case 93:return i+=1,o=i-1,[Y.CloseSquare,`]`,a,o,void 0];case 123:return i+=1,o=i-1,[Y.OpenCurly,`{`,a,o,void 0];case 125:return i+=1,o=i-1,[Y.CloseCurly,`}`,a,o,void 0];case 39:case 34:return p();case 35:return v();case K:case 46:return S(e)?g():(i+=1,o=i-1,[Y.Delim,n[a],a,o,{value:n[a]}]);case G:case U:case 12:case 9:case 32:{let e=n.charCodeAt(i);for(;e===32||e===G||e===9||e===U||e===12;)i+=1,e=n.charCodeAt(i);o=i-1}return[Y.Whitespace,n.slice(a,o+1),a,o,void 0];case W:return S(e)?g():n.charCodeAt(i+1)===W&&n.charCodeAt(i+2)===62?(i+=3,o=i-1,[Y.CDC,`-->`,a,o,void 0]):x(e)?_():(i+=1,o=i-1,[Y.Delim,`-`,a,o,{value:`-`}]);case 60:return n.charCodeAt(i+1)===33&&n.charCodeAt(i+2)===W&&n.charCodeAt(i+3)===W?(i+=4,o=i-1,[Y.CDO,`<!--`,a,o,void 0]):(i+=1,o=i-1,[Y.Delim,`<`,a,o,{value:`<`}]);case 64:return y();case J:return e!==J||Q(n.charCodeAt(i+1))?b():_();default:return i+=1,o=i-1,[Y.Delim,n[a],a,o,{value:n[a]}]}var t},endOfFile:function(){return i>=n.length}}}function Mr(){}(function(e){e.Comment=`comment`,e.AtKeyword=`at-keyword-token`,e.BadString=`bad-string-token`,e.BadURL=`bad-url-token`,e.CDC=`CDC-token`,e.CDO=`CDO-token`,e.Colon=`colon-token`,e.Comma=`comma-token`,e.Delim=`delim-token`,e.Dimension=`dimension-token`,e.EOF=`EOF-token`,e.Function=`function-token`,e.Hash=`hash-token`,e.Ident=`ident-token`,e.Number=`number-token`,e.Percentage=`percentage-token`,e.Semicolon=`semicolon-token`,e.String=`string-token`,e.URL=`url-token`,e.Whitespace=`whitespace-token`,e.OpenParen=`(-token`,e.CloseParen=`)-token`,e.OpenSquare=`[-token`,e.CloseSquare=`]-token`,e.OpenCurly=`{-token`,e.CloseCurly=`}-token`,e.UnicodeRange=`unicode-range-token`})(Y||(Y={})),function(e){e.Integer=`integer`,e.Number=`number`}(X||(X={})),function(e){e.Unrestricted=`unrestricted`,e.ID=`id`}(Tr||(Tr={})),Object.values(Y);var Nr=new Set([`url`,`src`,`image-set`,`-webkit-image-set`]);function Pr(e,t){let n=new Set,r=new Set,i=[],a,o=!1,s=e=>{let s=Rr(e,t);s!==void 0&&(a===`import`&&!o&&i.length<=1?(o=!0,n.add(s)):a!==`namespace`&&r.add(s))};for(let t of Ar({css:e}))switch(t[0]){case Y.AtKeyword:{let e=t[4].value.toLowerCase();i.length===0&&(a=e===`import`||e===`namespace`?e:void 0,o=!1);break}case Y.Semicolon:case Y.OpenCurly:case Y.CloseCurly:i.length===0&&(a=void 0),t[0]===Y.OpenCurly&&(i.length=0);break;case Y.Function:i.push(t[4].value.toLowerCase());break;case Y.OpenParen:case Y.OpenSquare:i.push(``);break;case Y.CloseParen:case Y.CloseSquare:i.pop();break;case Y.URL:s(t[4].value);break;case Y.String:{let e=i.at(-1);(e!==void 0&&Nr.has(e)||a===`import`&&i.length===0)&&s(t[4].value);break}default:break}return{imports:[...n],urls:[...r]}}function Fr(e,t){let n=Ir(e);if(n!==void 0)return new TextDecoder(n.encoding).decode(e.subarray(n.length));let r=/;\s*charset\s*=\s*"?([^";\s]+)/i.exec(t)?.[1],i=r===void 0?void 0:Lr(r);if(i!==void 0)return i.decode(e);let a=/^@charset "([^"]{1,40})";/.exec(new TextDecoder(`latin1`).decode(e.subarray(0,1024)))?.[1];return((a===void 0?void 0:Lr(/^utf-16(be|le)$/i.test(a)?`utf-8`:a))??new TextDecoder(`utf-8`)).decode(e)}function Ir(e){if(e[0]===239&&e[1]===187&&e[2]===191)return{encoding:`utf-8`,length:3};if(e[0]===254&&e[1]===255)return{encoding:`utf-16be`,length:2};if(e[0]===255&&e[1]===254)return{encoding:`utf-16le`,length:2}}function Lr(e){try{return new TextDecoder(e.trim())}catch(e){if(e instanceof RangeError)return;throw e}}function Rr(e,t){let n=e.trim();if(n===``||n.startsWith(`#`)||!URL.canParse(n,t))return;let r=new URL(n,t);if(!(r.protocol!==`http:`&&r.protocol!==`https:`))return r.hash=``,r.href}function zr(e=!1){return Lt(document,e?window:void 0)}function Br(){zt(document)}function Vr(){return Ft(document)}function Hr(e,t){ct(e,t)}function Ur(e){lt(e)}function Wr(e){return ut(It(document),e)}function Gr(e){return ke(document,e.flat())}function Kr(e=``){let t=oe(document),n=e===``?t.styles:[...t.styles,{text:e,base:document.baseURI}],r=new Set(t.urls);for(let e of n){let t=Pr(e.text,e.base);t.imports.forEach(e=>r.add(e)),t.urls.forEach(e=>r.add(e))}return{origin:self.origin,url:document.URL,urls:[...r]}}function qr(e){return e.map(e=>{let t=Pr(Fr(ri(e.base64),e.contentType),e.url);return[...t.imports,...t.urls]})}function Jr(e){return Promise.all(e.map(async e=>{let t;try{t=await fetch(e,{cache:`force-cache`,credentials:`same-origin`,redirect:`manual`,signal:AbortSignal.timeout(Yr)})}catch(t){return t instanceof TypeError?{url:e,refused:String(t)}:{url:e,failure:String(t)}}if(t.type===`opaqueredirect`)return{url:e,redirected:!0};try{return{url:e,status:t.status,contentType:t.headers.get(`content-type`)??``,base64:await ii(await t.blob())}}catch(t){return{url:e,failure:String(t)}}}))}var Yr=3e4,Xr=16;function Zr(){return 16}function Qr(e){return e.map(e=>{let t=ri(e),n=(e,n)=>[...n].every((n,r)=>t[e+r]===n.charCodeAt(0));return n(0,`GIF8`)||t[0]===137&&n(1,`PNG`)||n(0,`RIFF`)&&n(8,`WEBP`)})}function $r(e){return e.map(e=>{let t=ge(ri(e));return t===null?null:ve(t.width,t.height)})}function ei(e,t=self===top){return e.map(e=>e.ownerDocument===document&&t?xr(e):null)}function ti(e){return e.map(e=>e instanceof Element&&e.isConnected)}function ni(){return{width:window.innerWidth,height:window.innerHeight,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,dark:window.matchMedia(`(prefers-color-scheme: dark)`).matches,devicePixelRatio:window.devicePixelRatio,userAgent:navigator.userAgent}}function ri(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function ii(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let e=String(r.result);t(e.slice(e.indexOf(`,`)+1))},r.onerror=()=>n(r.error),r.readAsDataURL(e)})}return e.HEAD_BYTES=Xr,e.READ_IN_PAGE_TIMEOUT_MS=Yr,e.cited=Kr,e.connected=ti,e.engineStyles=Vr,e.environment=ni,e.eraseNotes=Br,e.headBytes=Zr,e.lostDrawings=Gr,e.markFrame=Hr,e.mayBeAnimated=Qr,e.note=zr,e.readInPage=Jr,e.selectorSets=ei,e.serialize=Wr,e.sheetsCited=qr,e.stills=$r,e.unmarkFrame=Ur,e})({});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# What the SDK raises, the same refusals as every Vision SDK: a test rescues each by its class.
|
|
2
|
+
module DeltaQa
|
|
3
|
+
module Vision
|
|
4
|
+
# The environment does not let the SDK reach Delta-QA: a variable is missing or wrong — named, never its value.
|
|
5
|
+
class ConfigurationError < StandardError
|
|
6
|
+
attr_reader :variable
|
|
7
|
+
|
|
8
|
+
def initialize(message, variable)
|
|
9
|
+
super(message)
|
|
10
|
+
@variable = variable
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# A refusal answered by Delta-QA, or an answer the SDK cannot read: its code, and the ticket to quote. Never the API key.
|
|
15
|
+
class ApiError < StandardError
|
|
16
|
+
attr_reader :status, :code, :ticket, :params
|
|
17
|
+
|
|
18
|
+
def initialize(message, status, code = nil, ticket = nil, params = {})
|
|
19
|
+
super(message)
|
|
20
|
+
@status = status
|
|
21
|
+
@code = code
|
|
22
|
+
@ticket = ticket
|
|
23
|
+
@params = params
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Delta-QA could not be reached: no answer came, the network said why (its cause).
|
|
28
|
+
class UnreachableError < StandardError; end
|
|
29
|
+
|
|
30
|
+
# The wait for the result of a closed launch ran out: Delta-QA still compares it; the launch keeps running there.
|
|
31
|
+
class LaunchResultTimeoutError < StandardError
|
|
32
|
+
attr_reader :launch_id
|
|
33
|
+
|
|
34
|
+
def initialize(launch_id, timeout_s, last_result)
|
|
35
|
+
last = last_result.nil? ? "" : " (last read: #{last_result})"
|
|
36
|
+
super("Delta-QA has not decided launch #{launch_id} within #{(timeout_s * 1000).to_i} ms#{last}: the launch keeps running on Delta-QA")
|
|
37
|
+
@launch_id = launch_id
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# A resource the page cites could not be read, for another reason than the network: nothing is sent.
|
|
42
|
+
class ResourceUnreadableError < StandardError
|
|
43
|
+
attr_reader :url
|
|
44
|
+
|
|
45
|
+
def initialize(url, reason)
|
|
46
|
+
super("The resource #{url} could not be read: #{reason}")
|
|
47
|
+
@url = url
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# A resource is larger than Delta-QA admits in a check: nothing is sent.
|
|
52
|
+
class ResourceTooLargeError < StandardError
|
|
53
|
+
def initialize(url, size, limit)
|
|
54
|
+
super("The resource #{url} weighs #{size} bytes, more than the #{limit} bytes Delta-QA admits")
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# A zone of a check designates no element of the page: nothing is sent.
|
|
59
|
+
class ZoneNotFoundError < StandardError
|
|
60
|
+
def initialize(kind, zone, size)
|
|
61
|
+
at = size.nil? ? "" : " at the size #{size}"
|
|
62
|
+
super("The zone to #{kind} #{zone} designates no element of the page#{at}")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# The browser of the test is not at a device pixel ratio of 1: Delta-QA compares pages at a device pixel ratio of 1 only. Nothing is sent.
|
|
67
|
+
class UnsupportedDensityError < StandardError
|
|
68
|
+
def initialize(device_pixel_ratio)
|
|
69
|
+
super("The browser of the test is at a device pixel ratio of #{device_pixel_ratio}: Delta-QA compares pages at a device pixel ratio of 1 only" \
|
|
70
|
+
" — give the browser --force-device-scale-factor=1")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# The browser of the test is not Chrome, Chromium or Edge, the browsers Delta-QA Vision captures a page in: nothing is opened.
|
|
75
|
+
class UnsupportedBrowserError < StandardError
|
|
76
|
+
CODE = "DELTAQA_UNSUPPORTED_BROWSER".freeze
|
|
77
|
+
|
|
78
|
+
def initialize(browser)
|
|
79
|
+
super("Delta-QA Vision captures the page in Chrome, Chromium or Edge. This test runs in #{browser}: run it under Chrome.")
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# A check of the Vision test already has this name: the name pairs a check with its reference. Nothing is taken.
|
|
84
|
+
class DuplicateCheckNameError < ArgumentError
|
|
85
|
+
def initialize(name)
|
|
86
|
+
super("The Vision test already has a check named #{name}: give each check of a test its own name")
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# A launch of the Vision test was not passed: a difference awaits a judgment, or Delta-QA failed it.
|
|
91
|
+
class TestFailedError < StandardError
|
|
92
|
+
attr_reader :results
|
|
93
|
+
|
|
94
|
+
def initialize(results)
|
|
95
|
+
launches = results.launches.map { |launch| "#{launch.size} #{launch.result}" }.join(", ")
|
|
96
|
+
super("Delta-QA did not pass the Vision test #{results.test_name}: #{launches} — judge it in Delta-QA: #{results.commit_url}")
|
|
97
|
+
@results = results
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# A document of the page was still being received at the page load timeout of the test.
|
|
102
|
+
class DocumentStillReceivingError < StandardError
|
|
103
|
+
attr_reader :document_url
|
|
104
|
+
|
|
105
|
+
def initialize(document_url, message)
|
|
106
|
+
super(message)
|
|
107
|
+
@document_url = document_url
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
require_relative "relay"
|
|
2
|
+
require_relative "resize_wait"
|
|
3
|
+
|
|
4
|
+
module DeltaQa
|
|
5
|
+
module Vision
|
|
6
|
+
# The page of a Ferrum test (and of Cuprite, which drives Ferrum) as the relay takes it. Ferrum talks Chromium's
|
|
7
|
+
# protocol directly: the adapter evaluates in each frame through Ferrum's frames, a frame of another origin included,
|
|
8
|
+
# holds a frame tag by the protocol (DOM.getFrameOwner), and sends the protocol's commands on the page's own session
|
|
9
|
+
# (Page#command) — Ferrum's, never detached.
|
|
10
|
+
class FerrumPageDriver
|
|
11
|
+
# What Chromium's protocol says, through Ferrum, when the page changed under a call.
|
|
12
|
+
CHANGING = ["Execution context was destroyed", "Cannot find context with specified id", "No node with given id found",
|
|
13
|
+
"Node with given id does not belong to the document", "Could not find node with given id", "Node is detached",
|
|
14
|
+
"Frame was detached", "No frame for given id found", "Frame with the given id was not found",
|
|
15
|
+
"node is not trackable", "There's no context available", "Could not find object with given id"].freeze
|
|
16
|
+
POLL_S = 0.05
|
|
17
|
+
|
|
18
|
+
# The page's own session of Chromium's protocol: Ferrum's, which stays.
|
|
19
|
+
class Session
|
|
20
|
+
def initialize(page)
|
|
21
|
+
@page = page
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def send(method, params)
|
|
25
|
+
@page.command(method, **params.transform_keys(&:to_sym))
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Ferrum's own session stays: the page needs it.
|
|
29
|
+
def close; end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# A document of the page: the Ferrum frame that evaluates in it, and the protocol's ids of its frame and parent.
|
|
33
|
+
Held = Struct.new(:frame, :id, :parent_id)
|
|
34
|
+
# A frame tag held: the frame of its parent document, and the tag as a remote object of that document.
|
|
35
|
+
Host = Struct.new(:frame, :tag)
|
|
36
|
+
|
|
37
|
+
# A Ferrum::Browser follows the page it shows (Cuprite switches windows); a Ferrum::Page is that page.
|
|
38
|
+
def initialize(browser_or_page)
|
|
39
|
+
@target = browser_or_page
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def framework
|
|
43
|
+
"Ferrum"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def browser
|
|
47
|
+
# "HeadlessChrome/158.0.…", "Chrome/…": the browser at the other end of Ferrum's protocol.
|
|
48
|
+
product = page.command("Browser.getVersion")["product"].to_s
|
|
49
|
+
[!product.match?(/firefox/i) && !product.empty?, product]
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def url
|
|
53
|
+
page.main_frame.evaluate("document.location.href")
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def title
|
|
57
|
+
page.main_frame.evaluate("document.title")
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def documents
|
|
61
|
+
documents = []
|
|
62
|
+
walk(page.command("Page.getFrameTree")["frameTree"], 0, nil, documents)
|
|
63
|
+
documents
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def evaluate(document, function, args)
|
|
67
|
+
document.handle.frame.evaluate(declaration(function), args)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def host_of(document)
|
|
71
|
+
held = document.handle
|
|
72
|
+
# The parent first: a frame gone by now leaves no handle held in the page.
|
|
73
|
+
parent = frame_of(held.parent_id)
|
|
74
|
+
owner = page.command("DOM.getFrameOwner", frameId: held.id)
|
|
75
|
+
tag = page.command("DOM.resolveNode", backendNodeId: owner["backendNodeId"])["object"]
|
|
76
|
+
Host.new(parent, ::Ferrum::RemoteObject.new(parent, page, tag))
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def evaluate_on(element, function, args)
|
|
80
|
+
on_element = "function (args) {\nreturn (function (#{function.params.join(", ")}) {\n#{function.body}\n}).call(null, this, args);\n}"
|
|
81
|
+
element.frame.evaluate_in(element.tag, on_element, [args], {})
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def release(element)
|
|
85
|
+
page.command("Runtime.releaseObject", objectId: element.tag.remote_id)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def document_received(document)
|
|
89
|
+
timeout_s = page.timeout
|
|
90
|
+
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + timeout_s
|
|
91
|
+
loop do
|
|
92
|
+
return unless document.handle.frame.evaluate("document.readyState") == "loading"
|
|
93
|
+
if Process.clock_gettime(Process::CLOCK_MONOTONIC) > deadline
|
|
94
|
+
raise DocumentStillReceivingError.new(document.url, "still loading after the timeout of the browser, #{(timeout_s * 1000).to_i} ms")
|
|
95
|
+
end
|
|
96
|
+
sleep POLL_S
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def open_cdp
|
|
101
|
+
Session.new(page)
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def viewport
|
|
105
|
+
width, height = page.main_frame.evaluate("[window.innerWidth, window.innerHeight]")
|
|
106
|
+
Relay::Size.new(width.to_i, height.to_i)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Ferrum and Cuprite emulate the viewport of their pages at the window's size: the size given back is set the same way.
|
|
110
|
+
def resize(size)
|
|
111
|
+
return if viewport == size
|
|
112
|
+
top = page.main_frame
|
|
113
|
+
top.execute(ResizeWait::LISTEN)
|
|
114
|
+
begin
|
|
115
|
+
page.set_viewport(width: size.width, height: size.height)
|
|
116
|
+
begin
|
|
117
|
+
resized = top.evaluate(ResizeWait::RESIZED, timeout: ResizeWait::TIMEOUT_MS / 1000.0)
|
|
118
|
+
rescue ::Ferrum::ScriptTimeoutError
|
|
119
|
+
raise ResizeWait.timed_out(size)
|
|
120
|
+
end
|
|
121
|
+
raise ResizeWait.timed_out(size) unless resized == true
|
|
122
|
+
ensure
|
|
123
|
+
top.execute(ResizeWait::FORGET)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def zone_selector_sets(zone, kind, function)
|
|
128
|
+
case zone
|
|
129
|
+
when String
|
|
130
|
+
[%(css selector "#{zone}"), in_top(function, "Array.from(document.querySelectorAll(selector))", zone)]
|
|
131
|
+
when Hash
|
|
132
|
+
[zone.inspect, of_locator(zone, function)]
|
|
133
|
+
when ::Ferrum::Node
|
|
134
|
+
of_node(zone, kind, function)
|
|
135
|
+
else
|
|
136
|
+
raise TypeError, "A zone of a Ferrum test is a CSS selector, a locator ({css: \"#cart\"} or {xpath: \"//main\"}) " \
|
|
137
|
+
"or a Ferrum::Node, got #{zone.inspect}"
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
def page_changing?(error)
|
|
142
|
+
return true if error.is_a?(::Ferrum::NodeNotFoundError) || error.is_a?(::Ferrum::NoExecutionContextError)
|
|
143
|
+
error.is_a?(::Ferrum::Error) && CHANGING.any? { |marker| error.message.to_s.include?(marker) }
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
private
|
|
147
|
+
|
|
148
|
+
def page
|
|
149
|
+
@target.is_a?(::Ferrum::Browser) ? @target.page : @target
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
def walk(tree, depth, parent_id, documents)
|
|
153
|
+
frame = tree["frame"]
|
|
154
|
+
url = "#{frame["url"]}#{frame["urlFragment"]}"
|
|
155
|
+
# No document arrived in this frame: its reading would never answer.
|
|
156
|
+
if depth.zero? || !url.empty?
|
|
157
|
+
documents << Relay::PageDocument.new(url, depth, Held.new(depth.zero? ? page.main_frame : frame_of(frame["id"]), frame["id"], parent_id))
|
|
158
|
+
end
|
|
159
|
+
(tree["childFrames"] || []).each { |child| walk(child, depth + 1, frame["id"], documents) }
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def frame_of(id)
|
|
163
|
+
top = page.main_frame
|
|
164
|
+
return top if id == top.id
|
|
165
|
+
frame = page.frame_by(id: id)
|
|
166
|
+
raise ::Ferrum::Error, "Frame was detached: Ferrum holds no frame #{id} of the page any more" if frame.nil?
|
|
167
|
+
frame
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# A locator: one pair, by CSS or by XPath, found in the top document.
|
|
171
|
+
def of_locator(zone, function)
|
|
172
|
+
raise ArgumentError, "A locator zone is one pair, {css: \"#cart\"} or {xpath: \"//main\"}, got #{zone.inspect}" unless zone.size == 1
|
|
173
|
+
how, what = zone.first
|
|
174
|
+
case how.to_sym
|
|
175
|
+
when :css
|
|
176
|
+
in_top(function, "Array.from(document.querySelectorAll(selector))", what)
|
|
177
|
+
when :xpath
|
|
178
|
+
in_top(function, "(() => { const found = document.evaluate(selector, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); " \
|
|
179
|
+
"return Array.from({ length: found.snapshotLength }, (_, index) => found.snapshotItem(index)); })()", what)
|
|
180
|
+
else
|
|
181
|
+
raise ArgumentError, "A locator zone of a Ferrum test is by css: or xpath:, got #{zone.inspect}"
|
|
182
|
+
end
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# The function called on the elements the expression finds in the top document, the selector its argument.
|
|
186
|
+
def in_top(function, elements, selector)
|
|
187
|
+
page.main_frame.evaluate("function (selector) {\nconst elements = #{elements};\n" \
|
|
188
|
+
"return (function (#{function.params.join(", ")}) {\n#{function.body}\n}).call(null, [elements]);\n}", selector)
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# A node is evaluated on in its own document: the capture script names a node of a frame (null).
|
|
192
|
+
def of_node(node, kind, function)
|
|
193
|
+
described = "element #{node.inspect}"
|
|
194
|
+
unless node.page.equal?(page)
|
|
195
|
+
raise ArgumentError, "The zone to #{kind} #{described} is an element of another page: designate the zones on the page of the test"
|
|
196
|
+
end
|
|
197
|
+
begin
|
|
198
|
+
connected = node.evaluate(on_this(Relay.capture("connected")))
|
|
199
|
+
rescue ::Ferrum::Error => e # a node of a document the page replaced designates nothing
|
|
200
|
+
return [described, []] if page_changing?(e)
|
|
201
|
+
raise
|
|
202
|
+
end
|
|
203
|
+
return [described, []] unless connected[0] == true
|
|
204
|
+
[described, node.evaluate(on_this(function))]
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def on_this(function)
|
|
208
|
+
"function () {\nreturn (function (#{function.params.join(", ")}) {\n#{function.body}\n}).call(null, [[this]]);\n}"
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# A function of the page as Ferrum calls it: its declaration, which carries the capture script.
|
|
212
|
+
def declaration(function)
|
|
213
|
+
"function (#{function.params.join(", ")}) {\n#{function.body}\n}"
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
end
|
|
217
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
require "delegate"
|
|
2
|
+
require_relative "selenium"
|
|
3
|
+
require_relative "ferrum"
|
|
4
|
+
|
|
5
|
+
module DeltaQa
|
|
6
|
+
module Vision
|
|
7
|
+
# The frameworks that drive a browser through another one: Capybara through its driver (Selenium, Cuprite), Watir
|
|
8
|
+
# through Selenium. The page is the one of the framework under them; a zone may also be an element of the framework
|
|
9
|
+
# on top, given as the element of the one under it.
|
|
10
|
+
class OnTopPageDriver < SimpleDelegator
|
|
11
|
+
def initialize(name, under, &element_under)
|
|
12
|
+
super(under)
|
|
13
|
+
@name = name
|
|
14
|
+
@element_under = element_under
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def framework
|
|
18
|
+
@name
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def zone_selector_sets(zone, kind, function)
|
|
22
|
+
under = @element_under.call(zone)
|
|
23
|
+
return __getobj__.zone_selector_sets(zone, kind, function) if under.equal?(zone)
|
|
24
|
+
return ["element #{zone.inspect}", []] if under.nil?
|
|
25
|
+
__getobj__.zone_selector_sets(under, kind, function)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# The page of a Capybara session: Selenium's or Ferrum's, by the driver of the session.
|
|
29
|
+
def self.capybara(session)
|
|
30
|
+
driver = session.driver
|
|
31
|
+
if defined?(::Capybara::Selenium::Driver) && driver.is_a?(::Capybara::Selenium::Driver)
|
|
32
|
+
new("Capybara (Selenium)", SeleniumPageDriver.new(driver.browser)) { |zone| capybara_element(zone) }
|
|
33
|
+
elsif defined?(::Capybara::Cuprite::Driver) && driver.is_a?(::Capybara::Cuprite::Driver)
|
|
34
|
+
new("Capybara (Cuprite)", FerrumPageDriver.new(driver.browser)) { |zone| capybara_element(zone, &:node) }
|
|
35
|
+
else
|
|
36
|
+
raise TypeError, "The Capybara driver #{driver.class} drives no browser Delta-QA Vision can take the page in" \
|
|
37
|
+
"#{" (rack_test renders no page)" if driver.class.name.to_s.include?("RackTest")}: run the test " \
|
|
38
|
+
"under the Selenium driver (Chrome, Chromium or Edge) or Cuprite"
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# The page of a Watir browser: Selenium's, the browser's own driver.
|
|
43
|
+
def self.watir(browser)
|
|
44
|
+
new("Watir", SeleniumPageDriver.new(browser.wd)) do |zone|
|
|
45
|
+
next zone unless zone.is_a?(::Watir::Element)
|
|
46
|
+
zone.exists? ? zone.wd : nil
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# A Capybara element as the element of its driver (Cuprite's node as Ferrum's, by the block); any other zone as it is.
|
|
51
|
+
def self.capybara_element(zone)
|
|
52
|
+
return zone unless zone.is_a?(::Capybara::Node::Element)
|
|
53
|
+
block_given? ? yield(zone.native) : zone.native
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|