react-grab 0.1.43-dev.9e02175 → 0.1.44-dev.08f8b4e

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.
package/dist/index.js CHANGED
@@ -6,4 +6,4 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import{a as e,i as t,n,r,t as i}from"./core-CjrYq8Gf.js";import{A as a,E as o,S as s}from"./freeze-updates-BaXw_tG8.js";let c=null;const l=()=>typeof window>`u`?c:window.__REACT_GRAB__??c??null,u=e=>{c=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},d=[],f=e=>{for(;d.length>0;){let t=d.shift();t&&e.registerPlugin(t)}},p=e=>{let t=l();if(t){t.registerPlugin(e);return}d.push(e)},m=e=>{let t=l();if(t){t.unregisterPlugin(e);return}let n=d.findIndex(t=>t.name===e);n!==-1&&d.splice(n,1)};typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?c=window.__REACT_GRAB__:(c=i(),window.__REACT_GRAB__=c),f(c),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:c})));export{e as DEFAULT_THEME,t as commentPlugin,s as formatElementInfo,n as generateSnippet,l as getGlobalApi,o as getStack,i as init,a as isInstrumentationActive,r as openPlugin,p as registerPlugin,u as setGlobalApi,m as unregisterPlugin};
9
+ import{a as e,i as t,n,r,t as i}from"./core-tKdWHrhJ.js";import{A as a,E as o,S as s}from"./freeze-updates-D6jYzCnJ.js";let c=null;const l=()=>typeof window>`u`?c:window.__REACT_GRAB__??c??null,u=e=>{c=e,typeof window<`u`&&(e?window.__REACT_GRAB__=e:delete window.__REACT_GRAB__)},d=[],f=e=>{for(;d.length>0;){let t=d.shift();t&&e.registerPlugin(t)}},p=e=>{let t=l();if(t){t.registerPlugin(e);return}d.push(e)},m=e=>{let t=l();if(t){t.unregisterPlugin(e);return}let n=d.findIndex(t=>t.name===e);n!==-1&&d.splice(n,1)};typeof window<`u`&&!window.__REACT_GRAB_DISABLED__&&(window.__REACT_GRAB__?c=window.__REACT_GRAB__:(c=i(),window.__REACT_GRAB__=c),f(c),window.dispatchEvent(new CustomEvent(`react-grab:init`,{detail:c})));export{e as DEFAULT_THEME,t as commentPlugin,s as formatElementInfo,n as generateSnippet,l as getGlobalApi,o as getStack,i as init,a as isInstrumentationActive,r as openPlugin,p as registerPlugin,u as setGlobalApi,m as unregisterPlugin};
@@ -6,5 +6,5 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./freeze-updates-B0WIVxVa.cjs`),t=require(`./copy-content-BwCC3_N9.cjs`),n=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),r=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},i=(e,t)=>{let i=n.has(e)||e.startsWith(`data-`)&&r(e),a=r(t)&&t.length<100||t.startsWith(`#`)&&r(t.slice(1));return i&&a},a=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},o=e=>{let t=0;for(let n of e)t+=n.penalty;return t},s=(e,t)=>o(e)-o(t),c=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},l=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,u=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,d=(e,t)=>{let n=[],i=e.getAttribute(`id`),a=e.tagName.toLowerCase();i&&r(i)&&n.push({name:`#${CSS.escape(i)}`,penalty:0});for(let t of e.classList)r(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:a,penalty:5});let o=c(e,a);o!==void 0&&n.push({name:u(a,o),penalty:10});let s=c(e);return s!==void 0&&n.push({name:l(a,s),penalty:50}),n},f=(t,n=e.it,r=[])=>{if(n<=0)return[];if(t.length===0)return[r];let i=[];for(let e of t[0]){let a=n-i.length;if(a<=0)break;i.push(...f(t.slice(1),a,[...r,e]))}return i},p=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e.nodeType===Node.DOCUMENT_NODE?e:e.ownerDocument},m=(e,t)=>t.querySelectorAll(a(e)).length===1,h=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=c(n,e);if(t===void 0)return;r.push({name:u(e,t),penalty:10}),n=n.parentElement}return m(r,t)?r:void 0},g=(e,n,r,i)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new t.r;if(e.tagName.toLowerCase()===`html`)return`html`;let o=p(n,e),c=Date.now(),l=[],u=e,g=0,_;for(;u&&u!==o&&!_;)if(l.push(d(u,i)),u=u.parentElement,g++,g>=3){let n=f(l);n.sort(s);for(let i of n){if(Date.now()-c>r){let n=h(e,o);if(!n)throw new t.a(r);return a(n)}if(m(i,o)){_=i;break}}}if(!_&&g<3){let e=f(l);e.sort(s);for(let t of e){if(Date.now()-c>r)break;if(m(t,o)){_=t;break}}}if(!_)throw new t.i;return a(_)},_=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,e=>`\\${e}`),v=e=>e.ownerDocument.body??e.ownerDocument.documentElement,y=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`role`,`name`,`title`,`alt`]),b=e=>e.length>0&&e.length<=120,x=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},S=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${_(e.id)}`;if(x(e,t))return t}for(let t of y){let n=e.getAttribute(t);if(!n||!b(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(x(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(x(e,i))return i}return null},C=e=>{let t=[],n=v(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${_(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r),a=i>=0?i+1:1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${a})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},w=(e,t=!0)=>{let n=S(e);if(n)return n;if(t)try{let t=g(e,v(e),200,(e,t)=>i(e,t)||y.has(e)&&b(t));if(t)return t}catch{}return C(e)},T=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let E=null;const D=new Map,O=()=>E||(E=document.createElement(`iframe`),E.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(E),E),k=t=>{let n=D.get(t);if(n)return n;let r=O(),i=r.contentDocument,a=i.createElement(t);i.body.appendChild(a);let o=r.contentWindow.getComputedStyle(a),s=new Map;for(let t of e._t){let e=o.getPropertyValue(t);e&&s.set(t,e)}return a.remove(),D.set(t,s),s},A=(e,t)=>{let n=T.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},j=t=>{let n=k(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let t of e._t){let e=r.getPropertyValue(t);e&&e!==n.get(t)&&(A(t,r)||i.push(`${t}: ${e};`))}let a=t.getAttribute(`class`)?.trim(),o=i.join(`
9
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./freeze-updates-akGeRUZP.cjs`),t=require(`./copy-content-DSxqD8E-.cjs`),n=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),r=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},i=(e,t)=>{let i=n.has(e)||e.startsWith(`data-`)&&r(e),a=r(t)&&t.length<100||t.startsWith(`#`)&&r(t.slice(1));return i&&a},a=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},o=e=>{let t=0;for(let n of e)t+=n.penalty;return t},s=(e,t)=>o(e)-o(t),c=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},l=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,u=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,d=(e,t)=>{let n=[],i=e.getAttribute(`id`),a=e.tagName.toLowerCase();i&&r(i)&&n.push({name:`#${CSS.escape(i)}`,penalty:0});for(let t of e.classList)r(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:a,penalty:5});let o=c(e,a);o!==void 0&&n.push({name:u(a,o),penalty:10});let s=c(e);return s!==void 0&&n.push({name:l(a,s),penalty:50}),n},f=(t,n=e.it,r=[])=>{if(n<=0)return[];if(t.length===0)return[r];let i=[];for(let e of t[0]){let a=n-i.length;if(a<=0)break;i.push(...f(t.slice(1),a,[...r,e]))}return i},p=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e.nodeType===Node.DOCUMENT_NODE?e:e.ownerDocument},m=(e,t)=>t.querySelectorAll(a(e)).length===1,h=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=c(n,e);if(t===void 0)return;r.push({name:u(e,t),penalty:10}),n=n.parentElement}return m(r,t)?r:void 0},g=(e,n,r,i)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new t.r;if(e.tagName.toLowerCase()===`html`)return`html`;let o=p(n,e),c=Date.now(),l=[],u=e,g=0,_;for(;u&&u!==o&&!_;)if(l.push(d(u,i)),u=u.parentElement,g++,g>=3){let n=f(l);n.sort(s);for(let i of n){if(Date.now()-c>r){let n=h(e,o);if(!n)throw new t.a(r);return a(n)}if(m(i,o)){_=i;break}}}if(!_&&g<3){let e=f(l);e.sort(s);for(let t of e){if(Date.now()-c>r)break;if(m(t,o)){_=t;break}}}if(!_)throw new t.i;return a(_)},_=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,e=>`\\${e}`),v=e=>e.ownerDocument.body??e.ownerDocument.documentElement,y=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`role`,`name`,`title`,`alt`]),b=e=>e.length>0&&e.length<=120,x=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},S=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${_(e.id)}`;if(x(e,t))return t}for(let t of y){let n=e.getAttribute(t);if(!n||!b(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(x(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(x(e,i))return i}return null},C=e=>{let t=[],n=v(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${_(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r),a=i>=0?i+1:1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${a})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},w=(e,t=!0)=>{let n=S(e);if(n)return n;if(t)try{let t=g(e,v(e),200,(e,t)=>i(e,t)||y.has(e)&&b(t));if(t)return t}catch{}return C(e)},T=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let E=null;const D=new Map,O=()=>E||(E=document.createElement(`iframe`),E.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(E),E),k=t=>{let n=D.get(t);if(n)return n;let r=O(),i=r.contentDocument,a=i.createElement(t);i.body.appendChild(a);let o=r.contentWindow.getComputedStyle(a),s=new Map;for(let t of e._t){let e=o.getPropertyValue(t);e&&s.set(t,e)}return a.remove(),D.set(t,s),s},A=(e,t)=>{let n=T.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},j=t=>{let n=k(t.tagName.toLowerCase()),r=getComputedStyle(t),i=[];for(let t of e._t){let e=r.getPropertyValue(t);e&&e!==n.get(t)&&(A(t,r)||i.push(`${t}: ${e};`))}let a=t.getAttribute(`class`)?.trim(),o=i.join(`
10
10
  `);return a?o?`className: ${a}\n\n${o}`:`className: ${a}`:o},M=()=>{E?.remove(),E=null,D.clear()},N=async t=>{let[n,r,i]=await Promise.all([e.S(t),e.k(t),e.E(t).then(e=>e??[])]),a=await e.D(t),o=e.C(t),s=e.x(t),c=e.j(t),l=w(t),u=j(t);return{element:t,snippet:n,htmlPreview:o,stackString:a,stack:i,componentName:s,filePath:r?.filePath??null,lineNumber:r?.lineNumber??null,columnNumber:r?.columnNumber??null,fiber:c,selector:l,styles:u}},P=(t,n)=>{if(!Number.isFinite(t)||!Number.isFinite(n))return[];e.m();let r=document.elementsFromPoint(t,n);return e.p(),Array.from(r)},F=new Set;let I=!1;const L=t=>{I=!0,F.add(e.t()),F.add(e.o(t??[document.body])),e.s(),e.r()},R=()=>{I=!1;for(let e of Array.from(F))e();F.clear(),e.o([]),e.c(),e.i()},z=()=>I,B=async(t,n)=>{await e.l(t,n)};exports.copyContent=t.t,exports.disposeBaselineStyles=M,exports.freeze=L,exports.getElementContext=N,exports.getElementsAtPosition=P,exports.isFreezeActive=z,exports.openFile=B,exports.unfreeze=R;
@@ -6,5 +6,5 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import{C as e,D as t,E as n,S as r,_t as i,c as a,i as o,it as s,j as c,k as l,l as u,m as d,o as f,p,r as m,s as h,t as g,x as ee}from"./freeze-updates-BaXw_tG8.js";import{a as _,i as v,r as y,t as b}from"./copy-content-D8eZwdki.js";const te=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),x=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},S=(e,t)=>{let n=te.has(e)||e.startsWith(`data-`)&&x(e),r=x(t)&&t.length<100||t.startsWith(`#`)&&x(t.slice(1));return n&&r},C=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},w=e=>{let t=0;for(let n of e)t+=n.penalty;return t},T=(e,t)=>w(e)-w(t),E=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},D=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,O=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,k=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&x(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)x(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=E(e,i);a!==void 0&&n.push({name:O(i,a),penalty:10});let o=E(e);return o!==void 0&&n.push({name:D(i,o),penalty:50}),n},A=(e,t=s,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...A(e.slice(1),a,[...n,i]))}return r},j=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e.nodeType===Node.DOCUMENT_NODE?e:e.ownerDocument},M=(e,t)=>t.querySelectorAll(C(e)).length===1,N=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=E(n,e);if(t===void 0)return;r.push({name:O(e,t),penalty:10}),n=n.parentElement}return M(r,t)?r:void 0},P=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new y;if(e.tagName.toLowerCase()===`html`)return`html`;let i=j(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(k(s,r)),s=s.parentElement,c++,c>=3){let t=A(o);t.sort(T);for(let r of t){if(Date.now()-a>n){let t=N(e,i);if(!t)throw new _(n);return C(t)}if(M(r,i)){l=r;break}}}if(!l&&c<3){let e=A(o);e.sort(T);for(let t of e){if(Date.now()-a>n)break;if(M(t,i)){l=t;break}}}if(!l)throw new v;return C(l)},F=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,e=>`\\${e}`),I=e=>e.ownerDocument.body??e.ownerDocument.documentElement,L=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`role`,`name`,`title`,`alt`]),R=e=>e.length>0&&e.length<=120,z=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},B=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${F(e.id)}`;if(z(e,t))return t}for(let t of L){let n=e.getAttribute(t);if(!n||!R(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(z(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(z(e,i))return i}return null},V=e=>{let t=[],n=I(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${F(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r),a=i>=0?i+1:1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${a})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},H=(e,t=!0)=>{let n=B(e);if(n)return n;if(t)try{let t=P(e,I(e),200,(e,t)=>S(e,t)||L.has(e)&&R(t));if(t)return t}catch{}return V(e)},U=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let W=null;const G=new Map,K=()=>W||(W=document.createElement(`iframe`),W.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(W),W),q=e=>{let t=G.get(e);if(t)return t;let n=K(),r=n.contentDocument,a=r.createElement(e);r.body.appendChild(a);let o=n.contentWindow.getComputedStyle(a),s=new Map;for(let e of i){let t=o.getPropertyValue(e);t&&s.set(e,t)}return a.remove(),G.set(e,s),s},J=(e,t)=>{let n=U.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},Y=e=>{let t=q(e.tagName.toLowerCase()),n=getComputedStyle(e),r=[];for(let e of i){let i=n.getPropertyValue(e);i&&i!==t.get(e)&&(J(e,n)||r.push(`${e}: ${i};`))}let a=e.getAttribute(`class`)?.trim(),o=r.join(`
9
+ import{C as e,D as t,E as n,S as r,_t as i,c as a,i as o,it as s,j as c,k as l,l as u,m as d,o as f,p,r as m,s as h,t as g,x as ee}from"./freeze-updates-D6jYzCnJ.js";import{a as _,i as v,r as y,t as b}from"./copy-content-Bg9AcfYk.js";const te=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),x=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},S=(e,t)=>{let n=te.has(e)||e.startsWith(`data-`)&&x(e),r=x(t)&&t.length<100||t.startsWith(`#`)&&x(t.slice(1));return n&&r},C=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},w=e=>{let t=0;for(let n of e)t+=n.penalty;return t},T=(e,t)=>w(e)-w(t),E=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(r.nodeType===Node.ELEMENT_NODE&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},D=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,O=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,k=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&x(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)x(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=E(e,i);a!==void 0&&n.push({name:O(i,a),penalty:10});let o=E(e);return o!==void 0&&n.push({name:D(i,o),penalty:50}),n},A=(e,t=s,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...A(e.slice(1),a,[...n,i]))}return r},j=(e,t)=>{let n=t.getRootNode?.();return n instanceof ShadowRoot?n:e.nodeType===Node.DOCUMENT_NODE?e:e.ownerDocument},M=(e,t)=>t.querySelectorAll(C(e)).length===1,N=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=E(n,e);if(t===void 0)return;r.push({name:O(e,t),penalty:10}),n=n.parentElement}return M(r,t)?r:void 0},P=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new y;if(e.tagName.toLowerCase()===`html`)return`html`;let i=j(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(k(s,r)),s=s.parentElement,c++,c>=3){let t=A(o);t.sort(T);for(let r of t){if(Date.now()-a>n){let t=N(e,i);if(!t)throw new _(n);return C(t)}if(M(r,i)){l=r;break}}}if(!l&&c<3){let e=A(o);e.sort(T);for(let t of e){if(Date.now()-a>n)break;if(M(t,i)){l=t;break}}}if(!l)throw new v;return C(l)},F=e=>typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/[^a-zA-Z0-9_-]/g,e=>`\\${e}`),I=e=>e.ownerDocument.body??e.ownerDocument.documentElement,L=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`role`,`name`,`title`,`alt`]),R=e=>e.length>0&&e.length<=120,z=(e,t)=>{try{let n=e.ownerDocument.querySelectorAll(t);return n.length===1&&n[0]===e}catch{return!1}},B=e=>{if(e instanceof HTMLElement&&e.id){let t=`#${F(e.id)}`;if(z(e,t))return t}for(let t of L){let n=e.getAttribute(t);if(!n||!R(n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(z(e,r))return r;let i=`${e.tagName.toLowerCase()}${r}`;if(z(e,i))return i}return null},V=e=>{let t=[],n=I(e),r=e;for(;r;){if(r instanceof HTMLElement&&r.id){t.unshift(`#${F(r.id)}`);break}let e=r.parentElement;if(!e){t.unshift(r.tagName.toLowerCase());break}let i=Array.from(e.children).indexOf(r),a=i>=0?i+1:1;if(t.unshift(`${r.tagName.toLowerCase()}:nth-child(${a})`),e===n){t.unshift(n.tagName.toLowerCase());break}r=e}return t.join(` > `)},H=(e,t=!0)=>{let n=B(e);if(n)return n;if(t)try{let t=P(e,I(e),200,(e,t)=>S(e,t)||L.has(e)&&R(t));if(t)return t}catch{}return V(e)},U=new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));let W=null;const G=new Map,K=()=>W||(W=document.createElement(`iframe`),W.style.cssText=`position:fixed;left:-9999px;width:0;height:0;border:none;visibility:hidden;`,document.body.appendChild(W),W),q=e=>{let t=G.get(e);if(t)return t;let n=K(),r=n.contentDocument,a=r.createElement(e);r.body.appendChild(a);let o=n.contentWindow.getComputedStyle(a),s=new Map;for(let e of i){let t=o.getPropertyValue(e);t&&s.set(e,t)}return a.remove(),G.set(e,s),s},J=(e,t)=>{let n=U.get(e);if(!n)return!1;let r=t.getPropertyValue(`border-${n}-width`);return r===`0px`||r===`0`},Y=e=>{let t=q(e.tagName.toLowerCase()),n=getComputedStyle(e),r=[];for(let e of i){let i=n.getPropertyValue(e);i&&i!==t.get(e)&&(J(e,n)||r.push(`${e}: ${i};`))}let a=e.getAttribute(`class`)?.trim(),o=r.join(`
10
10
  `);return a?o?`className: ${a}\n\n${o}`:`className: ${a}`:o},X=()=>{W?.remove(),W=null,G.clear()},Z=async i=>{let[a,o,s]=await Promise.all([r(i),l(i),n(i).then(e=>e??[])]),u=await t(i),d=e(i),f=ee(i),p=c(i),m=H(i),h=Y(i);return{element:i,snippet:a,htmlPreview:d,stackString:u,stack:s,componentName:f,filePath:o?.filePath??null,lineNumber:o?.lineNumber??null,columnNumber:o?.columnNumber??null,fiber:p,selector:m,styles:h}},ne=(e,t)=>{if(!Number.isFinite(e)||!Number.isFinite(t))return[];d();let n=document.elementsFromPoint(e,t);return p(),Array.from(n)},Q=new Set;let $=!1;const re=e=>{$=!0,Q.add(g()),Q.add(f(e??[document.body])),h(),m()},ie=()=>{$=!1;for(let e of Array.from(Q))e();Q.clear(),f([]),a(),o()},ae=()=>$,oe=async(e,t)=>{await u(e,t)};export{b as copyContent,X as disposeBaselineStyles,re as freeze,Z as getElementContext,ne as getElementsAtPosition,ae as isFreezeActive,oe as openFile,ie as unfreeze};