@react-native/debugger-frontend
Version:
Debugger frontend for React Native based on Chrome DevTools
374 lines • 260 kB
JavaScript
var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};function t(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}function r(e,t,r,i){return new(r||(r=Promise))((function(n,s){function a(e){try{c(i.next(e))}catch(e){s(e)}}function o(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,o)}c((i=i.apply(e,t||[])).next())}))}function i(e,t){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,s=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return a}function a(e,t,r){if(r||2===arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function o(e){return this instanceof o?(this.v=e,this):new o(e)}function c(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),s=[];return i=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",(function(e){return function(t){return Promise.resolve(t).then(e,d)}})),i[Symbol.asyncIterator]=function(){return this},i;function a(e,t){n[e]&&(i[e]=function(t){return new Promise((function(r,i){s.push([e,t,r,i])>1||c(e,t)}))},t&&(i[e]=t(i[e])))}function c(e,t){try{(r=n[e](t)).value instanceof o?Promise.resolve(r.value.v).then(l,d):u(s[0][2],r)}catch(e){u(s[0][3],e)}var r}function l(e){c("next",e)}function d(e){c("throw",e)}function u(e,t){e(t),s.shift(),s.length&&c(s[0][0],s[0][1])}}function l(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=n(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)})(i,n,(t=e[r](t)).done,t.value)}))}}}function d(e){return"function"==typeof e}function u(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var h=u((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function p(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var f=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,i,o;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=n(c),u=l.next();!u.done;u=l.next()){u.value.remove(this)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else c.remove(this);var p=this.initialTeardown;if(d(p))try{p()}catch(e){o=e instanceof h?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var m=n(f),y=m.next();!y.done;y=m.next()){var w=y.value;try{g(w)}catch(e){o=null!=o?o:[],e instanceof h?o=a(a([],s(o)),s(e.errors)):o.push(e)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}}if(o)throw new h(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)g(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&p(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&p(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),m=f.EMPTY;function y(e){return e instanceof f||e&&"closed"in e&&d(e.remove)&&d(e.add)&&d(e.unsubscribe)}function g(e){d(e)?e():e.unsubscribe()}var w=null,v=null,b=void 0,k=!1,S=!1,C={setTimeout:function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var n=C.delegate;return(null==n?void 0:n.setTimeout)?n.setTimeout.apply(n,a([e,t],s(r))):setTimeout.apply(void 0,a([e,t],s(r)))},clearTimeout:function(e){var t=C.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function E(e){C.setTimeout((function(){if(!w)throw e;w(e)}))}function T(){}var I=x("C",void 0,void 0);function x(e,t,r){return{kind:e,value:t,error:r}}var F=null;function P(e){if(k){var t=!F;if(t&&(F={errorThrown:!1,error:null}),e(),t){var r=F,i=r.errorThrown,n=r.error;if(F=null,i)throw n}}else e()}var R=function(e){function r(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,y(t)&&t.add(r)):r.destination=N,r}return t(r,e),r.create=function(e,t,r){return new O(e,t,r)},r.prototype.next=function(e){this.isStopped?A(function(e){return x("N",e,void 0)}(e),this):this._next(e)},r.prototype.error=function(e){this.isStopped?A(x("E",void 0,e),this):(this.isStopped=!0,this._error(e))},r.prototype.complete=function(){this.isStopped?A(I,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(e){this.destination.next(e)},r.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(f),_=Function.prototype.bind;function D(e,t){return _.call(e,t)}var M=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){q(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){q(e)}else q(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){q(e)}},e}(),O=function(e){function r(t,r,i){var n,s,a=e.call(this)||this;d(t)||!t?n={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=i?i:void 0}:a&&S?((s=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},n={next:t.next&&D(t.next,s),error:t.error&&D(t.error,s),complete:t.complete&&D(t.complete,s)}):n=t;return a.destination=new M(n),a}return t(r,e),r}(R);function q(e){var t;k?(t=e,k&&F&&(F.errorThrown=!0,F.error=t)):E(e)}function A(e,t){var r=v;r&&C.setTimeout((function(){return r(e,t)}))}var N={closed:!0,next:T,error:function(e){throw e},complete:T},j="function"==typeof Symbol&&Symbol.observable||"@@observable";function L(e){return e}function B(e){return 0===e.length?L:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var $=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var i,n=this,s=(i=e)&&i instanceof R||function(e){return e&&d(e.next)&&d(e.error)&&d(e.complete)}(i)&&y(i)?e:new O(e,t,r);return P((function(){var e=n,t=e.operator,r=e.source;s.add(t?t.call(s,r):r?n._subscribe(s):n._trySubscribe(s))})),s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=H(t))((function(t,i){var n=new O({next:function(t){try{e(t)}catch(e){i(e),n.unsubscribe()}},error:i,complete:t});r.subscribe(n)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[j]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=H(e))((function(e,r){var i;t.subscribe((function(e){return i=e}),(function(e){return r(e)}),(function(){return e(i)}))}))},e.create=function(t){return new e(t)},e}();function H(e){var t;return null!==(t=null!=e?e:b)&&void 0!==t?t:Promise}function K(e){return function(t){if(function(e){return d(null==e?void 0:e.lift)}(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function V(e,t,r,i,n){return new W(e,t,r,i,n)}var W=function(e){function r(t,r,i,n,s,a){var o=e.call(this,t)||this;return o.onFinalize=s,o.shouldUnsubscribe=a,o._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,o._error=n?function(e){try{n(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,o._complete=i?function(){try{i()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,o}return t(r,e),r.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),!r&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},r}(R),U=u((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),z=function(e){function r(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t(r,e),r.prototype.lift=function(e){var t=new G(this,this);return t.operator=e,t},r.prototype._throwIfClosed=function(){if(this.closed)throw new U},r.prototype.next=function(e){var t=this;P((function(){var r,i;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var s=n(t.currentObservers),a=s.next();!a.done;a=s.next()){a.value.next(e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}}))},r.prototype.error=function(e){var t=this;P((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},r.prototype.complete=function(){var e=this;P((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},r.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(r.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),r.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},r.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},r.prototype._innerSubscribe=function(e){var t=this,r=this,i=r.hasError,n=r.isStopped,s=r.observers;return i||n?m:(this.currentObservers=null,s.push(e),new f((function(){t.currentObservers=null,p(s,e)})))},r.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,i=t.thrownError,n=t.isStopped;r?e.error(i):n&&e.complete()},r.prototype.asObservable=function(){var e=new $;return e.source=this,e},r.create=function(e,t){return new G(e,t)},r}($),G=function(e){function r(t,r){var i=e.call(this)||this;return i.destination=t,i.source=r,i}return t(r,e),r.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},r.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},r.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},r.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:m},r}(z),Q={now:function(){return(Q.delegate||Date).now()},delegate:void 0},J=function(e){function r(t,r,i){void 0===t&&(t=1/0),void 0===r&&(r=1/0),void 0===i&&(i=Q);var n=e.call(this)||this;return n._bufferSize=t,n._windowTime=r,n._timestampProvider=i,n._buffer=[],n._infiniteTimeWindow=!0,n._infiniteTimeWindow=r===1/0,n._bufferSize=Math.max(1,t),n._windowTime=Math.max(1,r),n}return t(r,e),r.prototype.next=function(t){var r=this,i=r.isStopped,n=r._buffer,s=r._infiniteTimeWindow,a=r._timestampProvider,o=r._windowTime;i||(n.push(t),!s&&n.push(a.now()+o)),this._trimBuffer(),e.prototype.next.call(this,t)},r.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),r=this._infiniteTimeWindow,i=this._buffer.slice(),n=0;n<i.length&&!e.closed;n+=r?1:2)e.next(i[n]);return this._checkFinalizedStatuses(e),t},r.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,r=e._timestampProvider,i=e._buffer,n=e._infiniteTimeWindow,s=(n?1:2)*t;if(t<1/0&&s<i.length&&i.splice(0,i.length-s),!n){for(var a=r.now(),o=0,c=1;c<i.length&&i[c]<=a;c+=2)o=c;o&&i.splice(0,o+1)}},r}(z),X=function(e){function r(t,r){return e.call(this)||this}return t(r,e),r.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},r}(f),Y={setInterval:function(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var n=Y.delegate;return(null==n?void 0:n.setInterval)?n.setInterval.apply(n,a([e,t],s(r))):setInterval.apply(void 0,a([e,t],s(r)))},clearInterval:function(e){var t=Y.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},Z=function(e){function r(t,r){var i=e.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.pending=!1,i}return t(r,e),r.prototype.schedule=function(e,t){var r;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var i=this.id,n=this.scheduler;return null!=i&&(this.id=this.recycleAsyncId(n,i,t)),this.pending=!0,this.delay=t,this.id=null!==(r=this.id)&&void 0!==r?r:this.requestAsyncId(n,this.id,t),this},r.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),Y.setInterval(e.flush.bind(e,this),r)},r.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&Y.clearInterval(t)},r.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},r.prototype._execute=function(e,t){var r,i=!1;try{this.work(e)}catch(e){i=!0,r=e||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),r},r.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,i=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,p(i,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},r}(X),ee=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=Q.now,e}(),te=new(function(e){function r(t,r){void 0===r&&(r=ee.now);var i=e.call(this,t,r)||this;return i.actions=[],i._active=!1,i}return t(r,e),r.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var r;this._active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},r}(ee))(Z),re=te,ie=new $((function(e){return e.complete()}));function ne(e){return e&&d(e.schedule)}function se(e){return e[e.length-1]}function ae(e){return ne(se(e))?e.pop():void 0}var oe=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function ce(e){return d(null==e?void 0:e.then)}function le(e){return d(e[j])}function de(e){return Symbol.asyncIterator&&d(null==e?void 0:e[Symbol.asyncIterator])}function ue(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var he="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function pe(e){return d(null==e?void 0:e[he])}function fe(e){return c(this,arguments,(function(){var t,r,n;return i(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,o(t.read())];case 3:return r=i.sent(),n=r.value,r.done?[4,o(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,o(n)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function me(e){return d(null==e?void 0:e.getReader)}function ye(e){if(e instanceof $)return e;if(null!=e){if(le(e))return s=e,new $((function(e){var t=s[j]();if(d(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(oe(e))return i=e,new $((function(e){for(var t=0;t<i.length&&!e.closed;t++)e.next(i[t]);e.complete()}));if(ce(e))return r=e,new $((function(e){r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,E)}));if(de(e))return ge(e);if(pe(e))return t=e,new $((function(e){var r,i;try{for(var s=n(t),a=s.next();!a.done;a=s.next()){var o=a.value;if(e.next(o),e.closed)return}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}e.complete()}));if(me(e))return ge(fe(e))}var t,r,i,s;throw ue(e)}function ge(e){return new $((function(t){(function(e,t){var n,s,a,o;return r(this,void 0,void 0,(function(){var r,c;return i(this,(function(i){switch(i.label){case 0:i.trys.push([0,5,6,11]),n=l(e),i.label=1;case 1:return[4,n.next()];case 2:if((s=i.sent()).done)return[3,4];if(r=s.value,t.next(r),t.closed)return[2];i.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=i.sent(),a={error:c},[3,11];case 6:return i.trys.push([6,,9,10]),s&&!s.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:i.sent(),i.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function we(e,t,r,i,n){void 0===i&&(i=0),void 0===n&&(n=!1);var s=t.schedule((function(){r(),n?e.add(this.schedule(null,i)):this.unsubscribe()}),i);if(e.add(s),!n)return s}function ve(e,t){return void 0===t&&(t=0),K((function(r,i){r.subscribe(V(i,(function(r){return we(i,e,(function(){return i.next(r)}),t)}),(function(){return we(i,e,(function(){return i.complete()}),t)}),(function(r){return we(i,e,(function(){return i.error(r)}),t)})))}))}function be(e,t){return void 0===t&&(t=0),K((function(r,i){i.add(e.schedule((function(){return r.subscribe(i)}),t))}))}function ke(e,t){if(!e)throw new Error("Iterable cannot be null");return new $((function(r){we(r,t,(function(){var i=e[Symbol.asyncIterator]();we(r,t,(function(){i.next().then((function(e){e.done?r.complete():r.next(e.value)}))}),0,!0)}))}))}function Se(e,t){if(null!=e){if(le(e))return function(e,t){return ye(e).pipe(be(t),ve(t))}(e,t);if(oe(e))return function(e,t){return new $((function(r){var i=0;return t.schedule((function(){i===e.length?r.complete():(r.next(e[i++]),r.closed||this.schedule())}))}))}(e,t);if(ce(e))return function(e,t){return ye(e).pipe(be(t),ve(t))}(e,t);if(de(e))return ke(e,t);if(pe(e))return function(e,t){return new $((function(r){var i;return we(r,t,(function(){i=e[he](),we(r,t,(function(){var e,t,n;try{t=(e=i.next()).value,n=e.done}catch(e){return void r.error(e)}n?r.complete():r.next(t)}),0,!0)})),function(){return d(null==i?void 0:i.return)&&i.return()}}))}(e,t);if(me(e))return function(e,t){return ke(fe(e),t)}(e,t)}throw ue(e)}function Ce(e,t){return t?Se(e,t):ye(e)}function Ee(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Ce(e,ae(e))}var Te=u((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}));function Ie(e,t){var r="object"==typeof t;return new Promise((function(i,n){var s=new O({next:function(e){i(e),s.unsubscribe()},error:n,complete:function(){r?i(t.defaultValue):n(new Te)}});e.subscribe(s)}))}function xe(e,t){return K((function(r,i){var n=0;r.subscribe(V(i,(function(r){i.next(e.call(t,r,n++))})))}))}var Fe=Array.isArray;function Pe(e){return xe((function(t){return function(e,t){return Fe(t)?e.apply(void 0,a([],s(t))):e(t)}(e,t)}))}Array.isArray,Object.getPrototypeOf,Object.prototype,Object.keys;function Re(e,t,r,i,n,s,a,o){var c=[],l=0,d=0,u=!1,h=function(){!u||c.length||l||t.complete()},p=function(e){return l<i?f(e):c.push(e)},f=function(e){s&&t.next(e),l++;var o=!1;ye(r(e,d++)).subscribe(V(t,(function(e){null==n||n(e),s?p(e):t.next(e)}),(function(){o=!0}),void 0,(function(){if(o)try{l--;for(var e=function(){var e=c.shift();a?we(t,a,(function(){return f(e)})):f(e)};c.length&&l<i;)e();h()}catch(e){t.error(e)}})))};return e.subscribe(V(t,p,(function(){u=!0,h()}))),function(){null==o||o()}}function _e(e,t,r){return void 0===r&&(r=1/0),d(t)?_e((function(r,i){return xe((function(e,n){return t(r,e,i,n)}))(ye(e(r,i)))}),r):("number"==typeof t&&(r=t),K((function(t,i){return Re(t,i,e,r)})))}function De(e){return void 0===e&&(e=1/0),_e(L,e)}function Me(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return De(1)(Ce(e,ae(e)))}function Oe(e){return new $((function(t){ye(e()).subscribe(t)}))}var qe=["addListener","removeListener"],Ae=["addEventListener","removeEventListener"],Ne=["on","off"];function je(e,t,r,i){if(d(r)&&(i=r,r=void 0),i)return je(e,t,r).pipe(Pe(i));var n=s(function(e){return d(e.addEventListener)&&d(e.removeEventListener)}(e)?Ae.map((function(i){return function(n){return e[i](t,n,r)}})):function(e){return d(e.addListener)&&d(e.removeListener)}(e)?qe.map(Le(e,t)):function(e){return d(e.on)&&d(e.off)}(e)?Ne.map(Le(e,t)):[],2),a=n[0],o=n[1];if(!a&&oe(e))return _e((function(e){return je(e,t,r)}))(ye(e));if(!a)throw new TypeError("Invalid event target");return new $((function(e){var t=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.next(1<t.length?t:t[0])};return a(t),function(){return o(t)}}))}function Le(e,t){return function(r){return function(i){return e[r](t,i)}}}function Be(e,t,r){void 0===e&&(e=0),void 0===r&&(r=re);var i=-1;return null!=t&&(ne(t)?r=t:i=t),new $((function(t){var n,s=(n=e)instanceof Date&&!isNaN(n)?+e-r.now():e;s<0&&(s=0);var a=0;return r.schedule((function(){t.closed||(t.next(a++),0<=i?this.schedule(void 0,i):t.complete())}),s)}))}function $e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ae(e),i=function(e,t){return"number"==typeof se(e)?e.pop():t}(e,1/0),n=e;return n.length?1===n.length?ye(n[0]):De(i)(Ce(n,r)):ie}var He=new $(T),Ke=Array.isArray;function Ve(e){return 1===e.length&&Ke(e[0])?e[0]:e}function We(e,t){return K((function(r,i){var n=0;r.subscribe(V(i,(function(r){return e.call(t,r,n++)&&i.next(r)})))}))}function Ue(e){return function(t){for(var r=[],i=function(i){r.push(ye(e[i]).subscribe(V(t,(function(e){if(r){for(var n=0;n<r.length;n++)n!==i&&r[n].unsubscribe();r=null}t.next(e)}))))},n=0;r&&!t.closed&&n<e.length;n++)i(n)}}function ze(e){return K((function(t,r){var i,n=null,s=!1;n=t.subscribe(V(r,void 0,void 0,(function(a){i=ye(e(a,ze(e)(t))),n?(n.unsubscribe(),n=null,i.subscribe(r)):s=!0}))),s&&(n.unsubscribe(),n=null,i.subscribe(r))}))}function Ge(e){return K((function(t,r){var i=!1;t.subscribe(V(r,(function(e){i=!0,r.next(e)}),(function(){i||r.next(e),r.complete()})))}))}function Qe(e){return e<=0?function(){return ie}:K((function(t,r){var i=0;t.subscribe(V(r,(function(t){++i<=e&&(r.next(t),e<=i&&r.complete())})))}))}function Je(){return K((function(e,t){e.subscribe(V(t,T))}))}function Xe(e){return void 0===e&&(e=Ye),K((function(t,r){var i=!1;t.subscribe(V(r,(function(e){i=!0,r.next(e)}),(function(){return i?r.complete():r.error(e())})))}))}function Ye(){return new Te}function Ze(e,t){var r=arguments.length>=2;return function(i){return i.pipe(e?We((function(t,r){return e(t,r,i)})):L,Qe(1),r?Ge(t):Xe((function(){return new Te})))}}function et(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.length?K((function(t,r){Ue(a([t],s(e)))(r)})):L}function tt(e){var t;void 0===e&&(e=1/0);var r=(t=e&&"object"==typeof e?e:{count:e}).count,i=void 0===r?1/0:r,n=t.delay,s=t.resetOnSuccess,a=void 0!==s&&s;return i<=0?L:K((function(e,t){var r,s=0,o=function(){var c=!1;r=e.subscribe(V(t,(function(e){a&&(s=0),t.next(e)}),void 0,(function(e){if(s++<i){var a=function(){r?(r.unsubscribe(),r=null,o()):c=!0};if(null!=n){var l="number"==typeof n?Be(n):ye(n(e,s)),d=V(t,(function(){d.unsubscribe(),a()}),(function(){t.complete()}));l.subscribe(d)}else a()}else t.error(e)}))),c&&(r.unsubscribe(),r=null,o())};o()}))}function rt(e,t,r){var i=d(e)||t||r?{next:e,error:t,complete:r}:e;return i?K((function(e,t){var r;null===(r=i.subscribe)||void 0===r||r.call(i);var n=!0;e.subscribe(V(t,(function(e){var r;null===(r=i.next)||void 0===r||r.call(i,e),t.next(e)}),(function(){var e;n=!1,null===(e=i.complete)||void 0===e||e.call(i),t.complete()}),(function(e){var r;n=!1,null===(r=i.error)||void 0===r||r.call(i,e),t.error(e)}),(function(){var e,t;n&&(null===(e=i.unsubscribe)||void 0===e||e.call(i)),null===(t=i.finalize)||void 0===t||t.call(i)})))})):L}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
Symbol.dispose??=Symbol("dispose"),Symbol.asyncDispose??=Symbol("asyncDispose");const it=Symbol.dispose,nt=Symbol.asyncDispose;class st{#e=!1;#t=[];get disposed(){return this.#e}dispose(){if(!this.#e){this.#e=!0;for(const e of this.#t.reverse())e[it]()}}use(e){return e&&this.#t.push(e),e}adopt(e,t){return this.#t.push({[it](){t(e)}}),e}defer(e){this.#t.push({[it](){e()}})}move(){if(this.#e)throw new ReferenceError("a disposed stack can not use anything new");const e=new st;return e.#t=this.#t,this.#e=!0,e}[it]=this.dispose;[Symbol.toStringTag]="DisposableStack"}class at{#e=!1;#t=[];get disposed(){return this.#e}async dispose(){if(!this.#e){this.#e=!0;for(const e of this.#t.reverse())await e[nt]()}}use(e){return e&&this.#t.push(e),e}adopt(e,t){return this.#t.push({[nt]:()=>t(e)}),e}defer(e){this.#t.push({[nt]:()=>e()})}move(){if(this.#e)throw new ReferenceError("a disposed stack can not use anything new");const e=new at;return e.#t=this.#t,this.#e=!0,e}[nt]=this.dispose;[Symbol.toStringTag]="AsyncDisposableStack"}
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class ot{#r;#i=new Map;constructor(e=function(e){return{all:e=e||new Map,on:function(t,r){var i=e.get(t);i?i.push(r):e.set(t,[r])},off:function(t,r){var i=e.get(t);i&&(r?i.splice(i.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var i=e.get(t);i&&i.slice().map((function(e){e(r)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,r)}))}}}(new Map)){this.#r=e}on(e,t){const r=this.#i.get(e);return void 0===r?this.#i.set(e,[t]):r.push(t),this.#r.on(e,t),this}off(e,t){const r=this.#i.get(e)??[];if(void 0===t){for(const t of r)this.#r.off(e,t);return this.#i.delete(e),this}const i=r.lastIndexOf(t);return i>-1&&this.#r.off(e,...r.splice(i,1)),this}emit(e,t){return this.#r.emit(e,t),this.listenerCount(e)>0}once(e,t){const r=i=>{t(i),this.off(e,r)};return this.on(e,r)}listenerCount(e){return this.#i.get(e)?.length||0}removeAllListeners(e){return void 0!==e?this.off(e):(this[it](),this)}[it](){for(const[e,t]of this.#i)for(const r of t)this.#r.off(e,r);this.#i.clear()}}
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const ct=!("undefined"==typeof process||!process.version),lt={value:{get fs(){throw new Error("fs is not available in this environment")},get ScreenRecorder(){throw new Error("ScreenRecorder is not available in this environment")}}},dt=(e,t)=>{if(!e)throw new Error(t)};
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
function ut(e,t=!1){if(t){const t=atob(e);return Uint8Array.from(t,(e=>e.codePointAt(0)))}return(new TextEncoder).encode(e)}function ht(e){const t=[];for(let r=0;r<e.length;r+=65534){const i=e.subarray(r,r+65534);t.push(String.fromCodePoint.apply(null,i))}const r=t.join("");return btoa(r)}
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
let pt=null;const ft=e=>ct?async(...t)=>{yt&&mt.push(e+t),(await async function(){return pt||(pt=(await import("debug")).default),pt}())(e)(t)}:(...t)=>{const r=globalThis.__PUPPETEER_DEBUG;if(!r)return;("*"===r||(r.endsWith("*")?e.startsWith(r):e===r))&&console.log(`${e}:`,...t)};let mt=[],yt=!1;
/**
* @license
* Copyright 2018 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
class gt extends Error{constructor(e,t){super(e,t),this.name=this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class wt extends gt{}class vt extends gt{}class bt extends gt{#n;#s="";set code(e){this.#n=e}get code(){return this.#n}set originalMessage(e){this.#s=e}get originalMessage(){return this.#s}}class kt extends gt{}class St extends bt{}
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const Ct={letter:{cm:{width:21.59,height:27.94},in:{width:8.5,height:11}},legal:{cm:{width:21.59,height:35.56},in:{width:8.5,height:14}},tabloid:{cm:{width:27.94,height:43.18},in:{width:11,height:17}},ledger:{cm:{width:43.18,height:27.94},in:{width:17,height:11}},a0:{cm:{width:84.1,height:118.9},in:{width:33.1102,height:46.811}},a1:{cm:{width:59.4,height:84.1},in:{width:23.3858,height:33.1102}},a2:{cm:{width:42,height:59.4},in:{width:16.5354,height:23.3858}},a3:{cm:{width:29.7,height:42},in:{width:11.6929,height:16.5354}},a4:{cm:{width:21,height:29.7},in:{width:8.2677,height:11.6929}},a5:{cm:{width:14.8,height:21},in:{width:5.8268,height:8.2677}},a6:{cm:{width:10.5,height:14.8},in:{width:4.1339,height:5.8268}}},Et=ft("puppeteer:error"),Tt=(Object.freeze({width:800,height:600}),Symbol("Source URL for Puppeteer evaluation scripts"));
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class It{static INTERNAL_URL="pptr:internal";static fromCallSite(e,t){const r=new It;return r.#a=e,r.#o=t.toString(),r}static parse=e=>{e=e.slice(5);const[t="",r=""]=e.split(";"),i=new It;return i.#a=t,i.#o=decodeURIComponent(r),i};static isPuppeteerURL=e=>e.startsWith("pptr:");#a;#o;get functionName(){return this.#a}get siteString(){return this.#o}toString(){return`pptr:${[this.#a,encodeURIComponent(this.#o)].join(";")}`}}const xt=(e,t)=>{if(Object.prototype.hasOwnProperty.call(t,Tt))return t;const r=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t[2];const i=(new Error).stack;return Error.prepareStackTrace=r,Object.assign(t,{[Tt]:It.fromCallSite(e,i)})},Ft=e=>"string"==typeof e||e instanceof String;function Pt(e,...t){if(Ft(e))return dt(0===t.length,"Cannot evaluate a string with arguments"),e;return`(${e})(${t.map((function(e){return Object.is(e,void 0)?"undefined":JSON.stringify(e)})).join(",")})`}async function Rt(e,t){const r=[],i=e.getReader();if(t){const e=await lt.value.fs.promises.open(t,"w+");try{for(;;){const{done:t,value:n}=await i.read();if(t)break;r.push(n),await e.writeFile(n)}}finally{await e.close()}}else for(;;){const{done:e,value:t}=await i.read();if(e)break;r.push(t)}try{const e=function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let i=0;for(const t of e)r.set(t,i),i+=t.length;return r}(r);return 0===e.length?null:e}catch(e){return Et(e),null}}async function _t(e,t){return new ReadableStream({async pull(r){const{data:i,base64Encoded:n,eof:s}=await e.send("IO.read",{handle:t});r.enqueue(function(e,t){return t?Uint8Array.from(atob(e),(e=>e.codePointAt(0))):(new TextEncoder).encode(e)}(i,n??!1)),s&&(await e.send("IO.close",{handle:t}),r.close())}})}function Dt(e,t){return 0===e?He:Be(e).pipe(xe((()=>{throw new wt(`Timed out after waiting ${e}ms`,{cause:t})})))}const Mt="__puppeteer_utility_world__24.4.0",Ot=/^[\x20\t]*\/\/[@#] sourceURL=\s{0,10}(\S*?)\s{0,10}$/m;const qt=500;const At={px:1,in:96,cm:37.8,mm:3.78};function Nt(e,t="in"){if(void 0===e)return;let r;if("number"==typeof(i=e)||i instanceof Number)r=e;else{if(!Ft(e))throw new Error("page.pdf() Cannot handle parameter type: "+typeof e);{const t=e;let i=t.substring(t.length-2).toLowerCase(),n="";i in At?n=t.substring(0,t.length-2):(i="px",n=t);const s=Number(n);dt(!isNaN(s),"Failed to parse parameter value: "+t),r=s*At[i]}}var i;return r/At[t]}function jt(e,t){return new $((r=>{const i=e=>{r.next(e)};return e.on(t,i),()=>{e.off(t,i)}}))}function Lt(e,t){return e?je(e,"abort").pipe(xe((()=>{if(e.reason instanceof Error)throw e.reason.cause=t,e.reason;throw new Error(e.reason,{cause:t})}))):He}function Bt(e){return _e((t=>Ce(Promise.resolve(e(t))).pipe(We((e=>e)),xe((()=>t)))))}const $t=new Map([["accelerometer","sensors"],["ambient-light-sensor","sensors"],["background-sync","backgroundSync"],["camera","videoCapture"],["clipboard-read","clipboardReadWrite"],["clipboard-sanitized-write","clipboardSanitizedWrite"],["clipboard-write","clipboardReadWrite"],["geolocation","geolocation"],["gyroscope","sensors"],["idle-detection","idleDetection"],["keyboard-lock","keyboardLock"],["magnetometer","sensors"],["microphone","audioCapture"],["midi","midi"],["notifications","notifications"],["payment-handler","paymentHandler"],["persistent-storage","durableStorage"],["pointer-lock","pointerLock"],["midi-sysex","midiSysex"]]);class Ht extends ot{constructor(){super()}async waitForTarget(e,t={}){const{timeout:r=3e4,signal:i}=t;return await Ie($e(jt(this,"targetcreated"),jt(this,"targetchanged"),Ce(this.targets())).pipe(Bt(e),et(Lt(i),Dt(r))))}async pages(){const e=await Promise.all(this.browserContexts().map((e=>e.pages())));return e.reduce(((e,t)=>e.concat(t)),[])}async cookies(){return await this.defaultBrowserContext().cookies()}async setCookie(...e){return await this.defaultBrowserContext().setCookie(...e)}async deleteCookie(...e){return await this.defaultBrowserContext().deleteCookie(...e)}isConnected(){return this.connected}[it](){this.process()?this.close().catch(Et):this.disconnect().catch(Et)}[nt](){return this.process()?this.close():this.disconnect()}}var Kt;!function(e){e.Disconnected=Symbol("CDPSession.Disconnected"),e.Swapped=Symbol("CDPSession.Swapped"),e.Ready=Symbol("CDPSession.Ready"),e.SessionAttached="sessionattached",e.SessionDetached="sessiondetached"}(Kt||(Kt={}));class Vt extends ot{constructor(){super()}parentSession(){}}
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Wt{static create(e){return new Wt(e)}static async race(e){const t=new Set;try{const r=e.map((e=>e instanceof Wt?(e.#c&&t.add(e),e.valueOrThrow()):e));return await Promise.race(r)}finally{for(const e of t)e.reject(new Error("Timeout cleared"))}}#l=!1;#d=!1;#u;#h;#p=new Promise((e=>{this.#h=e}));#c;#f;constructor(e){e&&e.timeout>0&&(this.#f=new wt(e.message),this.#c=setTimeout((()=>{this.reject(this.#f)}),e.timeout))}#m(e){clearTimeout(this.#c),this.#u=e,this.#h()}resolve(e){this.#d||this.#l||(this.#l=!0,this.#m(e))}reject(e){this.#d||this.#l||(this.#d=!0,this.#m(e))}resolved(){return this.#l}finished(){return this.#l||this.#d}value(){return this.#u}#y;valueOrThrow(){return this.#y||(this.#y=(async()=>{if(await this.#p,this.#d)throw this.#u;return this.#u})()),this.#y}}
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Ut{static Guard=class{#g;#w;constructor(e,t){this.#g=e,this.#w=t}[it](){return this.#w?.(),this.#g.release()}};#v=!1;#b=[];async acquire(e){if(!this.#v)return this.#v=!0,new Ut.Guard(this);const t=Wt.create();return this.#b.push(t.resolve.bind(t)),await t.valueOrThrow(),new Ut.Guard(this,e)}release(){const e=this.#b.shift();e?e():this.#v=!1}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class zt extends ot{constructor(){super()}#k;#S=0;startScreenshot(){const e=this.#k||new Ut;return this.#k=e,this.#S++,e.acquire((()=>{this.#S--,0===this.#S&&(this.#k=void 0)}))}waitForScreenshotOperations(){return this.#k?.acquire()}async waitForTarget(e,t={}){const{timeout:r=3e4}=t;return await Ie($e(jt(this,"targetcreated"),jt(this,"targetchanged"),Ce(this.targets())).pipe(Bt(e),et(Dt(r))))}async deleteCookie(...e){return await this.setCookie(...e.map((e=>({...e,expires:1}))))}get closed(){return!this.browser().browserContexts().includes(this)}get id(){}[it](){this.close().catch(Et)}[nt](){return this.close()}}
/**
* @license
* Copyright 2019 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Gt{#C;#E;constructor(){this.#C=null,this.#E=null}setDefaultTimeout(e){this.#C=e}setDefaultNavigationTimeout(e){this.#E=e}navigationTimeout(){return null!==this.#E?this.#E:null!==this.#C?this.#C:3e4}timeout(){return null!==this.#C?this.#C:3e4}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var Qt=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},Jt=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});const Xt=new WeakSet;function Yt(e,t){let r=!1;if(e.prototype[it]){const t=e.prototype[it];e.prototype[it]=function(){if(!Xt.has(this))return t.call(this);Xt.delete(this)},r=!0}if(e.prototype[nt]){const t=e.prototype[nt];e.prototype[nt]=function(){if(!Xt.has(this))return t.call(this);Xt.delete(this)},r=!0}return r&&(e.prototype.move=function(){return Xt.add(this),this}),e}function Zt(e=e=>`Attempted to use disposed ${e.constructor.name}.`){return(t,r)=>function(...r){if(this.disposed)throw new Error(e(this));return t.call(this,...r)}}function er(e,t){const r=new WeakMap;let i=-1;return function(...t){if(-1===i&&(i=t.length),i!==t.length)throw new Error("Memoized method was called with the wrong number of arguments");let n=!1,s=r;for(const e of t)s.has(e)||(n=!0,s.set(e,new WeakMap)),s=s.get(e);if(n)return e.call(this,...t)}}function tr(e=function(){return this}){return(t,r)=>{const i=new WeakMap;return async function(...r){const n={stack:[],error:void 0,hasError:!1};try{const s=e.call(this);let a=i.get(s);a||(a=new Ut,i.set(s,a));Qt(n,await a.acquire(),!0);return await t.call(this,...r)}catch(e){n.error=e,n.hasError=!0}finally{const e=Jt(n);e&&await e}}}}new WeakMap;var rr,ir=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},nr=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});!function(e){e.Action="action"}(rr||(rr={}));class sr extends ot{static race(e){return ur.create(e)}visibility=null;_timeout=3e4;#T=!0;#I=!0;#x=!0;operators={conditions:(e,t)=>_e((r=>$e(...e.map((e=>e(r,t)))).pipe(Ge(r)))),retryAndRaceWithSignalAndTimer:(e,t)=>{const r=[];return e&&r.push(Lt(e,t)),r.push(Dt(this._timeout,t)),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return B(e)}(tt({delay:hr}),et(...r))}};get timeout(){return this._timeout}setTimeout(e){const t=this._clone();return t._timeout=e,t}setVisibility(e){const t=this._clone();return t.visibility=e,t}setWaitForEnabled(e){const t=this._clone();return t.#I=e,t}setEnsureElementIsInTheViewport(e){const t=this._clone();return t.#T=e,t}setWaitForStableBoundingBox(e){const t=this._clone();return t.#x=e,t}copyOptions(e){return this._timeout=e._timeout,this.visibility=e.visibility,this.#I=e.#I,this.#T=e.#T,this.#x=e.#x,this}#F=(e,t)=>this.#I?Ce(e.frame.waitForFunction((e=>{if(!(e instanceof HTMLElement))return!0;return!["BUTTON","INPUT","SELECT","TEXTAREA","OPTION","OPTGROUP"].includes(e.nodeName)||!e.hasAttribute("disabled")}),{timeout:this._timeout,signal:t},e)).pipe(Je()):ie;#P=e=>this.#x?Oe((()=>Ce(e.evaluate((e=>new Promise((t=>{window.requestAnimationFrame((()=>{const r=e.getBoundingClientRect();window.requestAnimationFrame((()=>{const i=e.getBoundingClientRect();t([{x:r.x,y:r.y,width:r.width,height:r.height},{x:i.x,y:i.y,width:i.width,height:i.height}])}))}))}))))))).pipe(Ze((([e,t])=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height)),tt({delay:hr}),Je()):ie;#R=e=>this.#T?Ce(e.isIntersectingViewport({threshold:0})).pipe(We((e=>!e)),_e((()=>Ce(e.scrollIntoView()))),_e((()=>Oe((()=>Ce(e.isIntersectingViewport({threshold:0})))).pipe(Ze(L),tt({delay:hr}),Je())))):ie;#_(e){const t=e?.signal,r=new Error("Locator.click");return this._wait(e).pipe(this.operators.conditions([this.#R,this.#P,this.#F],t),rt((()=>this.emit(rr.Action,void 0))),_e((t=>Ce(t.click(e)).pipe(ze((e=>{throw t.dispose().catch(Et),e}))))),this.operators.retryAndRaceWithSignalAndTimer(t,r))}#D(e,t){const r=t?.signal,i=new Error("Locator.fill");return this._wait(t).pipe(this.operators.conditions([this.#R,this.#P,this.#F],r),rt((()=>this.emit(rr.Action,void 0))),_e((t=>Ce(t.evaluate((e=>e instanceof HTMLSelectElement?"select":e instanceof HTMLTextAreaElement?"typeable-input":e instanceof HTMLInputElement?new Set(["textarea","text","url","tel","search","password","number","email"]).has(e.type)?"typeable-input":"other-input":e.isContentEditable?"contenteditable":"unknown"))).pipe(_e((r=>{switch(r){case"select":return Ce(t.select(e).then(T));case"contenteditable":case"typeable-input":return Ce(t.evaluate(((e,t)=>{const r=e.isContentEditable?e.innerText:e.value;if(t.length<=r.length||!t.startsWith(e.value))return e.isContentEditable?e.innerText="":e.value="",t;const i=e.isContentEditable?e.innerText:e.value;return e.isContentEditable?(e.innerText="",e.innerText=i):(e.value="",e.value=i),t.substring(i.length)}),e)).pipe(_e((e=>Ce(t.type(e)))));case"other-input":return Ce(t.focus()).pipe(_e((()=>Ce(t.evaluate(((e,t)=>{e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}),e)))));case"unknown":throw new Error("Element cannot be filled out.")}}))).pipe(ze((e=>{throw t.dispose().catch(Et),e}))))),this.operators.retryAndRaceWithSignalAndTimer(r,i))}#M(e){const t=e?.signal,r=new Error("Locator.hover");return this._wait(e).pipe(this.operators.conditions([this.#R,this.#P],t),rt((()=>this.emit(rr.Action,void 0))),_e((e=>Ce(e.hover()).pipe(ze((t=>{throw e.dispose().catch(Et),t}))))),this.operators.retryAndRaceWithSignalAndTimer(t,r))}#O(e){const t=e?.signal,r=new Error("Locator.scroll");return this._wait(e).pipe(this.operators.conditions([this.#R,this.#P],t),rt((()=>this.emit(rr.Action,void 0))),_e((t=>Ce(t.evaluate(((e,t,r)=>{void 0!==t&&(e.scrollTop=t),void 0!==r&&(e.scrollLeft=r)}),e?.scrollTop,e?.scrollLeft)).pipe(ze((e=>{throw t.dispose().catch(Et),e}))))),this.operators.retryAndRaceWithSignalAndTimer(t,r))}clone(){return this._clone()}async waitHandle(e){const t=new Error("Locator.waitHandle");return await Ie(this._wait(e).pipe(this.operators.retryAndRaceWithSignalAndTimer(e?.signal,t)))}async wait(e){const t={stack:[],error:void 0,hasError:!1};try{const r=ir(t,await this.waitHandle(e),!1);return await r.jsonValue()}catch(e){t.error=e,t.hasError=!0}finally{nr(t)}}map(e){return new lr(this._clone(),(t=>t.evaluateHandle(e)))}filter(e){return new cr(this._clone(),(async(t,r)=>(await t.frame.waitForFunction(e,{signal:r,timeout:this._timeout},t),!0)))}filterHandle(e){return new cr(this._clone(),e)}mapHandle(e){return new lr(this._clone(),e)}click(e){return Ie(this.#_(e))}fill(e,t){return Ie(this.#D(e,t))}hover(e){return Ie(this.#M(e))}scroll(e){return Ie(this.#O(e))}}class ar extends sr{static create(e,t){return new ar(e,t).setTimeout("getDefaultTimeout"in e?e.getDefaultTimeout():e.page().getDefaultTimeout())}#q;#A;constructor(e,t){super(),this.#q=e,this.#A=t}_clone(){return new ar(this.#q,this.#A)}_wait(e){const t=e?.signal;return Oe((()=>Ce(this.#q.waitForFunction(this.#A,{timeout:this.timeout,signal:t})))).pipe(Xe())}}class or extends sr{#N;constructor(e){super(),this.#N=e,this.copyOptions(this.#N)}get delegate(){return this.#N}setTimeout(e){const t=super.setTimeout(e);return t.#N=this.#N.setTimeout(e),t}setVisibility(e){const t=super.setVisibility(e);return t.#N=t.#N.setVisibility(e),t}setWaitForEnabled(e){const t=super.setWaitForEnabled(e);return t.#N=this.#N.setWaitForEnabled(e),t}setEnsureElementIsInTheViewport(e){const t=super.setEnsureElementIsInTheViewport(e);return t.#N=this.#N.setEnsureElementIsInTheViewport(e),t}setWaitForStableBoundingBox(e){const t=super.setWaitForStableBoundingBox(e);return t.#N=this.#N.setWaitForStableBoundingBox(e),t}}class cr extends or{#j;constructor(e,t){super(e),this.#j=t}_clone(){return new cr(this.delegate.clone(),this.#j).copyOptions(this)}_wait(e){return this.delegate._wait(e).pipe(_e((t=>Ce(Promise.resolve(this.#j(t,e?.signal))).pipe(We((e=>e)),xe((()=>t))))),Xe())}}class lr extends or{#L;constructor(e,t){super(e),this.#L=t}_clone(){return new lr(this.delegate.clone(),this.#L).copyOptions(this)}_wait(e){return this.delegate._wait(e).pipe(_e((t=>Ce(Promise.resolve(this.#L(t,e?.signal))))))}}class dr extends sr{static create(e,t){return new dr(e,t).setTimeout("getDefaultTimeout"in e?e.getDefaultTimeout():e.page().getDefaultTimeout())}#q;#B;constructor(e,t){super(),this.#q=e,this.#B=t}#$=e=>this.visibility?(()=>{switch(this.visibility){case"hidden":return Oe((()=>Ce(e.isHidden())));case"visible":return Oe((()=>Ce(e.isVisible())))}})().pipe(Ze(L),tt({delay:hr}),Je()):ie;_clone(){return new dr(this.#q,this.#B).copyOptions(this)}_wait(e){const t=e?.signal;return Oe((()=>Ce(this.#q.waitForSelector(this.#B,{visible:!1,timeout:this._timeout,signal:t})))).pipe(We((e=>null!==e)),Xe(),this.operators.conditions([this.#$],t))}}class ur extends sr{static create(e){const t=function(e){for(const t of e)if(!(t instanceof sr))throw new Error("Unknown locator for race candidate");return e}(e);return new ur(t)}#H;constructor(e){super(),this.#H=e}_clone(){return new ur(this.#H.map((e=>e.clone()))).copyOptions(this)}_wait(e){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===(e=Ve(e)).length?ye(e[0]):new $(Ue(e))}(...this.#H.map((t=>t._wait(e))))}}const hr=100;
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var pr=self&&self.__runInitializers||function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},fr=self&&self.__esDecorate||function(e,t,r,i,n,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?i.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=a(y.get))&&(u.get=o),(o=a(y.set))&&(u.set=o),(o=a(y.init))&&n.unshift(o)}else(o=a(y))&&("field"===c?n.unshift(o):u[l]=o)}d&&Object.defineProperty(d,i.name,u),h=!0},mr=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},yr=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});let gr=(()=>{let e,t=ot,r=[];return class extends t{static{const i="function"==typeof Symbol&&Symbol.metadata?Object.create(t[Symbol.metadata]??null):void 0;fr(this,null,e,{kind:"method",name:"screenshot",static:!1,private:!1,access:{has:e=>"screenshot"in e,get:e=>e.screenshot},metadata:i},null,r),i&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})}_isDragging=(pr(this,r),!1);_timeoutSettings=new Gt;#K=new WeakMap;#V=new J(1);constructor(){var e,t,r,i;super(),jt(this,"request").pipe(_e((e=>Me(Ee(1),$e(jt(this,"requestfailed"),jt(this,"requestfinished"),jt(this,"response").pipe(xe((e=>e.request())))).pipe(We((t=>t.id===e.id)),Qe(1),xe((()=>-1)))))),(t=(e,t)=>Ee(e+t),r=0,void 0===i&&(i=1/0),K((function(e,n){var s=r;return Re(e,n,(function(e,r){return t(s,e,r)}),i,(function(e){s=e}),!1,void 0,(function(){return s=null}))}))),(e=jt(this,"close"),K((function(t,r){ye(e).subscribe(V(r,(function(){return r.complete()}),T)),!r.closed&&t.subscribe(r)}))),function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=ae(e);return K((function(t,i){(r?Me(e,t,r):Me(e,t)).subscribe(i)}))}(0)).subscribe(this.#V)}on(e,t){if("request"!==e)return super.on(e,t);let r=this.#K.get(t);return void 0===r&&(r=e=>{e.enqueueInterceptAction((()=>t(e)))},this.#K.set(t,r)),super.on(e,r)}off(e,t){return"request"===e&&(t=this.#K.get(t)||t),super.off(e,t)}get accessibility(){return this.mainFrame().accessibility}locator(e){return"string"==typeof e?dr.create(this,e):ar.create(this,e)}locatorRace(e){return sr.race(e)}async $(e){return await this.mainFrame().$(e)}async $$(e,t){return await this.mainFrame().$$(e,t)}async evaluateHandle(e,...t){return e=xt(this.evaluateHandle.name,e),await this.mainFrame().evaluateHandle(e,...t)}async $eval(e,t,...r){return t=xt(this.$eval.name,t),await this.mainFrame().$eval(e,t,...r)}async $$eval(e,t,...r){return t=xt(this.$$eval.name,t),await this.mainFrame().$$eval(e,t,...r)}async addScriptTag(e){return await this.mainFrame().addScriptTag(e)}async addStyleTag(e){return await this.mainFrame().addStyleTag(e)}url(){return this.mainFrame().url()}async content(){return await this.mainFrame().content()}async setContent(e,t){await this.mainFrame().setContent(e,t)}async goto(e,t){return await this.mainFrame().goto(e,t)}async waitForNavigation(e={}){return await this.mainFrame().waitForNavigation(e)}waitForRequest(e,t={}){const{timeout:r=this._timeoutSettings.timeout(),signal:i}=t;if("string"==typeof e){const t=e;e=e=>e.url()===t}return Ie(jt(this,"request").pipe(Bt(e),et(Dt(r),Lt(i),jt(this,"close").pipe(xe((()=>{throw new St("Page closed!")}))))))}waitForResponse(e,t={}){const{timeout:r=this._timeoutSettings.timeout(),signal:i}=t;if("string"==typeof e){const t=e;e=e=>e.url()===t}return Ie(jt(this,"response").pipe(Bt(e),et(Dt(r),Lt(i),jt(this,"close").pipe(xe((()=>{throw new St("Page closed!")}))))))}waitForNetworkIdle(e={}){return Ie(this.waitForNetworkIdle$(e))}waitForNetworkIdle$(e={}){const{timeout:t=this._timeoutSettings.timeout(),idleTime:r=qt,concurrency:i=0,signal:n}=e;return this.#V.pipe((s=e=>e>i?ie:Be(r),K((function(e,t){var r=null,i=0,n=!1,o=function(){return n&&!r&&t.complete()};e.subscribe(V(t,(function(e){null==r||r.unsubscribe();var n=0,c=i++;ye(s(e,c)).subscribe(r=V(t,(function(r){return t.next(a?a(e,r,c,n++):r)}),(function(){r=null,o()})))}),(function(){n=!0,o()})))}))),xe((()=>{})),et(Dt(t),Lt(n),jt(this,"close").pipe(xe((()=>{throw new St("Page closed!")})))));var s,a}async waitForFrame(e,t={}){const{timeout:r=this.getDefaultTimeout(),signal:i}=t,n=Ft(e)?t=>e===t.url():e;return await Ie($e(jt(this,"frameattached"),jt(this,"framenavigated"),Ce(this.frames())).pipe(Bt(n),Ze(),et(Dt(r),Lt(i),jt(this,"close").pipe(xe((()=>{throw new St("Page closed.")}))))))}async emulate(e){await Promise.all([this.setUserAgent(e.userAgent),this.setViewport(e.viewport)])}async evaluate(e,...t){return e=xt(this.evaluate.name,e),await this.mainFrame().evaluate(e,...t)}async _maybeWriteTypedArrayToFile(e,t){e&&await lt.value.fs.promises.writeFile(e,t)}async screencast(e={}){const t=lt.value.ScreenRecorder,[r,i,n]=await this.#W();let s;if(e.crop){const{x:t,y:a,width:o,height:c}=vr(wr(e.crop));if(t<0||a<0)throw new Error("`crop.x` and `crop.y` must be greater than or equal to 0.");if(o<=0||c<=0)throw new Error("`crop.height` and `crop.width` must be greater than or equal to 0.");const l=r/n,d=i/n;if(t+o>l)throw new Error(`\`crop.width\` cannot be larger than the viewport width (${l}).`);if(a+c>d)throw new Error(`\`crop.height\` cannot be larger than the viewport height (${d}).`);s={x:t*n,y:a*n,width:o*n,height:c*n}}if(void 0!==e.speed&&e.speed<=0)throw new Error("`speed` must be greater than 0.");if(void 0!==e.scale&&e.scale<=0)throw new Error("`scale` must be greater than 0.");const a=new t(this,r,i,{...e,path:e.ffmpegPath,crop:s});try{await this._startScreencast()}catch(e){throw a.stop(),e}if(e.path){const{createWriteStream:t}=lt.value.fs,r=t(e.path,"binary");a.pipe(r)}return a}#U=0;#z;async _startScreencast(){++this.#U,this.#z||(this.#z=this.mainFrame().client.send("Page.startScreencast",{format:"png"}).then((()=>new Promise((e=>this.mainFrame().client.once("Page.screencastFrame",(()=>e()))))))),await this.#z}async _stopScreencast(){--this.#U,this.#z&&(this.#z=void 0,0===this.#U&&await this.mainFrame().client.send("Page.stopScreencast"))}async#W(){const e={stack:[],error:void 0,hasError:!1};try{const t=this.viewport(),r=mr(e,new st,!1);return t&&0!==t.deviceScaleFactor&&(await this.setViewport({...t,deviceScaleFactor:0}),r.defer((()=>{this.setViewport(t).catch(Et)}))),await this.mainFrame().isolatedRealm().evaluate((()=>[window.visualViewport.width*window.devicePixelRatio,window.visualViewport.height*window.devicePixelRatio,window.devicePixelRatio]))}catch(t){e.error=t,e.hasError=!0}finally{yr(e)}}async screenshot(e={}){const t={stack:[],error:void 0,hasError:!1};try{mr(t,await this.browserContext().startScreenshot(),!1);const r={...e,clip:e.clip?{...e.clip}:void 0};if(void 0===r.type&&void 0!==r.path){const e=r.path;switch(e.slice(e.lastIndexOf(".")+1).toLowerCase()){case"png":r.type="png";break;case"jpeg":case"jpg":r.type="jpeg";break;case"webp":r.type="webp"}}if(void 0!==r.quality){if(r.quality<0||r.quality>100)throw new Error(`Expected 'quality' (${r.quality}) to be between 0 and 100, inclusive.`);if(void 0===r.type||!["jpeg","webp"].includes(r.type))throw new Error(`${r.type??"png"} screenshots do not support 'quality'.`)}if(r.clip){if(r.clip.width<=0)throw new Error("'width' in 'clip' must be positive.");if(r.clip.height<=0)throw new Error("'height' in 'clip' must be positive.")}!function(e){e.optimizeForSpeed??=!1,e.type??="png",e.fromSurface??=!0,e.fullPage??=!1,e.omitBackground??=!1,e.encoding??="binary",e.captureBeyondViewport??=!0}(r);const i=mr(t,new at,!0);if(r.clip){if(r.fullPage)throw new Error("'clip' and 'fullPage' are mutually exclusive");r.clip=vr(wr(r.clip))}else if(r.fullPage){if(!r.captureBeyondViewport){const e=await this.mainFrame().isolatedRealm().evaluate((()=>{const e=document.documentElement;return{width:e.scrollWidth,height:e.scrollHeight}})),t=this.viewport();await this.setViewport({...t,...e}),i.defer((async()=>{await this.setViewport(t).catch(Et)}))}}else r.captureBeyondViewport=!1;const n=await this._screenshot(r);if("base64"===r.encoding)return n;const s=ut(n,!0);return await this._maybeWriteTypedArrayToFile(r.path,s),s}catch(e){t.error=e,t.hasError=!0}finally{const e=yr(t);e&&await e}}async title(){return await this.mainFrame().title()}click(e,t){return this.mainFrame().click(e,t)}focus(e){return this.mainFrame().focus(e)}hover(e){return this.mainFrame().hover(e)}select(e,...t){return this.mainFrame().select(e,...t)}tap(e){return this.mainFrame().tap(e)}type(e,t,r){return this.mainFrame().type(e,t,r)}async waitForSelector(e,t={}){return await this.mainFrame().waitForSelector(e,t)}waitForFunction(e,t,...r){return this.mainFrame().waitForFunction(e,t,...r)}[(e=[tr((function(){return this.browser()}))],it)](){this.close().catch(Et)}[nt](){return this.close()}}})();new Set(["Timestamp","Documents","Frames","JSEventListeners","Nodes","LayoutCount","RecalcStyleCount","LayoutDuration","RecalcStyleDuration","ScriptDuration","TaskDuration","JSHeapUsedSize","JSHeapTotalSize"]);function wr(e){return{...e,...e.width<0?{x:e.x+e.width,width:-e.width}:{x:e.x,width:e.width},...e.height<0?{y:e.y+e.height,height:-e.height}:{y:e.y,height:e.height}}}function vr(e){const t=Math.round(e.x),r=Math.round(e.y),i=Math.round(e.width+e.x-t),n=Math.round(e.height+e.y-r);return{...e,x:t,y:r,width:i,height:n}}
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class br{#G;#Q;#J;#X;#Y;constructor(e,t,r,i,n){this.#G=e,this.#Q=t,this.#J=r,this.#X=i,this.#Y=n}type(){return this.#G}text(){return this.#Q}args(){return this.#J}location(){return this.#X[0]??(this.#Y?{url:this.#Y.url()}:{})}stackTrace(){return this.#X}}
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class kr{#Z;#ee;#te=!1;constructor(e,t){this.#Z=e,this.#ee="selectSingle"!==t.mode}isMultiple(){return this.#ee}async accept(e){dt(!this.#te,"Cannot accept FileChooser which is already handled!"),this.#te=!0,await this.#Z.uploadFile(...e)}async cancel(){dt(!this.#te,"Cannot cancel FileChooser which is already handled!"),this.#te=!0,await this.#Z.evaluate((e=>{e.dispatchEvent(new Event("cancel",{bubbles:!0}))}))}}
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var Sr;
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
function Cr(e){return"object"==typeof e&&null!==e&&"name"in e&&"message"in e}function Er(e,t,r){return e.message=t,e.originalMessage=r??e.originalMessage,e}function Tr(e){let t=e.error.message;return e.error&&"object"==typeof e.error&&"data"in e.error&&(t+=` ${e.error.data}`),t}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/!function(e){e.Request=Symbol("NetworkManager.Request"),e.RequestServedFromCache=Symbol("NetworkManager.RequestServedFromCache"),e.Response=Symbol("NetworkManager.Response"),e.RequestFailed=Symbol("NetworkManager.RequestFailed"),e.RequestFinished=Symbol("NetworkManager.RequestFinished")}(Sr||(Sr={}));var Ir=self&&self.__runInitializers||function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},xr=self&&self.__esDecorate||function(e,t,r,i,n,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?i.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=a(y.get))&&(u.get=o),(o=a(y.set))&&(u.set=o),(o=a(y.init))&&n.unshift(o)}else(o=a(y))&&("field"===c?n.unshift(o):u[l]=o)}d&&Object.defineProperty(d,i.name,u),h=!0},Fr=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},Pr=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});let Rr=(()=>{let e,t,r,i,n=[Yt],s=[],a=[];(class{static{t=this}static{const o="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;xr(this,null,r,{kind:"method",name:"getProperty",static:!1,private:!1,access:{has:e=>"getProperty"in e,get:e=>e.getProperty},metadata:o},null,a),xr(this,null,i,{kind:"method",name:"getProperties",static:!1,private:!1,access:{has:e=>"getProperties"in e,get:e=>e.getProperties},metadata:o},null,a),xr(null,e={value:t},n,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),Ir(t,s)}constructor(){Ir(this,a)}async evaluate(e,...t){return e=xt(this.evaluate.name,e),await this.realm.evaluate(e,this,...t)}async evaluateHandle(e,...t){return e=xt(this.evaluateHandle.name,e),await this.realm.evaluateHandle(e,this,...t)}async getProperty(e){return await this.evaluateHandle(((e,t)=>e[t]),e)}async getProperties(){const e=await this.evaluate((e=>{const t=[],r=Object.getOwnPropertyDescriptors(e);for(const e in r)r[e]?.enumerable&&t.push(e);return t})),t=new Map,r=await Promise.all(e.map((e=>this.getProperty(e))));for(const[i,n]of Object.entries(e)){const e={stack:[],error:void 0,hasError:!1};try{const s=Fr(e,r[i],!1);s&&t.set(n,s.move())}catch(t){e.error=t,e.hasError=!0}finally{Pr(e)}}return t}[(r=[Zt()],i=[Zt()],it)](){this.dispose().catch(Et)}[nt](){return this.dispose()}});return t})();var _r=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},Dr=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});class Mr{#re;#ie;#ne;constructor(e,t,r){this.#re=e,this.#ie=t,this.#ne=r}get name(){return this.#re}get initSource(){return this.#ne}async run(e,t,r,i){const n=new st;try{if(!i){const i={stack:[],error:void 0,hasError:!1};try{const s=_r(i,await e.evaluateHandle(((e,t)=>globalThis[e].args.get(t)),this.#re,t),!1),a=await s.getProperties();for(const[e,t]of a)if(e in r)if("node"===t.remoteObject().subtype)r[+e]=t;else n.use(t);else n.use(t)}catch(e){i.error=e,i.hasError=!0}finally{Dr(i)}}await e.evaluate(((e,t,r)=>{const i=globalThis[e].callbacks;i.get(t).resolve(r),i.delete(t)}),this.#re,t,await this.#ie(...r));for(const e of r)e instanceof Rr&&n.use(e)}catch(r){Cr(r)?await e.evaluate(((e,t,r,i)=>{const n=new Error(r);n.stack=i;const s=globalThis[e].callbacks;s.get(t).reject(n),s.delete(t)}),this.#re,t,r.message,r.stack).catch(Et):await e.evaluate(((e,t,r)=>{const i=globalThis[e].callbacks;i.get(t).reject(r),i.delete(t)}),this.#re,t,r).catch(Et)}}}
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/function Or(){let e=0;return()=>++e}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class qr{#se=new Map;#ae=Or();create(e,t,r){const i=new Ar(this.#ae(),e,t);this.#se.set(i.id,i);try{r(i.id)}catch(e){throw i.promise.catch(Et).finally((()=>{this.#se.delete(i.id)})),i.reject(e),e}return i.promise.finally((()=>{this.#se.delete(i.id)}))}reject(e,t,r){const i=this.#se.get(e);i&&this._reject(i,t,r)}rejectRaw(e,t){const r=this.#se.get(e);r&&r.reject(t)}_reject(e,t,r){let i,n;t instanceof bt?(i=t,i.cause=e.error,n=t.message):(i=e.error,n=t),e.reject(Er(i,`Protocol error (${e.label}): ${n}`,r))}resolve(e,t){const r=this.#se.get(e);r&&r.resolve(t)}clear(){for(const e of this.#se.values())this._reject(e,new St("Target closed"));this.#se.clear()}getPendingProtocolErrors(){const e=[];for(const t of this.#se.values())e.push(new Error(`${t.label} timed out. Trace: ${t.error.stack}`));return e}}class Ar{#oe;#ce=new bt;#le=Wt.create();#de;#ue;constructor(e,t,r){this.#oe=e,this.#ue=t,r&&(this.#de=setTimeout((()=>{this.#le.reject(Er(this.#ce,`${t} timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.`))}),r))}resolve(e){clearTimeout(this.#de),this.#le.resolve(e)}reject(e){clearTimeout(this.#de),this.#le.reject(e)}get id(){return this.#oe}get promise(){return this.#le.valueOrThrow()}get error(){return this.#ce}get label(){return this.#ue}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Nr extends Vt{#he;#pe;#se=new qr;#fe;#me;#ye;#ge=!1;#we=!1;constructor(e,t,r,i,n){super(),this.#fe=e,this.#pe=t,this.#he=r,this.#me=i,this.#ge=n}setTarget(e){this.#ye=e}target(){return dt(this.#ye,"Target must exist"),this.#ye}connection(){return this.#fe}get detached(){return this.#fe._closed||this.#we}parentSession(){if(!this.#me)return this;const e=this.#fe?.session(this.#me);return e??void 0}send(e,t,r){return this.detached?Promise.reject(new St(`Protocol error (${e}): Session closed. Most likely the ${this.#pe} has been closed.`)):this.#fe._rawSend(this.#se,e,t,this.#he,r)}onMessage(e){e.id?e.error?this.#ge?this.#se.rejectRaw(e.id,e.error):this.#se.reject(e.id,Tr(e),e.error.message):this.#se.resolve(e.id,e.result):(dt(!e.id),this.emit(e.method,e.params))}async detach(){if(this.detached)throw new Error(`Session already detached. Most likely the ${this.#pe} has been closed.`);await this.#fe.send("Target.detachFromTarget",{sessionId:this.#he}),this.#we=!0}onClosed(){this.#se.clear(),this.#we=!0,this.emit(Kt.Disconnected,void 0)}id(){return this.#he}getPendingProtocolErrors(){return this.#se.getPendingProtocolErrors()}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const jr=ft("puppeteer:protocol:SEND ►"),Lr=ft("puppeteer:protocol:RECV ◀");class Br extends ot{#ve;#be;#ke;#Se;#Ce=new Map;#Ee=!1;#Te=new Set;#se;#ge=!1;constructor(e,t,r=0,i,n=!1){super(),this.#ge=n,this.#se=new qr,this.#ve=e,this.#ke=r,this.#Se=i??18e4,this.#be=t,this.#be.onmessage=this.onMessage.bind(this),this.#be.onclose=this.#Ie.bind(this)}static fromSession(e){return e.connection()}get delay(){return this.#ke}get timeout(){return this.#Se}get _closed(){return this.#Ee}get _sessions(){return this.#Ce}_session(e){return this.#Ce.get(e)||null}session(e){return this._session(e)}url(){return this.#ve}send(e,t,r){return this._rawSend(this.#se,e,t,void 0,r)}_rawSend(e,t,r,i,n){return this.#Ee?Promise.reject(new Error("Protocol error: Connection closed.")):e.create(t,n?.timeout??this.#Se,(e=>{const n=JSON.stringify({method:t,params:r,id:e,sessionId:i});jr(n),this.#be.send(n)}))}async closeBrowser(){await this.send("Browser.close")}async onMessage(e){this.#ke&&await new Promise((e=>setTimeout(e,this.#ke))),Lr(e);const t=JSON.parse(e);if("Target.attachedToTarget"===t.method){const e=t.params.sessionId,r=new Nr(this,t.params.targetInfo.type,e,t.sessionId,this.#ge);this.#Ce.set(e,r),this.emit(Kt.SessionAttached,r);const i=this.#Ce.get(t.sessionId);i&&i.emit(Kt.SessionAttached,r)}else if("Target.detachedFromTarget"===t.method){const e=this.#Ce.get(t.params.sessionId);if(e){e.onClosed(),this.#Ce.delete(t.params.sessionId),this.emit(Kt.SessionDetached,e);const r=this.#Ce.get(t.sessionId);r&&r.emit(Kt.SessionDetached,e)}}if(t.sessionId){const e=this.#Ce.get(t.sessionId);e&&e.onMessage(t)}else t.id?t.error?this.#ge?this.#se.rejectRaw(t.id,t.error):this.#se.reject(t.id,Tr(t),t.error.message):this.#se.resolve(t.id,t.result):this.emit(t.method,t.params)}#Ie(){if(!this.#Ee){this.#Ee=!0,this.#be.onmessage=void 0,this.#be.onclose=void 0,this.#se.clear();for(const e of this.#Ce.values())e.onClosed();this.#Ce.clear(),this.emit(Kt.Disconnected,void 0)}}dispose(){this.#Ie(),this.#be.close()}isAutoAttached(e){return!this.#Te.has(e)}async _createSession(e,t=!0){t||this.#Te.add(e.targetId);const{sessionId:r}=await this.send("Target.attachToTarget",{targetId:e.targetId,flatten:!0});this.#Te.delete(e.targetId);const i=this.#Ce.get(r);if(!i)throw new Error("CDPSession creation failed.");return i}async createSession(e){return await this._createSession(e,!1)}getPendingProtocolErrors(){const e=[];e.push(...this.#se.getPendingProtocolErrors());for(const t of this.#Ce.values())e.push(...t.getPendingProtocolErrors());return e}}function $r(e){return e instanceof St}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Hr{#xe;#Fe;constructor(e){this.#xe=new Kr(e),this.#Fe=new Vr(e)}updateClient(e){this.#xe.updateClient(e),this.#Fe.updateClient(e)}async startJSCoverage(e={}){return await this.#xe.start(e)}async stopJSCoverage(){return await this.#xe.stop()}async startCSSCoverage(e={}){return await this.#Fe.start(e)}async stopCSSCoverage(){return await this.#Fe.stop()}}class Kr{#Pe;#Re=!1;#_e=new Map;#De=new Map;#Me;#Oe=!1;#qe=!1;#Ae=!1;constructor(e){this.#Pe=e}updateClient(e){this.#Pe=e}async start(e={}){dt(!this.#Re,"JSCoverage is already enabled");const{resetOnNavigation:t=!0,reportAnonymousScripts:r=!1,includeRawScriptCoverage:i=!1,useBlockCoverage:n=!0}=e;this.#Oe=t,this.#qe=r,this.#Ae=i,this.#Re=!0,this.#_e.clear(),this.#De.clear(),this.#Me=new st;const s=this.#Me.use(new ot(this.#Pe));s.on("Debugger.scriptParsed",this.#Ne.bind(this)),s.on("Runtime.executionContextsCleared",this.#je.bind(this)),await Promise.all([this.#Pe.send("Profiler.enable"),this.#Pe.send("Profiler.startPreciseCoverage",{callCount:this.#Ae,detailed:n}),this.#Pe.send("Debugger.enable"),this.#Pe.send("Debugger.setSkipAllPauses",{skip:!0})])}#je(){this.#Oe&&(this.#_e.clear(),this.#De.clear())}async#Ne(e){if(!It.isPuppeteerURL(e.url)&&(e.url||this.#qe))try{const t=await this.#Pe.send("Debugger.getScriptSource",{scriptId:e.scriptId});this.#_e.set(e.scriptId,e.url),this.#De.set(e.scriptId,t.scriptSource)}catch(e){Et(e)}}async stop(){dt(this.#Re,"JSCoverage is not enabled"),this.#Re=!1;const e=await Promise.all([this.#Pe.send("Profiler.takePreciseCoverage"),this.#Pe.send("Profiler.stopPreciseCoverage"),this.#Pe.send("Profiler.disable"),this.#Pe.send("Debugger.disable")]);this.#Me?.dispose();const t=[],r=e[0];for(const e of r.result){let r=this.#_e.get(e.scriptId);!r&&this.#qe&&(r="debugger://VM"+e.scriptId);const i=this.#De.get(e.scriptId);if(void 0===i||void 0===r)continue;const n=[];for(const t of e.functions)n.push(...t.ranges);const s=Wr(n);this.#Ae?t.push({url:r,ranges:s,text:i,rawScriptCoverage:e}):t.push({url:r,ranges:s,text:i})}return t}}class Vr{#Pe;#Re=!1;#Le=new Map;#Be=new Map;#$e;#Oe=!1;constructor(e){this.#Pe=e}updateClient(e){this.#Pe=e}async start(e={}){dt(!this.#Re,"CSSCoverage is already enabled");const{resetOnNavigation:t=!0}=e;this.#Oe=t,this.#Re=!0,this.#Le.clear(),this.#Be.clear(),this.#$e=new st;const r=this.#$e.use(new ot(this.#Pe));r.on("CSS.styleSheetAdded",this.#He.bind(this)),r.on("Runtime.executionContextsCleared",this.#je.bind(this)),await Promise.all([this.#Pe.send("DOM.enable"),this.#Pe.send("CSS.enable"),this.#Pe.send("CSS.startRuleUsageTracking")])}#je(){this.#Oe&&(this.#Le.clear(),this.#Be.clear())}async#He(e){const t=e.header;if(t.sourceURL)try{const e=await this.#Pe.send("CSS.getStyleSheetText",{styleSheetId:t.styleSheetId});this.#Le.set(t.styleSheetId,t.sourceURL),this.#Be.set(t.styleSheetId,e.text)}catch(e){Et(e)}}async stop(){dt(this.#Re,"CSSCoverage is not enabled"),this.#Re=!1;const e=await this.#Pe.send("CSS.stopRuleUsageTracking");await Promise.all([this.#Pe.send("CSS.disable"),this.#Pe.send("DOM.disable")]),this.#$e?.dispose();const t=new Map;for(const r of e.ruleUsage){let e=t.get(r.styleSheetId);e||(e=[],t.set(r.styleSheetId,e)),e.push({startOffset:r.startOffset,endOffset:r.endOffset,count:r.used?1:0})}const r=[];for(const e of this.#Le.keys()){const i=this.#Le.get(e);dt(void 0!==i,`Stylesheet URL is undefined (styleSheetId=${e})`);const n=this.#Be.get(e);dt(void 0!==n,`Stylesheet text is undefined (styleSheetId=${e})`);const s=Wr(t.get(e)||[]);r.push({url:i,ranges:s,text:n})}return r}}function Wr(e){const t=[];for(const r of e)t.push({offset:r.startOffset,type:0,range:r}),t.push({offset:r.endOffset,type:1,range:r});t.sort(((e,t)=>{if(e.offset!==t.offset)return e.offset-t.offset;if(e.type!==t.type)return t.type-e.type;const r=e.range.endOffset-e.range.startOffset,i=t.range.endOffset-t.range.startOffset;return 0===e.type?i-r:r-i}));const r=[],i=[];let n=0;for(const e of t){if(r.length&&n<e.offset&&r[r.length-1]>0){const t=i[i.length-1];t&&t.end===n?t.end=e.offset:i.push({start:n,end:e.offset})}n=e.offset,0===e.type?r.push(e.range.count):r.pop()}return i.filter((e=>e.end-e.start>0))}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Ur{#G;#Ke;#Ve;handled=!1;constructor(e,t,r=""){this.#G=e,this.#Ke=t,this.#Ve=r}type(){return this.#G}message(){return this.#Ke}defaultValue(){return this.#Ve}async accept(e){dt(!this.handled,"Cannot accept dialog which is already handled!"),this.handled=!0,await this.handle({accept:!0,text:e})}async dismiss(){dt(!this.handled,"Cannot dismiss dialog which is already handled!"),this.handled=!0,await this.handle({accept:!1})}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class zr extends Ur{#Pe;constructor(e,t,r,i=""){super(t,r,i),this.#Pe=e}async handle(e){await this.#Pe.send("Page.handleJavaScriptDialog",{accept:e.accept,promptText:e.text})}}var Gr=self&&self.__runInitializers||function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},Qr=self&&self.__esDecorate||function(e,t,r,i,n,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?i.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=a(y.get))&&(u.get=o),(o=a(y.set))&&(u.set=o),(o=a(y.init))&&n.unshift(o)}else(o=a(y))&&("field"===c?n.unshift(o):u[l]=o)}d&&Object.defineProperty(d,i.name,u),h=!0},Jr=self&&self.__setFunctionName||function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})};class Xr{#We;#Ue;#ze;constructor(e,t,r){this.#We=e,this.#Ue=t,this.#ze=r,this.#Ue.registerState(this)}async setState(e){this.#We=e,await this.sync()}get state(){return this.#We}async sync(){await Promise.all(this.#Ue.clients().map((e=>this.#ze(e,this.#We))))}}let Yr=(()=>{let e,t,r,i,n,s,a,o,c,l,d,u,h,p,f,m,y,g,w,v,b=[];return class{static{const k="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e=[er],r=[er],n=[er],a=[er],c=[er],d=[er],h=[er],f=[er],y=[er],w=[er],Qr(this,t={value:Jr((async function(e,t){if(!t.viewport)return void await Promise.all([e.send("Emulation.clearDeviceMetricsOverride"),e.send("Emulation.setTouchEmulationEnabled",{enabled:!1})]).catch(Et);const{viewport:r}=t,i=r.isMobile||!1,n=r.width,s=r.height,a=r.deviceScaleFactor??1,o=r.isLandscape?{angle:90,type:"landscapePrimary"}:{angle:0,type:"portraitPrimary"},c=r.hasTouch||!1;await Promise.all([e.send("Emulation.setDeviceMetricsOverride",{mobile:i,width:n,height:s,deviceScaleFactor:a,screenOrientation:o}).catch((e=>{if(!e.message.includes("Target does not support metrics override"))throw e;Et(e)})),e.send("Emulation.setTouchEmulationEnabled",{enabled:c})])}),"#applyViewport")},e,{kind:"method",name:"#applyViewport",static:!1,private:!0,access:{has:e=>#Ge in e,get:e=>e.#Ge},metadata:k},null,b),Qr(this,i={value:Jr((async function(e,t){t.active&&(t.overrides?await e.send("Emulation.setIdleOverride",{isUserActive:t.overrides.isUserActive,isScreenUnlocked:t.overrides.isScreenUnlocked}):await e.send("Emulation.clearIdleOverride"))}),"#emulateIdleState")},r,{kind:"method",name:"#emulateIdleState",static:!1,private:!0,access:{has:e=>#Qe in e,get:e=>e.#Qe},metadata:k},null,b),Qr(this,s={value:Jr((async function(e,t){if(t.active)try{await e.send("Emulation.setTimezoneOverride",{timezoneId:t.timezoneId||""})}catch(e){if(Cr(e)&&e.message.includes("Invalid timezone"))throw new Error(`Invalid timezone ID: ${t.timezoneId}`);throw e}}),"#emulateTimezone")},n,{kind:"method",name:"#emulateTimezone",static:!1,private:!0,access:{has:e=>#Je in e,get:e=>e.#Je},metadata:k},null,b),Qr(this,o={value:Jr((async function(e,t){t.active&&await e.send("Emulation.setEmulatedVisionDeficiency",{type:t.visionDeficiency||"none"})}),"#emulateVisionDeficiency")},a,{kind:"method",name:"#emulateVisionDeficiency",static:!1,private:!0,access:{has:e=>#Xe in e,get:e=>e.#Xe},metadata:k},null,b),Qr(this,l={value:Jr((async function(e,t){t.active&&await e.send("Emulation.setCPUThrottlingRate",{rate:t.factor??1})}),"#emulateCpuThrottling")},c,{kind:"method",name:"#emulateCpuThrottling",static:!1,private:!0,access:{has:e=>#Ye in e,get:e=>e.#Ye},metadata:k},null,b),Qr(this,u={value:Jr((async function(e,t){t.active&&await e.send("Emulation.setEmulatedMedia",{features:t.mediaFeatures})}),"#emulateMediaFeatures")},d,{kind:"method",name:"#emulateMediaFeatures",static:!1,private:!0,access:{has:e=>#Ze in e,get:e=>e.#Ze},metadata:k},null,b),Qr(this,p={value:Jr((async function(e,t){t.active&&await e.send("Emulation.setEmulatedMedia",{media:t.type||""})}),"#emulateMediaType")},h,{kind:"method",name:"#emulateMediaType",static:!1,private:!0,access:{has:e=>#et in e,get:e=>e.#et},metadata:k},null,b),Qr(this,m={value:Jr((async function(e,t){t.active&&await e.send("Emulation.setGeolocationOverride",t.geoLocation?{longitude:t.geoLocation.longitude,latitude:t.geoLocation.latitude,accuracy:t.geoLocation.accuracy}:void 0)}),"#setGeolocation")},f,{kind:"method",name:"#setGeolocation",static:!1,private:!0,access:{has:e=>#tt in e,get:e=>e.#tt},metadata:k},null,b),Qr(this,g={value:Jr((async function(e,t){t.active&&await e.send("Emulation.setDefaultBackgroundColorOverride",{color:t.color})}),"#setDefaultBackgroundColor")},y,{kind:"method",name:"#setDefaultBackgroundColor",static:!1,private:!0,access:{has:e=>#rt in e,get:e=>e.#rt},metadata:k},null,b),Qr(this,v={value:Jr((async function(e,t){t.active&&await e.send("Emulation.setScriptExecutionDisabled",{value:!t.javaScriptEnabled})}),"#setJavaScriptEnabled")},w,{kind:"method",name:"#setJavaScriptEnabled",static:!1,private:!0,access:{has:e=>#it in e,get:e=>e.#it},metadata:k},null,b),k&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:k})}#Pe=Gr(this,b);#nt=!1;#st=!1;#at=[];#ot=new Xr({active:!1},this,this.#Ge);#ct=new Xr({active:!1},this,this.#Qe);#lt=new Xr({active:!1},this,this.#Je);#dt=new Xr({active:!1},this,this.#Xe);#ut=new Xr({active:!1},this,this.#Ye);#ht=new Xr({active:!1},this,this.#Ze);#pt=new Xr({active:!1},this,this.#et);#ft=new Xr({active:!1},this,this.#tt);#mt=new Xr({active:!1},this,this.#rt);#yt=new Xr({javaScriptEnabled:!0,active:!1},this,this.#it);#gt=new Set;constructor(e){this.#Pe=e}updateClient(e){this.#Pe=e,this.#gt.delete(e)}registerState(e){this.#at.push(e)}clients(){return[this.#Pe,...Array.from(this.#gt)]}async registerSpeculativeSession(e){this.#gt.add(e),e.once(Kt.Disconnected,(()=>{this.#gt.delete(e)})),Promise.all(this.#at.map((e=>e.sync().catch(Et))))}get javascriptEnabled(){return this.#yt.state.javaScriptEnabled}async emulateViewport(e){const t=this.#ot.state;if(!e&&!t.active)return!1;await this.#ot.setState(e?{viewport:e,active:!0}:{active:!1});const r=e?.isMobile||!1,i=e?.hasTouch||!1,n=this.#nt!==r||this.#st!==i;return this.#nt=r,this.#st=i,n}get#Ge(){return t.value}async emulateIdleState(e){await this.#ct.setState({active:!0,overrides:e})}get#Qe(){return i.value}get#Je(){return s.value}async emulateTimezone(e){await this.#lt.setState({timezoneId:e,active:!0})}get#Xe(){return o.value}async emulateVisionDeficiency(e){const t=new Set(["none","achromatopsia","blurredVision","deuteranopia","protanopia","reducedContrast","tritanopia"]);dt(!e||t.has(e),`Unsupported vision deficiency: ${e}`),await this.#dt.setState({active:!0,visionDeficiency:e})}get#Ye(){return l.value}async emulateCPUThrottling(e){dt(null===e||e>=1,"Throttling rate should be greater or equal to 1"),await this.#ut.setState({active:!0,factor:e??void 0})}get#Ze(){return u.value}async emulateMediaFeatures(e){if(Array.isArray(e))for(const t of e){const e=t.name;dt(/^(?:prefers-(?:color-scheme|reduced-motion)|color-gamut)$/.test(e),"Unsupported media feature: "+e)}await this.#ht.setState({active:!0,mediaFeatures:e})}get#et(){return p.value}async emulateMediaType(e){dt("screen"===e||"print"===e||void 0===(e??void 0),"Unsupported media type: "+e),await this.#pt.setState({type:e,active:!0})}get#tt(){return m.value}async setGeolocation(e){const{longitude:t,latitude:r,accuracy:i=0}=e;if(t<-180||t>180)throw new Error(`Invalid longitude "${t}": precondition -180 <= LONGITUDE <= 180 failed.`);if(r<-90||r>90)throw new Error(`Invalid latitude "${r}": precondition -90 <= LATITUDE <= 90 failed.`);if(i<0)throw new Error(`Invalid accuracy "${i}": precondition 0 <= ACCURACY failed.`);await this.#ft.setState({active:!0,geoLocation:{longitude:t,latitude:r,accuracy:i}})}get#rt(){return g.value}async resetDefaultBackgroundColor(){await this.#mt.setState({active:!0,color:void 0})}async setTransparentBackgroundColor(){await this.#mt.setState({active:!0,color:{r:0,g:0,b:0,a:0}})}get#it(){return v.value}async setJavaScriptEnabled(e){await this.#yt.setState({active:!0,javaScriptEnabled:e})}}})();
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const Zr=Symbol("_isElementHandle"),ei=new Map;
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/function ti(e){let t=e.toString();try{new Function(`(${t})`)}catch(e){if(e.message.includes("Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive"))return t;let r="function ";t.startsWith("async ")&&(r=`async ${r}`,t=t.substring(6)),t=`${r}${t}`;try{new Function(`(${t})`)}catch{throw new Error("Passed function cannot be serialized!")}}return t}const ri=(e,t)=>{let r=ti(e);for(const[e,i]of Object.entries(t))r=r.replace(new RegExp(`PLACEHOLDER\\(\\s*(?:'${e}'|"${e}")\\s*\\)`,"g"),`(${i})`);return(e=>{let t=ei.get(e);return t||(t=new Function(`return ${e}`)(),ei.set(e,t),t)})(r)};
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var ii=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},ni=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});async function*si(e,t){const r={stack:[],error:void 0,hasError:!1};try{const i=ii(r,await e.evaluateHandle((async(e,t)=>{const r=[];for(;r.length<t;){const t=await e.next();if(t.done)break;r.push(t.value)}return r}),t),!1),n=await i.getProperties(),s=n.values();return ii(r,new st,!1).defer((()=>{for(const e of s){const t={stack:[],error:void 0,hasError:!1};try{ii(t,e,!1)[it]()}catch(e){t.error=e,t.hasError=!0}finally{ni(t)}}})),yield*s,0===n.size}catch(e){r.error=e,r.hasError=!0}finally{ni(r)}}async function*ai(e){const t={stack:[],error:void 0,hasError:!1};try{const r=ii(t,await e.evaluateHandle((e=>async function*(){yield*e}())),!1);yield*async function*(e){let t=20;for(;!(yield*si(e,t));)t<<=1}(r)}catch(e){t.error=e,t.hasError=!0}finally{ni(t)}}
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class oi{static create=e=>new oi(e);#wt;constructor(e){this.#wt=e}async get(e){return await this.#wt(e)}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var ci=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},li=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});class di{static querySelectorAll;static querySelector;static get _querySelector(){if(this.querySelector)return this.querySelector;if(!this.querySelectorAll)throw new Error("Cannot create default `querySelector`.");return this.querySelector=ri((async(e,t,r)=>{const i=PLACEHOLDER("querySelectorAll")(e,t,r);for await(const e of i)return e;return null}),{querySelectorAll:ti(this.querySelectorAll)})}static get _querySelectorAll(){if(this.querySelectorAll)return this.querySelectorAll;if(!this.querySelector)throw new Error("Cannot create default `querySelectorAll`.");return this.querySelectorAll=ri((async function*(e,t,r){const i=PLACEHOLDER("querySelector"),n=await i(e,t,r);n&&(yield n)}),{querySelector:ti(this.querySelector)})}static async*queryAll(e,t){const r={stack:[],error:void 0,hasError:!1};try{const i=ci(r,await e.evaluateHandle(this._querySelectorAll,t,oi.create((e=>e.puppeteerUtil))),!1);yield*ai(i)}catch(e){r.error=e,r.hasError=!0}finally{li(r)}}static async queryOne(e,t){const r={stack:[],error:void 0,hasError:!1};try{const i=ci(r,await e.evaluateHandle(this._querySelector,t,oi.create((e=>e.puppeteerUtil))),!1);return Zr in i?i.move():null}catch(e){r.error=e,r.hasError=!0}finally{li(r)}}static async waitFor(e,t,r){const i={stack:[],error:void 0,hasError:!1};try{let n;const s=ci(i,await(async()=>{if(Zr in e)return n=e.frame,await n.isolatedRealm().adoptHandle(e);n=e})(),!1),{visible:a=!1,hidden:o=!1,timeout:c,signal:l}=r,d=a||o?"raf":r.polling;try{const e={stack:[],error:void 0,hasError:!1};try{l?.throwIfAborted();const r=ci(e,await n.isolatedRealm().waitForFunction((async(e,t,r,i,n)=>{const s=e.createFunction(t),a=await s(i??document,r,e);return e.checkVisibility(a,n)}),{polling:d,root:s,timeout:c,signal:l},oi.create((e=>e.puppeteerUtil)),ti(this._querySelector),t,s,!!a||!o&&void 0),!1);if(l?.aborted)throw l.reason;return Zr in r?await n.mainRealm().transferHandle(r):null}catch(t){e.error=t,e.hasError=!0}finally{li(e)}}catch(e){if(!Cr(e))throw e;if("AbortError"===e.name)throw e;throw e.message=`Waiting for selector \`${t}\` failed: ${e.message}`,e}}catch(e){i.error=e,i.hasError=!0}finally{li(i)}}}class ui{static async*map(e,t){for await(const r of e)yield await t(r)}static async*flatMap(e,t){for await(const r of e)yield*t(r)}static async collect(e){const t=[];for await(const r of e)t.push(r);return t}static async first(e){for await(const t of e)return t}}
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const hi=/\[\s*(?<attribute>\w+)\s*=\s*(?<quote>"|')(?<value>\\.|.*?(?=\k<quote>))\k<quote>\s*\]/g;class pi extends di{static querySelector=async(e,t,{ariaQuerySelector:r})=>await r(e,t);static async*queryAll(e,t){const{name:r,role:i}=(e=>{if(e.length>1e4)throw new Error(`Selector ${e} is too long`);const t={},r=e.replace(hi,((e,r,i,n)=>(dt((e=>["name","role"].includes(e))(r),`Unknown aria attribute "${r}" in selector`),t[r]=n,"")));return r&&!t.name&&(t.name=r),t})(t);yield*e.queryAXTree(r,i)}static queryOne=async(e,t)=>await ui.first(this.queryAll(e,t))??null}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class fi extends di{static querySelector=(e,t,{cssQuerySelector:r})=>r(e,t);static querySelectorAll=(e,t,{cssQuerySelectorAll:r})=>r(e,t)}const mi=new
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
class{#vt=!1;#bt=new Set;append(e){this.#kt((()=>{this.#bt.add(e)}))}pop(e){this.#kt((()=>{this.#bt.delete(e)}))}inject(e,t=!1){(this.#vt||t)&&e(this.#wt()),this.#vt=!1}#kt(e){e(),this.#vt=!0}#wt(){return`(() => {\n const module = {};\n "use strict";var g=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},J=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of B(e))!Y.call(t,n)&&n!==r&&g(t,n,{get:()=>e[n],enumerable:!(o=X(e,n))||o.enumerable});return t};var z=t=>J(g({},"__esModule",{value:!0}),t);var pe={};l(pe,{default:()=>he});module.exports=z(pe);var N=class extends Error{constructor(e,r){super(e,r),this.name=this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}},p=class extends N{};var c=class t{static create(e){return new t(e)}static async race(e){let r=new Set;try{let o=e.map(n=>n instanceof t?(n.#n&&r.add(n),n.valueOrThrow()):n);return await Promise.race(o)}finally{for(let o of r)o.reject(new Error("Timeout cleared"))}}#e=!1;#r=!1;#o;#t;#a=new Promise(e=>{this.#t=e});#n;#i;constructor(e){e&&e.timeout>0&&(this.#i=new p(e.message),this.#n=setTimeout(()=>{this.reject(this.#i)},e.timeout))}#l(e){clearTimeout(this.#n),this.#o=e,this.#t()}resolve(e){this.#r||this.#e||(this.#e=!0,this.#l(e))}reject(e){this.#r||this.#e||(this.#r=!0,this.#l(e))}resolved(){return this.#e}finished(){return this.#e||this.#r}value(){return this.#o}#s;valueOrThrow(){return this.#s||(this.#s=(async()=>{if(await this.#a,this.#r)throw this.#o;return this.#o})()),this.#s}};var L=new Map,F=t=>{let e=L.get(t);return e||(e=new Function(\`return \${t}\`)(),L.set(t,e),e)};var x={};l(x,{ariaQuerySelector:()=>G,ariaQuerySelectorAll:()=>b});var G=(t,e)=>globalThis.__ariaQuerySelector(t,e),b=async function*(t,e){yield*await globalThis.__ariaQuerySelectorAll(t,e)};var E={};l(E,{cssQuerySelector:()=>K,cssQuerySelectorAll:()=>Z});var K=(t,e)=>t.querySelector(e),Z=function(t,e){return t.querySelectorAll(e)};var A={};l(A,{customQuerySelectors:()=>P});var v=class{#e=new Map;register(e,r){if(!r.queryOne&&r.queryAll){let o=r.queryAll;r.queryOne=(n,i)=>{for(let s of o(n,i))return s;return null}}else if(r.queryOne&&!r.queryAll){let o=r.queryOne;r.queryAll=(n,i)=>{let s=o(n,i);return s?[s]:[]}}else if(!r.queryOne||!r.queryAll)throw new Error("At least one query method must be defined.");this.#e.set(e,{querySelector:r.queryOne,querySelectorAll:r.queryAll})}unregister(e){this.#e.delete(e)}get(e){return this.#e.get(e)}clear(){this.#e.clear()}},P=new v;var R={};l(R,{pierceQuerySelector:()=>ee,pierceQuerySelectorAll:()=>te});var ee=(t,e)=>{let r=null,o=n=>{let i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&o(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==n&&!r&&s.matches(e)&&(r=s)}while(!r&&i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r},te=(t,e)=>{let r=[],o=n=>{let i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT);do{let s=i.currentNode;s.shadowRoot&&o(s.shadowRoot),!(s instanceof ShadowRoot)&&s!==n&&s.matches(e)&&r.push(s)}while(i.nextNode())};return t instanceof Document&&(t=t.documentElement),o(t),r};var u=(t,e)=>{if(!t)throw new Error(e)};var y=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=new MutationObserver(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())}),this.#o.observe(this.#r,{childList:!0,subtree:!0,attributes:!0})}async stop(){u(this.#t,"Polling never started."),this.#t.finished()||this.#t.reject(new Error("Polling stopped")),this.#o&&(this.#o.disconnect(),this.#o=void 0)}result(){return u(this.#t,"Polling never started."),this.#t.valueOrThrow()}},w=class{#e;#r;constructor(e){this.#e=e}async start(){let e=this.#r=c.create(),r=await this.#e();if(r){e.resolve(r);return}let o=async()=>{if(e.finished())return;let n=await this.#e();if(!n){window.requestAnimationFrame(o);return}e.resolve(n),await this.stop()};window.requestAnimationFrame(o)}async stop(){u(this.#r,"Polling never started."),this.#r.finished()||this.#r.reject(new Error("Polling stopped"))}result(){return u(this.#r,"Polling never started."),this.#r.valueOrThrow()}},S=class{#e;#r;#o;#t;constructor(e,r){this.#e=e,this.#r=r}async start(){let e=this.#t=c.create(),r=await this.#e();if(r){e.resolve(r);return}this.#o=setInterval(async()=>{let o=await this.#e();o&&(e.resolve(o),await this.stop())},this.#r)}async stop(){u(this.#t,"Polling never started."),this.#t.finished()||this.#t.reject(new Error("Polling stopped")),this.#o&&(clearInterval(this.#o),this.#o=void 0)}result(){return u(this.#t,"Polling never started."),this.#t.valueOrThrow()}};var _={};l(_,{PCombinator:()=>H,pQuerySelector:()=>fe,pQuerySelectorAll:()=>$});var a=class{static async*map(e,r){for await(let o of e)yield await r(o)}static async*flatMap(e,r){for await(let o of e)yield*r(o)}static async collect(e){let r=[];for await(let o of e)r.push(o);return r}static async first(e){for await(let r of e)return r}};var C={};l(C,{textQuerySelectorAll:()=>m});var re=new Set(["checkbox","image","radio"]),oe=t=>t instanceof HTMLSelectElement||t instanceof HTMLTextAreaElement||t instanceof HTMLInputElement&&!re.has(t.type),ne=new Set(["SCRIPT","STYLE"]),f=t=>!ne.has(t.nodeName)&&!document.head?.contains(t),I=new WeakMap,j=t=>{for(;t;)I.delete(t),t instanceof ShadowRoot?t=t.host:t=t.parentNode},W=new WeakSet,se=new MutationObserver(t=>{for(let e of t)j(e.target)}),d=t=>{let e=I.get(t);if(e||(e={full:"",immediate:[]},!f(t)))return e;let r="";if(oe(t))e.full=t.value,e.immediate.push(t.value),t.addEventListener("input",o=>{j(o.target)},{once:!0,capture:!0});else{for(let o=t.firstChild;o;o=o.nextSibling){if(o.nodeType===Node.TEXT_NODE){e.full+=o.nodeValue??"",r+=o.nodeValue??"";continue}r&&e.immediate.push(r),r="",o.nodeType===Node.ELEMENT_NODE&&(e.full+=d(o).full)}r&&e.immediate.push(r),t instanceof Element&&t.shadowRoot&&(e.full+=d(t.shadowRoot).full),W.has(t)||(se.observe(t,{childList:!0,characterData:!0,subtree:!0}),W.add(t))}return I.set(t,e),e};var m=function*(t,e){let r=!1;for(let o of t.childNodes)if(o instanceof Element&&f(o)){let n;o.shadowRoot?n=m(o.shadowRoot,e):n=m(o,e);for(let i of n)yield i,r=!0}r||t instanceof Element&&f(t)&&d(t).full.includes(e)&&(yield t)};var k={};l(k,{checkVisibility:()=>le,pierce:()=>T,pierceAll:()=>O});var ie=["hidden","collapse"],le=(t,e)=>{if(!t)return e===!1;if(e===void 0)return t;let r=t.nodeType===Node.TEXT_NODE?t.parentElement:t,o=window.getComputedStyle(r),n=o&&!ie.includes(o.visibility)&&!ae(r);return e===n?t:!1};function ae(t){let e=t.getBoundingClientRect();return e.width===0||e.height===0}var ce=t=>"shadowRoot"in t&&t.shadowRoot instanceof ShadowRoot;function*T(t){ce(t)?yield t.shadowRoot:yield t}function*O(t){t=T(t).next().value,yield t;let e=[document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT)];for(let r of e){let o;for(;o=r.nextNode();)o.shadowRoot&&(yield o.shadowRoot,e.push(document.createTreeWalker(o.shadowRoot,NodeFilter.SHOW_ELEMENT)))}}var Q={};l(Q,{xpathQuerySelectorAll:()=>q});var q=function*(t,e,r=-1){let n=(t.ownerDocument||document).evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE),i=[],s;for(;(s=n.iterateNext())&&(i.push(s),!(r&&i.length===r)););for(let h=0;h<i.length;h++)s=i[h],yield s,delete i[h]};var ue=/[-\\w\\P{ASCII}*]/u,H=(r=>(r.Descendent=">>>",r.Child=">>>>",r))(H||{}),V=t=>"querySelectorAll"in t,M=class{#e;#r=[];#o=void 0;elements;constructor(e,r){this.elements=[e],this.#e=r,this.#t()}async run(){if(typeof this.#o=="string")switch(this.#o.trimStart()){case":scope":this.#t();break}for(;this.#o!==void 0;this.#t()){let e=this.#o;typeof e=="string"?e[0]&&ue.test(e[0])?this.elements=a.flatMap(this.elements,async function*(r){V(r)&&(yield*r.querySelectorAll(e))}):this.elements=a.flatMap(this.elements,async function*(r){if(!r.parentElement){if(!V(r))return;yield*r.querySelectorAll(e);return}let o=0;for(let n of r.parentElement.children)if(++o,n===r)break;yield*r.parentElement.querySelectorAll(\`:scope>:nth-child(\${o})\${e}\`)}):this.elements=a.flatMap(this.elements,async function*(r){switch(e.name){case"text":yield*m(r,e.value);break;case"xpath":yield*q(r,e.value);break;case"aria":yield*b(r,e.value);break;default:let o=P.get(e.name);if(!o)throw new Error(\`Unknown selector type: \${e.name}\`);yield*o.querySelectorAll(r,e.value)}})}}#t(){if(this.#r.length!==0){this.#o=this.#r.shift();return}if(this.#e.length===0){this.#o=void 0;return}let e=this.#e.shift();switch(e){case">>>>":{this.elements=a.flatMap(this.elements,T),this.#t();break}case">>>":{this.elements=a.flatMap(this.elements,O),this.#t();break}default:this.#r=e,this.#t();break}}},D=class{#e=new WeakMap;calculate(e,r=[]){if(e===null)return r;e instanceof ShadowRoot&&(e=e.host);let o=this.#e.get(e);if(o)return[...o,...r];let n=0;for(let s=e.previousSibling;s;s=s.previousSibling)++n;let i=this.calculate(e.parentNode,[n]);return this.#e.set(e,i),[...i,...r]}},U=(t,e)=>{if(t.length+e.length===0)return 0;let[r=-1,...o]=t,[n=-1,...i]=e;return r===n?U(o,i):r<n?-1:1},de=async function*(t){let e=new Set;for await(let o of t)e.add(o);let r=new D;yield*[...e.values()].map(o=>[o,r.calculate(o)]).sort(([,o],[,n])=>U(o,n)).map(([o])=>o)},$=function(t,e){let r=JSON.parse(e);if(r.some(o=>{let n=0;return o.some(i=>(typeof i=="string"?++n:n=0,n>1))}))throw new Error("Multiple deep combinators found in sequence.");return de(a.flatMap(r,o=>{let n=new M(t,o);return n.run(),n.elements}))},fe=async function(t,e){for await(let r of $(t,e))return r;return null};var me=Object.freeze({...x,...A,...R,..._,...C,...k,...Q,...E,Deferred:c,createFunction:F,createTextContent:d,IntervalPoller:S,isSuitableNodeForTextMatching:f,MutationPoller:y,RAFPoller:w}),he=me;\n\n ${[...this.#bt].map((e=>`(${e})(module.exports.default);`)).join("")}\n return module.exports.default;\n })()`}};
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const yi=new class{#i=new Map;get(e){const t=this.#i.get(e);return t?t[1]:void 0}register(e,t){dt(!this.#i.has(e),`Cannot register over existing handler: ${e}`),dt(/^[a-zA-Z]+$/.test(e),"Custom query handler names may only contain [a-zA-Z]"),dt(t.queryAll||t.queryOne,"At least one query method must be implemented.");const r=class extends di{static querySelectorAll=ri(((e,t,r)=>r.customQuerySelectors.get(PLACEHOLDER("name")).querySelectorAll(e,t)),{name:JSON.stringify(e)});static querySelector=ri(((e,t,r)=>r.customQuerySelectors.get(PLACEHOLDER("name")).querySelector(e,t)),{name:JSON.stringify(e)})},i=ri((e=>{e.customQuerySelectors.register(PLACEHOLDER("name"),{queryAll:PLACEHOLDER("queryAll"),queryOne:PLACEHOLDER("queryOne")})}),{name:JSON.stringify(e),queryAll:t.queryAll?ti(t.queryAll):String(void 0),queryOne:t.queryOne?ti(t.queryOne):String(void 0)}).toString();this.#i.set(e,[i,r]),mi.append(i)}unregister(e){const t=this.#i.get(e);if(!t)throw new Error(`Cannot unregister unknown handler: ${e}`);mi.pop(t[0]),this.#i.delete(e)}names(){return[...this.#i.keys()]}clear(){for(const[e]of this.#i)mi.pop(e);this.#i.clear()}};
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
class gi extends di{static querySelectorAll=(e,t,{pQuerySelectorAll:r})=>r(e,t);static querySelector=(e,t,{pQuerySelector:r})=>r(e,t)}var wi={attribute:/\[\s*(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)\s*(?:(?<operator>\W?=)\s*(?<value>.+?)\s*(\s(?<caseSensitive>[iIsS]))?\s*)?\]/gu,id:/#(?<name>[-\w\P{ASCII}]+)/gu,class:/\.(?<name>[-\w\P{ASCII}]+)/gu,comma:/\s*,\s*/g,combinator:/\s*[\s>+~]\s*/g,"pseudo-element":/::(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,"pseudo-class":/:(?<name>[-\w\P{ASCII}]+)(?:\((?<argument>¶*)\))?/gu,universal:/(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?\*/gu,type:/(?:(?<namespace>\*|[-\w\P{ASCII}]*)\|)?(?<name>[-\w\P{ASCII}]+)/gu},vi=new Set(["combinator","comma"]),bi=e=>{switch(e){case"pseudo-element":case"pseudo-class":return new RegExp(wi[e].source.replace("(?<argument>¶*)","(?<argument>.*)"),"gu");default:return wi[e]}};function ki(e,t){let r=0,i="";for(;t<e.length;t++){const n=e[t];switch(n){case"(":++r;break;case")":--r}if(i+=n,0===r)return i}return i}var Si=/(['"])([^\\\n]+?)\1/g,Ci=/\\./g;function Ei(e,t=wi){if(""===(e=e.trim()))return[];const r=[];e=(e=e.replace(Ci,((e,t)=>(r.push({value:e,offset:t}),"".repeat(e.length))))).replace(Si,((e,t,i,n)=>(r.push({value:e,offset:n}),`${t}${"".repeat(i.length)}${t}`)));{let t,i=0;for(;(t=e.indexOf("(",i))>-1;){const n=ki(e,t);r.push({value:n,offset:t}),e=`${e.substring(0,t)}(${"¶".repeat(n.length-2)})${e.substring(t+n.length)}`,i=t+n.length}}const i=function(e,t=wi){if(!e)return[];const r=[e];for(const[e,i]of Object.entries(t))for(let t=0;t<r.length;t++){const n=r[t];if("string"!=typeof n)continue;i.lastIndex=0;const s=i.exec(n);if(!s)continue;const a=s.index-1,o=[],c=s[0],l=n.slice(0,a+1);l&&o.push(l),o.push({...s.groups,type:e,content:c});const d=n.slice(a+c.length+1);d&&o.push(d),r.splice(t,1,...o)}let i=0;for(const e of r)switch(typeof e){case"string":throw new Error(`Unexpected sequence ${e} found at index ${i}`);case"object":i+=e.content.length,e.pos=[i-e.content.length,i],vi.has(e.type)&&(e.content=e.content.trim()||" ")}return r}(e,t),n=new Set;for(const e of r.reverse())for(const t of i){const{offset:r,value:i}=e;if(!(t.pos[0]<=r&&r+i.length<=t.pos[1]))continue;const{content:s}=t,a=r-t.pos[0];t.content=s.slice(0,a)+i+s.slice(a+i.length),t.content!==s&&n.add(t)}for(const e of n){const t=bi(e.type);if(!t)throw new Error(`Unknown token type: ${e.type}`);t.lastIndex=0;const r=t.exec(e.content);if(!r)throw new Error(`Unable to parse content for ${e.type}: ${e.content}`);Object.assign(e,r.groups)}return i}function Ti(e){if(Array.isArray(e))return e.map((e=>e.content)).join("");switch(e.type){case"list":return e.list.map(Ti).join(",");case"relative":return e.combinator+Ti(e.right);case"complex":return Ti(e.left)+e.combinator+Ti(e.right);case"compound":return e.list.map(Ti).join("");default:return e.content}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/wi.nesting=/&/g,wi.combinator=/\s*(>>>>?|[\s>+~])\s*/g;const Ii=/\\[\s\S]/g;
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const xi={aria:pi,pierce:class extends di{static querySelector=(e,t,{pierceQuerySelector:r})=>r(e,t);static querySelectorAll=(e,t,{pierceQuerySelectorAll:r})=>r(e,t)},xpath:
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
class extends di{static querySelectorAll=(e,t,{xpathQuerySelectorAll:r})=>r(e,t);static querySelector=(e,t,{xpathQuerySelectorAll:r})=>{for(const i of r(e,t,1))return i;return null}},text:
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
class extends di{static querySelectorAll=(e,t,{textQuerySelectorAll:r})=>r(e,t)}},Fi=["=","/"];function Pi(e){for(const t of[yi.names().map((e=>[e,yi.get(e)])),Object.entries(xi)])for(const[r,i]of t)for(const t of Fi){const n=`${r}${t}`;if(e.startsWith(n))return{updatedSelector:e=e.slice(n.length),polling:"aria"===r?"raf":"mutation",QueryHandler:i}}try{const[t,r,i,n]=function(e){let t=!0,r=!1,i=!1;const n=Ei(e);if(0===n.length)return[[],t,i,!1];let s=[],a=[s];const o=[a],c=[];for(const e of n){switch(e.type){case"combinator":switch(e.content){case">>>":t=!1,c.length&&(s.push(Ti(c)),c.splice(0)),s=[],a.push(">>>"),a.push(s);continue;case">>>>":t=!1,c.length&&(s.push(Ti(c)),c.splice(0)),s=[],a.push(">>>>"),a.push(s);continue}break;case"pseudo-element":if(!e.name.startsWith("-p-"))break;t=!1,c.length&&(s.push(Ti(c)),c.splice(0));const n=e.name.slice(3);"aria"===n&&(r=!0),s.push({name:n,value:(l=e.argument??"",l.length<=1?l:('"'!==l[0]&&"'"!==l[0]||!l.endsWith(l[0])||(l=l.slice(1,-1)),l.replace(Ii,(e=>e[1]))))});continue;case"pseudo-class":i=!0;break;case"comma":c.length&&(s.push(Ti(c)),c.splice(0)),s=[],a=[s],o.push(a);continue}c.push(e)}var l;return c.length&&s.push(Ti(c)),[o,t,i,r]}(e);return r?{updatedSelector:e,polling:i?"raf":"mutation",QueryHandler:fi}:{updatedSelector:JSON.stringify(t),polling:n?"raf":"mutation",QueryHandler:gi}}catch{return{updatedSelector:e,polling:"mutation",QueryHandler:fi}}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var Ri,_i=self&&self.__runInitializers||function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},Di=self&&self.__esDecorate||function(e,t,r,i,n,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?i.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=a(y.get))&&(u.get=o),(o=a(y.set))&&(u.set=o),(o=a(y.init))&&n.unshift(o)}else(o=a(y))&&("field"===c?n.unshift(o):u[l]=o)}d&&Object.defineProperty(d,i.name,u),h=!0},Mi=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},Oi=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});!function(e){e.FrameNavigated=Symbol("Frame.FrameNavigated"),e.FrameSwapped=Symbol("Frame.FrameSwapped"),e.LifecycleEvent=Symbol("Frame.LifecycleEvent"),e.FrameNavigatedWithinDocument=Symbol("Frame.FrameNavigatedWithinDocument"),e.FrameDetached=Symbol("Frame.FrameDetached"),e.FrameSwappedByActivation=Symbol("Frame.FrameSwappedByActivation")}(Ri||(Ri={}));const qi=Zt((e=>`Attempted to use detached Frame '${e._id}'.`));let Ai=(()=>{let e,t,r,i,n,s,a,o,c,l,d,u,h,p,f,m,y,g,w,v,b=ot,k=[];return class extends b{static{const S="function"==typeof Symbol&&Symbol.metadata?Object.create(b[Symbol.metadata]??null):void 0;e=[qi],t=[qi],r=[qi],i=[qi],n=[qi],s=[qi],a=[qi],o=[qi],c=[qi],l=[qi],d=[qi],u=[qi],h=[qi],p=[qi],f=[qi],m=[qi],y=[qi],g=[qi],w=[qi],v=[qi],Di(this,null,e,{kind:"method",name:"frameElement",static:!1,private:!1,access:{has:e=>"frameElement"in e,get:e=>e.frameElement},metadata:S},null,k),Di(this,null,t,{kind:"method",name:"evaluateHandle",static:!1,private:!1,access:{has:e=>"evaluateHandle"in e,get:e=>e.evaluateHandle},metadata:S},null,k),Di(this,null,r,{kind:"method",name:"evaluate",static:!1,private:!1,access:{has:e=>"evaluate"in e,get:e=>e.evaluate},metadata:S},null,k),Di(this,null,i,{kind:"method",name:"locator",static:!1,private:!1,access:{has:e=>"locator"in e,get:e=>e.locator},metadata:S},null,k),Di(this,null,n,{kind:"method",name:"$",static:!1,private:!1,access:{has:e=>"$"in e,get:e=>e.$},metadata:S},null,k),Di(this,null,s,{kind:"method",name:"$$",static:!1,private:!1,access:{has:e=>"$$"in e,get:e=>e.$$},metadata:S},null,k),Di(this,null,a,{kind:"method",name:"$eval",static:!1,private:!1,access:{has:e=>"$eval"in e,get:e=>e.$eval},metadata:S},null,k),Di(this,null,o,{kind:"method",name:"$$eval",static:!1,private:!1,access:{has:e=>"$$eval"in e,get:e=>e.$$eval},metadata:S},null,k),Di(this,null,c,{kind:"method",name:"waitForSelector",static:!1,private:!1,access:{has:e=>"waitForSelector"in e,get:e=>e.waitForSelector},metadata:S},null,k),Di(this,null,l,{kind:"method",name:"waitForFunction",static:!1,private:!1,access:{has:e=>"waitForFunction"in e,get:e=>e.waitForFunction},metadata:S},null,k),Di(this,null,d,{kind:"method",name:"content",static:!1,private:!1,access:{has:e=>"content"in e,get:e=>e.content},metadata:S},null,k),Di(this,null,u,{kind:"method",name:"addScriptTag",static:!1,private:!1,access:{has:e=>"addScriptTag"in e,get:e=>e.addScriptTag},metadata:S},null,k),Di(this,null,h,{kind:"method",name:"addStyleTag",static:!1,private:!1,access:{has:e=>"addStyleTag"in e,get:e=>e.addStyleTag},metadata:S},null,k),Di(this,null,p,{kind:"method",name:"click",static:!1,private:!1,access:{has:e=>"click"in e,get:e=>e.click},metadata:S},null,k),Di(this,null,f,{kind:"method",name:"focus",static:!1,private:!1,access:{has:e=>"focus"in e,get:e=>e.focus},metadata:S},null,k),Di(this,null,m,{kind:"method",name:"hover",static:!1,private:!1,access:{has:e=>"hover"in e,get:e=>e.hover},metadata:S},null,k),Di(this,null,y,{kind:"method",name:"select",static:!1,private:!1,access:{has:e=>"select"in e,get:e=>e.select},metadata:S},null,k),Di(this,null,g,{kind:"method",name:"tap",static:!1,private:!1,access:{has:e=>"tap"in e,get:e=>e.tap},metadata:S},null,k),Di(this,null,w,{kind:"method",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type},metadata:S},null,k),Di(this,null,v,{kind:"method",name:"title",static:!1,private:!1,access:{has:e=>"title"in e,get:e=>e.title},metadata:S},null,k),S&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:S})}_id=_i(this,k);_parentId;_name;_hasStartedLoading=!1;constructor(){super()}#St;#Ct(){return this.#St||(this.#St=this.mainRealm().evaluateHandle((()=>document))),this.#St}clearDocumentHandle(){this.#St=void 0}async frameElement(){const e={stack:[],error:void 0,hasError:!1};try{const t=this.parentFrame();if(!t)return null;const r=Mi(e,await t.isolatedRealm().evaluateHandle((()=>document.querySelectorAll("iframe,frame"))),!1);for await(const e of ai(r)){const r={stack:[],error:void 0,hasError:!1};try{const i=Mi(r,e,!1),n=await i.contentFrame();if(n?._id===this._id)return await t.mainRealm().adoptHandle(i)}catch(e){r.error=e,r.hasError=!0}finally{Oi(r)}}return null}catch(t){e.error=t,e.hasError=!0}finally{Oi(e)}}async evaluateHandle(e,...t){return e=xt(this.evaluateHandle.name,e),await this.mainRealm().evaluateHandle(e,...t)}async evaluate(e,...t){return e=xt(this.evaluate.name,e),await this.mainRealm().evaluate(e,...t)}locator(e){return"string"==typeof e?dr.create(this,e):ar.create(this,e)}async $(e){const t=await this.#Ct();return await t.$(e)}async $$(e,t){const r=await this.#Ct();return await r.$$(e,t)}async $eval(e,t,...r){t=xt(this.$eval.name,t);const i=await this.#Ct();return await i.$eval(e,t,...r)}async $$eval(e,t,...r){t=xt(this.$$eval.name,t);const i=await this.#Ct();return await i.$$eval(e,t,...r)}async waitForSelector(e,t={}){const{updatedSelector:r,QueryHandler:i,polling:n}=Pi(e);return await i.waitFor(this,r,{polling:n,...t})}async waitForFunction(e,t={},...r){return await this.mainRealm().waitForFunction(e,t,...r)}async content(){return await this.evaluate((()=>{let e="";for(const t of document.childNodes)if(t===document.documentElement)e+=document.documentElement.outerHTML;else e+=(new XMLSerializer).serializeToString(t);return e}))}async setFrameContent(e){return await this.evaluate((e=>{document.open(),document.write(e),document.close()}),e)}name(){return this._name||""}isDetached(){return this.detached}get disposed(){return this.detached}async addScriptTag(e){let{content:t="",type:r}=e;const{path:i}=e;if(+!!e.url+ +!!i+ +!!t!=1)throw new Error("Exactly one of `url`, `path`, or `content` must be specified.");return i&&(t=await lt.value.fs.promises.readFile(i,"utf8"),t+=`//# sourceURL=${i.replace(/\n/g,"")}`),r=r??"text/javascript",await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle((async({url:e,id:t,type:r,content:i})=>await new Promise(((n,s)=>{const a=document.createElement("script");a.type=r,a.text=i,a.addEventListener("error",(e=>{s(new Error(e.message??"Could not load script"))}),{once:!0}),t&&(a.id=t),e?(a.src=e,a.addEventListener("load",(()=>{n(a)}),{once:!0}),document.head.appendChild(a)):(document.head.appendChild(a),n(a))}))),{...e,type:r,content:t}))}async addStyleTag(e){let{content:t=""}=e;const{path:r}=e;if(+!!e.url+ +!!r+ +!!t!=1)throw new Error("Exactly one of `url`, `path`, or `content` must be specified.");return r&&(t=await lt.value.fs.promises.readFile(r,"utf8"),t+="/*# sourceURL="+r.replace(/\n/g,"")+"*/",e.content=t),await this.mainRealm().transferHandle(await this.isolatedRealm().evaluateHandle((async({url:e,content:t})=>await new Promise(((r,i)=>{let n;if(e){const t=document.createElement("link");t.rel="stylesheet",t.href=e,n=t}else n=document.createElement("style"),n.appendChild(document.createTextNode(t));return n.addEventListener("load",(()=>{r(n)}),{once:!0}),n.addEventListener("error",(e=>{i(new Error(e.message??"Could not load style"))}),{once:!0}),document.head.appendChild(n),n}))),e))}async click(e,t={}){const r={stack:[],error:void 0,hasError:!1};try{const i=Mi(r,await this.$(e),!1);dt(i,`No element found for selector: ${e}`),await i.click(t),await i.dispose()}catch(e){r.error=e,r.hasError=!0}finally{Oi(r)}}async focus(e){const t={stack:[],error:void 0,hasError:!1};try{const r=Mi(t,await this.$(e),!1);dt(r,`No element found for selector: ${e}`),await r.focus()}catch(e){t.error=e,t.hasError=!0}finally{Oi(t)}}async hover(e){const t={stack:[],error:void 0,hasError:!1};try{const r=Mi(t,await this.$(e),!1);dt(r,`No element found for selector: ${e}`),await r.hover()}catch(e){t.error=e,t.hasError=!0}finally{Oi(t)}}async select(e,...t){const r={stack:[],error:void 0,hasError:!1};try{const i=Mi(r,await this.$(e),!1);return dt(i,`No element found for selector: ${e}`),await i.select(...t)}catch(e){r.error=e,r.hasError=!0}finally{Oi(r)}}async tap(e){const t={stack:[],error:void 0,hasError:!1};try{const r=Mi(t,await this.$(e),!1);dt(r,`No element found for selector: ${e}`),await r.tap()}catch(e){t.error=e,t.hasError=!0}finally{Oi(t)}}async type(e,t,r){const i={stack:[],error:void 0,hasError:!1};try{const n=Mi(i,await this.$(e),!1);dt(n,`No element found for selector: ${e}`),await n.type(t,r)}catch(e){i.error=e,i.hasError=!0}finally{Oi(i)}}async title(){return await this.isolatedRealm().evaluate((()=>document.title))}}})();
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Ni{#oe;#Et;#Tt=new WeakMap;constructor(e,t,r){this.#oe=t,this.#Et=r,this.#Tt.set(e,t)}get id(){return this.#oe}get source(){return this.#Et}getIdForFrame(e){return this.#Tt.get(e)}setIdForFrame(e,t){this.#Tt.set(e,t)}}
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class ji{id;name;constructor(e,t){this.id=e,this.name=t}}class Li{#Pe;#It;#oe;#te=!1;#xt=this.#Ft.bind(this);#Pt=new Set;devices=[];constructor(e,t,r){this.#Pe=e,this.#It=t,this.#oe=r.id,this.#Pe.on("DeviceAccess.deviceRequestPrompted",this.#xt),this.#Pe.on("Target.detachedFromTarget",(()=>{this.#Pe=null})),this.#Ft(r)}#Ft(e){if(e.id===this.#oe)for(const t of e.devices){if(this.devices.some((e=>e.id===t.id)))continue;const e=new ji(t.id,t.name);this.devices.push(e);for(const t of this.#Pt)t.filter(e)&&t.promise.resolve(e)}}async waitForDevice(e,t={}){for(const t of this.devices)if(e(t))return t;const{timeout:r=this.#It.timeout()}=t,i=Wt.create({message:`Waiting for \`DeviceRequestPromptDevice\` failed: ${r}ms exceeded`,timeout:r});t.signal&&t.signal.addEventListener("abort",(()=>{i.reject(t.signal?.reason)}),{once:!0});const n={filter:e,promise:i};this.#Pt.add(n);try{return await i.valueOrThrow()}finally{this.#Pt.delete(n)}}async select(e){return dt(null!==this.#Pe,"Cannot select device through detached session!"),dt(this.devices.includes(e),"Cannot select unknown device!"),dt(!this.#te,"Cannot select DeviceRequestPrompt which is already handled!"),this.#Pe.off("DeviceAccess.deviceRequestPrompted",this.#xt),this.#te=!0,await this.#Pe.send("DeviceAccess.selectPrompt",{id:this.#oe,deviceId:e.id})}async cancel(){return dt(null!==this.#Pe,"Cannot cancel prompt through detached session!"),dt(!this.#te,"Cannot cancel DeviceRequestPrompt which is already handled!"),this.#Pe.off("DeviceAccess.deviceRequestPrompted",this.#xt),this.#te=!0,await this.#Pe.send("DeviceAccess.cancelPrompt",{id:this.#oe})}}class Bi{#Pe;#It;#Rt=new Set;constructor(e,t){this.#Pe=e,this.#It=t,this.#Pe.on("DeviceAccess.deviceRequestPrompted",(e=>{this.#_t(e)})),this.#Pe.on("Target.detachedFromTarget",(()=>{this.#Pe=null}))}async waitForDevicePrompt(e={}){dt(null!==this.#Pe,"Cannot wait for device prompt through detached session!");let t;0===this.#Rt.size&&(t=this.#Pe.send("DeviceAccess.enable"));const{timeout:r=this.#It.timeout()}=e,i=Wt.create({message:`Waiting for \`DeviceRequestPrompt\` failed: ${r}ms exceeded`,timeout:r});e.signal&&e.signal.addEventListener("abort",(()=>{i.reject(e.signal?.reason)}),{once:!0}),this.#Rt.add(i);try{const[e]=await Promise.all([i.valueOrThrow(),t]);return e}finally{this.#Rt.delete(i)}}#_t(e){if(!this.#Rt.size)return;dt(null!==this.#Pe);const t=new Li(this.#Pe,this.#It,e);for(const e of this.#Rt)e.resolve(t);this.#Rt.clear()}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var $i=self&&self.__runInitializers||function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},Hi=self&&self.__esDecorate||function(e,t,r,i,n,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?i.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=a(y.get))&&(u.get=o),(o=a(y.set))&&(u.set=o),(o=a(y.init))&&n.unshift(o)}else(o=a(y))&&("field"===c?n.unshift(o):u[l]=o)}d&&Object.defineProperty(d,i.name,u),h=!0},Ki=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},Vi=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i}),Wi=self&&self.__setFunctionName||function(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})};function Ui(e,t){return async function(...t){if(this.realm===this.frame.isolatedRealm())return await e.call(this,...t);let r;this.isolatedHandle?r=this.isolatedHandle:this.isolatedHandle=r=await this.frame.isolatedRealm().adoptHandle(this);const i=await e.call(r,...t);return i===r?this:i instanceof Rr?await this.realm.transferHandle(i):(Array.isArray(i)&&await Promise.all(i.map((async(e,t,r)=>{e instanceof Rr&&(r[t]=await this.realm.transferHandle(e))}))),i instanceof Map&&await Promise.all([...i.entries()].map((async([e,t])=>{t instanceof Rr&&i.set(e,await this.realm.transferHandle(t))}))),i)}}let zi=(()=>{let e,t,r,i,n,s,a,o,c,l,d,u,h,p,f,m,y,g,w,v,b,k,S,C,E,T,I,x,F,P,R,_,D=Rr,M=[];return class O extends D{static{const O="function"==typeof Symbol&&Symbol.metadata?Object.create(D[Symbol.metadata]??null):void 0;e=[Zt(),Ui],t=[Zt(),Ui],r=[Zt(),Ui],i=[Zt(),Ui],n=[Zt()],s=[Ui],o=[Zt(),Ui],c=[Zt(),Ui],l=[Zt(),Ui],d=[Zt(),Ui],u=[Zt(),Ui],h=[Zt(),Ui],p=[Zt(),Ui],f=[Zt(),Ui],m=[Zt(),Ui],y=[Zt(),Ui],g=[Zt(),Ui],w=[Zt(),Ui],v=[Zt(),Ui],b=[Zt(),Ui],k=[Zt(),Ui],S=[Zt(),Ui],C=[Zt(),Ui],E=[Zt(),Ui],T=[Zt(),Ui],I=[Zt(),Ui],x=[Zt(),Ui],F=[Zt(),Ui],P=[Zt(),Ui],R=[Zt(),Ui],_=[Zt(),Ui],Hi(this,null,e,{kind:"method",name:"getProperty",static:!1,private:!1,access:{has:e=>"getProperty"in e,get:e=>e.getProperty},metadata:O},null,M),Hi(this,null,t,{kind:"method",name:"getProperties",static:!1,private:!1,access:{has:e=>"getProperties"in e,get:e=>e.getProperties},metadata:O},null,M),Hi(this,null,r,{kind:"method",name:"jsonValue",static:!1,private:!1,access:{has:e=>"jsonValue"in e,get:e=>e.jsonValue},metadata:O},null,M),Hi(this,null,i,{kind:"method",name:"$",static:!1,private:!1,access:{has:e=>"$"in e,get:e=>e.$},metadata:O},null,M),Hi(this,null,n,{kind:"method",name:"$$",static:!1,private:!1,access:{has:e=>"$$"in e,get:e=>e.$$},metadata:O},null,M),Hi(this,a={value:Wi((async function(e){return await this.#Dt(e)}),"#$$")},s,{kind:"method",name:"#$$",static:!1,private:!0,access:{has:e=>#Mt in e,get:e=>e.#Mt},metadata:O},null,M),Hi(this,null,o,{kind:"method",name:"waitForSelector",static:!1,private:!1,access:{has:e=>"waitForSelector"in e,get:e=>e.waitForSelector},metadata:O},null,M),Hi(this,null,c,{kind:"method",name:"isVisible",static:!1,private:!1,access:{has:e=>"isVisible"in e,get:e=>e.isVisible},metadata:O},null,M),Hi(this,null,l,{kind:"method",name:"isHidden",static:!1,private:!1,access:{has:e=>"isHidden"in e,get:e=>e.isHidden},metadata:O},null,M),Hi(this,null,d,{kind:"method",name:"toElement",static:!1,private:!1,access:{has:e=>"toElement"in e,get:e=>e.toElement},metadata:O},null,M),Hi(this,null,u,{kind:"method",name:"clickablePoint",static:!1,private:!1,access:{has:e=>"clickablePoint"in e,get:e=>e.clickablePoint},metadata:O},null,M),Hi(this,null,h,{kind:"method",name:"hover",static:!1,private:!1,access:{has:e=>"hover"in e,get:e=>e.hover},metadata:O},null,M),Hi(this,null,p,{kind:"method",name:"click",static:!1,private:!1,access:{has:e=>"click"in e,get:e=>e.click},metadata:O},null,M),Hi(this,null,f,{kind:"method",name:"drag",static:!1,private:!1,access:{has:e=>"drag"in e,get:e=>e.drag},metadata:O},null,M),Hi(this,null,m,{kind:"method",name:"dragEnter",static:!1,private:!1,access:{has:e=>"dragEnter"in e,get:e=>e.dragEnter},metadata:O},null,M),Hi(this,null,y,{kind:"method",name:"dragOver",static:!1,private:!1,access:{has:e=>"dragOver"in e,get:e=>e.dragOver},metadata:O},null,M),Hi(this,null,g,{kind:"method",name:"drop",static:!1,private:!1,access:{has:e=>"drop"in e,get:e=>e.drop},metadata:O},null,M),Hi(this,null,w,{kind:"method",name:"dragAndDrop",static:!1,private:!1,access:{has:e=>"dragAndDrop"in e,get:e=>e.dragAndDrop},metadata:O},null,M),Hi(this,null,v,{kind:"method",name:"select",static:!1,private:!1,access:{has:e=>"select"in e,get:e=>e.select},metadata:O},null,M),Hi(this,null,b,{kind:"method",name:"tap",static:!1,private:!1,access:{has:e=>"tap"in e,get:e=>e.tap},metadata:O},null,M),Hi(this,null,k,{kind:"method",name:"touchStart",static:!1,private:!1,access:{has:e=>"touchStart"in e,get:e=>e.touchStart},metadata:O},null,M),Hi(this,null,S,{kind:"method",name:"touchMove",static:!1,private:!1,access:{has:e=>"touchMove"in e,get:e=>e.touchMove},metadata:O},null,M),Hi(this,null,C,{kind:"method",name:"touchEnd",static:!1,private:!1,access:{has:e=>"touchEnd"in e,get:e=>e.touchEnd},metadata:O},null,M),Hi(this,null,E,{kind:"method",name:"focus",static:!1,private:!1,access:{has:e=>"focus"in e,get:e=>e.focus},metadata:O},null,M),Hi(this,null,T,{kind:"method",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type},metadata:O},null,M),Hi(this,null,I,{kind:"method",name:"press",static:!1,private:!1,access:{has:e=>"press"in e,get:e=>e.press},metadata:O},null,M),Hi(this,null,x,{kind:"method",name:"boundingBox",static:!1,private:!1,access:{has:e=>"boundingBox"in e,get:e=>e.boundingBox},metadata:O},null,M),Hi(this,null,F,{kind:"method",name:"boxModel",static:!1,private:!1,access:{has:e=>"boxModel"in e,get:e=>e.boxModel},metadata:O},null,M),Hi(this,null,P,{kind:"method",name:"screenshot",static:!1,private:!1,access:{has:e=>"screenshot"in e,get:e=>e.screenshot},metadata:O},null,M),Hi(this,null,R,{kind:"method",name:"isIntersectingViewport",static:!1,private:!1,access:{has:e=>"isIntersectingViewport"in e,get:e=>e.isIntersectingViewport},metadata:O},null,M),Hi(this,null,_,{kind:"method",name:"scrollIntoView",static:!1,private:!1,access:{has:e=>"scrollIntoView"in e,get:e=>e.scrollIntoView},metadata:O},null,M),O&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:O})}isolatedHandle=$i(this,M);handle;constructor(e){super(),this.handle=e,this[Zr]=!0}get id(){return this.handle.id}get disposed(){return this.handle.disposed}async getProperty(e){return await this.handle.getProperty(e)}async getProperties(){return await this.handle.getProperties()}async evaluate(e,...t){return e=xt(this.evaluate.name,e),await this.handle.evaluate(e,...t)}async evaluateHandle(e,...t){return e=xt(this.evaluateHandle.name,e),await this.handle.evaluateHandle(e,...t)}async jsonValue(){return await this.handle.jsonValue()}toString(){return this.handle.toString()}remoteObject(){return this.handle.remoteObject()}async dispose(){await Promise.all([this.handle.dispose(),this.isolatedHandle?.dispose()])}asElement(){return this}async $(e){const{updatedSelector:t,QueryHandler:r}=Pi(e);return await r.queryOne(this,t)}async $$(e,t){return!1===t?.isolate?await this.#Dt(e):await this.#Mt(e)}get#Mt(){return a.value}async#Dt(e){const{updatedSelector:t,QueryHandler:r}=Pi(e);return await ui.collect(r.queryAll(this,t))}async $eval(e,t,...r){const i={stack:[],error:void 0,hasError:!1};try{t=xt(this.$eval.name,t);const n=Ki(i,await this.$(e),!1);if(!n)throw new Error(`Error: failed to find element matching selector "${e}"`);return await n.evaluate(t,...r)}catch(e){i.error=e,i.hasError=!0}finally{Vi(i)}}async $$eval(e,t,...r){const i={stack:[],error:void 0,hasError:!1};try{t=xt(this.$$eval.name,t);const n=await this.$$(e),s=Ki(i,await this.evaluateHandle(((e,...t)=>t),...n),!1),[a]=await Promise.all([s.evaluate(t,...r),...n.map((e=>e.dispose()))]);return a}catch(e){i.error=e,i.hasError=!0}finally{Vi(i)}}async waitForSelector(e,t={}){const{updatedSelector:r,QueryHandler:i,polling:n}=Pi(e);return await i.waitFor(this,r,{polling:n,...t})}async#Ot(e){return await this.evaluate((async(e,t,r)=>Boolean(t.checkVisibility(e,r))),oi.create((e=>e.puppeteerUtil)),e)}async isVisible(){return await this.#Ot(!0)}async isHidden(){return await this.#Ot(!1)}async toElement(e){const t=await this.evaluate(((e,t)=>e.nodeName===t.toUpperCase()),e);if(!t)throw new Error(`Element is not a(n) \`${e}\` element`);return this}async clickablePoint(e){const t=await this.#qt();if(!t)throw new Error("Node is either not clickable or not an Element");return void 0!==e?{x:t.x+e.x,y:t.y+e.y}:{x:t.x+t.width/2,y:t.y+t.height/2}}async hover(){await this.scrollIntoViewIfNeeded();const{x:e,y:t}=await this.clickablePoint();await this.frame.page().mouse.move(e,t)}async click(e={}){await this.scrollIntoViewIfNeeded();const{x:t,y:r}=await this.clickablePoint(e.offset);await this.frame.page().mouse.click(t,r,e)}async drag(e){await this.scrollIntoViewIfNeeded();const t=this.frame.page();if(t.isDragInterceptionEnabled()){const r=await this.clickablePoint();return e instanceof O&&(e=await e.clickablePoint()),await t.mouse.drag(r,e)}try{t._isDragging||(t._isDragging=!0,await this.hover(),await t.mouse.down()),e instanceof O?await e.hover():await t.mouse.move(e.x,e.y)}catch(e){throw t._isDragging=!1,e}}async dragEnter(e={items:[],dragOperationsMask:1}){const t=this.frame.page();await this.scrollIntoViewIfNeeded();const r=await this.clickablePoint();await t.mouse.dragEnter(r,e)}async dragOver(e={items:[],dragOperationsMask:1}){const t=this.frame.page();await this.scrollIntoViewIfNeeded();const r=await this.clickablePoint();await t.mouse.dragOver(r,e)}async drop(e={items:[],dragOperationsMask:1}){const t=this.frame.page();if("items"in e){await this.scrollIntoViewIfNeeded();const r=await this.clickablePoint();await t.mouse.drop(r,e)}else await e.drag(this),t._isDragging=!1,await t.mouse.up()}async dragAndDrop(e,t){const r=this.frame.page();dt(r.isDragInterceptionEnabled(),"Drag Interception is not enabled!"),await this.scrollIntoViewIfNeeded();const i=await this.clickablePoint(),n=await e.clickablePoint();await r.mouse.dragAndDrop(i,n,t)}async select(...e){for(const t of e)dt(Ft(t),'Values must be strings. Found value "'+t+'" of type "'+typeof t+'"');return await this.evaluate(((e,t)=>{const r=new Set(t);if(!(e instanceof HTMLSelectElement))throw new Error("Element is not a <select> element.");const i=new Set;if(e.multiple)for(const t of e.options)t.selected=r.has(t.value),t.selected&&i.add(t.value);else{for(const t of e.options)t.selected=!1;for(const t of e.options)if(r.has(t.value)){t.selected=!0,i.add(t.value);break}}return e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})),[...i.values()]}),e)}async tap(){await this.scrollIntoViewIfNeeded();const{x:e,y:t}=await this.clickablePoint();await this.frame.page().touchscreen.tap(e,t)}async touchStart(){await this.scrollIntoViewIfNeeded();const{x:e,y:t}=await this.clickablePoint();return await this.frame.page().touchscreen.touchStart(e,t)}async touchMove(e){await this.scrollIntoViewIfNeeded();const{x:t,y:r}=await this.clickablePoint();if(e)return await e.move(t,r);await this.frame.page().touchscreen.touchMove(t,r)}async touchEnd(){await this.scrollIntoViewIfNeeded(),await this.frame.page().touchscreen.touchEnd()}async focus(){await this.evaluate((e=>{if(!(e instanceof HTMLElement))throw new Error("Cannot focus non-HTMLElement");return e.focus()}))}async type(e,t){await this.focus(),await this.frame.page().keyboard.type(e,t)}async press(e,t){await this.focus(),await this.frame.page().keyboard.press(e,t)}async#qt(){const e=await this.evaluate((e=>e instanceof Element?[...e.getClientRects()].map((e=>({x:e.x,y:e.y,width:e.width,height:e.height}))):null));if(!e?.length)return null;await this.#At(e);let t,r=this.frame;for(;t=r?.parentFrame();){const i={stack:[],error:void 0,hasError:!1};try{const n=Ki(i,await r.frameElement(),!1);if(!n)throw new Error("Unsupported frame type");const s=await n.evaluate((e=>{if(0===e.getClientRects().length)return null;const t=e.getBoundingClientRect(),r=window.getComputedStyle(e);return{left:t.left+parseInt(r.paddingLeft,10)+parseInt(r.borderLeftWidth,10),top:t.top+parseInt(r.paddingTop,10)+parseInt(r.borderTopWidth,10)}}));if(!s)return null;for(const t of e)t.x+=s.left,t.y+=s.top;await n.#At(e),r=t}catch(e){i.error=e,i.hasError=!0}finally{Vi(i)}}const i=e.find((e=>e.width>=1&&e.height>=1));return i?{x:i.x,y:i.y,height:i.height,width:i.width}:null}async#At(e){const{documentWidth:t,documentHeight:r}=await this.frame.isolatedRealm().evaluate((()=>({documentWidth:document.documentElement.clientWidth,documentHeight:document.documentElement.clientHeight})));for(const i of e)Gi(i,t,r)}async boundingBox(){const e=await this.evaluate((e=>{if(!(e instanceof Element))return null;if(0===e.getClientRects().length)return null;const t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}));if(!e)return null;const t=await this.#Nt();return t?{x:e.x+t.x,y:e.y+t.y,height:e.height,width:e.width}:null}async boxModel(){const e=await this.evaluate((e=>{if(!(e instanceof Element))return null;if(0===e.getClientRects().length)return null;const t=e.getBoundingClientRect(),r=window.getComputedStyle(e),i={padding:{left:parseInt(r.paddingLeft,10),top:parseInt(r.paddingTop,10),right:parseInt(r.paddingRight,10),bottom:parseInt(r.paddingBottom,10)},margin:{left:-parseInt(r.marginLeft,10),top:-parseInt(r.marginTop,10),right:-parseInt(r.marginRight,10),bottom:-parseInt(r.marginBottom,10)},border:{left:parseInt(r.borderLeft,10),top:parseInt(r.borderTop,10),right:parseInt(r.borderRight,10),bottom:parseInt(r.borderBottom,10)}},n=[{x:t.left,y:t.top},{x:t.left+t.width,y:t.top},{x:t.left+t.width,y:t.top+t.height},{x:t.left,y:t.top+t.height}],s=a(n,i.border);return{content:a(s,i.padding),padding:s,border:n,margin:a(n,i.margin),width:t.width,height:t.height};function a(e,t){return[{x:e[0].x+t.left,y:e[0].y+t.top},{x:e[1].x-t.right,y:e[1].y+t.top},{x:e[2].x-t.right,y:e[2].y-t.bottom},{x:e[3].x+t.left,y:e[3].y-t.bottom}]}}));if(!e)return null;const t=await this.#Nt();if(!t)return null;for(const r of["content","padding","border","margin"])for(const i of e[r])i.x+=t.x,i.y+=t.y;return e}async#Nt(){const e={x:0,y:0};let t,r=this.frame;for(;t=r?.parentFrame();){const i={stack:[],error:void 0,hasError:!1};try{const n=Ki(i,await r.frameElement(),!1);if(!n)throw new Error("Unsupported frame type");const s=await n.evaluate((e=>{if(0===e.getClientRects().length)return null;const t=e.getBoundingClientRect(),r=window.getComputedStyle(e);return{left:t.left+parseInt(r.paddingLeft,10)+parseInt(r.borderLeftWidth,10),top:t.top+parseInt(r.paddingTop,10)+parseInt(r.borderTopWidth,10)}}));if(!s)return null;e.x+=s.left,e.y+=s.top,r=t}catch(e){i.error=e,i.hasError=!0}finally{Vi(i)}}return e}async screenshot(e={}){const{scrollIntoView:t=!0,clip:r}=e,i=this.frame.page();t&&await this.scrollIntoViewIfNeeded();const n=await this.#jt(),[s,a]=await this.evaluate((()=>{if(!window.visualViewport)throw new Error("window.visualViewport is not supported.");return[window.visualViewport.pageLeft,window.visualViewport.pageTop]}));return n.x+=s,n.y+=a,r&&(n.x+=r.x,n.y+=r.y,n.height=r.height,n.width=r.width),await i.screenshot({...e,clip:n})}async#jt(){const e=await this.boundingBox();return dt(e,"Node is either not visible or not an HTMLElement"),dt(0!==e.width,"Node has 0 width."),dt(0!==e.height,"Node has 0 height."),e}async assertConnectedElement(){const e=await this.evaluate((async e=>e.isConnected?e.nodeType!==Node.ELEMENT_NODE?"Node is not of type HTMLElement":void 0:"Node is detached from document"));if(e)throw new Error(e)}async scrollIntoViewIfNeeded(){await this.isIntersectingViewport({threshold:1})||await this.scrollIntoView()}async isIntersectingViewport(e={}){const t={stack:[],error:void 0,hasError:!1};try{await this.assertConnectedElement();const r=await this.#Lt(),i=Ki(t,r&&await r.#Bt(),!1);return await(i??this).evaluate((async(e,t)=>{const r=await new Promise((t=>{const r=new IntersectionObserver((e=>{t(e[0].intersectionRatio),r.disconnect()}));r.observe(e)}));return 1===t?1===r:r>t}),e.threshold??0)}catch(e){t.error=e,t.hasError=!0}finally{Vi(t)}}async scrollIntoView(){await this.assertConnectedElement(),await this.evaluate((async e=>{e.scrollIntoView({block:"center",inline:"center",behavior:"instant"})}))}async#Lt(){return await this.evaluate((e=>e instanceof SVGElement))?this:null}async#Bt(){return await this.evaluateHandle((e=>e instanceof SVGSVGElement?e:e.ownerSVGElement))}}})();function Gi(e,t,r){e.width=Math.max(e.x>=0?Math.min(t-e.x,e.width):Math.min(t,e.width+e.x),0),e.height=Math.max(e.y>=0?Math.min(r-e.y,e.height):Math.min(r,e.height+e.y),0)}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/function Qi(e){let t,r;if(e.exception){if(!("object"===e.exception.type&&"error"===e.exception.subtype||e.exception.objectId))return Xi(e.exception);{const i=Ji(e);t=i.name,r=i.message}}else t="Error",r=e.text;const i=r.split("\n").length,n=new Error(r);n.name=t;const s=n.stack.split("\n"),a=s.splice(0,i);if(s.shift(),e.stackTrace&&s.length<Error.stackTraceLimit)for(const t of e.stackTrace.callFrames.reverse()){if(It.isPuppeteerURL(t.url)&&t.url!==It.INTERNAL_URL){const e=It.parse(t.url);s.unshift(` at ${t.functionName||e.functionName} (${e.functionName} at ${e.siteString}, <anonymous>:${t.lineNumber}:${t.columnNumber})`)}else s.push(` at ${t.functionName||"<anonymous>"} (${t.url}:${t.lineNumber}:${t.columnNumber})`);if(s.length>=Error.stackTraceLimit)break}return n.stack=[...a,...s].join("\n"),n}const Ji=e=>{let t,r="";const i=e.exception?.description?.split("\n at ")??[],n=Math.min(e.stackTrace?.callFrames.length??0,i.length-1);return i.splice(-n,n),e.exception?.className&&(r=e.exception.className),t=i.join("\n"),r&&t.startsWith(`${r}: `)&&(t=t.slice(r.length+2)),{message:t,name:r}};function Xi(e){if(dt(!e.objectId,"Cannot extract value when objectId is given"),e.unserializableValue){if("bigint"===e.type)return BigInt(e.unserializableValue.replace("n",""));switch(e.unserializableValue){case"-0":return-0;case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error("Unsupported unserializable value: "+e.unserializableValue)}}return e.value}function Yi(e,t,r){globalThis[t]||Object.assign(globalThis,{[t](...i){const n=globalThis[t];n.args??=new Map,n.callbacks??=new Map;const s=(n.lastSeq??0)+1;return n.lastSeq=s,n.args.set(s,i),globalThis[r+t](JSON.stringify({type:e,name:t,seq:s,args:i,isTrivial:!i.some((e=>e instanceof Node))})),new Promise(((e,t)=>{n.callbacks.set(s,{resolve(t){n.args.delete(s),e(t)},reject(e){n.args.delete(s),t(e)}})}))}})}const Zi="puppeteer_";
/**
* @license
* Copyright 2019 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
class en extends Rr{#e=!1;#$t;#Ht;constructor(e,t){super(),this.#Ht=e,this.#$t=t}get disposed(){return this.#e}get realm(){return this.#Ht}get client(){return this.realm.environment.client}async jsonValue(){if(!this.#$t.objectId)return Xi(this.#$t);const e=await this.evaluate((e=>e));if(void 0===e)throw new Error("Could not serialize referenced object");return e}asElement(){return null}async dispose(){this.#e||(this.#e=!0,await tn(this.client,this.#$t))}toString(){if(!this.#$t.objectId)return"JSHandle:"+Xi(this.#$t);return"JSHandle@"+(this.#$t.subtype||this.#$t.type)}get id(){return this.#$t.objectId}remoteObject(){return this.#$t}async getProperties(){const e=await this.client.send("Runtime.getProperties",{objectId:this.#$t.objectId,ownProperties:!0}),t=new Map;for(const r of e.result)r.enumerable&&r.value&&t.set(r.name,this.#Ht.createCdpHandle(r.value));return t}}async function tn(e,t){t.objectId&&await e.send("Runtime.releaseObject",{objectId:t.objectId}).catch((e=>{Et(e)}))}
/**
* @license
* Copyright 2019 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var rn=self&&self.__runInitializers||function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},nn=self&&self.__esDecorate||function(e,t,r,i,n,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?i.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=a(y.get))&&(u.get=o),(o=a(y.set))&&(u.set=o),(o=a(y.init))&&n.unshift(o)}else(o=a(y))&&("field"===c?n.unshift(o):u[l]=o)}d&&Object.defineProperty(d,i.name,u),h=!0};const sn=new Set(["StaticText","InlineTextBox"]);let an=(()=>{let e,t,r,i,n=zi,s=[];return class extends n{static{const a="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;e=[Zt()],t=[Zt(),Ui],r=[Zt(),Ui],i=[Zt()],nn(this,null,e,{kind:"method",name:"contentFrame",static:!1,private:!1,access:{has:e=>"contentFrame"in e,get:e=>e.contentFrame},metadata:a},null,s),nn(this,null,t,{kind:"method",name:"scrollIntoView",static:!1,private:!1,access:{has:e=>"scrollIntoView"in e,get:e=>e.scrollIntoView},metadata:a},null,s),nn(this,null,r,{kind:"method",name:"uploadFile",static:!1,private:!1,access:{has:e=>"uploadFile"in e,get:e=>e.uploadFile},metadata:a},null,s),nn(this,null,i,{kind:"method",name:"autofill",static:!1,private:!1,access:{has:e=>"autofill"in e,get:e=>e.autofill},metadata:a},null,s),a&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}#Kt=rn(this,s);constructor(e,t){super(new en(e,t))}get realm(){return this.handle.realm}get client(){return this.handle.client}remoteObject(){return this.handle.remoteObject()}get#Vt(){return this.frame._frameManager}get frame(){return this.realm.environment}async contentFrame(){const e=await this.client.send("DOM.describeNode",{objectId:this.id});return"string"!=typeof e.node.frameId?null:this.#Vt.frame(e.node.frameId)}async scrollIntoView(){await this.assertConnectedElement();try{await this.client.send("DOM.scrollIntoViewIfNeeded",{objectId:this.id})}catch(e){Et(e),await super.scrollIntoView()}}async uploadFile(...e){const t=await this.evaluate((e=>e.multiple));dt(e.length<=1||t,"Multiple file uploads only work with <input type=file multiple>");const r=lt.value.path;if(r&&(e=e.map((e=>r.win32.isAbsolute(e)||r.posix.isAbsolute(e)?e:r.resolve(e)))),0===e.length)return void await this.evaluate((e=>{e.files=(new DataTransfer).files,e.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}));const{node:{backendNodeId:i}}=await this.client.send("DOM.describeNode",{objectId:this.id});await this.client.send("DOM.setFileInputFiles",{objectId:this.id,files:e,backendNodeId:i})}async autofill(e){const t=(await this.client.send("DOM.describeNode",{objectId:this.handle.id})).node.backendNodeId,r=this.frame._id;await this.client.send("Autofill.trigger",{fieldId:t,frameId:r,card:e.creditCard})}async*queryAXTree(e,t){const{nodes:r}=await this.client.send("Accessibility.queryAXTree",{objectId:this.id,accessibleName:e,role:t}),i=r.filter((e=>!e.ignored&&(!!e.role&&!sn.has(e.role.value))));return yield*ui.map(i,(e=>this.realm.adoptBackendNode(e.backendDOMNodeId)))}async backendNodeId(){if(this.#Kt)return this.#Kt;const{node:e}=await this.client.send("DOM.describeNode",{objectId:this.handle.id});return this.#Kt=e.backendNodeId,this.#Kt}}})();
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var on=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},cn=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});const ln=new Mr("__ariaQuerySelector",pi.queryOne,""),dn=new Mr("__ariaQuerySelectorAll",(async(e,t)=>{const r=pi.queryAll(e,t);return await e.realm.evaluateHandle(((...e)=>e),...await ui.collect(r))}),"");class un extends ot{#Pe;#Ht;#oe;#re;#Wt=new st;constructor(e,t,r){super(),this.#Pe=e,this.#Ht=r,this.#oe=t.id,t.name&&(this.#re=t.name);const i=this.#Wt.use(new ot(this.#Pe));i.on("Runtime.bindingCalled",this.#Ut.bind(this)),i.on("Runtime.executionContextDestroyed",(async e=>{e.executionContextId===this.#oe&&this[it]()})),i.on("Runtime.executionContextsCleared",(async()=>{this[it]()})),i.on("Runtime.consoleAPICalled",this.#zt.bind(this)),i.on(Kt.Disconnected,(()=>{this[it]()}))}#Gt=new Map;#g=new Ut;async#Qt(e){const t={stack:[],error:void 0,hasError:!1};try{if(this.#Gt.has(e.name))return;on(t,await this.#g.acquire(),!1);try{await this.#Pe.send("Runtime.addBinding",this.#re?{name:Zi+e.name,executionContextName:this.#re}:{name:Zi+e.name,executionContextId:this.#oe}),await this.evaluate(Yi,"internal",e.name,Zi),this.#Gt.set(e.name,e)}catch(e){if(e instanceof Error){if(e.message.includes("Execution context was destroyed"))return;if(e.message.includes("Cannot find context with specified id"))return}Et(e)}}catch(e){t.error=e,t.hasError=!0}finally{cn(t)}}async#Ut(e){if(e.executionContextId!==this.#oe)return;let t;try{t=JSON.parse(e.payload)}catch{return}const{type:r,name:i,seq:n,args:s,isTrivial:a}=t;if("internal"===r)if(this.#Gt.has(i))try{const e=this.#Gt.get(i);await(e?.run(this,n,s,a))}catch(e){Et(e)}else this.emit("bindingcalled",e);else this.emit("bindingcalled",e)}get id(){return this.#oe}#zt(e){e.executionContextId===this.#oe&&this.emit("consoleapicalled",e)}#Jt=!1;#Xt;get puppeteerUtil(){let e=Promise.resolve();return this.#Jt||(e=Promise.all([this.#Yt(ln),this.#Yt(dn)]),this.#Jt=!0),mi.inject((t=>{this.#Xt&&this.#Xt.then((e=>{e.dispose()})),this.#Xt=e.then((()=>this.evaluateHandle(t)))}),!this.#Xt),this.#Xt}async#Yt(e){try{await this.#Qt(e)}catch(e){Et(e)}}async evaluate(e,...t){return await this.#Zt(!0,e,...t)}async evaluateHandle(e,...t){return await this.#Zt(!1,e,...t)}async#Zt(e,t,...r){const i=`//# sourceURL=${(e=>{if(Object.prototype.hasOwnProperty.call(e,Tt))return e[Tt]})(t)?.toString()??It.INTERNAL_URL}`;if(Ft(t)){const r=this.#oe,n=t,s=Ot.test(n)?n:`${n}\n${i}\n`,{exceptionDetails:a,result:o}=await this.#Pe.send("Runtime.evaluate",{expression:s,contextId:r,returnByValue:e,awaitPromise:!0,userGesture:!0}).catch(hn);if(a)throw Qi(a);return e?Xi(o):this.#Ht.createCdpHandle(o)}const n=ti(t),s=Ot.test(n)?n:`${n}\n${i}\n`;let a;try{a=this.#Pe.send("Runtime.callFunctionOn",{functionDeclaration:s,executionContextId:this.#oe,arguments:r.some((e=>e instanceof oi))?await Promise.all(r.map((e=>async function(e,t){t instanceof oi&&(t=await t.get(e));return l(e,t)}(this,e)))):r.map((e=>l(this,e))),returnByValue:e,awaitPromise:!0,userGesture:!0})}catch(e){throw e instanceof TypeError&&e.message.startsWith("Converting circular structure to JSON")&&(e.message+=" Recursive objects are not allowed."),e}const{exceptionDetails:o,result:c}=await a.catch(hn);if(o)throw Qi(o);return e?Xi(c):this.#Ht.createCdpHandle(c);function l(e,t){if("bigint"==typeof t)return{unserializableValue:`${t.toString()}n`};if(Object.is(t,-0))return{unserializableValue:"-0"};if(Object.is(t,1/0))return{unserializableValue:"Infinity"};if(Object.is(t,-1/0))return{unserializableValue:"-Infinity"};if(Object.is(t,NaN))return{unserializableValue:"NaN"};const r=t&&(t instanceof en||t instanceof an)?t:null;if(r){if(r.realm!==e.#Ht)throw new Error("JSHandles can be evaluated only in the context they were created!");if(r.disposed)throw new Error("JSHandle is disposed!");return r.remoteObject().unserializableValue?{unserializableValue:r.remoteObject().unserializableValue}:r.remoteObject().objectId?{objectId:r.remoteObject().objectId}:{value:r.remoteObject().value}}return{value:t}}}[it](){this.#Wt.dispose(),this.emit("disposed",void 0)}}const hn=e=>{if(e.message.includes("Object reference chain is too long"))return{result:{type:"undefined"}};if(e.message.includes("Object couldn't be returned by value"))return{result:{type:"undefined"}};if(e.message.endsWith("Cannot find context with specified id")||e.message.endsWith("Inspected target navigated or closed"))throw new Error("Execution context was destroyed, most likely because of a navigation.");throw e};
/**
* @license
* Copyright 2018 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var pn,fn=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},mn=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});class yn{#er;#tr;constructor(e,t=""){this.#er=e,this.#tr=t}async snapshot(e={}){const{interestingOnly:t=!0,root:r=null,includeIframes:i=!1}=e,{nodes:n}=await this.#er.environment.client.send("Accessibility.getFullAXTree",{frameId:this.#tr});let s;if(r){const{node:e}=await this.#er.environment.client.send("DOM.describeNode",{objectId:r.id});s=e.backendNodeId}const a=gn.createTree(this.#er,n),o=async t=>{if("Iframe"===t.payload.role?.value){const r={stack:[],error:void 0,hasError:!1};try{if(!t.payload.backendDOMNodeId)return;const i=fn(r,await this.#er.adoptBackendNode(t.payload.backendDOMNodeId),!1);if(!i||!("contentFrame"in i))return;const n=await i.contentFrame();if(!n)return;const s=await n.accessibility.snapshot(e);t.iframeSnapshot=s??void 0}catch(e){r.error=e,r.hasError=!0}finally{mn(r)}}for(const e of t.children)await o(e)};let c=a;if(!a)return null;if(i&&await o(a),s&&(c=a.find((e=>e.payload.backendDOMNodeId===s))),!c)return null;if(!t)return this.serializeTree(c)[0]??null;const l=new Set;return this.collectInterestingNodes(l,a,!1),l.has(c)?this.serializeTree(c,l)[0]??null:null}serializeTree(e,t){const r=[];for(const i of e.children)r.push(...this.serializeTree(i,t));if(t&&!t.has(e))return r;const i=e.serialize();return r.length&&(i.children=r),e.iframeSnapshot&&(i.children||(i.children=[]),i.children.push(e.iframeSnapshot)),[i]}collectInterestingNodes(e,t,r){if((t.isInteresting(r)||t.iframeSnapshot)&&e.add(t),!t.isLeafNode()){r=r||t.isControl();for(const i of t.children)this.collectInterestingNodes(e,i,r)}}}class gn{payload;children=[];iframeSnapshot;#rr=!1;#ir=!1;#nr=!1;#sr=!1;#re;#ar;#or;#cr;#er;constructor(e,t){this.payload=t,this.#re=this.payload.name?this.payload.name.value:"",this.#ar=this.payload.role?this.payload.role.value:"Unknown",this.#or=this.payload.ignored,this.#er=e;for(const e of this.payload.properties||[])"editable"===e.name&&(this.#rr="richtext"===e.value.value,this.#ir=!0),"focusable"===e.name&&(this.#nr=e.value.value),"hidden"===e.name&&(this.#sr=e.value.value)}#lr(){return!this.#rr&&(!!this.#ir||("textbox"===this.#ar||"searchbox"===this.#ar))}#dr(){const e=this.#ar;return"LineBreak"===e||"text"===e||"InlineTextBox"===e||"StaticText"===e}#ur(){if(void 0===this.#cr){this.#cr=!1;for(const e of this.children)if(e.#nr||e.#ur()){this.#cr=!0;break}}return this.#cr}find(e){if(e(this))return this;for(const t of this.children){const r=t.find(e);if(r)return r}return null}isLeafNode(){if(!this.children.length)return!0;if(this.#lr()||this.#dr())return!0;switch(this.#ar){case"doc-cover":case"graphics-symbol":case"img":case"image":case"Meter":case"scrollbar":case"slider":case"separator":case"progressbar":return!0}return!this.#ur()&&(!(!this.#nr||!this.#re)||!("heading"!==this.#ar||!this.#re))}isControl(){switch(this.#ar){case"button":case"checkbox":case"ColorWell":case"combobox":case"DisclosureTriangle":case"listbox":case"menu":case"menubar":case"menuitem":case"menuitemcheckbox":case"menuitemradio":case"radio":case"scrollbar":case"searchbox":case"slider":case"spinbutton":case"switch":case"tab":case"textbox":case"tree":case"treeitem":return!0;default:return!1}}isInteresting(e){return"Ignored"!==this.#ar&&!this.#sr&&!this.#or&&(!(!this.#nr&&!this.#rr)||(!!this.isControl()||!e&&(this.isLeafNode()&&!!this.#re)))}serialize(){const e=new Map;for(const t of this.payload.properties||[])e.set(t.name.toLowerCase(),t.value.value);this.payload.name&&e.set("name",this.payload.name.value),this.payload.value&&e.set("value",this.payload.value.value),this.payload.description&&e.set("description",this.payload.description.value);const t={role:this.#ar,elementHandle:async()=>this.payload.backendDOMNodeId?await this.#er.adoptBackendNode(this.payload.backendDOMNodeId):null},r=["name","value","description","keyshortcuts","roledescription","valuetext"];for(const n of r)e.has(n)&&(t[n]=(i=n,e.get(i)));var i;const n=["disabled","expanded","focused","modal","multiline","multiselectable","readonly","required","selected"],s=t=>e.get(t);for(const e of n){if("focused"===e&&"RootWebArea"===this.#ar)continue;s(e)&&(t[e]=s(e))}const a=["checked","pressed"];for(const r of a){if(!e.has(r))continue;const i=e.get(r);t[r]="mixed"===i?"mixed":"true"===i}const o=["level","valuemax","valuemin"],c=t=>e.get(t);for(const r of o)e.has(r)&&(t[r]=c(r));const l=["autocomplete","haspopup","invalid","orientation"],d=t=>e.get(t);for(const e of l){const r=d(e);r&&"false"!==r&&(t[e]=d(e))}return t}static createTree(e,t){const r=new Map;for(const i of t)r.set(i.nodeId,new gn(e,i));for(const e of r.values())for(const t of e.payload.childIds||[]){const i=r.get(t);i&&e.children.push(i)}return r.values().next().value??null}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/!function(e){e.FrameAttached=Symbol("FrameManager.FrameAttached"),e.FrameNavigated=Symbol("FrameManager.FrameNavigated"),e.FrameDetached=Symbol("FrameManager.FrameDetached"),e.FrameSwapped=Symbol("FrameManager.FrameSwapped"),e.LifecycleEvent=Symbol("FrameManager.LifecycleEvent"),e.FrameNavigatedWithinDocument=Symbol("FrameManager.FrameNavigatedWithinDocument"),e.ConsoleApiCalled=Symbol("FrameManager.ConsoleApiCalled"),e.BindingCalled=Symbol("FrameManager.BindingCalled")}(pn||(pn={}));
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
class wn{#Ht;#hr;#pr;#ie;#J;#Se;#f;#fr=Wt.create();#mr;#yr;#gr=[];constructor(e,t,r,...i){if(this.#Ht=e,this.#hr=t.polling,this.#pr=t.root,this.#yr=t.signal,this.#yr?.addEventListener("abort",this.#wr,{once:!0}),"string"==typeof r)this.#ie=`() => {return (${r});}`;else this.#ie=ti(r);this.#J=i,this.#Ht.taskManager.add(this),t.timeout&&(this.#f=new wt(`Waiting failed: ${t.timeout}ms exceeded`),this.#Se=setTimeout((()=>{this.terminate(this.#f)}),t.timeout)),this.rerun()}get result(){return this.#fr.valueOrThrow()}async rerun(){for(const e of this.#gr)e.abort();this.#gr.length=0;const e=new AbortController;this.#gr.push(e);try{switch(this.#hr){case"raf":this.#mr=await this.#Ht.evaluateHandle((({RAFPoller:e,createFunction:t},r,...i)=>{const n=t(r);return new e((()=>n(...i)))}),oi.create((e=>e.puppeteerUtil)),this.#ie,...this.#J);break;case"mutation":this.#mr=await this.#Ht.evaluateHandle((({MutationPoller:e,createFunction:t},r,i,...n)=>{const s=t(i);return new e((()=>s(...n)),r||document)}),oi.create((e=>e.puppeteerUtil)),this.#pr,this.#ie,...this.#J);break;default:this.#mr=await this.#Ht.evaluateHandle((({IntervalPoller:e,createFunction:t},r,i,...n)=>{const s=t(i);return new e((()=>s(...n)),r)}),oi.create((e=>e.puppeteerUtil)),this.#hr,this.#ie,...this.#J)}await this.#mr.evaluate((e=>{e.start()}));const e=await this.#mr.evaluateHandle((e=>e.result()));this.#fr.resolve(e),await this.terminate()}catch(t){if(e.signal.aborted)return;const r=this.getBadError(t);r&&await this.terminate(r)}}async terminate(e){if(this.#Ht.taskManager.delete(this),this.#yr?.removeEventListener("abort",this.#wr),clearTimeout(this.#Se),e&&!this.#fr.finished()&&this.#fr.reject(e),this.#mr)try{await this.#mr.evaluate((async e=>{await e.stop()})),this.#mr&&(await this.#mr.dispose(),this.#mr=void 0)}catch{}}getBadError(e){if(Cr(e)){if(e.message.includes("Execution context is not available in detached frame"))return new Error("Waiting failed: Frame detached");if(e.message.includes("Execution context was destroyed"))return;if(e.message.includes("Cannot find context with specified id"))return;if(e.message.includes("DiscardedBrowsingContextError"))return;return e}return new Error("WaitTask failed with an error",{cause:e})}#wr=()=>{this.terminate(this.#yr?.reason)}}class vn{#vr=new Set;add(e){this.#vr.add(e)}delete(e){this.#vr.delete(e)}terminateAll(e){for(const t of this.#vr)t.terminate(e);this.#vr.clear()}async rerunAll(){await Promise.all([...this.#vr].map((e=>e.rerun())))}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class bn{timeoutSettings;taskManager=new vn;constructor(e){this.timeoutSettings=e}async waitForFunction(e,t={},...r){const{polling:i="raf",timeout:n=this.timeoutSettings.timeout(),root:s,signal:a}=t;if("number"==typeof i&&i<0)throw new Error("Cannot poll with non-positive interval");const o=new wn(this,{polling:i,root:s,timeout:n,signal:a},e,...r);return await o.result}get disposed(){return this.#e}#e=!1;dispose(){this.#e=!0,this.taskManager.terminateAll(new Error("waitForFunction failed: frame got detached."))}[it](){this.dispose()}}
/**
* @license
* Copyright 2019 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class kn extends bn{#br;#r=new ot;#kr;constructor(e,t){super(t),this.#kr=e}get environment(){return this.#kr}get client(){return this.#kr.client}get emitter(){return this.#r}setContext(e){this.#br?.[it](),e.once("disposed",this.#Sr.bind(this)),e.on("consoleapicalled",this.#Cr.bind(this)),e.on("bindingcalled",this.#Er.bind(this)),this.#br=e,this.#r.emit("context",e),this.taskManager.rerunAll()}#Sr(){this.#br=void 0,"clearDocumentHandle"in this.#kr&&this.#kr.clearDocumentHandle()}#Cr(e){this.#r.emit("consoleapicalled",e)}#Er(e){this.#r.emit("bindingcalled",e)}hasContext(){return!!this.#br}get context(){return this.#br}#Tr(){if(this.disposed)throw new Error(`Execution context is not available in detached frame or worker "${this.environment.url()}" (are you trying to evaluate?)`);return this.#br}async#Ir(){const e=new Error("Execution context was destroyed");return await Ie(jt(this.#r,"context").pipe(et(jt(this.#r,"disposed").pipe(xe((()=>{throw e}))),Dt(this.timeoutSettings.timeout()))))}async evaluateHandle(e,...t){e=xt(this.evaluateHandle.name,e);let r=this.#Tr();return r||(r=await this.#Ir()),await r.evaluateHandle(e,...t)}async evaluate(e,...t){e=xt(this.evaluate.name,e);let r=this.#Tr();return r||(r=await this.#Ir()),await r.evaluate(e,...t)}async adoptBackendNode(e){let t=this.#Tr();t||(t=await this.#Ir());const{object:r}=await this.client.send("DOM.resolveNode",{backendNodeId:e,executionContextId:t.id});return this.createCdpHandle(r)}async adoptHandle(e){if(e.realm===this)return await e.evaluateHandle((e=>e));const t=await this.client.send("DOM.describeNode",{objectId:e.id});return await this.adoptBackendNode(t.node.backendNodeId)}async transferHandle(e){if(e.realm===this)return e;if(void 0===e.remoteObject().objectId)return e;const t=await this.client.send("DOM.describeNode",{objectId:e.remoteObject().objectId}),r=await this.adoptBackendNode(t.node.backendNodeId);return await e.dispose(),r}createCdpHandle(e){return"node"===e.subtype?new an(this,e):new en(this,e)}[it](){this.#br?.[it](),this.#r.emit("disposed",void 0),super[it](),this.#r.removeAllListeners()}}
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const Sn=Symbol("mainWorld"),Cn=Symbol("puppeteerWorld"),En=new Map([["load","load"],["domcontentloaded","DOMContentLoaded"],["networkidle0","networkIdle"],["networkidle2","networkAlmostIdle"]]);class Tn{#xr;#Y;#Se;#Fr=null;#Me=new st;#Pr;#Rr;#_r=Wt.create();#Dr=Wt.create();#Mr=Wt.create();#Or;#qr;#Ar;constructor(e,t,r,i,n){Array.isArray(r)?r=r.slice():"string"==typeof r&&(r=[r]),this.#Pr=t._loaderId,this.#xr=r.map((e=>{const t=En.get(e);return dt(t,"Unknown value for options.waitUntil: "+e),t})),n?.addEventListener("abort",(()=>{this.#Rr.reject(n.reason)})),this.#Y=t,this.#Se=i;this.#Me.use(new ot(t._frameManager)).on(pn.LifecycleEvent,this.#Nr.bind(this));const s=this.#Me.use(new ot(t));s.on(Ri.FrameNavigatedWithinDocument,this.#jr.bind(this)),s.on(Ri.FrameNavigated,this.#Lr.bind(this)),s.on(Ri.FrameSwapped,this.#Br.bind(this)),s.on(Ri.FrameSwappedByActivation,this.#Br.bind(this)),s.on(Ri.FrameDetached,this.#$r.bind(this));const a=this.#Me.use(new ot(e));a.on(Sr.Request,this.#Hr.bind(this)),a.on(Sr.Response,this.#Kr.bind(this)),a.on(Sr.RequestFailed,this.#Vr.bind(this)),this.#Rr=Wt.create({timeout:this.#Se,message:`Navigation timeout of ${this.#Se} ms exceeded`}),this.#Nr()}#Hr(e){e.frame()===this.#Y&&e.isNavigationRequest()&&(this.#Fr=e,this.#Ar?.resolve(),this.#Ar=Wt.create(),null!==e.response()&&this.#Ar?.resolve())}#Vr(e){this.#Fr?.id===e.id&&this.#Ar?.resolve()}#Kr(e){this.#Fr?.id===e.request().id&&this.#Ar?.resolve()}#$r(e){this.#Y!==e?this.#Nr():this.#Rr.resolve(new Error("Navigating frame was detached"))}async navigationResponse(){return await(this.#Ar?.valueOrThrow()),this.#Fr?this.#Fr.response():null}sameDocumentNavigationPromise(){return this.#_r.valueOrThrow()}newDocumentNavigationPromise(){return this.#Mr.valueOrThrow()}lifecyclePromise(){return this.#Dr.valueOrThrow()}terminationPromise(){return this.#Rr.valueOrThrow()}#jr(){this.#Or=!0,this.#Nr()}#Lr(e){if("BackForwardCacheRestore"===e)return this.#Br();this.#Nr()}#Br(){this.#qr=!0,this.#Nr()}#Nr(){(function e(t,r){for(const e of r)if(!t._lifecycleEvents.has(e))return!1;for(const i of t.childFrames())if(i._hasStartedLoading&&!e(i,r))return!1;return!0})(this.#Y,this.#xr)&&(this.#Dr.resolve(),this.#Or&&this.#_r.resolve(void 0),(this.#qr||this.#Y._loaderId!==this.#Pr)&&this.#Mr.resolve(void 0))}dispose(){this.#Me.dispose(),this.#Rr.resolve(new Error("LifecycleWatcher disposed"))}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var In=self&&self.__runInitializers||function(e,t,r){for(var i=arguments.length>2,n=0;n<t.length;n++)r=i?t[n].call(e,r):t[n].call(e);return i?r:void 0},xn=self&&self.__esDecorate||function(e,t,r,i,n,s){function a(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var o,c=i.kind,l="getter"===c?"get":"setter"===c?"set":"value",d=!t&&e?i.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,i.name):{}),h=!1,p=r.length-1;p>=0;p--){var f={};for(var m in i)f[m]="access"===m?{}:i[m];for(var m in i.access)f.access[m]=i.access[m];f.addInitializer=function(e){if(h)throw new TypeError("Cannot add initializers after decoration has completed");s.push(a(e||null))};var y=(0,r[p])("accessor"===c?{get:u.get,set:u.set}:u[l],f);if("accessor"===c){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw new TypeError("Object expected");(o=a(y.get))&&(u.get=o),(o=a(y.set))&&(u.set=o),(o=a(y.init))&&n.unshift(o)}else(o=a(y))&&("field"===c?n.unshift(o):u[l]=o)}d&&Object.defineProperty(d,i.name,u),h=!0};let Fn=(()=>{let e,t,r,i,n,s,a,o=Ai,c=[];return class extends o{static{const l="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;xn(this,null,e,{kind:"method",name:"goto",static:!1,private:!1,access:{has:e=>"goto"in e,get:e=>e.goto},metadata:l},null,c),xn(this,null,t,{kind:"method",name:"waitForNavigation",static:!1,private:!1,access:{has:e=>"waitForNavigation"in e,get:e=>e.waitForNavigation},metadata:l},null,c),xn(this,null,r,{kind:"method",name:"setContent",static:!1,private:!1,access:{has:e=>"setContent"in e,get:e=>e.setContent},metadata:l},null,c),xn(this,null,i,{kind:"method",name:"addPreloadScript",static:!1,private:!1,access:{has:e=>"addPreloadScript"in e,get:e=>e.addPreloadScript},metadata:l},null,c),xn(this,null,n,{kind:"method",name:"addExposedFunctionBinding",static:!1,private:!1,access:{has:e=>"addExposedFunctionBinding"in e,get:e=>e.addExposedFunctionBinding},metadata:l},null,c),xn(this,null,s,{kind:"method",name:"removeExposedFunctionBinding",static:!1,private:!1,access:{has:e=>"removeExposedFunctionBinding"in e,get:e=>e.removeExposedFunctionBinding},metadata:l},null,c),xn(this,null,a,{kind:"method",name:"waitForDevicePrompt",static:!1,private:!1,access:{has:e=>"waitForDevicePrompt"in e,get:e=>e.waitForDevicePrompt},metadata:l},null,c),l&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})}#ve=(In(this,c),"");#we=!1;#Pe;_frameManager;_loaderId="";_lifecycleEvents=new Set;_id;_parentId;accessibility;worlds;constructor(e,t,r,i){super(),this._frameManager=e,this.#ve="",this._id=t,this._parentId=r,this.#we=!1,this.#Pe=i,this._loaderId="",this.worlds={[Sn]:new kn(this,this._frameManager.timeoutSettings),[Cn]:new kn(this,this._frameManager.timeoutSettings)},this.accessibility=new yn(this.worlds[Sn],t),this.on(Ri.FrameSwappedByActivation,(()=>{this._onLoadingStarted(),this._onLoadingStopped()})),this.worlds[Sn].emitter.on("consoleapicalled",this.#Wr.bind(this)),this.worlds[Sn].emitter.on("bindingcalled",this.#Ur.bind(this))}#Wr(e){this._frameManager.emit(pn.ConsoleApiCalled,[this.worlds[Sn],e])}#Ur(e){this._frameManager.emit(pn.BindingCalled,[this.worlds[Sn],e])}_client(){return this.#Pe}updateId(e){this._id=e}updateClient(e){this.#Pe=e}page(){return this._frameManager.page()}async goto(e,t={}){const{referer:r=this._frameManager.networkManager.extraHTTPHeaders().referer,referrerPolicy:i=this._frameManager.networkManager.extraHTTPHeaders()["referer-policy"],waitUntil:n=["load"],timeout:s=this._frameManager.timeoutSettings.navigationTimeout()}=t;let a=!1;const o=new Tn(this._frameManager.networkManager,this,n,s);let c=await Wt.race([async function(e,t,r,i,n){try{const s=await e.send("Page.navigate",{url:t,referrer:r,frameId:n,referrerPolicy:i});return a=!!s.loaderId,"net::ERR_HTTP_RESPONSE_CODE_FAILURE"===s.errorText?null:s.errorText?new Error(`${s.errorText} at ${t}`):null}catch(e){if(Cr(e))return e;throw e}}(this.#Pe,e,r,i,this._id),o.terminationPromise()]);c||(c=await Wt.race([o.terminationPromise(),a?o.newDocumentNavigationPromise():o.sameDocumentNavigationPromise()]));try{if(c)throw c;return await o.navigationResponse()}finally{o.dispose()}}async waitForNavigation(e={}){const{waitUntil:t=["load"],timeout:r=this._frameManager.timeoutSettings.navigationTimeout(),signal:i}=e,n=new Tn(this._frameManager.networkManager,this,t,r,i),s=await Wt.race([n.terminationPromise(),...e.ignoreSameDocumentNavigation?[]:[n.sameDocumentNavigationPromise()],n.newDocumentNavigationPromise()]);try{if(s)throw s;const e=await Wt.race([n.terminationPromise(),n.navigationResponse()]);if(e instanceof Error)throw s;return e||null}finally{n.dispose()}}get client(){return this.#Pe}mainRealm(){return this.worlds[Sn]}isolatedRealm(){return this.worlds[Cn]}async setContent(e,t={}){const{waitUntil:r=["load"],timeout:i=this._frameManager.timeoutSettings.navigationTimeout()}=t;await this.setFrameContent(e);const n=new Tn(this._frameManager.networkManager,this,r,i),s=await Wt.race([n.terminationPromise(),n.lifecyclePromise()]);if(n.dispose(),s)throw s}url(){return this.#ve}parentFrame(){return this._frameManager._frameTree.parentFrame(this._id)||null}childFrames(){return this._frameManager._frameTree.childFrames(this._id)}#zr(){return this._frameManager._deviceRequestPromptManager(this.#Pe)}async addPreloadScript(e){const t=this.parentFrame();if(t&&this.#Pe===t.client)return;if(e.getIdForFrame(this))return;const{identifier:r}=await this.#Pe.send("Page.addScriptToEvaluateOnNewDocument",{source:e.source});e.setIdForFrame(this,r)}async addExposedFunctionBinding(e){(this===this._frameManager.mainFrame()||this._hasStartedLoading)&&await Promise.all([this.#Pe.send("Runtime.addBinding",{name:Zi+e.name}),this.evaluate(e.initSource).catch(Et)])}async removeExposedFunctionBinding(e){(this===this._frameManager.mainFrame()||this._hasStartedLoading)&&await Promise.all([this.#Pe.send("Runtime.removeBinding",{name:Zi+e.name}),this.evaluate((e=>{globalThis[e]=void 0}),e.name).catch(Et)])}async waitForDevicePrompt(e={}){return await this.#zr().waitForDevicePrompt(e)}_navigated(e){this._name=e.name,this.#ve=`${e.url}${e.urlFragment||""}`}_navigatedWithinDocument(e){this.#ve=e}_onLifecycleEvent(e,t){"init"===t&&(this._loaderId=e,this._lifecycleEvents.clear()),this._lifecycleEvents.add(t)}_onLoadingStopped(){this._lifecycleEvents.add("DOMContentLoaded"),this._lifecycleEvents.add("load")}_onLoadingStarted(){this._hasStartedLoading=!0}get detached(){return this.#we}[(e=[qi],t=[qi],r=[qi],i=[qi],n=[qi],s=[qi],a=[qi],it)](){this.#we||(this.#we=!0,this.worlds[Sn][it](),this.worlds[Cn][it]())}exposeFunction(){throw new kt}async frameElement(){const e=this.parentFrame();if(!e)return null;const{backendNodeId:t}=await e.client.send("DOM.getFrameOwner",{frameId:this._id});return await e.mainRealm().adoptBackendNode(t)}}})();
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Pn{#Gr=new Map;#Qr=new Map;#Jr=new Map;#Xr;#Yr=!1;#Zr=new Map;getMainFrame(){return this.#Xr}getById(e){return this.#Gr.get(e)}waitForFrame(e){const t=this.getById(e);if(t)return Promise.resolve(t);const r=Wt.create();return(this.#Zr.get(e)||new Set).add(r),r.valueOrThrow()}frames(){return Array.from(this.#Gr.values())}addFrame(e){this.#Gr.set(e._id,e),e._parentId?(this.#Qr.set(e._id,e._parentId),this.#Jr.has(e._parentId)||this.#Jr.set(e._parentId,new Set),this.#Jr.get(e._parentId).add(e._id)):this.#Xr&&!this.#Yr||(this.#Xr=e,this.#Yr=!1),this.#Zr.get(e._id)?.forEach((t=>t.resolve(e)))}removeFrame(e){this.#Gr.delete(e._id),this.#Qr.delete(e._id),e._parentId?this.#Jr.get(e._parentId)?.delete(e._id):this.#Yr=!0}childFrames(e){const t=this.#Jr.get(e);return t?Array.from(t).map((e=>this.getById(e))).filter((e=>void 0!==e)):[]}parentFrame(e){const t=this.#Qr.get(e);return t?this.getById(t):void 0}}class Rn{_interceptionId;_failureText=null;_response=null;_fromMemoryCache=!1;_redirectChain=[];interception={enabled:!1,handled:!1,handlers:[],resolutionState:{action:_n.None},requestOverrides:{},response:null,abortReason:null};constructor(){}continueRequestOverrides(){return dt(this.interception.enabled,"Request Interception is not enabled!"),this.interception.requestOverrides}responseForRequest(){return dt(this.interception.enabled,"Request Interception is not enabled!"),this.interception.response}abortErrorReason(){return dt(this.interception.enabled,"Request Interception is not enabled!"),this.interception.abortReason}interceptResolutionState(){return this.interception.enabled?this.interception.handled?{action:_n.AlreadyHandled}:{...this.interception.resolutionState}:{action:_n.Disabled}}isInterceptResolutionHandled(){return this.interception.handled}enqueueInterceptAction(e){this.interception.handlers.push(e)}async finalizeInterceptions(){await this.interception.handlers.reduce(((e,t)=>e.then(t)),Promise.resolve()),this.interception.handlers=[];const{action:e}=this.interceptResolutionState();switch(e){case"abort":return await this._abort(this.interception.abortReason);case"respond":if(null===this.interception.response)throw new Error("Response is missing for the interception");return await this._respond(this.interception.response);case"continue":return await this._continue(this.interception.requestOverrides)}}#ei(){return!this.url().startsWith("data:")&&!this._fromMemoryCache}async continue(e={},t){if(this.#ei()){if(dt(this.interception.enabled,"Request Interception is not enabled!"),dt(!this.interception.handled,"Request is already handled!"),void 0===t)return await this._continue(e);if(this.interception.requestOverrides=e,void 0===this.interception.resolutionState.priority||t>this.interception.resolutionState.priority)this.interception.resolutionState={action:_n.Continue,priority:t};else if(t===this.interception.resolutionState.priority){if("abort"===this.interception.resolutionState.action||"respond"===this.interception.resolutionState.action)return;this.interception.resolutionState.action=_n.Continue}}}async respond(e,t){if(this.#ei()){if(dt(this.interception.enabled,"Request Interception is not enabled!"),dt(!this.interception.handled,"Request is already handled!"),void 0===t)return await this._respond(e);if(this.interception.response=e,void 0===this.interception.resolutionState.priority||t>this.interception.resolutionState.priority)this.interception.resolutionState={action:_n.Respond,priority:t};else if(t===this.interception.resolutionState.priority){if("abort"===this.interception.resolutionState.action)return;this.interception.resolutionState.action=_n.Respond}}}async abort(e="failed",t){if(!this.#ei())return;const r=On[e];if(dt(r,"Unknown error code: "+e),dt(this.interception.enabled,"Request Interception is not enabled!"),dt(!this.interception.handled,"Request is already handled!"),void 0===t)return await this._abort(r);this.interception.abortReason=r,(void 0===this.interception.resolutionState.priority||t>=this.interception.resolutionState.priority)&&(this.interception.resolutionState={action:_n.Abort,priority:t})}static getResponse(e){const t=Ft(e)?(new TextEncoder).encode(e):e;return{contentLength:t.byteLength,base64:ht(t)}}}var _n;function Dn(e){const t=[];for(const r in e){const i=e[r];if(!Object.is(i,void 0)){const e=Array.isArray(i)?i:[i];t.push(...e.map((e=>({name:r,value:e+""}))))}}return t}!function(e){e.Abort="abort",e.Respond="respond",e.Continue="continue",e.Disabled="disabled",e.None="none",e.AlreadyHandled="already-handled"}(_n||(_n={}));const Mn={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Switch Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required"},On={aborted:"Aborted",accessdenied:"AccessDenied",addressunreachable:"AddressUnreachable",blockedbyclient:"BlockedByClient",blockedbyresponse:"BlockedByResponse",connectionaborted:"ConnectionAborted",connectionclosed:"ConnectionClosed",connectionfailed:"ConnectionFailed",connectionrefused:"ConnectionRefused",connectionreset:"ConnectionReset",internetdisconnected:"InternetDisconnected",namenotresolved:"NameNotResolved",timedout:"TimedOut",failed:"Failed"};function qn(e){if(e.originalMessage.includes("Invalid header")||e.originalMessage.includes("Unsafe header")||e.originalMessage.includes('Expected "header"')||e.originalMessage.includes("invalid argument"))throw e;Et(e)}class An extends Rn{id;#Pe;#ti;#ve;#ri;#ii;#ni=!1;#si;#ai={};#Y;#oi;get client(){return this.#Pe}set client(e){this.#Pe=e}constructor(e,t,r,i,n,s){super(),this.#Pe=e,this.id=n.requestId,this.#ti=n.requestId===n.loaderId&&"Document"===n.type,this._interceptionId=r,this.#ve=n.request.url+(n.request.urlFragment??""),this.#ri=(n.type||"other").toLowerCase(),this.#ii=n.request.method,this.#si=n.request.postData,this.#ni=n.request.hasPostData??!1,this.#Y=t,this._redirectChain=s,this.#oi=n.initiator,this.interception.enabled=i;for(const[e,t]of Object.entries(n.request.headers))this.#ai[e.toLowerCase()]=t}url(){return this.#ve}resourceType(){return this.#ri}method(){return this.#ii}postData(){return this.#si}hasPostData(){return this.#ni}async fetchPostData(){try{return(await this.#Pe.send("Network.getRequestPostData",{requestId:this.id})).postData}catch(e){return void Et(e)}}headers(){return this.#ai}response(){return this._response}frame(){return this.#Y}isNavigationRequest(){return this.#ti}initiator(){return this.#oi}redirectChain(){return this._redirectChain.slice()}failure(){return this._failureText?{errorText:this._failureText}:null}async _continue(e={}){const{url:t,method:r,postData:i,headers:n}=e;this.interception.handled=!0;const s=i?(a=i,ht((new TextEncoder).encode(a))):void 0;var a;if(void 0===this._interceptionId)throw new Error("HTTPRequest is missing _interceptionId needed for Fetch.continueRequest");await this.#Pe.send("Fetch.continueRequest",{requestId:this._interceptionId,url:t,method:r,postData:s,headers:n?Dn(n):void 0}).catch((e=>(this.interception.handled=!1,qn(e))))}async _respond(e){let t;this.interception.handled=!0,e.body&&(t=Rn.getResponse(e.body));const r={};if(e.headers)for(const t of Object.keys(e.headers)){const i=e.headers[t];r[t.toLowerCase()]=Array.isArray(i)?i.map((e=>String(e))):String(i)}e.contentType&&(r["content-type"]=e.contentType),t?.contentLength&&!("content-length"in r)&&(r["content-length"]=String(t.contentLength));const i=e.status||200;if(void 0===this._interceptionId)throw new Error("HTTPRequest is missing _interceptionId needed for Fetch.fulfillRequest");await this.#Pe.send("Fetch.fulfillRequest",{requestId:this._interceptionId,responseCode:i,responsePhrase:Mn[i],responseHeaders:Dn(r),body:t?.base64}).catch((e=>(this.interception.handled=!1,qn(e))))}async _abort(e){if(this.interception.handled=!0,void 0===this._interceptionId)throw new Error("HTTPRequest is missing _interceptionId needed for Fetch.failRequest");await this.#Pe.send("Fetch.failRequest",{requestId:this._interceptionId,errorReason:e||"Failed"}).catch(qn)}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Nn{constructor(){}ok(){const e=this.status();return 0===e||e>=200&&e<=299}async buffer(){const e=await this.content();return Buffer.from(e)}async text(){const e=await this.content();return(new TextDecoder).decode(e)}async json(){const e=await this.text();return JSON.parse(e)}}
/**
* @license
* Copyright 2020 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class jn{#ci;#li;#di;#ui;#hi;#pi;constructor(e){this.#ci=e.subjectName,this.#li=e.issuer,this.#di=e.validFrom,this.#ui=e.validTo,this.#hi=e.protocol,this.#pi=e.sanList}issuer(){return this.#li}validFrom(){return this.#di}validTo(){return this.#ui}protocol(){return this.#hi}subjectName(){return this.#ci}subjectAlternativeNames(){return this.#pi}}class Ln extends Nn{#fi;#mi=null;#yi=Wt.create();#gi;#wi;#vi;#bi;#ki;#ai={};#Si;#Ci;constructor(e,t,r){super(),this.#fi=e,this.#gi={ip:t.remoteIPAddress,port:t.remotePort},this.#vi=this.#Ei(r)||t.statusText,this.#bi=!!t.fromDiskCache,this.#ki=!!t.fromServiceWorker,this.#wi=r?r.statusCode:t.status;const i=r?r.headers:t.headers;for(const[e,t]of Object.entries(i))this.#ai[e.toLowerCase()]=t;this.#Si=t.securityDetails?new jn(t.securityDetails):null,this.#Ci=t.timing||null}#Ei(e){if(!e||!e.headersText)return;const t=e.headersText.split("\r",1)[0];if(!t||t.length>1e3)return;const r=t.match(/[^ ]* [^ ]* (.*)/);if(!r)return;const i=r[1];return i||void 0}_resolveBody(e){return e?this.#yi.reject(e):this.#yi.resolve()}remoteAddress(){return this.#gi}url(){return this.#fi.url()}status(){return this.#wi}statusText(){return this.#vi}headers(){return this.#ai}securityDetails(){return this.#Si}timing(){return this.#Ci}content(){return this.#mi||(this.#mi=this.#yi.valueOrThrow().then((async()=>{try{const e=await this.#fi.client.send("Network.getResponseBody",{requestId:this.#fi.id});return ut(e.body,e.base64Encoded)}catch(e){if(e instanceof bt&&"No resource with given identifier found"===e.originalMessage)throw new bt("Could not load body for this request. This might happen if the request is a preflight request.");throw e}}))),this.#mi}request(){return this.#fi}fromCache(){return this.#bi||this.#fi._fromMemoryCache}fromServiceWorker(){return this.#ki}frame(){return this.#fi.frame()}}
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Bn{#Ti=new Map;#Ii=new Map;#xi=new Map;#Fi=new Map;#Pi=new Map;#Ri=new Map;forget(e){this.#Ti.delete(e),this.#Ii.delete(e),this.#Ri.delete(e),this.#Pi.delete(e),this.#Fi.delete(e)}responseExtraInfo(e){return this.#Fi.has(e)||this.#Fi.set(e,[]),this.#Fi.get(e)}queuedRedirectInfo(e){return this.#Pi.has(e)||this.#Pi.set(e,[]),this.#Pi.get(e)}queueRedirectInfo(e,t){this.queuedRedirectInfo(e).push(t)}takeQueuedRedirectInfo(e){return this.queuedRedirectInfo(e).shift()}inFlightRequestsCount(){let e=0;for(const t of this.#xi.values())t.response()||e++;return e}storeRequestWillBeSent(e,t){this.#Ti.set(e,t)}getRequestWillBeSent(e){return this.#Ti.get(e)}forgetRequestWillBeSent(e){this.#Ti.delete(e)}getRequestPaused(e){return this.#Ii.get(e)}forgetRequestPaused(e){this.#Ii.delete(e)}storeRequestPaused(e,t){this.#Ii.set(e,t)}getRequest(e){return this.#xi.get(e)}storeRequest(e,t){this.#xi.set(e,t)}forgetRequest(e){this.#xi.delete(e)}getQueuedEventGroup(e){return this.#Ri.get(e)}queueEventGroup(e,t){this.#Ri.set(e,t)}forgetQueuedEventGroup(e){this.#Ri.delete(e)}printState(){function e(e,t){return t instanceof Map?{dataType:"Map",value:Array.from(t.entries())}:t instanceof An?{dataType:"CdpHTTPRequest",value:`${t.id}: ${t.url()}`}:t}console.log("httpRequestsMap",JSON.stringify(this.#xi,e,2)),console.log("requestWillBeSentMap",JSON.stringify(this.#Ti,e,2)),console.log("requestWillBeSentMap",JSON.stringify(this.#Fi,e,2)),console.log("requestWillBeSentMap",JSON.stringify(this.#Ii,e,2))}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class $n extends ot{#Vt;#_i=new Bn;#Di;#Mi=null;#Oi=new Set;#qi=!1;#Ai=!1;#Ni;#ji;#Li;#Bi;#i=[["Fetch.requestPaused",this.#$i],["Fetch.authRequired",this.#Hi],["Network.requestWillBeSent",this.#Ki],["Network.requestServedFromCache",this.#Vi],["Network.responseReceived",this.#Wi],["Network.loadingFinished",this.#Ui],["Network.loadingFailed",this.#zi],["Network.responseReceivedExtraInfo",this.#Gi],[Kt.Disconnected,this.#Qi]];#Ji=new Map;constructor(e){super(),this.#Vt=e}async addClient(e){if(this.#Ji.has(e))return;const t=new st;this.#Ji.set(e,t);const r=t.use(new ot(e));for(const[t,i]of this.#i)r.on(t,(t=>i.bind(this)(e,t)));await Promise.all([e.send("Network.enable"),this.#Xi(e),this.#Yi(e),this.#Zi(e),this.#en(e),this.#tn(e)])}async#Qi(e){this.#Ji.get(e)?.dispose(),this.#Ji.delete(e)}async authenticate(e){this.#Mi=e;const t=this.#qi||!!this.#Mi;t!==this.#Ai&&(this.#Ai=t,await this.#rn(this.#en.bind(this)))}async setExtraHTTPHeaders(e){const t={};for(const[r,i]of Object.entries(e))dt(Ft(i),`Expected value of header "${r}" to be String, but "${typeof i}" is found.`),t[r.toLowerCase()]=i;this.#Di=t,await this.#rn(this.#Xi.bind(this))}async#Xi(e){void 0!==this.#Di&&await e.send("Network.setExtraHTTPHeaders",{headers:this.#Di})}extraHTTPHeaders(){return Object.assign({},this.#Di)}inFlightRequestsCount(){return this.#_i.inFlightRequestsCount()}async setOfflineMode(e){this.#ji||(this.#ji={offline:!1,upload:-1,download:-1,latency:0}),this.#ji.offline=e,await this.#rn(this.#Yi.bind(this))}async emulateNetworkConditions(e){this.#ji||(this.#ji={offline:!1,upload:-1,download:-1,latency:0}),this.#ji.upload=e?e.upload:-1,this.#ji.download=e?e.download:-1,this.#ji.latency=e?e.latency:0,await this.#rn(this.#Yi.bind(this))}async#rn(e){await Promise.all(Array.from(this.#Ji.keys()).map((t=>e(t))))}async#Yi(e){void 0!==this.#ji&&await e.send("Network.emulateNetworkConditions",{offline:this.#ji.offline,latency:this.#ji.latency,uploadThroughput:this.#ji.upload,downloadThroughput:this.#ji.download})}async setUserAgent(e,t){this.#Li=e,this.#Bi=t,await this.#rn(this.#tn.bind(this))}async#tn(e){void 0!==this.#Li&&await e.send("Network.setUserAgentOverride",{userAgent:this.#Li,userAgentMetadata:this.#Bi})}async setCacheEnabled(e){this.#Ni=!e,await this.#rn(this.#Zi.bind(this))}async setRequestInterception(e){this.#qi=e;const t=this.#qi||!!this.#Mi;t!==this.#Ai&&(this.#Ai=t,await this.#rn(this.#en.bind(this)))}async#en(e){void 0===this.#Ni&&(this.#Ni=!1),this.#Ai?await Promise.all([this.#Zi(e),e.send("Fetch.enable",{handleAuthRequests:!0,patterns:[{urlPattern:"*"}]})]):await Promise.all([this.#Zi(e),e.send("Fetch.disable")])}async#Zi(e){void 0!==this.#Ni&&await e.send("Network.setCacheDisabled",{cacheDisabled:this.#Ni})}#Ki(e,t){if(!this.#qi||t.request.url.startsWith("data:"))this.#Hr(e,t,void 0);else{const{requestId:r}=t;this.#_i.storeRequestWillBeSent(r,t);const i=this.#_i.getRequestPaused(r);if(i){const{requestId:n}=i;this.#in(t,i),this.#Hr(e,t,n),this.#_i.forgetRequestPaused(r)}}}#Hi(e,t){let r="Default";this.#Oi.has(t.requestId)?r="CancelAuth":this.#Mi&&(r="ProvideCredentials",this.#Oi.add(t.requestId));const{username:i,password:n}=this.#Mi||{username:void 0,password:void 0};e.send("Fetch.continueWithAuth",{requestId:t.requestId,authChallengeResponse:{response:r,username:i,password:n}}).catch(Et)}#$i(e,t){!this.#qi&&this.#Ai&&e.send("Fetch.continueRequest",{requestId:t.requestId}).catch(Et);const{networkId:r,requestId:i}=t;if(!r)return void this.#nn(e,t);const n=(()=>{const e=this.#_i.getRequestWillBeSent(r);if(!e||e.request.url===t.request.url&&e.request.method===t.request.method)return e;this.#_i.forgetRequestWillBeSent(r)})();n?(this.#in(n,t),this.#Hr(e,n,i)):this.#_i.storeRequestPaused(r,t)}#in(e,t){e.request.headers={...e.request.headers,...t.request.headers}}#nn(e,t){const r=t.frameId?this.#Vt.frame(t.frameId):null,i=new An(e,r,t.requestId,this.#qi,t,[]);this.emit(Sr.Request,i),i.finalizeInterceptions()}#Hr(e,t,r,i=!1){let n=[];if(t.redirectResponse){let i=null;if(t.redirectHasExtraInfo&&(i=this.#_i.responseExtraInfo(t.requestId).shift(),!i))return void this.#_i.queueRedirectInfo(t.requestId,{event:t,fetchRequestId:r});const s=this.#_i.getRequest(t.requestId);s&&(this.#sn(e,s,t.redirectResponse,i),n=s._redirectChain)}const s=t.frameId?this.#Vt.frame(t.frameId):null,a=new An(e,s,r,this.#qi,t,n);a._fromMemoryCache=i,this.#_i.storeRequest(t.requestId,a),this.emit(Sr.Request,a),a.finalizeInterceptions()}#Vi(e,t){const r=this.#_i.getRequestWillBeSent(t.requestId);let i=this.#_i.getRequest(t.requestId);i&&(i._fromMemoryCache=!0),!i&&r&&(this.#Hr(e,r,void 0,!0),i=this.#_i.getRequest(t.requestId)),i?this.emit(Sr.RequestServedFromCache,i):Et(new Error(`Request ${t.requestId} was served from cache but we could not find the corresponding request object`))}#sn(e,t,r,i){const n=new Ln(t,r,i);t._response=n,t._redirectChain.push(t),n._resolveBody(new Error("Response body is unavailable for redirect responses")),this.#an(t,!1),this.emit(Sr.Response,n),this.emit(Sr.RequestFinished,t)}#on(e,t,r){const i=this.#_i.getRequest(t.requestId);if(!i)return;this.#_i.responseExtraInfo(t.requestId).length&&Et(new Error("Unexpected extraInfo events for request "+t.requestId)),t.response.fromDiskCache&&(r=null);const n=new Ln(i,t.response,r);i._response=n,this.emit(Sr.Response,n)}#Wi(e,t){const r=this.#_i.getRequest(t.requestId);let i=null;!r||r._fromMemoryCache||!t.hasExtraInfo||(i=this.#_i.responseExtraInfo(t.requestId).shift(),i)?this.#on(e,t,i):this.#_i.queueEventGroup(t.requestId,{responseReceivedEvent:t})}#Gi(e,t){const r=this.#_i.takeQueuedRedirectInfo(t.requestId);if(r)return this.#_i.responseExtraInfo(t.requestId).push(t),void this.#Hr(e,r.event,r.fetchRequestId);const i=this.#_i.getQueuedEventGroup(t.requestId);if(i)return this.#_i.forgetQueuedEventGroup(t.requestId),this.#on(e,i.responseReceivedEvent,t),i.loadingFinishedEvent&&this.#cn(e,i.loadingFinishedEvent),void(i.loadingFailedEvent&&this.#ln(e,i.loadingFailedEvent));this.#_i.responseExtraInfo(t.requestId).push(t)}#an(e,t){const r=e.id,i=e._interceptionId;this.#_i.forgetRequest(r),void 0!==i&&this.#Oi.delete(i),t&&this.#_i.forget(r)}#Ui(e,t){const r=this.#_i.getQueuedEventGroup(t.requestId);r?r.loadingFinishedEvent=t:this.#cn(e,t)}#cn(e,t){const r=this.#_i.getRequest(t.requestId);r&&(this.#dn(e,r),r.response()&&r.response()?._resolveBody(),this.#an(r,!0),this.emit(Sr.RequestFinished,r))}#zi(e,t){const r=this.#_i.getQueuedEventGroup(t.requestId);r?r.loadingFailedEvent=t:this.#ln(e,t)}#ln(e,t){const r=this.#_i.getRequest(t.requestId);if(!r)return;this.#dn(e,r),r._failureText=t.errorText;const i=r.response();i&&i._resolveBody(),this.#an(r,!0),this.emit(Sr.RequestFailed,r)}#dn(e,t){e!==t.client&&t.isNavigationRequest()&&(t.client=e)}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Hn extends ot{#un;#hn;#It;#pn=new Set;#Pe;#fn=new Map;#Gt=new Set;_frameTree=new Pn;#mn=new Set;#yn=new WeakMap;#gn;get timeoutSettings(){return this.#It}get networkManager(){return this.#hn}get client(){return this.#Pe}constructor(e,t,r){super(),this.#Pe=e,this.#un=t,this.#hn=new $n(this),this.#It=r,this.setupEventListeners(this.#Pe),e.once(Kt.Disconnected,(()=>{this.#wn().catch(Et)}))}async#wn(){const e=this._frameTree.getMainFrame();if(!e)return;if(!this.#un.browser().connected)return void this.#vn(e);for(const t of e.childFrames())this.#vn(t);const t=Wt.create({timeout:100,message:"Frame was not swapped"});e.once(Ri.FrameSwappedByActivation,(()=>{t.resolve()}));try{await t.valueOrThrow()}catch{this.#vn(e)}}async swapFrameTree(e){this.#Pe=e;const t=this._frameTree.getMainFrame();t&&(this.#mn.add(this.#Pe.target()._targetId),this._frameTree.removeFrame(t),t.updateId(this.#Pe.target()._targetId),this._frameTree.addFrame(t),t.updateClient(e)),this.setupEventListeners(e),e.once(Kt.Disconnected,(()=>{this.#wn().catch(Et)})),await this.initialize(e,t),await this.#hn.addClient(e),t&&t.emit(Ri.FrameSwappedByActivation,void 0)}async registerSpeculativeSession(e){await this.#hn.addClient(e)}setupEventListeners(e){e.on("Page.frameAttached",(async t=>{await(this.#gn?.valueOrThrow()),this.#bn(e,t.frameId,t.parentFrameId)})),e.on("Page.frameNavigated",(async e=>{this.#mn.add(e.frame.id),await(this.#gn?.valueOrThrow()),this.#kn(e.frame,e.type)})),e.on("Page.navigatedWithinDocument",(async e=>{await(this.#gn?.valueOrThrow()),this.#Sn(e.frameId,e.url)})),e.on("Page.frameDetached",(async e=>{await(this.#gn?.valueOrThrow()),this.#$r(e.frameId,e.reason)})),e.on("Page.frameStartedLoading",(async e=>{await(this.#gn?.valueOrThrow()),this.#Cn(e.frameId)})),e.on("Page.frameStoppedLoading",(async e=>{await(this.#gn?.valueOrThrow()),this.#En(e.frameId)})),e.on("Runtime.executionContextCreated",(async t=>{await(this.#gn?.valueOrThrow()),this.#Tn(t.context,e)})),e.on("Page.lifecycleEvent",(async e=>{await(this.#gn?.valueOrThrow()),this.#In(e)}))}async initialize(e,t){try{this.#gn?.resolve(),this.#gn=Wt.create(),await Promise.all([this.#hn.addClient(e),e.send("Page.enable"),e.send("Page.getFrameTree").then((({frameTree:t})=>{this.#xn(e,t),this.#gn?.resolve()})),e.send("Page.setLifecycleEventsEnabled",{enabled:!0}),e.send("Runtime.enable").then((()=>this.#Fn(e,Mt))),...(t?Array.from(this.#fn.values()):[]).map((e=>t?.addPreloadScript(e))),...(t?Array.from(this.#Gt.values()):[]).map((e=>t?.addExposedFunctionBinding(e)))])}catch(e){if(this.#gn?.resolve(),Cr(e)&&$r(e))return;throw e}}page(){return this.#un}mainFrame(){const e=this._frameTree.getMainFrame();return dt(e,"Requesting main frame too early!"),e}frames(){return Array.from(this._frameTree.frames())}frame(e){return this._frameTree.getById(e)||null}async addExposedFunctionBinding(e){this.#Gt.add(e),await Promise.all(this.frames().map((async t=>await t.addExposedFunctionBinding(e))))}async removeExposedFunctionBinding(e){this.#Gt.delete(e),await Promise.all(this.frames().map((async t=>await t.removeExposedFunctionBinding(e))))}async evaluateOnNewDocument(e){const{identifier:t}=await this.mainFrame()._client().send("Page.addScriptToEvaluateOnNewDocument",{source:e}),r=new Ni(this.mainFrame(),t,e);return this.#fn.set(t,r),await Promise.all(this.frames().map((async e=>await e.addPreloadScript(r)))),{identifier:t}}async removeScriptToEvaluateOnNewDocument(e){const t=this.#fn.get(e);if(!t)throw new Error(`Script to evaluate on new document with id ${e} not found`);this.#fn.delete(e),await Promise.all(this.frames().map((e=>{const r=t.getIdForFrame(e);if(r)return e._client().send("Page.removeScriptToEvaluateOnNewDocument",{identifier:r}).catch(Et)})))}onAttachedToTarget(e){if("iframe"!==e._getTargetInfo().type)return;const t=this.frame(e._getTargetInfo().targetId);t&&t.updateClient(e._session()),this.setupEventListeners(e._session()),this.initialize(e._session(),t)}_deviceRequestPromptManager(e){let t=this.#yn.get(e);return void 0===t&&(t=new Bi(e,this.#It),this.#yn.set(e,t)),t}#In(e){const t=this.frame(e.frameId);t&&(t._onLifecycleEvent(e.loaderId,e.name),this.emit(pn.LifecycleEvent,t),t.emit(Ri.LifecycleEvent,void 0))}#Cn(e){const t=this.frame(e);t&&t._onLoadingStarted()}#En(e){const t=this.frame(e);t&&(t._onLoadingStopped(),this.emit(pn.LifecycleEvent,t),t.emit(Ri.LifecycleEvent,void 0))}#xn(e,t){if(t.frame.parentId&&this.#bn(e,t.frame.id,t.frame.parentId),this.#mn.has(t.frame.id)?this.#mn.delete(t.frame.id):this.#kn(t.frame,"Navigation"),t.childFrames)for(const r of t.childFrames)this.#xn(e,r)}#bn(e,t,r){let i=this.frame(t);if(i){const t=this.frame(r);e&&t&&i.client!==t?.client&&i.updateClient(e)}else i=new Fn(this,t,r,e),this._frameTree.addFrame(i),this.emit(pn.FrameAttached,i)}async#kn(e,t){const r=e.id,i=!e.parentId;let n=this._frameTree.getById(r);if(n)for(const e of n.childFrames())this.#vn(e);i&&(n?(this._frameTree.removeFrame(n),n._id=r):n=new Fn(this,r,void 0,this.#Pe),this._frameTree.addFrame(n)),n=await this._frameTree.waitForFrame(r),n._navigated(e),this.emit(pn.FrameNavigated,n),n.emit(Ri.FrameNavigated,t)}async#Fn(e,t){const r=`${e.id()}:${t}`;this.#pn.has(r)||(await e.send("Page.addScriptToEvaluateOnNewDocument",{source:`//# sourceURL=${It.INTERNAL_URL}`,worldName:t}),await Promise.all(this.frames().filter((t=>t.client===e)).map((r=>e.send("Page.createIsolatedWorld",{frameId:r._id,worldName:t,grantUniveralAccess:!0}).catch(Et)))),this.#pn.add(r))}#Sn(e,t){const r=this.frame(e);r&&(r._navigatedWithinDocument(t),this.emit(pn.FrameNavigatedWithinDocument,r),r.emit(Ri.FrameNavigatedWithinDocument,void 0),this.emit(pn.FrameNavigated,r),r.emit(Ri.FrameNavigated,"Navigation"))}#$r(e,t){const r=this.frame(e);if(r)switch(t){case"remove":this.#vn(r);break;case"swap":this.emit(pn.FrameSwapped,r),r.emit(Ri.FrameSwapped,void 0)}}#Tn(e,t){const r=e.auxData,i=r&&r.frameId,n="string"==typeof i?this.frame(i):void 0;let s;if(n){if(n.client!==t)return;e.auxData&&e.auxData.isDefault?s=n.worlds[Sn]:e.name===Mt&&(s=n.worlds[Cn])}if(!s)return;const a=new un(n?.client||this.#Pe,e,s);s.setContext(a)}#vn(e){for(const t of e.childFrames())this.#vn(t);e[it](),this._frameTree.removeFrame(e),this.emit(pn.FrameDetached,e),e.emit(Ri.FrameDetached,e)}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Kn{constructor(){}}const Vn=Object.freeze({Left:"left",Right:"right",Middle:"middle",Back:"back",Forward:"forward"});class Wn{constructor(){}}class Un{idGenerator=Or();touches=[];constructor(){}removeHandle(e){const t=this.touches.indexOf(e);-1!==t&&this.touches.splice(t,1)}async tap(e,t){const r=await this.touchStart(e,t);await r.end()}async touchMove(e,t){const r=this.touches[0];if(!r)throw new vt("Must start a new Touch first");return await r.move(e,t)}async touchEnd(){const e=this.touches.shift();if(!e)throw new vt("Must start a new Touch first");await e.end()}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/const zn={0:{keyCode:48,key:"0",code:"Digit0"},1:{keyCode:49,key:"1",code:"Digit1"},2:{keyCode:50,key:"2",code:"Digit2"},3:{keyCode:51,key:"3",code:"Digit3"},4:{keyCode:52,key:"4",code:"Digit4"},5:{keyCode:53,key:"5",code:"Digit5"},6:{keyCode:54,key:"6",code:"Digit6"},7:{keyCode:55,key:"7",code:"Digit7"},8:{keyCode:56,key:"8",code:"Digit8"},9:{keyCode:57,key:"9",code:"Digit9"},Power:{key:"Power",code:"Power"},Eject:{key:"Eject",code:"Eject"},Abort:{keyCode:3,code:"Abort",key:"Cancel"},Help:{keyCode:6,code:"Help",key:"Help"},Backspace:{keyCode:8,code:"Backspace",key:"Backspace"},Tab:{keyCode:9,code:"Tab",key:"Tab"},Numpad5:{keyCode:12,shiftKeyCode:101,key:"Clear",code:"Numpad5",shiftKey:"5",location:3},NumpadEnter:{keyCode:13,code:"NumpadEnter",key:"Enter",text:"\r",location:3},Enter:{keyCode:13,code:"Enter",key:"Enter",text:"\r"},"\r":{keyCode:13,code:"Enter",key:"Enter",text:"\r"},"\n":{keyCode:13,code:"Enter",key:"Enter",text:"\r"},ShiftLeft:{keyCode:16,code:"ShiftLeft",key:"Shift",location:1},ShiftRight:{keyCode:16,code:"ShiftRight",key:"Shift",location:2},ControlLeft:{keyCode:17,code:"ControlLeft",key:"Control",location:1},ControlRight:{keyCode:17,code:"ControlRight",key:"Control",location:2},AltLeft:{keyCode:18,code:"AltLeft",key:"Alt",location:1},AltRight:{keyCode:18,code:"AltRight",key:"Alt",location:2},Pause:{keyCode:19,code:"Pause",key:"Pause"},CapsLock:{keyCode:20,code:"CapsLock",key:"CapsLock"},Escape:{keyCode:27,code:"Escape",key:"Escape"},Convert:{keyCode:28,code:"Convert",key:"Convert"},NonConvert:{keyCode:29,code:"NonConvert",key:"NonConvert"},Space:{keyCode:32,code:"Space",key:" "},Numpad9:{keyCode:33,shiftKeyCode:105,key:"PageUp",code:"Numpad9",shiftKey:"9",location:3},PageUp:{keyCode:33,code:"PageUp",key:"PageUp"},Numpad3:{keyCode:34,shiftKeyCode:99,key:"PageDown",code:"Numpad3",shiftKey:"3",location:3},PageDown:{keyCode:34,code:"PageDown",key:"PageDown"},End:{keyCode:35,code:"End",key:"End"},Numpad1:{keyCode:35,shiftKeyCode:97,key:"End",code:"Numpad1",shiftKey:"1",location:3},Home:{keyCode:36,code:"Home",key:"Home"},Numpad7:{keyCode:36,shiftKeyCode:103,key:"Home",code:"Numpad7",shiftKey:"7",location:3},ArrowLeft:{keyCode:37,code:"ArrowLeft",key:"ArrowLeft"},Numpad4:{keyCode:37,shiftKeyCode:100,key:"ArrowLeft",code:"Numpad4",shiftKey:"4",location:3},Numpad8:{keyCode:38,shiftKeyCode:104,key:"ArrowUp",code:"Numpad8",shiftKey:"8",location:3},ArrowUp:{keyCode:38,code:"ArrowUp",key:"ArrowUp"},ArrowRight:{keyCode:39,code:"ArrowRight",key:"ArrowRight"},Numpad6:{keyCode:39,shiftKeyCode:102,key:"ArrowRight",code:"Numpad6",shiftKey:"6",location:3},Numpad2:{keyCode:40,shiftKeyCode:98,key:"ArrowDown",code:"Numpad2",shiftKey:"2",location:3},ArrowDown:{keyCode:40,code:"ArrowDown",key:"ArrowDown"},Select:{keyCode:41,code:"Select",key:"Select"},Open:{keyCode:43,code:"Open",key:"Execute"},PrintScreen:{keyCode:44,code:"PrintScreen",key:"PrintScreen"},Insert:{keyCode:45,code:"Insert",key:"Insert"},Numpad0:{keyCode:45,shiftKeyCode:96,key:"Insert",code:"Numpad0",shiftKey:"0",location:3},Delete:{keyCode:46,code:"Delete",key:"Delete"},NumpadDecimal:{keyCode:46,shiftKeyCode:110,code:"NumpadDecimal",key:"\0",shiftKey:".",location:3},Digit0:{keyCode:48,code:"Digit0",shiftKey:")",key:"0"},Digit1:{keyCode:49,code:"Digit1",shiftKey:"!",key:"1"},Digit2:{keyCode:50,code:"Digit2",shiftKey:"@",key:"2"},Digit3:{keyCode:51,code:"Digit3",shiftKey:"#",key:"3"},Digit4:{keyCode:52,code:"Digit4",shiftKey:"$",key:"4"},Digit5:{keyCode:53,code:"Digit5",shiftKey:"%",key:"5"},Digit6:{keyCode:54,code:"Digit6",shiftKey:"^",key:"6"},Digit7:{keyCode:55,code:"Digit7",shiftKey:"&",key:"7"},Digit8:{keyCode:56,code:"Digit8",shiftKey:"*",key:"8"},Digit9:{keyCode:57,code:"Digit9",shiftKey:"(",key:"9"},KeyA:{keyCode:65,code:"KeyA",shiftKey:"A",key:"a"},KeyB:{keyCode:66,code:"KeyB",shiftKey:"B",key:"b"},KeyC:{keyCode:67,code:"KeyC",shiftKey:"C",key:"c"},KeyD:{keyCode:68,code:"KeyD",shiftKey:"D",key:"d"},KeyE:{keyCode:69,code:"KeyE",shiftKey:"E",key:"e"},KeyF:{keyCode:70,code:"KeyF",shiftKey:"F",key:"f"},KeyG:{keyCode:71,code:"KeyG",shiftKey:"G",key:"g"},KeyH:{keyCode:72,code:"KeyH",shiftKey:"H",key:"h"},KeyI:{keyCode:73,code:"KeyI",shiftKey:"I",key:"i"},KeyJ:{keyCode:74,code:"KeyJ",shiftKey:"J",key:"j"},KeyK:{keyCode:75,code:"KeyK",shiftKey:"K",key:"k"},KeyL:{keyCode:76,code:"KeyL",shiftKey:"L",key:"l"},KeyM:{keyCode:77,code:"KeyM",shiftKey:"M",key:"m"},KeyN:{keyCode:78,code:"KeyN",shiftKey:"N",key:"n"},KeyO:{keyCode:79,code:"KeyO",shiftKey:"O",key:"o"},KeyP:{keyCode:80,code:"KeyP",shiftKey:"P",key:"p"},KeyQ:{keyCode:81,code:"KeyQ",shiftKey:"Q",key:"q"},KeyR:{keyCode:82,code:"KeyR",shiftKey:"R",key:"r"},KeyS:{keyCode:83,code:"KeyS",shiftKey:"S",key:"s"},KeyT:{keyCode:84,code:"KeyT",shiftKey:"T",key:"t"},KeyU:{keyCode:85,code:"KeyU",shiftKey:"U",key:"u"},KeyV:{keyCode:86,code:"KeyV",shiftKey:"V",key:"v"},KeyW:{keyCode:87,code:"KeyW",shiftKey:"W",key:"w"},KeyX:{keyCode:88,code:"KeyX",shiftKey:"X",key:"x"},KeyY:{keyCode:89,code:"KeyY",shiftKey:"Y",key:"y"},KeyZ:{keyCode:90,code:"KeyZ",shiftKey:"Z",key:"z"},MetaLeft:{keyCode:91,code:"MetaLeft",key:"Meta",location:1},MetaRight:{keyCode:92,code:"MetaRight",key:"Meta",location:2},ContextMenu:{keyCode:93,code:"ContextMenu",key:"ContextMenu"},NumpadMultiply:{keyCode:106,code:"NumpadMultiply",key:"*",location:3},NumpadAdd:{keyCode:107,code:"NumpadAdd",key:"+",location:3},NumpadSubtract:{keyCode:109,code:"NumpadSubtract",key:"-",location:3},NumpadDivide:{keyCode:111,code:"NumpadDivide",key:"/",location:3},F1:{keyCode:112,code:"F1",key:"F1"},F2:{keyCode:113,code:"F2",key:"F2"},F3:{keyCode:114,code:"F3",key:"F3"},F4:{keyCode:115,code:"F4",key:"F4"},F5:{keyCode:116,code:"F5",key:"F5"},F6:{keyCode:117,code:"F6",key:"F6"},F7:{keyCode:118,code:"F7",key:"F7"},F8:{keyCode:119,code:"F8",key:"F8"},F9:{keyCode:120,code:"F9",key:"F9"},F10:{keyCode:121,code:"F10",key:"F10"},F11:{keyCode:122,code:"F11",key:"F11"},F12:{keyCode:123,code:"F12",key:"F12"},F13:{keyCode:124,code:"F13",key:"F13"},F14:{keyCode:125,code:"F14",key:"F14"},F15:{keyCode:126,code:"F15",key:"F15"},F16:{keyCode:127,code:"F16",key:"F16"},F17:{keyCode:128,code:"F17",key:"F17"},F18:{keyCode:129,code:"F18",key:"F18"},F19:{keyCode:130,code:"F19",key:"F19"},F20:{keyCode:131,code:"F20",key:"F20"},F21:{keyCode:132,code:"F21",key:"F21"},F22:{keyCode:133,code:"F22",key:"F22"},F23:{keyCode:134,code:"F23",key:"F23"},F24:{keyCode:135,code:"F24",key:"F24"},NumLock:{keyCode:144,code:"NumLock",key:"NumLock"},ScrollLock:{keyCode:145,code:"ScrollLock",key:"ScrollLock"},AudioVolumeMute:{keyCode:173,code:"AudioVolumeMute",key:"AudioVolumeMute"},AudioVolumeDown:{keyCode:174,code:"AudioVolumeDown",key:"AudioVolumeDown"},AudioVolumeUp:{keyCode:175,code:"AudioVolumeUp",key:"AudioVolumeUp"},MediaTrackNext:{keyCode:176,code:"MediaTrackNext",key:"MediaTrackNext"},MediaTrackPrevious:{keyCode:177,code:"MediaTrackPrevious",key:"MediaTrackPrevious"},MediaStop:{keyCode:178,code:"MediaStop",key:"MediaStop"},MediaPlayPause:{keyCode:179,code:"MediaPlayPause",key:"MediaPlayPause"},Semicolon:{keyCode:186,code:"Semicolon",shiftKey:":",key:";"},Equal:{keyCode:187,code:"Equal",shiftKey:"+",key:"="},NumpadEqual:{keyCode:187,code:"NumpadEqual",key:"=",location:3},Comma:{keyCode:188,code:"Comma",shiftKey:"<",key:","},Minus:{keyCode:189,code:"Minus",shiftKey:"_",key:"-"},Period:{keyCode:190,code:"Period",shiftKey:">",key:"."},Slash:{keyCode:191,code:"Slash",shiftKey:"?",key:"/"},Backquote:{keyCode:192,code:"Backquote",shiftKey:"~",key:"`"},BracketLeft:{keyCode:219,code:"BracketLeft",shiftKey:"{",key:"["},Backslash:{keyCode:220,code:"Backslash",shiftKey:"|",key:"\\"},BracketRight:{keyCode:221,code:"BracketRight",shiftKey:"}",key:"]"},Quote:{keyCode:222,code:"Quote",shiftKey:'"',key:"'"},AltGraph:{keyCode:225,code:"AltGraph",key:"AltGraph"},Props:{keyCode:247,code:"Props",key:"CrSel"},Cancel:{keyCode:3,key:"Cancel",code:"Abort"},Clear:{keyCode:12,key:"Clear",code:"Numpad5",location:3},Shift:{keyCode:16,key:"Shift",code:"ShiftLeft",location:1},Control:{keyCode:17,key:"Control",code:"ControlLeft",location:1},Alt:{keyCode:18,key:"Alt",code:"AltLeft",location:1},Accept:{keyCode:30,key:"Accept"},ModeChange:{keyCode:31,key:"ModeChange"}," ":{keyCode:32,key:" ",code:"Space"},Print:{keyCode:42,key:"Print"},Execute:{keyCode:43,key:"Execute",code:"Open"},"\0":{keyCode:46,key:"\0",code:"NumpadDecimal",location:3},a:{keyCode:65,key:"a",code:"KeyA"},b:{keyCode:66,key:"b",code:"KeyB"},c:{keyCode:67,key:"c",code:"KeyC"},d:{keyCode:68,key:"d",code:"KeyD"},e:{keyCode:69,key:"e",code:"KeyE"},f:{keyCode:70,key:"f",code:"KeyF"},g:{keyCode:71,key:"g",code:"KeyG"},h:{keyCode:72,key:"h",code:"KeyH"},i:{keyCode:73,key:"i",code:"KeyI"},j:{keyCode:74,key:"j",code:"KeyJ"},k:{keyCode:75,key:"k",code:"KeyK"},l:{keyCode:76,key:"l",code:"KeyL"},m:{keyCode:77,key:"m",code:"KeyM"},n:{keyCode:78,key:"n",code:"KeyN"},o:{keyCode:79,key:"o",code:"KeyO"},p:{keyCode:80,key:"p",code:"KeyP"},q:{keyCode:81,key:"q",code:"KeyQ"},r:{keyCode:82,key:"r",code:"KeyR"},s:{keyCode:83,key:"s",code:"KeyS"},t:{keyCode:84,key:"t",code:"KeyT"},u:{keyCode:85,key:"u",code:"KeyU"},v:{keyCode:86,key:"v",code:"KeyV"},w:{keyCode:87,key:"w",code:"KeyW"},x:{keyCode:88,key:"x",code:"KeyX"},y:{keyCode:89,key:"y",code:"KeyY"},z:{keyCode:90,key:"z",code:"KeyZ"},Meta:{keyCode:91,key:"Meta",code:"MetaLeft",location:1},"*":{keyCode:106,key:"*",code:"NumpadMultiply",location:3},"+":{keyCode:107,key:"+",code:"NumpadAdd",location:3},"-":{keyCode:109,key:"-",code:"NumpadSubtract",location:3},"/":{keyCode:111,key:"/",code:"NumpadDivide",location:3},";":{keyCode:186,key:";",code:"Semicolon"},"=":{keyCode:187,key:"=",code:"Equal"},",":{keyCode:188,key:",",code:"Comma"},".":{keyCode:190,key:".",code:"Period"},"`":{keyCode:192,key:"`",code:"Backquote"},"[":{keyCode:219,key:"[",code:"BracketLeft"},"\\":{keyCode:220,key:"\\",code:"Backslash"},"]":{keyCode:221,key:"]",code:"BracketRight"},"'":{keyCode:222,key:"'",code:"Quote"},Attn:{keyCode:246,key:"Attn"},CrSel:{keyCode:247,key:"CrSel",code:"Props"},ExSel:{keyCode:248,key:"ExSel"},EraseEof:{keyCode:249,key:"EraseEof"},Play:{keyCode:250,key:"Play"},ZoomOut:{keyCode:251,key:"ZoomOut"},")":{keyCode:48,key:")",code:"Digit0"},"!":{keyCode:49,key:"!",code:"Digit1"},"@":{keyCode:50,key:"@",code:"Digit2"},"#":{keyCode:51,key:"#",code:"Digit3"},$:{keyCode:52,key:"$",code:"Digit4"},"%":{keyCode:53,key:"%",code:"Digit5"},"^":{keyCode:54,key:"^",code:"Digit6"},"&":{keyCode:55,key:"&",code:"Digit7"},"(":{keyCode:57,key:"(",code:"Digit9"},A:{keyCode:65,key:"A",code:"KeyA"},B:{keyCode:66,key:"B",code:"KeyB"},C:{keyCode:67,key:"C",code:"KeyC"},D:{keyCode:68,key:"D",code:"KeyD"},E:{keyCode:69,key:"E",code:"KeyE"},F:{keyCode:70,key:"F",code:"KeyF"},G:{keyCode:71,key:"G",code:"KeyG"},H:{keyCode:72,key:"H",code:"KeyH"},I:{keyCode:73,key:"I",code:"KeyI"},J:{keyCode:74,key:"J",code:"KeyJ"},K:{keyCode:75,key:"K",code:"KeyK"},L:{keyCode:76,key:"L",code:"KeyL"},M:{keyCode:77,key:"M",code:"KeyM"},N:{keyCode:78,key:"N",code:"KeyN"},O:{keyCode:79,key:"O",code:"KeyO"},P:{keyCode:80,key:"P",code:"KeyP"},Q:{keyCode:81,key:"Q",code:"KeyQ"},R:{keyCode:82,key:"R",code:"KeyR"},S:{keyCode:83,key:"S",code:"KeyS"},T:{keyCode:84,key:"T",code:"KeyT"},U:{keyCode:85,key:"U",code:"KeyU"},V:{keyCode:86,key:"V",code:"KeyV"},W:{keyCode:87,key:"W",code:"KeyW"},X:{keyCode:88,key:"X",code:"KeyX"},Y:{keyCode:89,key:"Y",code:"KeyY"},Z:{keyCode:90,key:"Z",code:"KeyZ"},":":{keyCode:186,key:":",code:"Semicolon"},"<":{keyCode:188,key:"<",code:"Comma"},_:{keyCode:189,key:"_",code:"Minus"},">":{keyCode:190,key:">",code:"Period"},"?":{keyCode:191,key:"?",code:"Slash"},"~":{keyCode:192,key:"~",code:"Backquote"},"{":{keyCode:219,key:"{",code:"BracketLeft"},"|":{keyCode:220,key:"|",code:"Backslash"},"}":{keyCode:221,key:"}",code:"BracketRight"},'"':{keyCode:222,key:'"',code:"Quote"},SoftLeft:{key:"SoftLeft",code:"SoftLeft",location:4},SoftRight:{key:"SoftRight",code:"SoftRight",location:4},Camera:{keyCode:44,key:"Camera",code:"Camera",location:4},Call:{key:"Call",code:"Call",location:4},EndCall:{keyCode:95,key:"EndCall",code:"EndCall",location:4},VolumeDown:{keyCode:182,key:"VolumeDown",code:"VolumeDown",location:4},VolumeUp:{keyCode:183,key:"VolumeUp",code:"VolumeUp",location:4}};
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class Gn extends Kn{#Pe;#Pn=new Set;_modifiers=0;constructor(e){super(),this.#Pe=e}updateClient(e){this.#Pe=e}async down(e,t={text:void 0,commands:[]}){const r=this.#Rn(e),i=this.#Pn.has(r.code);this.#Pn.add(r.code),this._modifiers|=this.#_n(r.key);const n=void 0===t.text?r.text:t.text;await this.#Pe.send("Input.dispatchKeyEvent",{type:n?"keyDown":"rawKeyDown",modifiers:this._modifiers,windowsVirtualKeyCode:r.keyCode,code:r.code,key:r.key,text:n,unmodifiedText:n,autoRepeat:i,location:r.location,isKeypad:3===r.location,commands:t.commands})}#_n(e){return"Alt"===e?1:"Control"===e?2:"Meta"===e?4:"Shift"===e?8:0}#Rn(e){const t=8&this._modifiers,r={key:"",keyCode:0,code:"",text:"",location:0},i=zn[e];return dt(i,`Unknown key: "${e}"`),i.key&&(r.key=i.key),t&&i.shiftKey&&(r.key=i.shiftKey),i.keyCode&&(r.keyCode=i.keyCode),t&&i.shiftKeyCode&&(r.keyCode=i.shiftKeyCode),i.code&&(r.code=i.code),i.location&&(r.location=i.location),1===r.key.length&&(r.text=r.key),i.text&&(r.text=i.text),t&&i.shiftText&&(r.text=i.shiftText),-9&this._modifiers&&(r.text=""),r}async up(e){const t=this.#Rn(e);this._modifiers&=~this.#_n(t.key),this.#Pn.delete(t.code),await this.#Pe.send("Input.dispatchKeyEvent",{type:"keyUp",modifiers:this._modifiers,key:t.key,windowsVirtualKeyCode:t.keyCode,code:t.code,location:t.location})}async sendCharacter(e){await this.#Pe.send("Input.insertText",{text:e})}charIsKey(e){return!!zn[e]}async type(e,t={}){const r=t.delay||void 0;for(const t of e)this.charIsKey(t)?await this.press(t,{delay:r}):(r&&await new Promise((e=>setTimeout(e,r))),await this.sendCharacter(t))}async press(e,t={}){const{delay:r=null}=t;await this.down(e,t),r&&await new Promise((e=>setTimeout(e,t.delay))),await this.up(e)}}const Qn=e=>{switch(e){case Vn.Left:return 1;case Vn.Right:return 2;case Vn.Middle:return 4;case Vn.Back:return 8;case Vn.Forward:return 16}},Jn=e=>1&e?Vn.Left:2&e?Vn.Right:4&e?Vn.Middle:8&e?Vn.Back:16&e?Vn.Forward:"none";class Xn extends Wn{#Pe;#Dn;constructor(e,t){super(),this.#Pe=e,this.#Dn=t}updateClient(e){this.#Pe=e}#Mn={position:{x:0,y:0},buttons:0};get#We(){return Object.assign({...this.#Mn},...this.#On)}#On=[];#qn(){const e={};this.#On.push(e);const t=()=>{this.#On.splice(this.#On.indexOf(e),1)};return{update:t=>{Object.assign(e,t)},commit:()=>{this.#Mn={...this.#Mn,...e},t()},rollback:t}}async#An(e){const{update:t,commit:r,rollback:i}=this.#qn();try{await e(t),r()}catch(e){throw i(),e}}async reset(){const e=[];for(const[t,r]of[[1,Vn.Left],[4,Vn.Middle],[2,Vn.Right],[16,Vn.Forward],[8,Vn.Back]])this.#We.buttons&t&&e.push(this.up({button:r}));0===this.#We.position.x&&0===this.#We.position.y||e.push(this.move(0,0)),await Promise.all(e)}async move(e,t,r={}){const{steps:i=1}=r,n=this.#We.position,s=e,a=t;for(let e=1;e<=i;e++)await this.#An((t=>{t({position:{x:n.x+(s-n.x)*(e/i),y:n.y+(a-n.y)*(e/i)}});const{buttons:r,position:o}=this.#We;return this.#Pe.send("Input.dispatchMouseEvent",{type:"mouseMoved",modifiers:this.#Dn._modifiers,buttons:r,button:Jn(r),...o})}))}async down(e={}){const{button:t=Vn.Left,clickCount:r=1}=e,i=Qn(t);if(!i)throw new Error(`Unsupported mouse button: ${t}`);if(this.#We.buttons&i)throw new Error(`'${t}' is already pressed.`);await this.#An((e=>{e({buttons:this.#We.buttons|i});const{buttons:n,position:s}=this.#We;return this.#Pe.send("Input.dispatchMouseEvent",{type:"mousePressed",modifiers:this.#Dn._modifiers,clickCount:r,buttons:n,button:t,...s})}))}async up(e={}){const{button:t=Vn.Left,clickCount:r=1}=e,i=Qn(t);if(!i)throw new Error(`Unsupported mouse button: ${t}`);if(!(this.#We.buttons&i))throw new Error(`'${t}' is not pressed.`);await this.#An((e=>{e({buttons:this.#We.buttons&~i});const{buttons:n,position:s}=this.#We;return this.#Pe.send("Input.dispatchMouseEvent",{type:"mouseReleased",modifiers:this.#Dn._modifiers,clickCount:r,buttons:n,button:t,...s})}))}async click(e,t,r={}){const{delay:i,count:n=1,clickCount:s=n}=r;if(n<1)throw new Error("Click must occur a positive number of times.");const a=[this.move(e,t)];if(s===n)for(let e=1;e<n;++e)a.push(this.down({...r,clickCount:e}),this.up({...r,clickCount:e}));a.push(this.down({...r,clickCount:s})),"number"==typeof i&&(await Promise.all(a),a.length=0,await new Promise((e=>{setTimeout(e,i)}))),a.push(this.up({...r,clickCount:s})),await Promise.all(a)}async wheel(e={}){const{deltaX:t=0,deltaY:r=0}=e,{position:i,buttons:n}=this.#We;await this.#Pe.send("Input.dispatchMouseEvent",{type:"mouseWheel",pointerType:"mouse",modifiers:this.#Dn._modifiers,deltaY:r,deltaX:t,buttons:n,...i})}async drag(e,t){const r=new Promise((e=>{this.#Pe.once("Input.dragIntercepted",(t=>e(t.data)))}));return await this.move(e.x,e.y),await this.down(),await this.move(t.x,t.y),await r}async dragEnter(e,t){await this.#Pe.send("Input.dispatchDragEvent",{type:"dragEnter",x:e.x,y:e.y,modifiers:this.#Dn._modifiers,data:t})}async dragOver(e,t){await this.#Pe.send("Input.dispatchDragEvent",{type:"dragOver",x:e.x,y:e.y,modifiers:this.#Dn._modifiers,data:t})}async drop(e,t){await this.#Pe.send("Input.dispatchDragEvent",{type:"drop",x:e.x,y:e.y,modifiers:this.#Dn._modifiers,data:t})}async dragAndDrop(e,t,r={}){const{delay:i=null}=r,n=await this.drag(e,t);await this.dragEnter(t,n),await this.dragOver(t,n),i&&await new Promise((e=>setTimeout(e,i))),await this.drop(t,n),await this.up()}}class Yn{#Nn=!1;#jn;#Ln;#Pe;#Dn;constructor(e,t,r,i){this.#Pe=e,this.#jn=t,this.#Dn=r,this.#Ln=i}updateClient(e){this.#Pe=e}async start(){if(this.#Nn)throw new vt("Touch has already started");await this.#Pe.send("Input.dispatchTouchEvent",{type:"touchStart",touchPoints:[this.#Ln],modifiers:this.#Dn._modifiers}),this.#Nn=!0}move(e,t){return this.#Ln.x=Math.round(e),this.#Ln.y=Math.round(t),this.#Pe.send("Input.dispatchTouchEvent",{type:"touchMove",touchPoints:[this.#Ln],modifiers:this.#Dn._modifiers})}async end(){await this.#Pe.send("Input.dispatchTouchEvent",{type:"touchEnd",touchPoints:[this.#Ln],modifiers:this.#Dn._modifiers}),this.#jn.removeHandle(this)}}class Zn extends Un{#Pe;#Dn;constructor(e,t){super(),this.#Pe=e,this.#Dn=t}updateClient(e){this.#Pe=e,this.touches.forEach((t=>{t.updateClient(e)}))}async touchStart(e,t){const r=this.idGenerator(),i={x:Math.round(e),y:Math.round(t),radiusX:.5,radiusY:.5,force:.5,id:r},n=new Yn(this.#Pe,this,this.#Dn,i);return await n.start(),this.touches.push(n),n}}class es{#Pe;#Bn=!1;#$n;constructor(e){this.#Pe=e}updateClient(e){this.#Pe=e}async start(e={}){dt(!this.#Bn,"Cannot start recording trace while already recording trace.");const t=["-*","devtools.timeline","v8.execute","disabled-by-default-devtools.timeline","disabled-by-default-devtools.timeline.frame","toplevel","blink.console","blink.user_timing","latencyInfo","disabled-by-default-devtools.timeline.stack","disabled-by-default-v8.cpu_profiler"],{path:r,screenshots:i=!1,categories:n=t}=e;i&&n.push("disabled-by-default-devtools.screenshot");const s=n.filter((e=>e.startsWith("-"))).map((e=>e.slice(1))),a=n.filter((e=>!e.startsWith("-")));this.#$n=r,this.#Bn=!0,await this.#Pe.send("Tracing.start",{transferMode:"ReturnAsStream",traceConfig:{excludedCategories:s,includedCategories:a}})}async stop(){const e=Wt.create();return this.#Pe.once("Tracing.tracingComplete",(async t=>{try{dt(t.stream,'Missing "stream"');const r=await _t(this.#Pe,t.stream),i=await Rt(r,this.#$n);e.resolve(i??void 0)}catch(t){Cr(t)?e.reject(t):e.reject(new Error(`Unknown error: ${t}`))}})),await this.#Pe.send("Tracing.end"),this.#Bn=!1,await e.valueOrThrow()}}
/**
* @license
* Copyright 2023 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var ts;!function(e){e.PAGE="page",e.BACKGROUND_PAGE="background_page",e.SERVICE_WORKER="service_worker",e.SHARED_WORKER="shared_worker",e.BROWSER="browser",e.WEBVIEW="webview",e.OTHER="other",e.TAB="tab"}(ts||(ts={}));class rs{constructor(){}async worker(){return null}async page(){return null}}
/**
* @license
* Copyright 2018 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class is extends ot{timeoutSettings=new Gt;#ve;constructor(e){super(),this.#ve=e}url(){return this.#ve}async evaluate(e,...t){return e=xt(this.evaluate.name,e),await this.mainRealm().evaluate(e,...t)}async evaluateHandle(e,...t){return e=xt(this.evaluateHandle.name,e),await this.mainRealm().evaluateHandle(e,...t)}async close(){throw new kt("WebWorker.close() is not supported")}}class ns extends is{#Ht;#Pe;#oe;#pe;constructor(e,t,r,i,n,s){super(t),this.#oe=r,this.#Pe=e,this.#pe=i,this.#Ht=new kn(this,new Gt),this.#Pe.once("Runtime.executionContextCreated",(async t=>{this.#Ht.setContext(new un(e,t.context,this.#Ht))})),this.#Ht.emitter.on("consoleapicalled",(async e=>{try{return n(e.type,e.args.map((e=>new en(this.#Ht,e))),e.stackTrace)}catch(e){Et(e)}})),this.#Pe.on("Runtime.exceptionThrown",s),this.#Pe.once(Kt.Disconnected,(()=>{this.#Ht.dispose()})),this.#Pe.send("Runtime.enable").catch(Et)}mainRealm(){return this.#Ht}get client(){return this.#Pe}async close(){switch(this.#pe){case ts.SERVICE_WORKER:case ts.SHARED_WORKER:await(this.client.connection()?.send("Target.closeTarget",{targetId:this.#oe})),await(this.client.connection()?.send("Target.detachFromTarget",{sessionId:this.client.id()}));break;default:await this.evaluate((()=>{self.close()}))}}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var ss=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},as=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});function os(e){return"warning"===e?"warn":e}class cs extends gr{static async _create(e,t,r){const i=new cs(e,t);if(await i.#Hn(),r)try{await i.setViewport(r)}catch(e){if(!Cr(e)||!$r(e))throw e;Et(e)}return i}#Ee=!1;#Kn;#Vn;#Wn;#Un;#zn;#Dn;#Gn;#Qn;#Vt;#Jn;#Xn;#Gt=new Map;#Yn=new Map;#Zn;#es;#ts=new Map;#rs=new Set;#is=Wt.create();#ns=!1;#ss=!1;constructor(e,t){super(),this.#Vn=e,this.#Un=e.parentSession(),dt(this.#Un,"Tab target session is not defined."),this.#zn=this.#Un.target(),dt(this.#zn,"Tab target is not defined."),this.#Wn=t,this.#Kn=t._targetManager(),this.#Dn=new Gn(e),this.#Gn=new Xn(e,this.#Dn),this.#Qn=new Zn(e,this.#Dn),this.#Vt=new Hn(e,this,this._timeoutSettings),this.#Jn=new Yr(e),this.#Xn=new es(e),this.#Zn=new Hr(e),this.#es=null;const r=new ot(this.#Vt);r.on(pn.FrameAttached,(e=>{this.emit("frameattached",e)})),r.on(pn.FrameDetached,(e=>{this.emit("framedetached",e)})),r.on(pn.FrameNavigated,(e=>{this.emit("framenavigated",e)})),r.on(pn.ConsoleApiCalled,(([e,t])=>{this.#zt(e,t)})),r.on(pn.BindingCalled,(([e,t])=>{this.#Ut(e,t)}));const i=new ot(this.#Vt.networkManager);i.on(Sr.Request,(e=>{this.emit("request",e)})),i.on(Sr.RequestServedFromCache,(e=>{this.emit("requestservedfromcache",e)})),i.on(Sr.Response,(e=>{this.emit("response",e)})),i.on(Sr.RequestFailed,(e=>{this.emit("requestfailed",e)})),i.on(Sr.RequestFinished,(e=>{this.emit("requestfinished",e)})),this.#Un.on(Kt.Swapped,this.#as.bind(this)),this.#Un.on(Kt.Ready,this.#os.bind(this)),this.#Kn.on("targetGone",this.#cs),this.#zn._isClosedDeferred.valueOrThrow().then((()=>{this.#Kn.off("targetGone",this.#cs),this.emit("close",void 0),this.#Ee=!0})).catch(Et),this.#ls(),this.#ds()}#ds(){const e=[];for(const t of this.#Kn.getChildTargets(this.#Wn))e.push(t);let t=0;for(;t<e.length;){const r=e[t];t++;const i=r._session();i&&this.#us(i);for(const t of this.#Kn.getChildTargets(r))e.push(t)}}async#as(e){dt(e instanceof Nr,"CDPSession is not instance of CdpCDPSession"),this.#Vn=e,this.#Wn=e.target(),dt(this.#Wn,"Missing target on swap"),this.#Dn.updateClient(e),this.#Gn.updateClient(e),this.#Qn.updateClient(e),this.#Jn.updateClient(e),this.#Xn.updateClient(e),this.#Zn.updateClient(e),await this.#Vt.swapFrameTree(e),this.#ls()}async#os(e){dt(e instanceof Nr),"prerender"===e.target()._subtype()&&(this.#Vt.registerSpeculativeSession(e).catch(Et),this.#Jn.registerSpeculativeSession(e).catch(Et))}#ls(){const e=new ot(this.#Vn);e.on(Kt.Ready,this.#us),e.on(Kt.Disconnected,(()=>{this.#is.reject(new St("Target closed"))})),e.on("Page.domContentEventFired",(()=>{this.emit("domcontentloaded",void 0)})),e.on("Page.loadEventFired",(()=>{this.emit("load",void 0)})),e.on("Page.javascriptDialogOpening",this.#hs.bind(this)),e.on("Runtime.exceptionThrown",this.#ps.bind(this)),e.on("Inspector.targetCrashed",this.#fs.bind(this)),e.on("Performance.metrics",this.#ms.bind(this)),e.on("Log.entryAdded",this.#ys.bind(this)),e.on("Page.fileChooserOpened",this.#gs.bind(this))}#cs=e=>{const t=e._session()?.id(),r=this.#ts.get(t);r&&(this.#ts.delete(t),this.emit("workerdestroyed",r))};#us=e=>{if(dt(e instanceof Nr),this.#Vt.onAttachedToTarget(e.target()),"worker"===e.target()._getTargetInfo().type){const t=new ns(e,e.target().url(),e.target()._targetId,e.target().type(),this.#ws.bind(this),this.#ps.bind(this));this.#ts.set(e.id(),t),this.emit("workercreated",t)}e.on(Kt.Ready,this.#us)};async#Hn(){try{await Promise.all([this.#Vt.initialize(this.#Vn),this.#Vn.send("Performance.enable"),this.#Vn.send("Log.enable")])}catch(e){if(!Cr(e)||!$r(e))throw e;Et(e)}}async#gs(e){const t={stack:[],error:void 0,hasError:!1};try{if(!this.#rs.size)return;const r=this.#Vt.frame(e.frameId);dt(r,"This should never happen.");const i=ss(t,await r.worlds[Sn].adoptBackendNode(e.backendNodeId),!1),n=new kr(i.move(),e);for(const e of this.#rs)e.resolve(n);this.#rs.clear()}catch(e){t.error=e,t.hasError=!0}finally{as(t)}}_client(){return this.#Vn}isServiceWorkerBypassed(){return this.#ns}isDragInterceptionEnabled(){return this.#ss}isJavaScriptEnabled(){return this.#Jn.javascriptEnabled}async waitForFileChooser(e={}){const t=0===this.#rs.size,{timeout:r=this._timeoutSettings.timeout()}=e,i=Wt.create({message:`Waiting for \`FileChooser\` failed: ${r}ms exceeded`,timeout:r});let n;e.signal&&e.signal.addEventListener("abort",(()=>{i.reject(e.signal?.reason)}),{once:!0}),this.#rs.add(i),t&&(n=this.#Vn.send("Page.setInterceptFileChooserDialog",{enabled:!0}));try{const[e]=await Promise.all([i.valueOrThrow(),n]);return e}catch(e){throw this.#rs.delete(i),e}}async setGeolocation(e){return await this.#Jn.setGeolocation(e)}target(){return this.#Wn}browser(){return this.#Wn.browser()}browserContext(){return this.#Wn.browserContext()}#fs(){this.emit("error",new Error("Page crashed!"))}#ys(e){const{level:t,text:r,args:i,source:n,url:s,lineNumber:a}=e.entry;i&&i.map((e=>{tn(this.#Vn,e)})),"worker"!==n&&this.emit("console",new br(os(t),r,[],[{url:s,lineNumber:a}]))}mainFrame(){return this.#Vt.mainFrame()}get keyboard(){return this.#Dn}get touchscreen(){return this.#Qn}get coverage(){return this.#Zn}get tracing(){return this.#Xn}frames(){return this.#Vt.frames()}workers(){return Array.from(this.#ts.values())}async setRequestInterception(e){return await this.#Vt.networkManager.setRequestInterception(e)}async setBypassServiceWorker(e){return this.#ns=e,await this.#Vn.send("Network.setBypassServiceWorker",{bypass:e})}async setDragInterception(e){return this.#ss=e,await this.#Vn.send("Input.setInterceptDrags",{enabled:e})}async setOfflineMode(e){return await this.#Vt.networkManager.setOfflineMode(e)}async emulateNetworkConditions(e){return await this.#Vt.networkManager.emulateNetworkConditions(e)}setDefaultNavigationTimeout(e){this._timeoutSettings.setDefaultNavigationTimeout(e)}setDefaultTimeout(e){this._timeoutSettings.setDefaultTimeout(e)}getDefaultTimeout(){return this._timeoutSettings.timeout()}getDefaultNavigationTimeout(){return this._timeoutSettings.navigationTimeout()}async queryObjects(e){dt(!e.disposed,"Prototype JSHandle is disposed!"),dt(e.id,"Prototype JSHandle must not be referencing primitive value");const t=await this.mainFrame().client.send("Runtime.queryObjects",{prototypeObjectId:e.id});return this.mainFrame().mainRealm().createCdpHandle(t.objects)}async cookies(...e){const t=(await this.#Vn.send("Network.getCookies",{urls:e.length?e:[this.url()]})).cookies,r=["sourcePort"];return t.map((e=>{for(const t of r)delete e[t];return e})).map((e=>({...e,partitionKey:e.partitionKey?e.partitionKey.topLevelSite:void 0})))}async deleteCookie(...e){const t=this.url();for(const r of e){const e={...r,partitionKey:ds(r.partitionKey)};if(!r.url&&t.startsWith("http")&&(e.url=t),await this.#Vn.send("Network.deleteCookies",e),t.startsWith("http")&&!e.partitionKey){const r=new URL(t);await this.#Vn.send("Network.deleteCookies",{...e,partitionKey:{topLevelSite:r.origin.replace(`:${r.port}`,""),hasCrossSiteAncestor:!1}})}}}async setCookie(...e){const t=this.url(),r=t.startsWith("http"),i=e.map((e=>{const i=Object.assign({},e);return!i.url&&r&&(i.url=t),dt("about:blank"!==i.url,`Blank page can not have cookie "${i.name}"`),dt(!String.prototype.startsWith.call(i.url||"","data:"),`Data URL page can not have cookie "${i.name}"`),i}));await this.deleteCookie(...i),i.length&&await this.#Vn.send("Network.setCookies",{cookies:i.map((e=>({...e,partitionKey:ds(e.partitionKey)})))})}async exposeFunction(e,t){if(this.#Gt.has(e))throw new Error(`Failed to add page binding with name ${e}: window['${e}'] already exists!`);const r=function(e,t){return Pt(Yi,e,t,Zi)}("exposedFun",e);let i;if("function"==typeof t)i=new Mr(e,t,r);else i=new Mr(e,t.default,r);this.#Gt.set(e,i);const[{identifier:n}]=await Promise.all([this.#Vt.evaluateOnNewDocument(r),this.#Vt.addExposedFunctionBinding(i)]);this.#Yn.set(e,n)}async removeExposedFunction(e){const t=this.#Yn.get(e);if(!t)throw new Error(`Function with name "${e}" does not exist`);const r=this.#Gt.get(e);this.#Yn.delete(e),this.#Gt.delete(e),await Promise.all([this.#Vt.removeScriptToEvaluateOnNewDocument(t),this.#Vt.removeExposedFunctionBinding(r)])}async authenticate(e){return await this.#Vt.networkManager.authenticate(e)}async setExtraHTTPHeaders(e){return await this.#Vt.networkManager.setExtraHTTPHeaders(e)}async setUserAgent(e,t){return await this.#Vt.networkManager.setUserAgent(e,t)}async metrics(){const e=await this.#Vn.send("Performance.getMetrics");return this.#vs(e.metrics)}#ms(e){this.emit("metrics",{title:e.title,metrics:this.#vs(e.metrics)})}#vs(e){const t={};for(const r of e||[])ls.has(r.name)&&(t[r.name]=r.value);return t}#ps(e){this.emit("pageerror",function(e){let t,r;if(e.exception){if(!("object"===e.exception.type&&"error"===e.exception.subtype||e.exception.objectId))return Xi(e.exception);{const i=Ji(e);t=i.name,r=i.message}}else t="Error",r=e.text;const i=new Error(r);i.name=t;const n=i.message.split("\n").length,s=i.stack.split("\n").splice(0,n),a=[];if(e.stackTrace)for(const t of e.stackTrace.callFrames)if(a.push(` at ${t.functionName||"<anonymous>"} (${t.url}:${t.lineNumber+1}:${t.columnNumber+1})`),a.length>=Error.stackTraceLimit)break;return i.stack=[...s,...a].join("\n"),i}(e.exceptionDetails))}#zt(e,t){const r=t.args.map((t=>e.createCdpHandle(t)));this.#ws(os(t.type),r,t.stackTrace)}async#Ut(e,t){let r;try{r=JSON.parse(t.payload)}catch{return}const{type:i,name:n,seq:s,args:a,isTrivial:o}=r;if("exposedFun"!==i)return;const c=e.context;if(!c)return;const l=this.#Gt.get(n);await(l?.run(c,s,a,o))}#ws(e,t,r){if(!this.listenerCount("console"))return void t.forEach((e=>e.dispose()));const i=[];for(const e of t){const t=e.remoteObject();t.objectId?i.push(e.toString()):i.push(Xi(t))}const n=[];if(r)for(const e of r.callFrames)n.push({url:e.url,lineNumber:e.lineNumber,columnNumber:e.columnNumber});const s=new br(os(e),i.join(" "),t,n);this.emit("console",s)}#hs(e){const t=function(e){let t=null;return new Set(["alert","confirm","prompt","beforeunload"]).has(e)&&(t=e),dt(t,`Unknown javascript dialog type: ${e}`),t}(e.type),r=new zr(this.#Vn,t,e.message,e.defaultPrompt);this.emit("dialog",r)}async reload(e){const[t]=await Promise.all([this.waitForNavigation({...e,ignoreSameDocumentNavigation:!0}),this.#Vn.send("Page.reload")]);return t}async createCDPSession(){return await this.target().createCDPSession()}async goBack(e={}){return await this.#bs(-1,e)}async goForward(e={}){return await this.#bs(1,e)}async#bs(e,t){const r=await this.#Vn.send("Page.getNavigationHistory"),i=r.entries[r.currentIndex+e];if(!i)return null;return(await Promise.all([this.waitForNavigation(t),this.#Vn.send("Page.navigateToHistoryEntry",{entryId:i.id})]))[0]}async bringToFront(){await this.#Vn.send("Page.bringToFront")}async setJavaScriptEnabled(e){return await this.#Jn.setJavaScriptEnabled(e)}async setBypassCSP(e){await this.#Vn.send("Page.setBypassCSP",{enabled:e})}async emulateMediaType(e){return await this.#Jn.emulateMediaType(e)}async emulateCPUThrottling(e){return await this.#Jn.emulateCPUThrottling(e)}async emulateMediaFeatures(e){return await this.#Jn.emulateMediaFeatures(e)}async emulateTimezone(e){return await this.#Jn.emulateTimezone(e)}async emulateIdleState(e){return await this.#Jn.emulateIdleState(e)}async emulateVisionDeficiency(e){return await this.#Jn.emulateVisionDeficiency(e)}async setViewport(e){const t=await this.#Jn.emulateViewport(e);this.#es=e,t&&await this.reload()}viewport(){return this.#es}async evaluateOnNewDocument(e,...t){const r=Pt(e,...t);return await this.#Vt.evaluateOnNewDocument(r)}async removeScriptToEvaluateOnNewDocument(e){return await this.#Vt.removeScriptToEvaluateOnNewDocument(e)}async setCacheEnabled(e=!0){await this.#Vt.networkManager.setCacheEnabled(e)}async _screenshot(e){const t={stack:[],error:void 0,hasError:!1};try{const{fromSurface:r,omitBackground:i,optimizeForSpeed:n,quality:s,clip:a,type:o,captureBeyondViewport:c}=e,l=ss(t,new at,!0);!i||"png"!==o&&"webp"!==o||(await this.#Jn.setTransparentBackgroundColor(),l.defer((async()=>{await this.#Jn.resetDefaultBackgroundColor().catch(Et)})));let d=a;if(d&&!c){d=function(e,t){const r=Math.max(e.x,t.x),i=Math.max(e.y,t.y);return{x:r,y:i,width:Math.max(Math.min(e.x+e.width,t.x+t.width)-r,0),height:Math.max(Math.min(e.y+e.height,t.y+t.height)-i,0)}}(d,await this.mainFrame().isolatedRealm().evaluate((()=>{const{height:e,pageLeft:t,pageTop:r,width:i}=window.visualViewport;return{x:t,y:r,height:e,width:i}})))}const{data:u}=await this.#Vn.send("Page.captureScreenshot",{format:o,optimizeForSpeed:n,fromSurface:r,...void 0!==s?{quality:Math.round(s)}:{},...d?{clip:{...d,scale:d.scale??1}}:{},captureBeyondViewport:c});return u}catch(e){t.error=e,t.hasError=!0}finally{const e=as(t);e&&await e}}async createPDFStream(e={}){const{timeout:t=this._timeoutSettings.timeout()}=e,{landscape:r,displayHeaderFooter:i,headerTemplate:n,footerTemplate:s,printBackground:a,scale:o,width:c,height:l,margin:d,pageRanges:u,preferCSSPageSize:h,omitBackground:p,tagged:f,outline:m,waitForFonts:y}=function(e={},t="in"){let r=8.5,i=11;if(e.format){const n=Ct[e.format.toLowerCase()][t];dt(n,"Unknown paper format: "+e.format),r=n.width,i=n.height}else r=Nt(e.width,t)??r,i=Nt(e.height,t)??i;const n={top:Nt(e.margin?.top,t)||0,left:Nt(e.margin?.left,t)||0,bottom:Nt(e.margin?.bottom,t)||0,right:Nt(e.margin?.right,t)||0};return e.outline&&(e.tagged=!0),{scale:1,displayHeaderFooter:!1,headerTemplate:"",footerTemplate:"",printBackground:!1,landscape:!1,pageRanges:"",preferCSSPageSize:!1,omitBackground:!1,outline:!1,tagged:!0,waitForFonts:!0,...e,width:r,height:i,margin:n}}(e);p&&await this.#Jn.setTransparentBackgroundColor(),y&&await Ie(Ce(this.mainFrame().isolatedRealm().evaluate((()=>document.fonts.ready))).pipe(et(Dt(t))));const g=this.#Vn.send("Page.printToPDF",{transferMode:"ReturnAsStream",landscape:r,displayHeaderFooter:i,headerTemplate:n,footerTemplate:s,printBackground:a,scale:o,paperWidth:c,paperHeight:l,marginTop:d.top,marginBottom:d.bottom,marginLeft:d.left,marginRight:d.right,pageRanges:u,preferCSSPageSize:h,generateTaggedPDF:f,generateDocumentOutline:m}),w=await Ie(Ce(g).pipe(et(Dt(t))));return p&&await this.#Jn.resetDefaultBackgroundColor(),dt(w.stream,"`stream` is missing from `Page.printToPDF"),await _t(this.#Vn,w.stream)}async pdf(e={}){const{path:t}=e,r=await this.createPDFStream(e),i=await Rt(r,t);return dt(i,"Could not create typed array"),i}async close(e={runBeforeUnload:void 0}){const t={stack:[],error:void 0,hasError:!1};try{ss(t,await this.browserContext().waitForScreenshotOperations(),!1);const r=this.#Vn.connection();dt(r,"Protocol error: Connection closed. Most likely the page has been closed.");!!e.runBeforeUnload?await this.#Vn.send("Page.close"):(await r.send("Target.closeTarget",{targetId:this.#Wn._targetId}),await this.#zn._isClosedDeferred.valueOrThrow())}catch(e){t.error=e,t.hasError=!0}finally{as(t)}}isClosed(){return this.#Ee}get mouse(){return this.#Gn}async waitForDevicePrompt(e={}){return await this.mainFrame().waitForDevicePrompt(e)}}const ls=new Set(["Timestamp","Documents","Frames","JSEventListeners","Nodes","LayoutCount","RecalcStyleCount","LayoutDuration","RecalcStyleDuration","ScriptDuration","TaskDuration","JSHeapUsedSize","JSHeapTotalSize"]);function ds(e){if(void 0!==e)return"string"==typeof e?{topLevelSite:e,hasCrossSiteAncestor:!1}:{topLevelSite:e.sourceOrigin,hasCrossSiteAncestor:e.hasCrossSiteAncestor??!1}}
/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/var us,hs=self&&self.__addDisposableResource||function(e,t,r){if(null!=t){if("object"!=typeof t&&"function"!=typeof t)throw new TypeError("Object expected.");var i,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");i=t[Symbol.asyncDispose]}if(void 0===i){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");i=t[Symbol.dispose],r&&(n=i)}if("function"!=typeof i)throw new TypeError("Object not disposable.");n&&(i=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:i,async:r})}else r&&e.stack.push({async:!0});return t},ps=self&&self.__disposeResources||function(e){return function(t){function r(r){t.error=t.hasError?new e(r,t.error,"An error was suppressed during disposal."):r,t.hasError=!0}var i,n=0;return function e(){for(;i=t.stack.pop();)try{if(!i.async&&1===n)return n=0,t.stack.push(i),Promise.resolve().then(e);if(i.dispose){var s=i.dispose.call(i.value);if(i.async)return n|=2,Promise.resolve(s).then(e,(function(t){return r(t),e()}))}else n|=1}catch(e){r(e)}if(1===n)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}()}}("function"==typeof SuppressedError?SuppressedError:function(e,t,r){var i=new Error(r);return i.name="SuppressedError",i.error=e,i.suppressed=t,i});class fs extends zt{#fe;#ks;#oe;constructor(e,t,r){super(),this.#fe=e,this.#ks=t,this.#oe=r}get id(){return this.#oe}targets(){return this.#ks.targets().filter((e=>e.browserContext()===this))}async pages(){return(await Promise.all(this.targets().filter((e=>"page"===e.type()||"other"===e.type()&&this.#ks._getIsPageTargetCallback()?.(e))).map((e=>e.page())))).filter((e=>!!e))}async overridePermissions(e,t){const r=t.map((e=>{const t=$t.get(e);if(!t)throw new Error("Unknown permission: "+e);return t}));await this.#fe.send("Browser.grantPermissions",{origin:e,browserContextId:this.#oe||void 0,permissions:r})}async clearPermissionOverrides(){await this.#fe.send("Browser.resetPermissions",{browserContextId:this.#oe||void 0})}async newPage(){const e={stack:[],error:void 0,hasError:!1};try{hs(e,await this.waitForScreenshotOperations(),!1);return await this.#ks._createPageInContext(this.#oe)}catch(t){e.error=t,e.hasError=!0}finally{ps(e)}}browser(){return this.#ks}async close(){dt(this.#oe,"Default BrowserContext cannot be closed!"),await this.#ks._disposeContext(this.#oe)}async cookies(){const{cookies:e}=await this.#fe.send("Storage.getCookies",{browserContextId:this.#oe});return e.map((e=>({...e,partitionKey:e.partitionKey?{sourceOrigin:e.partitionKey.topLevelSite,hasCrossSiteAncestor:e.partitionKey.hasCrossSiteAncestor}:void 0})))}async setCookie(...e){return await this.#fe.send("Storage.setCookies",{browserContextId:this.#oe,cookies:e.map((e=>({...e,partitionKey:ds(e.partitionKey)})))})}async setDownloadBehavior(e){await this.#fe.send("Browser.setDownloadBehavior",{behavior:e.policy,downloadPath:e.downloadPath,browserContextId:this.#oe})}}
/**
* @license
* Copyright 2019 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/!function(e){e.SUCCESS="success",e.ABORTED="aborted"}(us||(us={}));class ms extends rs{#Ss;#Cs;#Es;#Kn;#Ts;#Is=new Set;_initializedDeferred=Wt.create();_isClosedDeferred=Wt.create();_targetId;constructor(e,t,r,i,n){super(),this.#Cs=t,this.#Kn=i,this.#Es=e,this.#Ss=r,this._targetId=e.targetId,this.#Ts=n,this.#Cs&&this.#Cs.setTarget(this)}async asPage(){const e=this._session();return e?await cs._create(e,this,null):await this.createCDPSession().then((e=>cs._create(e,this,null)))}_subtype(){return this.#Es.subtype}_session(){return this.#Cs}_addChildTarget(e){this.#Is.add(e)}_removeChildTarget(e){this.#Is.delete(e)}_childTargets(){return this.#Is}_sessionFactory(){if(!this.#Ts)throw new Error("sessionFactory is not initialized");return this.#Ts}createCDPSession(){if(!this.#Ts)throw new Error("sessionFactory is not initialized");return this.#Ts(!1).then((e=>(e.setTarget(this),e)))}url(){return this.#Es.url}type(){switch(this.#Es.type){case"page":return ts.PAGE;case"background_page":return ts.BACKGROUND_PAGE;case"service_worker":return ts.SERVICE_WORKER;case"shared_worker":return ts.SHARED_WORKER;case"browser":return ts.BROWSER;case"webview":return ts.WEBVIEW;case"tab":return ts.TAB;default:return ts.OTHER}}_targetManager(){if(!this.#Kn)throw new Error("targetManager is not initialized");return this.#Kn}_getTargetInfo(){return this.#Es}browser(){if(!this.#Ss)throw new Error("browserContext is not initialized");return this.#Ss.browser()}browserContext(){if(!this.#Ss)throw new Error("browserContext is not initialized");return this.#Ss}opener(){const{openerId:e}=this.#Es;if(e)return this.browser().targets().find((t=>t._targetId===e))}_targetInfoChanged(e){this.#Es=e,this._checkIfInitialized()}_initialize(){this._initializedDeferred.resolve(us.SUCCESS)}_isTargetExposed(){return this.type()!==ts.TAB&&!this._subtype()}_checkIfInitialized(){this._initializedDeferred.resolved()||this._initializedDeferred.resolve(us.SUCCESS)}}class ys extends ms{#xs;pagePromise;constructor(e,t,r,i,n,s){super(e,t,r,i,n),this.#xs=s??void 0}_initialize(){this._initializedDeferred.valueOrThrow().then((async e=>{if(e===us.ABORTED)return;const t=this.opener();if(!(t instanceof ys))return;if(!t||!t.pagePromise||"page"!==this.type())return!0;const r=await t.pagePromise;if(!r.listenerCount("popup"))return!0;const i=await this.page();return r.emit("popup",i),!0})).catch(Et),this._checkIfInitialized()}async page(){if(!this.pagePromise){const e=this._session();this.pagePromise=(e?Promise.resolve(e):this._sessionFactory()(!1)).then((e=>cs._create(e,this,this.#xs??null)))}return await this.pagePromise??null}_checkIfInitialized(){this._initializedDeferred.resolved()||""!==this._getTargetInfo().url&&this._initializedDeferred.resolve(us.SUCCESS)}}class gs extends ys{}class ws extends ms{#Fs;async worker(){if(!this.#Fs){const e=this._session();this.#Fs=(e?Promise.resolve(e):this._sessionFactory()(!1)).then((e=>new ns(e,this._getTargetInfo().url,this._targetId,this.type(),(()=>{}),(()=>{}))))}return await this.#Fs}}class vs extends ms{}
/**
* @license
* Copyright 2022 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class bs extends ot{#fe;#Ps=new Map;#Rs=new Map;#_s=new Map;#Ds=new Set;#Ms;#Os;#qs=new WeakMap;#As=new WeakMap;#Ns=Wt.create();#js=new Set;#Ls=!0;#Bs=[{}];constructor(e,t,r,i=!0){super(),this.#fe=e,this.#Ms=r,this.#Os=t,this.#Ls=i,this.#fe.on("Target.targetCreated",this.#$s),this.#fe.on("Target.targetDestroyed",this.#Hs),this.#fe.on("Target.targetInfoChanged",this.#Ks),this.#fe.on(Kt.SessionDetached,this.#Vs),this.#Ws(this.#fe)}#Us=()=>{if(this.#Ls)for(const[e,t]of this.#Ps.entries()){const r=new ms(t,void 0,void 0,this,void 0),i="page"===t.type||"iframe"===t.type,n=t.url.startsWith("chrome-extension://");this.#Ms&&!this.#Ms(r)||!i||n||this.#js.add(e)}};async initialize(){await this.#fe.send("Target.setDiscoverTargets",{discover:!0,filter:this.#Bs}),this.#Us(),await this.#fe.send("Target.setAutoAttach",{waitForDebuggerOnStart:!0,flatten:!0,autoAttach:!0,filter:[{type:"page",exclude:!0},...this.#Bs]}),this.#zs(),await this.#Ns.valueOrThrow()}getChildTargets(e){return e._childTargets()}dispose(){this.#fe.off("Target.targetCreated",this.#$s),this.#fe.off("Target.targetDestroyed",this.#Hs),this.#fe.off("Target.targetInfoChanged",this.#Ks),this.#fe.off(Kt.SessionDetached,this.#Vs),this.#Gs(this.#fe)}getAvailableTargets(){return this.#Rs}#Ws(e){const t=t=>{this.#us(e,t)};dt(!this.#qs.has(e)),this.#qs.set(e,t),e.on("Target.attachedToTarget",t);const r=t=>this.#cs(e,t);dt(!this.#As.has(e)),this.#As.set(e,r),e.on("Target.detachedFromTarget",r)}#Gs(e){const t=this.#qs.get(e);t&&(e.off("Target.attachedToTarget",t),this.#qs.delete(e)),this.#As.has(e)&&(e.off("Target.detachedFromTarget",this.#As.get(e)),this.#As.delete(e))}#Vs=e=>{this.#Gs(e)};#$s=async e=>{if(this.#Ps.set(e.targetInfo.targetId,e.targetInfo),this.emit("targetDiscovered",e.targetInfo),"browser"===e.targetInfo.type&&e.targetInfo.attached){if(this.#Rs.has(e.targetInfo.targetId))return;const t=this.#Os(e.targetInfo,void 0);t._initialize(),this.#Rs.set(e.targetInfo.targetId,t)}};#Hs=e=>{const t=this.#Ps.get(e.targetId);if(this.#Ps.delete(e.targetId),this.#zs(e.targetId),"service_worker"===t?.type&&this.#Rs.has(e.targetId)){const t=this.#Rs.get(e.targetId);t&&(this.emit("targetGone",t),this.#Rs.delete(e.targetId))}};#Ks=e=>{if(this.#Ps.set(e.targetInfo.targetId,e.targetInfo),this.#Ds.has(e.targetInfo.targetId)||!this.#Rs.has(e.targetInfo.targetId)||!e.targetInfo.attached)return;const t=this.#Rs.get(e.targetInfo.targetId);if(!t)return;const r=t.url(),i=t._initializedDeferred.value()===us.SUCCESS;if(function(e,t){return Boolean(e._subtype())&&!t.subtype}(t,e.targetInfo)){const e=t?._session();dt(e,"Target that is being activated is missing a CDPSession."),e.parentSession()?.emit(Kt.Swapped,e)}t._targetInfoChanged(e.targetInfo),i&&r!==t.url()&&this.emit("targetChanged",{target:t,wasInitialized:i,previousURL:r})};#us=async(e,t)=>{const r=t.targetInfo,i=this.#fe._session(t.sessionId);if(!i)throw new Error(`Session ${t.sessionId} was not created.`);const n=async()=>{await i.send("Runtime.runIfWaitingForDebugger").catch(Et),await e.send("Target.detachFromTarget",{sessionId:i.id()}).catch(Et)};if(!this.#fe.isAutoAttached(r.targetId))return;if("service_worker"===r.type){if(this.#zs(r.targetId),await n(),this.#Rs.has(r.targetId))return;const e=this.#Os(r);return e._initialize(),this.#Rs.set(r.targetId,e),void this.emit("targetAvailable",e)}const s=this.#Rs.has(r.targetId),a=s?this.#Rs.get(r.targetId):this.#Os(r,i,e instanceof Nr?e:void 0);if(this.#Ms&&!this.#Ms(a))return this.#Ds.add(r.targetId),this.#zs(r.targetId),void await n();this.#Ws(i),s?(i.setTarget(a),this.#_s.set(i.id(),this.#Rs.get(r.targetId))):(a._initialize(),this.#Rs.set(r.targetId,a),this.#_s.set(i.id(),a));const o=e instanceof Vt?e.target():null;o?._addChildTarget(a),e.emit(Kt.Ready,i),this.#js.delete(a._targetId),s||this.emit("targetAvailable",a),this.#zs(),await Promise.all([i.send("Target.setAutoAttach",{waitForDebuggerOnStart:!0,flatten:!0,autoAttach:!0,filter:this.#Bs}),i.send("Runtime.runIfWaitingForDebugger")]).catch(Et)};#zs(e){void 0!==e&&this.#js.delete(e),0===this.#js.size&&this.#Ns.resolve()}#cs=(e,t)=>{const r=this.#_s.get(t.sessionId);this.#_s.delete(t.sessionId),r&&(e instanceof Vt&&e.target()._removeChildTarget(r),this.#Rs.delete(r._targetId),this.emit("targetGone",r))}}
/**
* @license
* Copyright 2017 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/class ks extends Ht{protocol="cdp";static async _create(e,t,r,i,n,s,a,o,c,l=!0){const d=new ks(e,t,i,s,a,o,c,l);return r&&await e.send("Security.setIgnoreCertificateErrors",{ignore:!0}),await d._attach(n),d}#xs;#Qs;#fe;#Js;#Ms;#Xs;#Ys;#Zs=new Map;#Kn;constructor(e,t,r,i,n,s,a,o=!0){super(),this.#xs=r,this.#Qs=i,this.#fe=e,this.#Js=n||(()=>{}),this.#Ms=s||(()=>!0),this.#ea(a),this.#Kn=new bs(e,this.#ta,this.#Ms,o),this.#Ys=new fs(this.#fe,this);for(const e of t)this.#Zs.set(e,new fs(this.#fe,this,e))}#ra=()=>{this.emit("disconnected",void 0)};async _attach(e){this.#fe.on(Kt.Disconnected,this.#ra),e&&await this.#Ys.setDownloadBehavior(e),this.#Kn.on("targetAvailable",this.#us),this.#Kn.on("targetGone",this.#cs),this.#Kn.on("targetChanged",this.#ia),this.#Kn.on("targetDiscovered",this.#na),await this.#Kn.initialize()}_detach(){this.#fe.off(Kt.Disconnected,this.#ra),this.#Kn.off("targetAvailable",this.#us),this.#Kn.off("targetGone",this.#cs),this.#Kn.off("targetChanged",this.#ia),this.#Kn.off("targetDiscovered",this.#na)}process(){return this.#Qs??null}_targetManager(){return this.#Kn}#ea(e){this.#Xs=e||(e=>"page"===e.type()||"background_page"===e.type()||"webview"===e.type())}_getIsPageTargetCallback(){return this.#Xs}async createBrowserContext(e={}){const{proxyServer:t,proxyBypassList:r,downloadBehavior:i}=e,{browserContextId:n}=await this.#fe.send("Target.createBrowserContext",{proxyServer:t,proxyBypassList:r&&r.join(",")}),s=new fs(this.#fe,this,n);return i&&await s.setDownloadBehavior(i),this.#Zs.set(n,s),s}browserContexts(){return[this.#Ys,...Array.from(this.#Zs.values())]}defaultBrowserContext(){return this.#Ys}async _disposeContext(e){e&&(await this.#fe.send("Target.disposeBrowserContext",{browserContextId:e}),this.#Zs.delete(e))}#ta=(e,t)=>{const{browserContextId:r}=e,i=r&&this.#Zs.has(r)?this.#Zs.get(r):this.#Ys;if(!i)throw new Error("Missing browser context");const n=t=>this.#fe._createSession(e,t),s=new vs(e,t,i,this.#Kn,n);return e.url?.startsWith("devtools://")?new gs(e,t,i,this.#Kn,n,this.#xs??null):this.#Xs(s)?new ys(e,t,i,this.#Kn,n,this.#xs??null):"service_worker"===e.type||"shared_worker"===e.type?new ws(e,t,i,this.#Kn,n):s};#us=async e=>{e._isTargetExposed()&&await e._initializedDeferred.valueOrThrow()===us.SUCCESS&&(this.emit("targetcreated",e),e.browserContext().emit("targetcreated",e))};#cs=async e=>{e._initializedDeferred.resolve(us.ABORTED),e._isClosedDeferred.resolve(),e._isTargetExposed()&&await e._initializedDeferred.valueOrThrow()===us.SUCCESS&&(this.emit("targetdestroyed",e),e.browserContext().emit("targetdestroyed",e))};#ia=({target:e})=>{this.emit("targetchanged",e),e.browserContext().emit("targetchanged",e)};#na=e=>{this.emit("targetdiscovered",e)};wsEndpoint(){return this.#fe.url()}async newPage(){return await this.#Ys.newPage()}async _createPageInContext(e){const{targetId:t}=await this.#fe.send("Target.createTarget",{url:"about:blank",browserContextId:e||void 0}),r=await this.waitForTarget((e=>e._targetId===t));if(!r)throw new Error(`Missing target for page (id = ${t})`);if(!(await r._initializedDeferred.valueOrThrow()===us.SUCCESS))throw new Error(`Failed to create target for page (id = ${t})`);const i=await r.page();if(!i)throw new Error(`Failed to create a page for context (id = ${e})`);return i}targets(){return Array.from(this.#Kn.getAvailableTargets().values()).filter((e=>e._isTargetExposed()&&e._initializedDeferred.value()===us.SUCCESS))}target(){const e=this.targets().find((e=>"browser"===e.type()));if(!e)throw new Error("Browser target is not found");return e}async version(){return(await this.#sa()).product}async userAgent(){return(await this.#sa()).userAgent}async close(){await this.#Js.call(null),await this.disconnect()}disconnect(){return this.#Kn.dispose(),this.#fe.dispose(),this._detach(),Promise.resolve()}get connected(){return!this.#fe._closed}#sa(){return this.#fe.send("Browser.getVersion")}get debugInfo(){return{pendingProtocolErrors:this.#fe.getPendingProtocolErrors()}}}export{ks as Browser,Br as Connection,an as ElementHandle,Fn as Frame,cs as Page,ms as Target};