self.BindingsTestRunner=self.BindingsTestRunner||{},BindingsTestRunner.cleanupURL=function(e){return e.startsWith("debugger://")?e.replace(/VM\d+/g,"VM[XXX]"):e},BindingsTestRunner.dumpWorkspace=function(e){let n=self.Workspace.workspace.uiSourceCodes().slice().map((e=>e.url()));n=n.map(BindingsTestRunner.cleanupURL),n.sort(String.caseInsensetiveComparator);const t=new Array(n.length).fill(!1);let o=[];if(e){const r=Diff.Diff.lineDiff(e,n),s=r.filter((e=>e[0]===Diff.Diff.Operation.Delete)).map((e=>e[1]));o=[].concat.apply([],s);let i=0;for(const e of r)if(e[0]!==Diff.Diff.Operation.Delete)if(e[0]!==Diff.Diff.Operation.Equal)for(const n of e[1])t[i++]=!0;else i+=e[1].length}TestRunner.addResult(`Removed: ${o.length} uiSourceCodes`);for(const r of o)TestRunner.addResult("[-] "+r);TestRunner.addResult(`Workspace: ${n.length} uiSourceCodes.`);for(let r=0;r<n.length;++r){const e=n[r],o=t[r]?"[+] ":"    ";TestRunner.addResult(o+e)}return n},BindingsTestRunner.attachFrame=function(e,n,t){let o=`(${function(e,n){const t=document.createElement("iframe");return t.src=n,t.id=e,document.body.appendChild(t),new Promise((e=>{t.onload=e}))}.toString()})('${e}', '${n}')`;return t&&(o+="//# sourceURL="+t),TestRunner.evaluateInPageAsync(o)},BindingsTestRunner.detachFrame=function(e,n){let t=`(${function(e){document.getElementById(e).remove()}.toString()})('${e}')`;return n&&(t+="//# sourceURL="+n),TestRunner.evaluateInPageAnonymously(t)},BindingsTestRunner.navigateFrame=function(e,n,t){let o=`(${function(e,n){const t=document.getElementById(e);return t.src=n,new Promise((e=>{t.onload=e}))}.toString()})('${e}', '${n}')`;return t&&(o+="//# sourceURL="+t),TestRunner.evaluateInPageAsync(o)},BindingsTestRunner.attachShadowDOM=function(e,n,t){let o=`(${function(e,n){const t=document.createElement("div");t.setAttribute("id",e);const o=t.attachShadow({mode:"open"}),r=document.querySelector(n).content.cloneNode(!0);o.appendChild(r),document.body.appendChild(t)}.toString()})('${e}', '${n}')`;return t&&(o+="//# sourceURL="+t),TestRunner.evaluateInPageAnonymously(o)},BindingsTestRunner.detachShadowDOM=function(e,n){let t=`(${function(e){document.querySelector("#"+e).remove()}.toString()})('${e}')`;return n&&(t+="//# sourceURL="+n),TestRunner.evaluateInPageAnonymously(t)},BindingsTestRunner.waitForStyleSheetRemoved=function(e){let n;const t=new Promise((e=>{n=e}));return TestRunner.cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved,(function t(o){if(!o.data.resourceURL().endsWith(e))return;TestRunner.cssModel.removeEventListener(SDK.CSSModel.Events.StyleSheetRemoved,t),n()})),t},TestRunner.addSniffer(Bindings.CompilerScriptMapping.prototype,"_sourceMapAttachedForTest",onSourceMap,!0),TestRunner.addSniffer(Bindings.SASSSourceMapping.prototype,"_sourceMapAttachedForTest",onSourceMap,!0);const sourceMapCallbacks=new Map;function onSourceMap(e){for(const n of sourceMapCallbacks.keys())if(e.url().endsWith(n)){sourceMapCallbacks.get(n).call(null),sourceMapCallbacks.delete(n)}}BindingsTestRunner.waitForSourceMap=function(e){let n;const t=new Promise((e=>{n=e}));return sourceMapCallbacks.set(e,n),t};const locationPool=new Bindings.LiveLocationPool,nameSymbol=Symbol("LiveLocationNameForTest"),createdSymbol=Symbol("LiveLocationCreated");async function updateDelegate(e,n){n[nameSymbol]=e;const t=n[createdSymbol]?"[ UPDATE ]":"[ CREATE ]";n[createdSymbol]=!0,await BindingsTestRunner.dumpLocation(n,t)}BindingsTestRunner.createDebuggerLiveLocation=function(e,n,t,o){const r=TestRunner.debuggerModel.scripts().find((e=>e.sourceURL.endsWith(n))),s=TestRunner.debuggerModel.createRawLocation(r,t||0,o||0);return self.Bindings.debuggerWorkspaceBinding.createLiveLocation(s,updateDelegate.bind(null,e),locationPool)},BindingsTestRunner.createCSSLiveLocation=function(e,n,t,o){const r=TestRunner.cssModel.styleSheetHeaders().find((e=>e.resourceURL().endsWith(n))),s=new SDK.CSSLocation(r,t||0,o||0);return self.Bindings.cssWorkspaceBinding.createLiveLocation(s,updateDelegate.bind(null,e),locationPool)},BindingsTestRunner.dumpLocation=async function(e,n){const t=`${n=n||"[  GET   ]"}  LiveLocation-${e[nameSymbol]}: `,o=await e.uiLocation();o?TestRunner.addResult(t+BindingsTestRunner.cleanupURL(o.uiSourceCode.url())+":"+o.lineNumber+":"+o.columnNumber):TestRunner.addResult(t+"null")};