@arcgis/lumina-compiler 4.33.0-next.9 → 4.33.0-next.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/context/index.d.ts +13 -20
  2. package/dist/context/typeScript.d.ts +2 -2
  3. package/dist/context/utils.d.ts +1 -1
  4. package/dist/dependencies/arcgisCore.d.ts +1 -1
  5. package/dist/dependencies/discover.d.ts +3 -3
  6. package/dist/dependencies/index.d.ts +2 -2
  7. package/dist/dependencies/loaders.d.ts +3 -3
  8. package/dist/dependencies/lumina.d.ts +2 -0
  9. package/dist/dependencies/stencil.d.ts +1 -1
  10. package/dist/dependencies/testSetupFiles.d.ts +1 -1
  11. package/dist/dependencies/updateLumina.d.ts +4 -4
  12. package/dist/dependencies/utils.d.ts +2 -2
  13. package/dist/docs/config.d.ts +1 -1
  14. package/dist/docs/index.d.ts +2 -2
  15. package/dist/docs/stencilDocsJson.d.ts +3 -3
  16. package/dist/docs/vsCodeCustomData/index.d.ts +2 -2
  17. package/dist/docs/vsCodeCustomData/utils.d.ts +2 -2
  18. package/dist/docs/webTypes/description.d.ts +1 -1
  19. package/dist/docs/webTypes/index.d.ts +2 -2
  20. package/dist/docs/webTypes/utils.d.ts +2 -2
  21. package/dist/entrypoints/addNonLazyImports.d.ts +2 -2
  22. package/dist/entrypoints/config.d.ts +1 -0
  23. package/dist/entrypoints/dtsUtils.d.ts +3 -3
  24. package/dist/entrypoints/findUtils.d.ts +1 -1
  25. package/dist/entrypoints/handleComponentImports.d.ts +2 -2
  26. package/dist/entrypoints/pathMapping.d.ts +1 -1
  27. package/dist/entrypoints/resolveTagName.d.ts +3 -3
  28. package/dist/extractor/apiJsonUtils.d.ts +2 -2
  29. package/dist/extractor/declaration.d.ts +1 -38
  30. package/dist/extractor/extractor.d.ts +5 -6
  31. package/dist/extractor/helpers/cssDoc.d.ts +1 -1
  32. package/dist/extractor/helpers/event.d.ts +3 -3
  33. package/dist/extractor/helpers/jsDoc.d.ts +2 -2
  34. package/dist/extractor/helpers/method.d.ts +3 -3
  35. package/dist/extractor/helpers/property.d.ts +3 -3
  36. package/dist/extractor/helpers/resolveType.d.ts +3 -3
  37. package/dist/extractor/helpers/typeValue.d.ts +2 -2
  38. package/dist/extractor/index.d.ts +3 -3
  39. package/dist/frameworkTypes/index.d.ts +2 -2
  40. package/dist/frameworkTypes/lumina.d.ts +1 -1
  41. package/dist/frameworkTypes/preact.d.ts +1 -1
  42. package/dist/frameworkTypes/react.d.ts +1 -1
  43. package/dist/frameworkTypes/stencil.d.ts +1 -1
  44. package/dist/frameworkTypes/utils.d.ts +2 -2
  45. package/dist/frameworkTypes/vanilla.d.ts +1 -1
  46. package/dist/index.d.ts +10 -10
  47. package/dist/index.js +6482 -106
  48. package/dist/jsxToLitHtml/autoAddNothing.d.ts +2 -2
  49. package/dist/jsxToLitHtml/comments.d.ts +4 -4
  50. package/dist/jsxToLitHtml/convertProps.d.ts +5 -6
  51. package/dist/jsxToLitHtml/imports.d.ts +2 -2
  52. package/dist/jsxToLitHtml/index.d.ts +1 -1
  53. package/dist/jsxToLitHtml/inferPropType.d.ts +3 -3
  54. package/dist/jsxToLitHtml/insertRepeatCall.d.ts +2 -2
  55. package/dist/jsxToLitHtml/jsxVisitor.d.ts +3 -4
  56. package/dist/jsxToLitHtml/templateParts.d.ts +2 -2
  57. package/dist/jsxToLitHtml/throwOnImportingExternalized.d.ts +1 -1
  58. package/dist/jsxToLitHtml/types.d.ts +5 -4
  59. package/dist/jsxToLitHtml/utils.d.ts +1 -0
  60. package/dist/loader/hideUntilHydrated.d.ts +1 -1
  61. package/dist/loader/index.d.ts +2 -2
  62. package/dist/loader/lazy.d.ts +3 -3
  63. package/dist/loader/storybookApiJson.d.ts +1 -1
  64. package/dist/plugins/buildCdn.d.ts +72 -6
  65. package/dist/plugins/buildStencilHydrate.d.ts +2 -2
  66. package/dist/plugins/buildWebApp.d.ts +3 -0
  67. package/dist/plugins/buildWrappers.d.ts +2 -2
  68. package/dist/plugins/configureVite.d.ts +4 -4
  69. package/dist/plugins/externalizeDependencies.d.ts +2 -6
  70. package/dist/plugins/handleDynamicAssets.d.ts +2 -2
  71. package/dist/plugins/handleStaticAssets.d.ts +2 -2
  72. package/dist/plugins/loadLitCss.d.ts +2 -6
  73. package/dist/plugins/printTotalBuildSize.d.ts +2 -2
  74. package/dist/plugins/provideAssets.d.ts +3 -20
  75. package/dist/plugins/setAssetsPath.d.ts +2 -2
  76. package/dist/plugins/updatePackageJson.d.ts +3 -3
  77. package/dist/publicTypes.d.ts +25 -13
  78. package/dist/puppeteerTesting/globalSetup.d.ts +2 -2
  79. package/dist/puppeteerTesting/globalSetup.js +105 -2
  80. package/dist/puppeteerTesting/index.d.ts +7 -8
  81. package/dist/puppeteerTesting/index.js +1129 -5
  82. package/dist/puppeteerTesting/injected.d.ts +1 -1
  83. package/dist/puppeteerTesting/puppeteer/browser.d.ts +1 -1
  84. package/dist/puppeteerTesting/puppeteer/element.d.ts +3 -3
  85. package/dist/puppeteerTesting/puppeteer/events.d.ts +2 -2
  86. package/dist/puppeteerTesting/puppeteer/page.d.ts +1 -1
  87. package/dist/puppeteerTesting/puppeteer/types.d.ts +3 -3
  88. package/dist/puppeteerTesting/vitest/matchers/attributes.d.ts +1 -1
  89. package/dist/puppeteerTesting/vitest/matchers/classList.d.ts +1 -1
  90. package/dist/puppeteerTesting/vitest/matchers/events.d.ts +1 -1
  91. package/dist/puppeteerTesting/vitest/matchers/index.d.ts +13 -13
  92. package/dist/puppeteerTesting/vitest/matchers/text.d.ts +1 -1
  93. package/dist/puppeteerTesting/vitest/runner.d.ts +3 -3
  94. package/dist/puppeteerTesting/vitest/runner.js +50 -1
  95. package/dist/puppeteerTesting/vitest/types.d.ts +1 -1
  96. package/dist/testing/index.d.ts +4 -4
  97. package/dist/testing/index.js +181 -24
  98. package/dist/testing/mount.d.ts +2 -2
  99. package/dist/testing/wrapController.d.ts +2 -2
  100. package/dist/tests/utils.d.ts +2 -2
  101. package/dist/transformers/index.d.ts +3 -3
  102. package/dist/transformers/injectRuntimeOptions.d.ts +2 -2
  103. package/dist/transformers/internalTypeScriptApis.d.ts +2 -2
  104. package/dist/transformers/liftDecorators.d.ts +1 -1
  105. package/dist/transformers/members.d.ts +2 -2
  106. package/dist/transformers/property.d.ts +4 -4
  107. package/dist/transformers/propertyOptions.d.ts +5 -5
  108. package/dist/transformers/utils.d.ts +3 -3
  109. package/dist/types/astTransformers.d.ts +2 -2
  110. package/dist/types/failOnJsonImport.d.ts +1 -1
  111. package/dist/types/hideInternalLitElement.d.ts +1 -1
  112. package/dist/types/index.d.ts +2 -2
  113. package/dist/types/liftSetterTypes.d.ts +2 -3
  114. package/dist/types/textTransformers.d.ts +2 -2
  115. package/dist/types/transformComponentMembers.d.ts +1 -1
  116. package/dist/types-C3YmWTVv.js +13 -0
  117. package/dist/useLumina.d.ts +1 -1
  118. package/package.json +6 -5
  119. package/dist/chunk-6XNX5V4L.js +0 -1
  120. package/dist/chunk-JFKSI6I7.js +0 -1
  121. package/dist/context/typeScript.spec.d.ts +0 -1
  122. package/dist/context/utils.spec.d.ts +0 -1
  123. package/dist/defaultAssetsUrl.spec.d.ts +0 -1
  124. package/dist/dependencies/lit.d.ts +0 -2
  125. package/dist/dependencies/updateLumina.spec.d.ts +0 -1
  126. package/dist/docs/steniclDocsJson.test.d.ts +0 -1
  127. package/dist/entrypoints/dtsUtils.spec.d.ts +0 -1
  128. package/dist/entrypoints/findUtils.spec.d.ts +0 -1
  129. package/dist/entrypoints/resolveTagName.spec.d.ts +0 -1
  130. package/dist/extractor/declaration.spec.d.ts +0 -1
  131. package/dist/extractor/helpers/cssDoc.spec.d.ts +0 -1
  132. package/dist/extractor/helpers/resolveType.spec.d.ts +0 -1
  133. package/dist/extractor/helpers/typeValue.spec.d.ts +0 -1
  134. package/dist/jsxToLitHtml/utils.spec.d.ts +0 -1
  135. package/dist/loader/lazy.spec.d.ts +0 -1
  136. package/dist/plugins/buildCdn.spec.d.ts +0 -1
  137. package/dist/plugins/externalizeDependencies.spec.d.ts +0 -1
  138. package/dist/plugins/provideAssets.spec.d.ts +0 -1
  139. package/dist/plugins/updatePackageJson.spec.d.ts +0 -1
@@ -1,6 +1,1130 @@
1
- import{a as p,b as y}from"../chunk-6XNX5V4L.js";import"../chunk-JFKSI6I7.js";import"vitest";async function R(t){await t.exposeFunction("puppeteerOnEvent",(n,e)=>{G(t._e2eEvents,n,e)}),await t.evaluateOnNewDocument(K)}async function N(t,n,e){let i=new w(n),r=e!=="document"?()=>window:()=>document,a=await t.evaluateHandle(r);return await b(t,a,n,o=>{i.push(o)}),i}async function v(t,n,e){let i=await t.evaluate(async(r,a,o)=>await new Promise((s,l)=>{let u=setTimeout(()=>{l(new Error(`waitForEvent() timeout, eventName: ${a}`))},o);r.addEventListener(a,d=>{clearTimeout(u),s(window.puppeteerSerializeEvent(d))},{once:!0})}),e,n,c.defaultTimeout);return await t.waitForChanges(),i}var w=class{constructor(n){this.eventName=n;this.events=[];this._cursor=0;this._queuedHandler=[]}get length(){return this.events.length}get firstEvent(){return this.events.at(0)}get lastEvent(){return this.events.at(-1)}async next(){let n=this._cursor;this._cursor++;let e=this.events[n];if(e)return await Promise.resolve({done:!1,value:e});{let i,r=new Promise(a=>i=a);return this._queuedHandler.push(i),await r.then(()=>({done:!1,value:this.events[n]}))}}push(n){this.events.push(n);let e=this._queuedHandler.shift();e&&e()}};async function b(t,n,e,i){let r=t._e2eEventIds++;t._e2eEvents.set(r,{eventName:e,callback:i}),await n.evaluate((a,o,s)=>{a.addEventListener(s,l=>{window.puppeteerOnEvent(o,window.puppeteerSerializeEvent(l))})},r,e)}function G(t,n,e){t.get(n)?.callback(e)}function K(){let t=async()=>await new Promise(requestAnimationFrame),n=window,e,i=new Promise((a,o)=>e=o).catch(a=>{throw a instanceof ErrorEvent?a.error??new Error(`${a.message} ${a.filename}:${a.lineno}:${a.colno}`):a});window.addEventListener("error",e),window.addEventListener("unhandledrejection",e);async function r(){await t();let a=globalThis.devOnly$createdElements??[],o=a.length;await Promise.all(a.map(async s=>{let l=s.deref();l&&l.isConnected&&(l.manager?.loadedCalled?await l.manager.component.updateComplete:await l?.componentOnReady())})),o!==a.length&&await r()}n.puppeteerAwaitAllReady=async()=>await Promise.race([i,r()]),n.puppeteerSerializeEventTarget=a=>a?a===window?{serializedWindow:!0}:a===document?{serializedDocument:!0}:"nodeType"in a&&a.nodeType!=null?{serializedElement:!0,nodeName:a.nodeName,nodeValue:a.nodeValue,nodeType:a.nodeType,tagName:a.tagName,className:a.className,id:a.id}:null:null,n.puppeteerSerializeEvent=a=>({bubbles:a.bubbles,cancelable:a.cancelable,composed:a.composed,currentTarget:n.puppeteerSerializeEventTarget(a.currentTarget),defaultPrevented:a.defaultPrevented,detail:"detail"in a?a.detail:void 0,eventPhase:a.eventPhase,isTrusted:a.isTrusted,target:n.puppeteerSerializeEventTarget(a.target),timeStamp:a.timeStamp,type:a.type,isSerializedEvent:!0})}var Y=globalThis.HTMLElement??function(){},c=class t extends Y{constructor(e=t._page,i=t._handle){super();this._page=e;this.handle=i;this._queuedActions=[];this._temporaryDisableValidation=!1;e._e2eElements.push(this);let r=this.classList.add,a=this.classList.remove,o=this.classList.toggle;this.classList.add=(...s)=>{this._temporaryDisableValidation=!0;try{r.apply(this.classList,s)}finally{this._temporaryDisableValidation=!1}},this.classList.remove=(...s)=>{this._temporaryDisableValidation=!0;try{a.apply(this.classList,s)}finally{this._temporaryDisableValidation=!1}},this.classList.toggle=(s,l)=>{this._temporaryDisableValidation=!0;try{return o.call(this.classList,s,l)}finally{this._temporaryDisableValidation=!1}}}static{this.defaultTimeout=2500}static create(e,i){customElements.get("e2e-element")||customElements.define("e2e-element",t),t._page=e,t._handle=i;let r=document.createElement("e2e-element");return t._page=void 0,t._handle=void 0,r}async find(e){return await P(this._page,this.handle,e)}async findAll(e){return await x(this._page,this.handle,e)}async callMethod(e,...i){return this._queuedActions.push({methodName:e,methodArgs:i}),await this.e2eRunActions()}triggerEvent(e,i){this._queuedActions.push({eventName:e,eventInitDict:i})}async spyOnEvent(e){let i=new w(e);return await b(this._page,this.handle,e,r=>{i.push(r)}),i}async click(e){await this.handle.click(e),await this._page.waitForChanges()}async focus(){await this.handle.focus(),await this._page.waitForChanges()}async hover(){await this.handle.hover(),await this._page.waitForChanges()}async isVisible(){this._validate();let e=!1;try{e=await this.handle.frame.evaluate(async r=>await new Promise(a=>{window.requestAnimationFrame(()=>{if(r.isConnected){let o=window.getComputedStyle(r);!!o&&o.display!=="none"&&o.visibility!=="hidden"&&o.opacity!=="0"?window.requestAnimationFrame(()=>{r.clientWidth,a(!0)}):a(!1)}else a(!1)})}),this.handle)}catch{}return e}async waitForEvent(e){return await v(this._page,e,this.handle)}async waitForVisible(){await this.awaitVisibility()}async waitForNotVisible(){await this.awaitVisibility(!1)}async awaitVisibility(e=!0){await new Promise((i,r)=>{let a=async()=>{let d=await this.isVisible();e===d&&(clearInterval(s),clearTimeout(u),i())},s=setInterval(()=>void a(),10),l=new Error(`waitForNotVisible timed out: ${t.defaultTimeout}ms`),u=setTimeout(()=>{clearTimeout(s),r(l)},t.defaultTimeout)})}async isIntersectingViewport(){return await this.handle.isIntersectingViewport()}async press(e,i){await this.handle.press(e,i),await this._page.waitForChanges()}async tap(){await this.handle.tap(),await this._page.waitForChanges()}async type(e,i){await this.handle.type(e,i),await this._page.waitForChanges()}async getProperty(e){return this._validate(),await this.handle.frame.evaluate((a,o)=>a[o],this.handle,e)}setProperty(e,i){this._queuedActions.push({setPropertyName:e,setPropertyValue:i})}getAttribute(e){return this._validate(),super.getAttribute(e)}setAttribute(e,i){super.setAttribute(e,i),this._queuedActions.push({setAttributeName:e,setAttributeValue:i})}removeAttribute(e){super.removeAttribute(e),this._queuedActions.push({removeAttribute:e})}toggleAttribute(e,i){let r=super.toggleAttribute(e,i);return this._queuedActions.push({toggleAttributeName:e,toggleAttributeForce:i}),r}get innerHTML(){return this._validate(),super.innerHTML}set innerHTML(e){this._queuedActions.push({setPropertyName:"innerHTML",setPropertyValue:e})}get innerText(){return this._validate(),super.innerText}set innerText(e){this._queuedActions.push({setPropertyName:"innerText",setPropertyValue:e})}get nodeValue(){return this._validate(),super.nodeValue}set nodeValue(e){typeof e=="string"&&this._queuedActions.push({setPropertyName:"nodeValue",setPropertyValue:e})}get outerHTML(){return this._validate(),super.outerHTML}set outerHTML(e){throw new Error("outerHTML is read-only")}get textContent(){return this._validate(),super.textContent}set textContent(e){super.textContent=e,this._queuedActions.push({setPropertyName:"textContent",setPropertyValue:e})}async getComputedStyle(e){e!=="::after"&&e!=="::before"&&e!==":after"&&e!==":before"&&(e=null);let i=await this._page.evaluate((r,a)=>{let o={},s=window.getComputedStyle(r,a);return[...Object.keys(s),...Array.from(r.style??[])].forEach(u=>{if(isNaN(u)){let d=s[u]||s.getPropertyValue(u);d!=null&&(o[u]=d)}else{let d=String(s[u]);if(d.includes("-")){let E=s.getPropertyValue(d);E!=null&&(o[d]=E)}}}),o},this.handle,e);return i.getPropertyValue=r=>i[r],i}async e2eRunActions(){if(this._queuedActions.length===0)return;let i=await this.handle.frame.evaluate(async(r,a)=>await r.componentOnReady().then(()=>{let o;return a.forEach(s=>{if(s.methodName)o=r[s.methodName].apply(r,s.methodArgs??[]);else if(s.setPropertyName)r[s.setPropertyName]=s.setPropertyValue;else if(s.setAttributeName)r.setAttribute(s.setAttributeName,String(s.setAttributeValue));else if(s.removeAttribute)r.removeAttribute(s.removeAttribute);else if(s.toggleAttributeName)typeof s.toggleAttributeForce=="boolean"?r.toggleAttribute(s.toggleAttributeName,s.toggleAttributeForce):r.toggleAttribute(s.toggleAttributeName);else if(s.classAdd)r.classList.add(s.classAdd);else if(s.classRemove)r.classList.remove(s.classRemove);else if(s.classToggle)r.classList.toggle(s.classToggle);else if(s.eventName){let l=new CustomEvent(s.eventName,{bubbles:!0,cancelable:!0,composed:!0,...s.eventInitDict});r.dispatchEvent(l)}}),o}),this.handle,this._queuedActions);return this._queuedActions.length=0,i}async e2eSync(){let e=this.handle.frame,{outerHtml:i,shadowRootHtml:r}=await e.evaluate(s=>({outerHtml:s.outerHTML,shadowRootHtml:s.shadowRoot?.innerHTML??null}),this.handle);if(typeof r=="string"){this.shadowRoot||this.attachShadow({mode:"open"});let s=this._parseHtmlToFragment(r);this._moveChildren(s,this.shadowRoot)}let o=this._parseHtmlToFragment(i).firstElementChild;if(o){Object.defineProperty(this,"tagName",{value:o.tagName,configurable:!0}),Object.defineProperty(this,"nodeName",{value:o.nodeName,configurable:!0});for(let s of Array.from(this.attributes))this.removeAttributeNode(s);for(let{name:s,value:l}of o.attributes)super.setAttribute(s,l);this._moveChildren(o,this)}}_moveChildren(e,i){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0]);for(;e.childNodes.length>0;)i.appendChild(e.childNodes[0])}_parseHtmlToFragment(e){let r=new DOMParser().parseFromString(e,"text/html"),a=document.createDocumentFragment();for(;r.body.firstChild;)a.appendChild(r.body.firstChild);return a}_validate(){if(!this._temporaryDisableValidation){if(this._queuedActions.length>0)throw new Error("await page.waitForChanges() must be called before reading element information");if(!this.handle)throw new Error("trying to read from a disposed element")}}async e2eDispose(){this.handle&&(await this.handle.dispose(),this.handle=null);let e=this._page._e2eElements.indexOf(this);e>-1&&this._page._e2eElements.splice(e,1),this._page=null}cloneNode(e){let i=super.cloneNode(e);return Object.defineProperty(i,"tagName",{value:this.tagName,configurable:!0}),Object.defineProperty(i,"nodeName",{value:this.nodeName,configurable:!0}),i}};async function P(t,n,e){let{lightSelector:i,text:r,contains:a}=S(e);if(typeof e=="string"&&e.includes(">>>")){let l=await t.$(e);if(!l)return null;let u=c.create(t,l);return await u.e2eSync(),u}let o;if(typeof i=="string"?o=await n.$(i):o=await Q(t,n,r,a),!o)return null;let s=c.create(t,o);return await s.e2eSync(),s}async function Q(t,n,e,i){let r=await t.evaluateHandle((a,o,s)=>{let l=null;function u(d){if(!d||l)return;if(d.nodeType===3){if(typeof o=="string"&&d.textContent?.trim()===o){l=d.parentElement;return}if(typeof s=="string"&&d.textContent?.includes(s)){l=d.parentElement;return}}else{if(d.nodeName==="SCRIPT"||d.nodeName==="STYLE")return;u(d.shadowRoot),d.childNodes?.forEach(u)}}return u(a),l},n,e,i);return r?r.asElement():null}async function x(t,n,e){let i=[];if(typeof e=="string"&&e.includes(">>>")){let o=await t.$$(e,{isolate:!0});for(let s of o){let l=c.create(t,s);await l.e2eSync(),i.push(l)}return i}let{lightSelector:r}=S(e);if(r===void 0)return[];let a=await n.$$(r,{isolate:!0});if(a.length===0)return[];for(let o of a){let s=c.create(t,o);await s.e2eSync(),i.push(s)}return i}function S(t){let n={lightSelector:void 0,text:void 0,contains:void 0};if(typeof t=="string")n.lightSelector=t.trim();else if(typeof t.text=="string")n.text=t.text.trim();else if(typeof t.contains=="string")n.contains=t.contains.trim();else throw new Error(`invalid find selector: ${JSON.stringify(t)}`);return n}import{isPosix as X,toSystemPathSeparators as Z}from"@arcgis/components-build-utils";async function ee(t){let n=await y.runner.createNewPage();try{return await te(n,t)}catch(e){throw n.isClosed()||await n.close(),e}}async function te(t,n){let e=[],i={_e2eElements:[],_originalClose:t.close,_e2eEvents:new Map,_e2eEventIds:0,_isWaitingForAllReady:!1,_unhandledError:void 0,async spyOnEvent(s,l){return await N.call(r,r,s,l)},async close(s){try{if(Array.isArray(r._e2eElements)){let l=r._e2eElements.map(async u=>{typeof u.e2eDispose=="function"&&await u.e2eDispose()});await Promise.all(l)}}catch{}await Promise.all(f),ne(r);try{r.isClosed()||await r._originalClose?.(s)}catch{}},async find(s){let l=await o();return await P(r,l,s)},async findAll(s){let l=await o();return await x(r,l,s)},async waitForEvent(s){let l=await o();return await v(r,s,l)},getDiagnostics:()=>e,async waitForChanges(s){await se(r,s)},async debugger(){if(!p.isDevToolsEnabled){console.warn("Re-run the test with the --inspect flag or set `puppeteerTesting.launchOptions.devtools: true` in order to use E2EPage.debugger()");return}p.isHeadlessBrowser&&console.warn("E2EPage.debugger() called while in headless mode. This may freeze the test."),await r.evaluate(async()=>await new Promise(s=>{debugger;s()}))},goTo:ie,setContent:_,async waitForTimeout(s){await new Promise(l=>setTimeout(l,s))}},r=Object.assign(t,i);await R(r);let a;async function o(){return a??=r.evaluateHandle(()=>document),(await a).asElement()}return r.on("console",s=>{s.type()==="error"&&e.push({type:"error",message:s.text(),location:s.location().url}),ae(s)}),r.on("pageerror",s=>{if(e.push({type:"pageerror",message:s.message,location:s.stack}),r._isWaitingForAllReady){r._unhandledError=s;return}else throw s}),r.on("error",s=>{throw e.push({type:"error",message:s.message,location:s.stack}),s}),r.on("requestfailed",s=>{let l=s.url(),u=s.failure()?.errorText;e.push({type:"requestfailed",message:u,location:l}),u!=="net::ERR_ABORTED"&&console.error("Request failed",{location:l,message:u})}),typeof n?.html=="string"&&await _.call(r,n.html),r}function ne(t){function n(){throw new Error("The page was already closed")}t.goto=n,t.find=n,t.debugger=n,t.findAll=n,t.setContent=n,t.spyOnEvent=n,t.waitForChanges=n,t.waitForEvent=n}async function ie(t,n={}){if(this.isClosed())throw new Error("e2eGoTo unavailable: page already closed");if(typeof t!="string")throw new Error("invalid gotoTest() url");if(!t.startsWith("/"))throw new Error("gotoTest() url must start with /");let e=p.devServerUrl;if(typeof e!="string")throw new Error("invalid gotoTest() browser url");let i=e+t.substring(1),r=await this.goto(i,n);if(r?.ok()!==!0)throw new Error(`Testing unable to load ${t}, HTTP status: ${String(r?.status())}`);return await T(this,n),r}async function _(t,n={}){if(this.isClosed())throw new Error("Can't call e2eSetContent on a closed age");if(typeof t!="string")throw new Error(`Expected first argument in e2eSetContent() to be an HTML string. Received: ${typeof t}`);let e=p.devServerHtml;if(typeof e!="string")throw new Error("Failed to retrieve .devServerHtml env variable");let i=e.replace("<body>",`<body>
2
- ${t}`),r=p.devServerUrl;if(r===void 0)throw new Error("Failed to retrieve .devServerUrl env variable");this.setContent=()=>{throw new Error(".setContent() was already set for this page. Calling it again would create a new page -- you should call newE2EPag() instead.")},await this.setRequestInterception(!0);let a=!1;this.on("request",s=>{a&&s.isNavigationRequest()&&(console.error(`Page was navigated to ${s.url()}. This may be a result of form submission or link click.`),this.close()),r===s.url()?(a=!0,s.respond({status:200,contentType:"text/html",body:i})):s.continue()});let o=await this.goto(r,n);if(o?.ok()!==!0)throw new Error(`Failed to load the test page. HTTP code: ${o?.status()} ${o?.statusText()}`);await T(this,n)}async function T(t,n){let e=n?.timeout??y.runner.config.testTimeout*re;t._isWaitingForAllReady=!0;try{await new Promise((i,r)=>{t.evaluate(async()=>await window.puppeteerAwaitAllReady()).then(i).catch(r),setTimeout(r,e,new Error("App did not load in allowed time. Please ensure the content loads a web component application."))})}catch(i){if(t._unhandledError){let r=t._unhandledError;throw t._unhandledError=void 0,r}throw i}finally{t._isWaitingForAllReady=!1}if(t._unhandledError){let i=t._unhandledError;throw t._unhandledError=void 0,i}}var re=.9;async function se(t,n=p.puppeteerWaitForChangesDelay??0){try{if(t.isClosed()||(await Promise.all(t._e2eElements.map(async e=>await e.e2eRunActions())),t.isClosed())||(await T(t),t.isClosed()))return;n>0&&await t.waitForTimeout(n),await Promise.all(t._e2eElements.map(async e=>await e.e2eSync()))}catch(e){if(!String(e).includes("Target closed"))throw e}}var f=[];async function ae(t){let n=t.type();if(n==="debug")return;let e="";if(t.args().length===0)e=`${t.text()}${$(t)}`;else{let i=oe(t);f.push(i),await Promise.all(f.slice(0,-1)),e=await i,f.splice(f.indexOf(i),1)}e.startsWith("Using Calcite Components")||(typeof console[n]=="function"?console[n](e):console.log(n,e))}async function oe(t){return`${(await Promise.all(t.args().map(le))).join(" ")} ${$(t)}`}var $=t=>[`
1
+ import { expect as p, afterEach as R } from "vitest";
2
+ import { toSystemPathSeparators as V, isPosix as L } from "@arcgis/components-build-utils";
3
+ import { p as _, i as h } from "../types-C3YmWTVv.js";
4
+ async function S(s) {
5
+ await s.exposeFunction("puppeteerOnEvent", (e, t) => {
6
+ O(s._e2eEvents, e, t);
7
+ }), await s.evaluateOnNewDocument(j);
8
+ }
9
+ async function D(s, e, t) {
10
+ const n = new $(e), a = t !== "document" ? () => window : () => document, i = await s.evaluateHandle(a);
11
+ return await C(s, i, e, (r) => {
12
+ n.push(r);
13
+ }), n;
14
+ }
15
+ async function T(s, e, t) {
16
+ const n = await s.evaluate(
17
+ async (a, i, r) => await new Promise((o, l) => {
18
+ const c = setTimeout(() => {
19
+ l(new Error(`waitForEvent() timeout, eventName: ${i}`));
20
+ }, r);
21
+ a.addEventListener(
22
+ i,
23
+ (u) => {
24
+ clearTimeout(c), o(window.puppeteerSerializeEvent(u));
25
+ },
26
+ { once: !0 }
27
+ );
28
+ }),
29
+ t,
30
+ e,
31
+ d.defaultTimeout
32
+ );
33
+ return await s.waitForChanges(), n;
34
+ }
35
+ class $ {
36
+ constructor(e) {
37
+ this.eventName = e, this.events = [], this._cursor = 0, this._queuedHandler = [];
38
+ }
39
+ get length() {
40
+ return this.events.length;
41
+ }
42
+ get firstEvent() {
43
+ return this.events.at(0);
44
+ }
45
+ get lastEvent() {
46
+ return this.events.at(-1);
47
+ }
48
+ async next() {
49
+ const e = this._cursor;
50
+ this._cursor++;
51
+ const t = this.events[e];
52
+ if (t)
53
+ return await Promise.resolve({
54
+ done: !1,
55
+ value: t
56
+ });
57
+ {
58
+ let n;
59
+ const a = new Promise((i) => n = i);
60
+ return this._queuedHandler.push(n), await a.then(() => ({
61
+ done: !1,
62
+ value: this.events[e]
63
+ }));
64
+ }
65
+ }
66
+ push(e) {
67
+ this.events.push(e);
68
+ const t = this._queuedHandler.shift();
69
+ t && t();
70
+ }
71
+ }
72
+ async function C(s, e, t, n) {
73
+ const a = s._e2eEventIds++;
74
+ s._e2eEvents.set(a, {
75
+ eventName: t,
76
+ callback: n
77
+ }), await e.evaluate(
78
+ (i, r, o) => {
79
+ i.addEventListener(o, (l) => {
80
+ window.puppeteerOnEvent(
81
+ r,
82
+ window.puppeteerSerializeEvent(l)
83
+ );
84
+ });
85
+ },
86
+ a,
87
+ t
88
+ );
89
+ }
90
+ function O(s, e, t) {
91
+ s.get(e)?.callback(t);
92
+ }
93
+ function j() {
94
+ const s = async () => await new Promise(requestAnimationFrame), e = window;
95
+ let t;
96
+ const n = new Promise((i, r) => t = r).catch((i) => {
97
+ throw i instanceof ErrorEvent ? i.error ?? new Error(`${i.message} ${i.filename}:${i.lineno}:${i.colno}`) : i;
98
+ });
99
+ window.addEventListener("error", t), window.addEventListener("unhandledrejection", t);
100
+ async function a() {
101
+ await s();
102
+ const i = globalThis.devOnly$createdElements ?? [], r = i.length;
103
+ await Promise.all(
104
+ i.map(async (o) => {
105
+ const l = o.deref();
106
+ l && l.isConnected && (l.manager?.loadedCalled ? await l.manager.component.updateComplete : await l?.componentOnReady());
107
+ })
108
+ ), r !== i.length && await a();
109
+ }
110
+ e.puppeteerAwaitAllReady = async () => await Promise.race([n, a()]), e.puppeteerSerializeEventTarget = (i) => i ? i === window ? { serializedWindow: !0 } : i === document ? { serializedDocument: !0 } : "nodeType" in i && i.nodeType != null ? {
111
+ serializedElement: !0,
112
+ nodeName: i.nodeName,
113
+ nodeValue: i.nodeValue,
114
+ nodeType: i.nodeType,
115
+ tagName: i.tagName,
116
+ className: i.className,
117
+ id: i.id
118
+ } : null : null, e.puppeteerSerializeEvent = (i) => ({
119
+ bubbles: i.bubbles,
120
+ cancelable: i.cancelable,
121
+ composed: i.composed,
122
+ currentTarget: e.puppeteerSerializeEventTarget(i.currentTarget),
123
+ defaultPrevented: i.defaultPrevented,
124
+ detail: "detail" in i ? i.detail : void 0,
125
+ eventPhase: i.eventPhase,
126
+ isTrusted: i.isTrusted,
127
+ target: e.puppeteerSerializeEventTarget(i.target),
128
+ timeStamp: i.timeStamp,
129
+ type: i.type,
130
+ isSerializedEvent: !0
131
+ });
132
+ }
133
+ const z = globalThis.HTMLElement ?? function() {
134
+ };
135
+ class d extends z {
136
+ constructor(e = d._page, t = d._handle) {
137
+ super(), this._page = e, this.handle = t, this._queuedActions = [], this._temporaryDisableValidation = !1, e._e2eElements.push(this);
138
+ const n = this.classList.add, a = this.classList.remove, i = this.classList.toggle;
139
+ this.classList.add = (...r) => {
140
+ this._temporaryDisableValidation = !0;
141
+ try {
142
+ n.apply(this.classList, r);
143
+ } finally {
144
+ this._temporaryDisableValidation = !1;
145
+ }
146
+ }, this.classList.remove = (...r) => {
147
+ this._temporaryDisableValidation = !0;
148
+ try {
149
+ a.apply(this.classList, r);
150
+ } finally {
151
+ this._temporaryDisableValidation = !1;
152
+ }
153
+ }, this.classList.toggle = (r, o) => {
154
+ this._temporaryDisableValidation = !0;
155
+ try {
156
+ return i.call(this.classList, r, o);
157
+ } finally {
158
+ this._temporaryDisableValidation = !1;
159
+ }
160
+ };
161
+ }
162
+ static {
163
+ this.defaultTimeout = 2500;
164
+ }
165
+ /**
166
+ * We can't directly call `new E22Element()` since it extends HTMLElement
167
+ * which is not directly constructable. Instead, we register it as a custom
168
+ * element.
169
+ */
170
+ static create(e, t) {
171
+ customElements.get("e2e-element") || customElements.define("e2e-element", d), d._page = e, d._handle = t;
172
+ const n = document.createElement("e2e-element");
173
+ return d._page = void 0, d._handle = void 0, n;
174
+ }
175
+ /**
176
+ * Find a child element that matches the selector, which is the same as
177
+ * `element.querySelector(selector)`. Use `>>>` within the
178
+ * selector to find an element within a host element's shadow root.
179
+ * For example, to select the first `div` inside of the component
180
+ * `my-cmp`, which is a child of this element, the call would be
181
+ * `element.find('my-cmp >>> div')`. Returns `null` if no
182
+ * elements were found.
183
+ */
184
+ async find(e) {
185
+ return await N(this._page, this.handle, e);
186
+ }
187
+ /**
188
+ * Find all child elements that match the selector, which is the same as
189
+ * `element.querySelectorAll(selector)`. Use `>>>` within the
190
+ * selector to find elements within a host element's shadow root.
191
+ * For example, to select all `li` elements inside of the component
192
+ * `my-cmp`, which is a child of this element, the call would be
193
+ * `element.findAll('my-cmp >>> li')`. Returns an empty array if
194
+ * no elements were found.
195
+ */
196
+ async findAll(e) {
197
+ return await x(this._page, this.handle, e);
198
+ }
199
+ /**
200
+ * Used to call a method on a component. For example, if a component
201
+ * has the method `cmp.myMethod(arg1, arg2)`, calling this method
202
+ * from a e2e test could be `cmp.callMethod('myMethod', arg1, arg2)`.
203
+ */
204
+ async callMethod(e, ...t) {
205
+ return this._queuedActions.push({
206
+ methodName: e,
207
+ methodArgs: t
208
+ }), await this.e2eRunActions();
209
+ }
210
+ /**
211
+ * This is a convenience method to easily create a `CustomEvent`,
212
+ * and dispatch it from the element, to include any custom event
213
+ * `detail` data as the second argument.
214
+ */
215
+ triggerEvent(e, t) {
216
+ this._queuedActions.push({
217
+ eventName: e,
218
+ eventInitDict: t
219
+ });
220
+ }
221
+ /**
222
+ * Used to test if an event was, or was not dispatched. This method
223
+ * returns a promise, that resolves with an EventSpy. The EventSpy
224
+ * can be used along with `expect(spy).toHaveReceivedEvent()`,
225
+ * `expect(spy).toHaveReceivedEventTimes(x)` and
226
+ * `expect(spy).toHaveReceivedEventDetail({...})`.
227
+ */
228
+ async spyOnEvent(e) {
229
+ const t = new $(e);
230
+ return await C(this._page, this.handle, e, (n) => {
231
+ t.push(n);
232
+ }), t;
233
+ }
234
+ /**
235
+ * Calling `click()` on an element scrolls it into view if needed, and
236
+ * then uses `page.mouse` to click in the center of the element.
237
+ * Please see the puppeteer docs for more information.
238
+ */
239
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
240
+ async click(e) {
241
+ await this.handle.click(e), await this._page.waitForChanges();
242
+ }
243
+ /**
244
+ * Sets focus on the element.
245
+ */
246
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
247
+ async focus() {
248
+ await this.handle.focus(), await this._page.waitForChanges();
249
+ }
250
+ /**
251
+ * Sets hover on the element.
252
+ */
253
+ async hover() {
254
+ await this.handle.hover(), await this._page.waitForChanges();
255
+ }
256
+ /**
257
+ * Resolves `true` when the element's style is `display !== 'none'`,
258
+ * `visibility !== 'hidden'` and `opacity !== '0'`.
259
+ */
260
+ async isVisible() {
261
+ this._validate();
262
+ let e = !1;
263
+ try {
264
+ e = await this.handle.frame.evaluate(
265
+ async (n) => await new Promise((a) => {
266
+ window.requestAnimationFrame(() => {
267
+ if (n.isConnected) {
268
+ const i = window.getComputedStyle(n);
269
+ !!i && i.display !== "none" && i.visibility !== "hidden" && i.opacity !== "0" ? window.requestAnimationFrame(() => {
270
+ n.clientWidth, a(!0);
271
+ }) : a(!1);
272
+ } else
273
+ a(!1);
274
+ });
275
+ }),
276
+ this.handle
277
+ );
278
+ } catch {
279
+ }
280
+ return e;
281
+ }
282
+ /**
283
+ * Waits until the given event is listened in the element.
284
+ */
285
+ async waitForEvent(e) {
286
+ return await T(this._page, e, this.handle);
287
+ }
288
+ /**
289
+ * Waits until the element's style is `display !== 'none'`,
290
+ * `visibility !== 'hidden'`, `opacity !== '0'` and the element
291
+ * is connected to the document.
292
+ */
293
+ async waitForVisible() {
294
+ await this.awaitVisibility();
295
+ }
296
+ /**
297
+ * Waits until the element's style is `display === 'none'`, or
298
+ * `visibility === 'hidden'`, or `opacity === '0'`, or the element
299
+ * is no longer connected to the document.
300
+ */
301
+ async waitForNotVisible() {
302
+ await this.awaitVisibility(!1);
303
+ }
304
+ async awaitVisibility(e = !0) {
305
+ await new Promise((t, n) => {
306
+ const a = async () => {
307
+ const c = await this.isVisible();
308
+ e === c && (clearInterval(r), clearTimeout(l), t());
309
+ }, r = setInterval(() => void a(), 10), o = new Error(`waitForNotVisible timed out: ${d.defaultTimeout}ms`), l = setTimeout(() => {
310
+ clearTimeout(r), n(o);
311
+ }, d.defaultTimeout);
312
+ });
313
+ }
314
+ /**
315
+ * Resolves to true if the element is visible in the current viewport.
316
+ */
317
+ async isIntersectingViewport() {
318
+ return await this.handle.isIntersectingViewport();
319
+ }
320
+ /**
321
+ * Focuses the element, and then uses `keyboard.down` and `keyboard.up`.
322
+ * If key is a single character and no modifier keys besides Shift are
323
+ * being held down, a keypress/input event will also be generated. The
324
+ * text option can be specified to force an input event to be generated.
325
+ * Note: Modifier keys DO effect `elementHandle.press`. Holding down Shift
326
+ * will type the text in upper case.
327
+ * Key names: https://github.com/puppeteer/puppeteer/blob/main/src/common/USKeyboardLayout.ts
328
+ */
329
+ async press(e, t) {
330
+ await this.handle.press(e, t), await this._page.waitForChanges();
331
+ }
332
+ /**
333
+ * This method scrolls the element it into view if needed,
334
+ * and then uses `page.touchscreen` to tap in the center of the element.
335
+ */
336
+ async tap() {
337
+ await this.handle.tap(), await this._page.waitForChanges();
338
+ }
339
+ /**
340
+ * Sends a keydown, keypress/input, and keyup event for each character in the text.
341
+ * To press a special key, like Control or ArrowDown, use `keyboard.press`.
342
+ */
343
+ async type(e, t) {
344
+ await this.handle.type(e, t), await this._page.waitForChanges();
345
+ }
346
+ /**
347
+ * Returns the value of a specified attribute on the element. If the
348
+ * given attribute does not exist, the value returned will be null.
349
+ */
350
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
351
+ async getProperty(e) {
352
+ return this._validate(), await this.handle.frame.evaluate(
353
+ (a, i) => a[i],
354
+ this.handle,
355
+ e
356
+ );
357
+ }
358
+ /**
359
+ * Used to set a property set on a component. For example, if a
360
+ * component has the property `elm.myProp`, then calling
361
+ * `elm.setProperty('myProp', 88)` would set the value `88` to
362
+ * the `myProp` property on the component.
363
+ */
364
+ setProperty(e, t) {
365
+ this._queuedActions.push({
366
+ setPropertyName: e,
367
+ setPropertyValue: t
368
+ });
369
+ }
370
+ /**
371
+ * Returns the value of a specified attribute on the element. If the
372
+ * given attribute does not exist, the value returned will be null.
373
+ */
374
+ getAttribute(e) {
375
+ return this._validate(), super.getAttribute(e);
376
+ }
377
+ /**
378
+ * Removes the attribute on the specified element. Note that
379
+ * `await page.waitForChanges()` must be called before reading
380
+ * the value if content has changed.
381
+ */
382
+ setAttribute(e, t) {
383
+ super.setAttribute(e, t), this._queuedActions.push({
384
+ setAttributeName: e,
385
+ setAttributeValue: t
386
+ });
387
+ }
388
+ /**
389
+ * Removes the attribute on the specified element. Note that
390
+ * `await page.waitForChanges()` must be called before reading
391
+ * the value if content has changed.
392
+ */
393
+ removeAttribute(e) {
394
+ super.removeAttribute(e), this._queuedActions.push({
395
+ removeAttribute: e
396
+ });
397
+ }
398
+ /**
399
+ * Toggles a `boolean` attribute (removing it if it is present and adding
400
+ * it if it is not present) on the given element. Note that
401
+ * `await page.waitForChanges()` must be called before reading
402
+ * the value if content has changed. The optional `force` argument is a
403
+ * `boolean` value to determine whether the attribute should be added or
404
+ * removed, no matter whether the attribute is present or not at the moment.
405
+ */
406
+ toggleAttribute(e, t) {
407
+ const n = super.toggleAttribute(e, t);
408
+ return this._queuedActions.push({
409
+ toggleAttributeName: e,
410
+ toggleAttributeForce: t
411
+ }), n;
412
+ }
413
+ /**
414
+ * Gets and sets `innerHTML` property of the element.
415
+ * Note that `await page.waitForChanges()` must be called before reading
416
+ * the value if content has changed.
417
+ */
418
+ get innerHTML() {
419
+ return this._validate(), super.innerHTML;
420
+ }
421
+ set innerHTML(e) {
422
+ this._queuedActions.push({
423
+ setPropertyName: "innerHTML",
424
+ setPropertyValue: e
425
+ });
426
+ }
427
+ /**
428
+ * Gets and sets `innerText` property of the element.
429
+ * Note that `await page.waitForChanges()` must be called before reading
430
+ * the value if content has changed.
431
+ */
432
+ get innerText() {
433
+ return this._validate(), super.innerText;
434
+ }
435
+ set innerText(e) {
436
+ this._queuedActions.push({
437
+ setPropertyName: "innerText",
438
+ setPropertyValue: e
439
+ });
440
+ }
441
+ get nodeValue() {
442
+ return this._validate(), super.nodeValue;
443
+ }
444
+ set nodeValue(e) {
445
+ typeof e == "string" && this._queuedActions.push({
446
+ setPropertyName: "nodeValue",
447
+ setPropertyValue: e
448
+ });
449
+ }
450
+ /**
451
+ * Gets the element's `outerHTML. This is a read-only property and will
452
+ * throw an error if set.
453
+ */
454
+ // eslint-disable-next-line @typescript-eslint/related-getter-setter-pairs
455
+ get outerHTML() {
456
+ return this._validate(), super.outerHTML;
457
+ }
458
+ set outerHTML(e) {
459
+ throw new Error("outerHTML is read-only");
460
+ }
461
+ /**
462
+ * The `textContent` property represents the text content of a node
463
+ * and its descendants. Note that `await page.waitForChanges()` must
464
+ * be called before reading the value if content has changed.
465
+ */
466
+ get textContent() {
467
+ return this._validate(), super.textContent;
468
+ }
469
+ set textContent(e) {
470
+ super.textContent = e, this._queuedActions.push({
471
+ setPropertyName: "textContent",
472
+ setPropertyValue: e
473
+ });
474
+ }
475
+ /**
476
+ * Returns an object that reports the values of all CSS properties of this
477
+ * element after applying active stylesheets and resolving any basic computation
478
+ * those values may contain. Individual CSS property values are accessed by
479
+ * simply indexing with CSS property names. The method is shortcut and an async
480
+ * version of using `window.getComputedStyle(element)` directly.
481
+ */
482
+ async getComputedStyle(e) {
483
+ e !== "::after" && e !== "::before" && e !== ":after" && e !== ":before" && (e = null);
484
+ const t = await this._page.evaluate(
485
+ (n, a) => {
486
+ const i = {}, r = window.getComputedStyle(n, a);
487
+ return [
488
+ ...Object.keys(r),
489
+ /**
490
+ * include CSS variables defined within the style attribute
491
+ * of an element, e.g.:
492
+ * ```
493
+ * <my-component style="--my-component-text-color: rgb(255, 0, 0);"></my-component>
494
+ * ```
495
+ */
496
+ ...Array.from(n.style ?? [])
497
+ ].forEach((l) => {
498
+ if (isNaN(l)) {
499
+ const c = (
500
+ /**
501
+ * access property directly for any known css property
502
+ */
503
+ r[l] || /**
504
+ * use `getPropertyValue` for css variables
505
+ */
506
+ r.getPropertyValue(l)
507
+ );
508
+ c != null && (i[l] = c);
509
+ } else {
510
+ const c = String(r[l]);
511
+ if (c.includes("-")) {
512
+ const u = r.getPropertyValue(c);
513
+ u != null && (i[c] = u);
514
+ }
515
+ }
516
+ }), i;
517
+ },
518
+ this.handle,
519
+ e
520
+ );
521
+ return t.getPropertyValue = (n) => t[n], t;
522
+ }
523
+ async e2eRunActions() {
524
+ if (this._queuedActions.length === 0)
525
+ return;
526
+ const t = await this.handle.frame.evaluate(
527
+ async (n, a) => (
528
+ // BROWSER CONTEXT
529
+ // cannot use async/await in here because typescript transpiles it in the node context
530
+ await n.componentOnReady().then(() => {
531
+ let i;
532
+ return a.forEach((r) => {
533
+ if (r.methodName)
534
+ i = n[r.methodName].apply(
535
+ n,
536
+ r.methodArgs ?? []
537
+ );
538
+ else if (r.setPropertyName)
539
+ n[r.setPropertyName] = r.setPropertyValue;
540
+ else if (r.setAttributeName)
541
+ n.setAttribute(r.setAttributeName, String(r.setAttributeValue));
542
+ else if (r.removeAttribute)
543
+ n.removeAttribute(r.removeAttribute);
544
+ else if (r.toggleAttributeName)
545
+ typeof r.toggleAttributeForce == "boolean" ? n.toggleAttribute(r.toggleAttributeName, r.toggleAttributeForce) : n.toggleAttribute(r.toggleAttributeName);
546
+ else if (r.classAdd)
547
+ n.classList.add(r.classAdd);
548
+ else if (r.classRemove)
549
+ n.classList.remove(r.classRemove);
550
+ else if (r.classToggle)
551
+ n.classList.toggle(r.classToggle);
552
+ else if (r.eventName) {
553
+ const o = new CustomEvent(r.eventName, {
554
+ bubbles: !0,
555
+ cancelable: !0,
556
+ composed: !0,
557
+ ...r.eventInitDict
558
+ });
559
+ n.dispatchEvent(o);
560
+ }
561
+ }), i;
562
+ })
563
+ ),
564
+ this.handle,
565
+ this._queuedActions
566
+ );
567
+ return this._queuedActions.length = 0, t;
568
+ }
569
+ async e2eSync() {
570
+ const e = this.handle.frame, { outerHtml: t, shadowRootHtml: n } = await e.evaluate(
571
+ (r) => ({
572
+ outerHtml: r.outerHTML,
573
+ shadowRootHtml: r.shadowRoot?.innerHTML ?? null
574
+ }),
575
+ this.handle
576
+ );
577
+ if (typeof n == "string") {
578
+ this.shadowRoot || this.attachShadow({ mode: "open" });
579
+ const r = this._parseHtmlToFragment(n);
580
+ this._moveChildren(r, this.shadowRoot);
581
+ }
582
+ const i = this._parseHtmlToFragment(t).firstElementChild;
583
+ if (i) {
584
+ Object.defineProperty(this, "tagName", {
585
+ value: i.tagName,
586
+ configurable: !0
587
+ }), Object.defineProperty(this, "nodeName", {
588
+ value: i.nodeName,
589
+ configurable: !0
590
+ });
591
+ for (const r of Array.from(this.attributes))
592
+ this.removeAttributeNode(r);
593
+ for (const { name: r, value: o } of i.attributes)
594
+ super.setAttribute(r, o);
595
+ this._moveChildren(i, this);
596
+ }
597
+ }
598
+ _moveChildren(e, t) {
599
+ for (; t.childNodes.length > 0; )
600
+ t.removeChild(t.childNodes[0]);
601
+ for (; e.childNodes.length > 0; )
602
+ t.appendChild(e.childNodes[0]);
603
+ }
604
+ _parseHtmlToFragment(e) {
605
+ const n = new DOMParser().parseFromString(e, "text/html"), a = document.createDocumentFragment();
606
+ for (; n.body.firstChild; )
607
+ a.appendChild(n.body.firstChild);
608
+ return a;
609
+ }
610
+ _validate() {
611
+ if (!this._temporaryDisableValidation) {
612
+ if (this._queuedActions.length > 0)
613
+ throw new Error("await page.waitForChanges() must be called before reading element information");
614
+ if (!this.handle)
615
+ throw new Error("trying to read from a disposed element");
616
+ }
617
+ }
618
+ async e2eDispose() {
619
+ this.handle && (await this.handle.dispose(), this.handle = null);
620
+ const e = this._page._e2eElements.indexOf(this);
621
+ e > -1 && this._page._e2eElements.splice(e, 1), this._page = null;
622
+ }
623
+ cloneNode(e) {
624
+ const t = super.cloneNode(e);
625
+ return Object.defineProperty(t, "tagName", {
626
+ value: this.tagName,
627
+ configurable: !0
628
+ }), Object.defineProperty(t, "nodeName", {
629
+ value: this.nodeName,
630
+ configurable: !0
631
+ }), t;
632
+ }
633
+ }
634
+ async function N(s, e, t) {
635
+ const { lightSelector: n, text: a, contains: i } = P(t);
636
+ if (typeof t == "string" && t.includes(">>>")) {
637
+ const l = await s.$(t);
638
+ if (!l)
639
+ return null;
640
+ const c = d.create(s, l);
641
+ return await c.e2eSync(), c;
642
+ }
643
+ let r;
644
+ if (typeof n == "string" ? r = await e.$(n) : r = await M(s, e, a, i), !r)
645
+ return null;
646
+ const o = d.create(s, r);
647
+ return await o.e2eSync(), o;
648
+ }
649
+ async function M(s, e, t, n) {
650
+ const a = await s.evaluateHandle(
651
+ (i, r, o) => {
652
+ let l = null;
653
+ function c(u) {
654
+ if (!u || l)
655
+ return;
656
+ if (u.nodeType === 3) {
657
+ if (typeof r == "string" && u.textContent?.trim() === r) {
658
+ l = u.parentElement;
659
+ return;
660
+ }
661
+ if (typeof o == "string" && u.textContent?.includes(o)) {
662
+ l = u.parentElement;
663
+ return;
664
+ }
665
+ } else {
666
+ if (u.nodeName === "SCRIPT" || u.nodeName === "STYLE")
667
+ return;
668
+ c(u.shadowRoot), u.childNodes?.forEach(c);
669
+ }
670
+ }
671
+ return c(i), l;
672
+ },
673
+ e,
674
+ t,
675
+ n
676
+ );
677
+ return a ? a.asElement() : null;
678
+ }
679
+ async function x(s, e, t) {
680
+ const n = [];
681
+ if (typeof t == "string" && t.includes(">>>")) {
682
+ const r = await s.$$(t, {
683
+ // Workaround for https://github.com/puppeteer/puppeteer/issues/11944#issuecomment-1952348209
684
+ isolate: !0
685
+ });
686
+ for (const o of r) {
687
+ const l = d.create(s, o);
688
+ await l.e2eSync(), n.push(l);
689
+ }
690
+ return n;
691
+ }
692
+ const { lightSelector: a } = P(t);
693
+ if (a === void 0)
694
+ return [];
695
+ const i = await e.$$(a, {
696
+ // Workaround for https://github.com/puppeteer/puppeteer/issues/11944#issuecomment-1952348209
697
+ isolate: !0
698
+ });
699
+ if (i.length === 0)
700
+ return [];
701
+ for (const r of i) {
702
+ const o = d.create(s, r);
703
+ await o.e2eSync(), n.push(o);
704
+ }
705
+ return n;
706
+ }
707
+ function P(s) {
708
+ const e = {
709
+ lightSelector: void 0,
710
+ text: void 0,
711
+ contains: void 0
712
+ };
713
+ if (typeof s == "string")
714
+ e.lightSelector = s.trim();
715
+ else if (typeof s.text == "string")
716
+ e.text = s.text.trim();
717
+ else if (typeof s.contains == "string")
718
+ e.contains = s.contains.trim();
719
+ else
720
+ throw new Error(`invalid find selector: ${JSON.stringify(s)}`);
721
+ return e;
722
+ }
723
+ async function fe(s) {
724
+ const e = await _.runner.createNewPage();
725
+ try {
726
+ return await q(e, s);
727
+ } catch (t) {
728
+ throw e.isClosed() || await e.close(), t;
729
+ }
730
+ }
731
+ async function q(s, e) {
732
+ const t = [], n = {
733
+ _e2eElements: [],
734
+ _originalClose: s.close,
735
+ _e2eEvents: /* @__PURE__ */ new Map(),
736
+ _e2eEventIds: 0,
737
+ _isWaitingForAllReady: !1,
738
+ _unhandledError: void 0,
739
+ async spyOnEvent(o, l) {
740
+ return await D.call(a, a, o, l);
741
+ },
742
+ async close(o) {
743
+ try {
744
+ if (Array.isArray(a._e2eElements)) {
745
+ const l = a._e2eElements.map(async (c) => {
746
+ typeof c.e2eDispose == "function" && await c.e2eDispose();
747
+ });
748
+ await Promise.all(l);
749
+ }
750
+ } catch {
751
+ }
752
+ await Promise.all(m), k(a);
753
+ try {
754
+ a.isClosed() || await a._originalClose?.(o);
755
+ } catch {
756
+ }
757
+ },
758
+ async find(o) {
759
+ const l = await r();
760
+ return await N(a, l, o);
761
+ },
762
+ async findAll(o) {
763
+ const l = await r();
764
+ return await x(a, l, o);
765
+ },
766
+ async waitForEvent(o) {
767
+ const l = await r();
768
+ return await T(a, o, l);
769
+ },
770
+ getDiagnostics: () => t,
771
+ async waitForChanges(o) {
772
+ await U(a, o);
773
+ },
774
+ async debugger() {
775
+ if (!h.isDevToolsEnabled) {
776
+ console.warn(
777
+ "Re-run the test with the --inspect flag or set `puppeteerTesting.launchOptions.devtools: true` in order to use E2EPage.debugger()"
778
+ );
779
+ return;
780
+ }
781
+ h.isHeadlessBrowser && console.warn("E2EPage.debugger() called while in headless mode. This may freeze the test."), await a.evaluate(
782
+ async () => await new Promise((o) => {
783
+ debugger;
784
+ o();
785
+ })
786
+ );
787
+ },
788
+ goTo: W,
789
+ setContent: y,
790
+ async waitForTimeout(o) {
791
+ await new Promise((l) => setTimeout(l, o));
792
+ }
793
+ }, a = Object.assign(s, n);
794
+ await S(a);
795
+ let i;
796
+ async function r() {
797
+ return i ??= a.evaluateHandle(() => document), (await i).asElement();
798
+ }
799
+ return a.on("console", (o) => {
800
+ o.type() === "error" && t.push({
801
+ type: "error",
802
+ message: o.text(),
803
+ location: o.location().url
804
+ }), J(o);
805
+ }), a.on("pageerror", (o) => {
806
+ if (t.push({
807
+ type: "pageerror",
808
+ message: o.message,
809
+ location: o.stack
810
+ }), a._isWaitingForAllReady) {
811
+ a._unhandledError = o;
812
+ return;
813
+ } else
814
+ throw o;
815
+ }), a.on("error", (o) => {
816
+ throw t.push({
817
+ type: "error",
818
+ message: o.message,
819
+ location: o.stack
820
+ }), o;
821
+ }), a.on("requestfailed", (o) => {
822
+ const l = o.url(), c = o.failure()?.errorText;
823
+ t.push({
824
+ type: "requestfailed",
825
+ message: c,
826
+ location: l
827
+ }), c !== "net::ERR_ABORTED" && console.error("Request failed", { location: l, message: c });
828
+ }), typeof e?.html == "string" && await y.call(a, e.html), a;
829
+ }
830
+ function k(s) {
831
+ function e() {
832
+ throw new Error("The page was already closed");
833
+ }
834
+ s.goto = e, s.find = e, s.debugger = e, s.findAll = e, s.setContent = e, s.spyOnEvent = e, s.waitForChanges = e, s.waitForEvent = e;
835
+ }
836
+ async function W(s, e = {}) {
837
+ if (this.isClosed())
838
+ throw new Error("e2eGoTo unavailable: page already closed");
839
+ if (typeof s != "string")
840
+ throw new Error("invalid gotoTest() url");
841
+ if (!s.startsWith("/"))
842
+ throw new Error("gotoTest() url must start with /");
843
+ const t = h.devServerUrl;
844
+ if (typeof t != "string")
845
+ throw new Error("invalid gotoTest() browser url");
846
+ const n = t + s.substring(1), a = await this.goto(n, e);
847
+ if (a?.ok() !== !0)
848
+ throw new Error(`Testing unable to load ${s}, HTTP status: ${String(a?.status())}`);
849
+ return await v(this, e), a;
850
+ }
851
+ async function y(s, e = {}) {
852
+ if (this.isClosed())
853
+ throw new Error("Can't call e2eSetContent on a closed age");
854
+ if (typeof s != "string")
855
+ throw new Error(`Expected first argument in e2eSetContent() to be an HTML string. Received: ${typeof s}`);
856
+ const t = h.devServerHtml;
857
+ if (typeof t != "string")
858
+ throw new Error("Failed to retrieve .devServerHtml env variable");
859
+ const n = t.replace("<body>", `<body>
860
+ ${s}`), a = h.devServerUrl;
861
+ if (a === void 0)
862
+ throw new Error("Failed to retrieve .devServerUrl env variable");
863
+ this.setContent = () => {
864
+ throw new Error(
865
+ ".setContent() was already set for this page. Calling it again would create a new page -- you should call newE2EPag() instead."
866
+ );
867
+ }, await this.setRequestInterception(!0);
868
+ let i = !1;
869
+ this.on("request", (o) => {
870
+ i && o.isNavigationRequest() && (console.error(
871
+ `Page was navigated to ${o.url()}. This may be a result of form submission or link click.`
872
+ ), this.close()), a === o.url() ? (i = !0, o.respond({
873
+ status: 200,
874
+ contentType: "text/html",
875
+ body: n
876
+ })) : o.continue();
877
+ });
878
+ const r = await this.goto(a, e);
879
+ if (r?.ok() !== !0)
880
+ throw new Error(`Failed to load the test page. HTTP code: ${r?.status()} ${r?.statusText()}`);
881
+ await v(this, e);
882
+ }
883
+ async function v(s, e) {
884
+ const t = e?.timeout ?? _.runner.config.testTimeout * I;
885
+ s._isWaitingForAllReady = !0;
886
+ try {
887
+ await new Promise((n, a) => {
888
+ s.evaluate(async () => await window.puppeteerAwaitAllReady()).then(n).catch(a), setTimeout(
889
+ a,
890
+ t,
891
+ new Error("App did not load in allowed time. Please ensure the content loads a web component application.")
892
+ );
893
+ });
894
+ } catch (n) {
895
+ if (s._unhandledError) {
896
+ const a = s._unhandledError;
897
+ throw s._unhandledError = void 0, a;
898
+ }
899
+ throw n;
900
+ } finally {
901
+ s._isWaitingForAllReady = !1;
902
+ }
903
+ if (s._unhandledError) {
904
+ const n = s._unhandledError;
905
+ throw s._unhandledError = void 0, n;
906
+ }
907
+ }
908
+ const I = 0.9;
909
+ async function U(s, e = h.puppeteerWaitForChangesDelay ?? 0) {
910
+ try {
911
+ if (s.isClosed() || (await Promise.all(s._e2eElements.map(async (t) => await t.e2eRunActions())), s.isClosed()) || (await v(s), s.isClosed()))
912
+ return;
913
+ e > 0 && await s.waitForTimeout(e), await Promise.all(s._e2eElements.map(async (t) => await t.e2eSync()));
914
+ } catch (t) {
915
+ if (!String(t).includes("Target closed"))
916
+ throw t;
917
+ }
918
+ }
919
+ const m = [];
920
+ async function J(s) {
921
+ const e = s.type();
922
+ if (e === "debug")
923
+ return;
924
+ let t = "";
925
+ if (s.args().length === 0)
926
+ t = `${s.text()}${A(s)}`;
927
+ else {
928
+ const n = B(s);
929
+ m.push(n), await Promise.all(m.slice(0, -1)), t = await n, m.splice(m.indexOf(n), 1);
930
+ }
931
+ t.startsWith("Using Calcite Components") || (typeof console[e] == "function" ? console[e](t) : console.log(e, t));
932
+ }
933
+ async function B(s) {
934
+ return `${(await Promise.all(s.args().map(G))).join(" ")} ${A(s)}`;
935
+ }
936
+ const A = (s) => [`
3
937
  Stack:
4
- `,t.stackTrace().map(ue).join(`
5
- `),`
6
- `].join("");async function le(t){let n=t.toString();if(n.startsWith(F))return n.slice(F.length);try{return await t.evaluate(e=>{if(typeof e=="object"&&e!==null){if(e instanceof Error)return String(e);if("tagName"in e&&"attributes"in e)return`<${e.tagName.toLowerCase()} ${Array.from(e.attributes,i=>`${i.name}="${i.value}"`).join(" ")}>`;try{let i=e?.constructor?.name;if(i)return`[${i} ${JSON.stringify(e)}]`}catch{}}return String(e)})}catch(e){return console.error(e),t.toString()}finally{t.dispose()}}var F="JSHandle:";function ue(t){let n="";if(t?.url){let e=t.url.indexOf(A);n=` ${decodeURIComponent(e===-1?t.url:Z(t.url.slice(e+A.length)))}`,t.lineNumber&&(n+=`:${t.lineNumber}`),t.columnNumber&&(n+=`:${t.columnNumber}`)}return n}var A=X?"/@fs":"/@fs/";import{expect as de,afterEach as ce}from"vitest";function m(t,n){if(typeof t!="object"||t===null)throw new Error(`${n} expect called with non-element value`);if("then"in t&&typeof t.then=="function")throw new Error("element must be a resolved value, not a promise, before it can be tested");if(!("getAttribute"in t)||typeof t.getAttribute!="function")throw new Error(`expect ${n} value is not an element`)}var k=(t,n,e)=>{m(t,"toEqualAttribute");let i=t.getAttribute(n);e!=null&&(e=String(e)),i!=null&&(i=String(i));let r=e===i;return{message:()=>`expected attribute ${n} to ${r?"not ":""}equal "${e}", but received "${i}"`,pass:r}},D=(t,n)=>{m(t,"toEqualAttributes");let e=Object.keys(n),i=e.every(r=>{let a=n[r];return a!=null&&(a=String(a)),t.getAttribute(r)===a});return{message:()=>`expected attributes to ${i?"not ":""}equal ${e.map(r=>`[${r}="${String(n[r])}"]`).join(", ")}`,pass:i}},M=(t,n)=>{m(t,"toHaveAttribute");let e=t.hasAttribute(n);return{message:()=>`expected to ${e?"not ":""}have the attribute "${n}"`,pass:e}};var L=(t,n)=>{m(t,"toHaveClass");let e=t.classList.contains(n);return{message:()=>`expected to ${e?"not ":""}have css class "${n}"`,pass:e}},H=(t,n)=>{m(t,"toHaveClasses");let e=n.every(i=>t.classList.contains(i));return{message:()=>`expected to ${e?"not ":""}have css classes "${n.join(" ")}", but className is "${t.className}"`,pass:e}},V=(t,n)=>{m(t,"toMatchClasses");let{pass:e}=H(t,n);return e&&(e=n.length===t.classList.length),{message:()=>`expected to ${e?"not ":""}match css classes "${n.join(" ")}", but className is "${t.className}"`,pass:e}};import{expect as g}from"vitest";var z=t=>{h(t);let n=t.events.length>0;return{message:()=>`expected to have ${n?"not ":""}called "${t.eventName}" event`,pass:n}};function h(t){if(typeof t!="object"||t===null)throw new Error(`expected to receive an event spy. got ${typeof t}`);if("then"in t&&typeof t.then=="function")throw new Error("event spy must be a resolved value, not a promise, before it can be tested");if(!("eventName"in t))throw new Error("toHaveReceivedEvent did not receive an event spy")}var O=(t,n)=>{h(t);let e=t.length===n;return{message:()=>`expected event "${t.eventName}" to have been called ${n} times, but was called ${t.events.length} time${t.events.length===1?"":"s"}`,pass:e}},W=function(n,e){if(h(n),n.lastEvent===void 0)throw new Error(`event "${n.eventName}" was not received`);let i=this.equals(n.lastEvent.detail,e);return g(n.lastEvent.detail).toEqual(e),{message:()=>`expected event "${n.eventName}" detail to ${i?"not ":""}equal`,pass:i}},q=function(n,e){if(h(n),n.firstEvent===void 0)throw new Error(`event "${n.eventName}" was not received`);let i=this.equals(n.firstEvent.detail,e);return g(n.firstEvent.detail).toEqual(e),{message:()=>`expected event "${n.eventName}" detail to ${i?"not ":""}equal`,pass:i}},j=function(n,e){if(h(n),n.firstEvent===void 0)throw new Error(`event "${n.eventName}" was not received`);let i=this.equals(n.lastEvent?.detail,e);return g(n.lastEvent?.detail).toEqual(e),{message:()=>`expected event "${n.eventName}" detail to ${i?"not ":""}equal`,pass:i}},I=function(n,e,i){if(h(n),n.firstEvent===void 0)throw new Error(`event "${n.eventName}" was not received`);let r=n.events[e];if(r===void 0)throw new Error(`event at index ${e} was not received`);let a=this.equals(r.detail,i);return g(r.detail).toEqual(i),{message:()=>`expected event "${n.eventName}" detail to ${a?"not ":""}equal`,pass:a}};var J=(t,n)=>{if(t==null)throw new Error("toEqualText expect called with nullish value");if(typeof t=="object"&&"then"in t&&typeof t.then=="function")throw new Error("element must be a resolved value, not a promise, before it can be tested");let e;typeof t=="object"&&"textContent"in t&&typeof t.textContent=="string"?e=(t.textContent??"").replace(C," ").trim():e=String(t).replace(C," ").trim(),n=String(n).replace(C," ").trim();let i=e===n;return{message:()=>`expected textContent "${n}" to ${i?"not ":""}equal "${e}"`,pass:i}},C=/\s+/gu;var B={toEqualAttribute:k,toEqualAttributes:D,toEqualText:J,toHaveAttribute:M,toHaveClass:L,toHaveClasses:H,toMatchClasses:V,toHaveReceivedEvent:z,toHaveReceivedEventTimes:O,toHaveReceivedEventDetail:W,toHaveFirstReceivedEventDetail:q,toHaveLastReceivedEventDetail:j,toHaveNthReceivedEventDetail:I};function me(){de.extend(B),ce(()=>{document.body.childNodes.forEach(U)})}function U(t){t.childNodes.forEach(U),t.remove()}export{ee as newE2EPage,me as setupPuppeteerTest};
938
+ `, s.stackTrace().map(Y).join(`
939
+ `), `
940
+ `].join("");
941
+ async function G(s) {
942
+ const e = s.toString();
943
+ if (e.startsWith(b))
944
+ return e.slice(b.length);
945
+ try {
946
+ return await s.evaluate((t) => {
947
+ if (typeof t == "object" && t !== null) {
948
+ if (t instanceof Error)
949
+ return String(t);
950
+ if ("tagName" in t && "attributes" in t)
951
+ return `<${t.tagName.toLowerCase()} ${Array.from(t.attributes, (n) => `${n.name}="${n.value}"`).join(" ")}>`;
952
+ try {
953
+ const n = t?.constructor?.name;
954
+ if (n)
955
+ return `[${n} ${JSON.stringify(t)}]`;
956
+ } catch {
957
+ }
958
+ }
959
+ return String(t);
960
+ });
961
+ } catch (t) {
962
+ return console.error(t), s.toString();
963
+ } finally {
964
+ s.dispose();
965
+ }
966
+ }
967
+ const b = "JSHandle:";
968
+ function Y(s) {
969
+ let e = "";
970
+ if (s?.url) {
971
+ const t = s.url.indexOf(E);
972
+ e = ` ${decodeURIComponent(
973
+ t === -1 ? s.url : V(s.url.slice(t + E.length))
974
+ )}`, s.lineNumber && (e += `:${s.lineNumber}`), s.columnNumber && (e += `:${s.columnNumber}`);
975
+ }
976
+ return e;
977
+ }
978
+ const E = L ? "/@fs" : "/@fs/";
979
+ function f(s, e) {
980
+ if (typeof s != "object" || s === null)
981
+ throw new Error(`${e} expect called with non-element value`);
982
+ if ("then" in s && typeof s.then == "function")
983
+ throw new Error("element must be a resolved value, not a promise, before it can be tested");
984
+ if (!("getAttribute" in s) || typeof s.getAttribute != "function")
985
+ throw new Error(`expect ${e} value is not an element`);
986
+ }
987
+ const K = (s, e, t) => {
988
+ f(s, "toEqualAttribute");
989
+ let n = s.getAttribute(e);
990
+ t != null && (t = String(t)), n != null && (n = String(n));
991
+ const a = t === n;
992
+ return {
993
+ message: () => `expected attribute ${e} to ${a ? "not " : ""}equal "${t}", but received "${n}"`,
994
+ pass: a
995
+ };
996
+ }, Q = (s, e) => {
997
+ f(s, "toEqualAttributes");
998
+ const t = Object.keys(e), n = t.every((a) => {
999
+ let i = e[a];
1000
+ return i != null && (i = String(i)), s.getAttribute(a) === i;
1001
+ });
1002
+ return {
1003
+ message: () => `expected attributes to ${n ? "not " : ""}equal ${t.map((a) => `[${a}="${String(e[a])}"]`).join(", ")}`,
1004
+ pass: n
1005
+ };
1006
+ }, X = (s, e) => {
1007
+ f(s, "toHaveAttribute");
1008
+ const t = s.hasAttribute(e);
1009
+ return {
1010
+ message: () => `expected to ${t ? "not " : ""}have the attribute "${e}"`,
1011
+ pass: t
1012
+ };
1013
+ }, Z = (s, e) => {
1014
+ f(s, "toHaveClass");
1015
+ const t = s.classList.contains(e);
1016
+ return {
1017
+ message: () => `expected to ${t ? "not " : ""}have css class "${e}"`,
1018
+ pass: t
1019
+ };
1020
+ }, H = (s, e) => {
1021
+ f(s, "toHaveClasses");
1022
+ const t = e.every((n) => s.classList.contains(n));
1023
+ return {
1024
+ message: () => `expected to ${t ? "not " : ""}have css classes "${e.join(" ")}", but className is "${s.className}"`,
1025
+ pass: t
1026
+ };
1027
+ }, ee = (s, e) => {
1028
+ f(s, "toMatchClasses");
1029
+ let { pass: t } = H(s, e);
1030
+ return t && (t = e.length === s.classList.length), {
1031
+ message: () => `expected to ${t ? "not " : ""}match css classes "${e.join(" ")}", but className is "${s.className}"`,
1032
+ pass: t
1033
+ };
1034
+ }, te = (s) => {
1035
+ w(s);
1036
+ const e = s.events.length > 0;
1037
+ return {
1038
+ message: () => `expected to have ${e ? "not " : ""}called "${s.eventName}" event`,
1039
+ pass: e
1040
+ };
1041
+ };
1042
+ function w(s) {
1043
+ if (typeof s != "object" || s === null)
1044
+ throw new Error(`expected to receive an event spy. got ${typeof s}`);
1045
+ if ("then" in s && typeof s.then == "function")
1046
+ throw new Error("event spy must be a resolved value, not a promise, before it can be tested");
1047
+ if (!("eventName" in s))
1048
+ throw new Error("toHaveReceivedEvent did not receive an event spy");
1049
+ }
1050
+ const se = (s, e) => {
1051
+ w(s);
1052
+ const t = s.length === e;
1053
+ return {
1054
+ message: () => `expected event "${s.eventName}" to have been called ${e} times, but was called ${s.events.length} time${s.events.length === 1 ? "" : "s"}`,
1055
+ pass: t
1056
+ };
1057
+ }, ne = function(e, t) {
1058
+ if (w(e), e.lastEvent === void 0)
1059
+ throw new Error(`event "${e.eventName}" was not received`);
1060
+ const n = this.equals(e.lastEvent.detail, t);
1061
+ return p(e.lastEvent.detail).toEqual(t), {
1062
+ message: () => `expected event "${e.eventName}" detail to ${n ? "not " : ""}equal`,
1063
+ pass: n
1064
+ };
1065
+ }, ie = function(e, t) {
1066
+ if (w(e), e.firstEvent === void 0)
1067
+ throw new Error(`event "${e.eventName}" was not received`);
1068
+ const n = this.equals(e.firstEvent.detail, t);
1069
+ return p(e.firstEvent.detail).toEqual(t), {
1070
+ message: () => `expected event "${e.eventName}" detail to ${n ? "not " : ""}equal`,
1071
+ pass: n
1072
+ };
1073
+ }, ae = function(e, t) {
1074
+ if (w(e), e.firstEvent === void 0)
1075
+ throw new Error(`event "${e.eventName}" was not received`);
1076
+ const n = this.equals(e.lastEvent?.detail, t);
1077
+ return p(e.lastEvent?.detail).toEqual(t), {
1078
+ message: () => `expected event "${e.eventName}" detail to ${n ? "not " : ""}equal`,
1079
+ pass: n
1080
+ };
1081
+ }, re = function(e, t, n) {
1082
+ if (w(e), e.firstEvent === void 0)
1083
+ throw new Error(`event "${e.eventName}" was not received`);
1084
+ const a = e.events[t];
1085
+ if (a === void 0)
1086
+ throw new Error(`event at index ${t} was not received`);
1087
+ const i = this.equals(a.detail, n);
1088
+ return p(a.detail).toEqual(n), {
1089
+ message: () => `expected event "${e.eventName}" detail to ${i ? "not " : ""}equal`,
1090
+ pass: i
1091
+ };
1092
+ }, oe = (s, e) => {
1093
+ if (s == null)
1094
+ throw new Error("toEqualText expect called with nullish value");
1095
+ if (typeof s == "object" && "then" in s && typeof s.then == "function")
1096
+ throw new Error("element must be a resolved value, not a promise, before it can be tested");
1097
+ let t;
1098
+ typeof s == "object" && "textContent" in s && typeof s.textContent == "string" ? t = (s.textContent ?? "").replace(g, " ").trim() : t = String(s).replace(g, " ").trim(), e = String(e).replace(g, " ").trim();
1099
+ const n = t === e;
1100
+ return {
1101
+ message: () => `expected textContent "${e}" to ${n ? "not " : ""}equal "${t}"`,
1102
+ pass: n
1103
+ };
1104
+ }, g = /\s+/gu, le = {
1105
+ toEqualAttribute: K,
1106
+ toEqualAttributes: Q,
1107
+ toEqualText: oe,
1108
+ toHaveAttribute: X,
1109
+ toHaveClass: Z,
1110
+ toHaveClasses: H,
1111
+ toMatchClasses: ee,
1112
+ toHaveReceivedEvent: te,
1113
+ toHaveReceivedEventTimes: se,
1114
+ toHaveReceivedEventDetail: ne,
1115
+ toHaveFirstReceivedEventDetail: ie,
1116
+ toHaveLastReceivedEventDetail: ae,
1117
+ toHaveNthReceivedEventDetail: re
1118
+ };
1119
+ function we() {
1120
+ p.extend(le), R(() => {
1121
+ document.body.childNodes.forEach(F);
1122
+ });
1123
+ }
1124
+ function F(s) {
1125
+ s.childNodes.forEach(F), s.remove();
1126
+ }
1127
+ export {
1128
+ fe as newE2EPage,
1129
+ we as setupPuppeteerTest
1130
+ };