self.ElementsTestRunner=self.ElementsTestRunner||{},ElementsTestRunner.events=[],ElementsTestRunner.containerId,ElementsTestRunner.setUpTestSuite=function(e){function n(e){ElementsTestRunner.containerId=e.id,TestRunner.DOMAgent.getOuterHTML(ElementsTestRunner.containerId).then(t)}function t(n){ElementsTestRunner.containerText=n;for(const e in SDK.DOMModel.Events){const n=SDK.DOMModel.Events[e];n!==SDK.DOMModel.Events.MarkersChanged&&n!==SDK.DOMModel.Events.DOMMutated&&TestRunner.domModel.addEventListener(n,ElementsTestRunner.recordEvent.bind(ElementsTestRunner,n))}e()}ElementsTestRunner.expandElementsTree((function(){ElementsTestRunner.selectNodeWithId("container",n)}))},ElementsTestRunner.recordEvent=function(e,n){if(!n.data)return;const t=n.data.node||n.data;for(let s=n.data.parent||t;s;s=s.parentNode)if("output"===s.getAttribute("id"))return;ElementsTestRunner.events.push("Event "+e.toString()+": "+t.nodeName())},ElementsTestRunner.patchOuterHTML=function(e,n,t){TestRunner.addResult("Replacing '"+e+"' with '"+n+"'\n"),ElementsTestRunner.setOuterHTML(ElementsTestRunner.containerText.replace(e,n),t)},ElementsTestRunner.patchOuterHTMLUseUndo=function(e,n,t){TestRunner.addResult("Replacing '"+e+"' with '"+n+"'\n"),ElementsTestRunner.setOuterHTMLUseUndo(ElementsTestRunner.containerText.replace(e,n),t)},ElementsTestRunner.setOuterHTML=function(e,n){ElementsTestRunner.innerSetOuterHTML(e,!1,(function(){TestRunner.addResult("\nBringing things back\n"),ElementsTestRunner.innerSetOuterHTML(ElementsTestRunner.containerText,!0,n)}))},ElementsTestRunner.setOuterHTMLUseUndo=function(e,n){ElementsTestRunner.innerSetOuterHTML(e,!1,(async function(){TestRunner.addResult("\nBringing things back\n"),await self.SDK.domModelUndoStack.undo(),ElementsTestRunner._dumpOuterHTML(!0,n)}))},ElementsTestRunner.innerSetOuterHTML=async function(e,n,t){await TestRunner.DOMAgent.setOuterHTML(ElementsTestRunner.containerId,e),TestRunner.domModel.markUndoableState(),ElementsTestRunner._dumpOuterHTML(n,t)},ElementsTestRunner._dumpOuterHTML=async function(e,n){const t=await TestRunner.RuntimeAgent.evaluate('document.getElementById("identity").wrapperIdentity');TestRunner.addResult("Wrapper identity: "+t.value),ElementsTestRunner.events.sort();for(let r=0;r<ElementsTestRunner.events.length;++r)TestRunner.addResult(ElementsTestRunner.events[r]);ElementsTestRunner.events=[];const s=await TestRunner.DOMAgent.getOuterHTML(ElementsTestRunner.containerId);TestRunner.addResult("==========8<=========="),TestRunner.addResult(s),TestRunner.addResult("==========>8=========="),e&&TestRunner.addResult("\n\n\n"),n()};