@agent-device/revyl 0.21.37 → 0.21.38

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.
@@ -1 +1 @@
1
- import{resolveIosViewportEvidenceFromRoots as e}from"./ios-snapshot-acquisition.mjs";function t(e){let t=Array.isArray(e)?e:[e],r=[],i=(e,t,a)=>{let o=r.length;r.push(n(e,{index:o,depth:t,parentIndex:a}));for(let n of f(e))i(n,t+1,o)};for(let e of t)i(e,0);return r}function n(e,t){return{index:t.index,type:r(e),role:a(e),subrole:e.subrole??void 0,label:o(e),value:s(e),identifier:l(e),rect:u(e),enabled:e.enabled,selected:i(e),password:e.subrole===`AXSecureTextField`||void 0,heading:e.traits?.includes(`Header`)===!0||void 0,roleDescription:c(e.role_description),hittable:e.hittable,depth:t.depth,parentIndex:t.parentIndex}}function r(e){return e.elementType??e.type}function i(e){if(e.selected===!0||e.traits?.includes(`Selected`)===!0)return!0}function a(e){return e.role??r(e)}function o(e){return c(e.label)??c(e.AXLabel)}function s(e){return c(e.value)??c(e.AXValue)}function c(e){if(e!=null&&e!==``)return typeof e==`string`?e:String(e)}function l(e){return c(e.identifier)??c(e.AXUniqueId)}function u(e){let t=e.rect??e.frame;if(!(!t||!d(t.x)||!d(t.y)||!d(t.width)||!d(t.height)))return{x:t.x,y:t.y,width:t.width,height:t.height}}function d(e){return typeof e==`number`&&Number.isFinite(e)}function f(e){return e.children??e.nodes??e.elements??[]}function p(t,n){let r=e((Array.isArray(t)?t:[t]).map(m));return r?.kind===`reported`?{kind:`derived`,rect:r.rect}:n!==void 0&&(n.width!==void 0||n.height!==void 0)?d(n.width)&&d(n.height)&&n.width>0&&n.height>0?{kind:`reported`,rect:{x:0,y:0,width:n.width,height:n.height}}:{kind:`missing`,reason:`invalid`}:r??{kind:`missing`,reason:`not-provided`}}function m(e){let t=e.rect??e.frame,n=u(e);return{type:e.elementType??e.type??e.role,...n?{rect:n}:{},rectStatus:t?n&&n.width>0&&n.height>0?`reported`:`invalid`:`not-provided`}}export{t as flattenIosTree,p as resolveIosAxTreeViewport};
1
+ import{resolveIosViewportEvidenceFromRoots as e}from"./ios-snapshot-acquisition.mjs";function t(e){let t=Array.isArray(e)?e:[e],r=[],i=(e,t,a)=>{let o=r.length;r.push(n(e,{index:o,depth:t,parentIndex:a}));for(let n of f(e))i(n,t+1,o)};for(let e of t)i(e,0);return r}function n(e,t){return{index:t.index,type:r(e),role:a(e),subrole:e.subrole??void 0,label:o(e),value:s(e),identifier:l(e),rect:u(e),enabled:e.enabled,selected:i(e),password:e.subrole===`AXSecureTextField`||void 0,heading:e.traits?.includes(`Header`)===!0||void 0,roleDescription:c(e.role_description),hittable:e.hittable,depth:t.depth,parentIndex:t.parentIndex}}function r(e){return e.elementType??e.type}function i(e){if(e.selected===!0||e.traits?.includes(`Selected`)===!0)return!0}function a(e){return e.role??r(e)}function o(e){return c(e.label)??c(e.AXLabel)}function s(e){return c(e.value)??c(e.AXValue)}function c(e){if(e!=null&&e!==``)return typeof e==`string`?e:String(e)}function l(e){return c(e.identifier)??c(e.AXUniqueId)}function u(e){let t=e.rect??e.frame;if(!(!t||!d(t.x)||!d(t.y)||!d(t.width)||!d(t.height)))return{x:t.x,y:t.y,width:t.width,height:t.height}}function d(e){return typeof e==`number`&&Number.isFinite(e)}function f(e){return e.children??e.nodes??e.elements??[]}function p(t,n){let r=e((Array.isArray(t)?t:[t]).map(h));return r?.kind===`reported`?m(r.rect,n)?{kind:`reported`,rect:r.rect}:{kind:`derived`,rect:r.rect}:n!==void 0&&(n.width!==void 0||n.height!==void 0)?d(n.width)&&d(n.height)&&n.width>0&&n.height>0?{kind:`reported`,rect:{x:0,y:0,width:n.width,height:n.height}}:{kind:`missing`,reason:`invalid`}:r??{kind:`missing`,reason:`not-provided`}}function m(e,t){return e.x===0&&e.y===0&&e.width===t?.width&&e.height===t.height}function h(e){let t=e.rect??e.frame,n=u(e);return{type:e.elementType??e.type??e.role,...n?{rect:n}:{},rectStatus:t?n&&n.width>0&&n.height>0?`reported`:`invalid`:`not-provided`}}export{t as flattenIosTree,p as resolveIosAxTreeViewport};
@@ -1,2 +1,2 @@
1
1
  import{t as e}from"./errors.mjs";import{t}from"./snapshot-visibility.mjs";import"./snapshot.mjs";function n(e,t,n){if(e===`com.android.launcher3`||e===`com.google.android.apps.nexuslauncher`)return t===`${e}:id/navbuttons_view`||n?.bundleId===e&&n.systemBar===`navigation`?`navigation`:void 0;if(e===`com.android.systemui`)switch(t){case`com.android.systemui:id/status_bar`:case`com.android.systemui:id/status_bar_container`:case`com.android.systemui:id/status_bar_launch_animation_container`:return`status`;case`com.android.systemui:id/navigation_bar`:case`com.android.systemui:id/navigation_bar_frame`:return`navigation`;default:return n?.bundleId===e?n.systemBar:void 0}}function r(e){if(!e)return;let t=/\[(-?\d+),(-?\d+)\]\[(-?\d+),(-?\d+)\]/.exec(e);if(!t)return;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]),a=Number(t[4]);return{x:n,y:r,width:Math.max(0,i-n),height:Math.max(0,a-r)}}function i(e){return e.replaceAll(/&(#(?:x|X)[0-9a-fA-F]+|#[0-9]+|amp|lt|gt|quot|apos);/g,(e,t)=>{switch(t){case`amp`:return`&`;case`lt`:return`<`;case`gt`:return`>`;case`quot`:return`"`;case`apos`:return`'`;default:return a(e,t)}})}function a(e,t){let n=t.slice(0,2).toLowerCase()===`#x`?Number.parseInt(t.slice(2),16):Number(t.slice(1));if(!Number.isInteger(n)||n<0||n>1114111)return e;try{return String.fromCodePoint(n)}catch{return e}}const o=new Set(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.:-`),s=new Set([` `,` `,`
2
- `,`\r`]),c=new Set([`__defineGetter__`,`__defineSetter__`,`__proto__`,`constructor`,`prototype`]);function l(e,t={}){let n=t.maxDocumentChars??134217728;if(e.length>n)throw Error(`XML document exceeds maximum supported size of ${n} characters.`);return new u(e).parse()}var u=class{roots=[];stack=[];index=0;xml;constructor(e){this.xml=e}parse(){for(this.skipByteOrderMark();this.index<this.xml.length;)this.readNextToken();return this.assertFullyClosed(),this.roots}readNextToken(){if(this.xml[this.index]!==`<`){this.readText();return}this.resolveMarkupReader()()}resolveMarkupReader(){return this.startsWith(`<!--`)?()=>this.skipUntil(`-->`,`Comment is not closed.`):this.startsWith(`<?`)?()=>this.skipUntil(`?>`,`Processing instruction is not closed.`):this.startsWith(`<![CDATA[`)?()=>this.readCdata():this.startsWith(`<!`)?()=>this.skipDeclaration():this.startsWith(`</`)?()=>this.readClosingTag():()=>this.readOpeningTag()}assertFullyClosed(){if(this.stack.length>0){let e=this.stack.at(-1);throw Error(`Unclosed XML tag <${e?.name??`unknown`}>.`)}}skipByteOrderMark(){this.xml.charCodeAt(0)===65279&&(this.index=1)}readOpeningTag(){this.index+=1,this.skipWhitespace();let e=this.readRequiredName(`Missing XML tag name at offset ${this.index}.`),{attributes:t,selfClosing:n}=this.readOpeningTagBody(),r={name:e,attributes:t,text:null,children:[]};this.addNode(r),n||this.pushOpenNode(r)}readOpeningTagBody(){let e={};for(;;){this.skipWhitespace();let t=this.readOpeningTagEnd();if(t)return{attributes:e,selfClosing:t===`self-closing`};let n=this.readAttribute();e[n.name]=n.value}}readOpeningTagEnd(){if(this.index>=this.xml.length)throw Error(`Opening XML tag is not closed.`);return this.xml[this.index]===`>`?(this.index+=1,`open`):this.xml[this.index]===`/`&&this.xml[this.index+1]===`>`?(this.index+=2,`self-closing`):null}readAttribute(){let e=this.readRequiredName(`Invalid XML attribute at offset ${this.index}.`);if(_(e),this.skipWhitespace(),this.xml[this.index]!==`=`)throw Error(`Missing value for XML attribute "${e}".`);return this.index+=1,this.skipWhitespace(),{name:e,value:this.readAttributeValue(e)}}pushOpenNode(e){if(this.stack.length>=256)throw Error(`Maximum XML nesting depth of 256 exceeded.`);this.stack.push(e)}readClosingTag(){this.index+=2,this.skipWhitespace();let e=this.readName();if(this.skipWhitespace(),this.xml[this.index]!==`>`)throw Error(`Closing XML tag </${e}> is not closed.`);this.index+=1;let t=this.stack.pop();if(!t)throw Error(`Unexpected closing XML tag </${e}>.`);if(t.name!==e)throw Error(`Expected </${t.name}> before </${e}>.`)}readText(){let e=this.xml.indexOf(`<`,this.index),t=e===-1?this.xml.length:e;this.appendText(this.xml.slice(this.index,t),!0),this.index=t}readCdata(){let e=this.index+9,t=this.xml.indexOf(`]]>`,e);if(t===-1)throw Error(`CDATA section is not closed.`);this.appendText(this.xml.slice(e,t),!1),this.index=t+3}appendText(e,t){let n=e.trim();if(!n)return;let r=this.stack.at(-1);r&&(r.text=`${r.text??``}${t?i(n):n}`)}addNode(e){let t=this.stack.at(-1);t?t.children.push(e):this.roots.push(e)}readName(){let e=this.index;for(;this.index<this.xml.length&&d(this.xml[this.index]);)this.index+=1;return this.xml.slice(e,this.index)}readRequiredName(e){let t=this.readName();if(!t)throw Error(e);return t}readAttributeValue(e){let t=this.xml[this.index];if(t!==`"`&&t!==`'`)throw Error(`XML attribute "${e}" must use a quoted value.`);this.index+=1;let n=this.index,r=this.xml.indexOf(t,n);if(r===-1)throw Error(`XML attribute "${e}" is not closed.`);return this.index=r+1,i(this.xml.slice(n,r).trim())}skipDeclaration(){let e={quote:null,bracketDepth:0};for(let t=this.index+2;t<this.xml.length;t+=1)if(p(e,this.xml[t])){this.index=t+1;return}throw Error(`XML declaration is not closed.`)}skipUntil(e,t){let n=this.xml.indexOf(e,this.index+e.length);if(n===-1)throw Error(t);this.index=n+e.length}skipWhitespace(){for(;this.index<this.xml.length&&f(this.xml[this.index]);)this.index+=1}startsWith(e){return this.xml.startsWith(e,this.index)}};function d(e){return e!==void 0&&o.has(e)}function f(e){return e!==void 0&&s.has(e)}function p(e,t){return t===void 0||m(e,t)?!1:(h(e,t),g(e,t))}function m(e,t){return e.quote?(t===e.quote&&(e.quote=null),!0):t===`"`||t===`'`?(e.quote=t,!0):!1}function h(e,t){if(t===`[`){e.bracketDepth+=1;return}t===`]`&&e.bracketDepth>0&&--e.bracketDepth}function g(e,t){return t===`>`&&e.bracketDepth===0}function _(e){if(c.has(e))throw Error(`Unsupported XML attribute name "${e}".`)}function v(t){try{return l(t)}catch(t){throw new e(`COMMAND_FAILED`,`Failed to parse WebDriver page source XML: ${t instanceof Error?t.message:String(t)}`,void 0,t)}}function y(e){let t=r(e.bounds??null);if(t)return t;let n=w(e.x),i=w(e.y),a=w(e.width),o=w(e.height);if(n!==void 0&&i!==void 0&&a!==void 0&&o!==void 0)return{x:n,y:i,width:a,height:o}}function b(e,t){for(let n of t){let t=x(e[n]);if(t!==void 0)return t}}function x(e){return e||void 0}function S(e,t){return e===void 0?t:e===`true`||e===`1`?!0:e===`false`||e===`0`?!1:t===void 0&&void 0}function C(e){return!!(e&&e.width>0&&e.height>0)}function w(e){if(e===void 0||e===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function T(e,t){return x(t.class)??x(e.replace(/^XCUIElementType/,``).toLowerCase())}function E(e,t=`ios`){let n=v(e),r=[],i=[];for(let e of n)D(r,e,void 0,0,i,t);return{nodes:r,roots:i}}function D(e,t,n,r,i,a){let o=O(t,a)?n:A(e,t,n,r,i,a),s=o===n?r:r+1;for(let n of t.children)D(e,n,o,s,i,a)}function O(e,t){if(Object.keys(e.attributes).length===0)return!0;let n=e.name.toLowerCase();return t===`ios`&&(n===`hierarchy`||n===`appiumaut`)}function k(e,t){return t===`android`?x(e.attributes.class)??e.name:e.name}function A(e,t,n,r,i,a){let o=e.length,s=y(t.attributes),c=k(t,a);return e.push(j(o,c,t.attributes,n,r,s,a)),n===void 0&&i.push({type:c,...s?{rect:s}:{},rectStatus:H(t.attributes,s)}),o}function j(e,t,n,r,i,a,o){return{index:e,type:t,role:T(t,n),...M(n,o),...o===`android`?N(t,n):{value:x(n.value)},identifier:b(n,[`resource-id`,`id`,`accessibility-id`,`name`]),...o===`android`&&n.package?{bundleId:n.package}:{},rect:a,...z(n,a,o),...L(t,n,o),...F(`heading`,S(n.heading)),...F(`roleDescription`,b(n,[`roleDescription`,`role-description`])??(o===`android`?R(n.extras):void 0)),depth:i,parentIndex:r}}function M(e,t){if(t===`ios`)return{label:b(e,[`label`,`text`,`name`])};let n=x(e[`content-desc`]),r=x(e.text)??n;return{label:r,...n!==void 0&&n!==r?{contentDescription:n}:{}}}function N(e,n){let r=S(n[`showing-hint`]??n[`hint-showing`]??n.hintShowing);return{value:t({type:e,text:n.text,editable:S(n.editable)===!0||P(n[`input-type`]),password:S(n.password),hintShowing:r}),...F(`placeholder`,x(n.hint)),...F(`hintShowing`,r)}}function P(e){let t=w(e);if(t===void 0||!Number.isInteger(t)||t<0||t>2147483647)return!1;let n=t&15;return n>=1&&n<=4}function F(e,t){return t===void 0?{}:{[e]:t}}const I=/(CheckBox|RadioButton|Switch|ToggleButton|CheckedTextView)$/;function L(e,t,n){let r={...F(`password`,S(t.password)),...F(`editable`,S(t.editable))},i=S(t.checked);if(n===`ios`)return{...r,...F(`checked`,i)};let a=S(t.checkable)??I.test(e);return{...r,...a&&i!==void 0?{checked:i}:{}}}function R(e){let t=e?.split(`;`).find(e=>e.startsWith(`AccessibilityNodeInfo.roleDescription=`));return x(t?.slice(38))}function z(e,t,n){let r=n===`android`||void 0,i=S(e.enabled,r),a=S(e.displayed??e.visible,r);return n===`android`?{enabled:i,selected:S(e.selected,!1),focused:S(e.focused,!1),visibleToUser:a,hittable:a===!0&&i===!0&&C(t)}:{...B(`enabled`,i),...B(`selected`,S(e.selected)),...B(`focused`,S(e.focused)),...B(`visibleToUser`,a),...V(e.hittable)}}function B(e,t){return t===void 0?{}:{[e]:t}}function V(e){let t=S(e);return t===void 0?{}:{hittable:t}}function H(e,t){let n=e.bounds!==void 0,r=[`x`,`y`,`width`,`height`].every(t=>e[t]!==void 0);return!n&&!r?`not-provided`:C(t)?`reported`:`invalid`}function U(e){let{nodes:t}=E(e,`android`);for(let e of t){let r=e.parentIndex===void 0?void 0:t[e.parentIndex],i=n(e.bundleId,e.identifier,r);i&&(e.systemBar=i)}return t}export{U as parseWebDriverAndroidSnapshotNodes};
2
+ `,`\r`]),c=new Set([`__defineGetter__`,`__defineSetter__`,`__proto__`,`constructor`,`prototype`]);function l(e,t={}){let n=t.maxDocumentChars??134217728;if(e.length>n)throw Error(`XML document exceeds maximum supported size of ${n} characters.`);return new u(e).parse()}var u=class{roots=[];stack=[];index=0;xml;constructor(e){this.xml=e}parse(){for(this.skipByteOrderMark();this.index<this.xml.length;)this.readNextToken();return this.assertFullyClosed(),this.roots}readNextToken(){if(this.xml[this.index]!==`<`){this.readText();return}this.resolveMarkupReader()()}resolveMarkupReader(){return this.startsWith(`<!--`)?()=>this.skipUntil(`-->`,`Comment is not closed.`):this.startsWith(`<?`)?()=>this.skipUntil(`?>`,`Processing instruction is not closed.`):this.startsWith(`<![CDATA[`)?()=>this.readCdata():this.startsWith(`<!`)?()=>this.skipDeclaration():this.startsWith(`</`)?()=>this.readClosingTag():()=>this.readOpeningTag()}assertFullyClosed(){if(this.stack.length>0){let e=this.stack.at(-1);throw Error(`Unclosed XML tag <${e?.name??`unknown`}>.`)}}skipByteOrderMark(){this.xml.charCodeAt(0)===65279&&(this.index=1)}readOpeningTag(){this.index+=1,this.skipWhitespace();let e=this.readRequiredName(`Missing XML tag name at offset ${this.index}.`),{attributes:t,selfClosing:n}=this.readOpeningTagBody(),r={name:e,attributes:t,text:null,children:[]};this.addNode(r),n||this.pushOpenNode(r)}readOpeningTagBody(){let e={};for(;;){this.skipWhitespace();let t=this.readOpeningTagEnd();if(t)return{attributes:e,selfClosing:t===`self-closing`};let n=this.readAttribute();e[n.name]=n.value}}readOpeningTagEnd(){if(this.index>=this.xml.length)throw Error(`Opening XML tag is not closed.`);return this.xml[this.index]===`>`?(this.index+=1,`open`):this.xml[this.index]===`/`&&this.xml[this.index+1]===`>`?(this.index+=2,`self-closing`):null}readAttribute(){let e=this.readRequiredName(`Invalid XML attribute at offset ${this.index}.`);if(_(e),this.skipWhitespace(),this.xml[this.index]!==`=`)throw Error(`Missing value for XML attribute "${e}".`);return this.index+=1,this.skipWhitespace(),{name:e,value:this.readAttributeValue(e)}}pushOpenNode(e){if(this.stack.length>=256)throw Error(`Maximum XML nesting depth of 256 exceeded.`);this.stack.push(e)}readClosingTag(){this.index+=2,this.skipWhitespace();let e=this.readName();if(this.skipWhitespace(),this.xml[this.index]!==`>`)throw Error(`Closing XML tag </${e}> is not closed.`);this.index+=1;let t=this.stack.pop();if(!t)throw Error(`Unexpected closing XML tag </${e}>.`);if(t.name!==e)throw Error(`Expected </${t.name}> before </${e}>.`)}readText(){let e=this.xml.indexOf(`<`,this.index),t=e===-1?this.xml.length:e;this.appendText(this.xml.slice(this.index,t),!0),this.index=t}readCdata(){let e=this.index+9,t=this.xml.indexOf(`]]>`,e);if(t===-1)throw Error(`CDATA section is not closed.`);this.appendText(this.xml.slice(e,t),!1),this.index=t+3}appendText(e,t){let n=e.trim();if(!n)return;let r=this.stack.at(-1);r&&(r.text=`${r.text??``}${t?i(n):n}`)}addNode(e){let t=this.stack.at(-1);t?t.children.push(e):this.roots.push(e)}readName(){let e=this.index;for(;this.index<this.xml.length&&d(this.xml[this.index]);)this.index+=1;return this.xml.slice(e,this.index)}readRequiredName(e){let t=this.readName();if(!t)throw Error(e);return t}readAttributeValue(e){let t=this.xml[this.index];if(t!==`"`&&t!==`'`)throw Error(`XML attribute "${e}" must use a quoted value.`);this.index+=1;let n=this.index,r=this.xml.indexOf(t,n);if(r===-1)throw Error(`XML attribute "${e}" is not closed.`);return this.index=r+1,i(this.xml.slice(n,r).trim())}skipDeclaration(){let e={quote:null,bracketDepth:0};for(let t=this.index+2;t<this.xml.length;t+=1)if(p(e,this.xml[t])){this.index=t+1;return}throw Error(`XML declaration is not closed.`)}skipUntil(e,t){let n=this.xml.indexOf(e,this.index+e.length);if(n===-1)throw Error(t);this.index=n+e.length}skipWhitespace(){for(;this.index<this.xml.length&&f(this.xml[this.index]);)this.index+=1}startsWith(e){return this.xml.startsWith(e,this.index)}};function d(e){return e!==void 0&&o.has(e)}function f(e){return e!==void 0&&s.has(e)}function p(e,t){return t===void 0||m(e,t)?!1:(h(e,t),g(e,t))}function m(e,t){return e.quote?(t===e.quote&&(e.quote=null),!0):t===`"`||t===`'`?(e.quote=t,!0):!1}function h(e,t){if(t===`[`){e.bracketDepth+=1;return}t===`]`&&e.bracketDepth>0&&--e.bracketDepth}function g(e,t){return t===`>`&&e.bracketDepth===0}function _(e){if(c.has(e))throw Error(`Unsupported XML attribute name "${e}".`)}function v(t){try{return l(t)}catch(t){throw new e(`COMMAND_FAILED`,`Failed to parse WebDriver page source XML: ${t instanceof Error?t.message:String(t)}`,void 0,t)}}function y(e){let t=r(e.bounds??null);if(t)return t;let n=w(e.x),i=w(e.y),a=w(e.width),o=w(e.height);if(n!==void 0&&i!==void 0&&a!==void 0&&o!==void 0)return{x:n,y:i,width:a,height:o}}function b(e,t){for(let n of t){let t=x(e[n]);if(t!==void 0)return t}}function x(e){return e||void 0}function S(e,t){return e===void 0?t:e===`true`||e===`1`?!0:e===`false`||e===`0`?!1:t===void 0&&void 0}function C(e){return!!(e&&e.width>0&&e.height>0)}function w(e){if(e===void 0||e===``)return;let t=Number(e);return Number.isFinite(t)?t:void 0}function T(e,t){return x(t.class)??x(e.replace(/^XCUIElementType/,``).toLowerCase())}function E(e,t=`ios`){let n=v(e),r=[],i=[];for(let e of n)D(r,e,void 0,0,i,t);return{nodes:r,roots:i}}function D(e,t,n,r,i,a){let o=O(t,a)?n:A(e,t,n,r,i,a),s=o===n?r:r+1;for(let n of t.children)D(e,n,o,s,i,a)}function O(e,t){if(Object.keys(e.attributes).length===0)return!0;let n=e.name.toLowerCase();return t===`ios`&&(n===`hierarchy`||n===`appiumaut`)}function k(e,t){return t===`android`?x(e.attributes.class)??e.name:e.name}function A(e,t,n,r,i,a){let o=e.length,s=y(t.attributes),c=k(t,a);return e.push(j(o,c,t.attributes,n,r,s,a)),n===void 0&&i.push({type:c,...s?{rect:s}:{},rectStatus:H(t.attributes,s)}),o}function j(e,t,n,r,i,a,o){return{index:e,type:t,role:T(t,n),...M(n,o),...o===`android`?N(t,n):{value:x(n.value)},identifier:b(n,[`resource-id`,`id`,`accessibility-id`,`name`]),...o===`android`&&n.package?{bundleId:n.package}:{},rect:a,...z(n,a,o),...L(t,n,o),...F(`heading`,S(n.heading)),...F(`roleDescription`,b(n,[`roleDescription`,`role-description`])??(o===`android`?R(n.extras):void 0)),depth:i,parentIndex:r}}function M(e,t){if(t===`ios`)return{label:b(e,[`label`,`text`,`name`])};let n=x(e[`content-desc`]),r=x(e.text),i=r??n;return{label:i,...n!==void 0&&n!==i?{contentDescription:n}:{},...i!==void 0&&r===void 0?{text:``}:{}}}function N(e,n){let r=S(n[`showing-hint`]??n[`hint-showing`]??n.hintShowing);return{value:t({type:e,text:n.text,editable:S(n.editable)===!0||P(n[`input-type`]),password:S(n.password),hintShowing:r}),...F(`placeholder`,x(n.hint)),...F(`hintShowing`,r)}}function P(e){let t=w(e);if(t===void 0||!Number.isInteger(t)||t<0||t>2147483647)return!1;let n=t&15;return n>=1&&n<=4}function F(e,t){return t===void 0?{}:{[e]:t}}const I=/(CheckBox|RadioButton|Switch|ToggleButton|CheckedTextView)$/;function L(e,t,n){let r={...F(`password`,S(t.password)),...F(`editable`,S(t.editable))},i=S(t.checked);if(n===`ios`)return{...r,...F(`checked`,i)};let a=S(t.checkable)??I.test(e);return{...r,...a&&i!==void 0?{checked:i}:{}}}function R(e){let t=e?.split(`;`).find(e=>e.startsWith(`AccessibilityNodeInfo.roleDescription=`));return x(t?.slice(38))}function z(e,t,n){let r=n===`android`||void 0,i=S(e.enabled,r),a=S(e.displayed??e.visible,r);return n===`android`?{enabled:i,selected:S(e.selected,!1),focused:S(e.focused,!1),visibleToUser:a,hittable:a===!0&&i===!0&&C(t)}:{...B(`enabled`,i),...B(`selected`,S(e.selected)),...B(`focused`,S(e.focused)),...B(`visibleToUser`,a),...V(e.hittable)}}function B(e,t){return t===void 0?{}:{[e]:t}}function V(e){let t=S(e);return t===void 0?{}:{hittable:t}}function H(e,t){let n=e.bounds!==void 0,r=[`x`,`y`,`width`,`height`].every(t=>e[t]!==void 0);return!n&&!r?`not-provided`:C(t)?`reported`:`invalid`}function U(e){let{nodes:t}=E(e,`android`);for(let e of t){let r=e.parentIndex===void 0?void 0:t[e.parentIndex],i=n(e.bundleId,e.identifier,r);i&&(e.systemBar=i)}return t}export{U as parseWebDriverAndroidSnapshotNodes};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-device/revyl",
3
- "version": "0.21.37",
3
+ "version": "0.21.38",
4
4
  "type": "module",
5
5
  "description": "Revyl cloud iOS simulator and Android emulator plugin for agent-device.",
6
6
  "files": [
@@ -16,12 +16,12 @@
16
16
  },
17
17
  "devDependencies": {
18
18
  "@agent-device/capture-kit": "0.0.0",
19
- "@agent-device/kernel": "0.0.0",
20
19
  "@agent-device/contracts": "0.0.0",
20
+ "@agent-device/kernel": "0.0.0",
21
21
  "@agent-device/provision-kit": "0.0.0",
22
22
  "@agent-device/provider-webdriver": "0.0.0",
23
- "agent-device": "0.21.37",
24
- "@agent-device/test-kit": "0.0.0"
23
+ "@agent-device/test-kit": "0.0.0",
24
+ "agent-device": "0.21.38"
25
25
  },
26
26
  "agentDevicePlugin": {
27
27
  "apiVersion": 1,