const listeners = new Map();

  const processShim = {
    env: {},
    version: "v20.0.0",
    versions: {
      node: "20.0.0",
      icu: "shim",
    },
    pid: 0,
    argv: ["node", ""],
    cwd: () => "/",
    uptime: () => 0,
    memoryUsage: () => ({ rss: 0 }),
    availableMemory: undefined,

    on: (event, listener) => {
      const set = listeners.get(event) ?? new Set();
      set.add(listener);
      listeners.set(event, set);
      return processShim;
    },
    off: (event, listener) => {
      listeners.get(event)?.delete(listener);
      return processShim;
    },
    listeners: (event) => Array.from(listeners.get(event) ?? []),
    exit: (code = 0) => {
      throw new Error(`process.exit(${code}) called`);
    },
  };

  globalThis.process = processShim;
  globalThis.global = globalThis.global ?? globalThis;
  globalThis.global.process = processShim;
var Ck=Object.create;var hd=Object.defineProperty;var Tk=Object.getOwnPropertyDescriptor;var Ak=Object.getOwnPropertyNames;var kk=Object.getPrototypeOf,Ik=Object.prototype.hasOwnProperty;var lu=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var N=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),C=(e,t)=>{for(var r in t)hd(e,r,{get:t[r],enumerable:!0})},Rk=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ak(t))!Ik.call(e,o)&&o!==r&&hd(e,o,{get:()=>t[o],enumerable:!(n=Tk(t,o))||n.enumerable});return e};var ng=(e,t,r)=>(r=e!=null?Ck(kk(e)):{},Rk(t||!e||!e.__esModule?hd(r,"default",{value:e,enumerable:!0}):r,e));var re=N(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.Log=Ve.LogLevel=void 0;var kD=" DEBUG ",ID="  INFO ",RD="  WARN ",PD=" ERROR ";function Ju(e){return e.unshift("[Statsig]"),e}Ve.LogLevel={None:0,Error:1,Warn:2,Info:3,Debug:4};var Yu=class e{static info(...t){e.level>=Ve.LogLevel.Info&&console.info(ID,...Ju(t))}static debug(...t){e.level>=Ve.LogLevel.Debug&&console.debug(kD,...Ju(t))}static warn(...t){e.level>=Ve.LogLevel.Warn&&console.warn(RD,...Ju(t))}static error(...t){e.level>=Ve.LogLevel.Error&&console.error(PD,...Ju(t))}};Ve.Log=Yu;Yu.level=Ve.LogLevel.Warn});var nr=N(Ge=>{"use strict";var kp,Ip,Rp;Object.defineProperty(Ge,"__esModule",{value:!0});Ge._getInstance=Ge._getStatsigGlobalFlag=Ge._getStatsigGlobal=void 0;var DD=re(),ND=()=>{try{return typeof __STATSIG__<"u"?__STATSIG__:es}catch{return es}};Ge._getStatsigGlobal=ND;var OD=e=>(0,Ge._getStatsigGlobal)()[e];Ge._getStatsigGlobalFlag=OD;var MD=e=>{let t=(0,Ge._getStatsigGlobal)();return e?t.instances&&t.instances[e]:(t.instances&&Object.keys(t.instances).length>1&&DD.Log.warn("Call made to Statsig global instance without an SDK key but there is more than one client instance. If you are using mulitple clients, please specify the SDK key."),t.firstInstance)};Ge._getInstance=MD;var eo="__STATSIG__",m_=typeof window<"u"?window:{},h_=typeof global<"u"?global:{},g_=typeof globalThis<"u"?globalThis:{},es=(Rp=(Ip=(kp=m_[eo])!==null&&kp!==void 0?kp:h_[eo])!==null&&Ip!==void 0?Ip:g_[eo])!==null&&Rp!==void 0?Rp:{instance:Ge._getInstance};m_[eo]=es;h_[eo]=es;g_[eo]=es});var Xu=N(Fr=>{"use strict";Object.defineProperty(Fr,"__esModule",{value:!0});Fr.Diagnostics=void 0;var Zu=new Map,Pp="start",Dp="end",FD="statsig::diagnostics";Fr.Diagnostics={_getMarkers:e=>Zu.get(e),_markInitOverallStart:e=>{ro(e,to({},Pp,"overall"))},_markInitOverallEnd:(e,t,r)=>{ro(e,to({success:t,error:t?void 0:{name:"InitializeError",message:"Failed to initialize"},evaluationDetails:r},Dp,"overall"))},_markInitNetworkReqStart:(e,t)=>{ro(e,to(t,Pp,"initialize","network_request"))},_markInitNetworkReqEnd:(e,t)=>{ro(e,to(t,Dp,"initialize","network_request"))},_markInitProcessStart:e=>{ro(e,to({},Pp,"initialize","process"))},_markInitProcessEnd:(e,t)=>{ro(e,to(t,Dp,"initialize","process"))},_clearMarkers:e=>{Zu.delete(e)},_formatError(e){if(e&&typeof e=="object")return{code:Np(e,"code"),name:Np(e,"name"),message:Np(e,"message")}},_getDiagnosticsData(e,t,r,n){var o;return{success:e?.ok===!0,statusCode:e?.status,sdkRegion:(o=e?.headers)===null||o===void 0?void 0:o.get("x-statsig-region"),isDelta:r.includes('"is_delta":true')===!0?!0:void 0,attempt:t,error:Fr.Diagnostics._formatError(n)}},_enqueueDiagnosticsEvent(e,t,r,n){let o=Fr.Diagnostics._getMarkers(r);if(o==null||o.length<=0)return-1;let i=o[o.length-1].timestamp-o[0].timestamp;Fr.Diagnostics._clearMarkers(r);let s=BD(e,{context:"initialize",markers:o.slice(),statsigOptions:n});return t.enqueue(s),i}};function to(e,t,r,n){return Object.assign({key:r,action:t,step:n,timestamp:Date.now()},e)}function BD(e,t){return{eventName:FD,user:e,value:null,metadata:t,time:Date.now()}}function ro(e,t){var r;let n=(r=Zu.get(e))!==null&&r!==void 0?r:[];n.push(t),Zu.set(e,n)}function Np(e,t){if(t in e)return e[t]}});var b_=N(Qu=>{"use strict";Object.defineProperty(Qu,"__esModule",{value:!0});Qu.EventBatch=void 0;var Op=class{constructor(t){this.attempts=0,this.createdAt=Date.now(),this.events=t}incrementAttempts(){this.attempts++}};Qu.EventBatch=Op});var tl=N(el=>{"use strict";Object.defineProperty(el,"__esModule",{value:!0});el.EventRetryConstants=void 0;el.EventRetryConstants={MAX_RETRY_ATTEMPTS:8,DEFAULT_BATCH_SIZE:100,MAX_PENDING_BATCHES:40,TICK_INTERVAL_MS:1e3,QUICK_FLUSH_WINDOW_MS:200,MAX_LOCAL_STORAGE:500,get MAX_QUEUED_EVENTS(){return this.DEFAULT_BATCH_SIZE*this.MAX_PENDING_BATCHES}}});var __=N(rl=>{"use strict";Object.defineProperty(rl,"__esModule",{value:!0});rl.BatchQueue=void 0;var LD=b_(),y_=tl(),Mp=class{constructor(t=y_.EventRetryConstants.DEFAULT_BATCH_SIZE){this._batches=[],this._batchSize=t}batchSize(){return this._batchSize}requeueBatch(t){return this._enqueueBatch(t)}hasFullBatch(){return this._batches.some(t=>t.events.length>=this._batchSize)}takeNextBatch(){return this._batches.shift()}takeAllBatches(){let t=this._batches;return this._batches=[],t}createBatches(t){let r=0,n=0;for(;r<t.length;){let o=t.slice(r,r+this._batchSize);n+=this._enqueueBatch(new LD.EventBatch(o)),r+=this._batchSize}return n}_enqueueBatch(t){this._batches.push(t);let r=0;for(;this._batches.length>y_.EventRetryConstants.MAX_PENDING_BATCHES;){let n=this._batches.shift();n&&(r+=n.events.length)}return r}};rl.BatchQueue=Mp});var nl=N(no=>{"use strict";Object.defineProperty(no,"__esModule",{value:!0});no._isTypeMatch=no._typeOf=void 0;function UD(e){return Array.isArray(e)?"array":typeof e}no._typeOf=UD;function jD(e,t){let r=n=>Array.isArray(n)?"array":n===null?"null":typeof n;return r(e)===r(t)}no._isTypeMatch=jD});var or=N(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke._getSortedObject=Ke._DJB2Object=Ke._DJB2=void 0;var qD=nl(),$D=e=>{let t=0;for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t=(t<<5)-t+n,t=t&t}return String(t>>>0)};Ke._DJB2=$D;var zD=(e,t)=>(0,Ke._DJB2)(JSON.stringify((0,Ke._getSortedObject)(e,t)));Ke._DJB2Object=zD;var WD=(e,t)=>{if(e==null)return null;let r=Object.keys(e).sort(),n={};return r.forEach(o=>{let i=e[o];if(t===0||(0,qD._typeOf)(i)!=="object"){n[o]=i;return}n[o]=(0,Ke._getSortedObject)(i,t!=null?t-1:t)}),n};Ke._getSortedObject=WD});var ts=N(oo=>{"use strict";Object.defineProperty(oo,"__esModule",{value:!0});oo._getStorageKey=oo._getUserStorageKey=void 0;var w_=or();function x_(e,t,r){var n;if(r)return r(e,t);let o=t&&t.customIDs?t.customIDs:{},i=[`uid:${(n=t?.userID)!==null&&n!==void 0?n:""}`,`cids:${Object.keys(o).sort((s,a)=>s.localeCompare(a)).map(s=>`${s}-${o[s]}`).join(",")}`,`k:${e}`];return(0,w_._DJB2)(i.join("|"))}oo._getUserStorageKey=x_;function HD(e,t,r){return t?x_(e,t,r):(0,w_._DJB2)(`k:${e}`)}oo._getStorageKey=HD});var io=N(Je=>{"use strict";Object.defineProperty(Je,"__esModule",{value:!0});Je.NetworkParam=Je.NetworkDefault=Je.Endpoint=void 0;Je.Endpoint={_initialize:"initialize",_rgstr:"rgstr",_download_config_specs:"download_config_specs"};Je.NetworkDefault={[Je.Endpoint._rgstr]:"https://prodregistryv2.org/v1",[Je.Endpoint._initialize]:"https://featureassets.org/v1",[Je.Endpoint._download_config_specs]:"https://api.statsigcdn.com/v1"};Je.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se",IsGzipped:"gz"}});var rs=N(ol=>{"use strict";Object.defineProperty(ol,"__esModule",{value:!0});ol.SDKType=void 0;var S_={},so;ol.SDKType={_get:e=>{var t;return((t=S_[e])!==null&&t!==void 0?t:"js-mono")+(so??"")},_setClientType(e,t){S_[e]=t},_setBindingType(e){(!so||so==="-react")&&(so="-"+e)}}});var ao=N(Br=>{"use strict";Object.defineProperty(Br,"__esModule",{value:!0});Br.StatsigMetadataProvider=Br.SDK_VERSION=void 0;Br.SDK_VERSION="3.32.6";var Fp={sdkVersion:Br.SDK_VERSION,sdkType:"js-mono"};Br.StatsigMetadataProvider={get:()=>Fp,add:e=>{Fp=Object.assign(Object.assign({},Fp),e)}}});var Ye=N(te=>{"use strict";Object.defineProperty(te,"__esModule",{value:!0});te._cloneObject=te._getUnloadEvent=te._getCurrentPageUrlSafe=te._addDocumentEventListenerSafe=te._addWindowEventListenerSafe=te._isServerEnv=te._getDocumentSafe=te._getWindowSafe=void 0;var VD=re(),GD=()=>typeof window<"u"?window:null;te._getWindowSafe=GD;var KD=()=>{var e;let t=(0,te._getWindowSafe)();return(e=t?.document)!==null&&e!==void 0?e:null};te._getDocumentSafe=KD;var JD=()=>{if((0,te._getDocumentSafe)()!==null)return!1;let e=typeof process<"u"&&process.versions!=null&&process.versions.node!=null;return typeof EdgeRuntime=="string"||e};te._isServerEnv=JD;var YD=(e,t)=>{let r=(0,te._getWindowSafe)();typeof r?.addEventListener=="function"&&r.addEventListener(e,t)};te._addWindowEventListenerSafe=YD;var ZD=(e,t)=>{let r=(0,te._getDocumentSafe)();typeof r?.addEventListener=="function"&&r.addEventListener(e,t)};te._addDocumentEventListenerSafe=ZD;var XD=()=>{var e;try{return(e=(0,te._getWindowSafe)())===null||e===void 0?void 0:e.location.href.split(/[?#]/)[0]}catch{return}};te._getCurrentPageUrlSafe=XD;var QD=()=>{let e=(0,te._getWindowSafe)();return e&&"onpagehide"in e?"pagehide":"beforeunload"};te._getUnloadEvent=QD;var eN=(e,t)=>{try{return JSON.parse(JSON.stringify(t))}catch{return VD.Log.error(`Failed to clone object ${e}`),null}};te._cloneObject=eN});var uo=N(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee._notifyVisibilityChanged=Ee._subscribeToVisiblityChanged=Ee._isUnloading=Ee._isCurrentlyVisible=void 0;var ns=Ye(),il="foreground",Lp="background",v_=[],Bp=il,Up=!1,tN=()=>Bp===il;Ee._isCurrentlyVisible=tN;var rN=()=>Up;Ee._isUnloading=rN;var nN=e=>{v_.unshift(e)};Ee._subscribeToVisiblityChanged=nN;var oN=e=>{e!==Bp&&(Bp=e,v_.forEach(t=>t(e)))};Ee._notifyVisibilityChanged=oN;(0,ns._addWindowEventListenerSafe)("focus",()=>{Up=!1,(0,Ee._notifyVisibilityChanged)(il)});(0,ns._addWindowEventListenerSafe)("blur",()=>(0,Ee._notifyVisibilityChanged)(Lp));(0,ns._addDocumentEventListenerSafe)("visibilitychange",()=>{(0,Ee._notifyVisibilityChanged)(document.visibilityState==="visible"?il:Lp)});(0,ns._addWindowEventListenerSafe)((0,ns._getUnloadEvent)(),()=>{Up=!0,(0,Ee._notifyVisibilityChanged)(Lp)})});var C_=N(lo=>{"use strict";var E_=lo&&lo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(lo,"__esModule",{value:!0});lo.EventSender=void 0;var iN=re(),sN=io(),aN=rs(),uN=ao(),lN=uo(),jp=class{constructor(t,r,n,o,i){this._sdkKey=t,this._network=r,this._emitter=n,this._options=i,this._logEventUrlConfig=o}setLogEventCompressionMode(t){this._network.setLogEventCompressionMode(t)}sendBatch(t){return E_(this,void 0,void 0,function*(){var r,n,o;let i="event_sender_unexpected_exception",s={};try{let u=(0,lN._isUnloading)()&&this._network.isBeaconSupported()&&((n=(r=this._options)===null||r===void 0?void 0:r.networkConfig)===null||n===void 0?void 0:n.networkOverrideFunc)==null;i="event_sender_pre_logs_flushed_emitter_exception",this._emitter({name:"pre_logs_flushed",events:t.events}),i=u?"event_sender_unexpected_exception":"event_sender_post_exception";let l=u?this._sendEventsViaBeacon(t,s):yield this._sendEventsViaPost(t,s);return l.success?(i="event_sender_logs_flushed_emitter_exception",this._emitter({name:"logs_flushed",events:t.events}),l):Object.assign(Object.assign(Object.assign({success:!1,statusCode:l.statusCode,failurePath:l.failurePath},l.failureErrorMessage?{failureErrorMessage:l.failureErrorMessage}:{}),l.failureDiagnosticBucket?{failureDiagnosticBucket:l.failureDiagnosticBucket}:{}),l.failureDiagnosticMetadata?{failureDiagnosticMetadata:l.failureDiagnosticMetadata}:{})}catch(a){return iN.Log.warn("Failed to send batch:",a),Object.assign(Object.assign(Object.assign({success:!1,statusCode:-1,failurePath:(o=s.path)!==null&&o!==void 0?o:i},s.errorMessage?{failureErrorMessage:s.errorMessage}:{}),s.diagnosticBucket?{failureDiagnosticBucket:s.diagnosticBucket}:{}),s.diagnosticMetadata?{failureDiagnosticMetadata:s.diagnosticMetadata}:{})}})}_sendEventsViaPost(t,r){return E_(this,void 0,void 0,function*(){var n,o;let i=yield this._network.post(this._getRequestData(t),r),s=(n=i?.code)!==null&&n!==void 0?n:-1;return s===-1?Object.assign(Object.assign(Object.assign({success:!1,statusCode:-1,failurePath:(o=r.path)!==null&&o!==void 0?o:i===void 0?"event_sender_post_returned_undefined":"event_sender_post_returned_null"},r.errorMessage?{failureErrorMessage:r.errorMessage}:{}),r.diagnosticBucket?{failureDiagnosticBucket:r.diagnosticBucket}:{}),r.diagnosticMetadata?{failureDiagnosticMetadata:r.diagnosticMetadata}:{}):{success:s>=200&&s<300,statusCode:s}})}_sendEventsViaBeacon(t,r){var n;let o=this._network.beacon(this._getRequestData(t),r);return Object.assign(Object.assign(Object.assign({success:o,statusCode:o?200:-1,failurePath:o?void 0:(n=r.path)!==null&&n!==void 0?n:"beacon_send_false"},!o&&r.errorMessage?{failureErrorMessage:r.errorMessage}:{}),!o&&r.diagnosticBucket?{failureDiagnosticBucket:r.diagnosticBucket}:{}),!o&&r.diagnosticMetadata?{failureDiagnosticMetadata:r.diagnosticMetadata}:{})}_getRequestData(t){return{sdkKey:this._sdkKey,data:{events:t.events},urlConfig:this._logEventUrlConfig,retries:3,preserveFailedStatusCode:!0,isCompressable:!0,params:{[sN.NetworkParam.EventCount]:String(t.events.length)},headers:{"statsig-event-count":String(t.events.length),"statsig-retry-count":String(t.attempts),"statsig-sdk-type":aN.SDKType._get(this._sdkKey),"statsig-sdk-version":uN.SDK_VERSION},credentials:"same-origin"}}};lo.EventSender=jp});var T_=N(al=>{"use strict";Object.defineProperty(al,"__esModule",{value:!0});al.FlushInterval=void 0;var sl=1e3,qp=6e4,$p=class{constructor(){this._currentIntervalMs=sl,this._lastFlushAttemptTime=Date.now()}getCurrentIntervalMs(){return this._currentIntervalMs}markFlushAttempt(){this._lastFlushAttemptTime=Date.now()}getTimeSinceLastAttempt(){return Date.now()-this._lastFlushAttemptTime}hasReachedMaxInterval(){return this.getTimeSinceLastAttempt()>=qp}getTimeTillMaxInterval(){return qp-this.getTimeSinceLastAttempt()}hasCompletelyRecoveredFromBackoff(){return this._currentIntervalMs<=sl}adjustForSuccess(){let t=this._currentIntervalMs;t!==sl&&(this._currentIntervalMs=Math.max(sl,Math.floor(t/2)))}adjustForFailure(){let t=this._currentIntervalMs;this._currentIntervalMs=Math.min(qp,t*2)}getTimeUntilNextFlush(){return this.getCurrentIntervalMs()-this.getTimeSinceLastAttempt()}};al.FlushInterval=$p});var k_=N(ul=>{"use strict";Object.defineProperty(ul,"__esModule",{value:!0});ul.FlushType=void 0;var A_;(function(e){e.ScheduledMaxTime="scheduled:max_time",e.ScheduledFullBatch="scheduled:full_batch",e.Limit="limit",e.Manual="manual",e.Shutdown="shutdown"})(A_||(ul.FlushType=A_={}))});var I_=N(co=>{"use strict";var cN=co&&co.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(co,"__esModule",{value:!0});co._fetchTxtRecords=void 0;var dN=new Uint8Array([0,0,1,0,0,1,0,0,0,0,0,0,13,102,101,97,116,117,114,101,97,115,115,101,116,115,3,111,114,103,0,0,16,0,1]),pN="https://cloudflare-dns.com/dns-query",fN=["i","e","d"],mN=200;function hN(e){return cN(this,void 0,void 0,function*(){let t=yield e(pN,{method:"POST",headers:{"Content-Type":"application/dns-message",Accept:"application/dns-message"},body:dN});if(!t.ok){let o=new Error("Failed to fetch TXT records from DNS");throw o.name="DnsTxtFetchError",o}let r=yield t.arrayBuffer(),n=new Uint8Array(r);return gN(n)})}co._fetchTxtRecords=hN;function gN(e){let t=e.findIndex((n,o)=>o<mN&&String.fromCharCode(n)==="="&&fN.includes(String.fromCharCode(e[o-1])));if(t===-1){let n=new Error("Failed to parse TXT records from DNS");throw n.name="DnsTxtParseError",n}let r="";for(let n=t-1;n<e.length;n++)r+=String.fromCharCode(e[n]);return r.split(",")}});var pt=N(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze._setObjectInStorage=Ze._getObjectFromStorage=Ze.Storage=void 0;var P_=re(),bN=Ye(),os={},Wp={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"InMemory",getItem:e=>os[e]?os[e]:null,setItem:(e,t)=>{os[e]=t},removeItem:e=>{delete os[e]},getAllKeys:()=>Object.keys(os)},ll=null;try{let e=(0,bN._getWindowSafe)();e&&e.localStorage&&typeof e.localStorage.getItem=="function"&&(ll={isReady:()=>!0,isReadyResolver:()=>null,getProviderName:()=>"LocalStorage",getItem:t=>e.localStorage.getItem(t),setItem:(t,r)=>e.localStorage.setItem(t,r),removeItem:t=>e.localStorage.removeItem(t),getAllKeys:()=>Object.keys(e.localStorage)})}catch{P_.Log.warn("Failed to setup localStorageProvider.")}var zp=ll??Wp,dt=zp;function R_(e){try{return e()}catch(t){if(t instanceof Error&&t.name==="SecurityError")return Ze.Storage._setProvider(Wp),null;throw t}}Ze.Storage={isReady:()=>dt.isReady(),isReadyResolver:()=>dt.isReadyResolver(),getProviderName:()=>dt.getProviderName(),getItem:e=>R_(()=>dt.getItem(e)),setItem:(e,t)=>R_(()=>dt.setItem(e,t)),removeItem:e=>dt.removeItem(e),getAllKeys:()=>dt.getAllKeys(),_setProvider:e=>{zp=e,dt=e},_setDisabled:e=>{e?dt=Wp:dt=zp}};function yN(e){let t=Ze.Storage.getItem(e);try{return JSON.parse(t??"null")}catch{return P_.Log.error(`Failed to parse value for key "${e}"`),null}}Ze._getObjectFromStorage=yN;function _N(e,t){Ze.Storage.setItem(e,JSON.stringify(t))}Ze._setObjectInStorage=_N});var F_=N(ir=>{"use strict";var D_=ir&&ir.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(ir,"__esModule",{value:!0});ir._isDomainFailure=ir.NetworkFallbackResolver=void 0;var wN=I_(),xN=or(),SN=re(),Vp=pt(),N_=10080*60*1e3,vN=14400*1e3,Gp=class{constructor(t){var r;this._fallbackInfo=null,this._errorBoundary=null,this._dnsQueryCooldowns={},this._networkOverrideFunc=(r=t.networkConfig)===null||r===void 0?void 0:r.networkOverrideFunc}setErrorBoundary(t){this._errorBoundary=t}tryBumpExpiryTime(t,r){var n;let o=(n=this._fallbackInfo)===null||n===void 0?void 0:n[r.endpoint];o&&(o.expiryTime=Date.now()+N_,Hp(t,Object.assign(Object.assign({},this._fallbackInfo),{[r.endpoint]:o})))}getActiveFallbackUrl(t,r){var n,o;if(r.customUrl!=null&&r.fallbackUrls!=null)return null;let i=this._fallbackInfo;i==null&&(i=(n=EN(t))!==null&&n!==void 0?n:{},this._fallbackInfo=i);let s=i[r.endpoint];return!s||Date.now()>((o=s.expiryTime)!==null&&o!==void 0?o:0)||r.getChecksum()!==s.urlConfigChecksum?(delete i[r.endpoint],this._fallbackInfo=i,Hp(t,this._fallbackInfo),null):s.url?s.url:null}tryFetchUpdatedFallbackInfo(t,r,n,o){return D_(this,void 0,void 0,function*(){var i,s;try{if(!O_(n,o))return!1;let u=r.customUrl==null&&r.fallbackUrls==null?yield this._tryFetchFallbackUrlsFromNetwork(r):r.fallbackUrls,l=this._pickNewFallbackUrl((i=this._fallbackInfo)===null||i===void 0?void 0:i[r.endpoint],u);return l?(this._updateFallbackInfoWithNewUrl(t,r,l),!0):!1}catch(a){return(s=this._errorBoundary)===null||s===void 0||s.logError("tryFetchUpdatedFallbackInfo",a),!1}})}_updateFallbackInfoWithNewUrl(t,r,n){var o,i,s;let a={urlConfigChecksum:r.getChecksum(),url:n,expiryTime:Date.now()+N_,previous:[]},u=r.endpoint,l=(o=this._fallbackInfo)===null||o===void 0?void 0:o[u];l&&a.previous.push(...l.previous),a.previous.length>10&&(a.previous=[]);let d=(s=(i=this._fallbackInfo)===null||i===void 0?void 0:i[u])===null||s===void 0?void 0:s.url;d!=null&&a.previous.push(d),this._fallbackInfo=Object.assign(Object.assign({},this._fallbackInfo),{[u]:a}),Hp(t,this._fallbackInfo)}_tryFetchFallbackUrlsFromNetwork(t){return D_(this,void 0,void 0,function*(){var r;let n=this._dnsQueryCooldowns[t.endpoint];if(n&&Date.now()<n)return null;this._dnsQueryCooldowns[t.endpoint]=Date.now()+vN;let o=[],i=yield(0,wN._fetchTxtRecords)((r=this._networkOverrideFunc)!==null&&r!==void 0?r:fetch),s=CN(t.defaultUrl);for(let a of i){if(!a.startsWith(t.endpointDnsKey+"="))continue;let u=a.split("=");if(u.length>1){let l=u[1];l.endsWith("/")&&(l=l.slice(0,-1)),o.push(`https://${l}${s}`)}}return o})}_pickNewFallbackUrl(t,r){var n;if(r==null)return null;let o=new Set((n=t?.previous)!==null&&n!==void 0?n:[]),i=t?.url,s=null;for(let a of r){let u=a.endsWith("/")?a.slice(0,-1):a;if(!o.has(a)&&u!==i){s=u;break}}return s}};ir.NetworkFallbackResolver=Gp;function O_(e,t){var r;let n=(r=e?.toLowerCase())!==null&&r!==void 0?r:"";return t||n.includes("uncaught exception")||n.includes("failed to fetch")||n.includes("networkerror when attempting to fetch resource")}ir._isDomainFailure=O_;function M_(e){return`statsig.network_fallback.${(0,xN._DJB2)(e)}`}function Hp(e,t){let r=M_(e);if(!t||Object.keys(t).length===0){Vp.Storage.removeItem(r);return}Vp.Storage.setItem(r,JSON.stringify(t))}function EN(e){let t=M_(e),r=Vp.Storage.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch{return SN.Log.error("Failed to parse FallbackInfo"),null}}function CN(e){try{return new URL(e).pathname}catch{return null}}});var Kp=N(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.SDKFlags=void 0;var B_={};cl.SDKFlags={setFlags:(e,t)=>{B_[e]=t},get:(e,t)=>{var r,n;return(n=(r=B_[e])===null||r===void 0?void 0:r[t])!==null&&n!==void 0?n:!1}}});var pl=N(dl=>{"use strict";Object.defineProperty(dl,"__esModule",{value:!0});dl.getUUID=void 0;function TN(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(Math.random()*4)]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,n=>{let o=Math.random()*16;return e>0?(o=(e+o)%16|0,e=Math.floor(e/16)):(o=(t+o)%16|0,t=Math.floor(t/16)),(n==="x"?o:o&7|8).toString(16)})}dl.getUUID=TN});var fo=N(Lr=>{"use strict";Object.defineProperty(Lr,"__esModule",{value:!0});Lr.StatsigSession=Lr.SessionID=void 0;var AN=ts(),kN=re(),L_=pt(),IN=pl(),RN=uo(),PN=1800*1e3,DN=14400*1e3,NN=15e3,po={};(0,RN._subscribeToVisiblityChanged)(e=>{e==="background"&&Object.values(po).forEach(t=>is(t))});Lr.SessionID={get:e=>Lr.StatsigSession.get(e).data.sessionID};Lr.StatsigSession={get:(e,t=!0)=>{po[e]==null&&(po[e]=UN(e));let r=po[e];return ON(r,t)},overrideInitialSessionID:(e,t)=>{let r=Date.now(),n={data:{sessionID:e,startTime:r,lastUpdate:r},sdkKey:t,lastPersistedAt:Date.now(),storageKey:j_(t)};is(n),po[t]=n},checkForIdleSession:e=>{let t=po[e];if(!t)return;U_(t)&&is(t)}};function ON(e,t){let r=Date.now();return U_(e)?is(e):t&&(e.data.lastUpdate=r,BN(e)),e}function U_(e){var t;let r=e.data,n=MN(r)||FN(r);return n&&(e.data=q_(),(t=__STATSIG__==null?void 0:__STATSIG__.instance(e.sdkKey))===null||t===void 0||t.$emt({name:"session_expired"})),n}function MN({lastUpdate:e}){return Date.now()-e>PN}function FN({startTime:e}){return Date.now()-e>DN}function j_(e){return`statsig.session_id.${(0,AN._getStorageKey)(e)}`}function is(e){try{(0,L_._setObjectInStorage)(e.storageKey,e.data),e.lastPersistedAt=Date.now()}catch{kN.Log.warn("Failed to save SessionID")}}function BN(e){Date.now()-e.lastPersistedAt>NN&&is(e)}function LN(e){return(0,L_._getObjectFromStorage)(e)}function UN(e){let t=j_(e),r=LN(t);return r&&r.sessionID&&r.startTime&&r.lastUpdate?{data:r,sdkKey:e,lastPersistedAt:0,storageKey:t}:{data:q_(),sdkKey:e,lastPersistedAt:0,storageKey:t}}function q_(){return{sessionID:(0,IN.getUUID)(),startTime:Date.now(),lastUpdate:Date.now()}}});var ho=N(mo=>{"use strict";Object.defineProperty(mo,"__esModule",{value:!0});mo.getCookieName=mo.StableID=void 0;var W_=ts(),jN=re(),H_=Ye(),V_=pt(),qN=pl(),ss={},Yp={},$_={};mo.StableID={cookiesEnabled:!1,randomID:Math.random().toString(36),get:e=>{if($_[e])return null;if(ss[e]!=null)return ss[e];let t=null;return t=zN(e),t!=null?(ss[e]=t,Jp(t,e),t):(t=$N(e),t==null&&(t=(0,qN.getUUID)()),Jp(t,e),z_(t,e),ss[e]=t,t)},setOverride:(e,t)=>{ss[t]=e,Jp(e,t),z_(e,t)},_setCookiesEnabled:(e,t)=>{Yp[e]=t},_setDisabled:(e,t)=>{$_[e]=t}};function G_(e){return`statsig.stable_id.${(0,W_._getStorageKey)(e)}`}function Jp(e,t){let r=G_(t);try{(0,V_._setObjectInStorage)(r,e)}catch{jN.Log.warn("Failed to save StableID to storage")}}function $N(e){let t=G_(e);return(0,V_._getObjectFromStorage)(t)}function zN(e){if(!Yp[e]||(0,H_._getDocumentSafe)()==null)return null;let t=document.cookie.split(";");for(let r of t){let[n,o]=r.trim().split("=");if(n===Zp(e))return decodeURIComponent(o)}return null}function z_(e,t){if(!Yp[t]||(0,H_._getDocumentSafe)()==null)return;let r=new Date;r.setFullYear(r.getFullYear()+1),document.cookie=`${Zp(t)}=${encodeURIComponent(e)}; expires=${r.toUTCString()}; path=/`}function Zp(e){return`statsig.stable_id.${(0,W_._getStorageKey)(e)}`}mo.getCookieName=Zp});var Xp=N(fl=>{"use strict";Object.defineProperty(fl,"__esModule",{value:!0});fl.ErrorTag=void 0;fl.ErrorTag={NetworkError:"NetworkError"}});var bo=N(go=>{"use strict";Object.defineProperty(go,"__esModule",{value:!0});go.LoggingEnabledOption=go.LogEventCompressionMode=void 0;go.LogEventCompressionMode={Disabled:"d",Enabled:"e",Forced:"f"};go.LoggingEnabledOption={disabled:"disabled",browserOnly:"browser-only",always:"always"}});var tf=N(Pt=>{"use strict";var ml=Pt&&Pt.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.NetworkCore=Pt.RETRYABLE_CODES=void 0;nr();var Z_=nr(),Qp=Xu(),Ur=re(),Xe=io(),WN=F_(),HN=Kp(),X_=rs(),Q_=Ye(),ew=fo(),VN=ho(),GN=Xp(),tw=ao(),as=bo(),rw=uo(),KN=1e4,JN=500,YN=3e4,ZN=1e3,nw=50,XN=nw/ZN;Pt.RETRYABLE_CODES=new Set([408,500,502,503,504,522,524,599]);var ef=class{constructor(t,r){this._emitter=r,this._errorBoundary=null,this._timeout=KN,this._netConfig={},this._options={},this._leakyBucket={},this._lastUsedInitUrl=null,t&&(this._options=t),this._options.networkConfig&&(this._netConfig=this._options.networkConfig),this._netConfig.networkTimeoutMs&&(this._timeout=this._netConfig.networkTimeoutMs),this._fallbackResolver=new WN.NetworkFallbackResolver(this._options),this.setLogEventCompressionMode(this._getLogEventCompressionMode(t))}setLogEventCompressionMode(t){this._options.logEventCompressionMode=t}setErrorBoundary(t){this._errorBoundary=t,this._errorBoundary.wrap(this),this._errorBoundary.wrap(this._fallbackResolver),this._fallbackResolver.setErrorBoundary(t)}isBeaconSupported(){return typeof navigator<"u"&&typeof navigator.sendBeacon=="function"}getLastUsedInitUrlAndReset(){let t=this._lastUsedInitUrl;return this._lastUsedInitUrl=null,t}beacon(t,r){if(!K_(t))return r&&(r.path="beacon_invalid_sdk_key"),!1;let n=this._getInternalRequestArgs("POST",t),o=this._getPopulatedURL(n),i=navigator;try{let s=i.sendBeacon.bind(i)(o,n.body);return s||r&&(r.path="beacon_send_false"),s}catch(s){throw r&&(r.path="beacon_send_exception"),s}}post(t,r){return ml(this,void 0,void 0,function*(){let n=this._getInternalRequestArgs("POST",t);return this._tryEncodeBody(n),yield this._tryToCompressBody(n),this._sendRequest(n,r)})}get(t){let r=this._getInternalRequestArgs("GET",t);return this._sendRequest(r)}_sendRequest(t,r){return ml(this,void 0,void 0,function*(){var n,o,i,s;if(!K_(t))return r&&(r.path="network_invalid_sdk_key"),null;if(this._netConfig.preventAllNetworkTraffic)return r&&(r.path="network_prevent_all_network_traffic"),null;let{method:a,body:u,retries:l,attempt:d}=t,p=t.urlConfig.endpoint;if(this._isRateLimited(p))return Ur.Log.warn(`Request to ${p} was blocked because you are making requests too frequently.`),r&&(r.path="network_rate_limited"),null;let f=d??1,m=!1,h=this._getPopulatedURL(t),_=Date.now(),S=null,D=(0,rw._isUnloading)();try{let w={method:a,body:u,headers:Object.assign({},t.headers),priority:t.priority,keepalive:D};sO(t,f);let x=this._leakyBucket[p];x&&(x.lastRequestTime=Date.now(),this._leakyBucket[p]=x);let E=(n=this._netConfig.networkOverrideFunc)!==null&&n!==void 0?n:fetch,I;if(S=yield Promise.race([E(h,w).finally(()=>clearTimeout(I)),new Promise((q,X)=>{I=setTimeout(()=>{m=!0,X(new Error(`Timeout of ${this._timeout}ms expired.`))},this._timeout)})]),!S.ok){let q=yield S.text().catch(()=>"No Text"),X=new Error(`NetworkError: ${h} ${q}`);throw X.name="NetworkError",X}let T=yield S.text();return Y_(t,S,f,T),this._fallbackResolver.tryBumpExpiryTime(t.sdkKey,t.urlConfig),{body:T,code:S.status}}catch(w){let x=tO(w),E=rO(x??"",m);if(Y_(t,S,f,"",w),(yield this._fallbackResolver.tryFetchUpdatedFallbackInfo(t.sdkKey,t.urlConfig,x,E))&&(t.fallbackUrl=this._fallbackResolver.getActiveFallbackUrl(t.sdkKey,t.urlConfig)),!l||f>l||!Pt.RETRYABLE_CODES.has((o=S?.status)!==null&&o!==void 0?o:500)){(i=this._emitter)===null||i===void 0||i.call(this,{name:"error",error:w,tag:GN.ErrorTag.NetworkError,requestArgs:t});let T=`A networking error occurred during ${a} request to ${h}.`;if(Ur.Log.error(T,x,w),(s=this._errorBoundary)===null||s===void 0||s.attachErrorIfNoneExists(T),t.preserveFailedStatusCode&&S!=null)return{body:null,code:S.status};if(S==null&&r){r.path=E?"network_request_timed_out_no_response":"network_request_exception_no_response",x&&(r.errorMessage=x);try{let q=nO(t,h,E,Date.now()-_);r.diagnosticBucket=q.bucket,r.diagnosticMetadata=q.metadata}catch{}}return null}return yield aO(f),this._sendRequest(Object.assign(Object.assign({},t),{retries:l,attempt:f+1}),r)}})}_getLogEventCompressionMode(t){let r=t?.logEventCompressionMode;return!r&&t?.disableCompression===!0&&(r=as.LogEventCompressionMode.Disabled),r||(r=as.LogEventCompressionMode.Enabled),r}_isRateLimited(t){var r;let n=Date.now(),o=(r=this._leakyBucket[t])!==null&&r!==void 0?r:{count:0,lastRequestTime:n},i=n-o.lastRequestTime,s=Math.floor(i*XN);return o.count=Math.max(0,o.count-s),o.count>=nw?!0:(o.count+=1,o.lastRequestTime=n,this._leakyBucket[t]=o,!1)}_getPopulatedURL(t){var r;let n=(r=t.fallbackUrl)!==null&&r!==void 0?r:t.urlConfig.getUrl();(t.urlConfig.endpoint===Xe.Endpoint._initialize||t.urlConfig.endpoint===Xe.Endpoint._download_config_specs)&&(this._lastUsedInitUrl=n);let o=Object.assign({[Xe.NetworkParam.SdkKey]:t.sdkKey,[Xe.NetworkParam.SdkType]:X_.SDKType._get(t.sdkKey),[Xe.NetworkParam.SdkVersion]:tw.SDK_VERSION,[Xe.NetworkParam.Time]:String(Date.now()),[Xe.NetworkParam.SessionID]:ew.SessionID.get(t.sdkKey)},t.params),i=Object.keys(o).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(o[s])}`).join("&");return`${n}${i?`?${i}`:""}`}_tryEncodeBody(t){var r;let n=(0,Q_._getWindowSafe)(),o=t.body;if(!(!t.isStatsigEncodable||this._options.disableStatsigEncoding||typeof o!="string"||(0,Z_._getStatsigGlobalFlag)("no-encode")!=null||!n?.btoa))try{t.body=n.btoa(o).split("").reverse().join(""),t.params=Object.assign(Object.assign({},(r=t.params)!==null&&r!==void 0?r:{}),{[Xe.NetworkParam.StatsigEncoded]:"1"})}catch(i){Ur.Log.warn(`Request encoding failed for ${t.urlConfig.getUrl()}`,i)}}_tryToCompressBody(t){return ml(this,void 0,void 0,function*(){var r;let n=t.body;if(!(typeof n!="string"||!eO(t,this._options)))try{let o=new TextEncoder().encode(n),i=new CompressionStream("gzip"),s=i.writable.getWriter();s.write(o).catch(Ur.Log.error),s.close().catch(Ur.Log.error);let a=i.readable.getReader(),u=[],l;for(;!(l=yield a.read()).done;)u.push(l.value);let d=u.reduce((m,h)=>m+h.length,0),p=new Uint8Array(d),f=0;for(let m of u)p.set(m,f),f+=m.length;t.body=p,t.params=Object.assign(Object.assign({},(r=t.params)!==null&&r!==void 0?r:{}),{[Xe.NetworkParam.IsGzipped]:"1"})}catch(o){Ur.Log.warn(`Request compression failed for ${t.urlConfig.getUrl()}`,o)}})}_getInternalRequestArgs(t,r){let n=this._fallbackResolver.getActiveFallbackUrl(r.sdkKey,r.urlConfig),o=Object.assign(Object.assign({},r),{method:t,fallbackUrl:n});return"data"in r&&QN(o,r.data),o}};Pt.NetworkCore=ef;var K_=e=>e.sdkKey?!0:(Ur.Log.warn("Unable to make request without an SDK key"),!1),QN=(e,t)=>{let{sdkKey:r,fallbackUrl:n}=e,o=VN.StableID.get(r),i=ew.SessionID.get(r),s=X_.SDKType._get(r);e.body=JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},tw.StatsigMetadataProvider.get()),{stableID:o,sessionID:i,sdkType:s,fallbackUrl:n})}))};function eO(e,t){if(!e.isCompressable||(0,Z_._getStatsigGlobalFlag)("no-compress")!=null||typeof CompressionStream>"u"||typeof TextEncoder>"u")return!1;let r=e.urlConfig.customUrl!=null||e.urlConfig.fallbackUrls!=null,n=HN.SDKFlags.get(e.sdkKey,"enable_log_event_compression")===!0;switch(t.logEventCompressionMode){case as.LogEventCompressionMode.Disabled:return!1;case as.LogEventCompressionMode.Enabled:return!(r&&!n);case as.LogEventCompressionMode.Forced:return!0;default:return!1}}function tO(e){return typeof e=="string"?e:e instanceof Error?`${e.name}: ${e.message}`:"Unknown Error"}function rO(e,t){return e.includes("Timeout")||t}function nO(e,t,r,n){var o,i,s;let a=(0,Q_._getWindowSafe)(),u=a?.document,l=typeof navigator<"u"?navigator:null,d=(0,rw._isUnloading)(),p=l&&typeof l.onLine=="boolean"?String(l.onLine):"unknown",f=(o=u?.visibilityState)!==null&&o!==void 0?o:"unknown",m=Object.keys((i=e.headers)!==null&&i!==void 0?i:{}).length>0,h=oO(t,(s=a?.location)===null||s===void 0?void 0:s.origin),_=e.urlConfig.customUrl!=null,S=e.fallbackUrl!=null,D=J_(n,[250,1e3,5e3,1e4]),w=J_(iO(e.body),[16384,65536,262144,1048576]),x="unknown_no_response";return r?x="timeout":p==="false"?x="browser_offline":d?x="page_unloading":f==="hidden"?x="page_hidden":h&&m?x="cross_origin_custom_headers_preflight_risk":_||S?x="custom_url_no_response":n<250&&(x="immediate_network_rejection"),{bucket:x,metadata:{elapsedMsBucket:D,bodySizeBucket:w,online:p,visibilityState:f,isUnloading:String(d),crossOrigin:String(h),hasCustomUrl:String(_)}}}function oO(e,t){return t?!e.startsWith(`${t}/`)&&!e.startsWith(`${t}?`)&&e!==t:!0}function iO(e){return e==null?0:typeof e=="string"?e.length:e instanceof Uint8Array?e.byteLength:typeof Blob<"u"&&e instanceof Blob?e.size:-1}function J_(e,t){if(e<0)return"unknown";for(let r of t)if(e<r)return`<${r}`;return`>=${t[t.length-1]}`}function sO(e,t){e.urlConfig.endpoint===Xe.Endpoint._initialize&&Qp.Diagnostics._markInitNetworkReqStart(e.sdkKey,{attempt:t})}function Y_(e,t,r,n,o){e.urlConfig.endpoint===Xe.Endpoint._initialize&&Qp.Diagnostics._markInitNetworkReqEnd(e.sdkKey,Qp.Diagnostics._getDiagnosticsData(t,r,n,o))}function aO(e){return ml(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,Math.min(JN*(e*e),YN)))})}});var ow=N(yo=>{"use strict";var jr=yo&&yo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(yo,"__esModule",{value:!0});yo.FlushCoordinator=void 0;var sr=tl(),uO=C_(),lO=T_(),qr=k_(),cO=or(),Ie=re(),dO=tf(),pO=Ye(),hl=fo(),fO=bo(),us=pt(),mO=new Set(["network_request_timed_out_no_response","network_request_exception_no_response","event_sender_post_returned_null","event_sender_post_returned_undefined","event_sender_post_exception"]),rf=class{constructor(t,r,n,o,i,s,a,u,l,d){this._cooldownTimer=null,this._maxIntervalTimer=null,this._hasRunQuickFlush=!1,this._currentFlushPromise=null,this._creationTime=Date.now(),this._isShuttingDown=!1,this._storageKey=null,this._flushInterval=new lO.FlushInterval,this._batchQueue=t,this._pendingEvents=r,this._onPrepareFlush=n,this._errorBoundary=d,this._sdkKey=o,this._loggingEnabled=l,this._eventSender=new uO.EventSender(o,i,s,a,u)}setLoggingEnabled(t){this._loggingEnabled=t}setLogEventCompressionMode(t){this._eventSender.setLogEventCompressionMode(t)}startScheduledFlushCycle(){this._scheduleNextFlush()}stopScheduledFlushCycle(){this._clearAllTimers()}addEvent(t){this._pendingEvents.addToPendingEventsQueue(t),!this._currentFlushPromise&&this._pendingEvents.hasEventsForFullBatch()&&this.processLimitFlush()}processManualFlush(){return jr(this,void 0,void 0,function*(){return this._currentFlushPromise&&(yield this._currentFlushPromise),this._currentFlushPromise=this._executeFlush(qr.FlushType.Manual).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()}),this._currentFlushPromise})}processShutdown(){return jr(this,void 0,void 0,function*(){return this._isShuttingDown=!0,this._clearAllTimers(),this._currentFlushPromise&&(yield this._currentFlushPromise),this._currentFlushPromise=this._executeFlush(qr.FlushType.Shutdown).catch(t=>{Ie.Log.error(`Error during shutdown flush: ${t}`)}).finally(()=>{this._currentFlushPromise=null}),this._currentFlushPromise})}_executeFlush(t){return jr(this,void 0,void 0,function*(){this._clearAllTimers();try{this._prepareQueueForFlush(t);let r=this._batchQueue.takeAllBatches();if(r.length===0)return;yield Promise.all(r.map(n=>this._processOneBatch(n,t)))}finally{this._isShuttingDown||this._scheduleNextFlush()}})}checkQuickFlush(){this._hasRunQuickFlush||Date.now()-this._creationTime>sr.EventRetryConstants.QUICK_FLUSH_WINDOW_MS||(this._hasRunQuickFlush=!0,setTimeout(()=>{this.processManualFlush().catch(t=>{Ie.Log.warn("Quick flush failed:",t)})},sr.EventRetryConstants.QUICK_FLUSH_WINDOW_MS))}_attemptScheduledFlush(){if(this._currentFlushPromise){this._scheduleNextFlush();return}let t=this.containsAtLeastOneFullBatch(),r=this._flushInterval.hasReachedMaxInterval();if(!t&&!r){this._scheduleNoopPollTick();return}this._flushInterval.markFlushAttempt();let n;t?n=qr.FlushType.ScheduledFullBatch:n=qr.FlushType.ScheduledMaxTime,this._currentFlushPromise=this._processNextBatch(n).then(()=>{}).catch(o=>{Ie.Log.error("Error during scheduled flush:",o)}).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()})}processLimitFlush(){this._flushInterval.hasCompletelyRecoveredFromBackoff()&&(this._currentFlushPromise||(this._currentFlushPromise=this._processLimitFlushInternal().catch(t=>{Ie.Log.error("Error during limit flush",t)}).finally(()=>{this._currentFlushPromise=null,this._scheduleNextFlush()})))}_processLimitFlushInternal(){return jr(this,void 0,void 0,function*(){if(yield this._processNextBatch(qr.FlushType.Limit))for(;this._flushInterval.hasCompletelyRecoveredFromBackoff()&&this.containsAtLeastOneFullBatch()&&(yield this._processNextBatch(qr.FlushType.Limit)););})}_scheduleNextFlush(){if(this._clearAllTimers(),this._isShuttingDown)return;let t=Math.max(0,this._flushInterval.getTimeUntilNextFlush());this._cooldownTimer=setTimeout(()=>{this._cooldownTimer=null,hl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},t);let r=Math.max(0,this._flushInterval.getTimeTillMaxInterval());this._maxIntervalTimer=setTimeout(()=>{this._maxIntervalTimer=null,hl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},r)}_clearAllTimers(){this._cooldownTimer!==null&&(clearTimeout(this._cooldownTimer),this._cooldownTimer=null),this._maxIntervalTimer!==null&&(clearTimeout(this._maxIntervalTimer),this._maxIntervalTimer=null)}_scheduleNoopPollTick(){if(this._clearAllTimers(),this._isShuttingDown)return;this._cooldownTimer=setTimeout(()=>{this._cooldownTimer=null,hl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},sr.EventRetryConstants.TICK_INTERVAL_MS);let t=Math.max(0,this._flushInterval.getTimeTillMaxInterval());this._maxIntervalTimer=setTimeout(()=>{this._maxIntervalTimer=null,hl.StatsigSession.checkForIdleSession(this._sdkKey),this._attemptScheduledFlush()},t)}_processNextBatch(t){return jr(this,void 0,void 0,function*(){this._prepareQueueForFlush(t);let r=this._batchQueue.takeNextBatch();return r?this._processOneBatch(r,t):!1})}_processOneBatch(t,r){return jr(this,void 0,void 0,function*(){if(this._loggingEnabled!==fO.LoggingEnabledOption.always&&(0,pO._isServerEnv)())return this._flushInterval.adjustForSuccess(),!0;let n=yield this._eventSender.sendBatch(t);return n.success?(this._flushInterval.adjustForSuccess(),!0):(this._flushInterval.adjustForFailure(),this._handleFailure(t,r,n.statusCode,n.failurePath,n.failureErrorMessage,n.failureDiagnosticBucket,n.failureDiagnosticMetadata),!1)})}_prepareQueueForFlush(t){this._onPrepareFlush();let r=this.convertPendingEventsToBatches();r>0&&(Ie.Log.warn(`Dropped ${r} events`),this._errorBoundary.logDroppedEvents(r,"Batch queue limit reached during batching",{loggingInterval:this._flushInterval.getCurrentIntervalMs(),batchSize:this._batchQueue.batchSize(),maxPendingBatches:sr.EventRetryConstants.MAX_PENDING_BATCHES,flushType:t,retries:"dropped before batching"}))}containsAtLeastOneFullBatch(){return this._pendingEvents.hasEventsForFullBatch()||this._batchQueue.hasFullBatch()}convertPendingEventsToBatches(){if(this._pendingEvents.isEmpty())return 0;let t=this._pendingEvents.takeAll();return this._batchQueue.createBatches(t)}_isRetryableBatch(t,r){return!!(dO.RETRYABLE_CODES.has(t)||t===-1&&r&&mO.has(r))}_handleFailure(t,r,n,o,i,s,a){if(r===qr.FlushType.Shutdown){Ie.Log.warn(`${r} flush failed during shutdown. ${t.events.length} event(s) will be saved to storage for retry in next session.`),this._saveShutdownFailedEventsToStorage(t.events);return}if(!this._isRetryableBatch(n,o)){let l="non-retryable error";Ie.Log.warn(`${r} flush failed after ${t.attempts} attempt(s). ${t.events.length} event(s) will be dropped. Non-retryable error: ${n}`),this._errorBoundary.logEventRequestFailure(t.events.length,l,r,n,t.attempts,o,i,s,a);return}if(t.attempts>=sr.EventRetryConstants.MAX_RETRY_ATTEMPTS){let l="max retry attempts exceeded";Ie.Log.warn(`${r} flush failed after ${t.attempts} attempt(s). ${t.events.length} event(s) will be dropped.`),this._errorBoundary.logEventRequestFailure(t.events.length,l,r,n,t.attempts,o,i,s,a);return}t.incrementAttempts();let u=this._batchQueue.requeueBatch(t);u>0&&(Ie.Log.warn(`Failed to requeue batch : dropped ${u} events due to full queue`),this._errorBoundary.logDroppedEvents(u,"Batch queue limit reached during requeue",{loggingInterval:this._flushInterval.getCurrentIntervalMs(),batchSize:this._batchQueue.batchSize(),maxPendingBatches:sr.EventRetryConstants.MAX_PENDING_BATCHES,flushType:r,retries:t.attempts}))}loadAndRetryShutdownFailedEvents(){return jr(this,void 0,void 0,function*(){let t=this._getStorageKey();try{us.Storage.isReady()||(yield us.Storage.isReadyResolver());let r=this._getShutdownFailedEventsFromStorage(t);if(r.length===0)return;Ie.Log.debug(`Loading ${r.length} failed shutdown event(s) from storage for retry`),us.Storage.removeItem(t),r.forEach(n=>{this.addEvent(n)}),yield this.processManualFlush()}catch(r){Ie.Log.warn("Failed to load and retry failed shutdown events:",r)}})}_getStorageKey(){return this._storageKey||(this._storageKey=`statsig.failed_shutdown_events.${(0,cO._DJB2)(this._sdkKey)}`),this._storageKey}_saveShutdownFailedEventsToStorage(t){let r=this._getStorageKey();try{let o=[...this._getShutdownFailedEventsFromStorage(r),...t];o.length>sr.EventRetryConstants.MAX_LOCAL_STORAGE&&(o=o.slice(-sr.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,us._setObjectInStorage)(r,o),Ie.Log.debug(`Saved ${t.length} failed shutdown event(s) to storage (total stored: ${o.length})`)}catch(n){Ie.Log.warn("Unable to save failed shutdown events to storage:",n)}}_getShutdownFailedEventsFromStorage(t){try{let r=(0,us._getObjectFromStorage)(t);return Array.isArray(r)?r:[]}catch{return[]}}};yo.FlushCoordinator=rf});var iw=N(gl=>{"use strict";Object.defineProperty(gl,"__esModule",{value:!0});gl.PendingEvents=void 0;var hO=re(),nf=class{constructor(t){this._pendingEvents=[],this._batchSize=t}addToPendingEventsQueue(t){this._pendingEvents.push(t),hO.Log.debug("Enqueued Event:",t)}hasEventsForFullBatch(){return this._pendingEvents.length>=this._batchSize}takeAll(){let t=this._pendingEvents;return this._pendingEvents=[],t}isEmpty(){return this._pendingEvents.length===0}};gl.PendingEvents=nf});var sf=N(Fe=>{"use strict";Object.defineProperty(Fe,"__esModule",{value:!0});Fe._createLayerParameterExposure=Fe._createConfigExposure=Fe._mapExposures=Fe._createGateExposure=Fe._isExposureEvent=void 0;var sw="statsig::config_exposure",aw="statsig::gate_exposure",uw="statsig::layer_exposure",of=(e,t,r,n,o)=>(r.bootstrapMetadata&&(n.bootstrapMetadata=r.bootstrapMetadata),{eventName:e,user:t,value:null,metadata:wO(r,n),secondaryExposures:o,time:Date.now()}),gO=({eventName:e})=>e===aw||e===sw||e===uw;Fe._isExposureEvent=gO;var bO=(e,t,r)=>{var n,o,i;let s={gate:t.name,gateValue:String(t.value),ruleID:t.ruleID};return((n=t.__evaluation)===null||n===void 0?void 0:n.version)!=null&&(s.configVersion=t.__evaluation.version),of(aw,e,t.details,s,bl((i=(o=t.__evaluation)===null||o===void 0?void 0:o.secondary_exposures)!==null&&i!==void 0?i:[],r))};Fe._createGateExposure=bO;function bl(e,t){return e.map(r=>typeof r=="string"?(t??{})[r]:r).filter(r=>r!=null)}Fe._mapExposures=bl;var yO=(e,t,r)=>{var n,o,i,s;let a={config:t.name,ruleID:t.ruleID};return((n=t.__evaluation)===null||n===void 0?void 0:n.version)!=null&&(a.configVersion=t.__evaluation.version),((o=t.__evaluation)===null||o===void 0?void 0:o.passed)!=null&&(a.rulePassed=String(t.__evaluation.passed)),of(sw,e,t.details,a,bl((s=(i=t.__evaluation)===null||i===void 0?void 0:i.secondary_exposures)!==null&&s!==void 0?s:[],r))};Fe._createConfigExposure=yO;var _O=(e,t,r,n)=>{var o,i,s,a,u,l,d;let p=t.__evaluation,f=((o=p?.explicit_parameters)===null||o===void 0?void 0:o.includes(r))===!0,m="",h=(i=p?.undelegated_secondary_exposures)!==null&&i!==void 0?i:[];f&&(m=(s=p.allocated_experiment_name)!==null&&s!==void 0?s:"",h=(a=p.secondary_exposures)!==null&&a!==void 0?a:[]);let _=(u=t.__evaluation)===null||u===void 0?void 0:u.parameter_rule_ids,S={config:t.name,parameterName:r,ruleID:(l=_?.[r])!==null&&l!==void 0?l:t.ruleID,allocatedExperiment:m,isExplicitParameter:String(f)};return((d=t.__evaluation)===null||d===void 0?void 0:d.version)!=null&&(S.configVersion=t.__evaluation.version),of(uw,e,t.details,S,bl(h,n))};Fe._createLayerParameterExposure=_O;var wO=(e,t)=>(t.reason=e.reason,e.lcut&&(t.lcut=String(e.lcut)),e.receivedAt&&(t.receivedAt=String(e.receivedAt)),t)});var uf=N(_l=>{"use strict";Object.defineProperty(_l,"__esModule",{value:!0});_l.UrlConfiguration=void 0;var xO=or(),yl=io(),SO={[yl.Endpoint._initialize]:"i",[yl.Endpoint._rgstr]:"e",[yl.Endpoint._download_config_specs]:"d"},af=class{constructor(t,r,n,o){this.customUrl=null,this.fallbackUrls=null,this.endpoint=t,this.endpointDnsKey=SO[t],r&&(this.customUrl=r),!r&&n&&(this.customUrl=n.endsWith("/")?`${n}${t}`:`${n}/${t}`),o&&(this.fallbackUrls=o);let i=yl.NetworkDefault[t];this.defaultUrl=`${i}/${t}`}getUrl(){var t;return(t=this.customUrl)!==null&&t!==void 0?t:this.defaultUrl}getChecksum(){var t;let r=((t=this.fallbackUrls)!==null&&t!==void 0?t:[]).sort().join(",");return(0,xO._DJB2)(this.customUrl+r)}};_l.UrlConfiguration=af});var mf=N(_o=>{"use strict";var lw=_o&&_o.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(_o,"__esModule",{value:!0});_o.EventLogger=void 0;var vO=__(),EO=ts(),lf=tl(),CO=ow(),TO=or(),ls=re(),AO=io(),kO=iw(),cf=Ye(),IO=sf(),cw=bo(),df=pt(),RO=uf(),PO=uo(),DO=1e3,NO=6e5,pf={},ff=class e{static _safeFlushAndForget(t){var r;(r=pf[t])===null||r===void 0||r.flush().catch(()=>{})}constructor(t,r,n,o,i){var s;this._sdkKey=t,this._emitter=r,this._network=n,this._options=o,this._errorBoundary=i,this._pendingEvents=null,this._batchQueue=null,this._flushCoordinator=null,this._lastExposureTimeMap={},this._nonExposedChecks={},this._isShuttingDown=!1,this._storageKey=null,this._pendingCompressionMode=null,this._loggingEnabled=(s=o?.loggingEnabled)!==null&&s!==void 0?s:o?.disableLogging===!0?cw.LoggingEnabledOption.disabled:cw.LoggingEnabledOption.browserOnly,o?.loggingEnabled&&o.disableLogging!==void 0&&ls.Log.warn("Detected both loggingEnabled and disableLogging options. loggingEnabled takes precedence - please remove disableLogging.");let a=o?.networkConfig;this._logEventUrlConfig=new RO.UrlConfiguration(AO.Endpoint._rgstr,a?.logEventUrl,a?.api,a?.logEventFallbackUrls)}setLogEventCompressionMode(t){this._flushCoordinator?this._flushCoordinator.setLogEventCompressionMode(t):this._pendingCompressionMode=t}setLoggingEnabled(t){let r=this._loggingEnabled==="disabled",n=t!=="disabled";if(this._loggingEnabled=t,this._flushCoordinator&&this._flushCoordinator.setLoggingEnabled(t),r&&n){let o=this._loadStoredEvents();ls.Log.debug(`Loaded ${o.length} stored event(s) from storage`),o.length>0&&(o.forEach(i=>{this._initFlushCoordinator().addEvent(i)}),this.flush().catch(i=>{ls.Log.warn("Failed to flush events after enabling logging:",i)}))}}enqueue(t){var r;if(!this._shouldLogEvent(t))return;let n=this._normalizeEvent(t);if(this._loggingEnabled==="disabled"){this._storeEventToStorage(n);return}this._initFlushCoordinator().addEvent(n),(r=this._flushCoordinator)===null||r===void 0||r.checkQuickFlush()}incrementNonExposureCount(t){var r;let n=(r=this._nonExposedChecks[t])!==null&&r!==void 0?r:0;this._nonExposedChecks[t]=n+1}reset(){this.flush().catch(()=>{}),this._lastExposureTimeMap={}}start(){var t;let r=(0,cf._isServerEnv)();if(r&&((t=this._options)===null||t===void 0?void 0:t.loggingEnabled)!=="always")return;let n=this._initFlushCoordinator();pf[this._sdkKey]=this,r||(0,PO._subscribeToVisiblityChanged)(o=>{o==="background"?e._safeFlushAndForget(this._sdkKey):o==="foreground"&&n.startScheduledFlushCycle()}),n.loadAndRetryShutdownFailedEvents().catch(o=>{ls.Log.warn("Failed to load failed shutdown events:",o)}),n.startScheduledFlushCycle()}stop(){return lw(this,void 0,void 0,function*(){this._isShuttingDown=!0,this._flushCoordinator&&(yield this._flushCoordinator.processShutdown()),delete pf[this._sdkKey],this._flushCoordinator=null,this._pendingEvents=null,this._batchQueue=null})}flush(){return lw(this,void 0,void 0,function*(){if(this._flushCoordinator)return this._flushCoordinator.processManualFlush()})}appendAndResetNonExposedChecks(){if(Object.keys(this._nonExposedChecks).length===0)return;let t=Object.assign({},this._nonExposedChecks);this._nonExposedChecks={};let r=this._normalizeEvent({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:t}});this._flushCoordinator&&this._flushCoordinator.addEvent(r)}_shouldLogEvent(t){var r;if(((r=this._options)===null||r===void 0?void 0:r.loggingEnabled)!=="always"&&(0,cf._isServerEnv)())return!1;if(!(0,IO._isExposureEvent)(t))return!0;let n=t.user?t.user:{statsigEnvironment:void 0},o=(0,EO._getUserStorageKey)(this._sdkKey,n),i=t.metadata?t.metadata:{},s=[t.eventName,o,i.gate,i.config,i.ruleID,i.allocatedExperiment,i.parameterName,String(i.isExplicitParameter),i.reason].join("|"),a=this._lastExposureTimeMap[s],u=Date.now();return a&&u-a<NO?!1:(Object.keys(this._lastExposureTimeMap).length>DO&&(this._lastExposureTimeMap={}),this._lastExposureTimeMap[s]=u,!0)}_getCurrentPageUrl(){var t;if(((t=this._options)===null||t===void 0?void 0:t.includeCurrentPageUrlWithEvents)!==!1)return(0,cf._getCurrentPageUrlSafe)()}_getStorageKey(){return this._storageKey||(this._storageKey=`statsig.pending_events.${(0,TO._DJB2)(this._sdkKey)}`),this._storageKey}_initFlushCoordinator(){var t,r;if(this._flushCoordinator)return this._flushCoordinator;let n=(r=(t=this._options)===null||t===void 0?void 0:t.loggingBufferMaxSize)!==null&&r!==void 0?r:lf.EventRetryConstants.DEFAULT_BATCH_SIZE;return this._pendingEvents=new kO.PendingEvents(n),this._batchQueue=new vO.BatchQueue(n),this._flushCoordinator=new CO.FlushCoordinator(this._batchQueue,this._pendingEvents,()=>this.appendAndResetNonExposedChecks(),this._sdkKey,this._network,this._emitter,this._logEventUrlConfig,this._options,this._loggingEnabled,this._errorBoundary),this._pendingCompressionMode&&(this._flushCoordinator.setLogEventCompressionMode(this._pendingCompressionMode),this._pendingCompressionMode=null),this._flushCoordinator}_storeEventToStorage(t){let r=this._getStorageKey();try{let n=this._getEventsFromStorage(r);n.push(t),n.length>lf.EventRetryConstants.MAX_LOCAL_STORAGE&&(n=n.slice(-lf.EventRetryConstants.MAX_LOCAL_STORAGE)),(0,df._setObjectInStorage)(r,n)}catch{ls.Log.warn("Unable to save events to storage")}}_getEventsFromStorage(t){try{let r=(0,df._getObjectFromStorage)(t);return Array.isArray(r)?r:[]}catch{return[]}}_loadStoredEvents(){let t=this._getStorageKey(),r=this._getEventsFromStorage(t);return r.length>0&&df.Storage.removeItem(t),r}_normalizeEvent(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);let r={},n=this._getCurrentPageUrl();return n&&(r.statsigMetadata={currentPage:n}),Object.assign(Object.assign({},t),r)}};_o.EventLogger=ff});var dw=N(wl=>{"use strict";Object.defineProperty(wl,"__esModule",{value:!0});wl.PrecomputedEvaluationsContextHandle=void 0;var OO=re(),MO=Ye(),FO=fo(),BO=ho(),hf=class{constructor(t,r,n,o,i,s){this._sdkKey=t,this._getOptions=r,this._getErrorBoundary=n,this._getValues=o,this._getUser=i,this._getSdkInstanceID=s}get sdkKey(){return this._sdkKey}get options(){return this._getOptions()}get errorBoundary(){return this._getErrorBoundary()}get values(){return this._getValues()}get user(){let t=(0,MO._cloneObject)("StatsigUser",this._getUser());return t==null&&(OO.Log.error("Failed to clone user"),t={}),t}getSession(t=!0){return FO.StatsigSession.get(this._sdkKey,t)}get stableID(){return BO.StableID.get(this._sdkKey)}get sdkInstanceID(){return this._getSdkInstanceID()}toContext(t=!0){return{sdkKey:this.sdkKey,options:this.options,values:this.values,user:this.user,errorBoundary:this.errorBoundary,session:this.getSession(t),stableID:this.stableID,sdkInstanceID:this.sdkInstanceID}}};wl.PrecomputedEvaluationsContextHandle=hf});var gf=N(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar._getUnitIDFromUser=ar._getFullUserHash=ar._normalizeUser=void 0;var LO=or(),UO=re(),jO=Ye();function qO(e,t,r){let n=(0,jO._cloneObject)("StatsigUser",e);return n==null?(UO.Log.error("Failed to clone user"),{statsigEnvironment:void 0}):(t!=null&&t.environment!=null?n.statsigEnvironment=t.environment:r!=null&&(n.statsigEnvironment={tier:r}),n)}ar._normalizeUser=qO;function $O(e){return e?(0,LO._DJB2Object)(e):null}ar._getFullUserHash=$O;function zO(e,t){var r,n,o;if(typeof t!="string")return e.userID;let i=t.toLowerCase();return i!=="userid"?(n=(r=e.customIDs)===null||r===void 0?void 0:r[t])!==null&&n!==void 0?n:(o=e.customIDs)===null||o===void 0?void 0:o[i]:e.userID}ar._getUnitIDFromUser=zO});var bf=N(xl=>{"use strict";Object.defineProperty(xl,"__esModule",{value:!0});xl._typedJsonParse=void 0;var WO=re();function HO(e,t,r){try{let n=JSON.parse(e);if(n&&typeof n=="object"&&t in n)return n}catch{}return WO.Log.error(`Failed to parse ${r}`),null}xl._typedJsonParse=HO});var hw=N(lr=>{"use strict";var yf=lr&&lr.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(lr,"__esModule",{value:!0});lr._makeDataAdapterResult=lr.DataAdapterCore=void 0;var Sl=re(),pw=ho(),vl=gf(),ur=pt(),fw=bf(),VO=10,GO=8,_f=class{constructor(t,r){this._adapterName=t,this._cacheSuffix=r,this._options=null,this._sdkKey=null,this._cacheLimit=VO,this._lastModifiedStoreKey=`statsig.last_modified_time.${r}`,this._inMemoryCache=new wf}attach(t,r,n){this._sdkKey=t,this._options=r}getDataSync(t){let r=t&&(0,vl._normalizeUser)(t,this._options),n=this._getCacheKey(r),o=this._inMemoryCache.get(n,r);if(o&&this._getIsCacheValueValid(o))return o;let i=this._loadFromCache(n);return i&&this._getIsCacheValueValid(i)?(this._inMemoryCache.add(n,i,this._cacheLimit),this._inMemoryCache.get(n,r)):null}setData(t,r){let n=r&&(0,vl._normalizeUser)(r,this._options),o=this._getCacheKey(n);this._inMemoryCache.add(o,El("Bootstrap",t,null,n),this._cacheLimit)}_getIsCacheValueValid(t){return t.stableID==null||t.stableID===pw.StableID.get(this._getSdkKey())}_getDataAsyncImpl(t,r,n){return yf(this,void 0,void 0,function*(){ur.Storage.isReady()||(yield ur.Storage.isReadyResolver());let o=t??this.getDataSync(r),i=[this._fetchAndPrepFromNetwork(o,r,n)];return n?.timeoutMs&&i.push(new Promise(s=>setTimeout(s,n.timeoutMs)).then(()=>(Sl.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(i)})}_prefetchDataImpl(t,r){return yf(this,void 0,void 0,function*(){let n=t&&(0,vl._normalizeUser)(t,this._options),o=this._getCacheKey(n),i=yield this._getDataAsyncImpl(null,n,r);i&&this._inMemoryCache.add(o,Object.assign(Object.assign({},i),{source:"Prefetch"}),this._cacheLimit)})}_fetchAndPrepFromNetwork(t,r,n){return yf(this,void 0,void 0,function*(){var o;let i=(o=t?.data)!==null&&o!==void 0?o:null,s=t!=null&&this._isCachedResultValidFor204(t,r),a=yield this._fetchFromNetwork(i,r,n,s);if(!a)return Sl.Log.debug("No response returned for latest value"),null;let u=(0,fw._typedJsonParse)(a,"has_updates","Response"),l=this._getSdkKey(),d=pw.StableID.get(l),p=null;if(u?.has_updates===!0)p=El("Network",a,d,r);else if(i&&u?.has_updates===!1)p=El("NetworkNotModified",i,d,r);else return null;let f=this._getCacheKey(r);return this._inMemoryCache.add(f,p,this._cacheLimit),this._writeToCache(f,p),p})}_getSdkKey(){return this._sdkKey!=null?this._sdkKey:(Sl.Log.error(`${this._adapterName} is not attached to a Client`),"")}_loadFromCache(t){var r;let n=(r=ur.Storage.getItem)===null||r===void 0?void 0:r.call(ur.Storage,t);if(n==null)return null;let o=(0,fw._typedJsonParse)(n,"source","Cached Result");return o?Object.assign(Object.assign({},o),{source:"Cache"}):null}_writeToCache(t,r){let n=JSON.stringify(r);for(let o=0;o<GO;o++)try{ur.Storage.setItem(t,n);break}catch(i){if(!(i instanceof Error)||!(i.toString().includes("QuotaExceededError")||i.toString().includes("QUOTA_EXCEEDED_ERR"))||this._cacheLimit<=1)throw i;this._cacheLimit=Math.ceil(this._cacheLimit/2),this._runLocalStorageCacheEviction(t,this._cacheLimit-1)}this._runLocalStorageCacheEviction(t)}_runLocalStorageCacheEviction(t,r=this._cacheLimit){var n;let o=(n=(0,ur._getObjectFromStorage)(this._lastModifiedStoreKey))!==null&&n!==void 0?n:{};o[t]=Date.now();let i=mw(o,r);for(let s of i)delete o[s],ur.Storage.removeItem(s);(0,ur._setObjectInStorage)(this._lastModifiedStoreKey,o)}};lr.DataAdapterCore=_f;function El(e,t,r,n){return{source:e,data:t,receivedAt:Date.now(),stableID:r,fullUserHash:(0,vl._getFullUserHash)(n)}}lr._makeDataAdapterResult=El;var wf=class{constructor(){this._data={}}get(t,r){var n;let o=this._data[t],i=o?.stableID,s=(n=r?.customIDs)===null||n===void 0?void 0:n.stableID;return s&&i&&s!==i?(Sl.Log.warn("'StatsigUser.customIDs.stableID' mismatch"),null):o}add(t,r,n){let o=mw(this._data,n-1);for(let i of o)delete this._data[i];this._data[t]=r}merge(t){this._data=Object.assign(Object.assign({},this._data),t)}};function mw(e,t){let r=Object.keys(e);return r.length<=t?[]:t===0?r:r.sort((n,o)=>{let i=e[n],s=e[o];return typeof i=="object"&&typeof s=="object"?i.receivedAt-s.receivedAt:i-s}).slice(0,r.length-t)}});var bw=N(gw=>{"use strict";Object.defineProperty(gw,"__esModule",{value:!0})});var Sf=N(Dt=>{"use strict";var KO=Dt&&Dt.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.ErrorBoundary=Dt.EXCEPTION_ENDPOINT=void 0;var JO=re(),YO=rs(),ZO=ao();Dt.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";var _w="[Statsig] UnknownError",xf=class{constructor(t,r,n,o){this._sdkKey=t,this._options=r,this._emitter=n,this._lastSeenError=o,this._seen=new Set}wrap(t,r){try{let n=t;QO(n).forEach(o=>{let i=n[o];"$EB"in i||(n[o]=(...s)=>this._capture(r?`${r}:${o}`:o,()=>i.apply(t,s)),n[o].$EB=!0)})}catch(n){this._onError("eb:wrap",n)}}logError(t,r){this._onError(t,r)}logDroppedEvents(t,r,n){let o={eventCount:String(t),reason:r};n&&Object.keys(n).forEach(i=>{o[i]=String(n[i])}),this._onError("statsig::log_event_dropped_event_count",new Error(r),!0,o)}logEventRequestFailure(t,r,n,o,i,s,a,u,l){let d={eventCount:String(t),flushType:n,statusCode:String(o),reason:r,retries:String(i)};s&&(d.failurePath=s),typeof a=="string"&&a.length>0&&(d.failureErrorMessage=a),typeof u=="string"&&u.length>0&&(d.failureDiagnosticBucket=u),l&&Object.keys(l).forEach(p=>{let f=l[p];f.length>0&&(d[`failureDiagnostic_${p}`]=f)}),this._onError("statsig::log_event_failed",new Error(r),!0,d)}getLastSeenErrorAndReset(){let t=this._lastSeenError;return this._lastSeenError=void 0,t??null}attachErrorIfNoneExists(t){this._lastSeenError||(this._lastSeenError=yw(t))}_capture(t,r){try{let n=r();return n&&n instanceof Promise?n.catch(o=>this._onError(t,o)):n}catch(n){return this._onError(t,n),null}}_onError(t,r,n=!1,o){try{JO.Log.warn(`Caught error in ${t}`,{error:r}),KO(this,void 0,void 0,function*(){var s,a,u,l,d,p,f;let m=r||Error(_w),h=m instanceof Error,_=h?m.name:"No Name",S=yw(m);if(this._lastSeenError=S,!n&&this._seen.has(_))return;if(this._seen.add(_),!((a=(s=this._options)===null||s===void 0?void 0:s.networkConfig)===null||a===void 0)&&a.preventAllNetworkTraffic){(u=this._emitter)===null||u===void 0||u.call(this,{name:"error",error:r,tag:t});return}let D=YO.SDKType._get(this._sdkKey),w=ZO.StatsigMetadataProvider.get(),x=h?m.stack:XO(m),E=Object.assign(Object.assign({tag:t,exception:_,info:x,statsigOptions:eM(this._options)},Object.assign(Object.assign({},w),{sdkType:D})),o??{}),I=(l=this._options)===null||l===void 0?void 0:l.networkConfig;yield((d=I?.networkOverrideFunc)!==null&&d!==void 0?d:fetch)((p=I?.sdkExceptionUrl)!==null&&p!==void 0?p:Dt.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this._sdkKey,"STATSIG-SDK-TYPE":String(D),"STATSIG-SDK-VERSION":String(w.sdkVersion),"Content-Type":"application/json"},body:JSON.stringify(E)}),(f=this._emitter)===null||f===void 0||f.call(this,{name:"error",error:r,tag:t})}).then(()=>{}).catch(()=>{})}catch{}}};Dt.ErrorBoundary=xf;function yw(e){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error("An unknown error occurred.")}function XO(e){try{return JSON.stringify(e)}catch{return _w}}function QO(e){let t=new Set,r=Object.getPrototypeOf(e);for(;r&&r!==Object.prototype;)Object.getOwnPropertyNames(r).filter(n=>typeof r?.[n]=="function").forEach(n=>t.add(n)),r=Object.getPrototypeOf(r);return Array.from(t)}function eM(e){if(!e)return{};let t={};return Object.keys(e).forEach(r=>{let n=r,o=e[n];switch(typeof o){case"number":case"bigint":case"boolean":t[String(n)]=o;break;case"string":o.length<50?t[String(n)]=o:t[String(n)]="set";break;case"object":n==="environment"?t.environment=o:n==="networkConfig"?t.networkConfig=o:t[String(n)]=o!=null?"set":"unset";break;default:}}),t}});var xw=N(ww=>{"use strict";Object.defineProperty(ww,"__esModule",{value:!0})});var vw=N(Sw=>{"use strict";Object.defineProperty(Sw,"__esModule",{value:!0})});var Cw=N(Ew=>{"use strict";Object.defineProperty(Ew,"__esModule",{value:!0})});var vf=N(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.createMemoKey=wo.MemoPrefix=void 0;wo.MemoPrefix={_gate:"g",_dynamicConfig:"c",_experiment:"e",_configList:"cl",_layer:"l",_paramStore:"p"};var tM=new Set([]),rM=new Set(["userPersistedValues"]);function nM(e,t,r){let n=`${e}|${t}`;if(!r)return n;for(let o of Object.keys(r)){if(rM.has(o))return;tM.has(o)?n+=`|${o}=true`:n+=`|${o}=${r[o]}`}return n}wo.createMemoKey=nM});var Aw=N(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0})});var Iw=N(kw=>{"use strict";Object.defineProperty(kw,"__esModule",{value:!0})});var Rw=N(cs=>{"use strict";Object.defineProperty(cs,"__esModule",{value:!0});cs._fastApproxSizeOf=void 0;var oM=2,iM=1,sM=(e,t)=>{let r=0,n=Object.keys(e);for(let o=0;o<n.length;o++){let i=n[o],s=e[i];if(r+=i.length,typeof s=="object"&&s!==null?r+=(0,cs._fastApproxSizeOf)(s,t)+oM:r+=String(s).length+iM,r>=t)return r}return r};cs._fastApproxSizeOf=sM});var Pw=N(xo=>{"use strict";var aM=xo&&xo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(xo,"__esModule",{value:!0});xo.StatsigClientBase=void 0;nr();var uM=nr(),lM=Sf(),cM=mf(),Cf=re(),dM=vf(),pM=Ye(),fM=fo(),Ef=ho(),mM=bo(),Cl=pt(),hM=3e3,Tf=class{constructor(t,r,n,o){var i,s,a,u;this.loadingStatus="Uninitialized",this._initializePromise=null,this._listeners={};let l=this.$emt.bind(this);o?.logLevel!=null&&(Cf.Log.level=o.logLevel),o?.disableStorage&&Cl.Storage._setDisabled(!0),o?.initialSessionID&&fM.StatsigSession.overrideInitialSessionID(o.initialSessionID,t),o?.storageProvider&&Cl.Storage._setProvider(o.storageProvider),o?.enableCookies&&Ef.StableID._setCookiesEnabled(t,o.enableCookies),o?.disableStableID&&Ef.StableID._setDisabled(t,!0),this._sdkKey=t,this._options=o??{},this._memoCache={},this.overrideAdapter=(i=o?.overrideAdapter)!==null&&i!==void 0?i:null,this._errorBoundary=new lM.ErrorBoundary(t,o,l),this._logger=new cM.EventLogger(t,l,n,o,this._errorBoundary),this._errorBoundary.wrap(this),this._errorBoundary.wrap(r),this._errorBoundary.wrap(this._logger),n.setErrorBoundary(this._errorBoundary),this.dataAdapter=r,this.dataAdapter.attach(t,o,n),this.storageProvider=Cl.Storage,(u=(a=(s=this.overrideAdapter)===null||s===void 0?void 0:s.loadFromStorage)===null||a===void 0?void 0:a.call(s))===null||u===void 0||u.catch(d=>this._errorBoundary.logError("OA::loadFromStorage",d)),this._primeReadyRipcord(),gM(t,this)}updateRuntimeOptions(t){t.loggingEnabled?(this._options.loggingEnabled=t.loggingEnabled,this._logger.setLoggingEnabled(t.loggingEnabled)):t.disableLogging!=null&&(this._options.disableLogging=t.disableLogging,this._logger.setLoggingEnabled(t.disableLogging?"disabled":"browser-only")),t.disableStorage!=null&&(this._options.disableStorage=t.disableStorage,Cl.Storage._setDisabled(t.disableStorage)),t.enableCookies!=null&&(this._options.enableCookies=t.enableCookies,Ef.StableID._setCookiesEnabled(this._sdkKey,t.enableCookies)),t.logEventCompressionMode?this._logger.setLogEventCompressionMode(t.logEventCompressionMode):t.disableCompression&&this._logger.setLogEventCompressionMode(mM.LogEventCompressionMode.Disabled)}flush(){return this._logger.flush()}shutdown(){return aM(this,void 0,void 0,function*(){this.$emt({name:"pre_shutdown"}),this._setStatus("Uninitialized",null),this._initializePromise=null,yield this._logger.stop()})}on(t,r){this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(r)}off(t,r){if(this._listeners[t]){let n=this._listeners[t].indexOf(r);n!==-1&&this._listeners[t].splice(n,1)}}$on(t,r){r.__isInternal=!0,this.on(t,r)}$emt(t){var r;let n=o=>{try{o(t)}catch(i){if(o.__isInternal===!0){this._errorBoundary.logError(`__emit:${t.name}`,i);return}Cf.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",t)}};this._listeners[t.name]&&this._listeners[t.name].forEach(o=>n(o)),(r=this._listeners["*"])===null||r===void 0||r.forEach(n)}_setStatus(t,r){this.loadingStatus=t,this._memoCache={},this.$emt({name:"values_updated",status:t,values:r})}_enqueueExposure(t,r,n){if(n?.disableExposureLog===!0){this._logger.incrementNonExposureCount(t);return}this._logger.enqueue(r)}_memoize(t,r){return(n,o)=>{if(this._options.disableEvaluationMemoization)return r(n,o);let i=(0,dM.createMemoKey)(t,n,o);return i?(i in this._memoCache||(Object.keys(this._memoCache).length>=hM&&(this._memoCache={}),this._memoCache[i]=r(n,o)),this._memoCache[i]):r(n,o)}}};xo.StatsigClientBase=Tf;function gM(e,t){var r;if((0,pM._isServerEnv)())return;let n=(0,uM._getStatsigGlobal)(),o=(r=n.instances)!==null&&r!==void 0?r:{},i=t;o[e]!=null&&Cf.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),o[e]=i,n.firstInstance||(n.firstInstance=i),n.instances=o,__STATSIG__=n}});var Dw=N(Tl=>{"use strict";Object.defineProperty(Tl,"__esModule",{value:!0});Tl.DataAdapterCachePrefix=void 0;Tl.DataAdapterCachePrefix="statsig.cached"});var Ow=N(Nw=>{"use strict";Object.defineProperty(Nw,"__esModule",{value:!0})});var Fw=N(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});Ce._makeTypedGet=Ce._mergeOverride=Ce._makeLayer=Ce._makeExperiment=Ce._makeDynamicConfig=Ce._makeFeatureGate=void 0;var bM=re(),yM=nl();function Af(e,t,r,n){var o;return{name:e,details:t,ruleID:(o=r?.rule_id)!==null&&o!==void 0?o:"",__evaluation:r,value:n}}function _M(e,t,r){var n;return Object.assign(Object.assign({},Af(e,t,r,r?.value===!0)),{idType:(n=r?.id_type)!==null&&n!==void 0?n:null})}Ce._makeFeatureGate=_M;function Mw(e,t,r){var n,o;let i=(n=r?.value)!==null&&n!==void 0?n:{};return Object.assign(Object.assign({},Af(e,t,r,i)),{idType:(o=r?.id_type)!==null&&o!==void 0?o:null,get:Al(e,r?.value)})}Ce._makeDynamicConfig=Mw;function wM(e,t,r){var n;let o=Mw(e,t,r);return Object.assign(Object.assign({},o),{groupName:(n=r?.group_name)!==null&&n!==void 0?n:null})}Ce._makeExperiment=wM;function xM(e,t,r,n){var o,i;return Object.assign(Object.assign({},Af(e,t,r,void 0)),{get:Al(e,r?.value,n),groupName:(o=r?.group_name)!==null&&o!==void 0?o:null,__value:(i=r?.value)!==null&&i!==void 0?i:{}})}Ce._makeLayer=xM;function SM(e,t,r,n){return Object.assign(Object.assign(Object.assign({},e),t),{get:Al(e.name,r,n)})}Ce._mergeOverride=SM;function Al(e,t,r){return(n,o)=>{var i;let s=(i=t?.[n])!==null&&i!==void 0?i:null;return s==null?o??null:o!=null&&!(0,yM._isTypeMatch)(s,o)?(bM.Log.warn(`Parameter type mismatch. '${e}.${n}' was found to be type '${typeof s}' but fallback/return type is '${typeof o}'. See https://docs.statsig.com/client/javascript-sdk/#typed-getters`),o??null):(r?.(n),s)}}Ce._makeTypedGet=Al});var Lw=N(Bw=>{"use strict";Object.defineProperty(Bw,"__esModule",{value:!0})});var Uw=N(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.UPDATE_DETAIL_ERROR_MESSAGES=So.createUpdateDetails=void 0;var vM=(e,t,r,n,o,i)=>({duration:r,source:t,success:e,error:n,sourceUrl:o,warnings:i});So.createUpdateDetails=vM;So.UPDATE_DETAIL_ERROR_MESSAGES={NO_NETWORK_DATA:"No data was returned from the network. This may be due to a network timeout if a timeout value was specified in the options or ad blocker error."}});var Qe=N(F=>{"use strict";var EM=F&&F.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),H=F&&F.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&EM(t,e,r)};Object.defineProperty(F,"__esModule",{value:!0});F.Storage=F.Log=F.EventLogger=F.Diagnostics=void 0;nr();var CM=nr(),TM=Xu();Object.defineProperty(F,"Diagnostics",{enumerable:!0,get:function(){return TM.Diagnostics}});var AM=mf();Object.defineProperty(F,"EventLogger",{enumerable:!0,get:function(){return AM.EventLogger}});var jw=re();Object.defineProperty(F,"Log",{enumerable:!0,get:function(){return jw.Log}});var kM=ao(),IM=pt();Object.defineProperty(F,"Storage",{enumerable:!0,get:function(){return IM.Storage}});H(nr(),F);H(ts(),F);H(dw(),F);H(hw(),F);H(Xu(),F);H(bw(),F);H(Sf(),F);H(xw(),F);H(vw(),F);H(or(),F);H(Cw(),F);H(re(),F);H(vf(),F);H(io(),F);H(tf(),F);H(Aw(),F);H(Iw(),F);H(Ye(),F);H(rs(),F);H(fo(),F);H(Rw(),F);H(ho(),F);H(Pw(),F);H(Xp(),F);H(Dw(),F);H(sf(),F);H(ao(),F);H(bo(),F);H(Ow(),F);H(Fw(),F);H(Lw(),F);H(gf(),F);H(pt(),F);H(bf(),F);H(nl(),F);H(uf(),F);H(pl(),F);H(uo(),F);H(Uw(),F);H(Kp(),F);Object.assign((0,CM._getStatsigGlobal)(),{Log:jw.Log,SDK_VERSION:kM.SDK_VERSION})});var qw=N(kl=>{"use strict";Object.defineProperty(kl,"__esModule",{value:!0});kl.V1InitializeContainer=void 0;var RM=Qe(),kf=class{constructor(t){this._values=t}getGate(t){return this._getResultFromLookup(this._values.feature_gates,t)}getConfig(t){return this._getResultFromLookup(this._values.dynamic_configs,t)}getLayer(t){return this._getResultFromLookup(this._values.layer_configs,t)}getParamStore(t){return this._getResultFromLookup(this._values.param_stores,t)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(t,r){var n,o;return t&&(o=(n=t[r])!==null&&n!==void 0?n:t[(0,RM._DJB2)(r)])!==null&&o!==void 0?o:null}};kl.V1InitializeContainer=kf});var $w=N(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.V2InitializeContainer=void 0;var PM=Qe(),If=class{constructor(t){this._values=t}getGate(t){var r,n,o;let i=this._getResultFromLookup(this._values.feature_gates,t);return i?{name:t,value:i.v===!0,rule_id:(r=i.r)!==null&&r!==void 0?r:"default",secondary_exposures:(n=i.s)!==null&&n!==void 0?n:[],id_type:(o=i.i)!==null&&o!==void 0?o:""}:null}getConfig(t){var r,n,o,i;let s=this._getResultFromLookup(this._values.dynamic_configs,t);return s?{name:t,value:(r=this._values.values[s.v])!==null&&r!==void 0?r:{},rule_id:s.r,secondary_exposures:(n=s.s)!==null&&n!==void 0?n:[],id_type:(o=s.i)!==null&&o!==void 0?o:"",is_user_in_experiment:s.ue===!0,passed:s.p===!0,group_name:(i=s.gn)!==null&&i!==void 0?i:void 0,is_experiment_active:s.ea===!0,group:s.r,is_device_based:s.i==="stableID"}:null}getLayer(t){var r,n,o,i,s,a;let u=this._getResultFromLookup(this._values.layer_configs,t);return u?{name:t,value:(r=this._values.values[u.v])!==null&&r!==void 0?r:{},rule_id:u.r,secondary_exposures:(n=u.s)!==null&&n!==void 0?n:[],is_user_in_experiment:u.ue===!0,group_name:(o=u.gn)!==null&&o!==void 0?o:void 0,is_experiment_active:u.ea===!0,group:u.r,is_device_based:u.i==="stableID",allocated_experiment_name:(i=u.ae)!==null&&i!==void 0?i:"",explicit_parameters:(s=u.ep)!==null&&s!==void 0?s:[],undelegated_secondary_exposures:(a=u.us)!==null&&a!==void 0?a:[],parameter_rule_ids:u.pr}:null}getParamStore(t){return this._getResultFromLookup(this._values.param_stores,t)}getConfigList(){return Object.keys(this._values.dynamic_configs)}getExposureMapping(){return this._values.exposures}_getResultFromLookup(t,r){var n,o;return t&&(o=(n=t[r])!==null&&n!==void 0?n:t[(0,PM._DJB2)(r)])!==null&&o!==void 0?o:null}};Il.V2InitializeContainer=If});var zw=N(Pf=>{"use strict";Object.defineProperty(Pf,"__esModule",{value:!0});var vo=Qe(),DM=qw(),NM=$w(),Rf=class{constructor(t,r){this._sdkKey=t,this._options=r,this._valuesForExternalUse=null,this._values=null,this._source="Uninitialized",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings=new Set}reset(){this._values=null,this._valuesForExternalUse=null,this._source="Loading",this._lcut=0,this._receivedAt=0,this._bootstrapMetadata=null,this._warnings.clear()}finalize(){this._values||(this._source="NoValues")}getValues(){return this._valuesForExternalUse}setValues(t,r){var n,o;if(!t)return!1;let i=(0,vo._typedJsonParse)(t.data,"has_updates","EvaluationResponse");return i==null?!1:(this._source=t.source,i?.has_updates!==!0||((n=i.time)!==null&&n!==void 0?n:0)<this._lcut||(this._valuesForExternalUse=(0,vo._typedJsonParse)(t.data,"has_updates","EvaluationResponse"),this._lcut=i.time,this._receivedAt=t.receivedAt,i.response_format==="init-v2"?this._values=new NM.V2InitializeContainer(i):this._values=new DM.V1InitializeContainer(i),this._bootstrapMetadata=this._extractBootstrapMetadata(t.source,i),t.source&&i.user&&this._setWarningState(r,i),vo.SDKFlags.setFlags(this._sdkKey,(o=i.sdk_flags)!==null&&o!==void 0?o:{})),!0)}getWarnings(){if(this._warnings.size!==0)return Array.from(this._warnings)}getGate(t){let r=this._values?this._values.getGate(t):null;return this._getDetailedStoreResult(r)}getConfig(t){let r=this._values?this._values.getConfig(t):null;return this._getDetailedStoreResult(r)}getConfigList(){return this._values?this._values.getConfigList():[]}getLayer(t){let r=this._values?this._values.getLayer(t):null;return this._getDetailedStoreResult(r)}getParamStore(t){let r=this._values?this._values.getParamStore(t):null;return this._getDetailedStoreResult(r)}getSource(){return this._source}getExposureMapping(){var t;return(t=this._values)===null||t===void 0?void 0:t.getExposureMapping()}_extractBootstrapMetadata(t,r){if(t!=="Bootstrap")return null;let n={};return r.user&&(n.user=r.user),r.sdkInfo&&(n.generatorSDKInfo=r.sdkInfo),n.lcut=r.time,n}_getDetailedStoreResult(t){return{result:t,details:this._getDetails(t==null)}}_setWarningState(t,r){var n,o,i;let s=vo.StableID.get(this._sdkKey);if(((n=t.customIDs)===null||n===void 0?void 0:n.stableID)!==s&&(!((o=t.customIDs)===null||o===void 0)&&o.stableID||s)){this._warnings.add("StableIDMismatch");return}if("user"in r){let a=r.user,u=Object.assign(Object.assign({},t),{analyticsOnlyMetadata:void 0,privateAttributes:void 0});!((i=this._options)===null||i===void 0)&&i.disableStableID&&(u=Object.assign(Object.assign({},u),{customIDs:Object.assign(Object.assign({},u.customIDs),{stableID:void 0})}),a=Object.assign(Object.assign({},a),{customIDs:Object.assign(Object.assign({},a.customIDs),{stableID:void 0})})),(0,vo._getFullUserHash)(u)!==(0,vo._getFullUserHash)(a)&&this._warnings.add("PartialUserMatch")}}getCurrentSourceDetails(){if(this._source==="Uninitialized"||this._source==="NoValues")return{reason:this._source};let t={reason:this._source,lcut:this._lcut,receivedAt:this._receivedAt};return this._warnings.size>0&&(t.warnings=Array.from(this._warnings)),t}_getDetails(t){var r,n;let o=this.getCurrentSourceDetails(),i=o.reason,s=(r=o.warnings)!==null&&r!==void 0?r:[];this._source==="Bootstrap"&&s.length>0&&(i=i+s[0]),i!=="Uninitialized"&&i!=="NoValues"&&(i=`${i}:${t?"Unrecognized":"Recognized"}`);let a=this._source==="Bootstrap"&&(n=this._bootstrapMetadata)!==null&&n!==void 0?n:void 0;return a&&(o.bootstrapMetadata=a),Object.assign(Object.assign({},o),{reason:i})}};Pf.default=Rf});var Hw=N(Rl=>{"use strict";Object.defineProperty(Rl,"__esModule",{value:!0});Rl._resolveDeltasResponse=void 0;var Ww=Qe(),OM=2;function MM(e,t){let r=(0,Ww._typedJsonParse)(t,"checksum","DeltasEvaluationResponse");if(!r)return{hadBadDeltaChecksum:!0};let n=FM(e,r),o=BM(n),i=(0,Ww._DJB2Object)({feature_gates:o.feature_gates,dynamic_configs:o.dynamic_configs,layer_configs:o.layer_configs},OM);return i===r.checksumV2?JSON.stringify(o):{hadBadDeltaChecksum:!0,badChecksum:i,badMergedConfigs:o,badFullResponse:r.deltas_full_response}}Rl._resolveDeltasResponse=MM;function FM(e,t){return Object.assign(Object.assign(Object.assign({},e),t),{feature_gates:Object.assign(Object.assign({},e.feature_gates),t.feature_gates),layer_configs:Object.assign(Object.assign({},e.layer_configs),t.layer_configs),dynamic_configs:Object.assign(Object.assign({},e.dynamic_configs),t.dynamic_configs)})}function BM(e){let t=e;return Df(e.deleted_gates,t.feature_gates),delete t.deleted_gates,Df(e.deleted_configs,t.dynamic_configs),delete t.deleted_configs,Df(e.deleted_layers,t.layer_configs),delete t.deleted_layers,t}function Df(e,t){e?.forEach(r=>{delete t[r]})}});var Of=N(ds=>{"use strict";var Vw=ds&&ds.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(ds,"__esModule",{value:!0});var Pl=Qe(),LM=Hw(),Nf=class extends Pl.NetworkCore{constructor(t,r){super(t,r);let n=t?.networkConfig;this._option=t,this._initializeUrlConfig=new Pl.UrlConfiguration(Pl.Endpoint._initialize,n?.initializeUrl,n?.api,n?.initializeFallbackUrls)}fetchEvaluations(t,r,n,o,i){return Vw(this,void 0,void 0,function*(){var s,a,u,l,d,p;let f=r?(0,Pl._typedJsonParse)(r,"has_updates","InitializeResponse"):null,m={user:o,hash:(u=(a=(s=this._option)===null||s===void 0?void 0:s.networkConfig)===null||a===void 0?void 0:a.initializeHashAlgorithm)!==null&&u!==void 0?u:"djb2",deltasResponseRequested:!1,full_checksum:null};if(f?.has_updates){let h=f?.hash_used!==((p=(d=(l=this._option)===null||l===void 0?void 0:l.networkConfig)===null||d===void 0?void 0:d.initializeHashAlgorithm)!==null&&p!==void 0?p:"djb2");m=Object.assign(Object.assign({},m),{sinceTime:i&&!h?f.time:0,previousDerivedFields:"derived_fields"in f&&i?f.derived_fields:{},deltasResponseRequested:!0,full_checksum:f.full_checksum,partialUserMatchSinceTime:h?0:f.time})}return this._fetchEvaluations(t,f,m,n)})}_fetchEvaluations(t,r,n,o){return Vw(this,void 0,void 0,function*(){var i,s;let a=yield this.post({sdkKey:t,urlConfig:this._initializeUrlConfig,data:n,retries:2,isStatsigEncodable:!0,priority:o});if(a?.code===204)return'{"has_updates": false}';if(a?.code!==200)return(i=a?.body)!==null&&i!==void 0?i:null;if(r?.has_updates!==!0||((s=a.body)===null||s===void 0?void 0:s.includes('"is_delta":true'))!==!0||n.deltasResponseRequested!==!0)return a.body;let u=(0,LM._resolveDeltasResponse)(r,a.body);return typeof u=="string"?u:this._fetchEvaluations(t,r,Object.assign(Object.assign(Object.assign({},n),u),{deltasResponseRequested:!1}),o)})}};ds.default=Nf});var Kw=N(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol._makeParamStoreGetter=void 0;var Gw=Qe(),Dl={disableExposureLog:!0};function Nl(e){return e==null||e.disableExposureLog===!1}function Mf(e,t){return t!=null&&!(0,Gw._isTypeMatch)(e,t)}function UM(e,t){return e.value}function jM(e,t,r){return e.getFeatureGate(t.gate_name,Nl(r)?void 0:Dl).value?t.pass_value:t.fail_value}function qM(e,t,r,n){let i=e.getDynamicConfig(t.config_name,Nl(n)?void 0:Dl).get(t.param_name);return Mf(i,r)?r:i}function $M(e,t,r,n){let i=e.getExperiment(t.experiment_name,Nl(n)?void 0:Dl).get(t.param_name);return Mf(i,r)?r:i}function zM(e,t,r,n){let i=e.getLayer(t.layer_name,Nl(n)?void 0:Dl).get(t.param_name);return Mf(i,r)?r:i}function WM(e,t,r){return(n,o)=>{if(t==null)return o;let i=t[n];if(i==null||o!=null&&(0,Gw._typeOf)(o)!==i.param_type)return o;switch(i.ref_type){case"static":return UM(i,r);case"gate":return jM(e,i,r);case"dynamic_config":return qM(e,i,o,r);case"experiment":return $M(e,i,o,r);case"layer":return zM(e,i,o,r);default:return o}}}Ol._makeParamStoreGetter=WM});var Yw=N(Eo=>{"use strict";var HM=Eo&&Eo.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(Eo,"__esModule",{value:!0});Eo.StatsigEvaluationsDataAdapter=void 0;var $r=Qe(),Jw=Of(),Ff=class extends $r.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this._network=null,this._options=null}attach(t,r,n){super.attach(t,r,n),n!==null&&n instanceof Jw.default?this._network=n:this._network=new Jw.default(r??{})}getDataAsync(t,r,n){return this._getDataAsyncImpl(t,(0,$r._normalizeUser)(r,this._options),n)}prefetchData(t,r){return this._prefetchDataImpl(t,r)}setData(t){let r=(0,$r._typedJsonParse)(t,"has_updates","data");r&&"user"in r?super.setData(t,r.user):$r.Log.error("StatsigUser not found. You may be using an older server SDK version. Please upgrade your SDK or use setDataLegacy.")}setDataLegacy(t,r){super.setData(t,r)}_fetchFromNetwork(t,r,n,o){return HM(this,void 0,void 0,function*(){var i;let s=yield(i=this._network)===null||i===void 0?void 0:i.fetchEvaluations(this._getSdkKey(),t,n?.priority,r,o);return s??null})}_getCacheKey(t){var r;let n=(0,$r._getStorageKey)(this._getSdkKey(),t,(r=this._options)===null||r===void 0?void 0:r.customUserCacheKeyFunc);return`${$r.DataAdapterCachePrefix}.${this._cacheSuffix}.${n}`}_isCachedResultValidFor204(t,r){return t.fullUserHash!=null&&t.fullUserHash===(0,$r._getFullUserHash)(r)}};Eo.StatsigEvaluationsDataAdapter=Ff});var Xw=N(ps=>{"use strict";var Ml=ps&&ps.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(d){try{l(n.next(d))}catch(p){s(p)}}function u(d){try{l(n.throw(d))}catch(p){s(p)}}function l(d){d.done?i(d.value):o(d.value).then(a,u)}l((n=n.apply(e,t||[])).next())})};Object.defineProperty(ps,"__esModule",{value:!0});var U=Qe(),VM=zw(),GM=Of(),Zw=Kw(),KM=Yw(),Bf=class e extends U.StatsigClientBase{static instance(t){let r=(0,U._getStatsigGlobal)().instance(t);return r instanceof e?r:(U.Log.warn((0,U._isServerEnv)()?"StatsigClient.instance is not supported in server environments":"Unable to find StatsigClient instance"),new e(t??"",{}))}constructor(t,r,n=null){var o,i;U.SDKType._setClientType(t,"javascript-client");let s=new GM.default(n,u=>{this.$emt(u)});super(t,(o=n?.dataAdapter)!==null&&o!==void 0?o:new KM.StatsigEvaluationsDataAdapter,s,n),this._possibleFirstTouchMetadata={},this.getFeatureGate=this._memoize(U.MemoPrefix._gate,this._getFeatureGateImpl.bind(this)),this.getDynamicConfig=this._memoize(U.MemoPrefix._dynamicConfig,this._getDynamicConfigImpl.bind(this)),this.getExperiment=this._memoize(U.MemoPrefix._experiment,this._getExperimentImpl.bind(this)),this.getConfigList=this._memoize(U.MemoPrefix._configList,this._getConfigListImpl.bind(this)),this.getLayer=this._memoize(U.MemoPrefix._layer,this._getLayerImpl.bind(this)),this.getParameterStore=this._memoize(U.MemoPrefix._paramStore,this._getParameterStoreImpl.bind(this)),this._store=new VM.default(t,n??null),this._network=s,this._user=this._configureUser(r,n),this._sdkInstanceID=(0,U.getUUID)(),this._contextHandle=new U.PrecomputedEvaluationsContextHandle(t,()=>this._options,()=>this._errorBoundary,()=>this._store.getValues(),()=>this._user,()=>this._sdkInstanceID);let a=(i=n?.plugins)!==null&&i!==void 0?i:[];for(let u of a)u.bind(this)}initializeSync(t){var r;return this.loadingStatus!=="Uninitialized"?(0,U.createUpdateDetails)(!0,this._store.getSource(),-1,null,null,["MultipleInitializations",...(r=this._store.getWarnings())!==null&&r!==void 0?r:[]]):(this._logger.start(),this.updateUserSync(this._user,t))}initializeAsync(t){return Ml(this,void 0,void 0,function*(){return this._initializePromise?this._initializePromise:(this._initializePromise=this._initializeAsyncImpl(t),this._initializePromise)})}updateUserSync(t,r){let n=performance.now();try{return this._updateUserSyncImpl(t,r,n)}catch(o){let i=o instanceof Error?o:new Error(String(o));return this._createErrorUpdateDetails(i,n)}}_updateUserSyncImpl(t,r,n){var o;let i=[...(o=this._store.getWarnings())!==null&&o!==void 0?o:[]];this._resetForUser(t);let s=this.dataAdapter.getDataSync(this._user);s==null&&i.push("NoCachedValues"),this._store.setValues(s,this._user),this._finalizeUpdate(s);let a=r?.disableBackgroundCacheRefresh;return a===!0||a==null&&s?.source==="Bootstrap"?(0,U.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),i):(this._runPostUpdate(s??null,this._user),(0,U.createUpdateDetails)(!0,this._store.getSource(),performance.now()-n,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),i))}updateUserAsync(t,r){return Ml(this,void 0,void 0,function*(){let n=performance.now();try{return yield this._updateUserAsyncImpl(t,r)}catch(o){let i=o instanceof Error?o:new Error(String(o));return this._createErrorUpdateDetails(i,n)}})}_updateUserAsyncImpl(t,r){return Ml(this,void 0,void 0,function*(){this._resetForUser(t);let n=this._user;U.Diagnostics._markInitOverallStart(this._sdkKey);let o=this.dataAdapter.getDataSync(n);if(this._store.setValues(o,this._user),this._setStatus("Loading",o),o=yield this.dataAdapter.getDataAsync(o,n,r),n!==this._user)return(0,U.createUpdateDetails)(!1,this._store.getSource(),-1,new Error("User changed during update"),this._network.getLastUsedInitUrlAndReset());let i=!1;o!=null&&(U.Diagnostics._markInitProcessStart(this._sdkKey),i=this._store.setValues(o,this._user),U.Diagnostics._markInitProcessEnd(this._sdkKey,{success:i})),this._finalizeUpdate(o),i||(this._errorBoundary.attachErrorIfNoneExists(U.UPDATE_DETAIL_ERROR_MESSAGES.NO_NETWORK_DATA),this.$emt({name:"initialization_failure"})),U.Diagnostics._markInitOverallEnd(this._sdkKey,i,this._store.getCurrentSourceDetails());let s=U.Diagnostics._enqueueDiagnosticsEvent(this._user,this._logger,this._sdkKey,this._options);return(0,U.createUpdateDetails)(i,this._store.getSource(),s,this._errorBoundary.getLastSeenErrorAndReset(),this._network.getLastUsedInitUrlAndReset(),this._store.getWarnings())})}getContext(){let t=(0,U._cloneObject)("StatsigUser",this._user);return t==null&&(U.Log.error("Failed to clone user"),t={}),{sdkKey:this._sdkKey,options:this._options,values:this._store.getValues(),user:t,errorBoundary:this._errorBoundary,session:U.StatsigSession.get(this._sdkKey),stableID:U.StableID.get(this._sdkKey),sdkInstanceID:this._sdkInstanceID}}getContextHandle(){return this._contextHandle}checkGate(t,r){return this.getFeatureGate(t,r).value}logEvent(t,r,n){let o=typeof t=="string"?{eventName:t,value:r,metadata:n}:t;this.$emt({name:"log_event_called",event:o}),this._logger.enqueue(Object.assign(Object.assign({},o),{user:this._user,time:Date.now()}))}updateUserWithAnalyticsOnlyMetadata(t){this._user=this._configureUser(Object.assign(Object.assign({},this._user),{analyticsOnlyMetadata:t}),this._options)}_primeReadyRipcord(){this.$on("error",()=>{this.loadingStatus==="Loading"&&this._finalizeUpdate(null)})}_initializeAsyncImpl(t){return Ml(this,void 0,void 0,function*(){return U.Storage.isReady()||(yield U.Storage.isReadyResolver()),this._logger.start(),this.updateUserAsync(this._user,t)})}_createErrorUpdateDetails(t,r){var n;return(0,U.createUpdateDetails)(!1,this._store.getSource(),performance.now()-r,t,null,[...(n=this._store.getWarnings())!==null&&n!==void 0?n:[]])}_finalizeUpdate(t){this._store.finalize(),this._setStatus("Ready",t)}_runPostUpdate(t,r){this.dataAdapter.getDataAsync(t,r,{priority:"low"}).catch(n=>{U.Log.error("An error occurred after update.",n)})}_resetForUser(t){this._logger.reset(),this._store.reset(),this._user=this._configureUser(t,this._options)}_configureUser(t,r){var n,o,i;let s=(0,U._normalizeUser)(t,r),a=(n=s.customIDs)===null||n===void 0?void 0:n.stableID;if(a){let u=(i=(o=this.storageProvider).isReadyResolver)===null||i===void 0?void 0:i.call(o);u?u.then(()=>U.StableID.setOverride(a,this._sdkKey),()=>U.StableID.setOverride(a,this._sdkKey)):U.StableID.setOverride(a,this._sdkKey)}return Object.keys(this._possibleFirstTouchMetadata).length>0&&(s.analyticsOnlyMetadata=Object.assign(Object.assign({},s.analyticsOnlyMetadata),this._possibleFirstTouchMetadata)),s}_getFeatureGateImpl(t,r){var n,o;let{result:i,details:s}=this._store.getGate(t);this._checkUserHasIdForEvaluation(i?.id_type,t,"Gate"),this._checkInitializationStatus(s.reason);let a=(0,U._makeFeatureGate)(t,s,i),u=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getGateOverride)===null||o===void 0?void 0:o.call(n,a,this._user,r),l=u??a;return this._enqueueExposure(t,(0,U._createGateExposure)(this._user,l,this._store.getExposureMapping()),r),this.$emt({name:"gate_evaluation",gate:l}),l}_getDynamicConfigImpl(t,r){var n,o;let{result:i,details:s}=this._store.getConfig(t);this._checkUserHasIdForEvaluation(i?.id_type,t,"Dynamic config"),this._checkInitializationStatus(s.reason);let a=(0,U._makeDynamicConfig)(t,s,i),u=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getDynamicConfigOverride)===null||o===void 0?void 0:o.call(n,a,this._user,r),l=u??a;return this._enqueueExposure(t,(0,U._createConfigExposure)(this._user,l,this._store.getExposureMapping()),r),this.$emt({name:"dynamic_config_evaluation",dynamicConfig:l}),l}_getExperimentImpl(t,r){var n,o,i,s;let{result:a,details:u}=this._store.getConfig(t);this._checkUserHasIdForEvaluation(a?.id_type,t,"Experiment"),this._checkInitializationStatus(u.reason);let l=(0,U._makeExperiment)(t,u,a);l.__evaluation!=null&&(l.__evaluation.secondary_exposures=(0,U._mapExposures)((o=(n=l.__evaluation)===null||n===void 0?void 0:n.secondary_exposures)!==null&&o!==void 0?o:[],this._store.getExposureMapping()));let d=(s=(i=this.overrideAdapter)===null||i===void 0?void 0:i.getExperimentOverride)===null||s===void 0?void 0:s.call(i,l,this._user,r),p=d??l;return this._enqueueExposure(t,(0,U._createConfigExposure)(this._user,p,this._store.getExposureMapping()),r),this.$emt({name:"experiment_evaluation",experiment:p}),p}_getConfigListImpl(){return this._store.getConfigList()}_getLayerImpl(t,r){var n,o,i;let{result:s,details:a}=this._store.getLayer(t),u=(0,U._makeLayer)(t,a,s),l=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getLayerOverride)===null||o===void 0?void 0:o.call(n,u,this._user,r);r?.disableExposureLog&&this._logger.incrementNonExposureCount(t);let d=(0,U._mergeOverride)(u,l,(i=l?.__value)!==null&&i!==void 0?i:u.__value,p=>{r?.disableExposureLog||this._enqueueExposure(t,(0,U._createLayerParameterExposure)(this._user,d,p,this._store.getExposureMapping()),r)});return this.$emt({name:"layer_evaluation",layer:d}),d}_getParameterStoreImpl(t,r){var n,o;let{result:i,details:s}=this._store.getParamStore(t);this._logger.incrementNonExposureCount(t);let a={name:t,details:s,__configuration:i,get:(0,Zw._makeParamStoreGetter)(this,i,r)},u=(o=(n=this.overrideAdapter)===null||n===void 0?void 0:n.getParamStoreOverride)===null||o===void 0?void 0:o.call(n,a,r);return u!=null&&(a.__configuration=u.config,a.details=u.details,a.get=(0,Zw._makeParamStoreGetter)(this,u.config,r)),a}_checkUserHasIdForEvaluation(t,r,n){t&&((0,U._getUnitIDFromUser)(this._user,t)||U.Log.warn(`The user does not have the required id_type "${t}" for ${n} "${r}"`))}_checkInitializationStatus(t){(t==="Uninitialized"||t.startsWith("Loading"))&&U.Log.warn(`SDK initialization has not completed. Reason: ${t}`)}};ps.default=Bf});var ex=N(ft=>{"use strict";var JM=ft&&ft.__createBinding||(Object.create?(function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}):(function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]})),YM=ft&&ft.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&JM(t,e,r)};Object.defineProperty(ft,"__esModule",{value:!0});ft.StatsigClient=void 0;var ZM=Qe(),Qw=Xw();ft.StatsigClient=Qw.default;YM(Qe(),ft);var XM=Object.assign((0,ZM._getStatsigGlobal)(),{StatsigClient:Qw.default});ft.default=XM});var eT=N((yce,QC)=>{"use strict";var u8=/^xn--/,l8=/[^\0-\x7F]/,c8=/[\x2E\u3002\uFF0E\uFF61]/g,d8={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},fh=35,Et=Math.floor,mh=String.fromCharCode;function yr(e){throw new RangeError(d8[e])}function p8(e,t){let r=[],n=e.length;for(;n--;)r[n]=t(e[n]);return r}function KC(e,t){let r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(c8,".");let o=e.split("."),i=p8(o,t).join(".");return n+i}function JC(e){let t=[],r=0,n=e.length;for(;r<n;){let o=e.charCodeAt(r++);if(o>=55296&&o<=56319&&r<n){let i=e.charCodeAt(r++);(i&64512)==56320?t.push(((o&1023)<<10)+(i&1023)+65536):(t.push(o),r--)}else t.push(o)}return t}var f8=e=>String.fromCodePoint(...e),m8=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},GC=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},YC=function(e,t,r){let n=0;for(e=r?Et(e/700):e>>1,e+=Et(e/t);e>fh*26>>1;n+=36)e=Et(e/fh);return Et(n+(fh+1)*e/(e+38))},ZC=function(e){let t=[],r=e.length,n=0,o=128,i=72,s=e.lastIndexOf("-");s<0&&(s=0);for(let a=0;a<s;++a)e.charCodeAt(a)>=128&&yr("not-basic"),t.push(e.charCodeAt(a));for(let a=s>0?s+1:0;a<r;){let u=n;for(let d=1,p=36;;p+=36){a>=r&&yr("invalid-input");let f=m8(e.charCodeAt(a++));f>=36&&yr("invalid-input"),f>Et((2147483647-n)/d)&&yr("overflow"),n+=f*d;let m=p<=i?1:p>=i+26?26:p-i;if(f<m)break;let h=36-m;d>Et(2147483647/h)&&yr("overflow"),d*=h}let l=t.length+1;i=YC(n-u,l,u==0),Et(n/l)>2147483647-o&&yr("overflow"),o+=Et(n/l),n%=l,t.splice(n++,0,o)}return String.fromCodePoint(...t)},XC=function(e){let t=[];e=JC(e);let r=e.length,n=128,o=0,i=72;for(let u of e)u<128&&t.push(mh(u));let s=t.length,a=s;for(s&&t.push("-");a<r;){let u=2147483647;for(let d of e)d>=n&&d<u&&(u=d);let l=a+1;u-n>Et((2147483647-o)/l)&&yr("overflow"),o+=(u-n)*l,n=u;for(let d of e)if(d<n&&++o>2147483647&&yr("overflow"),d===n){let p=o;for(let f=36;;f+=36){let m=f<=i?1:f>=i+26?26:f-i;if(p<m)break;let h=p-m,_=36-m;t.push(mh(GC(m+h%_,0))),p=Et(h/_)}t.push(mh(GC(p,0))),i=YC(o,l,a===s),o=0,++a}++o,++n}return t.join("")},h8=function(e){return KC(e,function(t){return u8.test(t)?ZC(t.slice(4).toLowerCase()):t})},g8=function(e){return KC(e,function(t){return l8.test(t)?"xn--"+XC(t):t})},b8={version:"2.3.1",ucs2:{decode:JC,encode:f8},decode:ZC,encode:XC,toASCII:g8,toUnicode:h8};QC.exports=b8});import*as $b from"node:os";var R=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var $=globalThis;var ze="10.48.0";function be(){return Ht($),$}function Ht(e){let t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||ze,t[ze]=t[ze]||{}}function We(e,t,r=$){let n=r.__SENTRY__=r.__SENTRY__||{},o=n[ze]=n[ze]||{};return o[e]||(o[e]=t())}var ci=["debug","info","warn","error","log","assert","trace"],Pk="Sentry Logger ",Sn={};function fe(e){if(!("console"in $))return e();let t=$.console,r={},n=Object.keys(Sn);n.forEach(o=>{let i=Sn[o];r[o]=t[o],t[o]=i});try{return e()}finally{n.forEach(o=>{t[o]=r[o]})}}function Dk(){bd().enabled=!0}function Nk(){bd().enabled=!1}function og(){return bd().enabled}function Ok(...e){gd("log",...e)}function Mk(...e){gd("warn",...e)}function Fk(...e){gd("error",...e)}function gd(e,...t){R&&og()&&fe(()=>{$.console[e](`${Pk}[${e}]:`,...t)})}function bd(){return R?We("loggerSettings",()=>({enabled:!1})):{enabled:!1}}var b={enable:Dk,disable:Nk,isEnabled:og,log:Ok,warn:Mk,error:Fk};var ig=/\(error: (.*)\)/,sg=/captureMessage|captureException/;function du(...e){let t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,o=0)=>{let i=[],s=r.split(`
`);for(let a=n;a<s.length;a++){let u=s[a];u.length>1024&&(u=u.slice(0,1024));let l=ig.test(u)?u.replace(ig,"$1"):u;if(!l.includes("Error: ")){for(let d of t){let p=d(l);if(p){i.push(p);break}}if(i.length>=50+o)break}}return ag(i.slice(o))}}function _d(e){return Array.isArray(e)?du(...e):e}function ag(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(cu(t).function||"")&&t.pop(),t.reverse(),sg.test(cu(t).function||"")&&(t.pop(),sg.test(cu(t).function||"")&&t.pop()),t.slice(0,50).map(r=>({...r,filename:r.filename||cu(t).filename,function:r.function||"?"}))}function cu(e){return e[e.length-1]||{}}var yd="<anonymous>";function di(e){try{return!e||typeof e!="function"?yd:e.name||yd}catch{return yd}}function pu(e){return"__v_isVNode"in e&&e.__v_isVNode?"[VueVNode]":"[VueViewModel]"}function ug(e){let t=e?.startsWith("file://")?e.slice(7):e;return t?.match(/\/[A-Z]:/)&&(t=t.slice(1)),t}var fu={},lg={};function vn(e,t){fu[e]=fu[e]||[],fu[e].push(t)}function En(e,t){if(!lg[e]){lg[e]=!0;try{t()}catch(r){R&&b.error(`Error while instrumenting ${e}`,r)}}}function Cn(e,t){let r=e&&fu[e];if(r)for(let n of r)try{n(t)}catch(o){R&&b.error(`Error while triggering instrumentation handler.
Type: ${e}
Name: ${di(n)}
Error:`,o)}}var wd=null;function cg(e){let t="error";vn(t,e),En(t,Bk)}function Bk(){wd=$.onerror,$.onerror=function(e,t,r,n,o){return Cn("error",{column:n,error:o,line:r,msg:e,url:t}),wd?wd.apply(this,arguments):!1},$.onerror.__SENTRY_INSTRUMENTED__=!0}var xd=null;function dg(e){let t="unhandledrejection";vn(t,e),En(t,Lk)}function Lk(){xd=$.onunhandledrejection,$.onunhandledrejection=function(e){return Cn("unhandledrejection",e),xd?xd.apply(this,arguments):!0},$.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var pg=Object.prototype.toString;function nt(e){switch(pg.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return it(e,Error)}}function mu(e,t){return pg.call(e)===`[object ${t}]`}function Sd(e){return mu(e,"ErrorEvent")}function Vt(e){return mu(e,"String")}function Tn(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function kr(e){return e===null||Tn(e)||typeof e!="object"&&typeof e!="function"}function Ct(e){return mu(e,"Object")}function vd(e){return typeof Event<"u"&&it(e,Event)}function Ed(e){return typeof Element<"u"&&it(e,Element)}function Cd(e){return mu(e,"RegExp")}function ot(e){return!!(e?.then&&typeof e.then=="function")}function Td(e){return Ct(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function it(e,t){try{return e instanceof t}catch{return!1}}function pi(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue||e.__v_isVNode))}var Uk=$,jk=80;function fg(e,t={}){if(!e)return"<unknown>";try{let r=e,n=5,o=[],i=0,s=0,a=" > ",u=a.length,l,d=Array.isArray(t)?t:t.keyAttrs,p=!Array.isArray(t)&&t.maxStringLength||jk;for(;r&&i++<n&&(l=qk(r,d),!(l==="html"||i>1&&s+o.length*u+l.length>=p));)o.push(l),s+=l.length,r=r.parentNode;return o.reverse().join(a)}catch{return"<unknown>"}}function qk(e,t){let r=e,n=[];if(!r?.tagName)return"";if(Uk.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());let o=t?.length?t.filter(i=>r.getAttribute(i)).map(i=>[i,r.getAttribute(i)]):null;if(o?.length)o.forEach(i=>{n.push(`[${i[0]}="${i[1]}"]`)});else{r.id&&n.push(`#${r.id}`);let i=r.className;if(i&&Vt(i)){let s=i.split(/\s+/);for(let a of s)n.push(`.${a}`)}}for(let i of["aria-label","type","name","title","alt"]){let s=r.getAttribute(i);s&&n.push(`[${i}="${s}"]`)}return n.join("")}function gg(e,t,r){if(!(t in e))return;let n=e[t];if(typeof n!="function")return;let o=r(n);typeof o=="function"&&$k(o,n);try{e[t]=o}catch{R&&b.log(`Failed to replace method "${t}" in object`,e)}}function fi(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{R&&b.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function $k(e,t){try{let r=t.prototype||{};e.prototype=t.prototype=r,fi(e,"__sentry_original__",t)}catch{}}function bg(e){return e.__sentry_original__}function Ad(e){if(nt(e))return{message:e.message,name:e.name,stack:e.stack,...hg(e)};if(vd(e)){let t={type:e.type,target:mg(e.target),currentTarget:mg(e.currentTarget),...hg(e)};return typeof CustomEvent<"u"&&it(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function mg(e){try{return Ed(e)?fg(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function hg(e){return typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e)):{}}function yg(e){let t=Object.keys(Ad(e));return t.sort(),t[0]?t.join(", "):"[object has no keys]"}var An;function kn(e){if(An!==void 0)return An?An(e):e();let t=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),r=$;return t in r&&typeof r[t]=="function"?(An=r[t],An(e)):(An=null,e())}function Se(){return kn(()=>Math.random())}function In(){return kn(()=>Date.now())}function Rn(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function kd(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let o=Math.max(t-60,0);o<5&&(o=0);let i=Math.min(o+140,n);return i>n-5&&(i=n),i===n&&(o=Math.max(i-140,0)),r=r.slice(o,i),o>0&&(r=`'{snip} ${r}`),i<n&&(r+=" {snip}"),r}function Id(e,t){if(!Array.isArray(e))return"";let r=[];for(let n=0;n<e.length;n++){let o=e[n];try{pi(o)?r.push(pu(o)):r.push(String(o))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function Tt(e,t,r=!1){return Vt(e)?Cd(t)?t.test(e):Vt(t)?r?e===t:e.includes(t):typeof t=="function"?t(e):!1:!1}function Gt(e,t=[],r=!1){return t.some(n=>Tt(e,n,r))}function zk(){let e=$;return e.crypto||e.msCrypto}var Rd;function Wk(){return Se()*16}function ie(e=zk()){try{if(e?.randomUUID)return kn(()=>e.randomUUID()).replace(/-/g,"")}catch{}return Rd||(Rd="10000000100040008000"+1e11),Rd.replace(/[018]/g,t=>(t^(Wk()&15)>>t/4).toString(16))}function _g(e){return e.exception?.values?.[0]}function Kt(e){let{message:t,event_id:r}=e;if(t)return t;let n=_g(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function Dd(e,t,r){let n=e.exception=e.exception||{},o=n.values=n.values||[],i=o[0]=o[0]||{};i.value||(i.value=t||""),i.type||(i.type=r||"Error")}function Pn(e,t){let r=_g(e);if(!r)return;let n={type:"generic",handled:!0},o=r.mechanism;if(r.mechanism={...n,...o,...t},t&&"data"in t){let i={...o?.data,...t.data};r.mechanism.data=i}}var Hk=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;function Pd(e){return parseInt(e||"",10)}function Nd(e){let t=e.match(Hk)||[],r=Pd(t[1]),n=Pd(t[2]),o=Pd(t[3]);return{buildmetadata:t[5],major:isNaN(r)?void 0:r,minor:isNaN(n)?void 0:n,patch:isNaN(o)?void 0:o,prerelease:t[4]}}function hu(e){if(wg(e))return!0;try{fi(e,"__sentry_captured__",!0)}catch{}return!1}function wg(e){try{return e.__sentry_captured__}catch{}}var Sg=1e3;function At(){return In()/Sg}function Vk(){let{performance:e}=$;if(!e?.now||!e.timeOrigin)return At;let t=e.timeOrigin;return()=>(t+kn(()=>e.now()))/Sg}var xg;function mi(){return(xg??(xg=Vk()))()}function vg(e){let t=mi(),r={sid:ie(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Gk(r)};return e&&kt(r,e),r}function kt(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||mi(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:ie()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{let r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function Eg(e,t){let r={};t?r={status:t}:e.status==="ok"&&(r={status:"exited"}),kt(e,r)}function Gk(e){return{sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}}}function Jt(e,t,r=2){if(!t||typeof t!="object"||r<=0)return t;if(e&&Object.keys(t).length===0)return e;let n={...e};for(let o in t)Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=Jt(n[o],t[o],r-1));return n}function st(){return ie()}function at(){return ie().substring(16)}var Od="_sentrySpan";function Dn(e,t){t?fi(e,Od,t):delete e[Od]}function Nn(e){return e[Od]}var Kk=100,xe=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:st(),sampleRand:Se()}}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._attributes={...this._attributes},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,t._conversationId=this._conversationId,Dn(t,Nn(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&kt(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(t){return this._conversationId=t||void 0,this._notifyScopeListeners(),this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,r){return this.setTags({[t]:r})}setAttributes(t){return this._attributes={...this._attributes,...t},this._notifyScopeListeners(),this}setAttribute(t,r){return this.setAttributes({[t]:r})}removeAttribute(t){return t in this._attributes&&(delete this._attributes[t],this._notifyScopeListeners()),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,r){return this._extra={...this._extra,[t]:r},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,r){return r===null?delete this._contexts[t]:this._contexts[t]=r,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let r=typeof t=="function"?t(this):t,n=r instanceof e?r.getScopeData():Ct(r)?t:void 0,{tags:o,attributes:i,extra:s,user:a,contexts:u,level:l,fingerprint:d=[],propagationContext:p,conversationId:f}=n||{};return this._tags={...this._tags,...o},this._attributes={...this._attributes,...i},this._extra={...this._extra,...s},this._contexts={...this._contexts,...u},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),d.length&&(this._fingerprint=d),p&&(this._propagationContext=p),f&&(this._conversationId=f),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Dn(this,void 0),this._attachments=[],this.setPropagationContext({traceId:st(),sampleRand:Se()}),this._notifyScopeListeners(),this}addBreadcrumb(t,r){let n=typeof r=="number"?r:Kk;if(n<=0)return this;let o={timestamp:At(),...t,message:t.message?Rn(t.message,2048):t.message};return this._breadcrumbs.push(o),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client?.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Nn(this),conversationId:this._conversationId}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Jt(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext=t,this}getPropagationContext(){return this._propagationContext}captureException(t,r){let n=r?.event_id||ie();if(!this._client)return R&&b.warn("No client configured on scope - will not capture exception!"),n;let o=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:o,...r,event_id:n},this),n}captureMessage(t,r,n){let o=n?.event_id||ie();if(!this._client)return R&&b.warn("No client configured on scope - will not capture message!"),o;let i=n?.syntheticException??new Error(t);return this._client.captureMessage(t,r,{originalException:t,syntheticException:i,...n,event_id:o},this),o}captureEvent(t,r){let n=t.event_id||r?.event_id||ie();return this._client?(this._client.captureEvent(t,{...r,event_id:n},this),n):(R&&b.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}};function hi(){return We("defaultCurrentScope",()=>new xe)}function gi(){return We("defaultIsolationScope",()=>new xe)}var Cg=e=>e instanceof Promise&&!e[Tg],Tg=Symbol("chained PromiseLike"),Ag=(e,t,r)=>{let n=e.then(o=>(t(o),o),o=>{throw r(o),o});return Cg(n)&&Cg(e)?n:Jk(e,n)},Jk=(e,t)=>{let r=!1;for(let n in e){if(n in t)continue;r=!0;let o=e[n];typeof o=="function"?Object.defineProperty(t,n,{value:(...i)=>o.apply(e,i),enumerable:!0,configurable:!0,writable:!0}):t[n]=o}return r&&Object.assign(t,{[Tg]:!0}),t};var Md=class{constructor(t,r){let n;t?n=t:n=new xe;let o;r?o=r:o=new xe,this._stack=[{scope:n}],this._isolationScope=o}withScope(t){let r=this._pushScope(),n;try{n=t(r)}catch(o){throw this._popScope(),o}return ot(n)?Ag(n,()=>this._popScope(),()=>this._popScope()):(this._popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){let t=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:t}),t}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function On(){let e=be(),t=Ht(e);return t.stack=t.stack||new Md(hi(),gi())}function Yk(e){return On().withScope(e)}function Zk(e,t){let r=On();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function kg(e){return On().withScope(()=>e(On().getIsolationScope()))}function Ig(){return{withIsolationScope:kg,withScope:Yk,withSetScope:Zk,withSetIsolationScope:(e,t)=>kg(t),getCurrentScope:()=>On().getScope(),getIsolationScope:()=>On().getIsolationScope()}}function Fd(e){let t=be(),r=Ht(t);r.acs=e}function Ne(e){let t=Ht(e);return t.acs?t.acs:Ig()}function Xk(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)&&Object.keys(e).includes("value")}function Qk(e,t){let{value:r,unit:n}=Xk(e)?e:{value:e,unit:void 0},o=eI(r),i=n&&typeof n=="string"?{unit:n}:{};if(o)return{...o,...i};if(!t||t==="skip-undefined"&&r===void 0)return;let s="";try{s=JSON.stringify(r)??""}catch{}return{value:s,type:"string",...i}}function Bd(e,t=!1){let r={};for(let[n,o]of Object.entries(e??{})){let i=Qk(o,t);i&&(r[n]=i)}return r}function Ld(e){if(!e)return 0;let t=0;for(let[r,n]of Object.entries(e)){t+=r.length*2,t+=n.type.length*2,t+=(n.unit?.length??0)*2;let o=n.value;Array.isArray(o)?t+=Rg(o[0])*o.length:kr(o)?t+=Rg(o):t+=100}return t}function Rg(e){return typeof e=="string"?e.length*2:typeof e=="boolean"?4:typeof e=="number"?8:0}function eI(e){let t=typeof e=="string"?"string":typeof e=="boolean"?"boolean":typeof e=="number"&&!Number.isNaN(e)?Number.isInteger(e)?"integer":"double":null;if(t)return{value:e,type:t}}var Pg;function Dg(){return Pg?.()}function Ud(){return Pg!==void 0}function ee(){let e=be();return Ne(e).getCurrentScope()}function ne(){let e=be();return Ne(e).getIsolationScope()}function bi(){return We("globalScope",()=>new xe)}function ut(...e){let t=be(),r=Ne(t);if(e.length===2){let[n,o]=e;return n?r.withSetScope(n,o):r.withScope(o)}return r.withScope(e[0])}function Mn(...e){let t=be(),r=Ne(t);if(e.length===2){let[n,o]=e;return n?r.withSetIsolationScope(n,o):r.withIsolationScope(o)}return r.withIsolationScope(e[0])}function Y(){return ee().getClient()}function yi(e){let t=Dg();if(t)return{trace_id:t.traceId,span_id:t.spanId};let r=e.getPropagationContext(),{traceId:n,parentSpanId:o,propagationSpanId:i}=r,s={trace_id:n,span_id:i||at()};return o&&(s.parent_span_id=o),s}var Ir="sentry.source",gu="sentry.sample_rate",Ng="sentry.previous_trace_sample_rate",bu="sentry.op",yu="sentry.origin";var Og="sentry.release",Mg="sentry.environment",Fg="sentry.segment.name",Bg="sentry.segment.id",Lg="sentry.sdk.name",Ug="sentry.sdk.version",jg="user.id",qg="user.email",$g="user.ip_address",zg="user.name";var jd="sentry.profile_id",qd="sentry.exclusive_time";var tI="_sentryScope",rI="_sentryIsolationScope";function nI(e){if(e){if(typeof e=="object"&&"deref"in e&&typeof e.deref=="function")try{return e.deref()}catch{return}return e}}function Fn(e){let t=e;return{scope:t[tI],isolationScope:nI(t[rI])}}var Rr="sentry-";var Hg=8192;function Pr(e){let t=_i(e);if(!t)return;let r=Object.entries(t).reduce((n,[o,i])=>{if(o.startsWith(Rr)){let s=o.slice(Rr.length);n[s]=i}return n},{});if(Object.keys(r).length>0)return r}function _u(e){if(!e)return;let t=Object.entries(e).reduce((r,[n,o])=>(o&&(r[`${Rr}${n}`]=o),r),{});return wu(t)}function _i(e){if(!(!e||!Vt(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,r)=>{let n=Wg(r);return Object.entries(n).forEach(([o,i])=>{t[o]=i}),t},{}):Wg(e)}function Wg(e){return e.split(",").map(t=>{let r=t.indexOf("=");if(r===-1)return[];let n=t.slice(0,r),o=t.slice(r+1);return[n,o].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((t,[r,n])=>(r&&n&&(t[r]=n),t),{})}function wu(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[r,n],o)=>{let i=`${encodeURIComponent(r)}=${encodeURIComponent(n)}`,s=o===0?i:`${t},${i}`;return s.length>Hg?(R&&b.warn(`Not adding key: ${r} with val: ${n} to baggage header due to exceeding baggage size limits.`),t):s},"")}var oI=/^o(\d+)\./,iI=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function sI(e){return e==="http"||e==="https"}function ve(e,t=!1){let{host:r,path:n,pass:o,port:i,projectId:s,protocol:a,publicKey:u}=e;return`${a}://${u}${t&&o?`:${o}`:""}@${r}${i?`:${i}`:""}/${n&&`${n}/`}${s}`}function aI(e){let t=iI.exec(e);if(!t){fe(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[r,n,o="",i="",s="",a=""]=t.slice(1),u="",l=a,d=l.split("/");if(d.length>1&&(u=d.slice(0,-1).join("/"),l=d.pop()),l){let p=l.match(/^\d+/);p&&(l=p[0])}return Vg({host:i,pass:o,path:u,projectId:l,port:s,protocol:r,publicKey:n})}function Vg(e){return{protocol:e.protocol,publicKey:e.publicKey||"",pass:e.pass||"",host:e.host,port:e.port||"",path:e.path||"",projectId:e.projectId}}function uI(e){if(!R)return!0;let{port:t,projectId:r,protocol:n}=e;return["protocol","publicKey","host","projectId"].find(s=>e[s]?!1:(b.error(`Invalid Sentry Dsn: ${s} missing`),!0))?!1:r.match(/^\d+$/)?sI(n)?t&&isNaN(parseInt(t,10))?(b.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(b.error(`Invalid Sentry Dsn: Invalid protocol ${n}`),!1):(b.error(`Invalid Sentry Dsn: Invalid projectId ${r}`),!1)}function lI(e){return e.match(oI)?.[1]}function xu(e){let t=e.getOptions(),{host:r}=e.getDsn()||{},n;return t.orgId?n=String(t.orgId):r&&(n=lI(r)),n}function Gg(e){let t=typeof e=="string"?aI(e):Vg(e);if(!(!t||!uI(t)))return t}function wi(e){if(typeof e=="boolean")return Number(e);let t=typeof e=="string"?parseFloat(e):e;if(!(typeof t!="number"||isNaN(t)||t<0||t>1))return t}var Su=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function Kg(e){if(!e)return;let t=e.match(Su);if(!t)return;let r;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}function xi(e,t){let r=Kg(e),n=Pr(t);if(!r?.traceId)return{traceId:st(),sampleRand:Se()};let o=cI(r,n);n&&(n.sample_rand=o.toString());let{traceId:i,parentSpanId:s,parentSampled:a}=r;return{traceId:i,parentSpanId:s,sampled:a,dsc:n||{},sampleRand:o}}function Si(e=st(),t=at(),r){let n="";return r!==void 0&&(n=r?"-1":"-0"),`${e}-${t}${n}`}function vi(e=st(),t=at(),r){return`00-${e}-${t}-${r?"01":"00"}`}function cI(e,t){let r=wi(t?.sample_rand);if(r!==void 0)return r;let n=wi(t?.sample_rate);return n&&e?.parentSampled!==void 0?e.parentSampled?Se()*n:n+Se()*(1-n):Se()}function $d(e,t){let r=xu(e);return t&&r&&t!==r?(b.log(`Won't continue trace because org IDs don't match (incoming baggage: ${t}, SDK options: ${r})`),!1):(e.getOptions().strictTraceContinuation||!1)&&(t&&!r||!t&&r)?(b.log(`Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ${t}, Sentry client: ${r})`),!1):!0}var zd=1,Jg=!1;function Eu(e){let{spanId:t,traceId:r,isRemote:n}=e.spanContext(),o=n?t:Dr(e).parent_span_id,i=Fn(e).scope,s=n?i?.getPropagationContext().propagationSpanId||at():t;return{parent_span_id:o,span_id:s,trace_id:r}}function Cu(e){let{traceId:t,spanId:r}=e.spanContext(),n=Bn(e);return Si(t,r,n)}function Zg(e){let{traceId:t,spanId:r}=e.spanContext(),n=Bn(e);return vi(t,r,n)}function fI(e){if(e&&e.length>0)return e.map(({context:{spanId:t,traceId:r,traceFlags:n,...o},attributes:i})=>({span_id:t,trace_id:r,sampled:n===zd,attributes:i,...o}))}function mI(e){if(e?.length)return e.map(({context:{spanId:t,traceId:r,traceFlags:n},attributes:o})=>({span_id:t,trace_id:r,sampled:n===zd,attributes:o}))}function vu(e){return typeof e=="number"?Yg(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Yg(e.getTime()):mi()}function Yg(e){return e>9999999999?e/1e3:e}function Dr(e){if(t0(e))return e.getSpanJSON();let{spanId:t,traceId:r}=e.spanContext();if(e0(e)){let{attributes:n,startTime:o,name:i,endTime:s,status:a,links:u}=e;return{span_id:t,trace_id:r,data:n,description:i,parent_span_id:Xg(e),start_timestamp:vu(o),timestamp:vu(s)||void 0,status:hI(a),op:n[bu],origin:n[yu],links:fI(u)}}return{span_id:t,trace_id:r,start_timestamp:0,data:{}}}function Wd(e){if(t0(e))return e.getStreamedSpanJSON();let{spanId:t,traceId:r}=e.spanContext();if(e0(e)){let{attributes:n,startTime:o,name:i,endTime:s,status:a,links:u}=e;return{name:i,span_id:t,trace_id:r,parent_span_id:Xg(e),start_timestamp:vu(o),end_timestamp:vu(s),is_segment:e===Ei(e),status:gI(a),attributes:n,links:mI(u)}}return{span_id:t,trace_id:r,start_timestamp:0,name:"",end_timestamp:0,status:"ok",is_segment:e===Ei(e)}}function Xg(e){return"parentSpanId"in e?e.parentSpanId:"parentSpanContext"in e?e.parentSpanContext?.spanId:void 0}function Qg(e){return{...e,attributes:Bd(e.attributes),links:e.links?.map(t=>({...t,attributes:Bd(t.attributes)}))}}function e0(e){let t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function t0(e){return typeof e.getSpanJSON=="function"}function Bn(e){let{traceFlags:t}=e.spanContext();return t===zd}function hI(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"internal_error"}function gI(e){return!e||e.code===1||e.code===0||e.message==="cancelled"?"ok":"error"}var bI="_sentryRootSpan";var Yt=Ei;function Ei(e){return e[bI]||e}function Zt(){let e=be(),t=Ne(e);return t.getActiveSpan?t.getActiveSpan():Nn(ee())}function Ci(){Jg||(fe(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Jg=!0)}var r0=!1;function n0(){if(r0)return;function e(){let t=Zt(),r=t&&Yt(t);if(r){let n="internal_error";R&&b.log(`[Tracing] Root span: ${n} -> Global error occurred`),r.setStatus({code:2,message:n})}}e.tag="sentry_tracingErrorCallback",r0=!0,cg(e),dg(e)}function o0(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;let t=e||Y()?.getOptions();return!!t&&(t.tracesSampleRate!=null||!!t.tracesSampler)}function i0(e){b.log(`Ignoring span ${e.op} - ${e.description} because it matches \`ignoreSpans\`.`)}function Hd(e,t){if(!t?.length||!e.description)return!1;for(let r of t){if(yI(r)){if(Tt(e.description,r))return R&&i0(e),!0;continue}if(!r.name&&!r.op)continue;let n=r.name?Tt(e.description,r.name):!0,o=r.op?e.op&&Tt(e.op,r.op):!0;if(n&&o)return R&&i0(e),!0}return!1}function s0(e,t){let r=t.parent_span_id,n=t.span_id;if(r)for(let o of e)o.parent_span_id===n&&(o.parent_span_id=r)}function yI(e){return typeof e=="string"||e instanceof RegExp}var Ln="production";var _I="_frozenDsc";function a0(e,t){let r=t.getOptions(),{publicKey:n}=t.getDsn()||{},o={environment:r.environment||Ln,release:r.release,public_key:n,trace_id:e,org_id:xu(t)};return t.emit("createDsc",o),o}function Un(e,t){let r=t.getPropagationContext();return r.dsc||a0(r.traceId,e)}function Xt(e){let t=Y();if(!t)return{};let r=Yt(e),n=Dr(r),o=n.data,i=r.spanContext().traceState,s=i?.get("sentry.sample_rate")??o[gu]??o[Ng];function a(h){return(typeof s=="number"||typeof s=="string")&&(h.sample_rate=`${s}`),h}let u=r[_I];if(u)return a(u);let l=i?.get("sentry.dsc"),d=l&&Pr(l);if(d)return a(d);let p=a0(e.spanContext().traceId,t),f=o[Ir]??o["sentry.span.source"],m=n.description;return f!=="url"&&m&&(p.transaction=m),o0()&&(p.sampled=String(Bn(r)),p.sample_rand=i?.get("sentry.sample_rand")??Fn(r).scope?.getPropagationContext().sampleRand.toString()),a(p),t.emit("createDsc",p,r),p}function jn(e){return!!e&&typeof e=="function"&&"_streamed"in e&&!!e._streamed}function He(e,t=100,r=1/0){try{return Vd("",e,t,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Gd(e,t=3,r=100*1024){let n=He(e,t);return vI(n)>r?Gd(e,t-1,r):n}function Vd(e,t,r=1/0,n=1/0,o=EI()){let[i,s]=o;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;let a=wI(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;let u=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:r;if(u===0)return a.replace("object ","");if(i(t))return"[Circular ~]";let l=t;if(l&&typeof l.toJSON=="function")try{let m=l.toJSON();return Vd("",m,u-1,n,o)}catch{}let d=Array.isArray(t)?[]:{},p=0,f=Ad(t);for(let m in f){if(!Object.prototype.hasOwnProperty.call(f,m))continue;if(p>=n){d[m]="[MaxProperties ~]";break}let h=f[m];d[m]=Vd(m,h,u-1,n,o),p++}return s(t),d}function wI(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(pi(t))return pu(t);if(Td(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${di(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;let r=xI(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function xI(e){let t=Object.getPrototypeOf(e);return t?.constructor?t.constructor.name:"null prototype"}function SI(e){return~-encodeURI(e).split(/%..|./).length}function vI(e){return SI(JSON.stringify(e))}function EI(){let e=new WeakSet;function t(n){return e.has(n)?!0:(e.add(n),!1)}function r(n){e.delete(n)}return[t,r]}function ye(e,t=[]){return[e,t]}function Jd(e,t){let[r,n]=e;return[r,[...n,t]]}function Ti(e,t){let r=e[1];for(let n of r){let o=n[0].type;if(t(n,o))return!0}return!1}function Yd(e,t){return Ti(e,(r,n)=>t.includes(n))}function Kd(e){let t=Ht($);return t.encodePolyfill?t.encodePolyfill(e):new TextEncoder().encode(e)}function Ai(e){let[t,r]=e,n=JSON.stringify(t);function o(i){typeof n=="string"?n=typeof i=="string"?n+i:[Kd(n),i]:n.push(typeof i=="string"?Kd(i):i)}for(let i of r){let[s,a]=i;if(o(`
${JSON.stringify(s)}
`),typeof a=="string"||a instanceof Uint8Array)o(a);else{let u;try{u=JSON.stringify(a)}catch{u=JSON.stringify(He(a))}o(u)}}return typeof n=="string"?n:CI(n)}function CI(e){let t=e.reduce((o,i)=>o+i.length,0),r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function Zd(e){let t=typeof e.data=="string"?Kd(e.data):e.data;return[{type:"attachment",length:t.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType},t]}var u0={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function TI(e){return e in u0}function Tu(e){return TI(e)?u0[e]:e}function qn(e){if(!e?.sdk)return;let{name:t,version:r}=e.sdk;return{name:t,version:r}}function Xd(e,t,r,n){let o=e.sdkProcessingMetadata?.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!r&&n&&{dsn:ve(n)},...o&&{trace:o}}}function kI(e,t){if(!t)return e;let r=e.sdk||{};return e.sdk={...r,name:r.name||t.name,version:r.version||t.version,integrations:[...e.sdk?.integrations||[],...t.integrations||[]],packages:[...e.sdk?.packages||[],...t.packages||[]],settings:e.sdk?.settings||t.settings?{...e.sdk?.settings,...t.settings}:void 0},e}function l0(e,t,r,n){let o=qn(r),i={sent_at:new Date().toISOString(),...o&&{sdk:o},...!!n&&t&&{dsn:ve(t)}},s="aggregates"in e?[{type:"sessions"},e]:[{type:"session"},e.toJSON()];return ye(i,[s])}function c0(e,t,r,n){let o=qn(r),i=e.type&&e.type!=="replay_event"?e.type:"event";kI(e,r?.sdk);let s=Xd(e,o,n,t);return delete e.sdkProcessingMetadata,ye(s,[[{type:i},e]])}function d0(e){return e.getOptions().traceLifecycle==="stream"}var p0="__SENTRY_SUPPRESS_TRACING__";var ki=(e,t)=>{let r=be(),n=Ne(r);if(n.continueTrace)return n.continueTrace(e,t);let{sentryTrace:o,baggage:i}=e,s=Y(),a=Pr(i);return s&&!$d(s,a?.org_id)?Au(t):ut(u=>{let l=xi(o,i);return u.setPropagationContext(l),Dn(u,void 0),t()})};function $n(e,t){let r=Qd();return r.withActiveSpan?r.withActiveSpan(e,t):ut(n=>(Dn(n,e||void 0),t(n)))}function Nr(e){let t=Qd();return t.suppressTracing?t.suppressTracing(e):ut(r=>{r.setSDKProcessingMetadata({[p0]:!0});let n=e();return r.setSDKProcessingMetadata({[p0]:void 0}),n})}function Au(e){let t=Qd();return t.startNewTrace?t.startNewTrace(e):ut(r=>(r.setPropagationContext({traceId:st(),sampleRand:Se()}),R&&b.log(`Starting a new trace with id ${r.getPropagationContext().traceId}`),$n(null,e)))}function Qd(){let e=be();return Ne(e)}function m0(e,t){let{fingerprint:r,span:n,breadcrumbs:o,sdkProcessingMetadata:i}=t;II(e,t),n&&DI(e,n),NI(e,r),RI(e,o),PI(e,i)}function f0(e,t){let{extra:r,tags:n,attributes:o,user:i,contexts:s,level:a,sdkProcessingMetadata:u,breadcrumbs:l,fingerprint:d,eventProcessors:p,attachments:f,propagationContext:m,transactionName:h,span:_}=t;Ii(e,"extra",r),Ii(e,"tags",n),Ii(e,"attributes",o),Ii(e,"user",i),Ii(e,"contexts",s),e.sdkProcessingMetadata=Jt(e.sdkProcessingMetadata,u,2),a&&(e.level=a),h&&(e.transactionName=h),_&&(e.span=_),l.length&&(e.breadcrumbs=[...e.breadcrumbs,...l]),d.length&&(e.fingerprint=[...e.fingerprint,...d]),p.length&&(e.eventProcessors=[...e.eventProcessors,...p]),f.length&&(e.attachments=[...e.attachments,...f]),e.propagationContext={...e.propagationContext,...m}}function Ii(e,t,r){e[t]=Jt(e[t],r,1)}function zn(e,t){let r=bi().getScopeData();return e&&f0(r,e.getScopeData()),t&&f0(r,t.getScopeData()),r}function II(e,t){let{extra:r,tags:n,user:o,contexts:i,level:s,transactionName:a}=t;Object.keys(r).length&&(e.extra={...r,...e.extra}),Object.keys(n).length&&(e.tags={...n,...e.tags}),Object.keys(o).length&&(e.user={...o,...e.user}),Object.keys(i).length&&(e.contexts={...i,...e.contexts}),s&&(e.level=s),a&&e.type!=="transaction"&&(e.transaction=a)}function RI(e,t){let r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}function PI(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function DI(e,t){e.contexts={trace:Eu(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:Xt(t),...e.sdkProcessingMetadata};let r=Yt(t),n=Dr(r).description;n&&!e.transaction&&e.type==="transaction"&&(e.transaction=n)}function NI(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint.length||delete e.fingerprint}function h0(e,t){let r=Wd(e),n=Ei(e),o=Wd(n),{isolationScope:i,scope:s}=Fn(e),a=zn(i,s);OI(r,o,t,a),r.is_segment&&t.emit("processSegmentSpan",r),t.emit("processSpan",r);let{beforeSendSpan:u}=t.getOptions(),l=u&&jn(u)?MI(r,u):r,d=l.attributes?.[Ir];return d&&g0(l,{"sentry.span.source":d}),{...Qg(l),_segmentSpan:n}}function OI(e,t,r,n){let o=r.getSdkMetadata(),{release:i,environment:s,sendDefaultPii:a}=r.getOptions();g0(e,{[Og]:i,[Mg]:s,[Fg]:t.name,[Bg]:t.span_id,[Lg]:o?.sdk?.name,[Ug]:o?.sdk?.version,...a?{[jg]:n.user?.id,[qg]:n.user?.email,[$g]:n.user?.ip_address,[zg]:n.user?.username}:{},...n.attributes})}function MI(e,t){let r=t(e);return r||(Ci(),e)}function g0(e,t){let r=e.attributes??(e.attributes={});Object.entries(t).forEach(([n,o])=>{o!=null&&!(n in r)&&(r[n]=o)})}var ep=0,b0=1,y0=2;function It(e){return new ku(t=>{t(e)})}function Wn(e){return new ku((t,r)=>{r(e)})}var ku=class e{constructor(t){this._state=ep,this._handlers=[],this._runExecutor(t)}then(t,r){return new e((n,o)=>{this._handlers.push([!1,i=>{if(!t)n(i);else try{n(t(i))}catch(s){o(s)}},i=>{if(!r)o(i);else try{n(r(i))}catch(s){o(s)}}]),this._executeHandlers()})}catch(t){return this.then(r=>r,t)}finally(t){return new e((r,n)=>{let o,i;return this.then(s=>{i=!1,o=s,t&&t()},s=>{i=!0,o=s,t&&t()}).then(()=>{if(i){n(o);return}r(o)})})}_executeHandlers(){if(this._state===ep)return;let t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===b0&&r[1](this._value),this._state===y0&&r[2](this._value),r[0]=!0)})}_runExecutor(t){let r=(i,s)=>{if(this._state===ep){if(ot(s)){s.then(n,o);return}this._state=i,this._value=s,this._executeHandlers()}},n=i=>{r(b0,i)},o=i=>{r(y0,i)};try{t(n,o)}catch(i){o(i)}}};function _0(e,t,r,n=0){try{let o=tp(t,r,e,n);return ot(o)?o:It(o)}catch(o){return Wn(o)}}function tp(e,t,r,n){let o=r[n];if(!e||!o)return e;let i=o({...e},t);return R&&i===null&&b.log(`Event processor "${o.id||"?"}" dropped event`),ot(i)?i.then(s=>tp(s,t,r,n+1)):tp(i,t,r,n+1)}var Or,w0,x0,Qt;function S0(e){let t=$._sentryDebugIds,r=$._debugIds;if(!t&&!r)return{};let n=t?Object.keys(t):[],o=r?Object.keys(r):[];if(Qt&&n.length===w0&&o.length===x0)return Qt;w0=n.length,x0=o.length,Qt={},Or||(Or={});let i=(s,a)=>{for(let u of s){let l=a[u],d=Or?.[u];if(d&&Qt&&l)Qt[d[0]]=l,Or&&(Or[u]=[d[0],l]);else if(l){let p=e(u);for(let f=p.length-1;f>=0;f--){let h=p[f]?.filename;if(h&&Qt&&Or){Qt[h]=l,Or[u]=[h,l];break}}}}};return t&&i(n,t),r&&i(o,r),Qt}function v0(e,t,r,n,o,i){let{normalizeDepth:s=3,normalizeMaxBreadth:a=1e3}=e,u={...t,event_id:t.event_id||r.event_id||ie(),timestamp:t.timestamp||At()},l=r.integrations||e.integrations.map(D=>D.name);FI(u,e),UI(u,l),o&&o.emit("applyFrameMetadata",t),t.type===void 0&&BI(u,e.stackParser);let d=qI(n,r.captureContext);r.mechanism&&Pn(u,r.mechanism);let p=o?o.getEventProcessors():[],f=zn(i,d),m=[...r.attachments||[],...f.attachments];m.length&&(r.attachments=m),m0(u,f);let h=[...p,...f.eventProcessors];return(r.data&&r.data.__sentry__===!0?It(u):_0(h,u,r)).then(D=>(D&&LI(D),typeof s=="number"&&s>0?jI(D,s,a):D))}function FI(e,t){let{environment:r,release:n,dist:o,maxValueLength:i}=t;e.environment=e.environment||r||Ln,!e.release&&n&&(e.release=n),!e.dist&&o&&(e.dist=o);let s=e.request;s?.url&&i&&(s.url=Rn(s.url,i)),i&&e.exception?.values?.forEach(a=>{a.value&&(a.value=Rn(a.value,i))})}function BI(e,t){let r=S0(t);e.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(o=>{o.filename&&(o.debug_id=r[o.filename])})})}function LI(e){let t={};if(e.exception?.values?.forEach(n=>{n.stacktrace?.frames?.forEach(o=>{o.debug_id&&(o.abs_path?t[o.abs_path]=o.debug_id:o.filename&&(t[o.filename]=o.debug_id),delete o.debug_id)})}),Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let r=e.debug_meta.images;Object.entries(t).forEach(([n,o])=>{r.push({type:"sourcemap",code_file:n,debug_id:o})})}function UI(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function jI(e,t,r){if(!e)return null;let n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(o=>({...o,...o.data&&{data:He(o.data,t,r)}}))},...e.user&&{user:He(e.user,t,r)},...e.contexts&&{contexts:He(e.contexts,t,r)},...e.extra&&{extra:He(e.extra,t,r)}};return e.contexts?.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=He(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(o=>({...o,...o.data&&{data:He(o.data,t,r)}}))),e.contexts?.flags&&n.contexts&&(n.contexts.flags=He(e.contexts.flags,3,r)),n}function qI(e,t){if(!t)return e;let r=e?e.clone():new xe;return r.update(t),r}function E0(e){if(e)return $I(e)?{captureContext:e}:WI(e)?{captureContext:e}:e}function $I(e){return e instanceof xe||typeof e=="function"}var zI=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function WI(e){return Object.keys(e).some(t=>zI.includes(t))}function ue(e,t){return ee().captureException(e,E0(t))}function Ri(e,t){ne().setTag(e,t)}function Pi(e){ne().setUser(e)}function Di(){let e=Y();return e?.getOptions().enabled!==!1&&!!e?.getTransport()}function Ni(e){let t=ne(),{user:r}=zn(t,ee()),{userAgent:n}=$.navigator||{},o=vg({user:r,...n&&{userAgent:n},...e}),i=t.getSession();return i?.status==="ok"&&kt(i,{status:"exited"}),Hn(),t.setSession(o),o}function Hn(){let e=ne(),r=ee().getSession()||e.getSession();r&&Eg(r),HI(),e.setSession()}function HI(){let e=ne(),t=Y(),r=e.getSession();r&&t&&t.captureSession(r)}var VI="7";function GI(e){let t=e.protocol?`${e.protocol}:`:"",r=e.port?`:${e.port}`:"";return`${t}//${e.host}${r}${e.path?`/${e.path}`:""}/api/`}function KI(e){return`${GI(e)}${e.projectId}/envelope/`}function JI(e,t){let r={sentry_version:VI};return e.publicKey&&(r.sentry_key=e.publicKey),t&&(r.sentry_client=`${t.name}/${t.version}`),new URLSearchParams(r).toString()}function C0(e,t,r){return t||`${KI(e)}?${JI(e,r)}`}var rp=[];function YI(e){let t={};return e.forEach(r=>{let{name:n}=r,o=t[n];o&&!o.isDefaultInstance&&r.isDefaultInstance||(t[n]=r)}),Object.values(t)}function np(e){let t=e.defaultIntegrations||[],r=e.integrations;t.forEach(o=>{o.isDefaultInstance=!0});let n;if(Array.isArray(r))n=[...t,...r];else if(typeof r=="function"){let o=r(t);n=Array.isArray(o)?o:[o]}else n=t;return YI(n)}function T0(e,t){let r={};return t.forEach(n=>{n?.beforeSetup&&n.beforeSetup(e)}),t.forEach(n=>{n&&ip(e,n,r)}),r}function op(e,t){for(let r of t)r?.afterAllSetup&&r.afterAllSetup(e)}function ip(e,t,r){if(r[t.name]){R&&b.log(`Integration skipped because it was already installed: ${t.name}`);return}if(r[t.name]=t,!rp.includes(t.name)&&typeof t.setupOnce=="function"&&(t.setupOnce(),rp.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(e),typeof t.preprocessEvent=="function"){let n=t.preprocessEvent.bind(t);e.on("preprocessEvent",(o,i)=>n(o,i,e))}if(typeof t.processEvent=="function"){let n=t.processEvent.bind(t),o=Object.assign((i,s)=>n(i,s,e),{id:t.name});e.addEventProcessor(o)}R&&b.log(`Integration installed: ${t.name}`)}function A0(e,t){return t?ut(t,()=>{let r=Zt(),n=r?Eu(r):yi(t);return[r?Xt(r):Un(e,t),n]}):[void 0,void 0]}function ZI(e){return[{type:"log",item_count:e.length,content_type:"application/vnd.sentry.items.log+json"},{items:e}]}function k0(e,t,r,n){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),r&&n&&(o.dsn=ve(n)),ye(o,[ZI(e)])}function Vn(e,t){let r=t??XI(e)??[];if(r.length===0)return;let n=e.getOptions(),o=k0(r,n._metadata,n.tunnel,e.getDsn());I0().set(e,[]),e.emit("flushLogs"),e.sendEnvelope(o)}function XI(e){return I0().get(e)}function I0(){return We("clientToLogBufferMap",()=>new WeakMap)}function QI(e){return[{type:"trace_metric",item_count:e.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:e}]}function R0(e,t,r,n){let o={};return t?.sdk&&(o.sdk={name:t.sdk.name,version:t.sdk.version}),r&&n&&(o.dsn=ve(n)),ye(o,[QI(e)])}function P0(e,t){let r=t??eR(e)??[];if(r.length===0)return;let n=e.getOptions(),o=R0(r,n._metadata,n.tunnel,e.getDsn());D0().set(e,[]),e.emit("flushMetrics"),e.sendEnvelope(o)}function eR(e){return D0().get(e)}function D0(){return We("clientToMetricBufferMap",()=>new WeakMap)}function Gn(e){return typeof e=="object"&&typeof e.unref=="function"&&e.unref(),e}var Oi=Symbol.for("SentryBufferFullError");function Kn(e=100){let t=new Set;function r(){return t.size<e}function n(s){t.delete(s)}function o(s){if(!r())return Wn(Oi);let a=s();return t.add(a),a.then(()=>n(a),()=>n(a)),a}function i(s){if(!t.size)return It(!0);let a=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return a;let u=[a,new Promise(l=>Gn(setTimeout(()=>l(!1),s)))];return Promise.race(u)}return{get $(){return Array.from(t)},add:o,drain:i}}var tR=60*1e3;function rR(e,t=In()){let r=parseInt(`${e}`,10);if(!isNaN(r))return r*1e3;let n=Date.parse(`${e}`);return isNaN(n)?tR:n-t}function nR(e,t){return e[t]||e.all||0}function N0(e,t,r=In()){return nR(e,t)>r}function O0(e,{statusCode:t,headers:r},n=In()){let o={...e},i=r?.["x-sentry-rate-limits"],s=r?.["retry-after"];if(i)for(let a of i.trim().split(",")){let[u,l,,,d]=a.split(":",5),p=parseInt(u,10),f=(isNaN(p)?60:p)*1e3;if(!l)o.all=n+f;else for(let m of l.split(";"))m==="metric_bucket"?(!d||d.split(";").includes("custom"))&&(o[m]=n+f):o[m]=n+f}else s?o.all=n+rR(s,n):t===429&&(o.all=n+60*1e3);return o}var Mi=64;function er(e,t,r=Kn(e.bufferSize||Mi)){let n={},o=s=>r.drain(s);function i(s){let a=[];if(Ti(s,(p,f)=>{let m=Tu(f);N0(n,m)?e.recordDroppedEvent("ratelimit_backoff",m):a.push(p)}),a.length===0)return Promise.resolve({});let u=ye(s[0],a),l=p=>{if(Yd(u,["client_report"])){R&&b.warn(`Dropping client report. Will not send outcomes (reason: ${p}).`);return}Ti(u,(f,m)=>{e.recordDroppedEvent(p,Tu(m))})},d=()=>t({body:Ai(u)}).then(p=>p.statusCode===413?(R&&b.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),l("send_error"),p):(R&&p.statusCode!==void 0&&(p.statusCode<200||p.statusCode>=300)&&b.warn(`Sentry responded with status code ${p.statusCode} to sent event.`),n=O0(n,p),p),p=>{throw l("network_error"),R&&b.error("Encountered error running transport request:",p),p});return r.add(d).then(p=>p,p=>{if(p===Oi)return R&&b.error("Skipped sending event because buffer is full."),l("queue_overflow"),Promise.resolve({});throw p})}return{send:i,flush:o}}function M0(e,t,r){let n=[{type:"client_report"},{timestamp:r||At(),discarded_events:e}];return ye(t?{dsn:t}:{},[n])}function Iu(e){let t=[];e.message&&t.push(e.message);try{let r=e.exception.values[e.exception.values.length-1];r?.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`))}catch{}return t}function F0(e){let{trace_id:t,parent_span_id:r,span_id:n,status:o,origin:i,data:s,op:a}=e.contexts?.trace??{};return{data:s??{},description:e.transaction,op:a,parent_span_id:r,span_id:n??"",start_timestamp:e.start_timestamp??0,status:o,timestamp:e.timestamp,trace_id:t??"",origin:i,profile_id:s?.[jd],exclusive_time:s?.[qd],measurements:e.measurements,is_segment:!0}}function B0(e){return{type:"transaction",timestamp:e.timestamp,start_timestamp:e.start_timestamp,transaction:e.description,contexts:{trace:{trace_id:e.trace_id,span_id:e.span_id,parent_span_id:e.parent_span_id,op:e.op,status:e.status,origin:e.origin,data:{...e.data,...e.profile_id&&{[jd]:e.profile_id},...e.exclusive_time&&{[qd]:e.exclusive_time}}}},measurements:e.measurements}}var L0="Not capturing exception because it's already been captured.",U0="Discarded session because of missing or non-string release",H0=Symbol.for("SentryInternalError"),V0=Symbol.for("SentryDoNotSendEventError"),oR=5e3;function Ru(e){return{message:e,[H0]:!0}}function sp(e){return{message:e,[V0]:!0}}function j0(e){return!!e&&typeof e=="object"&&H0 in e}function q0(e){return!!e&&typeof e=="object"&&V0 in e}function $0(e,t,r,n,o){let i=0,s,a=!1;e.on(r,()=>{i=0,clearTimeout(s),a=!1}),e.on(t,u=>{i+=n(u),i>=8e5?o(e):a||(a=!0,s=Gn(setTimeout(()=>{o(e)},oR)))}),e.on("flush",()=>{o(e)})}var Pu=class{constructor(t){if(this._options=t,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Kn(t.transportOptions?.bufferSize??Mi),t.dsn?this._dsn=Gg(t.dsn):R&&b.warn("No DSN provided, client will not send events."),this._dsn){let n=C0(this._dsn,t.tunnel,t._metadata?t._metadata.sdk:void 0);this._transport=t.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:n})}this._options.enableLogs=this._options.enableLogs??this._options._experiments?.enableLogs,this._options.enableLogs&&$0(this,"afterCaptureLog","flushLogs",uR,Vn),(this._options.enableMetrics??this._options._experiments?.enableMetrics??!0)&&$0(this,"afterCaptureMetric","flushMetrics",aR,P0)}captureException(t,r,n){let o=ie();if(hu(t))return R&&b.log(L0),o;let i={event_id:o,...r};return this._process(()=>this.eventFromException(t,i).then(s=>this._captureEvent(s,i,n)).then(s=>s),"error"),i.event_id}captureMessage(t,r,n,o){let i={event_id:ie(),...n},s=Tn(t)?t:String(t),a=kr(t),u=a?this.eventFromMessage(s,r,i):this.eventFromException(t,i);return this._process(()=>u.then(l=>this._captureEvent(l,i,o)),a?"unknown":"error"),i.event_id}captureEvent(t,r,n){let o=ie();if(r?.originalException&&hu(r.originalException))return R&&b.log(L0),o;let i={event_id:o,...r},s=t.sdkProcessingMetadata||{},a=s.capturedSpanScope,u=s.capturedSpanIsolationScope,l=z0(t.type);return this._process(()=>this._captureEvent(t,i,a||n,u),l),i.event_id}captureSession(t){this.sendSession(t),kt(t,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(t){let r=this._transport;if(!r)return!0;this.emit("flush");let n=await this._isClientDoneProcessing(t),o=await r.flush(t);return n&&o}async close(t){Vn(this);let r=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),r}getEventProcessors(){return this._eventProcessors}addEventProcessor(t){this._eventProcessors.push(t)}init(){(this._isEnabled()||this._options.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(t){return this._integrations[t]}addIntegration(t){let r=this._integrations[t.name];!r&&t.beforeSetup&&t.beforeSetup(this),ip(this,t,this._integrations),r||op(this,[t])}sendEvent(t,r={}){this.emit("beforeSendEvent",t,r);let n=c0(t,this._dsn,this._options._metadata,this._options.tunnel);for(let o of r.attachments||[])n=Jd(n,Zd(o));this.sendEnvelope(n).then(o=>this.emit("afterSendEvent",t,o))}sendSession(t){let{release:r,environment:n=Ln}=this._options;if("aggregates"in t){let i=t.attrs||{};if(!i.release&&!r){R&&b.warn(U0);return}i.release=i.release||r,i.environment=i.environment||n,t.attrs=i}else{if(!t.release&&!r){R&&b.warn(U0);return}t.release=t.release||r,t.environment=t.environment||n}this.emit("beforeSendSession",t);let o=l0(t,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(o)}recordDroppedEvent(t,r,n=1){if(this._options.sendClientReports){let o=`${t}:${r}`;R&&b.log(`Recording outcome: "${o}"${n>1?` (${n} times)`:""}`),this._outcomes[o]=(this._outcomes[o]||0)+n}}on(t,r){let n=this._hooks[t]=this._hooks[t]||new Set,o=(...i)=>r(...i);return n.add(o),()=>{n.delete(o)}}emit(t,...r){let n=this._hooks[t];n&&n.forEach(o=>o(...r))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._isEnabled()&&this._transport)try{return await this._transport.send(t)}catch(r){return R&&b.error("Error while sending envelope:",r),{}}return R&&b.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){let{integrations:t}=this._options;this._integrations=T0(this,t),op(this,t)}_updateSessionFromEvent(t,r){let n=r.level==="fatal",o=!1,i=r.exception?.values;if(i){o=!0,n=!1;for(let u of i)if(u.mechanism?.handled===!1){n=!0;break}}let s=t.status==="ok";(s&&t.errors===0||s&&n)&&(kt(t,{...n&&{status:"crashed"},errors:t.errors||Number(o||n)}),this.captureSession(t))}async _isClientDoneProcessing(t){let r=0;for(;!t||r<t;){if(await new Promise(n=>setTimeout(n,1)),!this._numProcessing)return!0;r++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(t,r,n,o){let i=this.getOptions(),s=Object.keys(this._integrations);return!r.integrations&&s?.length&&(r.integrations=s),this.emit("preprocessEvent",t,r),t.type||o.setLastEventId(t.event_id||r.event_id),v0(i,t,r,n,this,o).then(a=>{if(a===null)return a;this.emit("postprocessEvent",a,r),a.contexts={trace:{...a.contexts?.trace,...yi(n)},...a.contexts};let u=Un(this,n);return a.sdkProcessingMetadata={dynamicSamplingContext:u,...a.sdkProcessingMetadata},a})}_captureEvent(t,r={},n=ee(),o=ne()){return R&&ap(t)&&b.log(`Captured error event \`${Iu(t)[0]||"<unknown>"}\``),this._processEvent(t,r,n,o).then(i=>i.event_id,i=>{R&&(q0(i)?b.log(i.message):j0(i)?b.warn(i.message):b.warn(i))})}_processEvent(t,r,n,o){let i=this.getOptions(),{sampleRate:s}=i,a=G0(t),u=ap(t),d=`before send for type \`${t.type||"error"}\``,p=typeof s>"u"?void 0:wi(s);if(u&&typeof p=="number"&&Se()>p)return this.recordDroppedEvent("sample_rate","error"),Wn(sp(`Discarding event because it's not included in the random sample (sampling rate = ${s})`));let f=z0(t.type);return this._prepareEvent(t,r,n,o).then(m=>{if(m===null)throw this.recordDroppedEvent("event_processor",f),sp("An event processor returned `null`, will not send event.");if(r.data?.__sentry__===!0)return m;let _=sR(this,i,m,r);return iR(_,d)}).then(m=>{if(m===null){if(this.recordDroppedEvent("before_send",f),a){let D=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",D)}throw sp(`${d} returned \`null\`, will not send event.`)}let h=n.getSession()||o.getSession();if(u&&h&&this._updateSessionFromEvent(h,m),a){let S=m.sdkProcessingMetadata?.spanCountBeforeProcessing||0,D=m.spans?m.spans.length:0,w=S-D;w>0&&this.recordDroppedEvent("before_send","span",w)}let _=m.transaction_info;if(a&&_&&m.transaction!==t.transaction){let S="custom";m.transaction_info={..._,source:S}}return this.sendEvent(m,r),m}).then(null,m=>{throw q0(m)||j0(m)?m:(this.captureException(m,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:m}),Ru(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
Reason: ${m}`))})}_process(t,r){this._numProcessing++,this._promiseBuffer.add(t).then(n=>(this._numProcessing--,n),n=>(this._numProcessing--,n===Oi&&this.recordDroppedEvent("queue_overflow",r),n))}_clearOutcomes(){let t=this._outcomes;return this._outcomes={},Object.entries(t).map(([r,n])=>{let[o,i]=r.split(":");return{reason:o,category:i,quantity:n}})}_flushOutcomes(){R&&b.log("Flushing outcomes...");let t=this._clearOutcomes();if(t.length===0){R&&b.log("No outcomes to send");return}if(!this._dsn){R&&b.log("No dsn provided, will not send outcomes");return}R&&b.log("Sending outcomes:",t);let r=M0(t,this._options.tunnel&&ve(this._dsn));this.sendEnvelope(r)}};function z0(e){return e==="replay_event"?"replay":e||"error"}function iR(e,t){let r=`${t} must return \`null\` or a valid event.`;if(ot(e))return e.then(n=>{if(!Ct(n)&&n!==null)throw Ru(r);return n},n=>{throw Ru(`${t} rejected with ${n}`)});if(!Ct(e)&&e!==null)throw Ru(r);return e}function sR(e,t,r,n){let{beforeSend:o,beforeSendTransaction:i,ignoreSpans:s}=t,a=!jn(t.beforeSendSpan)&&t.beforeSendSpan,u=r;if(ap(u)&&o)return o(u,n);if(G0(u)){if(a||s){let l=F0(u);if(s?.length&&Hd(l,s))return null;if(a){let d=a(l);d?u=Jt(r,B0(d)):Ci()}if(u.spans){let d=[],p=u.spans;for(let m of p){if(s?.length&&Hd(m,s)){s0(p,m);continue}if(a){let h=a(m);h?d.push(h):(Ci(),d.push(m))}else d.push(m)}let f=u.spans.length-d.length;f&&e.recordDroppedEvent("before_send","span",f),u.spans=d}}if(i){if(u.spans){let l=u.spans.length;u.sdkProcessingMetadata={...r.sdkProcessingMetadata,spanCountBeforeProcessing:l}}return i(u,n)}}return u}function ap(e){return e.type===void 0}function G0(e){return e.type==="transaction"}function aR(e){let t=0;return e.name&&(t+=e.name.length*2),t+=8,t+K0(e.attributes)}function uR(e){let t=0;return e.message&&(t+=e.message.length*2),t+K0(e.attributes)}function K0(e){if(!e)return 0;let t=0;return Object.values(e).forEach(r=>{Array.isArray(r)?t+=r.length*W0(r[0]):kr(r)?t+=W0(r):t+=100}),t}function W0(e){return typeof e=="string"?e.length*2:typeof e=="number"?8:typeof e=="boolean"?4:0}function J0(e,t,r,n,o){let i={sent_at:new Date().toISOString()};r?.sdk&&(i.sdk={name:r.sdk.name,version:r.sdk.version}),n&&o&&(i.dsn=ve(o)),t&&(i.trace=t);let s=lR(e);return ye(i,[s])}function lR(e){return[{type:"check_in"},e]}function Y0(e){let t=e._metadata?.sdk,r=t?.name&&t?.version?`${t?.name}/${t?.version}`:void 0;e.transportOptions={...e.transportOptions,headers:{...r&&{"user-agent":r},...e.transportOptions?.headers}}}function Z0(e,t){return e(t.stack||"",1)}function cR(e){return nt(e)&&"__sentry_fetch_url_host__"in e&&typeof e.__sentry_fetch_url_host__=="string"}function dR(e){return cR(e)?`${e.message} (${e.__sentry_fetch_url_host__})`:e.message}function up(e,t){let r={type:t.name||t.constructor.name,value:dR(t)},n=Z0(e,t);return n.length&&(r.stacktrace={frames:n}),r}function pR(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(r instanceof Error)return r}}function fR(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message '${e.message}'`),n}else if("message"in e&&typeof e.message=="string")return e.message;let t=yg(e);if(Sd(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=mR(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function mR(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function hR(e,t,r,n){if(nt(r))return[r,void 0];if(t.synthetic=!0,Ct(r)){let i=e?.getOptions().normalizeDepth,s={__serialized__:Gd(r,i)},a=pR(r);if(a)return[a,s];let u=fR(r),l=n?.syntheticException||new Error(u);return l.message=u,[l,s]}let o=n?.syntheticException||new Error(r);return o.message=`${r}`,[o,void 0]}function X0(e,t,r,n){let i=n?.data&&n.data.mechanism||{handled:!0,type:"generic"},[s,a]=hR(e,i,r,n),u={exception:{values:[up(t,s)]}};return a&&(u.extra=a),Dd(u,void 0,void 0),Pn(u,i),{...u,event_id:n?.event_id}}function Q0(e,t,r="info",n,o){let i={event_id:n?.event_id,level:r};if(o&&n?.syntheticException){let s=Z0(e,n.syntheticException);s.length&&(i.exception={values:[{value:t,stacktrace:{frames:s}}]},Pn(i,{synthetic:!0}))}if(Tn(t)){let{__sentry_template_string__:s,__sentry_template_values__:a}=t;return i.logentry={message:s,params:a},i}return i.message=t,i}var Fi=class extends Pu{constructor(t){n0(),Y0(t),super(t),this._setUpMetricsProcessing()}eventFromException(t,r){let n=X0(this,this._options.stackParser,t,r);return n.level="error",It(n)}eventFromMessage(t,r="info",n){return It(Q0(this._options.stackParser,t,r,n,this._options.attachStacktrace))}captureException(t,r,n){return eb(r),super.captureException(t,r,n)}captureEvent(t,r,n){return!t.type&&t.exception?.values&&t.exception.values.length>0&&eb(r),super.captureEvent(t,r,n)}captureCheckIn(t,r,n){let o="checkInId"in t&&t.checkInId?t.checkInId:ie();if(!this._isEnabled())return R&&b.warn("SDK not enabled, will not capture check-in."),o;let i=this.getOptions(),{release:s,environment:a,tunnel:u}=i,l={check_in_id:o,monitor_slug:t.monitorSlug,status:t.status,release:s,environment:a};"duration"in t&&(l.duration=t.duration),r&&(l.monitor_config={schedule:r.schedule,checkin_margin:r.checkinMargin,max_runtime:r.maxRuntime,timezone:r.timezone,failure_issue_threshold:r.failureIssueThreshold,recovery_threshold:r.recoveryThreshold});let[d,p]=A0(this,n);p&&(l.contexts={trace:p});let f=J0(l,d,this.getSdkMetadata(),u,this.getDsn());return R&&b.log("Sending checkin:",t.monitorSlug,t.status),this.sendEnvelope(f),o}dispose(){R&&b.log("Disposing client...");for(let t of Object.keys(this._hooks))this._hooks[t]?.clear();this._hooks={},this._eventProcessors.length=0,this._integrations={},this._outcomes={},this._transport=void 0,this._promiseBuffer=Kn(Mi)}_prepareEvent(t,r,n,o){return this._options.platform&&(t.platform=t.platform||this._options.platform),this._options.runtime&&(t.contexts={...t.contexts,runtime:t.contexts?.runtime||this._options.runtime}),this._options.serverName&&(t.server_name=t.server_name||this._options.serverName),super._prepareEvent(t,r,n,o)}_setUpMetricsProcessing(){this.on("processMetric",t=>{this._options.serverName&&(t.attributes={"server.address":this._options.serverName,...t.attributes})})}};function eb(e){let t=ne().getScopeData().sdkProcessingMetadata.requestSession;if(t){let r=e?.mechanism?.handled??!0;r&&t.status!=="crashed"?t.status="errored":r||(t.status="crashed")}}var gR=new Set(["false","f","n","no","off","0"]),bR=new Set(["true","t","y","yes","on","1"]);function tr(e,t){let r=String(e).toLowerCase();return gR.has(r)?!1:bR.has(r)?!0:t?.strict?null:!!e}function Bi(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let r=t[6]||"",n=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:n,relative:t[5]+r+n}}function lp(e){return e.split(/[?#]/,1)[0]}function Li(e){let{protocol:t,host:r,path:n}=e,o=r?.replace(/^.*@/,"[filtered]:[filtered]@").replace(/(:80)$/,"").replace(/(:443)$/,"")||"";return`${t?`${t}://`:""}${o}${n}`}function Ui(e,t,r=[t],n="npm"){let o=(e._metadata=e._metadata||{}).sdk=e._metadata.sdk||{};o.name||(o.name=`sentry.javascript.${t}`,o.packages=r.map(i=>({name:`${n}:@sentry/${i}`,version:ze})),o.version=ze)}function Mr(e={}){let t=e.client||Y();if(!Di()||!t)return{};let r=be(),n=Ne(r);if(n.getTraceData)return n.getTraceData(e);let o=e.scope||ee(),i=e.span||Zt();if(!i&&Ud())return{};let s=i?Cu(i):yR(o),a=i?Xt(i):Un(t,o),u=_u(a);if(!Su.test(s))return b.warn("Invalid sentry-trace data. Cannot generate trace data"),{};let d={"sentry-trace":s,baggage:u};return e.propagateTraceparent&&(d.traceparent=i?Zg(i):_R(o)),d}function yR(e){let{traceId:t,sampled:r,propagationSpanId:n}=e.getPropagationContext();return Si(t,n,r)}function _R(e){let{traceId:t,sampled:r,propagationSpanId:n}=e.getPropagationContext();return vi(t,n,r)}var tb="[Tracing] Not injecting trace data for url because it does not match tracePropagationTargets:";function ji(e,t,r){if(typeof e!="string"||!t)return!0;let n=r?.get(e);if(n!==void 0)return R&&!n&&b.log(tb,e),n;let o=Gt(e,t);return r?.set(e,o),R&&!o&&b.log(tb,e),o}function rb(e){let t=Object.create(null);try{Object.entries(e).forEach(([r,n])=>{typeof n=="string"&&(t[r]=n)})}catch{}return t}function cp(e){let t=e.headers||{},n=(typeof t["x-forwarded-host"]=="string"?t["x-forwarded-host"]:void 0)||(typeof t.host=="string"?t.host:void 0),i=(typeof t["x-forwarded-proto"]=="string"?t["x-forwarded-proto"]:void 0)||e.protocol||(e.socket?.encrypted?"https":"http"),s=e.url||"",a=wR({url:s,host:n,protocol:i}),u=e.body||void 0,l=e.cookies;return{url:a,method:e.method,query_string:nb(s),headers:rb(t),cookies:l,data:u}}function wR({url:e,protocol:t,host:r}){if(e?.startsWith("http"))return e;if(e&&r)return`${t}://${r}${e}`}function nb(e){if(e)try{let t=new URL(e,"http://s.io").search.slice(1);return t.length?t:void 0}catch{return}}var xR=100;function ke(e,t){let r=Y(),n=ne();if(!r)return;let{beforeBreadcrumb:o=null,maxBreadcrumbs:i=xR}=r.getOptions();if(i<=0)return;let a={timestamp:At(),...e},u=o?fe(()=>o(a,t)):a;u!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",u,t),n.addBreadcrumb(u,i))}var ob,SR="FunctionToString",ib=new WeakMap,vR=(()=>({name:SR,setupOnce(){ob=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=bg(this),r=ib.has(Y())&&t!==void 0?t:this;return ob.apply(r,e)}}catch{}},setup(e){ib.set(e,!0)}})),qi=vR;var ER=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],CR="EventFilters",Jn=(e={})=>{let t;return{name:CR,setup(r){let n=r.getOptions();t=sb(e,n)},processEvent(r,n,o){if(!t){let i=o.getOptions();t=sb(e,i)}return TR(r,t)?null:r}}},ab=((e={})=>({...Jn(e),name:"InboundFilters"}));function sb(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:ER],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function TR(e,t){if(e.type){if(e.type==="transaction"&&kR(e,t.ignoreTransactions))return R&&b.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
Event: ${Kt(e)}`),!0}else{if(AR(e,t.ignoreErrors))return R&&b.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
Event: ${Kt(e)}`),!0;if(DR(e))return R&&b.warn(`Event dropped due to not having an error message, error type or stacktrace.
Event: ${Kt(e)}`),!0;if(IR(e,t.denyUrls))return R&&b.warn(`Event dropped due to being matched by \`denyUrls\` option.
Event: ${Kt(e)}.
Url: ${Du(e)}`),!0;if(!RR(e,t.allowUrls))return R&&b.warn(`Event dropped due to not being matched by \`allowUrls\` option.
Event: ${Kt(e)}.
Url: ${Du(e)}`),!0}return!1}function AR(e,t){return t?.length?Iu(e).some(r=>Gt(r,t)):!1}function kR(e,t){if(!t?.length)return!1;let r=e.transaction;return r?Gt(r,t):!1}function IR(e,t){if(!t?.length)return!1;let r=Du(e);return r?Gt(r,t):!1}function RR(e,t){if(!t?.length)return!0;let r=Du(e);return r?Gt(r,t):!0}function PR(e=[]){for(let t=e.length-1;t>=0;t--){let r=e[t];if(r&&r.filename!=="<anonymous>"&&r.filename!=="[native code]")return r.filename||null}return null}function Du(e){try{let r=[...e.exception?.values??[]].reverse().find(n=>n.mechanism?.parent_id===void 0&&n.stacktrace?.frames?.length)?.stacktrace?.frames;return r?PR(r):null}catch{return R&&b.error(`Cannot extract url for event ${Kt(e)}`),null}}function DR(e){return e.exception?.values?.length?!e.message&&!e.exception.values.some(t=>t.stacktrace||t.type&&t.type!=="Error"||t.value):!1}function cb(e,t,r,n,o,i){if(!o.exception?.values||!i||!it(i.originalException,Error))return;let s=o.exception.values.length>0?o.exception.values[o.exception.values.length-1]:void 0;s&&(o.exception.values=dp(e,t,n,i.originalException,r,o.exception.values,s,0))}function dp(e,t,r,n,o,i,s,a){if(i.length>=r+1)return i;let u=[...i];if(it(n[o],Error)){ub(s,a,n);let l=e(t,n[o]),d=u.length;lb(l,o,d,a),u=dp(e,t,r,n[o],o,[l,...u],l,d)}return db(n)&&n.errors.forEach((l,d)=>{if(it(l,Error)){ub(s,a,n);let p=e(t,l),f=u.length;lb(p,`errors[${d}]`,f,a),u=dp(e,t,r,l,o,[p,...u],p,f)}}),u}function db(e){return Array.isArray(e.errors)}function ub(e,t,r){e.mechanism={handled:!0,type:"auto.core.linked_errors",...db(r)&&{is_exception_group:!0},...e.mechanism,exception_id:t}}function lb(e,t,r,n){e.mechanism={handled:!0,...e.mechanism,type:"chained",source:t,exception_id:r,parent_id:n}}var NR="cause",OR=5,MR="LinkedErrors",FR=((e={})=>{let t=e.limit||OR,r=e.key||NR;return{name:MR,preprocessEvent(n,o,i){let s=i.getOptions();cb(up,s.stackParser,r,t,n,o)}}}),$i=FR;function pb(e){let t={},r=0;for(;r<e.length;){let n=e.indexOf("=",r);if(n===-1)break;let o=e.indexOf(";",r);if(o===-1)o=e.length;else if(o<n){r=e.lastIndexOf(";",n-1)+1;continue}let i=e.slice(r,n).trim();if(t[i]===void 0){let s=e.slice(n+1,o).trim();s.charCodeAt(0)===34&&(s=s.slice(1,-1));try{t[i]=s.indexOf("%")!==-1?decodeURIComponent(s):s}catch{t[i]=s}}r=o+1}return t}var pp=["X-Client-IP","X-Forwarded-For","Fly-Client-IP","CF-Connecting-IP","Fastly-Client-Ip","True-Client-Ip","X-Real-IP","X-Cluster-Client-IP","X-Forwarded","Forwarded-For","Forwarded","X-Vercel-Forwarded-For"];function fb(e){let t={};for(let i of Object.keys(e))t[i.toLowerCase()]=e[i];return pp.map(i=>{let s=t[i.toLowerCase()],a=Array.isArray(s)?s.join(";"):s;return i==="Forwarded"?BR(a):a?.split(",").map(u=>u.trim())}).reduce((i,s)=>s?i.concat(s):i,[]).find(i=>i!==null&&LR(i))||null}function BR(e){if(!e)return null;for(let t of e.split(";"))if(t.startsWith("for="))return t.slice(4);return null}function LR(e){return/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-fA-F\d]{1,4}:){7}(?:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-fA-F\d]{1,4}|:)|(?:[a-fA-F\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,2}|:)|(?:[a-fA-F\d]{1,4}:){4}(?:(?::[a-fA-F\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,3}|:)|(?:[a-fA-F\d]{1,4}:){3}(?:(?::[a-fA-F\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,4}|:)|(?:[a-fA-F\d]{1,4}:){2}(?:(?::[a-fA-F\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,5}|:)|(?:[a-fA-F\d]{1,4}:){1}(?:(?::[a-fA-F\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,6}|:)|(?::(?:(?::[a-fA-F\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-fA-F\d]{1,4}){1,7}|:)))(?:%[0-9a-zA-Z]{1,})?$)/.test(e)}var UR={cookies:!0,data:!0,headers:!0,query_string:!0,url:!0},jR="RequestData",qR=((e={})=>{let t={...UR,...e.include};return{name:jR,processEvent(r,n,o){let{sdkProcessingMetadata:i={}}=r,{normalizedRequest:s,ipAddress:a}=i,u={...t,ip:t.ip??o.getOptions().sendDefaultPii};return s&&$R(r,s,{ipAddress:a},u),r}}}),zi=qR;function $R(e,t,r,n){if(e.request={...e.request,...zR(t,n)},n.ip){let o=t.headers&&fb(t.headers)||r.ipAddress;o&&(e.user={...e.user,ip_address:o})}}function zR(e,t){let r={},n={...e.headers};if(t.headers&&(r.headers=n,t.cookies||delete n.cookie,t.ip||pp.forEach(o=>{delete n[o]})),r.method=e.method,t.url&&(r.url=e.url),t.cookies){let o=e.cookies||(n?.cookie?pb(n.cookie):void 0);r.cookies=o||{}}return t.query_string&&(r.query_string=e.query_string),t.data&&(r.data=e.data),r}function mb(e){let t="console";vn(t,e),En(t,WR)}function WR(){"console"in $&&ci.forEach(function(e){e in $.console&&gg($.console,e,function(t){return Sn[e]=t,function(...r){Cn("console",{args:r,level:e}),Sn[e]?.apply($.console,r)}})})}function hb(e){return e==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(e)?e:"log"}var HR=/^(\S+:\\|\/?)([\s\S]*?)((?:\.{1,2}|[^/\\]+?|)(\.[^./\\]*|))(?:[/\\]*)$/;function VR(e){let t=e.length>1024?`<truncated>${e.slice(-1024)}`:e,r=HR.exec(t);return r?r.slice(1):[]}function fp(e){let t=VR(e),r=t[0]||"",n=t[1];return!r&&!n?".":(n&&(n=n.slice(0,n.length-1)),r+n)}var GR="Console",Wi=(e={})=>{let t=new Set(e.levels||ci);return{name:GR,setup(r){mb(({args:n,level:o})=>{Y()!==r||!t.has(o)||KR(o,n)})}}};function KR(e,t){let r={category:"console",data:{arguments:t,logger:"console"},level:hb(e),message:gb(t)};if(e==="assert")if(t[0]===!1){let n=t.slice(1);r.message=n.length>0?`Assertion failed: ${gb(n)}`:"Assertion failed",r.data.arguments=n}else return;ke(r,{input:t,level:e})}function gb(e){return"util"in $&&typeof $.util.format=="function"?$.util.format(...e):Id(e," ")}function bb(e,t,r){let n=r.getDsn(),o=r.getOptions().tunnel,i=qn(r.getOptions()._metadata),s={sent_at:new Date().toISOString(),...JR(t)&&{trace:t},...i&&{sdk:i},...!!o&&n&&{dsn:ve(n)}},a=[{type:"span",item_count:e.length,content_type:"application/vnd.sentry.items.span.v2+json"},{items:e}];return ye(s,[a])}function JR(e){return!!e.trace_id&&!!e.public_key}function yb(e){let t=156;if(t+=e.name.length*2,t+=Ld(e.attributes),e.links&&e.links.length>0){let n=e.links[0]?.attributes,o=100+(n?Ld(n):0);t+=o*e.links.length}return t}var _b=1e3,YR=5e6,Nu=class{constructor(t,r){this._traceBuckets=new Map,this._client=t;let{maxSpanLimit:n,flushInterval:o,maxTraceWeightInBytes:i}=r??{};this._maxSpanLimit=n&&n>0&&n<=_b?n:_b,this._flushInterval=o&&o>0?o:5e3,this._maxTraceWeight=i&&i>0?i:YR,this._client.on("flush",()=>{this.drain()}),this._client.on("close",()=>{this._traceBuckets.forEach(s=>{clearTimeout(s.timeout)}),this._traceBuckets.clear()})}add(t){let r=t.trace_id,n=this._traceBuckets.get(r);n||(n={spans:new Set,size:0,timeout:Gn(setTimeout(()=>{this.flush(r)},this._flushInterval))},this._traceBuckets.set(r,n)),n.spans.add(t),n.size+=yb(t),(n.spans.size>=this._maxSpanLimit||n.size>=this._maxTraceWeight)&&this.flush(r)}drain(){this._traceBuckets.size&&(R&&b.log(`Flushing span tree map with ${this._traceBuckets.size} traces`),this._traceBuckets.forEach((t,r)=>{this.flush(r)}))}flush(t){let r=this._traceBuckets.get(t);if(!r)return;if(!r.spans.size){this._removeTrace(t);return}let n=Array.from(r.spans),o=n[0]?._segmentSpan;if(!o){R&&b.warn("No segment span reference found on span JSON, cannot compute DSC"),this._removeTrace(t);return}let i=Xt(o),s=n.map(u=>{let{_segmentSpan:l,...d}=u;return d}),a=bb(s,i,this._client);R&&b.log(`Sending span envelope for trace ${t} with ${s.length} spans`),this._client.sendEnvelope(a).then(null,u=>{R&&b.error("Error while sending streamed span envelope:",u)}),this._removeTrace(t)}_removeTrace(t){let r=this._traceBuckets.get(t);r&&clearTimeout(r.timeout),this._traceBuckets.delete(t)}};var Hi=()=>({name:"SpanStreaming",setup(e){let t="SpanStreaming integration requires",r="Falling back to static trace lifecycle.",n=e.getOptions();if(!d0(e)){n.traceLifecycle="static",R&&b.warn(`${t} \`traceLifecycle\` to be set to "stream"! ${r}`);return}let o=n.beforeSendSpan;if(o&&!jn(o)){n.traceLifecycle="static",R&&b.warn(`${t} a beforeSendSpan callback using \`withStreamedSpan\`! ${r}`);return}let i=new Nu(e);e.on("afterSpanEnd",s=>{Bn(s)&&i.add(h0(s,e))})}});function Vi(e){if(e!==void 0)return e>=400&&e<500?"warning":e>=500?"error":void 0}function Sb(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function vb(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,n=/at (?:async )?(.+?) \(data:(.*?),/;return o=>{let i=o.match(n);if(i)return{filename:`<data:${i[2]}>`,function:i[1]};let s=o.match(r);if(s){let a,u,l,d,p;if(s[1]){l=s[1];let _=l.lastIndexOf(".");if(l[_-1]==="."&&_--,_>0){a=l.slice(0,_),u=l.slice(_+1);let S=a.indexOf(".Module");S>0&&(l=l.slice(S+1),a=a.slice(0,S))}d=void 0}u&&(d=a,p=u),u==="<anonymous>"&&(p=void 0,l=void 0),l===void 0&&(p=p||"?",l=d?`${d}.${p}`:p);let f=ug(s[2]),m=s[5]==="native";!f&&s[5]&&!m&&(f=s[5]);let h=f?ZR(f):void 0;return{filename:h??f,module:h&&e?.(h),function:l,lineno:wb(s[3]),colno:wb(s[4]),in_app:Sb(f||"",m)}}if(o.match(t))return{filename:o}}}function mp(e){return[90,vb(e)]}function wb(e){return parseInt(e||"",10)||void 0}function ZR(e){try{return decodeURI(e)}catch{return}}var Oe=class{constructor(t){this._maxSize=t,this._cache=new Map}get size(){return this._cache.size}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){if(this._cache.size>=this._maxSize){let n=this._cache.keys().next().value;this._cache.delete(n)}this._cache.set(t,r)}remove(t){let r=this._cache.get(t);return r&&this._cache.delete(t),r}clear(){this._cache.clear()}keys(){return Array.from(this._cache.keys())}values(){let t=[];return this._cache.forEach(r=>t.push(r)),t}};import{threadId as XR,isMainThread as QR}from"worker_threads";var Z=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;var eP=6e4,Ou=class extends Fi{constructor(t){let r=t.includeServerName===!1?void 0:t.serverName||global.process.env.SENTRY_NAME||$b.hostname(),n={...t,platform:"node",runtime:{name:"node",version:global.process.version},serverName:r};Ui(n,"node-light",["node-core"]),b.log(`Initializing Sentry: process: ${process.pid}, thread: ${QR?"main":`worker-${XR}`}.`),super(n),this.getOptions().enableLogs&&(this._logOnExitFlushListener=()=>{Vn(this)},r&&this.on("beforeCaptureLog",o=>{o.attributes={...o.attributes,"server.address":r}}),process.on("beforeExit",this._logOnExitFlushListener))}async flush(t){return this.getOptions().sendClientReports&&this._flushOutcomes(),super.flush(t)}async close(t){return this._clientReportInterval&&clearInterval(this._clientReportInterval),this._clientReportOnExitFlushListener&&process.off("beforeExit",this._clientReportOnExitFlushListener),this._logOnExitFlushListener&&process.off("beforeExit",this._logOnExitFlushListener),super.close(t)}startClientReportTracking(){let t=this.getOptions();t.sendClientReports&&(this._clientReportOnExitFlushListener=()=>{this._flushOutcomes()},this._clientReportInterval=setInterval(()=>{Z&&b.log("Flushing client reports based on interval."),this._flushOutcomes()},t.clientReportFlushInterval??eP).unref(),process.on("beforeExit",this._clientReportOnExitFlushListener))}};import*as hp from"node:diagnostics_channel";var tP="ChildProcess",zb=(e={})=>({name:tP,setup(){hp.channel("child_process").subscribe(t=>{t&&typeof t=="object"&&"process"in t&&rP(t.process,e)}),hp.channel("worker_threads").subscribe(t=>{t&&typeof t=="object"&&"worker"in t&&nP(t.worker,e)})}});function rP(e,t){let r=!1,n;e.on("spawn",()=>{if(e.spawnfile==="/usr/bin/sw_vers"){r=!0;return}n={spawnfile:e.spawnfile},t.includeChildProcessArgs&&(n.spawnargs=e.spawnargs)}).on("exit",o=>{r||(r=!0,o!==null&&o!==0&&ke({category:"child_process",message:`Child process exited with code '${o}'`,level:o===0?"info":"warning",data:n}))}).on("error",o=>{r||(r=!0,ke({category:"child_process",message:`Child process errored with '${o.message}'`,level:"error",data:n}))})}function nP(e,t){let r;e.on("online",()=>{r=e.threadId}).on("error",n=>{t.captureWorkerErrors!==!1?ue(n,{mechanism:{type:"auto.child_process.worker_thread",handled:!1,data:{threadId:String(r)}}}):ke({category:"worker_thread",message:`Worker thread errored with '${n.message}'`,level:"error",data:{threadId:r}})})}import{execFile as oP}from"node:child_process";import{readFile as iP,readdir as sP}from"node:fs";import*as le from"node:os";import{join as aP}from"node:path";import{promisify as Hb}from"node:util";var uP=Hb(iP),lP=Hb(sP),cP="Context",dP=((e={})=>{let t,r={app:!0,os:!0,device:!0,culture:!0,cloudResource:!0,...e};async function n(i){t===void 0&&(t=o());let s=pP(await t);return i.contexts={...i.contexts,app:{...s.app,...i.contexts?.app},os:{...s.os,...i.contexts?.os},device:{...s.device,...i.contexts?.device},culture:{...s.culture,...i.contexts?.culture},cloud_resource:{...s.cloud_resource,...i.contexts?.cloud_resource}},i}async function o(){let i={};if(r.os&&(i.os=await fP()),r.app&&(i.app=hP()),r.device&&(i.device=gP(r.device)),r.culture){let s=mP();s&&(i.culture=s)}return r.cloudResource&&(i.cloud_resource=SP()),i}return{name:cP,processEvent(i){return n(i)}}}),Vb=dP;function pP(e){if(e.app?.app_memory&&(e.app.app_memory=process.memoryUsage().rss),e.app?.free_memory&&typeof process.availableMemory=="function"){let t=process.availableMemory?.();t!=null&&(e.app.free_memory=t)}return e.device?.free_memory&&(e.device.free_memory=le.freemem()),e}async function fP(){let e=le.platform();switch(e){case"darwin":return wP();case"linux":return xP();default:return{name:bP[e]||e,version:le.release()}}}function mP(){try{if(typeof process.versions.icu!="string")return;let e=new Date(9e8);if(new Intl.DateTimeFormat("es",{month:"long"}).format(e)==="enero"){let r=Intl.DateTimeFormat().resolvedOptions();return{locale:r.locale,timezone:r.timeZone}}}catch{}}function hP(){let e=process.memoryUsage().rss,r={app_start_time:new Date(Date.now()-process.uptime()*1e3).toISOString(),app_memory:e};if(typeof process.availableMemory=="function"){let n=process.availableMemory?.();n!=null&&(r.free_memory=n)}return r}function gP(e){let t={},r;try{r=le.uptime()}catch{}if(typeof r=="number"&&(t.boot_time=new Date(Date.now()-r*1e3).toISOString()),t.arch=le.arch(),(e===!0||e.memory)&&(t.memory_size=le.totalmem(),t.free_memory=le.freemem()),e===!0||e.cpu){let n=le.cpus(),o=n?.[0];o&&(t.processor_count=n.length,t.cpu_description=o.model,t.processor_frequency=o.speed)}return t}var bP={aix:"IBM AIX",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",win32:"Windows",ohos:"OpenHarmony",android:"Android"},yP=[{name:"fedora-release",distros:["Fedora"]},{name:"redhat-release",distros:["Red Hat Linux","Centos"]},{name:"redhat_version",distros:["Red Hat Linux"]},{name:"SuSE-release",distros:["SUSE Linux"]},{name:"lsb-release",distros:["Ubuntu Linux","Arch Linux"]},{name:"debian_version",distros:["Debian"]},{name:"debian_release",distros:["Debian"]},{name:"arch-release",distros:["Arch Linux"]},{name:"gentoo-release",distros:["Gentoo Linux"]},{name:"novell-release",distros:["SUSE Linux"]},{name:"alpine-release",distros:["Alpine Linux"]}],_P={alpine:e=>e,arch:e=>lt(/distrib_release=(.*)/,e),centos:e=>lt(/release ([^ ]+)/,e),debian:e=>e,fedora:e=>lt(/release (..)/,e),mint:e=>lt(/distrib_release=(.*)/,e),red:e=>lt(/release ([^ ]+)/,e),suse:e=>lt(/VERSION = (.*)\n/,e),ubuntu:e=>lt(/distrib_release=(.*)/,e)};function lt(e,t){let r=e.exec(t);return r?r[1]:void 0}async function wP(){let e={kernel_version:le.release(),name:"Mac OS X",version:`10.${Number(le.release().split(".")[0])-4}`};try{let t=await new Promise((r,n)=>{oP("/usr/bin/sw_vers",(o,i)=>{if(o){n(o);return}r(i)})});e.name=lt(/^ProductName:\s+(.*)$/m,t),e.version=lt(/^ProductVersion:\s+(.*)$/m,t),e.build=lt(/^BuildVersion:\s+(.*)$/m,t)}catch{}return e}function Wb(e){return e.split(" ")[0].toLowerCase()}async function xP(){let e={kernel_version:le.release(),name:"Linux"};try{let t=await lP("/etc"),r=yP.find(a=>t.includes(a.name));if(!r)return e;let n=aP("/etc",r.name),o=(await uP(n,{encoding:"utf-8"})).toLowerCase(),{distros:i}=r;e.name=i.find(a=>o.indexOf(Wb(a))>=0)||i[0];let s=Wb(e.name);e.version=_P[s]?.(o)}catch{}return e}function SP(){return process.env.VERCEL?{"cloud.provider":"vercel","cloud.region":process.env.VERCEL_REGION}:process.env.AWS_REGION?{"cloud.provider":"aws","cloud.region":process.env.AWS_REGION,"cloud.platform":process.env.AWS_EXECUTION_ENV}:process.env.GCP_PROJECT?{"cloud.provider":"gcp"}:process.env.ALIYUN_REGION_ID?{"cloud.provider":"alibaba_cloud","cloud.region":process.env.ALIYUN_REGION_ID}:process.env.WEBSITE_SITE_NAME&&process.env.REGION_NAME?{"cloud.provider":"azure","cloud.region":process.env.REGION_NAME}:process.env.IBM_CLOUD_REGION?{"cloud.provider":"ibm_cloud","cloud.region":process.env.IBM_CLOUD_REGION}:process.env.TENCENTCLOUD_REGION?{"cloud.provider":"tencent_cloud","cloud.region":process.env.TENCENTCLOUD_REGION,"cloud.account.id":process.env.TENCENTCLOUD_APPID,"cloud.availability_zone":process.env.TENCENTCLOUD_ZONE}:process.env.NETLIFY?{"cloud.provider":"netlify"}:process.env.FLY_REGION?{"cloud.provider":"fly.io","cloud.region":process.env.FLY_REGION}:process.env.DYNO?{"cloud.provider":"heroku"}:void 0}import{createReadStream as vP}from"node:fs";import{createInterface as EP}from"node:readline";var gp=new Oe(10),Jb=new Oe(20),CP=7,TP="ContextLines",AP=1e3,kP=1e4;function IP(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function RP(e){return!!(e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:"))}function PP(e){return e.lineno!==void 0&&e.lineno>kP||e.colno!==void 0&&e.colno>AP}function DP(e,t){let r=gp.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function NP(e,t){if(!e.length)return[];let r=0,n=e[0];if(typeof n!="number")return[];let o=Kb(n,t),i=[];for(;;){if(r===e.length-1){i.push(o);break}let s=e[r+1];if(typeof s!="number")break;s<=o[1]?o[1]=s+t:(i.push(o),o=Kb(s,t)),r++}return i}function OP(e,t,r){return new Promise((n,o)=>{let i=vP(e),s=EP({input:i});function a(){i.destroy(),n()}let u=0,l=0,d=t[l];if(d===void 0){a();return}let p=d[0],f=d[1];function m(h){Jb.set(e,1),Z&&b.error(`Failed to read file: ${e}. Error: ${h}`),s.close(),s.removeAllListeners(),a()}i.on("error",m),s.on("error",m),s.on("close",a),s.on("line",h=>{if(u++,!(u<p)&&(r[u]=kd(h,0),u>=f)){if(l===t.length-1){s.close(),s.removeAllListeners();return}l++;let _=t[l];if(_===void 0){s.close(),s.removeAllListeners();return}p=_[0],f=_[1]}})})}async function MP(e,t){let r={};if(t>0&&e.exception?.values){for(let i of e.exception.values)if(i.stacktrace?.frames?.length)for(let s=i.stacktrace.frames.length-1;s>=0;s--){let a=i.stacktrace.frames[s],u=a?.filename;if(!a||typeof u!="string"||typeof a.lineno!="number"||RP(u)||PP(a))continue;r[u]||(r[u]=[]),r[u].push(a.lineno)}}let n=Object.keys(r);if(n.length==0)return e;let o=[];for(let i of n){if(Jb.get(i))continue;let s=r[i];if(!s)continue;s.sort((l,d)=>l-d);let a=NP(s,t);if(a.every(l=>DP(i,l)))continue;let u=IP(gp,i,{});o.push(OP(i,a,u))}if(await Promise.all(o).catch(()=>{Z&&b.log("Failed to read one or more source files and resolve context lines")}),t>0&&e.exception?.values)for(let i of e.exception.values)i.stacktrace?.frames&&i.stacktrace.frames.length>0&&FP(i.stacktrace.frames,t,gp);return e}function FP(e,t,r){for(let n of e)if(n.filename&&n.context_line===void 0&&typeof n.lineno=="number"){let o=r.get(n.filename);if(o===void 0)continue;BP(n.lineno,n,t,o)}}function Gb(e){delete e.pre_context,delete e.context_line,delete e.post_context}function BP(e,t,r,n){if(t.lineno===void 0||n===void 0){Z&&b.error("Cannot resolve context for frame with no lineno or file contents");return}t.pre_context=[];for(let i=Yb(e,r);i<e;i++){let s=n[i];if(s===void 0){Gb(t),Z&&b.error(`Could not find line ${i} in file ${t.filename}`);return}t.pre_context.push(s)}if(n[e]===void 0){Gb(t),Z&&b.error(`Could not find line ${e} in file ${t.filename}`);return}t.context_line=n[e];let o=Zb(e,r);t.post_context=[];for(let i=e+1;i<=o;i++){let s=n[i];if(s===void 0)break;t.post_context.push(s)}}function Yb(e,t){return Math.max(1,e-t)}function Zb(e,t){return e+t}function Kb(e,t){return[Yb(e,t),Zb(e,t)]}var LP=((e={})=>{let t=e.frameContextLines!==void 0?e.frameContextLines:CP;return{name:TP,processEvent(r){return MP(r,t)}}}),Xb=LP;var Mu=Nd(process.versions.node),Qb=Mu.major,IY=Mu.minor;import{Worker as UP}from"node:worker_threads";var Fu;async function Bu(){if(Fu===void 0)try{Fu=!!(await import("node:inspector")).url()}catch{Fu=!1}return Fu}var Gi="__SENTRY_ERROR_LOCAL_VARIABLES__";function ty(e,t,r){let n=0,o=5,i=0;return setInterval(()=>{i===0?n>e&&(o*=2,r(o),o>86400&&(o=86400),i=o):(i-=1,i===0&&t()),n=0},1e3).unref(),()=>{n+=1}}function ey(e){return e!==void 0&&(e.length===0||e==="?"||e==="<anonymous>")}function Lu(e,t){return e===t||`Object.${e}`===t||e===`Object.${t}`||ey(e)&&ey(t)}var jP="[encoded data, 4236 characters]";function ry(...e){b.log("[LocalVariables]",...e)}var ny=((e={})=>{function t(i,s){let a=(i.stacktrace?.frames||[]).filter(u=>u.function!=="new Promise");for(let u=0;u<a.length;u++){let l=a.length-u-1,d=s[u],p=a[l];if(!p||!d)break;d.vars===void 0||p.in_app===!1&&e.includeOutOfAppFrames!==!0||!Lu(p.function,d.function)||(p.vars=d.vars)}}function r(i,s){if(s.originalException&&typeof s.originalException=="object"&&Gi in s.originalException&&Array.isArray(s.originalException[Gi])){for(let a of i.exception?.values||[])t(a,s.originalException[Gi]);s.originalException[Gi]=void 0}return i}async function n(){let i=await import("node:inspector");i.url()||i.open(0)}function o(i){let s=new UP(new URL(`data:application/javascript;base64,${jP}`),{workerData:i,execArgv:[],env:{...process.env,NODE_OPTIONS:void 0}});process.on("exit",()=>{s.terminate()}),s.once("error",a=>{ry("Worker error",a)}),s.once("exit",a=>{ry("Worker exit",a)}),s.unref()}return{name:"LocalVariablesAsync",async setup(i){if(!i.getOptions().includeLocalVariables)return;if(await Bu()){b.warn("Local variables capture has been disabled because the debugger was already enabled");return}let a={...e,debug:b.isEnabled()};n().then(()=>{try{o(a)}catch(u){b.error("Failed to start worker",u)}},u=>{b.error("Failed to start inspector",u)})},processEvent(i,s){return r(i,s)}}});function oy(e){if(e!==void 0)return e.slice(-10).reduce((t,r)=>`${t},${r.function},${r.lineno},${r.colno}`,"")}function qP(e,t){if(t!==void 0)return oy(e(t,1))}function iy(e){let t=[],r=!1;function n(s){t=[],!r&&(r=!0,e(s))}t.push(n);function o(s){t.push(s)}function i(s){let a=t.pop()||n;try{a(s)}catch{n(s)}}return{add:o,next:i}}var bp=class e{constructor(t){this._session=t}static async create(t){if(t)return t;let r=await import("node:inspector");return new e(new r.Session)}configureAndConnect(t,r){this._session.connect(),this._session.on("Debugger.paused",n=>{t(n,()=>{this._session.post("Debugger.resume")})}),this._session.post("Debugger.enable"),this._session.post("Debugger.setPauseOnExceptions",{state:r?"all":"uncaught"})}setPauseOnExceptions(t){this._session.post("Debugger.setPauseOnExceptions",{state:t?"all":"uncaught"})}getLocalVariables(t,r){this._getProperties(t,n=>{let{add:o,next:i}=iy(r);for(let s of n)if(s.value?.objectId&&s.value.className==="Array"){let a=s.value.objectId;o(u=>this._unrollArray(a,s.name,u,i))}else if(s.value?.objectId&&s.value.className==="Object"){let a=s.value.objectId;o(u=>this._unrollObject(a,s.name,u,i))}else s.value&&o(a=>this._unrollOther(s,a,i));i({})})}_getProperties(t,r){this._session.post("Runtime.getProperties",{objectId:t,ownProperties:!0},(n,o)=>{r(n?[]:o.result)})}_unrollArray(t,r,n,o){this._getProperties(t,i=>{n[r]=i.filter(s=>s.name!=="length"&&!isNaN(parseInt(s.name,10))).sort((s,a)=>parseInt(s.name,10)-parseInt(a.name,10)).map(s=>s.value?.value),o(n)})}_unrollObject(t,r,n,o){this._getProperties(t,i=>{n[r]=i.map(s=>[s.name,s.value?.value]).reduce((s,[a,u])=>(s[a]=u,s),{}),o(n)})}_unrollOther(t,r,n){t.value&&("value"in t.value?t.value.value===void 0||t.value.value===null?r[t.name]=`<${t.value.value}>`:r[t.name]=t.value.value:"description"in t.value&&t.value.type!=="function"?r[t.name]=`<${t.value.description}>`:t.value.type==="undefined"&&(r[t.name]="<undefined>")),n(r)}},$P="LocalVariables",zP=((e={},t)=>{let r=new Oe(20),n,o=!1;function i(l){let d=oy(l.stacktrace?.frames);if(d===void 0)return;let p=r.remove(d);if(p===void 0)return;let f=(l.stacktrace?.frames||[]).filter(m=>m.function!=="new Promise");for(let m=0;m<f.length;m++){let h=f.length-m-1,_=p[m],S=f[h];if(!S||!_)break;_.vars===void 0||S.in_app===!1&&e.includeOutOfAppFrames!==!0||!Lu(S.function,_.function)||(S.vars=_.vars)}}function s(l){for(let d of l.exception?.values||[])i(d);return l}let a;async function u(){let d=Y()?.getOptions();if(!d?.includeLocalVariables)return;if(Qb<18){b.log("The `LocalVariables` integration is only supported on Node >= v18.");return}if(await Bu()){b.warn("Local variables capture has been disabled because the debugger was already enabled");return}try{let f=await bp.create(t),m=(_,{params:{reason:S,data:D,callFrames:w}},x)=>{if(S!=="exception"&&S!=="promiseRejection"){x();return}n?.();let E=qP(_,D.description);if(E==null){x();return}let{add:I,next:T}=iy(q=>{r.set(E,q),x()});for(let q=0;q<Math.min(w.length,5);q++){let{scopeChain:X,functionName:ae,this:we}=w[q],he=X.find(L=>L.type==="local"),M=we.className==="global"||!we.className?ae:`${we.className}.${ae}`;if(he?.object.objectId===void 0)I(L=>{L[q]={function:M},T(L)});else{let L=he.object.objectId;I(z=>f.getLocalVariables(L,Q=>{z[q]={function:M,vars:Q},T(z)}))}}T([])},h=e.captureAllExceptions!==!1;if(f.configureAndConnect((_,S)=>m(d.stackParser,_,S),h),h){let _=e.maxExceptionsPerSecond||50;n=ty(_,()=>{b.log("Local variables rate-limit lifted."),f.setPauseOnExceptions(!0)},S=>{b.log(`Local variables rate-limit exceeded. Disabling capturing of caught exceptions for ${S} seconds.`),f.setPauseOnExceptions(!1)})}o=!0}catch(f){b.log("The `LocalVariables` integration failed to start.",f)}}return{name:$P,setupOnce(){a=u()},async processEvent(l){return await a,o?s(l):l},_getCachedFramesCount(){return r.size},_getFirstCachedFrame(){return r.values()[0]}}}),sy=zP;var ay=(e={})=>Mu.major<19?sy(e):ny(e);import{existsSync as WP,readFileSync as ly}from"node:fs";import{dirname as HP,join as cy}from"node:path";function Uu(){try{return typeof module<"u"&&typeof module.exports<"u"}catch{return!1}}var yp,VP="Modules",GP=typeof __SENTRY_SERVER_MODULES__>"u"?{}:__SENTRY_SERVER_MODULES__,KP=(()=>({name:VP,processEvent(e){return e.modules={...e.modules,...uy()},e},getModules:uy})),dy=KP;function JP(){try{return lu.cache?Object.keys(lu.cache):[]}catch{return[]}}function YP(){return{...GP,...QP(),...Uu()?ZP():{}}}function ZP(){let e=lu.main?.paths||[],t=JP(),r={},n=new Set;return t.forEach(o=>{let i=o,s=()=>{let a=i;if(i=HP(a),!i||a===i||n.has(a))return;if(e.indexOf(i)<0)return s();let u=cy(a,"package.json");if(n.add(a),!WP(u))return s();try{let l=JSON.parse(ly(u,"utf8"));r[l.name]=l.version}catch{}};s()}),r}function uy(){return yp||(yp=YP()),yp}function XP(){try{let e=cy(process.cwd(),"package.json");return JSON.parse(ly(e,"utf8"))}catch{return{}}}function QP(){let e=XP();return{...e.dependencies,...e.devDependencies}}import{isMainThread as t2}from"worker_threads";var e2=2e3;function Ki(e){fe(()=>{console.error(e)});let t=Y();if(t===void 0){Z&&b.warn("No NodeClient was defined, we are exiting the process now."),global.process.exit(1);return}let r=t.getOptions(),n=r?.shutdownTimeout&&r.shutdownTimeout>0?r.shutdownTimeout:e2;t.close(n).then(o=>{o||Z&&b.warn("We reached the timeout for emptying the request buffer, still exiting now!"),global.process.exit(1)},o=>{Z&&b.error(o)})}var r2="OnUncaughtException",py=(e={})=>{let t={exitEvenIfOtherHandlersAreRegistered:!1,...e};return{name:r2,setup(r){t2&&global.process.on("uncaughtException",n2(r,t))}}};function n2(e,t){let n=!1,o=!1,i=!1,s,a=e.getOptions();return Object.assign(u=>{let l=Ki;t.onFatalError?l=t.onFatalError:a.onFatalError&&(l=a.onFatalError);let p=global.process.listeners("uncaughtException").filter(m=>m.name!=="domainUncaughtExceptionClear"&&m.tag!=="sentry_tracingErrorCallback"&&m._errorHandler!==!0).length===0,f=t.exitEvenIfOtherHandlersAreRegistered||p;n?f&&(i?(Z&&b.warn("uncaught exception after calling fatal error shutdown callback - this is bad! forcing shutdown"),Ki(u)):o||(o=!0,setTimeout(()=>{i||(i=!0,l(s,u))},2e3))):(s=u,n=!0,Y()===e&&ue(u,{originalException:u,captureContext:{level:"fatal"},mechanism:{handled:!1,type:"auto.node.onuncaughtexception"}}),!i&&f&&(i=!0,l(u)))},{_errorHandler:!0})}var o2="OnUnhandledRejection",i2=[{name:"AI_NoOutputGeneratedError"},{name:"AbortError"}],s2=((e={})=>{let t={mode:e.mode??"warn",ignore:[...i2,...e.ignore??[]]};return{name:o2,setup(r){global.process.on("unhandledRejection",c2(r,t))}}}),fy=s2;function a2(e){if(typeof e!="object"||e===null)return{name:"",message:String(e??"")};let t=e,r=typeof t.name=="string"?t.name:"",n=typeof t.message=="string"?t.message:String(e);return{name:r,message:n}}function u2(e,t){let r=e.name===void 0||Tt(t.name,e.name,!0),n=e.message===void 0||Tt(t.message,e.message);return r&&n}function l2(e,t){let r=a2(t);return e.some(n=>u2(n,r))}function c2(e,t){return function(n,o){if(Y()!==e||l2(t.ignore??[],n))return;let i=t.mode==="strict"?"fatal":"error",s=n&&typeof n=="object"?n._sentry_active_span:void 0;(s?u=>$n(s,u):u=>u())(()=>{ue(n,{originalException:o,captureContext:{extra:{unhandledPromiseRejection:!0},level:i},mechanism:{handled:!1,type:"auto.node.onunhandledrejection"}})}),d2(n,t.mode)}}function d2(e,t){let r="This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:";t==="warn"?fe(()=>{console.warn(r),console.error(e&&typeof e=="object"&&"stack"in e?e.stack:e)}):t==="strict"&&(fe(()=>{console.warn(r)}),Ki(e))}var p2="ProcessSession",my=()=>({name:p2,setupOnce(){Ni(),process.on("beforeExit",()=>{ne().getSession()?.status!=="ok"&&Hn()})}});import*as hy from"node:http";var _p="Spotlight",f2=((e={})=>{let t={sidecarUrl:e.sidecarUrl||"http://localhost:8969/stream"};return{name:_p,setup(r){try{process.env.NODE_ENV&&process.env.NODE_ENV!=="development"&&b.warn("[Spotlight] It seems you're not in dev mode. Do you really want to have Spotlight enabled?")}catch{}m2(r,t)}}}),gy=f2;function m2(e,t){let r=h2(t.sidecarUrl);if(!r)return;let n=0;e.on("beforeEnvelope",o=>{if(n>3){b.warn("[Spotlight] Disabled Sentry -> Spotlight integration due to too many failed requests");return}let i=Ai(o);Nr(()=>{let s=hy.request({method:"POST",path:r.pathname,hostname:r.hostname,port:r.port,headers:{"Content-Type":"application/x-sentry-envelope"}},a=>{a.statusCode&&a.statusCode>=200&&a.statusCode<400&&(n=0),a.on("data",()=>{}),a.on("end",()=>{}),a.setEncoding("utf8")});s.on("error",()=>{n++,b.warn("[Spotlight] Failed to send envelope to Spotlight Sidecar")}),s.write(i),s.end()})})}function h2(e){try{return new URL(`${e}`)}catch{b.warn(`[Spotlight] Invalid sidecar URL: ${e}`);return}}import*as by from"node:util";var g2="NodeSystemError";function b2(e){return!(e instanceof Error)||!("errno"in e)||typeof e.errno!="number"?!1:by.getSystemErrorMap().has(e.errno)}var yy=(e={})=>({name:g2,processEvent:(t,r,n)=>{if(!b2(r.originalException))return t;let o=r.originalException,i={...o};!n.getOptions().sendDefaultPii&&e.includePaths!==!0&&(delete i.path,delete i.dest),t.contexts={...t.contexts,node_system_error:i};for(let s of t.exception?.values||[])s.value&&(o.path&&s.value.includes(o.path)&&(s.value=s.value.replace(`'${o.path}'`,"").trim()),o.dest&&s.value.includes(o.dest)&&(s.value=s.value.replace(`'${o.dest}'`,"").trim()));return t}});import{posix as y2,sep as _2}from"node:path";function _y(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}function wy(e=process.argv[1]?fp(process.argv[1]):process.cwd(),t=_2==="\\"){let r=t?_y(e):e;return n=>{if(!n)return;let o=t?_y(n):n,{dir:i,base:s,ext:a}=y2.parse(o);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,a.length*-1));let u=decodeURIComponent(s);i||(i=".");let l=i.lastIndexOf("/node_modules");if(l>-1)return`${i.slice(l+14).replace(/\//g,".")}:${u}`;if(i.startsWith(r)){let d=i.slice(r.length+1).replace(/\//g,".");return d?`${d}:${u}`:u}return u}}function xy(e){if(process.env.SENTRY_RELEASE)return process.env.SENTRY_RELEASE;if($.SENTRY_RELEASE?.id)return $.SENTRY_RELEASE.id;let t=process.env.GITHUB_SHA||process.env.CI_MERGE_REQUEST_SOURCE_BRANCH_SHA||process.env.CI_BUILD_REF||process.env.CI_COMMIT_SHA||process.env.BITBUCKET_COMMIT,r=process.env.APPVEYOR_PULL_REQUEST_HEAD_COMMIT||process.env.APPVEYOR_REPO_COMMIT||process.env.CODEBUILD_RESOLVED_SOURCE_VERSION||process.env.AWS_COMMIT_ID||process.env.BUILD_SOURCEVERSION||process.env.GIT_CLONE_COMMIT_HASH||process.env.BUDDY_EXECUTION_REVISION||process.env.BUILDKITE_COMMIT||process.env.CIRCLE_SHA1||process.env.CIRRUS_CHANGE_IN_REPO||process.env.CF_REVISION||process.env.CM_COMMIT||process.env.CF_PAGES_COMMIT_SHA||process.env.DRONE_COMMIT_SHA||process.env.FC_GIT_COMMIT_SHA||process.env.HEROKU_TEST_RUN_COMMIT_VERSION||process.env.HEROKU_BUILD_COMMIT||process.env.HEROKU_SLUG_COMMIT||process.env.RAILWAY_GIT_COMMIT_SHA||process.env.RENDER_GIT_COMMIT||process.env.SEMAPHORE_GIT_SHA||process.env.TRAVIS_PULL_REQUEST_SHA||process.env.VERCEL_GIT_COMMIT_SHA||process.env.VERCEL_GITHUB_COMMIT_SHA||process.env.VERCEL_GITLAB_COMMIT_SHA||process.env.VERCEL_BITBUCKET_COMMIT_SHA||process.env.ZEIT_GITHUB_COMMIT_SHA||process.env.ZEIT_GITLAB_COMMIT_SHA||process.env.ZEIT_BITBUCKET_COMMIT_SHA,n=process.env.CI_COMMIT_ID||process.env.SOURCE_COMMIT||process.env.SOURCE_VERSION||process.env.GIT_COMMIT||process.env.COMMIT_REF||process.env.BUILD_VCS_NUMBER||process.env.CI_COMMIT_SHA;return t||r||n||e}var Sy=du(mp(wy()));import*as x2 from"node:http";import*as S2 from"node:https";import{Readable as v2}from"node:stream";import{createGzip as E2}from"node:zlib";import*as Rt from"node:net";import*as xp from"node:tls";import*as wp from"node:http";var ct=Symbol("AgentBaseInternalState"),ju=class extends wp.Agent{constructor(t){super(t),this[ct]={}}isSecureEndpoint(t){if(t){if(typeof t.secureEndpoint=="boolean")return t.secureEndpoint;if(typeof t.protocol=="string")return t.protocol==="https:"}let{stack:r}=new Error;return typeof r!="string"?!1:r.split(`
`).some(n=>n.indexOf("(https.js:")!==-1||n.indexOf("node:https:")!==-1)}createSocket(t,r,n){let o={...r,secureEndpoint:this.isSecureEndpoint(r)};Promise.resolve().then(()=>this.connect(t,o)).then(i=>{if(i instanceof wp.Agent)return i.addRequest(t,o);this[ct].currentSocket=i,super.createSocket(t,r,n)},n)}createConnection(){let t=this[ct].currentSocket;if(this[ct].currentSocket=void 0,!t)throw new Error("No socket was returned in the `connect()` function");return t}get defaultPort(){return this[ct].defaultPort??(this.protocol==="https:"?443:80)}set defaultPort(t){this[ct]&&(this[ct].defaultPort=t)}get protocol(){return this[ct].protocol??(this.isSecureEndpoint()?"https:":"http:")}set protocol(t){this[ct]&&(this[ct].protocol=t)}};function qu(...e){b.log("[https-proxy-agent:parse-proxy-response]",...e)}function vy(e){return new Promise((t,r)=>{let n=0,o=[];function i(){let d=e.read();d?l(d):e.once("readable",i)}function s(){e.removeListener("end",a),e.removeListener("error",u),e.removeListener("readable",i)}function a(){s(),qu("onend"),r(new Error("Proxy connection ended before receiving CONNECT response"))}function u(d){s(),qu("onerror %o",d),r(d)}function l(d){o.push(d),n+=d.length;let p=Buffer.concat(o,n),f=p.indexOf(`\r
\r
`);if(f===-1){qu("have not received end of HTTP headers yet..."),i();return}let m=p.subarray(0,f).toString("ascii").split(`\r
`),h=m.shift();if(!h)return e.destroy(),r(new Error("No header received from proxy CONNECT response"));let _=h.split(" "),S=+(_[1]||0),D=_.slice(2).join(" "),w={};for(let x of m){if(!x)continue;let E=x.indexOf(":");if(E===-1)return e.destroy(),r(new Error(`Invalid header from proxy CONNECT response: "${x}"`));let I=x.slice(0,E).toLowerCase(),T=x.slice(E+1).trimStart(),q=w[I];typeof q=="string"?w[I]=[q,T]:Array.isArray(q)?q.push(T):w[I]=T}qu("got proxy server response: %o %o",h,w),s(),t({connect:{statusCode:S,statusText:D,headers:w},buffered:p})}e.on("error",u),e.on("end",a),i()})}function Ji(...e){b.log("[https-proxy-agent]",...e)}var Yi=class extends ju{static __initStatic(){this.protocols=["http","https"]}constructor(t,r){super(r),this.options={},this.proxy=typeof t=="string"?new URL(t):t,this.proxyHeaders=r?.headers??{},Ji("Creating new HttpsProxyAgent instance: %o",this.proxy.href);let n=(this.proxy.hostname||this.proxy.host).replace(/^\[|\]$/g,""),o=this.proxy.port?parseInt(this.proxy.port,10):this.proxy.protocol==="https:"?443:80;this.connectOpts={ALPNProtocols:["http/1.1"],...r?Ey(r,"headers"):null,host:n,port:o}}async connect(t,r){let{proxy:n}=this;if(!r.host)throw new TypeError('No "host" provided');let o;if(n.protocol==="https:"){Ji("Creating `tls.Socket`: %o",this.connectOpts);let f=this.connectOpts.servername||this.connectOpts.host;o=xp.connect({...this.connectOpts,servername:f&&Rt.isIP(f)?void 0:f})}else Ji("Creating `net.Socket`: %o",this.connectOpts),o=Rt.connect(this.connectOpts);let i=typeof this.proxyHeaders=="function"?this.proxyHeaders():{...this.proxyHeaders},s=Rt.isIPv6(r.host)?`[${r.host}]`:r.host,a=`CONNECT ${s}:${r.port} HTTP/1.1\r
`;if(n.username||n.password){let f=`${decodeURIComponent(n.username)}:${decodeURIComponent(n.password)}`;i["Proxy-Authorization"]=`Basic ${Buffer.from(f).toString("base64")}`}i.Host=`${s}:${r.port}`,i["Proxy-Connection"]||(i["Proxy-Connection"]=this.keepAlive?"Keep-Alive":"close");for(let f of Object.keys(i))a+=`${f}: ${i[f]}\r
`;let u=vy(o);o.write(`${a}\r
`);let{connect:l,buffered:d}=await u;if(t.emit("proxyConnect",l),this.emit("proxyConnect",l,t),l.statusCode===200){if(t.once("socket",w2),r.secureEndpoint){Ji("Upgrading socket connection to TLS");let f=r.servername||r.host;return xp.connect({...Ey(r,"host","path","port"),socket:o,servername:Rt.isIP(f)?void 0:f})}return o}o.destroy();let p=new Rt.Socket({writable:!1});return p.readable=!0,t.once("socket",f=>{Ji("Replaying proxy buffer for failed request"),f.push(d),f.push(null)}),p}};Yi.__initStatic();function w2(e){e.resume()}function Ey(e,...t){let r={},n;for(n in e)t.includes(n)||(r[n]=e[n]);return r}var C2=1024*32;function T2(e){return new v2({read(){this.push(e),this.push(null)}})}function Cy(e){let t;try{t=new URL(e.url)}catch{return fe(()=>{console.warn("[@sentry/node]: Invalid dsn or tunnel option, will not send any events. The tunnel option must be a full URL when used.")}),er(e,()=>Promise.resolve({}))}let r=t.protocol==="https:",n=A2(t,e.proxy||(r?process.env.https_proxy:void 0)||process.env.http_proxy),o=r?S2:x2,i=e.keepAlive===void 0?!1:e.keepAlive,s=n?new Yi(n):new o.Agent({keepAlive:i,maxSockets:30,timeout:2e3}),a=k2(e,e.httpModule??o,s);return er(e,a)}function A2(e,t){let{no_proxy:r}=process.env;if(!r?.split(",").some(o=>e.host.endsWith(o)||e.hostname.endsWith(o)))return t}function k2(e,t,r){let{hostname:n,pathname:o,port:i,protocol:s,search:a}=new URL(e.url);return function(l){return new Promise((d,p)=>{Nr(()=>{let f=T2(l.body),m={...e.headers};l.body.length>C2&&(m["content-encoding"]="gzip",f=f.pipe(E2()));let h=n.startsWith("["),_=t.request({method:"POST",agent:r,headers:m,hostname:h?n.slice(1,-1):n,path:`${o}${a}`,port:i,protocol:s,ca:e.caCerts},S=>{S.on("data",()=>{}),S.on("end",()=>{}),S.setEncoding("utf8");let D=S.headers["retry-after"]??null,w=S.headers["x-sentry-rate-limits"]??null;d({statusCode:S.statusCode,headers:{"retry-after":D,"x-sentry-rate-limits":Array.isArray(w)?w[0]||null:w}})});_.on("error",p),f.pipe(_)})})}}function Ty(e){if(e===!1)return!1;if(typeof e=="string")return e;let t=tr(process.env.SENTRY_SPOTLIGHT,{strict:!0}),r=t===null&&process.env.SENTRY_SPOTLIGHT?process.env.SENTRY_SPOTLIGHT:void 0;return e===!0?r??!0:t??r}import{AsyncLocalStorage as I2}from"node:async_hooks";function Ay(){let e=new I2;function t(){let a=e.getStore();return a||{scope:hi(),isolationScope:gi()}}function r(a){let u=t().scope.clone(),l=t().isolationScope;return e.run({scope:u,isolationScope:l},()=>a(u))}function n(a,u){let l=t().isolationScope.clone();return e.run({scope:a,isolationScope:l},()=>u(a))}function o(a){let u=t().scope.clone(),l=t().isolationScope.clone();return e.run({scope:u,isolationScope:l},()=>a(l))}function i(a,u){let l=t().scope.clone();return e.run({scope:l,isolationScope:a},()=>u(a))}function s(a){return r(u=>(u.setSDKProcessingMetadata({__SENTRY_SUPPRESS_TRACING__:!0}),a()))}Fd({suppressTracing:s,withScope:r,withSetScope:n,withIsolationScope:o,withSetIsolationScope:i,getCurrentScope:()=>t().scope,getIsolationScope:()=>t().isolationScope})}import{subscribe as $u}from"node:diagnostics_channel";function ky(e,t,r,n){let o=0,i=[];Z&&b.log(n,"Patching request.on");let s=new WeakMap,a=r==="small"?1e3:r==="medium"?1e4:1048576;try{e.on=new Proxy(e.on,{apply:(u,l,d)=>{let[p,f,...m]=d;if(p==="data"){Z&&b.log(n,`Handling request.on("data") with maximum body size of ${a}b`);let h=new Proxy(f,{apply:(_,S,D)=>{try{let w=D[0],x=Buffer.from(w);o<a?(i.push(x),o+=x.byteLength):Z&&b.log(n,`Dropping request body chunk because maximum body length of ${a}b is exceeded.`)}catch{Z&&b.error(n,"Encountered error while storing body chunk.")}return Reflect.apply(_,S,D)}});return s.set(f,h),Reflect.apply(u,l,[p,h,...m])}return Reflect.apply(u,l,d)}}),e.off=new Proxy(e.off,{apply:(u,l,d)=>{let[,p]=d,f=s.get(p);if(f){s.delete(p);let m=d.slice();return m[1]=f,Reflect.apply(u,l,m)}return Reflect.apply(u,l,d)}}),e.on("end",()=>{try{let u=Buffer.concat(i).toString("utf-8");if(u){let d=Buffer.byteLength(u,"utf-8")>a?`${Buffer.from(u).subarray(0,a-3).toString("utf-8")}...`:u;t.setSDKProcessingMetadata({normalizedRequest:{data:d}})}}catch(u){Z&&b.error(n,"Error building captured request body",u)}})}catch(u){Z&&b.error(n,"Error patching request to capture body",u)}}function Zi(e,t){if(!e)return t;let r=_i(e),n=_i(t);if(!n)return e;let o={},i={};for(let[u,l]of Object.entries(n))u.startsWith(Rr)?o[u]=l:i[u]=l;let s=Object.keys(o).length>0,a={};if(r)for(let[u,l]of Object.entries(r))s&&u.startsWith(Rr)||(a[u]=l);Object.assign(a,o);for(let[u,l]of Object.entries(i))a[u]||(a[u]=l);return wu(a)}var Yn="@sentry/instrumentation-http";function Iy(e,t){let r=R2(e),n=t?.statusCode,o=Vi(n);ke({category:"http",data:{status_code:n,...r},type:"http",level:o},{event:"response",request:e,response:t})}function Ry(e,t){let r=Sp(e),{tracePropagationTargets:n,propagateTraceparent:o}=Y()?.getOptions()||{},i=ji(r,n,t)?Mr({propagateTraceparent:o}):void 0;if(!i)return;let{"sentry-trace":s,baggage:a,traceparent:u}=i;if(!e.getHeader("sentry-trace")){if(s)try{e.setHeader("sentry-trace",s),Z&&b.log(Yn,"Added sentry-trace header to outgoing request")}catch(d){Z&&b.error(Yn,"Failed to add sentry-trace header to outgoing request:",nt(d)?d.message:"Unknown error")}if(u&&!e.getHeader("traceparent"))try{e.setHeader("traceparent",u),Z&&b.log(Yn,"Added traceparent header to outgoing request")}catch(d){Z&&b.error(Yn,"Failed to add traceparent header to outgoing request:",nt(d)?d.message:"Unknown error")}if(a){let d=e.getHeader("baggage"),p=Zi(d,a);if(p)try{e.setHeader("baggage",p),Z&&b.log(Yn,"Added baggage header to outgoing request")}catch(f){Z&&b.error(Yn,"Failed to add baggage header to outgoing request:",nt(f)?f.message:"Unknown error")}}}}function R2(e){try{let t=e.getHeader("host")||e.host,r=new URL(e.path,`${e.protocol}//${t}`),n=Bi(r.toString()),o={url:Li(n),"http.method":e.method||"GET"};return n.search&&(o["http.query"]=n.search),n.hash&&(o["http.fragment"]=n.hash),o}catch{return{}}}function Py(e){return{method:e.method,protocol:e.protocol,host:e.host,hostname:e.host,path:e.path,headers:e.getHeaders()}}function Sp(e){let t=e.getHeader("host")||e.host,r=e.protocol,n=e.path;return`${r}//${t}${n}`}var vp="Http",Dy=new WeakSet,P2=((e={})=>{let t={maxRequestBodySize:e.maxRequestBodySize??"medium",ignoreRequestBody:e.ignoreRequestBody,breadcrumbs:e.breadcrumbs??!0,tracePropagation:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},r=new Oe(100),n=new WeakMap;return{name:vp,setupOnce(){let o=(u=>{D2(u.server,t)}),i=(u=>{N2(u.request,t,r,n)}),s=(u=>{let l=u;Ny(l.request,l.response,t,n)}),a=(u=>{Ny(u.request,void 0,t,n)});$u("http.server.request.start",o),$u("http.client.request.created",i),$u("http.client.response.finish",s),$u("http.client.request.error",a)}}}),Oy=P2;function D2(e,{ignoreRequestBody:t,maxRequestBodySize:r}){let n=e.emit;if(Dy.has(n))return;let o=new Proxy(n,{apply(i,s,a){if(a[0]!=="request"||!ee().getClient())return i.apply(s,a);Z&&b.log(vp,"Handling incoming request");let l=ne().clone(),d=a[1],p=cp(d),f=d.ip||d.socket?.remoteAddress,m=d.url||"/";r!=="none"&&!t?.(m,d)&&ky(d,l,r,vp),l.setSDKProcessingMetadata({normalizedRequest:p,ipAddress:f});let h=(d.method||"GET").toUpperCase(),_=lp(m),S=`${h} ${_}`;return l.setTransactionName(S),Mn(l,()=>{let D=p.headers?.["sentry-trace"],w=p.headers?.baggage;return ki({sentryTrace:Array.isArray(D)?D[0]:D,baggage:Array.isArray(w)?w[0]:w},()=>(ee().getPropagationContext().propagationSpanId=at(),i.apply(s,a)))})}});Dy.add(o),e.emit=o}function N2(e,t,r,n){let o=My(e,t);n.set(e,o),!o&&t.tracePropagation&&Ry(e,r)}function Ny(e,t,r,n){!r.breadcrumbs||(n.get(e)??My(e,r))||Iy(e,t)}function My(e,t){if(ee().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:r}=t;if(!r)return!1;let n=Sp(e);return r(n,Py(e))}import{subscribe as Ly}from"node:diagnostics_channel";var Ep="sentry-trace",zu="baggage",O2="traceparent";function Fy(e,t){let r=Wu(e.origin,e.path),{tracePropagationTargets:n,propagateTraceparent:o}=Y()?.getOptions()||{},i=ji(r,n,t)?Mr({propagateTraceparent:o}):void 0;if(!i)return;let{"sentry-trace":s,baggage:a,traceparent:u}=i,l=Array.isArray(e.headers)?e.headers:M2(e.headers);if(Cp(l,Ep),Cp(l,zu),o&&Cp(l,O2),!(Tp(l,Ep)!==-1)){s&&l.push(Ep,s),u&&Tp(l,"traceparent")===-1&&l.push("traceparent",u);let p=Tp(l,zu);if(a&&p===-1)l.push(zu,a);else if(a){let f=l[p+1],m=Zi(f,a);m&&(l[p+1]=m)}}Array.isArray(e.headers)||(e.headers=F2(l))}function M2(e){let t=e.split(`\r
`),r=[];for(let n of t)try{let o=n.indexOf(":");if(o===-1)continue;let i=n.slice(0,o).trim(),s=n.slice(o+1).trim();i&&r.push(i,s)}catch{b.warn(`Failed to convert string request header to array header: ${n}`)}return r}function F2(e){let t=[];for(let r=0;r<e.length;r+=2){let n=e[r],o=e[r+1];!n||o==null||t.push(`${n}: ${o}`)}return t.length?t.join(`\r
`).concat(`\r
`):""}function Cp(e,t){let r=-1;for(let n=0;n<e.length;n+=2){if(e[n]!==t)continue;if(r===-1){r=n;continue}let o=e[r+1];if(t===zu&&o){let i=Zi(e[n+1],o);i&&(e[r+1]=i)}e.splice(n,2),n-=2}}function Tp(e,t){return e.findIndex((r,n)=>n%2===0&&r===t)}function By(e,t){let r=B2(e),n=t.statusCode,o=Vi(n);ke({category:"http",data:{status_code:n,...r},type:"http",level:o},{event:"response",request:e,response:t})}function B2(e){try{let t=Wu(e.origin,e.path),r=Bi(t),n={url:Li(r),"http.method":e.method||"GET"};return r.search&&(n["http.query"]=r.search),r.hash&&(n["http.fragment"]=r.hash),n}catch{return{}}}function Wu(e,t="/"){try{return new URL(t,e).toString()}catch{let r=`${e}`;return r.endsWith("/")&&t.startsWith("/")?`${r}${t.slice(1)}`:!r.endsWith("/")&&!t.startsWith("/")?`${r}/${t}`:`${r}${t}`}}var L2="NodeFetch",U2=((e={})=>{let t={breadcrumbs:e.breadcrumbs??!0,tracePropagation:e.tracePropagation??!0,ignoreOutgoingRequests:e.ignoreOutgoingRequests},r=new Oe(100),n=new WeakMap;return{name:L2,setupOnce(){let o=(s=>{j2(s.request,t,r,n)}),i=(s=>{let a=s;q2(a.request,a.response,t,n)});Ly("undici:request:create",o),Ly("undici:request:headers",i)}}}),Uy=U2;function j2(e,t,r,n){let o=$2(e,t);n.set(e,o),!o&&t.tracePropagation&&Fy(e,r)}function q2(e,t,r,n){!r.breadcrumbs||n.get(e)||By(e,t)}function $2(e,t){if(ee().getScopeData().sdkProcessingMetadata.__SENTRY_SUPPRESS_TRACING__)return!0;let{ignoreOutgoingRequests:r}=t;if(!r)return!1;let n=Wu(e.origin,e.path);return r(n)}function jy(){return[Jn(),qi(),$i(),zi(),yy(),Wi(),Oy(),Uy(),py(),fy(),Xb(),ay(),Vb(),zb(),my(),dy()]}function Ap(e={}){return z2(e,jy)}function z2(e={},t){let r=W2(e,t);r.debug===!0&&(Z?b.enable():fe(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),Ay(),ee().update(r.initialScope),r.spotlight&&!r.integrations.some(({name:i})=>i===_p)&&r.integrations.push(gy({sidecarUrl:typeof r.spotlight=="string"?r.spotlight:void 0})),Ui(r,"node-light",["node-core"]);let o=new Ou(r);return ee().setClient(o),o.init(),b.log(`SDK initialized from ${Uu()?"CommonJS":"ESM"} (light mode)`),o.startClientReportTracking(),G2(),process.env.VERCEL&&process.on("SIGTERM",async()=>{await o.flush(200)}),o}function W2(e,t){let r=H2(e.release),n=Ty(e.spotlight),o=V2(e.tracesSampleRate),i={...e,dsn:e.dsn??process.env.SENTRY_DSN,environment:e.environment??process.env.SENTRY_ENVIRONMENT,sendClientReports:e.sendClientReports??!0,transport:e.transport??Cy,stackParser:_d(e.stackParser||Sy),release:r,tracesSampleRate:o,spotlight:n,debug:tr(e.debug??process.env.SENTRY_DEBUG)},s=e.integrations,a=e.defaultIntegrations??t(i),u=np({defaultIntegrations:a,integrations:s});return i.traceLifecycle==="stream"&&!u.some(l=>l.name==="SpanStreaming")&&u.push(Hi()),{...i,integrations:u}}function H2(e){if(e!==void 0)return e;let t=xy();if(t!==void 0)return t}function V2(e){if(e!==void 0)return e;let t=process.env.SENTRY_TRACES_SAMPLE_RATE;if(!t)return;let r=parseFloat(t);return isFinite(r)?r:void 0}function G2(){if(tr(process.env.SENTRY_USE_ENVIRONMENT)!==!1){let e=process.env.SENTRY_TRACE,t=process.env.SENTRY_BAGGAGE,r=xi(e,t);ee().setPropagationContext(r)}}var wD=new Set(["about:blank"]);function qy(e){if(wD.has(e))return!0;let t;try{t=new URL(e)}catch{return!1}return t.protocol==="http:"||t.protocol==="https:"}var xD=["chrome","iab","cdp"];function $y(e){return xD.some(t=>t===e)}var Xi="browser/config.toml",zy="full_cdp_access_enabled",Wy="browser_use_full_cdp_access";var Hy="BROWSER_USE_AVAILABLE_BACKENDS",Vy="BROWSER_USE_CODEX_APP_BUILD_FLAVOR",Gy="BROWSER_USE_CODEX_APP_VERSION",Ky="BROWSER_USE_DISABLE_AMBIENT_NETWORK",Jy="BROWSER_USE_DISABLE_BROWSER_CAPABILITIES",Yy="BROWSER_USE_DISABLE_TAB_CAPABILITIES",Zy="BROWSER_USE_SECURITY_MODE";var Qi=class{constructor(t){this.transport=t;this.transport.setMessageCallback(r=>{this.handleIncomingMessage(r)}),this.transport.addCloseListener?.(r=>{this.rejectPendingRequests(r?.message??"transport closed before response")})}transport;nextId=1;pendingRequests=new Map;requestHandlers=new Map;eventHandlers=new Map;registerRequestHandlerObject(t){[...Object.getOwnPropertyNames(t),...Object.getOwnPropertyNames(Object.getPrototypeOf(t))].filter(n=>n!=="constructor"&&typeof t[n]=="function").forEach(n=>{let o=t[n];o&&this.registerRequestHandler(n,o.bind(t))})}registerRequestHandler(t,r){this.requestHandlers.set(t,r)}addEventListener(t,r){let n=t.toString(),o=this.eventHandlers.get(n)??[];o.push(r),this.eventHandlers.set(n,o)}removeEventListener(t,r){let n=t.toString(),o=this.eventHandlers.get(n)??[];this.eventHandlers.set(n,o.filter(i=>i!==r))}sendNotification(t,r){this.transport.sendMessage({jsonrpc:"2.0",method:t,params:r})}sendRequest(t,r){let n=this.nextId++;return new Promise((o,i)=>{this.pendingRequests.set(n,{resolve:o,reject:i});try{this.transport.sendMessage({jsonrpc:"2.0",method:t.toString(),params:r,id:n})}catch(s){this.pendingRequests.delete(n),i(s)}})}async handleIncomingMessage(t){if("method"in t)return this.handleIncomingRequest(t);if(t.id===void 0)return;let r=this.pendingRequests.get(t.id);if(r){if(this.pendingRequests.delete(t.id),"error"in t){r.reject(t.error?.message||"Something went wrong");return}r.resolve(t.result)}}rejectPendingRequests(t){for(let r of this.pendingRequests.values())r.reject(t);this.pendingRequests.clear()}async handleIncomingRequest(t){if(t.id===void 0){(this.eventHandlers.get(t.method??"")??[]).forEach(o=>o(t.params));return}let r=this.requestHandlers.get(t.method??"");if(!r){this.transport.sendMessage({jsonrpc:"2.0",id:t.id,error:{code:-1,message:`No handler registered for method: ${t.method}`}});return}try{let n=await r(t.params);this.transport.sendMessage({jsonrpc:"2.0",id:t.id,result:n})}catch(n){this.transport.sendMessage({jsonrpc:"2.0",id:t.id,error:{code:1,message:n instanceof Error?n.message:String(n)}})}}};function Zn(e,t){return new Error(`${e} does not support command "${t.type}".`)}var Xy=e=>e==="win32"?"\\\\.\\pipe\\codex-browser-use":"/tmp/codex-browser-use";var SD="https://chatgpt.com/backend-api",vD="agent";var Hu="codex_browser_use";function J(e){return`Browser Use rejected this action due to browser security policy. Reason: ${e} The agent must not attempt to achieve the same outcome via workaround, indirect execution, raw CDP or browser commands, alternate browser surfaces, or policy circumvention. Proceed only with a materially safer alternative that does not require this blocked browser action; if none exists, stop and request user input.`}function e_(e){return ED(e,vD)}function ED(e,t){if(!Qy(e))return!1;let r=e.feature_status;return Qy(r)?r[t]===!0:!1}function t_(e,{conversationId:t,turnId:r,urlRequestSource:n=Hu}={}){let o;try{o=new URL(e)}catch{throw new Error("Browser Use cannot visit the requested page because the URL is invalid. Use a complete http:// or https:// URL.")}if(o.protocol!=="http:"&&o.protocol!=="https:")return null;let i=o.hostname.trim().toLowerCase();if(i.length===0)throw new Error("Browser Use cannot visit the requested page because the URL does not include a website host.");return AD(i)?null:{cacheKey:i.startsWith("www.")?i.slice(4):i,displayUrl:TD(o),endpoint:CD(o,{conversationId:t,turnId:r,urlRequestSource:n})}}function CD(e,{conversationId:t,turnId:r,urlRequestSource:n}){let o=new URL(e.origin);o.pathname=e.pathname,o.search=e.search;let i=new URL(`${SD}/aura/site_status`);return i.searchParams.set("site_url",o.toString()),i.searchParams.set("url_request_source",n),t!=null&&i.searchParams.set("conversation_id",t),r!=null&&i.searchParams.set("turn_id",r),i.toString()}function TD(e){let t=new URL(e.origin);t.pathname=e.pathname;let r=t.toString();return t.pathname==="/"?r.slice(0,-1):r}function AD(e){return e==="localhost"||e.endsWith(".localhost")||e==="127.0.0.1"||e==="[::1]"||e==="::1"}function Qy(e){return typeof e=="object"&&e!=null}var r_="codex-agent-overlay-root";function i_(){let e=Vu(Hy);return e==null?null:c_(e).filter($y)}function s_(e){return{browser:o_(e?.browser??[],n_("browser")),tab:o_(e?.tab??[],n_("tab"))}}function a_(){return Gu(Zy)}function u_(){return Gu(Gy)}function l_(e){return Vu(e)==="1"}function n_(e){let t=Vu(e==="browser"?Jy:Yy);return new Set(c_(t))}function Vu(e){let t=globalThis.nodeRepl?.env[e];return typeof t=="string"?t:void 0}function Gu(e){let t=Vu(e)?.trim();return t||void 0}function o_(e,t){return t.size===0?e:e.filter(r=>!t.has(r.id))}function c_(e){return(e??"").split(",").map(t=>t.trim()).filter(Boolean)}function Ku(){return l_(Ky)}function Me(){let e=globalThis.nodeRepl;return e?.config==null?void 0:e}var Xn=async(e,t)=>{let r=Me()?.fetch;if(r==null)throw new Error("browser-client privileged fetch is unavailable");return r(e,t)};function Qn(){return"production"}var d_=!1,p_=()=>{d_||(Ap({dsn:"https://946e373d0393408ec734c0156b0aeec6@o33249.ingest.us.sentry.io/4511236780326912",sendDefaultPii:!1,environment:Qn(),release:"26.608.12217",transport:e=>er(e,t=>{let r={body:t.body,method:"POST",referrerPolicy:"origin",headers:e.headers,keepalive:e.keepAlive};return Xn(e.url,r).then(n=>({statusCode:n.status,headers:{"x-sentry-rate-limits":n.headers.get("X-Sentry-Rate-Limits"),"retry-after":n.headers.get("Retry-After")}}))})}),d_=!0)},f_=(e,t)=>{Pi({email:e.email,id:e.id}),Ri("backend",t)};var rx=ng(ex(),1);var Nt="1.0.0";import{platform as eF}from"os";var tF="client-sYWqzCYMRkUg4DqqiZcR5DGTNl2iD7zNJY0HoeDLzxR",nx=u_(),rF=nx??Nt,nF=Qn(),Lf=new rx.StatsigClient(tF,{appVersion:"26.608.12217"},{environment:{tier:nF},networkConfig:{api:"https://ab.chatgpt.com/v1",sdkExceptionUrl:"https://ab.chatgpt.com/v1/sdk_exception",networkOverrideFunc:Xn},loggingEnabled:"always"}),tx=!1,ox=async()=>{if(!tx)try{await Lf.initializeAsync(),tx=!0}catch(e){console.warn(e),ue(e)}},Fl=(e,t,r)=>Lf.logEvent(e,t,{...r,codexAppVersion:nx??"unknown"}),ix=(e,t)=>{Lf.updateUserSync({userID:e.id,email:e.email,appVersion:"26.608.12217",custom:{backend:t,platform:eF(),codexAppVersion:rF}})};var Uf=null,sx=async()=>{if(Uf)return Uf;let t=await(await Xn("https://chatgpt.com/backend-api/me")).json();if(!("object"in t)||t.object!=="user")throw new Error("User unavailable");return Uf=t,t};var oF="codex_",ax=()=>{Ku()||(p_(),ox(),jf())},jf=async e=>{if(!Ku())try{let t=await sx();f_(t,e),ix(t,e)}catch(t){ue(t)}};function iF(e){return`${oF}${e}`}var Ot=(e,t,r)=>{if(!Ku())return Fl(iF(e),t,r)};var oe={};C(oe,{AtlasCommand:()=>g,BrowserUserClaimTab:()=>Ts,BrowserUserHistory:()=>ks,BrowserUserOpenTabs:()=>As,CloseTab:()=>bs,CreateTab:()=>gs,CuaClick:()=>Bs,CuaDoubleClick:()=>Us,CuaDownloadMedia:()=>Ls,CuaDrag:()=>qs,CuaKeypress:()=>js,CuaMove:()=>$s,CuaScroll:()=>zs,CuaType:()=>Ws,DomCuaClick:()=>Hs,DomCuaDoubleClick:()=>Gs,DomCuaDownloadMedia:()=>Vs,DomCuaGetVisibleDom:()=>Ks,DomCuaKeypress:()=>Js,DomCuaScroll:()=>Ys,DomCuaType:()=>Zs,FinalizeTabs:()=>ys,ListTabs:()=>sn,NameSession:()=>_s,NavigateTab:()=>Es,NavigateTabBack:()=>an,NavigateTabForward:()=>un,NavigateTabReload:()=>Cs,PlaywrightDomSnapshot:()=>ga,PlaywrightDownloadPath:()=>wa,PlaywrightElementInfo:()=>ba,PlaywrightElementScreenshot:()=>ya,PlaywrightEvaluate:()=>Fs,PlaywrightFileChooserSetFiles:()=>Sa,PlaywrightLocatorAllTextContents:()=>ua,PlaywrightLocatorClick:()=>Xs,PlaywrightLocatorCount:()=>na,PlaywrightLocatorDblclick:()=>Qs,PlaywrightLocatorDownloadMedia:()=>ea,PlaywrightLocatorFill:()=>Oo,PlaywrightLocatorGetAttribute:()=>da,PlaywrightLocatorInnerText:()=>ca,PlaywrightLocatorIsEnabled:()=>aa,PlaywrightLocatorIsVisible:()=>sa,PlaywrightLocatorPress:()=>ta,PlaywrightLocatorReadAll:()=>pa,PlaywrightLocatorSelectOption:()=>oa,PlaywrightLocatorSetChecked:()=>ia,PlaywrightLocatorTextContent:()=>la,PlaywrightLocatorWaitFor:()=>ra,PlaywrightWaitForDownload:()=>_a,PlaywrightWaitForFileChooser:()=>xa,PlaywrightWaitForLoadState:()=>ma,PlaywrightWaitForTimeout:()=>ha,PlaywrightWaitForURL:()=>fa,RuntimeConfig:()=>Wf,SelectedTab:()=>ws,TabClipboardRead:()=>Ns,TabClipboardReadText:()=>Ps,TabClipboardWrite:()=>Os,TabClipboardWriteText:()=>Ds,TabContentExport:()=>Is,TabContentExportGSuite:()=>Rs,TabDevLogs:()=>No,TabScreenshot:()=>Ms,TabsContent:()=>xs,WebMcpInvokeTool:()=>vs,WebMcpListTools:()=>Ss});var g=class{constructor(t,r,n){this.type=t,this.schema=r,this.payload=n}parse(){return this.schema.parse(this.payload)}toJSON(){return{type:this.type,...this.payload}}};var gs={};C(gs,{PayloadSchema:()=>_x,ResultSchema:()=>g3,commandType:()=>wx,create:()=>b3});var c={};C(c,{BRAND:()=>PF,DIRTY:()=>zr,EMPTY_PATH:()=>lF,INVALID:()=>B,NEVER:()=>h3,OK:()=>_e,ParseStatus:()=>me,Schema:()=>V,ZodAny:()=>pr,ZodArray:()=>Lt,ZodBigInt:()=>Hr,ZodBoolean:()=>Vr,ZodBranded:()=>ms,ZodCatch:()=>nn,ZodDate:()=>Gr,ZodDefault:()=>rn,ZodDiscriminatedUnion:()=>Ul,ZodEffects:()=>Ue,ZodEnum:()=>en,ZodError:()=>Te,ZodFirstPartyTypeKind:()=>j,ZodFunction:()=>ql,ZodIntersection:()=>Zr,ZodIssueCode:()=>v,ZodLazy:()=>Xr,ZodLiteral:()=>Qr,ZodMap:()=>Ro,ZodNaN:()=>Do,ZodNativeEnum:()=>tn,ZodNever:()=>et,ZodNull:()=>Jr,ZodNullable:()=>gt,ZodNumber:()=>Wr,ZodObject:()=>Ae,ZodOptional:()=>Be,ZodParsedType:()=>P,ZodPipeline:()=>hs,ZodPromise:()=>fr,ZodReadonly:()=>on,ZodRecord:()=>jl,ZodSchema:()=>V,ZodSet:()=>Po,ZodString:()=>dr,ZodSymbol:()=>ko,ZodTransformer:()=>Ue,ZodTuple:()=>ht,ZodType:()=>V,ZodUndefined:()=>Kr,ZodUnion:()=>Yr,ZodUnknown:()=>Bt,ZodVoid:()=>Io,addIssueToContext:()=>k,any:()=>jF,array:()=>WF,bigint:()=>MF,boolean:()=>yx,coerce:()=>m3,custom:()=>hx,date:()=>FF,datetimeRegex:()=>fx,defaultErrorMap:()=>Mt,discriminatedUnion:()=>KF,effect:()=>s3,enum:()=>n3,function:()=>e3,getErrorMap:()=>Co,getParsedType:()=>mt,instanceof:()=>NF,intersection:()=>JF,isAborted:()=>Bl,isAsync:()=>To,isDirty:()=>Ll,isValid:()=>cr,late:()=>DF,lazy:()=>t3,literal:()=>r3,makeIssue:()=>fs,map:()=>XF,nan:()=>OF,nativeEnum:()=>o3,never:()=>$F,null:()=>UF,nullable:()=>u3,number:()=>bx,object:()=>HF,objectUtil:()=>qf,oboolean:()=>f3,onumber:()=>p3,optional:()=>a3,ostring:()=>d3,pipeline:()=>c3,preprocess:()=>l3,promise:()=>i3,quotelessJson:()=>sF,record:()=>ZF,set:()=>QF,setErrorMap:()=>uF,strictObject:()=>VF,string:()=>gx,symbol:()=>BF,transformer:()=>s3,tuple:()=>YF,undefined:()=>LF,union:()=>GF,unknown:()=>qF,util:()=>G,void:()=>zF});var G;(function(e){e.assertEqual=o=>{};function t(o){}e.assertIs=t;function r(o){throw new Error}e.assertNever=r,e.arrayToEnum=o=>{let i={};for(let s of o)i[s]=s;return i},e.getValidEnumValues=o=>{let i=e.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),s={};for(let a of i)s[a]=o[a];return e.objectValues(s)},e.objectValues=o=>e.objectKeys(o).map(function(i){return o[i]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let s in o)Object.prototype.hasOwnProperty.call(o,s)&&i.push(s);return i},e.find=(o,i)=>{for(let s of o)if(i(s))return s},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}e.joinValues=n,e.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(G||(G={}));var qf;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(qf||(qf={}));var P=G.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),mt=e=>{switch(typeof e){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(e)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?P.promise:typeof Map<"u"&&e instanceof Map?P.map:typeof Set<"u"&&e instanceof Set?P.set:typeof Date<"u"&&e instanceof Date?P.date:P.object;default:return P.unknown}};var v=G.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),sF=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Te=class e extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){let r=t||function(i){return i.message},n={_errors:[]},o=i=>{for(let s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(o);else if(s.code==="invalid_return_type")o(s.returnTypeError);else if(s.code==="invalid_arguments")o(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let a=n,u=0;for(;u<s.path.length;){let l=s.path[u];u===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(r(s))):a[l]=a[l]||{_errors:[]},a=a[l],u++}}};return o(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,G.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let i=o.path[0];r[i]=r[i]||[],r[i].push(t(o))}else n.push(t(o));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Te.create=e=>new Te(e);var aF=(e,t)=>{let r;switch(e.code){case v.invalid_type:e.received===P.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,G.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${G.joinValues(e.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${G.joinValues(e.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${G.joinValues(e.options)}, received '${e.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:G.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case v.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case v.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=t.defaultError,G.assertNever(e)}return{message:r}},Mt=aF;var ux=Mt;function uF(e){ux=e}function Co(){return ux}var fs=e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,i=[...r,...o.path||[]],s={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let a="",u=n.filter(l=>!!l).slice().reverse();for(let l of u)a=l(s,{data:t,defaultError:a}).message;return{...o,path:i,message:a}},lF=[];function k(e,t){let r=Co(),n=fs({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Mt?void 0:Mt].filter(o=>!!o)});e.common.issues.push(n)}var me=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let o of r){if(o.status==="aborted")return B;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r){let i=await o.key,s=await o.value;n.push({key:i,value:s})}return e.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:i,value:s}=o;if(i.status==="aborted"||s.status==="aborted")return B;i.status==="dirty"&&t.dirty(),s.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||o.alwaysSet)&&(n[i.value]=s.value)}return{status:t.value,value:n}}},B=Object.freeze({status:"aborted"}),zr=e=>({status:"dirty",value:e}),_e=e=>({status:"valid",value:e}),Bl=e=>e.status==="aborted",Ll=e=>e.status==="dirty",cr=e=>e.status==="valid",To=e=>typeof Promise<"u"&&e instanceof Promise;var O;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(O||(O={}));var Le=class{constructor(t,r,n,o){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},lx=(e,t)=>{if(cr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new Te(e.common.issues);return this._error=r,this._error}}};function W(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:o}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:o}:{errorMap:(s,a)=>{let{message:u}=e;return s.code==="invalid_enum_value"?{message:u??a.defaultError}:typeof a.data>"u"?{message:u??n??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:u??r??a.defaultError}},description:o}}var V=class{get description(){return this._def.description}_getType(t){return mt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:mt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new me,ctx:{common:t.parent.common,data:t.data,parsedType:mt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(To(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mt(t)},o=this._parseSync({data:t,path:n.path,parent:n});return lx(n,o)}"~validate"(t){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mt(t)};if(!this["~standard"].async)try{let n=this._parseSync({data:t,path:[],parent:r});return cr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>cr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:mt(t)},o=this._parse({data:t,path:n.path,parent:n}),i=await(To(o)?o:Promise.resolve(o));return lx(n,i)}refine(t,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,i)=>{let s=t(o),a=()=>i.addIssue({code:v.custom,...n(o)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(t,r){return this._refinement((n,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):r),!1))}_refinement(t){return new Ue({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Be.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Lt.create(this)}promise(){return fr.create(this,this._def)}or(t){return Yr.create([this,t],this._def)}and(t){return Zr.create(this,t,this._def)}transform(t){return new Ue({...W(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new rn({...W(this._def),innerType:this,defaultValue:r,typeName:j.ZodDefault})}brand(){return new ms({typeName:j.ZodBranded,type:this,...W(this._def)})}catch(t){let r=typeof t=="function"?t:()=>t;return new nn({...W(this._def),innerType:this,catchValue:r,typeName:j.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return hs.create(this,t)}readonly(){return on.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},cF=/^c[^\s-]{8,}$/i,dF=/^[0-9a-z]+$/,pF=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,mF=/^[a-z0-9_-]{21}$/i,hF=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,bF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",$f,_F=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,wF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,xF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,SF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,vF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,EF=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dx="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",CF=new RegExp(`^${dx}$`);function px(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function TF(e){return new RegExp(`^${px(e)}$`)}function fx(e){let t=`${dx}T${px(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function AF(e,t){return!!((t==="v4"||!t)&&_F.test(e)||(t==="v6"||!t)&&xF.test(e))}function kF(e,t){if(!hF.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return!(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||t&&o.alg!==t)}catch{return!1}}function IF(e,t){return!!((t==="v4"||!t)&&wF.test(e)||(t==="v6"||!t)&&SF.test(e))}var dr=class e extends V{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==P.string){let i=this._getOrReturnCtx(t);return k(i,{code:v.invalid_type,expected:P.string,received:i.parsedType}),B}let n=new me,o;for(let i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(o=this._getOrReturnCtx(t,o),k(o,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")t.data.length>i.value&&(o=this._getOrReturnCtx(t,o),k(o,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let s=t.data.length>i.value,a=t.data.length<i.value;(s||a)&&(o=this._getOrReturnCtx(t,o),s?k(o,{code:v.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&k(o,{code:v.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")bF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"email",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")$f||($f=new RegExp(yF,"u")),$f.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"emoji",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")fF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"uuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")mF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"nanoid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")cF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"cuid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")dF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"cuid2",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")pF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"ulid",code:v.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),k(o,{validation:"url",code:v.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"regex",code:v.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(o=this._getOrReturnCtx(t,o),k(o,{code:v.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(o=this._getOrReturnCtx(t,o),k(o,{code:v.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(o=this._getOrReturnCtx(t,o),k(o,{code:v.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?fx(i).test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{code:v.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?CF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{code:v.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?TF(i).test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{code:v.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?gF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"duration",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?AF(t.data,i.version)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"ip",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?kF(t.data,i.alg)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"jwt",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?IF(t.data,i.version)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"cidr",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?vF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"base64",code:v.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?EF.test(t.data)||(o=this._getOrReturnCtx(t,o),k(o,{validation:"base64url",code:v.invalid_string,message:i.message}),n.dirty()):G.assertNever(i);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(o=>t.test(o),{validation:r,code:v.invalid_string,...O.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...O.errToObj(t)})}url(t){return this._addCheck({kind:"url",...O.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...O.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...O.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...O.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...O.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...O.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...O.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...O.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...O.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...O.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...O.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...O.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...O.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...O.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...O.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...O.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...O.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...O.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...O.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...O.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...O.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...O.errToObj(r)})}nonempty(t){return this.min(1,O.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};dr.create=e=>new dr({checks:[],typeName:j.ZodString,coerce:e?.coerce??!1,...W(e)});function RF(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}var Wr=class e extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==P.number){let i=this._getOrReturnCtx(t);return k(i,{code:v.invalid_type,expected:P.number,received:i.parsedType}),B}let n,o=new me;for(let i of this._def.checks)i.kind==="int"?G.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),k(n,{code:v.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),k(n,{code:v.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),k(n,{code:v.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?RF(t.data,i.value)!==0&&(n=this._getOrReturnCtx(t,n),k(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),k(n,{code:v.not_finite,message:i.message}),o.dirty()):G.assertNever(i);return{status:o.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:O.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:O.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&G.isInteger(t.value))}get isFinite(){let t=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}};Wr.create=e=>new Wr({checks:[],typeName:j.ZodNumber,coerce:e?.coerce||!1,...W(e)});var Hr=class e extends V{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==P.bigint)return this._getInvalidInput(t);let n,o=new me;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),k(n,{code:v.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),k(n,{code:v.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),k(n,{code:v.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):G.assertNever(i);return{status:o.value,value:t.data}}_getInvalidInput(t){let r=this._getOrReturnCtx(t);return k(r,{code:v.invalid_type,expected:P.bigint,received:r.parsedType}),B}gte(t,r){return this.setLimit("min",t,!0,O.toString(r))}gt(t,r){return this.setLimit("min",t,!1,O.toString(r))}lte(t,r){return this.setLimit("max",t,!0,O.toString(r))}lt(t,r){return this.setLimit("max",t,!1,O.toString(r))}setLimit(t,r,n,o){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:O.toString(o)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:O.toString(r)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};Hr.create=e=>new Hr({checks:[],typeName:j.ZodBigInt,coerce:e?.coerce??!1,...W(e)});var Vr=class extends V{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==P.boolean){let n=this._getOrReturnCtx(t);return k(n,{code:v.invalid_type,expected:P.boolean,received:n.parsedType}),B}return _e(t.data)}};Vr.create=e=>new Vr({typeName:j.ZodBoolean,coerce:e?.coerce||!1,...W(e)});var Gr=class e extends V{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==P.date){let i=this._getOrReturnCtx(t);return k(i,{code:v.invalid_type,expected:P.date,received:i.parsedType}),B}if(Number.isNaN(t.data.getTime())){let i=this._getOrReturnCtx(t);return k(i,{code:v.invalid_date}),B}let n=new me,o;for(let i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(o=this._getOrReturnCtx(t,o),k(o,{code:v.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(o=this._getOrReturnCtx(t,o),k(o,{code:v.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):G.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:O.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:O.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};Gr.create=e=>new Gr({checks:[],coerce:e?.coerce||!1,typeName:j.ZodDate,...W(e)});var ko=class extends V{_parse(t){if(this._getType(t)!==P.symbol){let n=this._getOrReturnCtx(t);return k(n,{code:v.invalid_type,expected:P.symbol,received:n.parsedType}),B}return _e(t.data)}};ko.create=e=>new ko({typeName:j.ZodSymbol,...W(e)});var Kr=class extends V{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return k(n,{code:v.invalid_type,expected:P.undefined,received:n.parsedType}),B}return _e(t.data)}};Kr.create=e=>new Kr({typeName:j.ZodUndefined,...W(e)});var Jr=class extends V{_parse(t){if(this._getType(t)!==P.null){let n=this._getOrReturnCtx(t);return k(n,{code:v.invalid_type,expected:P.null,received:n.parsedType}),B}return _e(t.data)}};Jr.create=e=>new Jr({typeName:j.ZodNull,...W(e)});var pr=class extends V{constructor(){super(...arguments),this._any=!0}_parse(t){return _e(t.data)}};pr.create=e=>new pr({typeName:j.ZodAny,...W(e)});var Bt=class extends V{constructor(){super(...arguments),this._unknown=!0}_parse(t){return _e(t.data)}};Bt.create=e=>new Bt({typeName:j.ZodUnknown,...W(e)});var et=class extends V{_parse(t){let r=this._getOrReturnCtx(t);return k(r,{code:v.invalid_type,expected:P.never,received:r.parsedType}),B}};et.create=e=>new et({typeName:j.ZodNever,...W(e)});var Io=class extends V{_parse(t){if(this._getType(t)!==P.undefined){let n=this._getOrReturnCtx(t);return k(n,{code:v.invalid_type,expected:P.void,received:n.parsedType}),B}return _e(t.data)}};Io.create=e=>new Io({typeName:j.ZodVoid,...W(e)});var Lt=class e extends V{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),o=this._def;if(r.parsedType!==P.array)return k(r,{code:v.invalid_type,expected:P.array,received:r.parsedType}),B;if(o.exactLength!==null){let s=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(s||a)&&(k(r,{code:s?v.too_big:v.too_small,minimum:a?o.exactLength.value:void 0,maximum:s?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(k(r,{code:v.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(k(r,{code:v.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,a)=>o.type._parseAsync(new Le(r,s,r.path,a)))).then(s=>me.mergeArray(n,s));let i=[...r.data].map((s,a)=>o.type._parseSync(new Le(r,s,r.path,a)));return me.mergeArray(n,i)}get element(){return this._def.type}min(t,r){return new e({...this._def,minLength:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxLength:{value:t,message:O.toString(r)}})}length(t,r){return new e({...this._def,exactLength:{value:t,message:O.toString(r)}})}nonempty(t){return this.min(1,t)}};Lt.create=(e,t)=>new Lt({type:e,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...W(t)});function Ao(e){if(e instanceof Ae){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=Be.create(Ao(n))}return new Ae({...e._def,shape:()=>t})}else return e instanceof Lt?new Lt({...e._def,type:Ao(e.element)}):e instanceof Be?Be.create(Ao(e.unwrap())):e instanceof gt?gt.create(Ao(e.unwrap())):e instanceof ht?ht.create(e.items.map(t=>Ao(t))):e}var Ae=class e extends V{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=G.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==P.object){let l=this._getOrReturnCtx(t);return k(l,{code:v.invalid_type,expected:P.object,received:l.parsedType}),B}let{status:n,ctx:o}=this._processInputParams(t),{shape:i,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof et&&this._def.unknownKeys==="strip"))for(let l in o.data)s.includes(l)||a.push(l);let u=[];for(let l of s){let d=i[l],p=o.data[l];u.push({key:{status:"valid",value:l},value:d._parse(new Le(o,p,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof et){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of a)u.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")a.length>0&&(k(o,{code:v.unrecognized_keys,keys:a}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of a){let p=o.data[d];u.push({key:{status:"valid",value:d},value:l._parse(new Le(o,p,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of u){let p=await d.key,f=await d.value;l.push({key:p,value:f,alwaysSet:d.alwaysSet})}return l}).then(l=>me.mergeObjectSync(n,l)):me.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(t){return O.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:O.errToObj(t).message??o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:j.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let r={};for(let n of G.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}omit(t){let r={};for(let n of G.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new e({...this._def,shape:()=>r})}deepPartial(){return Ao(this)}partial(t){let r={};for(let n of G.objectKeys(this.shape)){let o=this.shape[n];t&&!t[n]?r[n]=o:r[n]=o.optional()}return new e({...this._def,shape:()=>r})}required(t){let r={};for(let n of G.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof Be;)i=i._def.innerType;r[n]=i}return new e({...this._def,shape:()=>r})}keyof(){return mx(G.objectKeys(this.shape))}};Ae.create=(e,t)=>new Ae({shape:()=>e,unknownKeys:"strip",catchall:et.create(),typeName:j.ZodObject,...W(t)});Ae.strictCreate=(e,t)=>new Ae({shape:()=>e,unknownKeys:"strict",catchall:et.create(),typeName:j.ZodObject,...W(t)});Ae.lazycreate=(e,t)=>new Ae({shape:e,unknownKeys:"strip",catchall:et.create(),typeName:j.ZodObject,...W(t)});var Yr=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function o(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let s=i.map(a=>new Te(a.ctx.common.issues));return k(r,{code:v.invalid_union,unionErrors:s}),B}if(r.common.async)return Promise.all(n.map(async i=>{let s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(o);{let i,s=[];for(let u of n){let l={...r,common:{...r.common,issues:[]},parent:null},d=u._parseSync({data:r.data,path:r.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;let a=s.map(u=>new Te(u));return k(r,{code:v.invalid_union,unionErrors:a}),B}}get options(){return this._def.options}};Yr.create=(e,t)=>new Yr({options:e,typeName:j.ZodUnion,...W(t)});var Ft=e=>e instanceof Xr?Ft(e.schema):e instanceof Ue?Ft(e.innerType()):e instanceof Qr?[e.value]:e instanceof en?e.options:e instanceof tn?G.objectValues(e.enum):e instanceof rn?Ft(e._def.innerType):e instanceof Kr?[void 0]:e instanceof Jr?[null]:e instanceof Be?[void 0,...Ft(e.unwrap())]:e instanceof gt?[null,...Ft(e.unwrap())]:e instanceof ms||e instanceof on?Ft(e.unwrap()):e instanceof nn?Ft(e._def.innerType):[],Ul=class e extends V{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.object)return k(r,{code:v.invalid_type,expected:P.object,received:r.parsedType}),B;let n=this.discriminator,o=r.data[n],i=this.optionsMap.get(o);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(k(r,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let o=new Map;for(let i of r){let s=Ft(i.shape[t]);if(!s.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let a of s){if(o.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);o.set(a,i)}}return new e({typeName:j.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...W(n)})}};function zf(e,t){let r=mt(e),n=mt(t);if(e===t)return{valid:!0,data:e};if(r===P.object&&n===P.object){let o=G.objectKeys(t),i=G.objectKeys(e).filter(a=>o.indexOf(a)!==-1),s={...e,...t};for(let a of i){let u=zf(e[a],t[a]);if(!u.valid)return{valid:!1};s[a]=u.data}return{valid:!0,data:s}}else if(r===P.array&&n===P.array){if(e.length!==t.length)return{valid:!1};let o=[];for(let i=0;i<e.length;i++){let s=e[i],a=t[i],u=zf(s,a);if(!u.valid)return{valid:!1};o.push(u.data)}return{valid:!0,data:o}}else return r===P.date&&n===P.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var Zr=class extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=(i,s)=>{if(Bl(i)||Bl(s))return B;let a=zf(i.value,s.value);return a.valid?((Ll(i)||Ll(s))&&r.dirty(),{status:r.value,value:a.data}):(k(n,{code:v.invalid_intersection_types}),B)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>o(i,s)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Zr.create=(e,t,r)=>new Zr({left:e,right:t,typeName:j.ZodIntersection,...W(r)});var ht=class e extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.array)return k(n,{code:v.invalid_type,expected:P.array,received:n.parsedType}),B;if(n.data.length<this._def.items.length)return k(n,{code:v.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&n.data.length>this._def.items.length&&(k(n,{code:v.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let i=[...n.data].map((s,a)=>{let u=this._def.items[a]||this._def.rest;return u?u._parse(new Le(n,s,n.path,a)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>me.mergeArray(r,s)):me.mergeArray(r,i)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ht.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ht({items:e,typeName:j.ZodTuple,rest:null,...W(t)})};var jl=class e extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.object)return k(n,{code:v.invalid_type,expected:P.object,received:n.parsedType}),B;let o=[],i=this._def.keyType,s=this._def.valueType;for(let a in n.data)o.push({key:i._parse(new Le(n,a,n.path,a)),value:s._parse(new Le(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?me.mergeObjectAsync(r,o):me.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof V?new e({keyType:t,valueType:r,typeName:j.ZodRecord,...W(n)}):new e({keyType:dr.create(),valueType:t,typeName:j.ZodRecord,...W(r)})}},Ro=class extends V{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.map)return k(n,{code:v.invalid_type,expected:P.map,received:n.parsedType}),B;let o=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([a,u],l)=>({key:o._parse(new Le(n,a,n.path,[l,"key"])),value:i._parse(new Le(n,u,n.path,[l,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let u of s){let l=await u.key,d=await u.value;if(l.status==="aborted"||d.status==="aborted")return B;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(l.value,d.value)}return{status:r.value,value:a}})}else{let a=new Map;for(let u of s){let l=u.key,d=u.value;if(l.status==="aborted"||d.status==="aborted")return B;(l.status==="dirty"||d.status==="dirty")&&r.dirty(),a.set(l.value,d.value)}return{status:r.value,value:a}}}};Ro.create=(e,t,r)=>new Ro({valueType:t,keyType:e,typeName:j.ZodMap,...W(r)});var Po=class e extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==P.set)return k(n,{code:v.invalid_type,expected:P.set,received:n.parsedType}),B;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(k(n,{code:v.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(k(n,{code:v.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),r.dirty());let i=this._def.valueType;function s(u){let l=new Set;for(let d of u){if(d.status==="aborted")return B;d.status==="dirty"&&r.dirty(),l.add(d.value)}return{status:r.value,value:l}}let a=[...n.data.values()].map((u,l)=>i._parse(new Le(n,u,n.path,l)));return n.common.async?Promise.all(a).then(u=>s(u)):s(a)}min(t,r){return new e({...this._def,minSize:{value:t,message:O.toString(r)}})}max(t,r){return new e({...this._def,maxSize:{value:t,message:O.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};Po.create=(e,t)=>new Po({valueType:e,minSize:null,maxSize:null,typeName:j.ZodSet,...W(t)});var ql=class e extends V{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.function)return k(r,{code:v.invalid_type,expected:P.function,received:r.parsedType}),B;function n(a,u){return fs({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Co(),Mt].filter(l=>!!l),issueData:{code:v.invalid_arguments,argumentsError:u}})}function o(a,u){return fs({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Co(),Mt].filter(l=>!!l),issueData:{code:v.invalid_return_type,returnTypeError:u}})}let i={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof fr){let a=this;return _e(async function(...u){let l=new Te([]),d=await a._def.args.parseAsync(u,i).catch(m=>{throw l.addIssue(n(u,m)),l}),p=await Reflect.apply(s,this,d);return await a._def.returns._def.type.parseAsync(p,i).catch(m=>{throw l.addIssue(o(p,m)),l})})}else{let a=this;return _e(function(...u){let l=a._def.args.safeParse(u,i);if(!l.success)throw new Te([n(u,l.error)]);let d=Reflect.apply(s,this,l.data),p=a._def.returns.safeParse(d,i);if(!p.success)throw new Te([o(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ht.create(t).rest(Bt.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new e({args:t||ht.create([]).rest(Bt.create()),returns:r||Bt.create(),typeName:j.ZodFunction,...W(n)})}},Xr=class extends V{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Xr.create=(e,t)=>new Xr({getter:e,typeName:j.ZodLazy,...W(t)});var Qr=class extends V{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return k(r,{received:r.data,code:v.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:t.data}}get value(){return this._def.value}};Qr.create=(e,t)=>new Qr({value:e,typeName:j.ZodLiteral,...W(t)});function mx(e,t){return new en({values:e,typeName:j.ZodEnum,...W(t)})}var en=class e extends V{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return k(r,{expected:G.joinValues(n),received:r.parsedType,code:v.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){let r=this._getOrReturnCtx(t),n=this._def.values;return k(r,{received:r.data,code:v.invalid_enum_value,options:n}),B}return _e(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return e.create(t,{...this._def,...r})}exclude(t,r=this._def){return e.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}};en.create=mx;var tn=class extends V{_parse(t){let r=G.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==P.string&&n.parsedType!==P.number){let o=G.objectValues(r);return k(n,{expected:G.joinValues(o),received:n.parsedType,code:v.invalid_type}),B}if(this._cache||(this._cache=new Set(G.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){let o=G.objectValues(r);return k(n,{received:n.data,code:v.invalid_enum_value,options:o}),B}return _e(t.data)}get enum(){return this._def.values}};tn.create=(e,t)=>new tn({values:e,typeName:j.ZodNativeEnum,...W(t)});var fr=class extends V{unwrap(){return this._def.type}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==P.promise&&r.common.async===!1)return k(r,{code:v.invalid_type,expected:P.promise,received:r.parsedType}),B;let n=r.parsedType===P.promise?r.data:Promise.resolve(r.data);return _e(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};fr.create=(e,t)=>new fr({type:e,typeName:j.ZodPromise,...W(t)});var Ue=class extends V{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=this._def.effect||null,i={addIssue:s=>{k(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let s=o.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async a=>{if(r.value==="aborted")return B;let u=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return u.status==="aborted"?B:u.status==="dirty"?zr(u.value):r.value==="dirty"?zr(u.value):u});{if(r.value==="aborted")return B;let a=this._def.schema._parseSync({data:s,path:n.path,parent:n});return a.status==="aborted"?B:a.status==="dirty"?zr(a.value):r.value==="dirty"?zr(a.value):a}}if(o.type==="refinement"){let s=a=>{let u=o.refinement(a,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?B:(a.status==="dirty"&&r.dirty(),s(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?B:(a.status==="dirty"&&r.dirty(),s(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!cr(s))return B;let a=o.transform(s.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>cr(s)?Promise.resolve(o.transform(s.value,i)).then(a=>({status:r.value,value:a})):B);G.assertNever(o)}};Ue.create=(e,t,r)=>new Ue({schema:e,typeName:j.ZodEffects,effect:t,...W(r)});Ue.createWithPreprocess=(e,t,r)=>new Ue({schema:t,effect:{type:"preprocess",transform:e},typeName:j.ZodEffects,...W(r)});var Be=class extends V{_parse(t){return this._getType(t)===P.undefined?_e(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};Be.create=(e,t)=>new Be({innerType:e,typeName:j.ZodOptional,...W(t)});var gt=class extends V{_parse(t){return this._getType(t)===P.null?_e(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};gt.create=(e,t)=>new gt({innerType:e,typeName:j.ZodNullable,...W(t)});var rn=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};rn.create=(e,t)=>new rn({innerType:e,typeName:j.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...W(t)});var nn=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return To(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Te(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};nn.create=(e,t)=>new nn({innerType:e,typeName:j.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...W(t)});var Do=class extends V{_parse(t){if(this._getType(t)!==P.nan){let n=this._getOrReturnCtx(t);return k(n,{code:v.invalid_type,expected:P.nan,received:n.parsedType}),B}return{status:"valid",value:t.data}}};Do.create=e=>new Do({typeName:j.ZodNaN,...W(e)});var PF=Symbol("zod_brand"),ms=class extends V{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},hs=class e extends V{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?B:i.status==="dirty"?(r.dirty(),zr(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?B:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new e({in:t,out:r,typeName:j.ZodPipeline})}},on=class extends V{_parse(t){let r=this._def.innerType._parse(t),n=o=>(cr(o)&&(o.value=Object.freeze(o.value)),o);return To(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};on.create=(e,t)=>new on({innerType:e,typeName:j.ZodReadonly,...W(t)});function cx(e,t){let r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function hx(e,t={},r){return e?pr.create().superRefine((n,o)=>{let i=e(n);if(i instanceof Promise)return i.then(s=>{if(!s){let a=cx(t,n),u=a.fatal??r??!0;o.addIssue({code:"custom",...a,fatal:u})}});if(!i){let s=cx(t,n),a=s.fatal??r??!0;o.addIssue({code:"custom",...s,fatal:a})}}):pr.create()}var DF={object:Ae.lazycreate},j;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(j||(j={}));var NF=(e,t={message:`Input not instance of ${e.name}`})=>hx(r=>r instanceof e,t),gx=dr.create,bx=Wr.create,OF=Do.create,MF=Hr.create,yx=Vr.create,FF=Gr.create,BF=ko.create,LF=Kr.create,UF=Jr.create,jF=pr.create,qF=Bt.create,$F=et.create,zF=Io.create,WF=Lt.create,HF=Ae.create,VF=Ae.strictCreate,GF=Yr.create,KF=Ul.create,JF=Zr.create,YF=ht.create,ZF=jl.create,XF=Ro.create,QF=Po.create,e3=ql.create,t3=Xr.create,r3=Qr.create,n3=en.create,o3=tn.create,i3=fr.create,s3=Ue.create,a3=Be.create,u3=gt.create,l3=Ue.createWithPreprocess,c3=hs.create,d3=()=>gx().optional(),p3=()=>bx().optional(),f3=()=>yx().optional(),m3={string:(e=>dr.create({...e,coerce:!0})),number:(e=>Wr.create({...e,coerce:!0})),boolean:(e=>Vr.create({...e,coerce:!0})),bigint:(e=>Hr.create({...e,coerce:!0})),date:(e=>Gr.create({...e,coerce:!0}))};var h3=B;var _x=c.object({browser_id:c.string()}),g3=c.object({id:c.string()}),wx="create_tab";function b3(e){return new g(wx,_x,e)}var bs={};C(bs,{PayloadSchema:()=>xx,ResultSchema:()=>y3,commandType:()=>Sx,create:()=>_3});var xx=c.object({browser_id:c.string(),tab_id:c.string()}),y3=c.object({}),Sx="close_tab";function _3(e){return new g(Sx,xx,e)}var ys={};C(ys,{FinalizeTabStatusSchema:()=>vx,PayloadSchema:()=>Ex,ResultSchema:()=>w3,commandType:()=>Cx,create:()=>x3});var vx=c.enum(["handoff","deliverable"]),Ex=c.object({browser_id:c.string(),keep:c.array(c.object({tab_id:c.string(),status:vx})).optional()}),w3=c.object({}),Cx="finalize_tabs";function x3(e){return new g(Cx,Ex,e)}var Wf={};C(Wf,{PayloadSchema:()=>Tx,ResultSchema:()=>S3,commandType:()=>Ax,create:()=>v3});var Tx=c.object({browser_id:c.string()}),S3=c.object({display_truncate_max_chars:c.number().int().positive().optional()}),Ax="runtime_config";function v3(e){return new g(Ax,Tx,e)}var _s={};C(_s,{PayloadSchema:()=>kx,ResultSchema:()=>E3,commandType:()=>Ix,create:()=>C3});var kx=c.object({browser_id:c.string(),name:c.string()}),E3=c.object({}),Ix="name_session";function C3(e){return new g(Ix,kx,e)}var ws={};C(ws,{PayloadSchema:()=>Rx,ResultSchema:()=>T3,commandType:()=>Px,create:()=>A3});var Rx=c.object({browser_id:c.string()}),T3=c.object({id:c.string().optional()}),Px="selected_tab";function A3(e){return new g(Px,Rx,e)}var sn={};C(sn,{PayloadSchema:()=>Dx,ResultSchema:()=>k3,commandType:()=>Nx,create:()=>I3});var Dx=c.object({browser_id:c.string()}),k3=c.object({tabs:c.array(c.object({id:c.string(),url:c.string().optional(),title:c.string().optional()}))}),Nx="list_tabs";function I3(e){return new g(Nx,Dx,e)}var xs={};C(xs,{ContentTypeSchema:()=>Ox,PayloadSchema:()=>Mx,ResultSchema:()=>R3,commandType:()=>Fx,create:()=>P3});var Ox=c.enum(["html","text","domSnapshot"]),Mx=c.object({browser_id:c.string(),urls:c.array(c.string()),content_type:Ox,timeout_ms:c.number().int().positive().optional()}),R3=c.object({results:c.array(c.object({url:c.string(),title:c.string().nullable(),content:c.string().nullable()}))}),Fx="tabs_content";function P3(e){return new g(Fx,Mx,e)}var Ss={};C(Ss,{PayloadSchema:()=>Bx,ResultSchema:()=>O3,commandType:()=>Lx,create:()=>M3});var D3=c.object({readOnlyHint:c.boolean().optional(),untrustedContentHint:c.boolean().optional()}),N3=c.object({name:c.string(),title:c.string().optional(),description:c.string().optional(),input_schema:c.unknown(),annotations:D3.optional(),origin:c.string().optional(),pageUrl:c.string().optional()}),Bx=c.object({browser_id:c.string(),tab_id:c.string()}),O3=c.object({tools:c.array(N3)}),Lx="webmcp_list_tools";function M3(e){return new g(Lx,Bx,e)}var vs={};C(vs,{PayloadSchema:()=>Ux,ResultSchema:()=>F3,commandType:()=>jx,create:()=>B3});var Ux=c.object({browser_id:c.string(),tab_id:c.string(),tool_name:c.string(),input:c.unknown(),timeout_ms:c.number().int().positive().optional()}),F3=c.object({result:c.unknown()}),jx="webmcp_invoke_tool";function B3(e){return new g(jx,Ux,e)}var Es={};C(Es,{PayloadSchema:()=>qx,ResultSchema:()=>L3,commandType:()=>$x,create:()=>U3});var qx=c.object({browser_id:c.string(),tab_id:c.string(),url:c.string()}),L3=c.object({}),$x="navigate_tab_url";function U3(e){return new g($x,qx,e)}var an={};C(an,{PayloadSchema:()=>zx,ResultSchema:()=>j3,commandType:()=>Wx,create:()=>q3});var zx=c.object({browser_id:c.string(),tab_id:c.string()}),j3=c.object({}),Wx="navigate_tab_back";function q3(e){return new g(Wx,zx,e)}var un={};C(un,{PayloadSchema:()=>Hx,ResultSchema:()=>$3,commandType:()=>Vx,create:()=>z3});var Hx=c.object({browser_id:c.string(),tab_id:c.string()}),$3=c.object({}),Vx="navigate_tab_forward";function z3(e){return new g(Vx,Hx,e)}var Cs={};C(Cs,{PayloadSchema:()=>Gx,ResultSchema:()=>W3,commandType:()=>Kx,create:()=>H3});var Gx=c.object({browser_id:c.string(),tab_id:c.string()}),W3=c.object({}),Kx="navigate_tab_reload";function H3(e){return new g(Kx,Gx,e)}var Ts={};C(Ts,{PayloadSchema:()=>Jx,ResultSchema:()=>V3,commandType:()=>Yx,create:()=>G3});var Jx=c.object({browser_id:c.string(),tab_id:c.string()}),V3=c.object({id:c.string(),title:c.string().optional(),url:c.string().optional()}),Yx="browser_user_claim_tab";function G3(e){return new g(Yx,Jx,e)}var As={};C(As,{PayloadSchema:()=>Zx,ResultSchema:()=>K3,commandType:()=>Xx,create:()=>J3});var Zx=c.object({browser_id:c.string()}),K3=c.object({tabs:c.array(c.object({id:c.string(),title:c.string().optional(),url:c.string().optional(),lastOpened:c.string().optional(),tabGroup:c.string().optional()}))}),Xx="browser_user_open_tabs";function J3(e){return new g(Xx,Zx,e)}var ks={};C(ks,{PayloadSchema:()=>Qx,ResultSchema:()=>Y3,commandType:()=>eS,create:()=>Z3});var Qx=c.object({browser_id:c.string(),query:c.string().optional(),limit:c.number().int().positive().optional(),from:c.string().optional(),to:c.string().optional()}),Y3=c.object({items:c.array(c.object({url:c.string(),title:c.string().optional(),dateVisited:c.string()}))}),eS="browser_user_history";function Z3(e){return new g(eS,Qx,e)}var No={};C(No,{LogLevelSchema:()=>Hf,PayloadSchema:()=>tS,ResultSchema:()=>X3,commandType:()=>rS,create:()=>Q3});var Hf=c.enum(["debug","info","log","warn","error"]),tS=c.object({browser_id:c.string(),tab_id:c.string(),filter:c.string().optional(),levels:c.array(Hf).optional(),limit:c.number().int().positive().optional()}),X3=c.object({logs:c.array(c.object({level:Hf,message:c.string(),timestamp:c.string(),url:c.string().optional()}))}),rS="tab_dev_logs";function Q3(e){return new g(rS,tS,e)}var Is={};C(Is,{PayloadSchema:()=>nS,ResultSchema:()=>eB,commandType:()=>oS,create:()=>tB});var nS=c.object({browser_id:c.string(),tab_id:c.string()}),eB=c.object({path:c.string()}),oS="tab_content_export";function tB(e){return new g(oS,nS,e)}var Rs={};C(Rs,{GSuiteExportTypeSchema:()=>iS,PayloadSchema:()=>sS,ResultSchema:()=>rB,commandType:()=>aS,create:()=>nB});var iS=c.enum(["pdf","md","xlsx","csv","docx","pptx"]),sS=c.object({browser_id:c.string(),tab_id:c.string(),format:iS}),rB=c.object({path:c.string()}),aS="tab_content_export_gsuite";function nB(e){return new g(aS,sS,e)}var Ps={};C(Ps,{PayloadSchema:()=>uS,ResultSchema:()=>oB,commandType:()=>lS,create:()=>iB});var uS=c.object({browser_id:c.string(),tab_id:c.string()}),oB=c.object({text:c.string()}),lS="tab_clipboard_read_text";function iB(e){return new g(lS,uS,e)}var Ds={};C(Ds,{PayloadSchema:()=>cS,ResultSchema:()=>sB,commandType:()=>dS,create:()=>aB});var cS=c.object({browser_id:c.string(),tab_id:c.string(),text:c.string()}),sB=c.object({}),dS="tab_clipboard_write_text";function aB(e){return new g(dS,cS,e)}var Ns={};C(Ns,{PayloadSchema:()=>pS,ResultSchema:()=>cB,commandType:()=>fS,create:()=>dB});var uB=c.object({mime_type:c.string(),text:c.string().optional(),base64:c.string().optional()}).superRefine((e,t)=>{let r=e.text!==void 0,n=e.base64!==void 0;r===n&&t.addIssue({code:c.ZodIssueCode.custom,message:"Clipboard entries must set exactly one of text or base64"})}),lB=c.object({entries:c.array(uB),presentation_style:c.enum(["unspecified","inline","attachment"]).optional()}),pS=c.object({browser_id:c.string(),tab_id:c.string()}),cB=c.object({items:c.array(lB)}),fS="tab_clipboard_read";function dB(e){return new g(fS,pS,e)}var Os={};C(Os,{PayloadSchema:()=>mS,ResultSchema:()=>mB,commandType:()=>hS,create:()=>hB});var pB=c.object({mime_type:c.string(),text:c.string().optional(),base64:c.string().optional()}).superRefine((e,t)=>{let r=e.text!==void 0,n=e.base64!==void 0;r===n&&t.addIssue({code:c.ZodIssueCode.custom,message:"Clipboard entries must set exactly one of text or base64"})}),fB=c.object({entries:c.array(pB),presentation_style:c.enum(["unspecified","inline","attachment"]).optional()}),mS=c.object({browser_id:c.string(),tab_id:c.string(),items:c.array(fB)}),mB=c.object({}),hS="tab_clipboard_write";function hB(e){return new g(hS,mS,e)}var Ms={};C(Ms,{PayloadSchema:()=>gS,ResultSchema:()=>gB,commandType:()=>bS,create:()=>bB});var gS=c.object({browser_id:c.string(),tab_id:c.string(),fullPage:c.boolean().optional(),cropX:c.number().optional(),cropY:c.number().optional(),cropWidth:c.number().optional(),cropHeight:c.number().optional()}),gB=c.object({data:c.string()}),bS="tab_screenshot";function bB(e){return new g(bS,gS,e)}var Fs={};C(Fs,{PayloadSchema:()=>yS,ResultSchema:()=>yB,commandType:()=>_S,create:()=>_B});var yS=c.object({browser_id:c.string(),tab_id:c.string(),script:c.string(),timeout_ms:c.number().int().positive().optional()}),yB=c.object({value:c.unknown().optional()}),_S="playwright_evaluate";function _B(e){return new g(_S,yS,e)}var Bs={};C(Bs,{PayloadSchema:()=>wS,ResultSchema:()=>wB,commandType:()=>xS,create:()=>xB});var wS=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),button:c.number().optional(),keys:c.array(c.string()).optional()}),wB=c.object({}),xS="cua_click";function xB(e){return new g(xS,wS,e)}var Ls={};C(Ls,{PayloadSchema:()=>SS,ResultSchema:()=>SB,commandType:()=>vS,create:()=>vB});var SS=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),timeout_ms:c.number().int().positive().optional()}),SB=c.object({}),vS="cua_download_media";function vB(e){return new g(vS,SS,e)}var Us={};C(Us,{PayloadSchema:()=>ES,ResultSchema:()=>EB,commandType:()=>CS,create:()=>CB});var ES=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),keys:c.array(c.string()).optional()}),EB=c.object({}),CS="cua_double_click";function CB(e){return new g(CS,ES,e)}var js={};C(js,{PayloadSchema:()=>TS,ResultSchema:()=>TB,commandType:()=>AS,create:()=>AB});var TS=c.object({browser_id:c.string(),tab_id:c.string(),keys:c.array(c.string())}),TB=c.object({}),AS="cua_keypress";function AB(e){return new g(AS,TS,e)}var qs={};C(qs,{PayloadSchema:()=>kS,ResultSchema:()=>kB,commandType:()=>IS,create:()=>IB});var kS=c.object({browser_id:c.string(),tab_id:c.string(),path:c.array(c.object({x:c.number(),y:c.number()})),keys:c.array(c.string()).optional()}),kB=c.object({}),IS="cua_drag";function IB(e){return new g(IS,kS,e)}var $s={};C($s,{PayloadSchema:()=>RS,ResultSchema:()=>RB,commandType:()=>PS,create:()=>PB});var RS=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),keys:c.array(c.string()).optional()}),RB=c.object({}),PS="cua_move";function PB(e){return new g(PS,RS,e)}var zs={};C(zs,{PayloadSchema:()=>DS,ResultSchema:()=>DB,commandType:()=>NS,create:()=>NB});var DS=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),scroll_x:c.number(),scroll_y:c.number(),keys:c.array(c.string()).optional()}),DB=c.object({}),NS="cua_scroll";function NB(e){return new g(NS,DS,e)}var Ws={};C(Ws,{PayloadSchema:()=>OS,ResultSchema:()=>OB,commandType:()=>MS,create:()=>MB});var OS=c.object({browser_id:c.string(),tab_id:c.string(),text:c.string()}),OB=c.object({}),MS="cua_type";function MB(e){return new g(MS,OS,e)}var Hs={};C(Hs,{PayloadSchema:()=>FS,ResultSchema:()=>FB,commandType:()=>BS,create:()=>BB});var FS=c.object({browser_id:c.string(),tab_id:c.string(),node_id:c.string()}),FB=c.object({}),BS="dom_cua_click";function BB(e){return new g(BS,FS,e)}var Vs={};C(Vs,{PayloadSchema:()=>LS,ResultSchema:()=>LB,commandType:()=>US,create:()=>UB});var LS=c.object({browser_id:c.string(),tab_id:c.string(),node_id:c.string(),timeout_ms:c.number().int().positive().optional()}),LB=c.object({}),US="dom_cua_download_media";function UB(e){return new g(US,LS,e)}var Gs={};C(Gs,{PayloadSchema:()=>jS,ResultSchema:()=>jB,commandType:()=>qS,create:()=>qB});var jS=c.object({browser_id:c.string(),tab_id:c.string(),node_id:c.string()}),jB=c.object({}),qS="dom_cua_double_click";function qB(e){return new g(qS,jS,e)}var Ks={};C(Ks,{PayloadSchema:()=>$S,ResultSchema:()=>$B,commandType:()=>zS,create:()=>zB});var $S=c.object({browser_id:c.string(),tab_id:c.string()}),$B=c.unknown(),zS="dom_cua_get_visible_dom";function zB(e){return new g(zS,$S,e)}var Js={};C(Js,{PayloadSchema:()=>WS,ResultSchema:()=>WB,commandType:()=>HS,create:()=>HB});var WS=c.object({browser_id:c.string(),tab_id:c.string(),keys:c.array(c.string())}),WB=c.object({}),HS="dom_cua_keypress";function HB(e){return new g(HS,WS,e)}var Ys={};C(Ys,{PayloadSchema:()=>VS,ResultSchema:()=>VB,commandType:()=>GS,create:()=>GB});var VS=c.object({browser_id:c.string(),tab_id:c.string(),scroll_x:c.number(),scroll_y:c.number(),node_id:c.string().optional()}),VB=c.object({}),GS="dom_cua_scroll";function GB(e){return new g(GS,VS,e)}var Zs={};C(Zs,{PayloadSchema:()=>KS,ResultSchema:()=>KB,commandType:()=>JS,create:()=>JB});var KS=c.object({browser_id:c.string(),tab_id:c.string(),text:c.string()}),KB=c.object({}),JS="dom_cua_type";function JB(e){return new g(JS,KS,e)}var Xs={};C(Xs,{PayloadSchema:()=>YS,ResultSchema:()=>YB,commandType:()=>ZS,create:()=>ZB});var YS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),modifiers:c.array(c.enum(["Alt","Control","ControlOrMeta","Meta","Shift"])).optional(),button:c.enum(["left","right","middle"]).optional(),force:c.boolean().optional(),timeout_ms:c.number().int().positive().optional()}),YB=c.object({}),ZS="playwright_locator_click";function ZB(e){return new g(ZS,YS,e)}var Qs={};C(Qs,{PayloadSchema:()=>XS,ResultSchema:()=>XB,commandType:()=>QS,create:()=>QB});var XS=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),modifiers:c.array(c.enum(["Alt","Control","ControlOrMeta","Meta","Shift"])).optional(),button:c.enum(["left","right","middle"]).optional(),force:c.boolean().optional(),timeout_ms:c.number().int().positive().optional()}),XB=c.object({}),QS="playwright_locator_dblclick";function QB(e){return new g(QS,XS,e)}var ea={};C(ea,{PayloadSchema:()=>ev,ResultSchema:()=>eL,commandType:()=>tv,create:()=>tL});var ev=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),eL=c.object({}),tv="playwright_locator_download_media";function tL(e){return new g(tv,ev,e)}var Oo={};C(Oo,{PayloadSchema:()=>rv,ResultSchema:()=>rL,commandType:()=>nv,create:()=>nL});var rv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),value:c.string(),replace:c.boolean()}),rL=c.object({}),nv="playwright_locator_fill";function nL(e){return new g(nv,rv,e)}var ta={};C(ta,{PayloadSchema:()=>ov,ResultSchema:()=>oL,commandType:()=>iv,create:()=>iL});var ov=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),value:c.string()}),oL=c.object({}),iv="playwright_locator_press";function iL(e){return new g(iv,ov,e)}var ra={};C(ra,{PayloadSchema:()=>sv,ResultSchema:()=>sL,commandType:()=>av,create:()=>aL});var sv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),state:c.enum(["attached","detached","visible","hidden"]),timeout_ms:c.number().int().positive().optional()}),sL=c.object({}),av="playwright_locator_wait_for";function aL(e){return new g(av,sv,e)}var na={};C(na,{PayloadSchema:()=>uv,ResultSchema:()=>uL,commandType:()=>lv,create:()=>lL});var uv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string()}),uL=c.object({count:c.number().int()}),lv="playwright_locator_count";function lL(e){return new g(lv,uv,e)}var oa={};C(oa,{PayloadSchema:()=>dv,ResultSchema:()=>cL,SelectOptionSchema:()=>cv,commandType:()=>pv,create:()=>dL});var cv=c.object({value:c.string().optional(),label:c.string().optional(),index:c.number().int().nonnegative().optional()}).superRefine((e,t)=>{e.value===void 0&&e.label===void 0&&e.index===void 0&&t.addIssue({code:c.ZodIssueCode.custom,message:"Select option requires value, label, or index"})}),dv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),selections:c.array(cv).min(1),timeout_ms:c.number().int().positive().optional()}),cL=c.object({}),pv="playwright_locator_select_option";function dL(e){return new g(pv,dv,e)}var ia={};C(ia,{PayloadSchema:()=>fv,ResultSchema:()=>pL,commandType:()=>mv,create:()=>fL});var fv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),checked:c.boolean(),force:c.boolean().optional(),timeout_ms:c.number().int().positive().optional()}),pL=c.object({}),mv="playwright_locator_set_checked";function fL(e){return new g(mv,fv,e)}var sa={};C(sa,{PayloadSchema:()=>hv,ResultSchema:()=>mL,commandType:()=>gv,create:()=>hL});var hv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string()}),mL=c.object({value:c.boolean()}),gv="playwright_locator_is_visible";function hL(e){return new g(gv,hv,e)}var aa={};C(aa,{PayloadSchema:()=>bv,ResultSchema:()=>gL,commandType:()=>yv,create:()=>bL});var bv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string()}),gL=c.object({value:c.boolean()}),yv="playwright_locator_is_enabled";function bL(e){return new g(yv,bv,e)}var ua={};C(ua,{PayloadSchema:()=>_v,ResultSchema:()=>yL,commandType:()=>wv,create:()=>_L});var _v=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),yL=c.object({values:c.array(c.string())}),wv="playwright_locator_all_text_contents";function _L(e){return new g(wv,_v,e)}var la={};C(la,{PayloadSchema:()=>xv,ResultSchema:()=>wL,commandType:()=>Sv,create:()=>xL});var xv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),wL=c.object({value:c.string().nullable()}),Sv="playwright_locator_text_content";function xL(e){return new g(Sv,xv,e)}var ca={};C(ca,{PayloadSchema:()=>vv,ResultSchema:()=>SL,commandType:()=>Ev,create:()=>vL});var vv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),timeout_ms:c.number().int().positive().optional()}),SL=c.object({value:c.string()}),Ev="playwright_locator_inner_text";function vL(e){return new g(Ev,vv,e)}var da={};C(da,{PayloadSchema:()=>Cv,ResultSchema:()=>EL,commandType:()=>Tv,create:()=>CL});var Cv=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),name:c.string(),timeout_ms:c.number().int().positive().optional()}),EL=c.object({value:c.string().nullable()}),Tv="playwright_locator_get_attribute";function CL(e){return new g(Tv,Cv,e)}var pa={};C(pa,{PayloadSchema:()=>Av,ResultSchema:()=>AL,commandType:()=>kv,create:()=>kL});var Av=c.object({browser_id:c.string(),tab_id:c.string(),selector:c.string(),relative_selector:c.string().optional(),timeout_ms:c.number().int().positive().optional()}),TL=c.object({attributes:c.record(c.string()),inner_text:c.string(),text_content:c.string().nullable()}),AL=c.object({values:c.array(TL.nullable())}),kv="playwright_locator_read_all";function kL(e){return new g(kv,Av,e)}var fa={};C(fa,{PayloadSchema:()=>Iv,ResultSchema:()=>RL,commandType:()=>Rv,create:()=>PL});var IL=c.enum(["load","domcontentloaded","networkidle","commit"]),Iv=c.object({browser_id:c.string(),tab_id:c.string(),url:c.string(),wait_until:IL.optional(),timeout_ms:c.number().int().positive().optional()}),RL=c.object({url:c.string().optional()}),Rv="playwright_wait_for_url";function PL(e){return new g(Rv,Iv,e)}var ma={};C(ma,{LoadStateSchema:()=>Pv,PayloadSchema:()=>Dv,ResultSchema:()=>DL,commandType:()=>Nv,create:()=>NL});var Pv=c.enum(["load","domcontentloaded","networkidle"]),Dv=c.object({browser_id:c.string(),tab_id:c.string(),state:Pv.optional(),timeout_ms:c.number().int().positive().optional()}),DL=c.object({}),Nv="playwright_wait_for_load_state";function NL(e){return new g(Nv,Dv,e)}var ha={};C(ha,{PayloadSchema:()=>Ov,ResultSchema:()=>OL,commandType:()=>Mv,create:()=>ML});var Ov=c.object({browser_id:c.string(),tab_id:c.string(),timeout_ms:c.number().int().nonnegative()}),OL=c.object({}),Mv="playwright_wait_for_timeout";function ML(e){return new g(Mv,Ov,e)}var ga={};C(ga,{PayloadSchema:()=>Fv,ResultSchema:()=>FL,commandType:()=>Bv,create:()=>BL});var Fv=c.object({browser_id:c.string(),tab_id:c.string()}),FL=c.object({dom_snapshot:c.string()}),Bv="playwright_dom_snapshot";function BL(e){return new g(Bv,Fv,e)}var ba={};C(ba,{PayloadSchema:()=>Lv,ResultSchema:()=>qL,commandType:()=>Uv,create:()=>$L});var LL=c.object({x:c.number(),y:c.number(),width:c.number(),height:c.number()}),UL=c.object({primary:c.string().nullable().optional(),candidates:c.array(c.string()),frameSelectors:c.array(c.string()).optional()}),jL=c.object({nodeId:c.number().int().positive().nullable().optional(),tagName:c.string(),role:c.string().nullable().optional(),visibleText:c.string().nullable().optional(),ariaName:c.string().nullable().optional(),testId:c.string().nullable().optional(),boundingBox:LL.nullable().optional(),preview:c.string(),selector:UL}),Lv=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),include_non_interactable:c.boolean().optional()}),qL=c.array(jL),Uv="playwright_element_info";function $L(e){return new g(Uv,Lv,e)}var ya={};C(ya,{PayloadSchema:()=>jv,ResultSchema:()=>zL,commandType:()=>qv,create:()=>WL});var jv=c.object({browser_id:c.string(),tab_id:c.string(),x:c.number(),y:c.number(),include_non_interactable:c.boolean().optional()}),zL=c.object({data:c.string()}),qv="playwright_element_screenshot";function WL(e){return new g(qv,jv,e)}var _a={};C(_a,{PayloadSchema:()=>$v,ResultSchema:()=>HL,commandType:()=>zv,create:()=>VL});var $v=c.object({browser_id:c.string(),tab_id:c.string(),timeout_ms:c.number().int().positive().optional()}),HL=c.object({download_id:c.string()}),zv="playwright_wait_for_download";function VL(e){return new g(zv,$v,e)}var wa={};C(wa,{PayloadSchema:()=>Wv,ResultSchema:()=>GL,commandType:()=>Hv,create:()=>KL});var Wv=c.object({browser_id:c.string(),tab_id:c.string(),download_id:c.string(),timeout_ms:c.number().int().positive().optional()}),GL=c.object({path:c.string().nullable()}),Hv="playwright_download_path";function KL(e){return new g(Hv,Wv,e)}var xa={};C(xa,{PayloadSchema:()=>Vv,ResultSchema:()=>JL,commandType:()=>Gv,create:()=>YL});var Vv=c.object({browser_id:c.string(),tab_id:c.string(),timeout_ms:c.number().int().positive().optional()}),JL=c.object({file_chooser_id:c.string(),is_multiple:c.boolean()}),Gv="playwright_wait_for_file_chooser";function YL(e){return new g(Gv,Vv,e)}var Sa={};C(Sa,{PayloadSchema:()=>Kv,ResultSchema:()=>ZL,commandType:()=>Jv,create:()=>XL});var Kv=c.object({browser_id:c.string(),tab_id:c.string(),file_chooser_id:c.string(),files:c.array(c.string()),timeout_ms:c.number().int().positive().optional()}),ZL=c.object({}),Jv="playwright_file_chooser_set_files";function XL(e){return new g(Jv,Kv,e)}var va=class{#e;#r;#t;constructor({browserId:t,createTab:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async new(){let t=await this.#t.send({command:gs.create({browser_id:this.#e})});return this.#r(t)}async selected(){let t=await this.#t.send({command:ws.create({browser_id:this.#e})});if(t.id)return this.#r(t)}async list(){return(await this.#t.send({command:sn.create({browser_id:this.#e})})).tabs}async finalize(t={}){if(t===null||Array.isArray(t)||typeof t!="object")throw new Error("browser.tabs.finalize expects an options object");let r=t.keep??[];if(!Array.isArray(r))throw new Error("browser.tabs.finalize keep must be an array");await this.#t.send({command:ys.create({browser_id:this.#e,keep:r.map(n=>({tab_id:QL(n.tab),status:e6(n.status)}))})})}async content(t){let r=xs.create({browser_id:this.#e,urls:t.urls,content_type:t.contentType,...t.timeoutMs===void 0?{}:{timeout_ms:t.timeoutMs}});return r.parse(),t.urls.length===0?[]:(await this.#t.send({command:r})).results}async get(t){if(!t)throw new Error("tabs.get requires a tab id");let r=await this.list(),n=r.find(o=>o.id===t);if(!n){let o=r.length?r.map(i=>`${i.id}|${i.title??"<no title>"}|${i.url??"<no url>"}`).join(", "):"none";throw new Error(`tabs.get could not find tab id "${t}". Existing tabs: ${o}`)}return this.#r(n)}};function QL(e){if(typeof e=="string"){if(!e)throw new Error("browser.tabs.finalize received an empty tab id");return e}if(e&&typeof e=="object"&&typeof e.id=="string")return e.id;throw new Error("browser.tabs.finalize keep entries must be objects like { tab, status }; do not pass a Tab or tab id directly")}function e6(e){if(e==="handoff"||e==="deliverable")return e;throw new Error(`browser.tabs.finalize received invalid status ${String(e)}`)}var Ea=class{#e;#r;#t;constructor({browserId:t,createTab:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async openTabs(){return(await this.#t.send({command:As.create({browser_id:this.#e})})).tabs}async claimTab(t){let r=t6(t),n=await this.#t.send({command:Ts.create({browser_id:this.#e,tab_id:r})});return this.#r(n)}async history(t={}){if(t===null||Array.isArray(t)||typeof t!="object")throw new Error("browser.user.history expects an options object");let r={browser_id:this.#e},n=r6(t.query),o=n6(t.limit),i=Yv(t.from,"from"),s=Yv(t.to,"to");return n!==void 0&&(r.query=n),o!==void 0&&(r.limit=o),i!==void 0&&(r.from=i),s!==void 0&&(r.to=s),(await this.#t.send({command:ks.create(r)})).items}},Yv=(e,t)=>{if(e==null)return;let r=e instanceof Date?e:new Date(e);if(Number.isNaN(r.getTime()))throw new Error(`browser.user.history received an invalid ${t} date`);return r.toISOString()},t6=e=>{if(typeof e=="string"){if(e.length===0)throw new Error("browser.user.claimTab received an empty tab id");return e}if(e&&typeof e=="object"&&typeof e.id=="string")return e.id;throw new Error("browser.user.claimTab expects a tab returned by browser.user.openTabs() or a tab id")},r6=e=>{if(e!=null){if(typeof e!="string")throw new Error("browser.user.history received an invalid query");return e}},n6=e=>{if(e!=null){if(!Number.isInteger(e)||e<=0)throw new Error("browser.user.history received an invalid limit");return e}};var $l=e=>{let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n+=1)r[n]=t.charCodeAt(n);return r};function tt(e,t){let r=e instanceof Error?e.message:String(e),n=new Error(`${r}
${t}`);return e instanceof Error&&e.stack&&(n.stack=`${n.name}: ${n.message}
${e.stack}`),n}function o6(e,t){let r=i6(t);if(typeof e=="string"){if(e.length===0)throw new Error("playwright.evaluate requires a pageFunction");return`const arg = ${r};
return (${e});`}if(typeof e=="function")return[`const arg = ${r};`,`const __playwrightEvaluate = (${e.toString()});`,"return await __playwrightEvaluate(arg);"].join(`
`);throw new Error("playwright.evaluate requires a string or function")}function i6(e){if(e===void 0)return"undefined";try{let t=JSON.stringify(e);if(t!==void 0)return t}catch(t){throw tt(t,"playwright.evaluate arg must be JSON-serializable")}throw new Error("playwright.evaluate arg must be JSON-serializable")}function Zv(e,t){let{x:r,y:n}=t;if(!Number.isFinite(r)||!Number.isFinite(n))throw new Error(`${e} requires numeric x and y coordinates`);return{x:r,y:n}}function s6(e){let t=Array.isArray(e)?e:[e];if(!t.length)throw new Error("locator.selectOption requires at least one value");return t.map(r=>{if(typeof r=="string")return{value:r};if(!r||typeof r!="object")throw new Error("locator.selectOption requires a string or { value?, label?, index? }");let n={};if(r.value!==void 0){if(typeof r.value!="string")throw new Error("locator.selectOption value must be a string");n.value=r.value}if(r.label!==void 0){if(typeof r.label!="string")throw new Error("locator.selectOption label must be a string");n.label=r.label}if(r.index!==void 0){if(!Number.isInteger(r.index)||r.index<0)throw new Error("locator.selectOption index must be a non-negative integer");n.index=r.index}if(n.value===void 0&&n.label===void 0&&n.index===void 0)throw new Error("locator.selectOption requires value, label, or index for each selection");return n})}var Ca=class e{#e;#r;#t;#n;#o;#i;#s;constructor({browserId:t,tabId:r,selector:n,transport:o,collectionReadCache:i,collectionReadIndex:s,collectionRelativeSelector:a}){this.#e=t,this.#r=r,this.#t=n,this.#n=o,this.#o=i,this.#i=s,this.#s=a}async click(t={}){try{await this.#n.send({command:Xs.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,modifiers:t.modifiers,button:t.button,force:t.force,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs}),this.#o?.clear()}catch(r){throw tt(r,`waiting on click for selector ${this.#t}`)}}async dblclick(t={}){try{await this.#n.send({command:Qs.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,modifiers:t.modifiers,button:t.button,force:t.force,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs}),this.#o?.clear()}catch(r){throw tt(r,`waiting on dblclick for selector ${this.#t}`)}}async selectOption(t,{timeoutMs:r}={}){let n=s6(t);try{await this.#n.send({command:oa.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,selections:n,timeout_ms:r}),timeoutMs:r}),this.#o?.clear()}catch(o){throw tt(o,`locator.selectOption failed for selector ${this.#t}`)}}async fill(t,{timeoutMs:r}={}){if(t==null)throw new Error("locator.fill requires a value");try{await this.#n.send({command:Oo.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,value:t,replace:!0}),timeoutMs:r}),this.#o?.clear()}catch(n){throw tt(n,`locator.fill failed for selector ${this.#t}`)}}async type(t,{timeoutMs:r}={}){if(t==null)throw new Error("locator.type requires a value");try{await this.#n.send({command:Oo.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,value:t,replace:!1}),timeoutMs:r}),this.#o?.clear()}catch(n){throw tt(n,`locator.type failed for selector ${this.#t}`)}}async press(t,{timeoutMs:r}={}){if(t==null)throw new Error("locator.press requires a value");try{await this.#n.send({command:ta.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,value:t}),timeoutMs:r}),this.#o?.clear()}catch(n){throw tt(n,`locator.press failed for selector ${this.#t}`)}}async setChecked(t,r={}){if(typeof t!="boolean")throw new Error("locator.setChecked requires a boolean");try{await this.#n.send({command:ia.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,checked:t,force:r.force,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs}),this.#o?.clear()}catch(n){throw tt(n,`locator.setChecked(${t}) failed for selector ${this.#t}`)}}async check(t={}){await this.setChecked(!0,t)}async uncheck(t={}){await this.setChecked(!1,t)}async waitFor({state:t,timeoutMs:r}){if(!t)throw new Error("locator.waitFor requires a state");try{await this.#n.send({command:ra.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,state:t,timeout_ms:r}),timeoutMs:r})}catch(n){throw tt(n,`locator.waitFor(${t}) timed out for selector ${this.#t}`)}}async count(){return(await this.#n.send({command:na.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t})})).count}async all(){let t=await this.count(),r=new Vf({browserId:this.#e,tabId:this.#r,selector:this.#t,transport:this.#n});return Array.from({length:t},(n,o)=>new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> nth=${o}`,transport:this.#n,collectionReadCache:r,collectionReadIndex:o}))}async textContent({timeoutMs:t}={}){let r=await this.cachedRead(t);return r?r.text_content:(await this.#n.send({command:la.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,timeout_ms:t}),timeoutMs:t})).value}async innerText({timeoutMs:t}={}){let r=await this.cachedRead(t);return r?r.inner_text:(await this.#n.send({command:ca.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,timeout_ms:t}),timeoutMs:t})).value}async getAttribute(t,{timeoutMs:r}={}){if(!t)throw new Error("locator.getAttribute requires a name");let n=await this.cachedRead(r);return n?Object.prototype.hasOwnProperty.call(n.attributes,t)?n.attributes[t]??null:null:(await this.#n.send({command:da.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,name:t,timeout_ms:r}),timeoutMs:r})).value}async isVisible(){return(await this.#n.send({command:sa.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t})})).value}async isEnabled(){return(await this.#n.send({command:aa.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t})})).value}async allTextContents({timeoutMs:t}={}){return(await this.#n.send({command:ua.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,timeout_ms:t}),timeoutMs:t})).values}async downloadMedia({timeoutMs:t}={}){try{await this.#n.send({command:ea.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,timeout_ms:t}),timeoutMs:t}),this.#o?.clear()}catch(r){throw tt(r,`locator.downloadMedia failed for selector ${this.#t}`)}}locator(t,r={}){if(!t)throw new Error("locator.locator requires a selector");return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> ${t}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,t):void 0}).filter(r)}first(){return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> nth=0`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,"nth=0"):void 0})}last(){return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> nth=-1`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,"nth=-1"):void 0})}nth(t){if(typeof t!="number")throw new Error("locator.nth requires a numeric index");return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> nth=${t}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,`nth=${t}`):void 0})}and(t){if(!(t instanceof e))throw new Error("locator.and requires a PlaywrightLocator");if(t.#e!==this.#e||t.#r!==this.#r)throw new Error("Locators must belong to the same tab");return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> internal:and=${JSON.stringify(t.#t)}`,transport:this.#n})}or(t){if(!(t instanceof e))throw new Error("locator.or requires a PlaywrightLocator");if(t.#e!==this.#e||t.#r!==this.#r)throw new Error("Locators must belong to the same tab");return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> internal:or=${JSON.stringify(t.#t)}`,transport:this.#n})}filter(t={}){let r=[this.#t];if(t.hasText!==void 0&&r.push(`internal:has-text=${zl(t.hasText,!1)}`),t.hasNotText!==void 0&&r.push(`internal:has-not-text=${zl(t.hasNotText,!1)}`),t.has!==void 0&&(this.assertCompatibleLocator(t.has,"locator.filter has"),r.push(`internal:has=${JSON.stringify(t.has.#t)}`)),t.hasNot!==void 0&&(this.assertCompatibleLocator(t.hasNot,"locator.filter hasNot"),r.push(`internal:has-not=${JSON.stringify(t.hasNot.#t)}`)),t.visible!==void 0){if(typeof t.visible!="boolean")throw new Error("locator.filter visible must be a boolean");r.push(`visible=${t.visible}`)}let n=r.slice(1).join(" >> "),o=this.#o&&this.#i!==void 0&&(!n||this.#s!==void 0);return new e({browserId:this.#e,tabId:this.#r,selector:r.join(" >> "),transport:this.#n,collectionReadCache:o?this.#o:void 0,collectionReadIndex:o?this.#i:void 0,collectionRelativeSelector:o?bt(this.#s,n):void 0})}getByRole(t,r={}){let n=Kf(t,r);return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,n):void 0})}getByText(t,r={}){let n=Jf(t,r);return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,n):void 0})}getByLabel(t,r={}){let n=Yf(t,r);return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,n):void 0})}getByPlaceholder(t,r={}){let n=Zf(t,r);return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> ${n}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,n):void 0})}getByTestId(t){let r=Xf(t);return new e({browserId:this.#e,tabId:this.#r,selector:`${this.#t} >> ${r}`,transport:this.#n,collectionReadCache:this.#o,collectionReadIndex:this.#i,collectionRelativeSelector:this.#o&&this.#i!==void 0?bt(this.#s,r):void 0})}async cachedRead(t){return!this.#o||this.#i===void 0?null:await this.#o.read({index:this.#i,relativeSelector:this.#s,timeoutMs:t})}assertCompatibleLocator(t,r){if(!(t instanceof e))throw new Error(`${r} requires a PlaywrightLocator`);if(t.#e!==this.#e||t.#r!==this.#r)throw new Error("Locators must belong to the same tab")}},Vf=class{#e;#r;#t;#n;#o=new Map;constructor({browserId:t,tabId:r,selector:n,transport:o}){this.#e=t,this.#r=r,this.#t=n,this.#n=o}clear(){this.#o.clear()}async read({index:t,relativeSelector:r,timeoutMs:n}){let o=r??"",i=this.#o.get(o);return i||(i=this.#i(r,n).catch(s=>{throw this.#o.delete(o),s}),this.#o.set(o,i)),(await i)[t]??null}async#i(t,r){return(await this.#n.send({command:pa.create({browser_id:this.#e,tab_id:this.#r,selector:this.#t,relative_selector:t,timeout_ms:r}),timeoutMs:r})).values}};function bt(e,t){return e?t?`${e} >> ${t}`:e:t||void 0}function Xv(e){let t=e;return e.unicode||t.unicodeSets?String(e):String(e).replace(/(^|[^\\])(\\\\)*(["'`])/g,"$1$2\\\\$3").replace(/>>/g,"\\>\\>")}function zl(e,t){return typeof e!="string"?Xv(e):`${JSON.stringify(e)}${t?"s":"i"}`}function Gf(e,t){return typeof e!="string"?Xv(e):`"${e.replace(/\\/g,"\\\\").replace(/["]/g,'\\"')}"${t?"s":"i"}`}function Kf(e,t){if(!e)throw new Error("getByRole requires a role");let r=[];return t.name!==void 0&&r.push(`[name=${Gf(t.name,!!t.exact)}]`),`internal:role=${e}${r.join("")}`}function Jf(e,t){if(typeof e!="string"&&!(e instanceof RegExp))throw new Error("getByText requires a string or RegExp");return`internal:text=${zl(e,!!t.exact)}`}function Yf(e,t){if(typeof e!="string"&&!(e instanceof RegExp))throw new Error("getByLabel requires a string or RegExp");return`internal:label=${zl(e,!!t.exact)}`}function Zf(e,t){if(typeof e!="string"&&!(e instanceof RegExp))throw new Error("getByPlaceholder requires a string or RegExp");return`internal:attr=[placeholder=${Gf(e,!!t.exact)}]`}function Xf(e){if(!e)throw new Error("getByTestId requires a testId");return`internal:testid=[data-testid=${Gf(e,!0)}]`}var Wl=class e{#e;#r;#t;#n;constructor({browserId:t,tabId:r,frameSelector:n,transport:o}){this.#e=t,this.#r=r,this.#t=n,this.#n=o}locator(t){if(!t)throw new Error("frameLocator.locator requires a selector");let r=`${this.#t} >> internal:control=enter-frame >> ${t}`;return new Ca({browserId:this.#e,tabId:this.#r,selector:r,transport:this.#n})}frameLocator(t){if(!t)throw new Error("frameLocator.frameLocator requires a selector");return new e({browserId:this.#e,tabId:this.#r,frameSelector:`${this.#t} >> internal:control=enter-frame >> ${t}`,transport:this.#n})}getByRole(t,r={}){return this.locator(Kf(t,r))}getByText(t,r={}){return this.locator(Jf(t,r))}getByLabel(t,r={}){return this.locator(Yf(t,r))}getByPlaceholder(t,r={}){return this.locator(Zf(t,r))}getByTestId(t){return this.locator(Xf(t))}},Hl=class{#e;#r;#t;#n;constructor({browserId:t,tabId:r,downloadId:n,transport:o}){this.#e=t,this.#r=r,this.#t=n,this.#n=o}async path({timeoutMs:t}={}){return(await this.#n.send({command:wa.create({browser_id:this.#e,tab_id:this.#r,download_id:this.#t,timeout_ms:t}),timeoutMs:t})).path??null}},Vl=class{#e;#r;#t;#n;#o;constructor({browserId:t,tabId:r,fileChooserId:n,isMultiple:o,transport:i}){this.#e=t,this.#r=r,this.#t=n,this.#n=o,this.#o=i}isMultiple(){return this.#n}async setFiles(t,{timeoutMs:r}={}){if(t==null)throw new Error("fileChooser.setFiles requires files");let n=Array.isArray(t)?t:[t];if(!n.length)throw new Error("fileChooser.setFiles requires at least one file");try{await this.#o.send({command:Sa.create({browser_id:this.#e,tab_id:this.#r,file_chooser_id:this.#t,files:n,timeout_ms:r}),timeoutMs:r})}catch(o){throw tt(o,"fileChooser.setFiles failed")}}},Ta=class{#e;#r;#t;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async goBack(){await this.#t.send({command:an.create({browser_id:this.#e,tab_id:this.#r})})}async goForward(){await this.#t.send({command:un.create({browser_id:this.#e,tab_id:this.#r})})}async evaluate(t,r,n){return(await this.#t.send({command:Fs.create({browser_id:this.#e,script:o6(t,r),tab_id:this.#r,timeout_ms:n?.timeoutMs}),timeoutMs:n?.timeoutMs})).value}locator(t){if(!t)throw new Error("playwright.locator requires a selector");return new Ca({browserId:this.#e,tabId:this.#r,selector:t,transport:this.#t})}getByRole(t,r={}){return this.locator(Kf(t,r))}getByText(t,r={}){return this.locator(Jf(t,r))}getByLabel(t,r={}){return this.locator(Yf(t,r))}getByPlaceholder(t,r={}){return this.locator(Zf(t,r))}getByTestId(t){return this.locator(Xf(t))}frameLocator(t){if(!t)throw new Error("playwright.frameLocator requires a selector");return new Wl({browserId:this.#e,tabId:this.#r,frameSelector:t,transport:this.#t})}async waitForURL(t,r={}){if(!t)throw new Error("playwright.waitForURL requires a url");await this.#t.send({command:fa.create({browser_id:this.#e,tab_id:this.#r,url:t,wait_until:r.waitUntil,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs})}async waitForLoadState(t={}){await this.#t.send({command:ma.create({browser_id:this.#e,tab_id:this.#r,state:t.state,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs})}async waitForTimeout(t){if(!Number.isInteger(t)||t<0)throw new Error("playwright.waitForTimeout requires a non-negative integer");await this.#t.send({command:ha.create({browser_id:this.#e,tab_id:this.#r,timeout_ms:t}),timeoutMs:t+2e3})}async waitForEvent(t,r={}){if(t==="download"){let n=await this.#t.send({command:_a.create({browser_id:this.#e,tab_id:this.#r,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs});return new Hl({browserId:this.#e,tabId:this.#r,downloadId:n.download_id,transport:this.#t})}if(t==="filechooser"){let n=await this.#t.send({command:xa.create({browser_id:this.#e,tab_id:this.#r,timeout_ms:r.timeoutMs}),timeoutMs:r.timeoutMs});return new Vl({browserId:this.#e,tabId:this.#r,fileChooserId:n.file_chooser_id,isMultiple:n.is_multiple,transport:this.#t})}throw new Error("playwright.waitForEvent only supports 'download' and 'filechooser'")}async expectNavigation(t,r={}){let n=r.url?this.waitForURL(r.url,{timeoutMs:r.timeoutMs,waitUntil:r.waitUntil}):this.waitForLoadState({timeoutMs:r.timeoutMs,state:r.waitUntil}),o=t(),[i]=await Promise.all([o,n]);return i}async elementInfo(t){let r=Zv("playwright.elementInfo",t);return await this.#t.send({command:ba.create({browser_id:this.#e,tab_id:this.#r,x:r.x,y:r.y,include_non_interactable:t.includeNonInteractable})})}async elementScreenshot(t){let r=Zv("playwright.elementScreenshot",t),n=await this.#t.send({command:ya.create({browser_id:this.#e,tab_id:this.#r,x:r.x,y:r.y,include_non_interactable:t.includeNonInteractable})});return $l(n.data)}async domSnapshot(){return(await this.#t.send({command:ga.create({browser_id:this.#e,tab_id:this.#r})})).dom_snapshot}};var Aa=class{#e;#r;#t;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async get_visible_dom(){return this.#t.send({command:Ks.create({browser_id:this.#e,tab_id:this.#r})})}async click(t){if(!t?.node_id)throw new Error("dom_cua.click requires a node_id");await this.#t.send({command:Hs.create({browser_id:this.#e,tab_id:this.#r,node_id:t.node_id})})}async double_click(t){if(!t?.node_id)throw new Error("dom_cua.double_click requires a node_id");await this.#t.send({command:Gs.create({browser_id:this.#e,tab_id:this.#r,node_id:t.node_id})})}async scroll({node_id:t,x:r,y:n}){if(typeof r!="number"||typeof n!="number")throw new Error("dom_cua.scroll requires x and y numbers");await this.#t.send({command:Ys.create({browser_id:this.#e,tab_id:this.#r,node_id:t,scroll_x:r,scroll_y:n})})}async type({text:t}){if(typeof t!="string")throw new Error("dom_cua.type requires text");await this.#t.send({command:Zs.create({browser_id:this.#e,tab_id:this.#r,text:t})})}async keypress(t){if(!Array.isArray(t?.keys)||t.keys.length===0)throw new Error("dom_cua.keypress requires a non-empty keys array");await this.#t.send({command:Js.create({browser_id:this.#e,tab_id:this.#r,keys:t.keys})})}async downloadMedia(t){if(!t?.node_id)throw new Error("dom_cua.downloadMedia requires a node_id");await this.#t.send({command:Vs.create({browser_id:this.#e,tab_id:this.#r,node_id:t.node_id,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs})}};var ka=class{#e;#r;#t;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async click(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.click requires x and y");await this.#t.send({command:Bs.create({browser_id:this.#e,tab_id:this.#r,x:t.x,y:t.y,button:t.button,keys:t.keypress})})}async scroll(t){if(typeof t?.x!="number"||typeof t?.y!="number"||typeof t?.scrollX!="number"||typeof t?.scrollY!="number")throw new Error("cua.scroll requires x, y, scrollX, and scrollY");await this.#t.send({command:zs.create({browser_id:this.#e,tab_id:this.#r,x:t.x,y:t.y,scroll_x:t.scrollX,scroll_y:t.scrollY,keys:t.keypress})})}async double_click(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.double_click requires x and y");await this.#t.send({command:Us.create({browser_id:this.#e,tab_id:this.#r,x:t.x,y:t.y,keys:t.keypress})})}async type(t){if(typeof t?.text!="string")throw new Error("cua.type requires text");await this.#t.send({command:Ws.create({browser_id:this.#e,tab_id:this.#r,text:t.text})})}async keypress(t){if(!Array.isArray(t?.keys)||t.keys.length===0)throw new Error("cua.keypress requires a non-empty keys array");await this.#t.send({command:js.create({browser_id:this.#e,tab_id:this.#r,keys:t.keys})})}async drag(t){if(!Array.isArray(t?.path)||t.path.length===0||t.path.some(r=>typeof r?.x!="number"||typeof r?.y!="number"))throw new Error("cua.drag requires a non-empty path of {x, y} points");await this.#t.send({command:qs.create({browser_id:this.#e,tab_id:this.#r,path:t.path,keys:t.keys})})}async move(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.move requires x and y");await this.#t.send({command:$s.create({browser_id:this.#e,tab_id:this.#r,x:t.x,y:t.y,keys:t.keys})})}async downloadMedia(t){if(typeof t?.x!="number"||typeof t?.y!="number")throw new Error("cua.downloadMedia requires x and y");await this.#t.send({command:Ls.create({browser_id:this.#e,tab_id:this.#r,x:t.x,y:t.y,timeout_ms:t.timeoutMs}),timeoutMs:t.timeoutMs})}};var Ia=class{#e;#r;#t;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async export(){return(await this.#t.send({command:Is.create({browser_id:this.#e,tab_id:this.#r})})).path}async exportGsuite(t){return(await this.#t.send({command:Rs.create({browser_id:this.#e,tab_id:this.#r,format:t})})).path}};var Ra=class{#e;#r;#t;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async readText(){return(await this.#t.send({command:Ps.create({browser_id:this.#e,tab_id:this.#r})})).text}async writeText(t){if(t==null)throw new Error("tab.clipboard.writeText requires text");await this.#t.send({command:Ds.create({browser_id:this.#e,tab_id:this.#r,text:t})})}async read(){return(await this.#t.send({command:Ns.create({browser_id:this.#e,tab_id:this.#r})})).items.map(r=>({entries:r.entries.map(n=>({mimeType:n.mime_type,text:n.text,base64:n.base64})),presentationStyle:r.presentation_style}))}async write(t){if(!Array.isArray(t)||t.length===0)throw new Error("tab.clipboard.write requires at least one clipboard item");await this.#t.send({command:Os.create({browser_id:this.#e,tab_id:this.#r,items:t.map(r=>({presentation_style:r.presentationStyle,entries:r.entries.map(n=>({mime_type:n.mimeType,text:n.text,base64:n.base64}))}))})})}};var Pa=class{#e;#r;#t;constructor({browserId:t,tabId:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async logs(t={}){let r=a6(t.filter),n=u6(t.levels),o=l6(t.limit),i={browser_id:this.#e,tab_id:this.#r,...r!==void 0?{filter:r}:{},...n!==void 0?{levels:n}:{},...o!==void 0?{limit:o}:{}};return(await this.#t.send({command:No.create(i)})).logs}},a6=e=>{if(e!=null){if(typeof e!="string")throw new Error("tab.dev.logs received an invalid filter");return e}},u6=e=>{if(e!=null){if(!Array.isArray(e)||e.length===0)throw new Error("tab.dev.logs received invalid levels");return e.map(t=>{if(t==="warning")return"warn";if(No.LogLevelSchema.options.includes(t))return t;throw new Error(`tab.dev.logs received invalid level "${String(t)}"`)})}},l6=e=>{if(e!=null){if(!Number.isInteger(e)||e<=0)throw new Error("tab.dev.logs received an invalid limit");return e}};var Mo=class{constructor(t,r,n,o){this.transport=t;this.browserId=r;this.documentationApi=n;this.info=o}get id(){return this.info.id}async documentation(){return await this.documentationApi.get(`capabilities/browser/${this.id}`)}},yt=class{constructor(t,r,n,o,i){this.transport=t;this.browserId=r;this.tabId=n;this.documentationApi=o;this.info=i}get id(){return this.info.id}async documentation(){return await this.documentationApi.get(`capabilities/tab/${this.id}`)}};function Gl({capability:e,info:t,internalOnly:r}){return{capability:e,create:n=>new e({...n,info:t}),id:t.id,info:t,...r==null?{}:{internalOnly:r}}}function mr({capability:e,info:t,internalOnly:r}){return{capability:e,create:n=>new e({...n,info:t}),id:t.id,info:t,...r==null?{}:{internalOnly:r}}}function c6({heading:e,infos:t,scope:r}){let n=t.length===0?["- None"]:t.map(({description:o,id:i})=>`- \`${i}\`: ${o}
  Read with \`await (await ${r}.capabilities.get("${i}")).documentation()\`.`);return[`### ${e}`,...n].join(`
`)}function Kl({capabilities:e,definitions:t,heading:r,scope:n}){let o=new Map(t.map(i=>[i.id,i]));return c6({heading:r,infos:(e??[]).flatMap(({id:i})=>{let s=o.get(i);return s==null?[]:[s.info]}),scope:n})}var Fo=class{#e;constructor(t){this.#e=t}async get(t){let r=this.#e[t];if(!r)throw new Error(`Capability is not available: ${t}`);return r}async list(){return Object.values(this.#e).map(t=>t.info)}};var Ut={};C(Ut,{Call:()=>Bo,Events:()=>Lo});var Bo={};C(Bo,{PayloadSchema:()=>tE,ResultSchema:()=>p6,commandType:()=>eE,create:()=>f6});var Jl=c.object({session_id:c.string().min(1).optional(),target_id:c.string().min(1).optional()}).refine(e=>e.session_id==null!=(e.target_id==null),"CDP target must provide exactly one of session_id or target_id."),d6=c.object({extensionId:c.string().optional(),sessionId:c.string().optional(),tabId:c.number().int().optional(),targetId:c.string().optional()}),Qv=c.object({sequence:c.number().int().positive(),source:d6,method:c.string().min(1),params:c.record(c.string(),c.unknown()).optional()});var eE="tab_cdp_call",tE=c.object({browser_id:c.string(),tab_id:c.string(),method:c.string().min(1),params:c.record(c.string(),c.unknown()).optional(),target:Jl.optional(),timeout_ms:c.number().int().positive().optional()}),p6=c.unknown();function f6(e){return new g(eE,tE,e)}var Lo={};C(Lo,{PayloadSchema:()=>nE,ResultSchema:()=>m6,commandType:()=>rE,create:()=>h6});var rE="tab_cdp_events",nE=c.object({after_sequence:c.number().int().nonnegative().optional(),browser_id:c.string(),limit:c.number().int().positive().max(1e3).optional(),methods:c.array(c.string().min(1)).min(1).optional(),tab_id:c.string(),target:Jl.optional(),timeout_ms:c.number().int().nonnegative().optional()}),m6=c.object({cursor:c.number().int().nonnegative(),events:c.array(Qv),hasMore:c.boolean(),truncated:c.boolean()});function h6(e){return new g(rE,nE,e)}var oE={id:"cdp",description:"Send raw Chrome DevTools Protocol commands and read debugger events through a supported Browser Use tab when full CDP access is enabled."};var g6=2e3,Da=class extends yt{constructor({browserId:t,documentation:r,info:n,tabId:o,transport:i}){super(i,t,o,r,n)}async send(t,r,n){let o=await this.transport.send({command:Bo.create({browser_id:this.browserId,method:t,params:r,tab_id:this.tabId,target:iE(n?.target),timeout_ms:n?.timeoutMs}),timeoutMs:n?.timeoutMs});return Bo.ResultSchema.parse(o)}async readEvents(t){let r=await this.transport.send({command:Lo.create({after_sequence:t?.afterSequence,browser_id:this.browserId,limit:t?.limit,methods:t?.methods,tab_id:this.tabId,target:iE(t?.target),timeout_ms:t?.timeoutMs}),timeoutMs:b6(t?.timeoutMs)});return Lo.ResultSchema.parse(r)}},Uo=mr({capability:Da,info:oE,internalOnly:!0});function iE(e){if(e!=null)return{session_id:e.sessionId,target_id:e.targetId}}function b6(e){return e!=null&&e>0?e+g6:void 0}var qo={};C(qo,{Handoff:()=>jo});var jo={};C(jo,{PayloadSchema:()=>uE,ResultSchema:()=>S6,commandType:()=>aE,create:()=>v6});var y6=300*1e3,_6=/^[A-Za-z0-9_-]{1,48}$/,w6=new Set(["__proto__","constructor","prototype"]),x6=c.object({id:c.string().regex(_6).refine(e=>!w6.has(e)),label:c.string(),type:c.string().min(1),autocomplete:c.string(),required:c.boolean(),selector:c.string()}),sE=c.object({origin:c.string(),reason:c.string(),expires_at:c.string().datetime({offset:!0}).refine(e=>Date.parse(e)<=Date.now()+y6,"expires_at must be no more than 5 minutes in the future"),fields:c.array(x6).min(1).max(6),submit:c.object({selector:c.string(),action:c.enum(["click","press_enter"])}).optional()});var aE="tab_browser_auth_handoff",uE=sE.extend({browser_id:c.string(),tab_id:c.string()}),S6=c.object({status:c.enum(["submitted","declined","cancelled","unavailable","expired","origin_changed","page_changed","locator_invalid","submission_failed"])});function v6(e){return new g(aE,uE,e)}var lE={id:"browserAuth",description:"Use when authentication or sign-in blocks the browser task. Pauses for the user to provide credentials to a validated login form without exposing the values to the model. Omit submit for forms that auto-submit during credential entry."};var Na=class extends yt{constructor({browserId:t,documentation:r,info:n,tabId:o,transport:i}){super(i,t,o,r,n)}async request(t){let r=await this.transport.send({command:jo.create({...t,browser_id:this.browserId,tab_id:this.tabId})});return jo.ResultSchema.parse(r)}},Oa=mr({capability:Na,info:lE});var ln={};C(ln,{Bundle:()=>$o,List:()=>zo});var $o={};C($o,{PayloadSchema:()=>gE,ResultSchema:()=>I6,commandType:()=>hE,create:()=>R6});var cE=c.enum(["font","image","script","stylesheet","video","other"]),dE=c.enum(["font","image","stylesheet","video"]),E6=c.object({kind:c.enum(["attribute","computedStyle","resource"]),nodeId:c.number().int().positive().optional(),property:c.string().optional()}),C6=c.object({id:c.string(),kind:cE,name:c.string(),sources:c.array(E6),url:c.string()}),T6=c.object({id:c.string(),markup:c.string(),name:c.string()}),pE=c.object({assets:c.array(C6),id:c.string(),inlineSvgs:c.array(T6),pageUrl:c.string().nullable(),summary:c.object({byKind:c.record(cE,c.number().int().nonnegative()),inlineSvgCount:c.number().int().nonnegative(),totalCount:c.number().int().nonnegative()})}),fE=c.object({assetIds:c.array(c.string()).optional(),inventoryId:c.string(),kinds:c.array(dE).optional()}),A6=c.object({contentType:c.string().nullable(),id:c.string(),kind:dE,name:c.string(),path:c.string(),url:c.string()}),k6=c.object({contentType:c.string().nullable(),id:c.string(),name:c.string(),reason:c.string(),url:c.string()}),mE=c.object({assets:c.array(A6),directoryPath:c.string(),failures:c.array(k6),manifestPath:c.string(),summary:c.object({downloadedCount:c.number().int().nonnegative(),elapsedMs:c.number().nonnegative(),failedCount:c.number().int().nonnegative(),requestedCount:c.number().int().nonnegative()})});var hE="tab_page_assets_bundle",gE=fE.extend({browser_id:c.string(),tab_id:c.string()}),I6=mE;function R6(e){return new g(hE,gE,e)}var zo={};C(zo,{PayloadSchema:()=>yE,ResultSchema:()=>P6,commandType:()=>bE,create:()=>D6});var bE="tab_page_assets_list",yE=c.object({browser_id:c.string(),tab_id:c.string()}),P6=pE;function D6(e){return new g(bE,yE,e)}var _E={id:"pageAssets",description:"List assets already observed in the current page state and bundle selected assets into a temporary local artifact."};var Ma=class extends yt{constructor({browserId:t,documentation:r,info:n,tabId:o,transport:i}){super(i,t,o,r,n)}async list(){let t=await this.transport.send({command:zo.create({browser_id:this.browserId,tab_id:this.tabId})});return zo.ResultSchema.parse(t)}async bundle(t){let r=await this.transport.send({command:$o.create({...t,browser_id:this.browserId,tab_id:this.tabId})});return $o.ResultSchema.parse(r)}},Qf=mr({capability:Ma,info:_E});var em={id:"webmcp",description:"List and invoke page-defined WebMCP tools registered through navigator.modelContext in the active tab."};var Fa=class extends yt{constructor({browserId:t,documentation:r,info:n,tabId:o,transport:i}){super(i,t,o,r,n)}async listTools(){return(await this.transport.send({command:Ss.create({browser_id:this.browserId,tab_id:this.tabId})})).tools.map(r=>this.toTool(r))}async invokeTool({input:t,timeoutMs:r,toolName:n}){let o=n.trim();if(!o)throw new Error("tab.capabilities.webmcp.invokeTool requires a toolName");return(await this.transport.send({command:vs.create({browser_id:this.browserId,tab_id:this.tabId,tool_name:o,input:t,...r==null?{}:{timeout_ms:r}})})).result}toTool(t){return{name:t.name,...t.title==null?{}:{title:t.title},...t.description==null?{}:{description:t.description},inputSchema:t.input_schema,...t.annotations==null?{}:{annotations:t.annotations},...t.origin==null?{}:{origin:t.origin},...t.pageUrl==null?{}:{pageUrl:t.pageUrl},invoke:async(r,n)=>await this.invokeTool({toolName:t.name,input:r,...n?.timeoutMs==null?{}:{timeoutMs:n.timeoutMs}})}}},cn=mr({capability:Fa,info:em,internalOnly:!0});var wE=[Uo,Oa,Qf,cn],N6=O6(wE),xE=({browserId:e,capabilities:t,documentation:r,tabId:n,transport:o})=>{let i={};for(let s of t??[]){let a=N6.get(s.id);a!=null&&Object.assign(i,{[s.id]:a({browserId:e,documentation:r,info:s,tabId:n,transport:o})})}return new Fo(i)},SE=e=>Kl({capabilities:e,definitions:wE,heading:"Tab Capabilities",scope:"tab"});function O6(e){return new Map(e.map(t=>[t.id,t.create]))}var Ba=class{#e;#r;constructor({browserId:t,capabilities:r,documentation:n,transport:o,tabPayload:i={}}){if(!i.id)throw new Error("Tab requires an id");this.#e=t,this.#r=o,this.id=i.id,this.playwright=new Ta({browserId:t,tabId:this.id,transport:this.#r}),this.dom_cua=new Aa({browserId:t,tabId:this.id,transport:this.#r}),this.cua=new ka({browserId:t,tabId:this.id,transport:this.#r}),this.content=new Ia({browserId:t,tabId:this.id,transport:this.#r}),this.clipboard=new Ra({browserId:t,tabId:this.id,transport:this.#r}),this.dev=new Pa({browserId:t,tabId:this.id,transport:this.#r}),this.capabilities=xE({browserId:this.#e,capabilities:r,documentation:n,tabId:this.id,transport:this.#r})}async goto(t){if(!t)throw new Error("tab.goto requires a url");if(this.#t(),!this.id)throw new Error("tab.goto requires a tab id");await this.#r.send({command:Es.create({browser_id:this.#e,tab_id:this.id,url:t})})}async back(){this.#t(),await this.#r.send({command:an.create({browser_id:this.#e,tab_id:this.id})})}async forward(){this.#t(),await this.#r.send({command:un.create({browser_id:this.#e,tab_id:this.id})})}async reload(){this.#t(),await this.#r.send({command:Cs.create({browser_id:this.#e,tab_id:this.id})})}async close(){this.#t(),await this.#r.send({command:bs.create({browser_id:this.#e,tab_id:this.id})})}async screenshot(t={}){this.#t();let r={browser_id:this.#e,tab_id:this.id,fullPage:t.fullPage};if(t.clip){let{x:o,y:i,width:s,height:a}=t.clip;if(typeof o!="number"||typeof i!="number"||typeof s!="number"||typeof a!="number")throw new Error("tab.screenshot clip requires x, y, width, and height");r.cropX=o,r.cropY=i,r.cropWidth=s,r.cropHeight=a}let n=await this.#r.send({command:Ms.create(r)});return $l(n.data)}async title(){return(await this.#n())?.title}async url(){return(await this.#n())?.url}#t(){if(!this.#r)throw new Error("Tab is not bound to a transport")}async#n(){this.#t();let r=(await this.#r.send({command:sn.create({browser_id:this.#e})})).tabs.find(n=>n.id===this.id);if(r)return{title:r.title,url:r.url}}};var Wo={};C(Wo,{PayloadSchema:()=>vE,ResultSchema:()=>M6,commandType:()=>Yl,create:()=>F6});var Yl="browser_visibility_get",vE=c.object({browser_id:c.string()}),M6=c.object({visible:c.boolean()});function F6(e){return new g(Yl,vE,e)}var Ho={};C(Ho,{PayloadSchema:()=>EE,ResultSchema:()=>B6,commandType:()=>Zl,create:()=>L6});var Zl="browser_visibility_set",EE=c.object({browser_id:c.string(),visible:c.boolean()}),B6=c.object({});function L6(e){return new g(Zl,EE,e)}var Tie={[Yl]:Wo,[Zl]:Ho};var TE={id:"visibility",description:"Use to show or hide the browser to the user, and to determine the browser's current visibility. Keep browser work in the background unless the user asks to see it or live viewing is useful. When the browser should be visible, call set(true)."};var La=class extends Mo{constructor({browserId:t,documentation:r,info:n,transport:o}){super(o,t,r,n)}async set(t){let r=await this.transport.send({command:Ho.create({browser_id:this.browserId,visible:t})});Ho.ResultSchema.parse(r)}async get(){let t=await this.transport.send({command:Wo.create({browser_id:this.browserId})});return Wo.ResultSchema.parse(t).visible}},tm=Gl({capability:La,info:TE});var Vo={};C(Vo,{PayloadSchema:()=>AE,ResultSchema:()=>U6,commandType:()=>Xl,create:()=>j6});var Xl="browser_viewport_reset",AE=c.object({browser_id:c.string()}),U6=c.object({});function j6(e){return new g(Xl,AE,e)}var Go={};C(Go,{PayloadSchema:()=>kE,ResultSchema:()=>q6,commandType:()=>Ql,create:()=>$6});var Ql="browser_viewport_set",kE=c.object({browser_id:c.string(),height:c.number().int().positive(),width:c.number().int().positive()}),q6=c.object({});function $6(e){return new g(Ql,kE,e)}var Mie={[Xl]:Vo,[Ql]:Go};var RE={id:"viewport",description:"Controls an explicit browser viewport override for responsive or device-size testing. Use it when a task calls for specific dimensions or breakpoint validation; otherwise leave it unset so the browser uses its normal 1280x720 viewport. Reset temporary overrides before finishing unless the user asked to keep them."};var Ua=class extends Mo{constructor({browserId:t,documentation:r,info:n,transport:o}){super(o,t,r,n)}async set(t){let r=await this.transport.send({command:Go.create({browser_id:this.browserId,...t})});Go.ResultSchema.parse(r)}async reset(){let t=await this.transport.send({command:Vo.create({browser_id:this.browserId})});Vo.ResultSchema.parse(t)}},rm=Gl({capability:Ua,info:RE});var PE=[tm,rm],z6=W6(PE),DE=({browserId:e,capabilities:t,documentation:r,transport:n})=>{let o={};for(let i of t??[]){let s=z6.get(i.id);s!=null&&(o[i.id]=s({browserId:e,documentation:r,info:i,transport:n}))}return new Fo(o)},NE=e=>Kl({capabilities:e,definitions:PE,heading:"Browser Capabilities",scope:"browser"});function W6(e){return new Map(e.map(t=>[t.id,t.create]))}var ja=class{#e;#r;#t;constructor({capabilities:t,documentation:r,transport:n,browserId:o}){this.#e=t,this.#r=r,this.#t=n,this.browserId=o,this.capabilities=DE({browserId:o,capabilities:t?.browser,documentation:r,transport:n});let i=s=>new Ba({browserId:o,capabilities:t?.tab,documentation:r,transport:n,tabPayload:s});this.tabs=new va({browserId:o,createTab:i,transport:n}),this.user=new Ea({browserId:o,createTab:i,transport:n})}async documentation(){let t=["## Additional Capabilities",NE(this.#e?.browser),SE(this.#e?.tab)].join(`
`),[r,n]=await Promise.all([this.#r.get("api"),this.#r.get("playwright").catch(o=>{if(!H6(o))throw o})]);return[t,n,r].filter(o=>o!=null).join(`

`)}async nameSession(t){let r=t.trim();if(!r)throw new Error("browser.nameSession requires a name");await this.#t.send({command:_s.create({browser_id:this.browserId,name:r})})}};function H6(e){return e!=null&&typeof e=="object"&&"code"in e&&e.code==="ENOENT"}var qa=class{#e;#r;#t;constructor({browserInfos:t=[],documentation:r,transport:n}){this.#e=t,this.#r=r,this.#t=n}async list(){return this.#e}async get(t){if(!t)throw new Error("browsers.get requires a browser id");let r=this.#e.find(n=>n.id===t||n.type===t);if(r==null)throw new Error(`Browser is not available: ${t}`);return new ja({capabilities:r.capabilities,documentation:this.#r,transport:this.#t,browserId:t})}};var $a=class{constructor({browserInfos:t,documentation:r,transport:n}){if(!n)throw new Error("Agent requires a transport instance");this.documentation=r,this.browsers=new qa({browserInfos:t,documentation:this.documentation,transport:n})}};var V6=async e=>{throw new Error(`Documentation is not available: ${e}`)},za=class{#e;constructor(t=V6){this.#e=t}async get(t){return await this.#e(t)}};var Wa=class{constructor({executeAgentCommand:t,displaySideEffect:r}={}){if(typeof t!="function")throw new Error("FunctionAgentTransport requires an executeAgentCommand function");this.executeAgentCommand=t,this.displaySideEffect=r??J6}async display(t){await this.displaySideEffect(t)}async send({command:t,timeoutMs:r}){let n=t.toJSON(),o=await this.executeAgentCommand({...n,client_timeout_ms:typeof r=="number"&&r>0?r:void 0}),i=await G6(o,this.displaySideEffect);if(i==null)throw new Error("transport send returned empty response");return i}},G6=async(e,t)=>{let r=K6.safeParse(e);if(!r.success)return e;for(let i of r.data.side_effects)await t(i);let{side_effects:n,...o}=r.data;return o},K6=c.object({side_effects:c.array(c.string())}).passthrough(),J6=async e=>{let t=globalThis.display;if(typeof t=="function"){await t(e);return}console.log(e)};var qh={};C(qh,{BrowserAuthHandoffCommand:()=>MT,BrowserUserClaimTabCommand:()=>sT,BrowserUserHistoryCommand:()=>aT,BrowserUserOpenTabsCommand:()=>uT,CloseTabCommand:()=>a1,CreateTabCommand:()=>u1,CuaClickCommand:()=>qE,CuaDoubleClickCommand:()=>$E,CuaDragCommand:()=>zE,CuaKeypressCommand:()=>XE,CuaMoveCommand:()=>QE,CuaScrollCommand:()=>eC,CuaTypeCommand:()=>wh,DomCuaClickCommand:()=>jT,DomCuaDoubleClickCommand:()=>qT,DomCuaGetVisibleDomCommand:()=>t1,DomCuaKeypressCommand:()=>i1,DomCuaScrollCommand:()=>s1,DomCuaTypeCommand:()=>Fh,FinalizeTabsCommand:()=>l1,ListTabsCommand:()=>c1,NameSessionCommand:()=>d1,NavigateTabBackCommand:()=>p1,NavigateTabForwardCommand:()=>f1,NavigateTabReloadCommand:()=>m1,NavigateTabUrlCommand:()=>y1,PlaywrightDomSnapshotCommand:()=>x1,PlaywrightDownloadPathCommand:()=>C1,PlaywrightEvaluateCommand:()=>_A,PlaywrightFileChooserSetFilesCommand:()=>T1,PlaywrightLocatorAllTextContentsCommand:()=>P1,PlaywrightLocatorClickCommand:()=>jc,PlaywrightLocatorCountCommand:()=>qc,PlaywrightLocatorDblclickCommand:()=>A1,PlaywrightLocatorDownloadMediaCommand:()=>k1,PlaywrightLocatorFillCommand:()=>ii,PlaywrightLocatorGetAttributeCommand:()=>I1,PlaywrightLocatorInnerTextCommand:()=>R1,PlaywrightLocatorIsEnabledCommand:()=>$c,PlaywrightLocatorIsVisibleCommand:()=>zc,PlaywrightLocatorPressCommand:()=>Wc,PlaywrightLocatorReadAllCommand:()=>M1,PlaywrightLocatorSelectOptionCommand:()=>D1,PlaywrightLocatorSetCheckedCommand:()=>N1,PlaywrightLocatorTextContentCommand:()=>O1,PlaywrightLocatorWaitForCommand:()=>F1,PlaywrightWaitForDownloadCommand:()=>B1,PlaywrightWaitForFileChooserCommand:()=>L1,PlaywrightWaitForLoadStateCommand:()=>q1,PlaywrightWaitForTimeoutCommand:()=>$1,PlaywrightWaitForURLCommand:()=>H1,SelectedTabCommand:()=>V1,TabCdpCallCommand:()=>uA,TabCdpEventsCommand:()=>lA,TabClipboardReadCommand:()=>K1,TabClipboardReadTextCommand:()=>Y1,TabClipboardWriteCommand:()=>iT,TabClipboardWriteTextCommand:()=>Z1,TabContentExportGSuiteCommand:()=>pA,TabDevLogsCommand:()=>fA,TabPageAssetsBundleCommand:()=>xA,TabPageAssetsListCommand:()=>SA,TabScreenshotCommand:()=>gA,WebMcpInvokeToolCommand:()=>LT,WebMcpListToolsCommand:()=>UT});import{AsyncLocalStorage as Y6}from"node:async_hooks";var OE={end(){}},im=new Y6,Z6={cua_click:{action:"click",name:"browser_use.tab.click"},cua_double_click:{action:"dblclick",name:"browser_use.tab.click"},cua_type:{action:"type",name:"browser_use.tab.type"},navigate_tab_url:{attrs:e=>({"url.origin":X6(nm(e,"url"))}),name:"browser_use.tab.goto"},playwright_dom_snapshot:{attrs:()=>({"browser_use.playwright.snapshot.mode":"ai","browser_use.playwright.snapshot.target":"body_or_document"}),name:"browser_use.playwright.dom_snapshot",operation:"dom_snapshot",resultAttrs:e=>{let t=nm(e,"dom_snapshot")??"";return{"browser_use.playwright.snapshot.length":t.length,"browser_use.playwright.snapshot.line_count":tU(t)}}},playwright_locator_click:{action:"click",name:"browser_use.tab.click"},playwright_locator_dblclick:{action:"dblclick",name:"browser_use.tab.click"},playwright_locator_fill:{action:"fill",name:"browser_use.tab.type"},playwright_locator_press:{action:"press",name:"browser_use.tab.type"},playwright_locator_set_checked:{action:"set_checked",name:"browser_use.tab.click"},tab_screenshot:{name:"browser_use.tab.screenshot"},playwright_wait_for_load_state:{attrs:e=>({"load.state":nm(e,"state")??"load"}),name:"browser_use.tab.wait_for_load_state"},playwright_wait_for_timeout:{name:"browser_use.tab.wait_for_timeout"}};async function sm(e,t,r,n={}){let o=om(t),i=UE();if(i?.withSpan)return await i.withSpan(e,o,r,n);let s=rU(e,o);try{let a=await r();return ME(s,{attrs:om(n.resultAttrs?.(a)??{}),status:"ok"}),a}catch(a){throw ME(s,{attrs:{"error.kind":nU(a)},status:"error"}),a}}async function ec(e,t,r){let n=Z6[e],o={commandType:e,playwrightOperation:n?.operation??e};return await im.run(o,async()=>n==null?await r():await sm(n.name,{"browser.action":n.action,"browser_use.command.type":e,"browser_use.playwright.operation":n.operation,...Q6(t),...eU(t),...n.attrs?.(t)},r,{resultAttrs:n.resultAttrs}))}function FE(){let e=im.getStore();return e==null?{}:{"browser_use.command.type":e.commandType}}function hr(e){return im.getStore()?.playwrightOperation??e}function X6(e){if(e!=null)try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t.origin:t.protocol.replace(/:$/,"")}catch{return}}function Q6(e){let t=BE(e,"tab_id");return{"browser_use.tab.id":t,"tab.id":t}}function eU(e){return{timeout_ms:BE(e,"timeout_ms")}}function BE(e,t){if(!LE(e))return;let r=e[t],n=typeof r=="string"?Number(r):r;return typeof n=="number"&&Number.isFinite(n)?n:void 0}function nm(e,t){if(!LE(e))return;let r=e[t];return typeof r=="string"?r:void 0}function LE(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function tU(e){return e===""?0:e.split(`
`).length}function UE(){return globalThis.nodeRepl?.telemetry}function rU(e,t){try{return UE()?.startSpan(e,om(t))??OE}catch{return OE}}function ME(e,t){try{e.end(t)}catch{}}function om(e){return Object.fromEntries(Object.entries(e).filter(t=>{let r=t[1];return typeof r=="boolean"||typeof r=="number"||typeof r=="string"}))}function nU(e){return e instanceof Error&&e.name?e.name:typeof e}function y(e,t){let r=typeof e=="string"?e:e.commandType,n=(async(o,i)=>await ec(r,o,async()=>t(o,i)));return n.type=r,n}import{platform as oU}from"node:os";function am(e){return e==="ControlOrMeta"?um()?"Meta":"Control":e}function dn(e){if(!e)return 0;let t=0;for(let r of e)switch(am(r)){case"Alt":t|=1;break;case"Control":t|=2;break;case"Meta":t|=4;break;case"Shift":t|=8;break}return t}function um(){return oU()==="darwin"}function _t(e,t){if(!Number.isFinite(t.x)||!Number.isFinite(t.y))throw new Error(`${e} requires finite x and y coordinates`)}function wt(e){return dn(e)}function jE(e){switch(e){case void 0:case 1:return"left";case 2:return"middle";case 3:return"right";default:throw new Error(`Unsupported CUA mouse button: ${e}`)}}function A(e){let t=Number(e);if(!Number.isInteger(t)||t<=0)throw new Error("Expected a positive integer");return t}function se(e){let t=typeof e.timeout_ms=="number"?e.timeout_ms:3e3;return Math.min(Math.max(0,t),e.max||3e3)}function iU(e,t,r){let n={x:r[0]??0,y:r[1]??0},o={x:r[2]??0,y:r[3]??0},i={x:r[6]??0,y:r[7]??0},s=e.x/t.width,a=e.y/t.height;return{x:n.x+s*(o.x-n.x)+a*(i.x-n.x),y:n.y+s*(o.y-n.y)+a*(i.y-n.y)}}function tc(e,t,r){if(r==null||r.length<8)return null;if(t!=null)return iU(e,t,r);let n=sU(r);return n==null?null:{x:n.left+e.x,y:n.top+e.y}}function sU(e){if(e==null||e.length<8)return null;let t=[e[0],e[2],e[4],e[6]],r=[e[1],e[3],e[5],e[7]];return t.some(n=>n==null)||r.some(n=>n==null)?null:{bottom:Math.max(...r),left:Math.min(...t),right:Math.max(...t),top:Math.min(...r)}}var qE=y("cua_click",async(e,t)=>{let r=A(e.tab_id);return _t("cua_click",e),await t.cua.clickPoint({button:jE(e.button),clickCount:1,modifiers:wt(e.keys),point:{x:e.x,y:e.y},tabId:r,timeoutMs:1e4}),{}});var $E=y("cua_double_click",async(e,t)=>{let r=A(e.tab_id);return _t("cua_double_click",e),await t.cua.clickPoint({clickCount:2,modifiers:wt(e.keys),point:{x:e.x,y:e.y},tabId:r,timeoutMs:1e4}),{}});var zE=y("cua_drag",async(e,t)=>{let r=A(e.tab_id),n=wt(e.keys);if(e.path.length===0)throw new Error("cua_drag requires a non-empty path");for(let o of e.path)_t("cua_drag",o);return await t.cua.dragPath({modifiers:n,path:e.path,tabId:r}),{}});var aU="__codexIabExpectedInputTargetToken";var WE=0;function rc(e){if(e===!0)return typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():(WE+=1,`iab-input-${Date.now()}-${WE}-${Math.random().toString(36).slice(2)}`)}function lm(e,t){return t==null?e:{...e,[aU]:t}}async function ic(e,t,r,n={}){let o=new cm(e,uU(t),n.iabInputTargetToken),i=Array.isArray(r)?r.flatMap(oc):oc(r),s=VE(i),a=s[s.length-1];if(!a)throw new Error("keypress requires at least one key");if(HE(s)!=null)throw new Error("Native clipboard shortcuts are disabled; use Browser Use virtual clipboard commands instead.");for(let u of s.slice(0,-1))await o.down(u);await o.down(a),await o.up(a);for(let u of s.slice(0,-1).reverse())await o.up(u)}function Ko(e){let t=Array.isArray(e)?e.flatMap(oc):oc(e);return HE(VE(t))}var cm=class{constructor(t,r,n){this.cdp=t;this.target=r;this.iabInputTargetToken=n}cdp;target;iabInputTargetToken;pressedModifiers=new Set;async down(t){let r=nc(t,this.pressedModifiers),n=dm(r.key);n&&this.pressedModifiers.add(n);let o=this.keyText(r),i=dU(r.code,this.pressedModifiers);await this.callInputDispatch(lm({type:o?"keyDown":"rawKeyDown",modifiers:dn(this.pressedModifiers),windowsVirtualKeyCode:r.keyCodeWithoutLocation,code:r.code,...i.length>0?{commands:i}:{},key:r.key,text:o,unmodifiedText:o,location:r.location,isKeypad:r.location===GE},this.iabInputTargetToken))}async up(t){let r=nc(t,this.pressedModifiers),n=dm(r.key);n&&this.pressedModifiers.delete(n),await this.callInputDispatch(lm({type:"keyUp",modifiers:dn(this.pressedModifiers),windowsVirtualKeyCode:r.keyCodeWithoutLocation,code:r.code,key:r.key,location:r.location},this.iabInputTargetToken))}keyText(t){return this.pressedModifiers.size===0||this.pressedModifiers.size===1&&this.pressedModifiers.has("Shift")?t.text:""}async callInputDispatch(t){if(this.target.sessionId==null&&this.target.targetId==null){await this.cdp.call(this.target.tabId,"Input.dispatchKeyEvent",t);return}await this.cdp.callTarget(this.target,"Input.dispatchKeyEvent",t)}};function uU(e){return typeof e=="object"?e:{tabId:e}}function HE(e){let t=new Set;for(let o of e.slice(0,-1)){let i=nc(o,t),s=dm(i.key);s&&t.add(s)}let r=e[e.length-1];if(r==null)return null;let n=nc(r,t);return fU(n.code,t)?"paste":pU(n.code,t)?"blocked":null}function nc(e,t){let r=am(e),n=KE.get(r);if(!n)throw new Error(`Unknown key: "${e}"`);return t.has("Shift")&&n.shifted?n.shifted:n}function oc(e){let t=[],r="";for(let n of e)n==="+"&&r?(t.push(r),r=""):r+=n;return r&&t.push(r),t}function VE(e){let t=yU.get(cU(e));return t||e.map(lU)}function lU(e){return KE.has(e)?e:bU.get(e.toLowerCase())??e}function cU(e){return e.map(t=>t.toLowerCase()).join("+")}function dm(e){switch(e){case"Alt":case"Control":case"Meta":case"Shift":return e;default:return}}function dU(e,t){if(!um())return[];let n=[...mU.filter(i=>t.has(i)),e].join("+"),o=gU.get(n);return o?[o]:[]}function pU(e,t){return(t.has("Meta")||t.has("Control"))&&hU.has(e)||e==="Insert"&&(t.has("Control")||t.has("Shift"))}function fU(e,t){let r=(t.has("Meta")||t.has("Control"))&&!(t.has("Meta")&&t.has("Control"));return e==="KeyV"&&r&&t.size===1}var GE=3,mU=["Shift","Control","Alt","Meta"],hU=new Set(["KeyC","KeyV","KeyX"]),gU=new Map([["Backspace","deleteBackward"],["Delete","deleteForward"],["Meta+KeyA","selectAll"],["Meta+KeyZ","undo"],["Shift+Meta+KeyZ","redo"]]),bU=new Map([["alt","Alt"],["option","Alt"],["control","Control"],["controlormeta","ControlOrMeta"],["ctrl","ControlOrMeta"],["cmd","Meta"],["meta","Meta"],["win","Meta"],["super","Meta"],["shift","Shift"],["capslock","CapsLock"],["esc","Escape"],["escape","Escape"],["enter","Enter"],["return","Enter"],["backspace","Backspace"],["delete","Delete"],["del","Delete"],["tab","Tab"],["space","Space"],["left","ArrowLeft"],["arrowleft","ArrowLeft"],["right","ArrowRight"],["arrowright","ArrowRight"],["up","ArrowUp"],["arrowup","ArrowUp"],["down","ArrowDown"],["arrowdown","ArrowDown"],["home","Home"],["end","End"],["insert","Insert"],["pageup","PageUp"],["pagedown","PageDown"]]),yU=new Map([["ctrl+a",["ControlOrMeta","a"]],["ctrl+c",["ControlOrMeta","c"]],["ctrl+l",["ControlOrMeta","l"]],["ctrl+n",["ControlOrMeta","n"]],["ctrl+shift+v",["ControlOrMeta","Shift","v"]],["ctrl+v",["ControlOrMeta","v"]],["ctrl+x",["ControlOrMeta","x"]],["ctrl+y",["ControlOrMeta","Shift","z"]],["ctrl+z",["ControlOrMeta","z"]]]),_U=new Map([["AltLeft",["Alt"]],["ControlLeft",["Control"]],["Enter",[`
`,"\r"]],["MetaLeft",["Meta"]],["ShiftLeft",["Shift"]]]),KE=wU({Escape:{keyCode:27,key:"Escape"},F1:{keyCode:112,key:"F1"},F2:{keyCode:113,key:"F2"},F3:{keyCode:114,key:"F3"},F4:{keyCode:115,key:"F4"},F5:{keyCode:116,key:"F5"},F6:{keyCode:117,key:"F6"},F7:{keyCode:118,key:"F7"},F8:{keyCode:119,key:"F8"},F9:{keyCode:120,key:"F9"},F10:{keyCode:121,key:"F10"},F11:{keyCode:122,key:"F11"},F12:{keyCode:123,key:"F12"},Backquote:{keyCode:192,shiftKey:"~",key:"`"},Digit1:{keyCode:49,shiftKey:"!",key:"1"},Digit2:{keyCode:50,shiftKey:"@",key:"2"},Digit3:{keyCode:51,shiftKey:"#",key:"3"},Digit4:{keyCode:52,shiftKey:"$",key:"4"},Digit5:{keyCode:53,shiftKey:"%",key:"5"},Digit6:{keyCode:54,shiftKey:"^",key:"6"},Digit7:{keyCode:55,shiftKey:"&",key:"7"},Digit8:{keyCode:56,shiftKey:"*",key:"8"},Digit9:{keyCode:57,shiftKey:"(",key:"9"},Digit0:{keyCode:48,shiftKey:")",key:"0"},Minus:{keyCode:189,shiftKey:"_",key:"-"},Equal:{keyCode:187,shiftKey:"+",key:"="},Backslash:{keyCode:220,shiftKey:"|",key:"\\"},Backspace:{keyCode:8,key:"Backspace"},Tab:{keyCode:9,key:"Tab"},KeyQ:{keyCode:81,shiftKey:"Q",key:"q"},KeyW:{keyCode:87,shiftKey:"W",key:"w"},KeyE:{keyCode:69,shiftKey:"E",key:"e"},KeyR:{keyCode:82,shiftKey:"R",key:"r"},KeyT:{keyCode:84,shiftKey:"T",key:"t"},KeyY:{keyCode:89,shiftKey:"Y",key:"y"},KeyU:{keyCode:85,shiftKey:"U",key:"u"},KeyI:{keyCode:73,shiftKey:"I",key:"i"},KeyO:{keyCode:79,shiftKey:"O",key:"o"},KeyP:{keyCode:80,shiftKey:"P",key:"p"},BracketLeft:{keyCode:219,shiftKey:"{",key:"["},BracketRight:{keyCode:221,shiftKey:"}",key:"]"},CapsLock:{keyCode:20,key:"CapsLock"},KeyA:{keyCode:65,shiftKey:"A",key:"a"},KeyS:{keyCode:83,shiftKey:"S",key:"s"},KeyD:{keyCode:68,shiftKey:"D",key:"d"},KeyF:{keyCode:70,shiftKey:"F",key:"f"},KeyG:{keyCode:71,shiftKey:"G",key:"g"},KeyH:{keyCode:72,shiftKey:"H",key:"h"},KeyJ:{keyCode:74,shiftKey:"J",key:"j"},KeyK:{keyCode:75,shiftKey:"K",key:"k"},KeyL:{keyCode:76,shiftKey:"L",key:"l"},Semicolon:{keyCode:186,shiftKey:":",key:";"},Quote:{keyCode:222,shiftKey:'"',key:"'"},Enter:{keyCode:13,key:"Enter",text:"\r"},ShiftLeft:{keyCode:160,keyCodeWithoutLocation:16,key:"Shift",location:1},KeyZ:{keyCode:90,shiftKey:"Z",key:"z"},KeyX:{keyCode:88,shiftKey:"X",key:"x"},KeyC:{keyCode:67,shiftKey:"C",key:"c"},KeyV:{keyCode:86,shiftKey:"V",key:"v"},KeyB:{keyCode:66,shiftKey:"B",key:"b"},KeyN:{keyCode:78,shiftKey:"N",key:"n"},KeyM:{keyCode:77,shiftKey:"M",key:"m"},Comma:{keyCode:188,shiftKey:"<",key:","},Period:{keyCode:190,shiftKey:">",key:"."},Slash:{keyCode:191,shiftKey:"?",key:"/"},ShiftRight:{keyCode:161,keyCodeWithoutLocation:16,key:"Shift",location:2},ControlLeft:{keyCode:162,keyCodeWithoutLocation:17,key:"Control",location:1},MetaLeft:{keyCode:91,key:"Meta",location:1},AltLeft:{keyCode:164,keyCodeWithoutLocation:18,key:"Alt",location:1},Space:{keyCode:32,key:" "},AltRight:{keyCode:165,keyCodeWithoutLocation:18,key:"Alt",location:2},AltGraph:{keyCode:225,key:"AltGraph"},MetaRight:{keyCode:92,key:"Meta",location:2},ContextMenu:{keyCode:93,key:"ContextMenu"},ControlRight:{keyCode:163,keyCodeWithoutLocation:17,key:"Control",location:2},PageUp:{keyCode:33,key:"PageUp"},PageDown:{keyCode:34,key:"PageDown"},Insert:{keyCode:45,key:"Insert"},Delete:{keyCode:46,key:"Delete"},Home:{keyCode:36,key:"Home"},End:{keyCode:35,key:"End"},ArrowLeft:{keyCode:37,key:"ArrowLeft"},ArrowUp:{keyCode:38,key:"ArrowUp"},ArrowRight:{keyCode:39,key:"ArrowRight"},ArrowDown:{keyCode:40,key:"ArrowDown"},NumpadEnter:{keyCode:13,key:"Enter",text:"\r",location:GE}});function wU(e){let t=new Map;for(let[r,n]of Object.entries(e)){let o={key:n.key,keyCode:n.keyCode,keyCodeWithoutLocation:n.keyCodeWithoutLocation??n.keyCode,code:r,text:n.text??"",location:n.location??0};n.key.length===1&&(o.text=n.key);let i;n.shiftKey&&(i={...o,key:n.shiftKey,keyCode:n.shiftKeyCode??o.keyCode,text:n.shiftKey},o.shifted=i),t.set(r,o);for(let s of _U.get(r)??[])t.set(s,o);n.location||(o.key.length===1&&t.set(o.key,o),i&&t.set(i.key,{...i,shifted:void 0}))}return t}var pm=new WeakMap,JE=new WeakSet,fm="const __name = (target) => target;",xU=()=>{let e=globalThis,t=Object.prototype.hasOwnProperty.call(navigator,"clipboard"),r=Object.getOwnPropertyDescriptor(navigator,"clipboard"),n=e.__browserUseFakeClipboard??={installed:!1,items:[]};if(n.installed)return;let o=f=>{let m=new Uint8Array(f),h=32768,_="";for(let S=0;S<m.length;S+=h){let D=m.subarray(S,S+h);_+=String.fromCharCode(...D)}return btoa(_)},i=f=>{let m=atob(f),h=new Uint8Array(m.length);for(let _=0;_<m.length;_+=1)h[_]=m.charCodeAt(_);return h.buffer},s=f=>typeof f.text=="string"?new Blob([f.text],{type:f.mime_type}):new Blob([i(f.base64??"")],{type:f.mime_type}),a=f=>({types:f.entries.map(h=>h.mime_type),presentationStyle:f.presentation_style??"unspecified",getType:async h=>{let _=f.entries.find(S=>S.mime_type===h);if(_==null)throw new DOMException(`No fake clipboard entry for ${h}`,"NotFoundError");return s(_)}}),u=async f=>Promise.all(f.map(async m=>({entries:await Promise.all(m.types.map(async _=>{let S=await m.getType(_);return _.startsWith("text/")?{mime_type:_,text:await S.text()}:{mime_type:_,base64:o(await S.arrayBuffer())}})),presentation_style:m.presentationStyle??"unspecified"}))),l=()=>n.items.flatMap(f=>f.entries).find(f=>f.mime_type==="text/plain")?.text??"",d={read:async()=>n.items.map(a),readText:async()=>l(),write:async f=>{n.items=await u(Array.from(f))},writeText:async f=>{n.items=[{entries:[{mime_type:"text/plain",text:f}],presentation_style:"unspecified"}]},addEventListener:()=>{},dispatchEvent:()=>!0,removeEventListener:()=>{}};Object.defineProperty(d,"__browserUseFakeClipboard",{value:!0});let p={configurable:!0,get:()=>d};Object.defineProperty(navigator,"clipboard",p),e.__browserUseFakeClipboardCleanup=()=>{Object.getOwnPropertyDescriptor(navigator,"clipboard")?.get===p.get&&(t&&r!=null?Object.defineProperty(navigator,"clipboard",r):Reflect.deleteProperty(navigator,"clipboard")),n.items=[],n.installed=!1,delete e.__browserUseFakeClipboard,delete e.__browserUseFakeClipboardCleanup},n.installed=!0},SU=()=>{globalThis.__browserUseFakeClipboardCleanup?.()},sc=async(e={})=>{let t=w=>{if(w==null||typeof w!="object"||!("ownerDocument"in w))return null;let E=w.ownerDocument?.defaultView??null;return E==null?null:w instanceof E.Element?w:null},r=w=>w.ownerDocument.defaultView??window,n=w=>{let x=w.activeElement;if(x==null)return null;let E=r(x);if(x instanceof E.HTMLElement&&x.shadowRoot!=null)return n(x.shadowRoot)??x;if(x instanceof E.HTMLIFrameElement||x instanceof E.HTMLFrameElement)try{let I=x.contentDocument??x.contentWindow?.document??null;if(I!=null)return n(I)??x}catch{return x}return x},o=(w,x)=>{if(x==null)return;let E=t(w);if((E??null)?.__codexIabInputTargetToken!==x)throw new Error("Active element is no longer the expected input target")},i=async(w,x)=>{for(let E of w)if(E.types.includes(x))return await(await E.getType(x)).text();return""},s=async(w,x,E)=>{w.clearData();for(let I of x)for(let T of I.types){let q=await I.getType(T);if(T.startsWith("text/")){w.setData(T,await q.text());continue}let X=T.split("/")[1]??"bin";w.items.add(new E.File([q],`clipboard.${X}`,{type:T}))}},a=(w,x,E,I)=>{let T=t(w);if(T==null)return;let q=r(T);if(T instanceof q.HTMLTextAreaElement||T instanceof q.HTMLInputElement){if(E.length===0)return;let X=ae=>{let we=Object.getPrototypeOf(T),he=Object.getOwnPropertyDescriptor(we,"value")?.set,M=Object.getOwnPropertyDescriptor(T,"value")?.set;if(he!=null&&M!==he){he.call(T,ae);return}T.value=ae};if(T.selectionStart==null||T.selectionEnd==null)X(I?E:T.value+E);else{let ae=T.selectionStart??T.value.length,we=T.selectionEnd??T.value.length;try{T.setRangeText(E,ae,we,"end")}catch{X(I?E:T.value+E)}}T.dispatchEvent(new q.InputEvent("input",{bubbles:!0}));return}if(T instanceof q.HTMLElement&&(T.isContentEditable||T.closest("[contenteditable=true]"))){if(T.focus(),x.length>0){T.ownerDocument.execCommand("insertHTML",!1,x);return}E.length>0&&T.ownerDocument.execCommand("insertText",!1,E)}};if(navigator.clipboard?.read==null)throw new Error("navigator.clipboard.read is not available");let u=await navigator.clipboard.read();if(u.length===0)throw new Error("Browser Use virtual clipboard has no data to paste");let l=n(document)??document.body;o(l,e.iabInputTargetToken);let d=t(l),p=d==null?window:r(d),f=await i(u,"text/html"),m=await i(u,"text/plain"),h=p.navigator.clipboard;if(h?.__browserUseFakeClipboard===!0&&h!==navigator.clipboard&&await h.write(u),typeof p.DataTransfer!="function"||typeof p.ClipboardEvent!="function"){a(l,f,m,e.replaceInputValue===!0);return}let _=new p.DataTransfer;await s(_,u,p);let S=new p.ClipboardEvent("paste",{bubbles:!0,cancelable:!0,clipboardData:_,composed:!0});l.dispatchEvent(S)&&!S.defaultPrevented&&a(l,f,m,e.replaceInputValue===!0)},YE=()=>{let e=globalThis,t=navigator.clipboard;if(e.__browserUseFakeClipboard?.installed!==!0||t?.__browserUseFakeClipboard!==!0)throw new Error("Browser Use virtual clipboard is not installed")};function vU(){return`(() => {
    ${fm}
    const installFakeClipboard = ${xU.toString()};
    installFakeClipboard();
    const assertFakeClipboardInstalled = ${YE.toString()};
    assertFakeClipboardInstalled();
  })()`}function EU(){return`(() => {
    ${fm}
    const cleanupFakeClipboard = ${SU.toString()};
    cleanupFakeClipboard();
  })()`}function CU(e){JE.has(e)||(JE.add(e),e.cdp.addTabCleanupHandler(async t=>{await AU(e,t)}))}async function TU(e,t){CU(e);let r=pm.get(e);r==null&&(r=new Map,pm.set(e,r));let n=kU(t),o=r.get(n);o==null&&(o=(async()=>{let i=vU(),s;try{s=(await Jo(e,t,"Page.addScriptToEvaluateOnNewDocument",{runImmediately:!0,source:i})).identifier;let u=await Jo(e,t,"Runtime.evaluate",{expression:i,returnByValue:!0}),l=ZE(u,"Browser Use virtual clipboard install failed");if(l!=null)throw new Error(`Browser Use virtual clipboard install failed: ${l}`);return s==null?{target:t}:{identifier:s,target:t}}catch(a){throw s!=null&&await Jo(e,t,"Page.removeScriptToEvaluateOnNewDocument",{identifier:s}).catch(()=>{}),a}})().catch(i=>{throw r.delete(n),i}),r.set(n,o)),await o}async function AU(e,t){let r=pm.get(e);if(r==null)return;let n=Array.from(r.entries()).filter(([o])=>IU(o,t));for(let[o,i]of n){r.delete(o);let s=await i.catch(()=>{});s!=null&&(await Jo(e,s.target,"Runtime.evaluate",{expression:EU(),returnByValue:!0}).catch(()=>{}),s.identifier!=null&&await Jo(e,s.target,"Page.removeScriptToEvaluateOnNewDocument",{identifier:s.identifier}).catch(()=>{}))}}function kU(e){return e.sessionId!=null?`${e.tabId}:session:${e.sessionId}`:e.targetId!=null?`${e.tabId}:target:${e.targetId}`:`${e.tabId}:`}function IU(e,t){return e===`${t}:`||e.startsWith(`${t}:`)}async function Jo(e,t,r,n){return t.sessionId==null&&t.targetId==null?await e.cdp.call(t.tabId,r,n):await e.cdp.callTarget(t,r,n)}function ZE(e,t){return e.exceptionDetails==null?null:String(e.exceptionDetails.exception?.description??e.exceptionDetails.exception?.value??e.exceptionDetails.text??t)}function ac(e,t){if(!Array.isArray(e)||e.length===0)throw new Error(`${t} requires items`);for(let r of e){if(!Array.isArray(r.entries)||r.entries.length===0)throw new Error(`${t} requires clipboard item entries`);for(let n of r.entries){if(typeof n.mime_type!="string"||n.mime_type.length===0)throw new Error(`${t} requires entry mime_type`);let o=typeof n.text=="string",i=typeof n.base64=="string";if(o===i)throw new Error(`${t} requires exactly one of entry text or base64`)}}}async function Re({args:e,commandType:t,ctx:r,pageFunction:n,tabId:o,target:i}){let s=i??{tabId:o};await TU(r,s);let a=await Jo(r,s,"Runtime.evaluate",{expression:`(
        async () => {
          try {
            ${fm}
            const assertFakeClipboardInstalled = ${YE.toString()};
            assertFakeClipboardInstalled();
            const pageFunction = ${n.toString()};
            const data = await pageFunction(${JSON.stringify(e)});
            return { ok: true, data };
          } catch (error) {
            return {
              ok: false,
              error:
                error instanceof Error
                  ? error.message
                  : String(error),
            };
          }
        }
      )()`,awaitPromise:!0,returnByValue:!0}),u=ZE(a,`${t} failed`);if(u!=null)throw new Error(`Browser Use encountered an error interacting with this webpage's clipboard: ${u}`);if(a.result?.value?.ok!==!0){let l=a.result?.value?.error??`${t} failed`;throw new Error(`Browser Use encountered an error interacting with this webpage's clipboard: ${l}`)}return a.result.value.data}async function Yo({commandType:e,ctx:t,iabInputTargetToken:r,tabId:n,target:o}){await Re({args:r==null?{}:{iabInputTargetToken:r},commandType:e,ctx:t,pageFunction:sc,tabId:A(n),...o!=null?{target:o}:{}})}var XE=y("cua_keypress",async(e,t)=>(Array.isArray(e.keys)?Ko(e.keys):null)==="paste"?(await Yo({commandType:"cua_keypress",ctx:t,tabId:e.tab_id}),{}):(await t.cua.dispatchKeyPress({commandName:"cua_keypress",keys:e.keys,tabId:e.tab_id}),{}));var QE=y("cua_move",async(e,t)=>{let r=A(e.tab_id);return _t("cua_move",e),await t.cua.dispatchMouseMove(r,{x:e.x,y:e.y},wt(e.keys)),{}});var eC=y("cua_scroll",async(e,t)=>{let r=A(e.tab_id);_t("cua_scroll",e);let n=wt(e.keys),o={x:e.x,y:e.y};return await t.cua.scrollPoint({modifiers:n,point:o,scrollX:e.scroll_x,scrollY:e.scroll_y,tabId:r}),{}});var Sm={};C(Sm,{arrayReplaceAt:()=>xm,assign:()=>Qo,escapeHtml:()=>qt,escapeRE:()=>p4,fromCodePoint:()=>Ga,has:()=>t4,isMdAsciiPunct:()=>mn,isPunctChar:()=>fn,isSpace:()=>K,isString:()=>_c,isValidEntityCode:()=>wc,isWhiteSpace:()=>pn,lib:()=>f4,normalizeReference:()=>hn,unescapeAll:()=>jt,unescapeMd:()=>s4});var pc={};C(pc,{decode:()=>Ha,encode:()=>cc,format:()=>Zo,parse:()=>Va});var tC={};function RU(e){let t=tC[e];if(t)return t;t=tC[e]=[];for(let r=0;r<128;r++){let n=String.fromCharCode(r);t.push(n)}for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t[n]="%"+("0"+n.toString(16).toUpperCase()).slice(-2)}return t}function uc(e,t){typeof t!="string"&&(t=uc.defaultChars);let r=RU(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(n){let o="";for(let i=0,s=n.length;i<s;i+=3){let a=parseInt(n.slice(i+1,i+3),16);if(a<128){o+=r[a];continue}if((a&224)===192&&i+3<s){let u=parseInt(n.slice(i+4,i+6),16);if((u&192)===128){let l=a<<6&1984|u&63;l<128?o+="\uFFFD\uFFFD":o+=String.fromCharCode(l),i+=3;continue}}if((a&240)===224&&i+6<s){let u=parseInt(n.slice(i+4,i+6),16),l=parseInt(n.slice(i+7,i+9),16);if((u&192)===128&&(l&192)===128){let d=a<<12&61440|u<<6&4032|l&63;d<2048||d>=55296&&d<=57343?o+="\uFFFD\uFFFD\uFFFD":o+=String.fromCharCode(d),i+=6;continue}}if((a&248)===240&&i+9<s){let u=parseInt(n.slice(i+4,i+6),16),l=parseInt(n.slice(i+7,i+9),16),d=parseInt(n.slice(i+10,i+12),16);if((u&192)===128&&(l&192)===128&&(d&192)===128){let p=a<<18&1835008|u<<12&258048|l<<6&4032|d&63;p<65536||p>1114111?o+="\uFFFD\uFFFD\uFFFD\uFFFD":(p-=65536,o+=String.fromCharCode(55296+(p>>10),56320+(p&1023))),i+=9;continue}}o+="\uFFFD"}return o})}uc.defaultChars=";/?:@&=+$,#";uc.componentChars="";var Ha=uc;var rC={};function PU(e){let t=rC[e];if(t)return t;t=rC[e]=[];for(let r=0;r<128;r++){let n=String.fromCharCode(r);/^[0-9a-z]$/i.test(n)?t.push(n):t.push("%"+("0"+r.toString(16).toUpperCase()).slice(-2))}for(let r=0;r<e.length;r++)t[e.charCodeAt(r)]=e[r];return t}function lc(e,t,r){typeof t!="string"&&(r=t,t=lc.defaultChars),typeof r>"u"&&(r=!0);let n=PU(t),o="";for(let i=0,s=e.length;i<s;i++){let a=e.charCodeAt(i);if(r&&a===37&&i+2<s&&/^[0-9a-f]{2}$/i.test(e.slice(i+1,i+3))){o+=e.slice(i,i+3),i+=2;continue}if(a<128){o+=n[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&i+1<s){let u=e.charCodeAt(i+1);if(u>=56320&&u<=57343){o+=encodeURIComponent(e[i]+e[i+1]),i++;continue}}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[i])}return o}lc.defaultChars=";/?:@&=+$,-_.!~*'()#";lc.componentChars="-_.!~*'()";var cc=lc;function Zo(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function dc(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var DU=/^([a-z0-9.+-]+:)/i,NU=/:[0-9]*$/,OU=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,MU=["<",">",'"',"`"," ","\r",`
`,"	"],FU=["{","}","|","\\","^","`"].concat(MU),BU=["'"].concat(FU),nC=["%","/","?",";","#"].concat(BU),oC=["/","?","#"],LU=255,iC=/^[+a-z0-9A-Z_-]{0,63}$/,UU=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,sC={javascript:!0,"javascript:":!0},aC={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function jU(e,t){if(e&&e instanceof dc)return e;let r=new dc;return r.parse(e,t),r}dc.prototype.parse=function(e,t){let r,n,o,i=e;if(i=i.trim(),!t&&e.split("#").length===1){let l=OU.exec(i);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let s=DU.exec(i);if(s&&(s=s[0],r=s.toLowerCase(),this.protocol=s,i=i.substr(s.length)),(t||s||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=i.substr(0,2)==="//",o&&!(s&&sC[s])&&(i=i.substr(2),this.slashes=!0)),!sC[s]&&(o||s&&!aC[s])){let l=-1;for(let h=0;h<oC.length;h++)n=i.indexOf(oC[h]),n!==-1&&(l===-1||n<l)&&(l=n);let d,p;l===-1?p=i.lastIndexOf("@"):p=i.lastIndexOf("@",l),p!==-1&&(d=i.slice(0,p),i=i.slice(p+1),this.auth=d),l=-1;for(let h=0;h<nC.length;h++)n=i.indexOf(nC[h]),n!==-1&&(l===-1||n<l)&&(l=n);l===-1&&(l=i.length),i[l-1]===":"&&l--;let f=i.slice(0,l);i=i.slice(l),this.parseHost(f),this.hostname=this.hostname||"";let m=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!m){let h=this.hostname.split(/\./);for(let _=0,S=h.length;_<S;_++){let D=h[_];if(D&&!D.match(iC)){let w="";for(let x=0,E=D.length;x<E;x++)D.charCodeAt(x)>127?w+="x":w+=D[x];if(!w.match(iC)){let x=h.slice(0,_),E=h.slice(_+1),I=D.match(UU);I&&(x.push(I[1]),E.unshift(I[2])),E.length&&(i=E.join(".")+i),this.hostname=x.join(".");break}}}}this.hostname.length>LU&&(this.hostname=""),m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let a=i.indexOf("#");a!==-1&&(this.hash=i.substr(a),i=i.slice(0,a));let u=i.indexOf("?");return u!==-1&&(this.search=i.substr(u),i=i.slice(0,u)),i&&(this.pathname=i),aC[r]&&this.hostname&&!this.pathname&&(this.pathname=""),this};dc.prototype.parseHost=function(e){let t=NU.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var Va=jU;var mm={};C(mm,{Any:()=>fc,Cc:()=>mc,Cf:()=>uC,P:()=>Xo,S:()=>hc,Z:()=>gc});var fc=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;var mc=/[\0-\x1F\x7F-\x9F]/;var uC=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;var Xo=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;var hc=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;var gc=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var lC=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(e=>e.charCodeAt(0)));var cC=new Uint16Array("\u0200aglq	\x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(e=>e.charCodeAt(0)));var hm,qU=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),gm=(hm=String.fromCodePoint)!==null&&hm!==void 0?hm:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function bm(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=qU.get(e))!==null&&t!==void 0?t:e}var de;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(de||(de={}));var $U=32,gr;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(gr||(gr={}));function ym(e){return e>=de.ZERO&&e<=de.NINE}function zU(e){return e>=de.UPPER_A&&e<=de.UPPER_F||e>=de.LOWER_A&&e<=de.LOWER_F}function WU(e){return e>=de.UPPER_A&&e<=de.UPPER_Z||e>=de.LOWER_A&&e<=de.LOWER_Z||ym(e)}function HU(e){return e===de.EQUALS||WU(e)}var ce;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(ce||(ce={}));var xt;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(xt||(xt={}));var bc=class{constructor(t,r,n){this.decodeTree=t,this.emitCodePoint=r,this.errors=n,this.state=ce.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=xt.Strict}startEntity(t){this.decodeMode=t,this.state=ce.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,r){switch(this.state){case ce.EntityStart:return t.charCodeAt(r)===de.NUM?(this.state=ce.NumericStart,this.consumed+=1,this.stateNumericStart(t,r+1)):(this.state=ce.NamedEntity,this.stateNamedEntity(t,r));case ce.NumericStart:return this.stateNumericStart(t,r);case ce.NumericDecimal:return this.stateNumericDecimal(t,r);case ce.NumericHex:return this.stateNumericHex(t,r);case ce.NamedEntity:return this.stateNamedEntity(t,r)}}stateNumericStart(t,r){return r>=t.length?-1:(t.charCodeAt(r)|$U)===de.LOWER_X?(this.state=ce.NumericHex,this.consumed+=1,this.stateNumericHex(t,r+1)):(this.state=ce.NumericDecimal,this.stateNumericDecimal(t,r))}addToNumericResult(t,r,n,o){if(r!==n){let i=n-r;this.result=this.result*Math.pow(o,i)+parseInt(t.substr(r,i),o),this.consumed+=i}}stateNumericHex(t,r){let n=r;for(;r<t.length;){let o=t.charCodeAt(r);if(ym(o)||zU(o))r+=1;else return this.addToNumericResult(t,n,r,16),this.emitNumericEntity(o,3)}return this.addToNumericResult(t,n,r,16),-1}stateNumericDecimal(t,r){let n=r;for(;r<t.length;){let o=t.charCodeAt(r);if(ym(o))r+=1;else return this.addToNumericResult(t,n,r,10),this.emitNumericEntity(o,2)}return this.addToNumericResult(t,n,r,10),-1}emitNumericEntity(t,r){var n;if(this.consumed<=r)return(n=this.errors)===null||n===void 0||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===de.SEMI)this.consumed+=1;else if(this.decodeMode===xt.Strict)return 0;return this.emitCodePoint(bm(this.result),this.consumed),this.errors&&(t!==de.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,r){let{decodeTree:n}=this,o=n[this.treeIndex],i=(o&gr.VALUE_LENGTH)>>14;for(;r<t.length;r++,this.excess++){let s=t.charCodeAt(r);if(this.treeIndex=VU(n,o,this.treeIndex+Math.max(1,i),s),this.treeIndex<0)return this.result===0||this.decodeMode===xt.Attribute&&(i===0||HU(s))?0:this.emitNotTerminatedNamedEntity();if(o=n[this.treeIndex],i=(o&gr.VALUE_LENGTH)>>14,i!==0){if(s===de.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==xt.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;let{result:r,decodeTree:n}=this,o=(n[r]&gr.VALUE_LENGTH)>>14;return this.emitNamedEntityData(r,o,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,r,n){let{decodeTree:o}=this;return this.emitCodePoint(r===1?o[t]&~gr.VALUE_LENGTH:o[t+1],n),r===3&&this.emitCodePoint(o[t+2],n),n}end(){var t;switch(this.state){case ce.NamedEntity:return this.result!==0&&(this.decodeMode!==xt.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ce.NumericDecimal:return this.emitNumericEntity(0,2);case ce.NumericHex:return this.emitNumericEntity(0,3);case ce.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ce.EntityStart:return 0}}};function dC(e){let t="",r=new bc(e,n=>t+=gm(n));return function(o,i){let s=0,a=0;for(;(a=o.indexOf("&",a))>=0;){t+=o.slice(s,a),r.startEntity(i);let l=r.write(o,a+1);if(l<0){s=a+r.end();break}s=a+l,a=l===0?s+1:s}let u=t+o.slice(s);return t="",u}}function VU(e,t,r,n){let o=(t&gr.BRANCH_LENGTH)>>7,i=t&gr.JUMP_TABLE;if(o===0)return i!==0&&n===i?r:-1;if(i){let u=n-i;return u<0||u>=o?-1:e[r+u]-1}let s=r,a=s+o-1;for(;s<=a;){let u=s+a>>>1,l=e[u];if(l<n)s=u+1;else if(l>n)a=u-1;else return e[u+o]}return-1}var GU=dC(lC),Hae=dC(cC);function br(e,t=xt.Legacy){return GU(e,t)}function yc(e){for(let t=1;t<e.length;t++)e[t][0]+=e[t-1][0]+1;return e}var KU=new Map(yc([[9,"&Tab;"],[0,"&NewLine;"],[22,"&excl;"],[0,"&quot;"],[0,"&num;"],[0,"&dollar;"],[0,"&percnt;"],[0,"&amp;"],[0,"&apos;"],[0,"&lpar;"],[0,"&rpar;"],[0,"&ast;"],[0,"&plus;"],[0,"&comma;"],[1,"&period;"],[0,"&sol;"],[10,"&colon;"],[0,"&semi;"],[0,{v:"&lt;",n:8402,o:"&nvlt;"}],[0,{v:"&equals;",n:8421,o:"&bne;"}],[0,{v:"&gt;",n:8402,o:"&nvgt;"}],[0,"&quest;"],[0,"&commat;"],[26,"&lbrack;"],[0,"&bsol;"],[0,"&rbrack;"],[0,"&Hat;"],[0,"&lowbar;"],[0,"&DiacriticalGrave;"],[5,{n:106,o:"&fjlig;"}],[20,"&lbrace;"],[0,"&verbar;"],[0,"&rbrace;"],[34,"&nbsp;"],[0,"&iexcl;"],[0,"&cent;"],[0,"&pound;"],[0,"&curren;"],[0,"&yen;"],[0,"&brvbar;"],[0,"&sect;"],[0,"&die;"],[0,"&copy;"],[0,"&ordf;"],[0,"&laquo;"],[0,"&not;"],[0,"&shy;"],[0,"&circledR;"],[0,"&macr;"],[0,"&deg;"],[0,"&PlusMinus;"],[0,"&sup2;"],[0,"&sup3;"],[0,"&acute;"],[0,"&micro;"],[0,"&para;"],[0,"&centerdot;"],[0,"&cedil;"],[0,"&sup1;"],[0,"&ordm;"],[0,"&raquo;"],[0,"&frac14;"],[0,"&frac12;"],[0,"&frac34;"],[0,"&iquest;"],[0,"&Agrave;"],[0,"&Aacute;"],[0,"&Acirc;"],[0,"&Atilde;"],[0,"&Auml;"],[0,"&angst;"],[0,"&AElig;"],[0,"&Ccedil;"],[0,"&Egrave;"],[0,"&Eacute;"],[0,"&Ecirc;"],[0,"&Euml;"],[0,"&Igrave;"],[0,"&Iacute;"],[0,"&Icirc;"],[0,"&Iuml;"],[0,"&ETH;"],[0,"&Ntilde;"],[0,"&Ograve;"],[0,"&Oacute;"],[0,"&Ocirc;"],[0,"&Otilde;"],[0,"&Ouml;"],[0,"&times;"],[0,"&Oslash;"],[0,"&Ugrave;"],[0,"&Uacute;"],[0,"&Ucirc;"],[0,"&Uuml;"],[0,"&Yacute;"],[0,"&THORN;"],[0,"&szlig;"],[0,"&agrave;"],[0,"&aacute;"],[0,"&acirc;"],[0,"&atilde;"],[0,"&auml;"],[0,"&aring;"],[0,"&aelig;"],[0,"&ccedil;"],[0,"&egrave;"],[0,"&eacute;"],[0,"&ecirc;"],[0,"&euml;"],[0,"&igrave;"],[0,"&iacute;"],[0,"&icirc;"],[0,"&iuml;"],[0,"&eth;"],[0,"&ntilde;"],[0,"&ograve;"],[0,"&oacute;"],[0,"&ocirc;"],[0,"&otilde;"],[0,"&ouml;"],[0,"&div;"],[0,"&oslash;"],[0,"&ugrave;"],[0,"&uacute;"],[0,"&ucirc;"],[0,"&uuml;"],[0,"&yacute;"],[0,"&thorn;"],[0,"&yuml;"],[0,"&Amacr;"],[0,"&amacr;"],[0,"&Abreve;"],[0,"&abreve;"],[0,"&Aogon;"],[0,"&aogon;"],[0,"&Cacute;"],[0,"&cacute;"],[0,"&Ccirc;"],[0,"&ccirc;"],[0,"&Cdot;"],[0,"&cdot;"],[0,"&Ccaron;"],[0,"&ccaron;"],[0,"&Dcaron;"],[0,"&dcaron;"],[0,"&Dstrok;"],[0,"&dstrok;"],[0,"&Emacr;"],[0,"&emacr;"],[2,"&Edot;"],[0,"&edot;"],[0,"&Eogon;"],[0,"&eogon;"],[0,"&Ecaron;"],[0,"&ecaron;"],[0,"&Gcirc;"],[0,"&gcirc;"],[0,"&Gbreve;"],[0,"&gbreve;"],[0,"&Gdot;"],[0,"&gdot;"],[0,"&Gcedil;"],[1,"&Hcirc;"],[0,"&hcirc;"],[0,"&Hstrok;"],[0,"&hstrok;"],[0,"&Itilde;"],[0,"&itilde;"],[0,"&Imacr;"],[0,"&imacr;"],[2,"&Iogon;"],[0,"&iogon;"],[0,"&Idot;"],[0,"&imath;"],[0,"&IJlig;"],[0,"&ijlig;"],[0,"&Jcirc;"],[0,"&jcirc;"],[0,"&Kcedil;"],[0,"&kcedil;"],[0,"&kgreen;"],[0,"&Lacute;"],[0,"&lacute;"],[0,"&Lcedil;"],[0,"&lcedil;"],[0,"&Lcaron;"],[0,"&lcaron;"],[0,"&Lmidot;"],[0,"&lmidot;"],[0,"&Lstrok;"],[0,"&lstrok;"],[0,"&Nacute;"],[0,"&nacute;"],[0,"&Ncedil;"],[0,"&ncedil;"],[0,"&Ncaron;"],[0,"&ncaron;"],[0,"&napos;"],[0,"&ENG;"],[0,"&eng;"],[0,"&Omacr;"],[0,"&omacr;"],[2,"&Odblac;"],[0,"&odblac;"],[0,"&OElig;"],[0,"&oelig;"],[0,"&Racute;"],[0,"&racute;"],[0,"&Rcedil;"],[0,"&rcedil;"],[0,"&Rcaron;"],[0,"&rcaron;"],[0,"&Sacute;"],[0,"&sacute;"],[0,"&Scirc;"],[0,"&scirc;"],[0,"&Scedil;"],[0,"&scedil;"],[0,"&Scaron;"],[0,"&scaron;"],[0,"&Tcedil;"],[0,"&tcedil;"],[0,"&Tcaron;"],[0,"&tcaron;"],[0,"&Tstrok;"],[0,"&tstrok;"],[0,"&Utilde;"],[0,"&utilde;"],[0,"&Umacr;"],[0,"&umacr;"],[0,"&Ubreve;"],[0,"&ubreve;"],[0,"&Uring;"],[0,"&uring;"],[0,"&Udblac;"],[0,"&udblac;"],[0,"&Uogon;"],[0,"&uogon;"],[0,"&Wcirc;"],[0,"&wcirc;"],[0,"&Ycirc;"],[0,"&ycirc;"],[0,"&Yuml;"],[0,"&Zacute;"],[0,"&zacute;"],[0,"&Zdot;"],[0,"&zdot;"],[0,"&Zcaron;"],[0,"&zcaron;"],[19,"&fnof;"],[34,"&imped;"],[63,"&gacute;"],[65,"&jmath;"],[142,"&circ;"],[0,"&caron;"],[16,"&breve;"],[0,"&DiacriticalDot;"],[0,"&ring;"],[0,"&ogon;"],[0,"&DiacriticalTilde;"],[0,"&dblac;"],[51,"&DownBreve;"],[127,"&Alpha;"],[0,"&Beta;"],[0,"&Gamma;"],[0,"&Delta;"],[0,"&Epsilon;"],[0,"&Zeta;"],[0,"&Eta;"],[0,"&Theta;"],[0,"&Iota;"],[0,"&Kappa;"],[0,"&Lambda;"],[0,"&Mu;"],[0,"&Nu;"],[0,"&Xi;"],[0,"&Omicron;"],[0,"&Pi;"],[0,"&Rho;"],[1,"&Sigma;"],[0,"&Tau;"],[0,"&Upsilon;"],[0,"&Phi;"],[0,"&Chi;"],[0,"&Psi;"],[0,"&ohm;"],[7,"&alpha;"],[0,"&beta;"],[0,"&gamma;"],[0,"&delta;"],[0,"&epsi;"],[0,"&zeta;"],[0,"&eta;"],[0,"&theta;"],[0,"&iota;"],[0,"&kappa;"],[0,"&lambda;"],[0,"&mu;"],[0,"&nu;"],[0,"&xi;"],[0,"&omicron;"],[0,"&pi;"],[0,"&rho;"],[0,"&sigmaf;"],[0,"&sigma;"],[0,"&tau;"],[0,"&upsi;"],[0,"&phi;"],[0,"&chi;"],[0,"&psi;"],[0,"&omega;"],[7,"&thetasym;"],[0,"&Upsi;"],[2,"&phiv;"],[0,"&piv;"],[5,"&Gammad;"],[0,"&digamma;"],[18,"&kappav;"],[0,"&rhov;"],[3,"&epsiv;"],[0,"&backepsilon;"],[10,"&IOcy;"],[0,"&DJcy;"],[0,"&GJcy;"],[0,"&Jukcy;"],[0,"&DScy;"],[0,"&Iukcy;"],[0,"&YIcy;"],[0,"&Jsercy;"],[0,"&LJcy;"],[0,"&NJcy;"],[0,"&TSHcy;"],[0,"&KJcy;"],[1,"&Ubrcy;"],[0,"&DZcy;"],[0,"&Acy;"],[0,"&Bcy;"],[0,"&Vcy;"],[0,"&Gcy;"],[0,"&Dcy;"],[0,"&IEcy;"],[0,"&ZHcy;"],[0,"&Zcy;"],[0,"&Icy;"],[0,"&Jcy;"],[0,"&Kcy;"],[0,"&Lcy;"],[0,"&Mcy;"],[0,"&Ncy;"],[0,"&Ocy;"],[0,"&Pcy;"],[0,"&Rcy;"],[0,"&Scy;"],[0,"&Tcy;"],[0,"&Ucy;"],[0,"&Fcy;"],[0,"&KHcy;"],[0,"&TScy;"],[0,"&CHcy;"],[0,"&SHcy;"],[0,"&SHCHcy;"],[0,"&HARDcy;"],[0,"&Ycy;"],[0,"&SOFTcy;"],[0,"&Ecy;"],[0,"&YUcy;"],[0,"&YAcy;"],[0,"&acy;"],[0,"&bcy;"],[0,"&vcy;"],[0,"&gcy;"],[0,"&dcy;"],[0,"&iecy;"],[0,"&zhcy;"],[0,"&zcy;"],[0,"&icy;"],[0,"&jcy;"],[0,"&kcy;"],[0,"&lcy;"],[0,"&mcy;"],[0,"&ncy;"],[0,"&ocy;"],[0,"&pcy;"],[0,"&rcy;"],[0,"&scy;"],[0,"&tcy;"],[0,"&ucy;"],[0,"&fcy;"],[0,"&khcy;"],[0,"&tscy;"],[0,"&chcy;"],[0,"&shcy;"],[0,"&shchcy;"],[0,"&hardcy;"],[0,"&ycy;"],[0,"&softcy;"],[0,"&ecy;"],[0,"&yucy;"],[0,"&yacy;"],[1,"&iocy;"],[0,"&djcy;"],[0,"&gjcy;"],[0,"&jukcy;"],[0,"&dscy;"],[0,"&iukcy;"],[0,"&yicy;"],[0,"&jsercy;"],[0,"&ljcy;"],[0,"&njcy;"],[0,"&tshcy;"],[0,"&kjcy;"],[1,"&ubrcy;"],[0,"&dzcy;"],[7074,"&ensp;"],[0,"&emsp;"],[0,"&emsp13;"],[0,"&emsp14;"],[1,"&numsp;"],[0,"&puncsp;"],[0,"&ThinSpace;"],[0,"&hairsp;"],[0,"&NegativeMediumSpace;"],[0,"&zwnj;"],[0,"&zwj;"],[0,"&lrm;"],[0,"&rlm;"],[0,"&dash;"],[2,"&ndash;"],[0,"&mdash;"],[0,"&horbar;"],[0,"&Verbar;"],[1,"&lsquo;"],[0,"&CloseCurlyQuote;"],[0,"&lsquor;"],[1,"&ldquo;"],[0,"&CloseCurlyDoubleQuote;"],[0,"&bdquo;"],[1,"&dagger;"],[0,"&Dagger;"],[0,"&bull;"],[2,"&nldr;"],[0,"&hellip;"],[9,"&permil;"],[0,"&pertenk;"],[0,"&prime;"],[0,"&Prime;"],[0,"&tprime;"],[0,"&backprime;"],[3,"&lsaquo;"],[0,"&rsaquo;"],[3,"&oline;"],[2,"&caret;"],[1,"&hybull;"],[0,"&frasl;"],[10,"&bsemi;"],[7,"&qprime;"],[7,{v:"&MediumSpace;",n:8202,o:"&ThickSpace;"}],[0,"&NoBreak;"],[0,"&af;"],[0,"&InvisibleTimes;"],[0,"&ic;"],[72,"&euro;"],[46,"&tdot;"],[0,"&DotDot;"],[37,"&complexes;"],[2,"&incare;"],[4,"&gscr;"],[0,"&hamilt;"],[0,"&Hfr;"],[0,"&Hopf;"],[0,"&planckh;"],[0,"&hbar;"],[0,"&imagline;"],[0,"&Ifr;"],[0,"&lagran;"],[0,"&ell;"],[1,"&naturals;"],[0,"&numero;"],[0,"&copysr;"],[0,"&weierp;"],[0,"&Popf;"],[0,"&Qopf;"],[0,"&realine;"],[0,"&real;"],[0,"&reals;"],[0,"&rx;"],[3,"&trade;"],[1,"&integers;"],[2,"&mho;"],[0,"&zeetrf;"],[0,"&iiota;"],[2,"&bernou;"],[0,"&Cayleys;"],[1,"&escr;"],[0,"&Escr;"],[0,"&Fouriertrf;"],[1,"&Mellintrf;"],[0,"&order;"],[0,"&alefsym;"],[0,"&beth;"],[0,"&gimel;"],[0,"&daleth;"],[12,"&CapitalDifferentialD;"],[0,"&dd;"],[0,"&ee;"],[0,"&ii;"],[10,"&frac13;"],[0,"&frac23;"],[0,"&frac15;"],[0,"&frac25;"],[0,"&frac35;"],[0,"&frac45;"],[0,"&frac16;"],[0,"&frac56;"],[0,"&frac18;"],[0,"&frac38;"],[0,"&frac58;"],[0,"&frac78;"],[49,"&larr;"],[0,"&ShortUpArrow;"],[0,"&rarr;"],[0,"&darr;"],[0,"&harr;"],[0,"&updownarrow;"],[0,"&nwarr;"],[0,"&nearr;"],[0,"&LowerRightArrow;"],[0,"&LowerLeftArrow;"],[0,"&nlarr;"],[0,"&nrarr;"],[1,{v:"&rarrw;",n:824,o:"&nrarrw;"}],[0,"&Larr;"],[0,"&Uarr;"],[0,"&Rarr;"],[0,"&Darr;"],[0,"&larrtl;"],[0,"&rarrtl;"],[0,"&LeftTeeArrow;"],[0,"&mapstoup;"],[0,"&map;"],[0,"&DownTeeArrow;"],[1,"&hookleftarrow;"],[0,"&hookrightarrow;"],[0,"&larrlp;"],[0,"&looparrowright;"],[0,"&harrw;"],[0,"&nharr;"],[1,"&lsh;"],[0,"&rsh;"],[0,"&ldsh;"],[0,"&rdsh;"],[1,"&crarr;"],[0,"&cularr;"],[0,"&curarr;"],[2,"&circlearrowleft;"],[0,"&circlearrowright;"],[0,"&leftharpoonup;"],[0,"&DownLeftVector;"],[0,"&RightUpVector;"],[0,"&LeftUpVector;"],[0,"&rharu;"],[0,"&DownRightVector;"],[0,"&dharr;"],[0,"&dharl;"],[0,"&RightArrowLeftArrow;"],[0,"&udarr;"],[0,"&LeftArrowRightArrow;"],[0,"&leftleftarrows;"],[0,"&upuparrows;"],[0,"&rightrightarrows;"],[0,"&ddarr;"],[0,"&leftrightharpoons;"],[0,"&Equilibrium;"],[0,"&nlArr;"],[0,"&nhArr;"],[0,"&nrArr;"],[0,"&DoubleLeftArrow;"],[0,"&DoubleUpArrow;"],[0,"&DoubleRightArrow;"],[0,"&dArr;"],[0,"&DoubleLeftRightArrow;"],[0,"&DoubleUpDownArrow;"],[0,"&nwArr;"],[0,"&neArr;"],[0,"&seArr;"],[0,"&swArr;"],[0,"&lAarr;"],[0,"&rAarr;"],[1,"&zigrarr;"],[6,"&larrb;"],[0,"&rarrb;"],[15,"&DownArrowUpArrow;"],[7,"&loarr;"],[0,"&roarr;"],[0,"&hoarr;"],[0,"&forall;"],[0,"&comp;"],[0,{v:"&part;",n:824,o:"&npart;"}],[0,"&exist;"],[0,"&nexist;"],[0,"&empty;"],[1,"&Del;"],[0,"&Element;"],[0,"&NotElement;"],[1,"&ni;"],[0,"&notni;"],[2,"&prod;"],[0,"&coprod;"],[0,"&sum;"],[0,"&minus;"],[0,"&MinusPlus;"],[0,"&dotplus;"],[1,"&Backslash;"],[0,"&lowast;"],[0,"&compfn;"],[1,"&radic;"],[2,"&prop;"],[0,"&infin;"],[0,"&angrt;"],[0,{v:"&ang;",n:8402,o:"&nang;"}],[0,"&angmsd;"],[0,"&angsph;"],[0,"&mid;"],[0,"&nmid;"],[0,"&DoubleVerticalBar;"],[0,"&NotDoubleVerticalBar;"],[0,"&and;"],[0,"&or;"],[0,{v:"&cap;",n:65024,o:"&caps;"}],[0,{v:"&cup;",n:65024,o:"&cups;"}],[0,"&int;"],[0,"&Int;"],[0,"&iiint;"],[0,"&conint;"],[0,"&Conint;"],[0,"&Cconint;"],[0,"&cwint;"],[0,"&ClockwiseContourIntegral;"],[0,"&awconint;"],[0,"&there4;"],[0,"&becaus;"],[0,"&ratio;"],[0,"&Colon;"],[0,"&dotminus;"],[1,"&mDDot;"],[0,"&homtht;"],[0,{v:"&sim;",n:8402,o:"&nvsim;"}],[0,{v:"&backsim;",n:817,o:"&race;"}],[0,{v:"&ac;",n:819,o:"&acE;"}],[0,"&acd;"],[0,"&VerticalTilde;"],[0,"&NotTilde;"],[0,{v:"&eqsim;",n:824,o:"&nesim;"}],[0,"&sime;"],[0,"&NotTildeEqual;"],[0,"&cong;"],[0,"&simne;"],[0,"&ncong;"],[0,"&ap;"],[0,"&nap;"],[0,"&ape;"],[0,{v:"&apid;",n:824,o:"&napid;"}],[0,"&backcong;"],[0,{v:"&asympeq;",n:8402,o:"&nvap;"}],[0,{v:"&bump;",n:824,o:"&nbump;"}],[0,{v:"&bumpe;",n:824,o:"&nbumpe;"}],[0,{v:"&doteq;",n:824,o:"&nedot;"}],[0,"&doteqdot;"],[0,"&efDot;"],[0,"&erDot;"],[0,"&Assign;"],[0,"&ecolon;"],[0,"&ecir;"],[0,"&circeq;"],[1,"&wedgeq;"],[0,"&veeeq;"],[1,"&triangleq;"],[2,"&equest;"],[0,"&ne;"],[0,{v:"&Congruent;",n:8421,o:"&bnequiv;"}],[0,"&nequiv;"],[1,{v:"&le;",n:8402,o:"&nvle;"}],[0,{v:"&ge;",n:8402,o:"&nvge;"}],[0,{v:"&lE;",n:824,o:"&nlE;"}],[0,{v:"&gE;",n:824,o:"&ngE;"}],[0,{v:"&lnE;",n:65024,o:"&lvertneqq;"}],[0,{v:"&gnE;",n:65024,o:"&gvertneqq;"}],[0,{v:"&ll;",n:new Map(yc([[824,"&nLtv;"],[7577,"&nLt;"]]))}],[0,{v:"&gg;",n:new Map(yc([[824,"&nGtv;"],[7577,"&nGt;"]]))}],[0,"&between;"],[0,"&NotCupCap;"],[0,"&nless;"],[0,"&ngt;"],[0,"&nle;"],[0,"&nge;"],[0,"&lesssim;"],[0,"&GreaterTilde;"],[0,"&nlsim;"],[0,"&ngsim;"],[0,"&LessGreater;"],[0,"&gl;"],[0,"&NotLessGreater;"],[0,"&NotGreaterLess;"],[0,"&pr;"],[0,"&sc;"],[0,"&prcue;"],[0,"&sccue;"],[0,"&PrecedesTilde;"],[0,{v:"&scsim;",n:824,o:"&NotSucceedsTilde;"}],[0,"&NotPrecedes;"],[0,"&NotSucceeds;"],[0,{v:"&sub;",n:8402,o:"&NotSubset;"}],[0,{v:"&sup;",n:8402,o:"&NotSuperset;"}],[0,"&nsub;"],[0,"&nsup;"],[0,"&sube;"],[0,"&supe;"],[0,"&NotSubsetEqual;"],[0,"&NotSupersetEqual;"],[0,{v:"&subne;",n:65024,o:"&varsubsetneq;"}],[0,{v:"&supne;",n:65024,o:"&varsupsetneq;"}],[1,"&cupdot;"],[0,"&UnionPlus;"],[0,{v:"&sqsub;",n:824,o:"&NotSquareSubset;"}],[0,{v:"&sqsup;",n:824,o:"&NotSquareSuperset;"}],[0,"&sqsube;"],[0,"&sqsupe;"],[0,{v:"&sqcap;",n:65024,o:"&sqcaps;"}],[0,{v:"&sqcup;",n:65024,o:"&sqcups;"}],[0,"&CirclePlus;"],[0,"&CircleMinus;"],[0,"&CircleTimes;"],[0,"&osol;"],[0,"&CircleDot;"],[0,"&circledcirc;"],[0,"&circledast;"],[1,"&circleddash;"],[0,"&boxplus;"],[0,"&boxminus;"],[0,"&boxtimes;"],[0,"&dotsquare;"],[0,"&RightTee;"],[0,"&dashv;"],[0,"&DownTee;"],[0,"&bot;"],[1,"&models;"],[0,"&DoubleRightTee;"],[0,"&Vdash;"],[0,"&Vvdash;"],[0,"&VDash;"],[0,"&nvdash;"],[0,"&nvDash;"],[0,"&nVdash;"],[0,"&nVDash;"],[0,"&prurel;"],[1,"&LeftTriangle;"],[0,"&RightTriangle;"],[0,{v:"&LeftTriangleEqual;",n:8402,o:"&nvltrie;"}],[0,{v:"&RightTriangleEqual;",n:8402,o:"&nvrtrie;"}],[0,"&origof;"],[0,"&imof;"],[0,"&multimap;"],[0,"&hercon;"],[0,"&intcal;"],[0,"&veebar;"],[1,"&barvee;"],[0,"&angrtvb;"],[0,"&lrtri;"],[0,"&bigwedge;"],[0,"&bigvee;"],[0,"&bigcap;"],[0,"&bigcup;"],[0,"&diam;"],[0,"&sdot;"],[0,"&sstarf;"],[0,"&divideontimes;"],[0,"&bowtie;"],[0,"&ltimes;"],[0,"&rtimes;"],[0,"&leftthreetimes;"],[0,"&rightthreetimes;"],[0,"&backsimeq;"],[0,"&curlyvee;"],[0,"&curlywedge;"],[0,"&Sub;"],[0,"&Sup;"],[0,"&Cap;"],[0,"&Cup;"],[0,"&fork;"],[0,"&epar;"],[0,"&lessdot;"],[0,"&gtdot;"],[0,{v:"&Ll;",n:824,o:"&nLl;"}],[0,{v:"&Gg;",n:824,o:"&nGg;"}],[0,{v:"&leg;",n:65024,o:"&lesg;"}],[0,{v:"&gel;",n:65024,o:"&gesl;"}],[2,"&cuepr;"],[0,"&cuesc;"],[0,"&NotPrecedesSlantEqual;"],[0,"&NotSucceedsSlantEqual;"],[0,"&NotSquareSubsetEqual;"],[0,"&NotSquareSupersetEqual;"],[2,"&lnsim;"],[0,"&gnsim;"],[0,"&precnsim;"],[0,"&scnsim;"],[0,"&nltri;"],[0,"&NotRightTriangle;"],[0,"&nltrie;"],[0,"&NotRightTriangleEqual;"],[0,"&vellip;"],[0,"&ctdot;"],[0,"&utdot;"],[0,"&dtdot;"],[0,"&disin;"],[0,"&isinsv;"],[0,"&isins;"],[0,{v:"&isindot;",n:824,o:"&notindot;"}],[0,"&notinvc;"],[0,"&notinvb;"],[1,{v:"&isinE;",n:824,o:"&notinE;"}],[0,"&nisd;"],[0,"&xnis;"],[0,"&nis;"],[0,"&notnivc;"],[0,"&notnivb;"],[6,"&barwed;"],[0,"&Barwed;"],[1,"&lceil;"],[0,"&rceil;"],[0,"&LeftFloor;"],[0,"&rfloor;"],[0,"&drcrop;"],[0,"&dlcrop;"],[0,"&urcrop;"],[0,"&ulcrop;"],[0,"&bnot;"],[1,"&profline;"],[0,"&profsurf;"],[1,"&telrec;"],[0,"&target;"],[5,"&ulcorn;"],[0,"&urcorn;"],[0,"&dlcorn;"],[0,"&drcorn;"],[2,"&frown;"],[0,"&smile;"],[9,"&cylcty;"],[0,"&profalar;"],[7,"&topbot;"],[6,"&ovbar;"],[1,"&solbar;"],[60,"&angzarr;"],[51,"&lmoustache;"],[0,"&rmoustache;"],[2,"&OverBracket;"],[0,"&bbrk;"],[0,"&bbrktbrk;"],[37,"&OverParenthesis;"],[0,"&UnderParenthesis;"],[0,"&OverBrace;"],[0,"&UnderBrace;"],[2,"&trpezium;"],[4,"&elinters;"],[59,"&blank;"],[164,"&circledS;"],[55,"&boxh;"],[1,"&boxv;"],[9,"&boxdr;"],[3,"&boxdl;"],[3,"&boxur;"],[3,"&boxul;"],[3,"&boxvr;"],[7,"&boxvl;"],[7,"&boxhd;"],[7,"&boxhu;"],[7,"&boxvh;"],[19,"&boxH;"],[0,"&boxV;"],[0,"&boxdR;"],[0,"&boxDr;"],[0,"&boxDR;"],[0,"&boxdL;"],[0,"&boxDl;"],[0,"&boxDL;"],[0,"&boxuR;"],[0,"&boxUr;"],[0,"&boxUR;"],[0,"&boxuL;"],[0,"&boxUl;"],[0,"&boxUL;"],[0,"&boxvR;"],[0,"&boxVr;"],[0,"&boxVR;"],[0,"&boxvL;"],[0,"&boxVl;"],[0,"&boxVL;"],[0,"&boxHd;"],[0,"&boxhD;"],[0,"&boxHD;"],[0,"&boxHu;"],[0,"&boxhU;"],[0,"&boxHU;"],[0,"&boxvH;"],[0,"&boxVh;"],[0,"&boxVH;"],[19,"&uhblk;"],[3,"&lhblk;"],[3,"&block;"],[8,"&blk14;"],[0,"&blk12;"],[0,"&blk34;"],[13,"&square;"],[8,"&blacksquare;"],[0,"&EmptyVerySmallSquare;"],[1,"&rect;"],[0,"&marker;"],[2,"&fltns;"],[1,"&bigtriangleup;"],[0,"&blacktriangle;"],[0,"&triangle;"],[2,"&blacktriangleright;"],[0,"&rtri;"],[3,"&bigtriangledown;"],[0,"&blacktriangledown;"],[0,"&dtri;"],[2,"&blacktriangleleft;"],[0,"&ltri;"],[6,"&loz;"],[0,"&cir;"],[32,"&tridot;"],[2,"&bigcirc;"],[8,"&ultri;"],[0,"&urtri;"],[0,"&lltri;"],[0,"&EmptySmallSquare;"],[0,"&FilledSmallSquare;"],[8,"&bigstar;"],[0,"&star;"],[7,"&phone;"],[49,"&female;"],[1,"&male;"],[29,"&spades;"],[2,"&clubs;"],[1,"&hearts;"],[0,"&diamondsuit;"],[3,"&sung;"],[2,"&flat;"],[0,"&natural;"],[0,"&sharp;"],[163,"&check;"],[3,"&cross;"],[8,"&malt;"],[21,"&sext;"],[33,"&VerticalSeparator;"],[25,"&lbbrk;"],[0,"&rbbrk;"],[84,"&bsolhsub;"],[0,"&suphsol;"],[28,"&LeftDoubleBracket;"],[0,"&RightDoubleBracket;"],[0,"&lang;"],[0,"&rang;"],[0,"&Lang;"],[0,"&Rang;"],[0,"&loang;"],[0,"&roang;"],[7,"&longleftarrow;"],[0,"&longrightarrow;"],[0,"&longleftrightarrow;"],[0,"&DoubleLongLeftArrow;"],[0,"&DoubleLongRightArrow;"],[0,"&DoubleLongLeftRightArrow;"],[1,"&longmapsto;"],[2,"&dzigrarr;"],[258,"&nvlArr;"],[0,"&nvrArr;"],[0,"&nvHarr;"],[0,"&Map;"],[6,"&lbarr;"],[0,"&bkarow;"],[0,"&lBarr;"],[0,"&dbkarow;"],[0,"&drbkarow;"],[0,"&DDotrahd;"],[0,"&UpArrowBar;"],[0,"&DownArrowBar;"],[2,"&Rarrtl;"],[2,"&latail;"],[0,"&ratail;"],[0,"&lAtail;"],[0,"&rAtail;"],[0,"&larrfs;"],[0,"&rarrfs;"],[0,"&larrbfs;"],[0,"&rarrbfs;"],[2,"&nwarhk;"],[0,"&nearhk;"],[0,"&hksearow;"],[0,"&hkswarow;"],[0,"&nwnear;"],[0,"&nesear;"],[0,"&seswar;"],[0,"&swnwar;"],[8,{v:"&rarrc;",n:824,o:"&nrarrc;"}],[1,"&cudarrr;"],[0,"&ldca;"],[0,"&rdca;"],[0,"&cudarrl;"],[0,"&larrpl;"],[2,"&curarrm;"],[0,"&cularrp;"],[7,"&rarrpl;"],[2,"&harrcir;"],[0,"&Uarrocir;"],[0,"&lurdshar;"],[0,"&ldrushar;"],[2,"&LeftRightVector;"],[0,"&RightUpDownVector;"],[0,"&DownLeftRightVector;"],[0,"&LeftUpDownVector;"],[0,"&LeftVectorBar;"],[0,"&RightVectorBar;"],[0,"&RightUpVectorBar;"],[0,"&RightDownVectorBar;"],[0,"&DownLeftVectorBar;"],[0,"&DownRightVectorBar;"],[0,"&LeftUpVectorBar;"],[0,"&LeftDownVectorBar;"],[0,"&LeftTeeVector;"],[0,"&RightTeeVector;"],[0,"&RightUpTeeVector;"],[0,"&RightDownTeeVector;"],[0,"&DownLeftTeeVector;"],[0,"&DownRightTeeVector;"],[0,"&LeftUpTeeVector;"],[0,"&LeftDownTeeVector;"],[0,"&lHar;"],[0,"&uHar;"],[0,"&rHar;"],[0,"&dHar;"],[0,"&luruhar;"],[0,"&ldrdhar;"],[0,"&ruluhar;"],[0,"&rdldhar;"],[0,"&lharul;"],[0,"&llhard;"],[0,"&rharul;"],[0,"&lrhard;"],[0,"&udhar;"],[0,"&duhar;"],[0,"&RoundImplies;"],[0,"&erarr;"],[0,"&simrarr;"],[0,"&larrsim;"],[0,"&rarrsim;"],[0,"&rarrap;"],[0,"&ltlarr;"],[1,"&gtrarr;"],[0,"&subrarr;"],[1,"&suplarr;"],[0,"&lfisht;"],[0,"&rfisht;"],[0,"&ufisht;"],[0,"&dfisht;"],[5,"&lopar;"],[0,"&ropar;"],[4,"&lbrke;"],[0,"&rbrke;"],[0,"&lbrkslu;"],[0,"&rbrksld;"],[0,"&lbrksld;"],[0,"&rbrkslu;"],[0,"&langd;"],[0,"&rangd;"],[0,"&lparlt;"],[0,"&rpargt;"],[0,"&gtlPar;"],[0,"&ltrPar;"],[3,"&vzigzag;"],[1,"&vangrt;"],[0,"&angrtvbd;"],[6,"&ange;"],[0,"&range;"],[0,"&dwangle;"],[0,"&uwangle;"],[0,"&angmsdaa;"],[0,"&angmsdab;"],[0,"&angmsdac;"],[0,"&angmsdad;"],[0,"&angmsdae;"],[0,"&angmsdaf;"],[0,"&angmsdag;"],[0,"&angmsdah;"],[0,"&bemptyv;"],[0,"&demptyv;"],[0,"&cemptyv;"],[0,"&raemptyv;"],[0,"&laemptyv;"],[0,"&ohbar;"],[0,"&omid;"],[0,"&opar;"],[1,"&operp;"],[1,"&olcross;"],[0,"&odsold;"],[1,"&olcir;"],[0,"&ofcir;"],[0,"&olt;"],[0,"&ogt;"],[0,"&cirscir;"],[0,"&cirE;"],[0,"&solb;"],[0,"&bsolb;"],[3,"&boxbox;"],[3,"&trisb;"],[0,"&rtriltri;"],[0,{v:"&LeftTriangleBar;",n:824,o:"&NotLeftTriangleBar;"}],[0,{v:"&RightTriangleBar;",n:824,o:"&NotRightTriangleBar;"}],[11,"&iinfin;"],[0,"&infintie;"],[0,"&nvinfin;"],[4,"&eparsl;"],[0,"&smeparsl;"],[0,"&eqvparsl;"],[5,"&blacklozenge;"],[8,"&RuleDelayed;"],[1,"&dsol;"],[9,"&bigodot;"],[0,"&bigoplus;"],[0,"&bigotimes;"],[1,"&biguplus;"],[1,"&bigsqcup;"],[5,"&iiiint;"],[0,"&fpartint;"],[2,"&cirfnint;"],[0,"&awint;"],[0,"&rppolint;"],[0,"&scpolint;"],[0,"&npolint;"],[0,"&pointint;"],[0,"&quatint;"],[0,"&intlarhk;"],[10,"&pluscir;"],[0,"&plusacir;"],[0,"&simplus;"],[0,"&plusdu;"],[0,"&plussim;"],[0,"&plustwo;"],[1,"&mcomma;"],[0,"&minusdu;"],[2,"&loplus;"],[0,"&roplus;"],[0,"&Cross;"],[0,"&timesd;"],[0,"&timesbar;"],[1,"&smashp;"],[0,"&lotimes;"],[0,"&rotimes;"],[0,"&otimesas;"],[0,"&Otimes;"],[0,"&odiv;"],[0,"&triplus;"],[0,"&triminus;"],[0,"&tritime;"],[0,"&intprod;"],[2,"&amalg;"],[0,"&capdot;"],[1,"&ncup;"],[0,"&ncap;"],[0,"&capand;"],[0,"&cupor;"],[0,"&cupcap;"],[0,"&capcup;"],[0,"&cupbrcap;"],[0,"&capbrcup;"],[0,"&cupcup;"],[0,"&capcap;"],[0,"&ccups;"],[0,"&ccaps;"],[2,"&ccupssm;"],[2,"&And;"],[0,"&Or;"],[0,"&andand;"],[0,"&oror;"],[0,"&orslope;"],[0,"&andslope;"],[1,"&andv;"],[0,"&orv;"],[0,"&andd;"],[0,"&ord;"],[1,"&wedbar;"],[6,"&sdote;"],[3,"&simdot;"],[2,{v:"&congdot;",n:824,o:"&ncongdot;"}],[0,"&easter;"],[0,"&apacir;"],[0,{v:"&apE;",n:824,o:"&napE;"}],[0,"&eplus;"],[0,"&pluse;"],[0,"&Esim;"],[0,"&Colone;"],[0,"&Equal;"],[1,"&ddotseq;"],[0,"&equivDD;"],[0,"&ltcir;"],[0,"&gtcir;"],[0,"&ltquest;"],[0,"&gtquest;"],[0,{v:"&leqslant;",n:824,o:"&nleqslant;"}],[0,{v:"&geqslant;",n:824,o:"&ngeqslant;"}],[0,"&lesdot;"],[0,"&gesdot;"],[0,"&lesdoto;"],[0,"&gesdoto;"],[0,"&lesdotor;"],[0,"&gesdotol;"],[0,"&lap;"],[0,"&gap;"],[0,"&lne;"],[0,"&gne;"],[0,"&lnap;"],[0,"&gnap;"],[0,"&lEg;"],[0,"&gEl;"],[0,"&lsime;"],[0,"&gsime;"],[0,"&lsimg;"],[0,"&gsiml;"],[0,"&lgE;"],[0,"&glE;"],[0,"&lesges;"],[0,"&gesles;"],[0,"&els;"],[0,"&egs;"],[0,"&elsdot;"],[0,"&egsdot;"],[0,"&el;"],[0,"&eg;"],[2,"&siml;"],[0,"&simg;"],[0,"&simlE;"],[0,"&simgE;"],[0,{v:"&LessLess;",n:824,o:"&NotNestedLessLess;"}],[0,{v:"&GreaterGreater;",n:824,o:"&NotNestedGreaterGreater;"}],[1,"&glj;"],[0,"&gla;"],[0,"&ltcc;"],[0,"&gtcc;"],[0,"&lescc;"],[0,"&gescc;"],[0,"&smt;"],[0,"&lat;"],[0,{v:"&smte;",n:65024,o:"&smtes;"}],[0,{v:"&late;",n:65024,o:"&lates;"}],[0,"&bumpE;"],[0,{v:"&PrecedesEqual;",n:824,o:"&NotPrecedesEqual;"}],[0,{v:"&sce;",n:824,o:"&NotSucceedsEqual;"}],[2,"&prE;"],[0,"&scE;"],[0,"&precneqq;"],[0,"&scnE;"],[0,"&prap;"],[0,"&scap;"],[0,"&precnapprox;"],[0,"&scnap;"],[0,"&Pr;"],[0,"&Sc;"],[0,"&subdot;"],[0,"&supdot;"],[0,"&subplus;"],[0,"&supplus;"],[0,"&submult;"],[0,"&supmult;"],[0,"&subedot;"],[0,"&supedot;"],[0,{v:"&subE;",n:824,o:"&nsubE;"}],[0,{v:"&supE;",n:824,o:"&nsupE;"}],[0,"&subsim;"],[0,"&supsim;"],[2,{v:"&subnE;",n:65024,o:"&varsubsetneqq;"}],[0,{v:"&supnE;",n:65024,o:"&varsupsetneqq;"}],[2,"&csub;"],[0,"&csup;"],[0,"&csube;"],[0,"&csupe;"],[0,"&subsup;"],[0,"&supsub;"],[0,"&subsub;"],[0,"&supsup;"],[0,"&suphsub;"],[0,"&supdsub;"],[0,"&forkv;"],[0,"&topfork;"],[0,"&mlcp;"],[8,"&Dashv;"],[1,"&Vdashl;"],[0,"&Barv;"],[0,"&vBar;"],[0,"&vBarv;"],[1,"&Vbar;"],[0,"&Not;"],[0,"&bNot;"],[0,"&rnmid;"],[0,"&cirmid;"],[0,"&midcir;"],[0,"&topcir;"],[0,"&nhpar;"],[0,"&parsim;"],[9,{v:"&parsl;",n:8421,o:"&nparsl;"}],[44343,{n:new Map(yc([[56476,"&Ascr;"],[1,"&Cscr;"],[0,"&Dscr;"],[2,"&Gscr;"],[2,"&Jscr;"],[0,"&Kscr;"],[2,"&Nscr;"],[0,"&Oscr;"],[0,"&Pscr;"],[0,"&Qscr;"],[1,"&Sscr;"],[0,"&Tscr;"],[0,"&Uscr;"],[0,"&Vscr;"],[0,"&Wscr;"],[0,"&Xscr;"],[0,"&Yscr;"],[0,"&Zscr;"],[0,"&ascr;"],[0,"&bscr;"],[0,"&cscr;"],[0,"&dscr;"],[1,"&fscr;"],[1,"&hscr;"],[0,"&iscr;"],[0,"&jscr;"],[0,"&kscr;"],[0,"&lscr;"],[0,"&mscr;"],[0,"&nscr;"],[1,"&pscr;"],[0,"&qscr;"],[0,"&rscr;"],[0,"&sscr;"],[0,"&tscr;"],[0,"&uscr;"],[0,"&vscr;"],[0,"&wscr;"],[0,"&xscr;"],[0,"&yscr;"],[0,"&zscr;"],[52,"&Afr;"],[0,"&Bfr;"],[1,"&Dfr;"],[0,"&Efr;"],[0,"&Ffr;"],[0,"&Gfr;"],[2,"&Jfr;"],[0,"&Kfr;"],[0,"&Lfr;"],[0,"&Mfr;"],[0,"&Nfr;"],[0,"&Ofr;"],[0,"&Pfr;"],[0,"&Qfr;"],[1,"&Sfr;"],[0,"&Tfr;"],[0,"&Ufr;"],[0,"&Vfr;"],[0,"&Wfr;"],[0,"&Xfr;"],[0,"&Yfr;"],[1,"&afr;"],[0,"&bfr;"],[0,"&cfr;"],[0,"&dfr;"],[0,"&efr;"],[0,"&ffr;"],[0,"&gfr;"],[0,"&hfr;"],[0,"&ifr;"],[0,"&jfr;"],[0,"&kfr;"],[0,"&lfr;"],[0,"&mfr;"],[0,"&nfr;"],[0,"&ofr;"],[0,"&pfr;"],[0,"&qfr;"],[0,"&rfr;"],[0,"&sfr;"],[0,"&tfr;"],[0,"&ufr;"],[0,"&vfr;"],[0,"&wfr;"],[0,"&xfr;"],[0,"&yfr;"],[0,"&zfr;"],[0,"&Aopf;"],[0,"&Bopf;"],[1,"&Dopf;"],[0,"&Eopf;"],[0,"&Fopf;"],[0,"&Gopf;"],[1,"&Iopf;"],[0,"&Jopf;"],[0,"&Kopf;"],[0,"&Lopf;"],[0,"&Mopf;"],[1,"&Oopf;"],[3,"&Sopf;"],[0,"&Topf;"],[0,"&Uopf;"],[0,"&Vopf;"],[0,"&Wopf;"],[0,"&Xopf;"],[0,"&Yopf;"],[1,"&aopf;"],[0,"&bopf;"],[0,"&copf;"],[0,"&dopf;"],[0,"&eopf;"],[0,"&fopf;"],[0,"&gopf;"],[0,"&hopf;"],[0,"&iopf;"],[0,"&jopf;"],[0,"&kopf;"],[0,"&lopf;"],[0,"&mopf;"],[0,"&nopf;"],[0,"&oopf;"],[0,"&popf;"],[0,"&qopf;"],[0,"&ropf;"],[0,"&sopf;"],[0,"&topf;"],[0,"&uopf;"],[0,"&vopf;"],[0,"&wopf;"],[0,"&xopf;"],[0,"&yopf;"],[0,"&zopf;"]]))}],[8906,"&fflig;"],[0,"&filig;"],[0,"&fllig;"],[0,"&ffilig;"],[0,"&ffllig;"]]));var JU=new Map([[34,"&quot;"],[38,"&amp;"],[39,"&apos;"],[60,"&lt;"],[62,"&gt;"]]),YU=String.prototype.codePointAt!=null?(e,t)=>e.codePointAt(t):(e,t)=>(e.charCodeAt(t)&64512)===55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t);function _m(e,t){return function(n){let o,i=0,s="";for(;o=e.exec(n);)i!==o.index&&(s+=n.substring(i,o.index)),s+=t.get(o[0].charCodeAt(0)),i=o.index+1;return s+n.substring(i)}}var pC=_m(/[&<>'"]/g,JU),fC=_m(/["&\u00A0]/g,new Map([[34,"&quot;"],[38,"&amp;"],[160,"&nbsp;"]])),mC=_m(/[&<>\u00A0]/g,new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[160,"&nbsp;"]]));var hC;(function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"})(hC||(hC={}));var gC;(function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"})(gC||(gC={}));function QU(e){return Object.prototype.toString.call(e)}function _c(e){return QU(e)==="[object String]"}var e4=Object.prototype.hasOwnProperty;function t4(e,t){return e4.call(e,t)}function Qo(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){if(r){if(typeof r!="object")throw new TypeError(r+"must be object");Object.keys(r).forEach(function(n){e[n]=r[n]})}}),e}function xm(e,t,r){return[].concat(e.slice(0,t),r,e.slice(t+1))}function wc(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Ga(e){if(e>65535){e-=65536;let t=55296+(e>>10),r=56320+(e&1023);return String.fromCharCode(t,r)}return String.fromCharCode(e)}var _C=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,r4=/&([a-z#][a-z0-9]{1,31});/gi,n4=new RegExp(_C.source+"|"+r4.source,"gi"),o4=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function i4(e,t){if(t.charCodeAt(0)===35&&o4.test(t)){let n=t[1].toLowerCase()==="x"?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return wc(n)?Ga(n):e}let r=br(e);return r!==e?r:e}function s4(e){return e.indexOf("\\")<0?e:e.replace(_C,"$1")}function jt(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(n4,function(t,r,n){return r||i4(t,n)})}var a4=/[&<>"]/,u4=/[&<>"]/g,l4={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function c4(e){return l4[e]}function qt(e){return a4.test(e)?e.replace(u4,c4):e}var d4=/[.?*+^$[\]\\(){}|-]/g;function p4(e){return e.replace(d4,"\\$&")}function K(e){switch(e){case 9:case 32:return!0}return!1}function pn(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function fn(e){return Xo.test(e)||hc.test(e)}function mn(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function hn(e){return e=e.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(e=e.replace(/ẞ/g,"\xDF")),e.toLowerCase().toUpperCase()}var f4={mdurl:pc,ucmicro:mm};var Tm={};C(Tm,{parseLinkDestination:()=>Em,parseLinkLabel:()=>vm,parseLinkTitle:()=>Cm});function vm(e,t,r){let n,o,i,s,a=e.posMax,u=e.pos;for(e.pos=t+1,n=1;e.pos<a;){if(i=e.src.charCodeAt(e.pos),i===93&&(n--,n===0)){o=!0;break}if(s=e.pos,e.md.inline.skipToken(e),i===91){if(s===e.pos-1)n++;else if(r)return e.pos=u,-1}}let l=-1;return o&&(l=e.pos),e.pos=u,l}function Em(e,t,r){let n,o=t,i={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<r;){if(n=e.charCodeAt(o),n===10||n===60)return i;if(n===62)return i.pos=o+1,i.str=jt(e.slice(t+1,o)),i.ok=!0,i;if(n===92&&o+1<r){o+=2;continue}o++}return i}let s=0;for(;o<r&&(n=e.charCodeAt(o),!(n===32||n<32||n===127));){if(n===92&&o+1<r){if(e.charCodeAt(o+1)===32)break;o+=2;continue}if(n===40&&(s++,s>32))return i;if(n===41){if(s===0)break;s--}o++}return t===o||s!==0||(i.str=jt(e.slice(t,o)),i.pos=o,i.ok=!0),i}function Cm(e,t,r,n){let o,i=t,s={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)s.str=n.str,s.marker=n.marker;else{if(i>=r)return s;let a=e.charCodeAt(i);if(a!==34&&a!==39&&a!==40)return s;t++,i++,a===40&&(a=41),s.marker=a}for(;i<r;){if(o=e.charCodeAt(i),o===s.marker)return s.pos=i+1,s.str+=jt(e.slice(t,i)),s.ok=!0,s;if(o===40&&s.marker===41)return s;o===92&&i+1<r&&i++,i++}return s.can_continue=!0,s.str+=jt(e.slice(t,i)),s}var St={};St.code_inline=function(e,t,r,n,o){let i=e[t];return"<code"+o.renderAttrs(i)+">"+qt(i.content)+"</code>"};St.code_block=function(e,t,r,n,o){let i=e[t];return"<pre"+o.renderAttrs(i)+"><code>"+qt(e[t].content)+`</code></pre>
`};St.fence=function(e,t,r,n,o){let i=e[t],s=i.info?jt(i.info).trim():"",a="",u="";if(s){let d=s.split(/(\s+)/g);a=d[0],u=d.slice(2).join("")}let l;if(r.highlight?l=r.highlight(i.content,a,u)||qt(i.content):l=qt(i.content),l.indexOf("<pre")===0)return l+`
`;if(s){let d=i.attrIndex("class"),p=i.attrs?i.attrs.slice():[];d<0?p.push(["class",r.langPrefix+a]):(p[d]=p[d].slice(),p[d][1]+=" "+r.langPrefix+a);let f={attrs:p};return`<pre><code${o.renderAttrs(f)}>${l}</code></pre>
`}return`<pre><code${o.renderAttrs(i)}>${l}</code></pre>
`};St.image=function(e,t,r,n,o){let i=e[t];return i.attrs[i.attrIndex("alt")][1]=o.renderInlineAsText(i.children,r,n),o.renderToken(e,t,r)};St.hardbreak=function(e,t,r){return r.xhtmlOut?`<br />
`:`<br>
`};St.softbreak=function(e,t,r){return r.breaks?r.xhtmlOut?`<br />
`:`<br>
`:`
`};St.text=function(e,t){return qt(e[t].content)};St.html_block=function(e,t){return e[t].content};St.html_inline=function(e,t){return e[t].content};function ei(){this.rules=Qo({},St)}ei.prototype.renderAttrs=function(t){let r,n,o;if(!t.attrs)return"";for(o="",r=0,n=t.attrs.length;r<n;r++)o+=" "+qt(t.attrs[r][0])+'="'+qt(t.attrs[r][1])+'"';return o};ei.prototype.renderToken=function(t,r,n){let o=t[r],i="";if(o.hidden)return"";o.block&&o.nesting!==-1&&r&&t[r-1].hidden&&(i+=`
`),i+=(o.nesting===-1?"</":"<")+o.tag,i+=this.renderAttrs(o),o.nesting===0&&n.xhtmlOut&&(i+=" /");let s=!1;if(o.block&&(s=!0,o.nesting===1&&r+1<t.length)){let a=t[r+1];(a.type==="inline"||a.hidden||a.nesting===-1&&a.tag===o.tag)&&(s=!1)}return i+=s?`>
`:">",i};ei.prototype.renderInline=function(e,t,r){let n="",o=this.rules;for(let i=0,s=e.length;i<s;i++){let a=e[i].type;typeof o[a]<"u"?n+=o[a](e,i,t,r,this):n+=this.renderToken(e,i,t)}return n};ei.prototype.renderInlineAsText=function(e,t,r){let n="";for(let o=0,i=e.length;o<i;o++)switch(e[o].type){case"text":n+=e[o].content;break;case"image":n+=this.renderInlineAsText(e[o].children,t,r);break;case"html_inline":case"html_block":n+=e[o].content;break;case"softbreak":case"hardbreak":n+=`
`;break;default:}return n};ei.prototype.render=function(e,t,r){let n="",o=this.rules;for(let i=0,s=e.length;i<s;i++){let a=e[i].type;a==="inline"?n+=this.renderInline(e[i].children,t,r):typeof o[a]<"u"?n+=o[a](e,i,t,r,this):n+=this.renderToken(e,i,t,r)}return n};var wC=ei;function rt(){this.__rules__=[],this.__cache__=null}rt.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1};rt.prototype.__compile__=function(){let e=this,t=[""];e.__rules__.forEach(function(r){r.enabled&&r.alt.forEach(function(n){t.indexOf(n)<0&&t.push(n)})}),e.__cache__={},t.forEach(function(r){e.__cache__[r]=[],e.__rules__.forEach(function(n){n.enabled&&(r&&n.alt.indexOf(r)<0||e.__cache__[r].push(n.fn))})})};rt.prototype.at=function(e,t,r){let n=this.__find__(e),o=r||{};if(n===-1)throw new Error("Parser rule not found: "+e);this.__rules__[n].fn=t,this.__rules__[n].alt=o.alt||[],this.__cache__=null};rt.prototype.before=function(e,t,r,n){let o=this.__find__(e),i=n||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o,0,{name:t,enabled:!0,fn:r,alt:i.alt||[]}),this.__cache__=null};rt.prototype.after=function(e,t,r,n){let o=this.__find__(e),i=n||{};if(o===-1)throw new Error("Parser rule not found: "+e);this.__rules__.splice(o+1,0,{name:t,enabled:!0,fn:r,alt:i.alt||[]}),this.__cache__=null};rt.prototype.push=function(e,t,r){let n=r||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:n.alt||[]}),this.__cache__=null};rt.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let r=[];return e.forEach(function(n){let o=this.__find__(n);if(o<0){if(t)return;throw new Error("Rules manager: invalid rule name "+n)}this.__rules__[o].enabled=!0,r.push(n)},this),this.__cache__=null,r};rt.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(r){r.enabled=!1}),this.enable(e,t)};rt.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let r=[];return e.forEach(function(n){let o=this.__find__(n);if(o<0){if(t)return;throw new Error("Rules manager: invalid rule name "+n)}this.__rules__[o].enabled=!1,r.push(n)},this),this.__cache__=null,r};rt.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};var gn=rt;function ti(e,t,r){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=r,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}ti.prototype.attrIndex=function(t){if(!this.attrs)return-1;let r=this.attrs;for(let n=0,o=r.length;n<o;n++)if(r[n][0]===t)return n;return-1};ti.prototype.attrPush=function(t){this.attrs?this.attrs.push(t):this.attrs=[t]};ti.prototype.attrSet=function(t,r){let n=this.attrIndex(t),o=[t,r];n<0?this.attrPush(o):this.attrs[n]=o};ti.prototype.attrGet=function(t){let r=this.attrIndex(t),n=null;return r>=0&&(n=this.attrs[r][1]),n};ti.prototype.attrJoin=function(t,r){let n=this.attrIndex(t);n<0?this.attrPush([t,r]):this.attrs[n][1]=this.attrs[n][1]+" "+r};var $t=ti;function xC(e,t,r){this.src=e,this.env=r,this.tokens=[],this.inlineMode=!1,this.md=t}xC.prototype.Token=$t;var SC=xC;var m4=/\r\n?|\n/g,h4=/\0/g;function Am(e){let t;t=e.src.replace(m4,`
`),t=t.replace(h4,"\uFFFD"),e.src=t}function km(e){let t;e.inlineMode?(t=new e.Token("inline","",0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Im(e){let t=e.tokens;for(let r=0,n=t.length;r<n;r++){let o=t[r];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function g4(e){return/^<a[>\s]/i.test(e)}function b4(e){return/^<\/a\s*>/i.test(e)}function Rm(e){let t=e.tokens;if(e.md.options.linkify)for(let r=0,n=t.length;r<n;r++){if(t[r].type!=="inline"||!e.md.linkify.pretest(t[r].content))continue;let o=t[r].children,i=0;for(let s=o.length-1;s>=0;s--){let a=o[s];if(a.type==="link_close"){for(s--;o[s].level!==a.level&&o[s].type!=="link_open";)s--;continue}if(a.type==="html_inline"&&(g4(a.content)&&i>0&&i--,b4(a.content)&&i++),!(i>0)&&a.type==="text"&&e.md.linkify.test(a.content)){let u=a.content,l=e.md.linkify.match(u),d=[],p=a.level,f=0;l.length>0&&l[0].index===0&&s>0&&o[s-1].type==="text_special"&&(l=l.slice(1));for(let m=0;m<l.length;m++){let h=l[m].url,_=e.md.normalizeLink(h);if(!e.md.validateLink(_))continue;let S=l[m].text;l[m].schema?l[m].schema==="mailto:"&&!/^mailto:/i.test(S)?S=e.md.normalizeLinkText("mailto:"+S).replace(/^mailto:/,""):S=e.md.normalizeLinkText(S):S=e.md.normalizeLinkText("http://"+S).replace(/^http:\/\//,"");let D=l[m].index;if(D>f){let I=new e.Token("text","",0);I.content=u.slice(f,D),I.level=p,d.push(I)}let w=new e.Token("link_open","a",1);w.attrs=[["href",_]],w.level=p++,w.markup="linkify",w.info="auto",d.push(w);let x=new e.Token("text","",0);x.content=S,x.level=p,d.push(x);let E=new e.Token("link_close","a",-1);E.level=--p,E.markup="linkify",E.info="auto",d.push(E),f=l[m].lastIndex}if(f<u.length){let m=new e.Token("text","",0);m.content=u.slice(f),m.level=p,d.push(m)}t[r].children=o=xm(o,s,d)}}}}var vC=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,y4=/\((c|tm|r)\)/i,_4=/\((c|tm|r)\)/ig,w4={c:"\xA9",r:"\xAE",tm:"\u2122"};function x4(e,t){return w4[t.toLowerCase()]}function S4(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e[r];n.type==="text"&&!t&&(n.content=n.content.replace(_4,x4)),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function v4(e){let t=0;for(let r=e.length-1;r>=0;r--){let n=e[r];n.type==="text"&&!t&&vC.test(n.content)&&(n.content=n.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),n.type==="link_open"&&n.info==="auto"&&t--,n.type==="link_close"&&n.info==="auto"&&t++}}function Pm(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type==="inline"&&(y4.test(e.tokens[t].content)&&S4(e.tokens[t].children),vC.test(e.tokens[t].content)&&v4(e.tokens[t].children))}var E4=/['"]/,EC=/['"]/g,CC="\u2019";function xc(e,t,r){return e.slice(0,t)+r+e.slice(t+1)}function C4(e,t){let r,n=[];for(let o=0;o<e.length;o++){let i=e[o],s=e[o].level;for(r=n.length-1;r>=0&&!(n[r].level<=s);r--);if(n.length=r+1,i.type!=="text")continue;let a=i.content,u=0,l=a.length;e:for(;u<l;){EC.lastIndex=u;let d=EC.exec(a);if(!d)break;let p=!0,f=!0;u=d.index+1;let m=d[0]==="'",h=32;if(d.index-1>=0)h=a.charCodeAt(d.index-1);else for(r=o-1;r>=0&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r--)if(e[r].content){h=e[r].content.charCodeAt(e[r].content.length-1);break}let _=32;if(u<l)_=a.charCodeAt(u);else for(r=o+1;r<e.length&&!(e[r].type==="softbreak"||e[r].type==="hardbreak");r++)if(e[r].content){_=e[r].content.charCodeAt(0);break}let S=mn(h)||fn(String.fromCharCode(h)),D=mn(_)||fn(String.fromCharCode(_)),w=pn(h),x=pn(_);if(x?p=!1:D&&(w||S||(p=!1)),w?f=!1:S&&(x||D||(f=!1)),_===34&&d[0]==='"'&&h>=48&&h<=57&&(f=p=!1),p&&f&&(p=S,f=D),!p&&!f){m&&(i.content=xc(i.content,d.index,CC));continue}if(f)for(r=n.length-1;r>=0;r--){let E=n[r];if(n[r].level<s)break;if(E.single===m&&n[r].level===s){E=n[r];let I,T;m?(I=t.md.options.quotes[2],T=t.md.options.quotes[3]):(I=t.md.options.quotes[0],T=t.md.options.quotes[1]),i.content=xc(i.content,d.index,T),e[E.token].content=xc(e[E.token].content,E.pos,I),u+=T.length-1,E.token===o&&(u+=I.length-1),a=i.content,l=a.length,n.length=r;continue e}}p?n.push({token:o,pos:d.index,single:m,level:s}):f&&m&&(i.content=xc(i.content,d.index,CC))}}}function Dm(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!=="inline"||!E4.test(e.tokens[t].content)||C4(e.tokens[t].children,e)}function Nm(e){let t,r,n=e.tokens,o=n.length;for(let i=0;i<o;i++){if(n[i].type!=="inline")continue;let s=n[i].children,a=s.length;for(t=0;t<a;t++)s[t].type==="text_special"&&(s[t].type="text");for(t=r=0;t<a;t++)s[t].type==="text"&&t+1<a&&s[t+1].type==="text"?s[t+1].content=s[t].content+s[t+1].content:(t!==r&&(s[r]=s[t]),r++);t!==r&&(s.length=r)}}var Om=[["normalize",Am],["block",km],["inline",Im],["linkify",Rm],["replacements",Pm],["smartquotes",Dm],["text_join",Nm]];function Mm(){this.ruler=new gn;for(let e=0;e<Om.length;e++)this.ruler.push(Om[e][0],Om[e][1])}Mm.prototype.process=function(e){let t=this.ruler.getRules("");for(let r=0,n=t.length;r<n;r++)t[r](e)};Mm.prototype.State=SC;var TC=Mm;function vt(e,t,r,n){this.src=e,this.md=t,this.env=r,this.tokens=n,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;let o=this.src;for(let i=0,s=0,a=0,u=0,l=o.length,d=!1;s<l;s++){let p=o.charCodeAt(s);if(!d)if(K(p)){a++,p===9?u+=4-u%4:u++;continue}else d=!0;(p===10||s===l-1)&&(p!==10&&s++,this.bMarks.push(i),this.eMarks.push(s),this.tShift.push(a),this.sCount.push(u),this.bsCount.push(0),d=!1,a=0,u=0,i=s+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}vt.prototype.push=function(e,t,r){let n=new $t(e,t,r);return n.block=!0,r<0&&this.level--,n.level=this.level,r>0&&this.level++,this.tokens.push(n),n};vt.prototype.isEmpty=function(t){return this.bMarks[t]+this.tShift[t]>=this.eMarks[t]};vt.prototype.skipEmptyLines=function(t){for(let r=this.lineMax;t<r&&!(this.bMarks[t]+this.tShift[t]<this.eMarks[t]);t++);return t};vt.prototype.skipSpaces=function(t){for(let r=this.src.length;t<r;t++){let n=this.src.charCodeAt(t);if(!K(n))break}return t};vt.prototype.skipSpacesBack=function(t,r){if(t<=r)return t;for(;t>r;)if(!K(this.src.charCodeAt(--t)))return t+1;return t};vt.prototype.skipChars=function(t,r){for(let n=this.src.length;t<n&&this.src.charCodeAt(t)===r;t++);return t};vt.prototype.skipCharsBack=function(t,r,n){if(t<=n)return t;for(;t>n;)if(r!==this.src.charCodeAt(--t))return t+1;return t};vt.prototype.getLines=function(t,r,n,o){if(t>=r)return"";let i=new Array(r-t);for(let s=0,a=t;a<r;a++,s++){let u=0,l=this.bMarks[a],d=l,p;for(a+1<r||o?p=this.eMarks[a]+1:p=this.eMarks[a];d<p&&u<n;){let f=this.src.charCodeAt(d);if(K(f))f===9?u+=4-(u+this.bsCount[a])%4:u++;else if(d-l<this.tShift[a])u++;else break;d++}u>n?i[s]=new Array(u-n+1).join(" ")+this.src.slice(d,p):i[s]=this.src.slice(d,p)}return i.join("")};vt.prototype.Token=$t;var AC=vt;var T4=65536;function Fm(e,t){let r=e.bMarks[t]+e.tShift[t],n=e.eMarks[t];return e.src.slice(r,n)}function kC(e){let t=[],r=e.length,n=0,o=e.charCodeAt(n),i=!1,s=0,a="";for(;n<r;)o===124&&(i?(a+=e.substring(s,n-1),s=n):(t.push(a+e.substring(s,n)),a="",s=n+1)),i=o===92,n++,o=e.charCodeAt(n);return t.push(a+e.substring(s)),t}function Bm(e,t,r,n){if(t+2>r)return!1;let o=t+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let i=e.bMarks[o]+e.tShift[o];if(i>=e.eMarks[o])return!1;let s=e.src.charCodeAt(i++);if(s!==124&&s!==45&&s!==58||i>=e.eMarks[o])return!1;let a=e.src.charCodeAt(i++);if(a!==124&&a!==45&&a!==58&&!K(a)||s===45&&K(a))return!1;for(;i<e.eMarks[o];){let E=e.src.charCodeAt(i);if(E!==124&&E!==45&&E!==58&&!K(E))return!1;i++}let u=Fm(e,t+1),l=u.split("|"),d=[];for(let E=0;E<l.length;E++){let I=l[E].trim();if(!I){if(E===0||E===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(I))return!1;I.charCodeAt(I.length-1)===58?d.push(I.charCodeAt(0)===58?"center":"right"):I.charCodeAt(0)===58?d.push("left"):d.push("")}if(u=Fm(e,t).trim(),u.indexOf("|")===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=kC(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();let p=l.length;if(p===0||p!==d.length)return!1;if(n)return!0;let f=e.parentType;e.parentType="table";let m=e.md.block.ruler.getRules("blockquote"),h=e.push("table_open","table",1),_=[t,0];h.map=_;let S=e.push("thead_open","thead",1);S.map=[t,t+1];let D=e.push("tr_open","tr",1);D.map=[t,t+1];for(let E=0;E<l.length;E++){let I=e.push("th_open","th",1);d[E]&&(I.attrs=[["style","text-align:"+d[E]]]);let T=e.push("inline","",0);T.content=l[E].trim(),T.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let w,x=0;for(o=t+2;o<r&&!(e.sCount[o]<e.blkIndent);o++){let E=!1;for(let T=0,q=m.length;T<q;T++)if(m[T](e,o,r,!0)){E=!0;break}if(E||(u=Fm(e,o).trim(),!u)||e.sCount[o]-e.blkIndent>=4||(l=kC(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),x+=p-l.length,x>T4))break;if(o===t+2){let T=e.push("tbody_open","tbody",1);T.map=w=[t+2,0]}let I=e.push("tr_open","tr",1);I.map=[o,o+1];for(let T=0;T<p;T++){let q=e.push("td_open","td",1);d[T]&&(q.attrs=[["style","text-align:"+d[T]]]);let X=e.push("inline","",0);X.content=l[T]?l[T].trim():"",X.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return w&&(e.push("tbody_close","tbody",-1),w[1]=o),e.push("table_close","table",-1),_[1]=o,e.parentType=f,e.line=o,!0}function Lm(e,t,r){if(e.sCount[t]-e.blkIndent<4)return!1;let n=t+1,o=n;for(;n<r;){if(e.isEmpty(n)){n++;continue}if(e.sCount[n]-e.blkIndent>=4){n++,o=n;continue}break}e.line=o;let i=e.push("code_block","code",0);return i.content=e.getLines(t,o,4+e.blkIndent,!1)+`
`,i.map=[t,e.line],!0}function Um(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||o+3>i)return!1;let s=e.src.charCodeAt(o);if(s!==126&&s!==96)return!1;let a=o;o=e.skipChars(o,s);let u=o-a;if(u<3)return!1;let l=e.src.slice(a,o),d=e.src.slice(o,i);if(s===96&&d.indexOf(String.fromCharCode(s))>=0)return!1;if(n)return!0;let p=t,f=!1;for(;p++,!(p>=r||(o=a=e.bMarks[p]+e.tShift[p],i=e.eMarks[p],o<i&&e.sCount[p]<e.blkIndent));)if(e.src.charCodeAt(o)===s&&!(e.sCount[p]-e.blkIndent>=4)&&(o=e.skipChars(o,s),!(o-a<u)&&(o=e.skipSpaces(o),!(o<i)))){f=!0;break}u=e.sCount[t],e.line=p+(f?1:0);let m=e.push("fence","code",0);return m.info=d,m.content=e.getLines(t+1,p,u,!0),m.markup=l,m.map=[t,e.line],!0}function jm(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t],s=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(n)return!0;let a=[],u=[],l=[],d=[],p=e.md.block.ruler.getRules("blockquote"),f=e.parentType;e.parentType="blockquote";let m=!1,h;for(h=t;h<r;h++){let x=e.sCount[h]<e.blkIndent;if(o=e.bMarks[h]+e.tShift[h],i=e.eMarks[h],o>=i)break;if(e.src.charCodeAt(o++)===62&&!x){let I=e.sCount[h]+1,T,q;e.src.charCodeAt(o)===32?(o++,I++,q=!1,T=!0):e.src.charCodeAt(o)===9?(T=!0,(e.bsCount[h]+I)%4===3?(o++,I++,q=!1):q=!0):T=!1;let X=I;for(a.push(e.bMarks[h]),e.bMarks[h]=o;o<i;){let ae=e.src.charCodeAt(o);if(K(ae))ae===9?X+=4-(X+e.bsCount[h]+(q?1:0))%4:X++;else break;o++}m=o>=i,u.push(e.bsCount[h]),e.bsCount[h]=e.sCount[h]+1+(T?1:0),l.push(e.sCount[h]),e.sCount[h]=X-I,d.push(e.tShift[h]),e.tShift[h]=o-e.bMarks[h];continue}if(m)break;let E=!1;for(let I=0,T=p.length;I<T;I++)if(p[I](e,h,r,!0)){E=!0;break}if(E){e.lineMax=h,e.blkIndent!==0&&(a.push(e.bMarks[h]),u.push(e.bsCount[h]),d.push(e.tShift[h]),l.push(e.sCount[h]),e.sCount[h]-=e.blkIndent);break}a.push(e.bMarks[h]),u.push(e.bsCount[h]),d.push(e.tShift[h]),l.push(e.sCount[h]),e.sCount[h]=-1}let _=e.blkIndent;e.blkIndent=0;let S=e.push("blockquote_open","blockquote",1);S.markup=">";let D=[t,0];S.map=D,e.md.block.tokenize(e,t,h);let w=e.push("blockquote_close","blockquote",-1);w.markup=">",e.lineMax=s,e.parentType=f,D[1]=e.line;for(let x=0;x<d.length;x++)e.bMarks[x+t]=a[x],e.tShift[x+t]=d[x],e.sCount[x+t]=l[x],e.bsCount[x+t]=u[x];return e.blkIndent=_,!0}function qm(e,t,r,n){let o=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.bMarks[t]+e.tShift[t],s=e.src.charCodeAt(i++);if(s!==42&&s!==45&&s!==95)return!1;let a=1;for(;i<o;){let l=e.src.charCodeAt(i++);if(l!==s&&!K(l))return!1;l===s&&a++}if(a<3)return!1;if(n)return!0;e.line=t+1;let u=e.push("hr","hr",0);return u.map=[t,e.line],u.markup=Array(a+1).join(String.fromCharCode(s)),!0}function IC(e,t){let r=e.eMarks[t],n=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(n++);if(o!==42&&o!==45&&o!==43)return-1;if(n<r){let i=e.src.charCodeAt(n);if(!K(i))return-1}return n}function RC(e,t){let r=e.bMarks[t]+e.tShift[t],n=e.eMarks[t],o=r;if(o+1>=n)return-1;let i=e.src.charCodeAt(o++);if(i<48||i>57)return-1;for(;;){if(o>=n)return-1;if(i=e.src.charCodeAt(o++),i>=48&&i<=57){if(o-r>=10)return-1;continue}if(i===41||i===46)break;return-1}return o<n&&(i=e.src.charCodeAt(o),!K(i))?-1:o}function A4(e,t){let r=e.level+2;for(let n=t+2,o=e.tokens.length-2;n<o;n++)e.tokens[n].level===r&&e.tokens[n].type==="paragraph_open"&&(e.tokens[n+2].hidden=!0,e.tokens[n].hidden=!0,n+=2)}function $m(e,t,r,n){let o,i,s,a,u=t,l=!0;if(e.sCount[u]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[u]-e.listIndent>=4&&e.sCount[u]<e.blkIndent)return!1;let d=!1;n&&e.parentType==="paragraph"&&e.sCount[u]>=e.blkIndent&&(d=!0);let p,f,m;if((m=RC(e,u))>=0){if(p=!0,s=e.bMarks[u]+e.tShift[u],f=Number(e.src.slice(s,m-1)),d&&f!==1)return!1}else if((m=IC(e,u))>=0)p=!1;else return!1;if(d&&e.skipSpaces(m)>=e.eMarks[u])return!1;if(n)return!0;let h=e.src.charCodeAt(m-1),_=e.tokens.length;p?(a=e.push("ordered_list_open","ol",1),f!==1&&(a.attrs=[["start",f]])):a=e.push("bullet_list_open","ul",1);let S=[u,0];a.map=S,a.markup=String.fromCharCode(h);let D=!1,w=e.md.block.ruler.getRules("list"),x=e.parentType;for(e.parentType="list";u<r;){i=m,o=e.eMarks[u];let E=e.sCount[u]+m-(e.bMarks[u]+e.tShift[u]),I=E;for(;i<o;){let Q=e.src.charCodeAt(i);if(Q===9)I+=4-(I+e.bsCount[u])%4;else if(Q===32)I++;else break;i++}let T=i,q;T>=o?q=1:q=I-E,q>4&&(q=1);let X=E+q;a=e.push("list_item_open","li",1),a.markup=String.fromCharCode(h);let ae=[u,0];a.map=ae,p&&(a.info=e.src.slice(s,m-1));let we=e.tight,he=e.tShift[u],M=e.sCount[u],L=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=X,e.tight=!0,e.tShift[u]=T-e.bMarks[u],e.sCount[u]=I,T>=o&&e.isEmpty(u+1)?e.line=Math.min(e.line+2,r):e.md.block.tokenize(e,u,r,!0),(!e.tight||D)&&(l=!1),D=e.line-u>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=L,e.tShift[u]=he,e.sCount[u]=M,e.tight=we,a=e.push("list_item_close","li",-1),a.markup=String.fromCharCode(h),u=e.line,ae[1]=u,u>=r||e.sCount[u]<e.blkIndent||e.sCount[u]-e.blkIndent>=4)break;let z=!1;for(let Q=0,pe=w.length;Q<pe;Q++)if(w[Q](e,u,r,!0)){z=!0;break}if(z)break;if(p){if(m=RC(e,u),m<0)break;s=e.bMarks[u]+e.tShift[u]}else if(m=IC(e,u),m<0)break;if(h!==e.src.charCodeAt(m-1))break}return p?a=e.push("ordered_list_close","ol",-1):a=e.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(h),S[1]=u,e.line=u,e.parentType=x,l&&A4(e,_),!0}function zm(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t],s=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(o)!==91)return!1;function a(w){let x=e.lineMax;if(w>=x||e.isEmpty(w))return null;let E=!1;if(e.sCount[w]-e.blkIndent>3&&(E=!0),e.sCount[w]<0&&(E=!0),!E){let q=e.md.block.ruler.getRules("reference"),X=e.parentType;e.parentType="reference";let ae=!1;for(let we=0,he=q.length;we<he;we++)if(q[we](e,w,x,!0)){ae=!0;break}if(e.parentType=X,ae)return null}let I=e.bMarks[w]+e.tShift[w],T=e.eMarks[w];return e.src.slice(I,T+1)}let u=e.src.slice(o,i+1);i=u.length;let l=-1;for(o=1;o<i;o++){let w=u.charCodeAt(o);if(w===91)return!1;if(w===93){l=o;break}else if(w===10){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}else if(w===92&&(o++,o<i&&u.charCodeAt(o)===10)){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}}if(l<0||u.charCodeAt(l+1)!==58)return!1;for(o=l+2;o<i;o++){let w=u.charCodeAt(o);if(w===10){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}else if(!K(w))break}let d=e.md.helpers.parseLinkDestination(u,o,i);if(!d.ok)return!1;let p=e.md.normalizeLink(d.str);if(!e.md.validateLink(p))return!1;o=d.pos;let f=o,m=s,h=o;for(;o<i;o++){let w=u.charCodeAt(o);if(w===10){let x=a(s);x!==null&&(u+=x,i=u.length,s++)}else if(!K(w))break}let _=e.md.helpers.parseLinkTitle(u,o,i);for(;_.can_continue;){let w=a(s);if(w===null)break;u+=w,o=i,i=u.length,s++,_=e.md.helpers.parseLinkTitle(u,o,i,_)}let S;for(o<i&&h!==o&&_.ok?(S=_.str,o=_.pos):(S="",o=f,s=m);o<i;){let w=u.charCodeAt(o);if(!K(w))break;o++}if(o<i&&u.charCodeAt(o)!==10&&S)for(S="",o=f,s=m;o<i;){let w=u.charCodeAt(o);if(!K(w))break;o++}if(o<i&&u.charCodeAt(o)!==10)return!1;let D=hn(u.slice(1,l));return D?(n||(typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[D]>"u"&&(e.env.references[D]={title:S,href:p}),e.line=s),!0):!1}var PC=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"];var k4="[a-zA-Z_:][a-zA-Z0-9:._-]*",I4="[^\"'=<>`\\x00-\\x20]+",R4="'[^']*'",P4='"[^"]*"',D4="(?:"+I4+"|"+R4+"|"+P4+")",N4="(?:\\s+"+k4+"(?:\\s*=\\s*"+D4+")?)",DC="<[A-Za-z][A-Za-z0-9\\-]*"+N4+"*\\s*\\/?>",NC="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",O4="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",M4="<[?][\\s\\S]*?[?]>",F4="<![A-Za-z][^>]*>",B4="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",OC=new RegExp("^(?:"+DC+"|"+NC+"|"+O4+"|"+M4+"|"+F4+"|"+B4+")"),MC=new RegExp("^(?:"+DC+"|"+NC+")");var ri=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+PC.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(MC.source+"\\s*$"),/^$/,!1]];function Wm(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let s=e.src.slice(o,i),a=0;for(;a<ri.length&&!ri[a][0].test(s);a++);if(a===ri.length)return!1;if(n)return ri[a][2];let u=t+1;if(!ri[a][1].test(s)){for(;u<r&&!(e.sCount[u]<e.blkIndent);u++)if(o=e.bMarks[u]+e.tShift[u],i=e.eMarks[u],s=e.src.slice(o,i),ri[a][1].test(s)){s.length!==0&&u++;break}}e.line=u;let l=e.push("html_block","",0);return l.map=[t,u],l.content=e.getLines(t,u,e.blkIndent,!0),!0}function Hm(e,t,r,n){let o=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let s=e.src.charCodeAt(o);if(s!==35||o>=i)return!1;let a=1;for(s=e.src.charCodeAt(++o);s===35&&o<i&&a<=6;)a++,s=e.src.charCodeAt(++o);if(a>6||o<i&&!K(s))return!1;if(n)return!0;i=e.skipSpacesBack(i,o);let u=e.skipCharsBack(i,35,o);u>o&&K(e.src.charCodeAt(u-1))&&(i=u),e.line=t+1;let l=e.push("heading_open","h"+String(a),1);l.markup="########".slice(0,a),l.map=[t,e.line];let d=e.push("inline","",0);d.content=e.src.slice(o,i).trim(),d.map=[t,e.line],d.children=[];let p=e.push("heading_close","h"+String(a),-1);return p.markup="########".slice(0,a),!0}function Vm(e,t,r){let n=e.md.block.ruler.getRules("paragraph");if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.parentType;e.parentType="paragraph";let i=0,s,a=t+1;for(;a<r&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3)continue;if(e.sCount[a]>=e.blkIndent){let m=e.bMarks[a]+e.tShift[a],h=e.eMarks[a];if(m<h&&(s=e.src.charCodeAt(m),(s===45||s===61)&&(m=e.skipChars(m,s),m=e.skipSpaces(m),m>=h))){i=s===61?1:2;break}}if(e.sCount[a]<0)continue;let f=!1;for(let m=0,h=n.length;m<h;m++)if(n[m](e,a,r,!0)){f=!0;break}if(f)break}if(!i)return!1;let u=e.getLines(t,a,e.blkIndent,!1).trim();e.line=a+1;let l=e.push("heading_open","h"+String(i),1);l.markup=String.fromCharCode(s),l.map=[t,e.line];let d=e.push("inline","",0);d.content=u,d.map=[t,e.line-1],d.children=[];let p=e.push("heading_close","h"+String(i),-1);return p.markup=String.fromCharCode(s),e.parentType=o,!0}function Gm(e,t,r){let n=e.md.block.ruler.getRules("paragraph"),o=e.parentType,i=t+1;for(e.parentType="paragraph";i<r&&!e.isEmpty(i);i++){if(e.sCount[i]-e.blkIndent>3||e.sCount[i]<0)continue;let l=!1;for(let d=0,p=n.length;d<p;d++)if(n[d](e,i,r,!0)){l=!0;break}if(l)break}let s=e.getLines(t,i,e.blkIndent,!1).trim();e.line=i;let a=e.push("paragraph_open","p",1);a.map=[t,e.line];let u=e.push("inline","",0);return u.content=s,u.map=[t,e.line],u.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}var Sc=[["table",Bm,["paragraph","reference"]],["code",Lm],["fence",Um,["paragraph","reference","blockquote","list"]],["blockquote",jm,["paragraph","reference","blockquote","list"]],["hr",qm,["paragraph","reference","blockquote","list"]],["list",$m,["paragraph","reference","blockquote"]],["reference",zm],["html_block",Wm,["paragraph","reference","blockquote"]],["heading",Hm,["paragraph","reference","blockquote"]],["lheading",Vm],["paragraph",Gm]];function vc(){this.ruler=new gn;for(let e=0;e<Sc.length;e++)this.ruler.push(Sc[e][0],Sc[e][1],{alt:(Sc[e][2]||[]).slice()})}vc.prototype.tokenize=function(e,t,r){let n=this.ruler.getRules(""),o=n.length,i=e.md.options.maxNesting,s=t,a=!1;for(;s<r&&(e.line=s=e.skipEmptyLines(s),!(s>=r||e.sCount[s]<e.blkIndent));){if(e.level>=i){e.line=r;break}let u=e.line,l=!1;for(let d=0;d<o;d++)if(l=n[d](e,s,r,!1),l){if(u>=e.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");e.tight=!a,e.isEmpty(e.line-1)&&(a=!0),s=e.line,s<r&&e.isEmpty(s)&&(a=!0,s++,e.line=s)}};vc.prototype.parse=function(e,t,r,n){if(!e)return;let o=new this.State(e,t,r,n);this.tokenize(o,o.line,o.lineMax)};vc.prototype.State=AC;var FC=vc;function Ka(e,t,r,n){this.src=e,this.env=r,this.md=t,this.tokens=n,this.tokens_meta=Array(n.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}Ka.prototype.pushPending=function(){let e=new $t("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e};Ka.prototype.push=function(e,t,r){this.pending&&this.pushPending();let n=new $t(e,t,r),o=null;return r<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),n.level=this.level,r>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(o),n};Ka.prototype.scanDelims=function(e,t){let r=this.posMax,n=this.src.charCodeAt(e),o=e>0?this.src.charCodeAt(e-1):32,i=e;for(;i<r&&this.src.charCodeAt(i)===n;)i++;let s=i-e,a=i<r?this.src.charCodeAt(i):32,u=mn(o)||fn(String.fromCharCode(o)),l=mn(a)||fn(String.fromCharCode(a)),d=pn(o),p=pn(a),f=!p&&(!l||d||u),m=!d&&(!u||p||l);return{can_open:f&&(t||!m||u),can_close:m&&(t||!f||l),length:s}};Ka.prototype.Token=$t;var BC=Ka;function L4(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Km(e,t){let r=e.pos;for(;r<e.posMax&&!L4(e.src.charCodeAt(r));)r++;return r===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,r)),e.pos=r,!0)}var U4=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function Jm(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let r=e.pos,n=e.posMax;if(r+3>n||e.src.charCodeAt(r)!==58||e.src.charCodeAt(r+1)!==47||e.src.charCodeAt(r+2)!==47)return!1;let o=e.pending.match(U4);if(!o)return!1;let i=o[1],s=e.md.linkify.matchAtStart(e.src.slice(r-i.length));if(!s)return!1;let a=s.url;if(a.length<=i.length)return!1;let u=a.length;for(;u>0&&a.charCodeAt(u-1)===42;)u--;u!==a.length&&(a=a.slice(0,u));let l=e.md.normalizeLink(a);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-i.length);let d=e.push("link_open","a",1);d.attrs=[["href",l]],d.markup="linkify",d.info="auto";let p=e.push("text","",0);p.content=e.md.normalizeLinkText(a);let f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=a.length-i.length,!0}function Ym(e,t){let r=e.pos;if(e.src.charCodeAt(r)!==10)return!1;let n=e.pending.length-1,o=e.posMax;if(!t)if(n>=0&&e.pending.charCodeAt(n)===32)if(n>=1&&e.pending.charCodeAt(n-1)===32){let i=n-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(r++;r<o&&K(e.src.charCodeAt(r));)r++;return e.pos=r,!0}var Zm=[];for(let e=0;e<256;e++)Zm.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Zm[e.charCodeAt(0)]=1});function Xm(e,t){let r=e.pos,n=e.posMax;if(e.src.charCodeAt(r)!==92||(r++,r>=n))return!1;let o=e.src.charCodeAt(r);if(o===10){for(t||e.push("hardbreak","br",0),r++;r<n&&(o=e.src.charCodeAt(r),!!K(o));)r++;return e.pos=r,!0}let i=e.src[r];if(o>=55296&&o<=56319&&r+1<n){let a=e.src.charCodeAt(r+1);a>=56320&&a<=57343&&(i+=e.src[r+1],r++)}let s="\\"+i;if(!t){let a=e.push("text_special","",0);o<256&&Zm[o]!==0?a.content=i:a.content=s,a.markup=s,a.info="escape"}return e.pos=r+1,!0}function Qm(e,t){let r=e.pos;if(e.src.charCodeAt(r)!==96)return!1;let o=r;r++;let i=e.posMax;for(;r<i&&e.src.charCodeAt(r)===96;)r++;let s=e.src.slice(o,r),a=s.length;if(e.backticksScanned&&(e.backticks[a]||0)<=o)return t||(e.pending+=s),e.pos+=a,!0;let u=r,l;for(;(l=e.src.indexOf("`",u))!==-1;){for(u=l+1;u<i&&e.src.charCodeAt(u)===96;)u++;let d=u-l;if(d===a){if(!t){let p=e.push("code_inline","code",0);p.markup=s,p.content=e.src.slice(r,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return e.pos=u,!0}e.backticks[d]=l}return e.backticksScanned=!0,t||(e.pending+=s),e.pos+=a,!0}function j4(e,t){let r=e.pos,n=e.src.charCodeAt(r);if(t||n!==126)return!1;let o=e.scanDelims(e.pos,!0),i=o.length,s=String.fromCharCode(n);if(i<2)return!1;let a;i%2&&(a=e.push("text","",0),a.content=s,i--);for(let u=0;u<i;u+=2)a=e.push("text","",0),a.content=s+s,e.delimiters.push({marker:n,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function LC(e,t){let r,n=[],o=t.length;for(let i=0;i<o;i++){let s=t[i];if(s.marker!==126||s.end===-1)continue;let a=t[s.end];r=e.tokens[s.token],r.type="s_open",r.tag="s",r.nesting=1,r.markup="~~",r.content="",r=e.tokens[a.token],r.type="s_close",r.tag="s",r.nesting=-1,r.markup="~~",r.content="",e.tokens[a.token-1].type==="text"&&e.tokens[a.token-1].content==="~"&&n.push(a.token-1)}for(;n.length;){let i=n.pop(),s=i+1;for(;s<e.tokens.length&&e.tokens[s].type==="s_close";)s++;s--,i!==s&&(r=e.tokens[s],e.tokens[s]=e.tokens[i],e.tokens[i]=r)}}function q4(e){let t=e.tokens_meta,r=e.tokens_meta.length;LC(e,e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&LC(e,t[n].delimiters)}var eh={tokenize:j4,postProcess:q4};function $4(e,t){let r=e.pos,n=e.src.charCodeAt(r);if(t||n!==95&&n!==42)return!1;let o=e.scanDelims(e.pos,n===42);for(let i=0;i<o.length;i++){let s=e.push("text","",0);s.content=String.fromCharCode(n),e.delimiters.push({marker:n,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function UC(e,t){let r=t.length;for(let n=r-1;n>=0;n--){let o=t[n];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;let i=t[o.end],s=n>0&&t[n-1].end===o.end+1&&t[n-1].marker===o.marker&&t[n-1].token===o.token-1&&t[o.end+1].token===i.token+1,a=String.fromCharCode(o.marker),u=e.tokens[o.token];u.type=s?"strong_open":"em_open",u.tag=s?"strong":"em",u.nesting=1,u.markup=s?a+a:a,u.content="";let l=e.tokens[i.token];l.type=s?"strong_close":"em_close",l.tag=s?"strong":"em",l.nesting=-1,l.markup=s?a+a:a,l.content="",s&&(e.tokens[t[n-1].token].content="",e.tokens[t[o.end+1].token].content="",n--)}}function z4(e){let t=e.tokens_meta,r=e.tokens_meta.length;UC(e,e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&UC(e,t[n].delimiters)}var th={tokenize:$4,postProcess:z4};function rh(e,t){let r,n,o,i,s="",a="",u=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let d=e.pos,p=e.posMax,f=e.pos+1,m=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(m<0)return!1;let h=m+1;if(h<p&&e.src.charCodeAt(h)===40){for(l=!1,h++;h<p&&(r=e.src.charCodeAt(h),!(!K(r)&&r!==10));h++);if(h>=p)return!1;if(u=h,o=e.md.helpers.parseLinkDestination(e.src,h,e.posMax),o.ok){for(s=e.md.normalizeLink(o.str),e.md.validateLink(s)?h=o.pos:s="",u=h;h<p&&(r=e.src.charCodeAt(h),!(!K(r)&&r!==10));h++);if(o=e.md.helpers.parseLinkTitle(e.src,h,e.posMax),h<p&&u!==h&&o.ok)for(a=o.str,h=o.pos;h<p&&(r=e.src.charCodeAt(h),!(!K(r)&&r!==10));h++);}(h>=p||e.src.charCodeAt(h)!==41)&&(l=!0),h++}if(l){if(typeof e.env.references>"u")return!1;if(h<p&&e.src.charCodeAt(h)===91?(u=h+1,h=e.md.helpers.parseLinkLabel(e,h),h>=0?n=e.src.slice(u,h++):h=m+1):h=m+1,n||(n=e.src.slice(f,m)),i=e.env.references[hn(n)],!i)return e.pos=d,!1;s=i.href,a=i.title}if(!t){e.pos=f,e.posMax=m;let _=e.push("link_open","a",1),S=[["href",s]];_.attrs=S,a&&S.push(["title",a]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=h,e.posMax=p,!0}function nh(e,t){let r,n,o,i,s,a,u,l,d="",p=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let m=e.pos+2,h=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(h<0)return!1;if(i=h+1,i<f&&e.src.charCodeAt(i)===40){for(i++;i<f&&(r=e.src.charCodeAt(i),!(!K(r)&&r!==10));i++);if(i>=f)return!1;for(l=i,a=e.md.helpers.parseLinkDestination(e.src,i,e.posMax),a.ok&&(d=e.md.normalizeLink(a.str),e.md.validateLink(d)?i=a.pos:d=""),l=i;i<f&&(r=e.src.charCodeAt(i),!(!K(r)&&r!==10));i++);if(a=e.md.helpers.parseLinkTitle(e.src,i,e.posMax),i<f&&l!==i&&a.ok)for(u=a.str,i=a.pos;i<f&&(r=e.src.charCodeAt(i),!(!K(r)&&r!==10));i++);else u="";if(i>=f||e.src.charCodeAt(i)!==41)return e.pos=p,!1;i++}else{if(typeof e.env.references>"u")return!1;if(i<f&&e.src.charCodeAt(i)===91?(l=i+1,i=e.md.helpers.parseLinkLabel(e,i),i>=0?o=e.src.slice(l,i++):i=h+1):i=h+1,o||(o=e.src.slice(m,h)),s=e.env.references[hn(o)],!s)return e.pos=p,!1;d=s.href,u=s.title}if(!t){n=e.src.slice(m,h);let _=[];e.md.inline.parse(n,e.md,e.env,_);let S=e.push("image","img",0),D=[["src",d],["alt",""]];S.attrs=D,S.children=_,S.content=n,u&&D.push(["title",u])}return e.pos=i,e.posMax=f,!0}var W4=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,H4=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function oh(e,t){let r=e.pos;if(e.src.charCodeAt(r)!==60)return!1;let n=e.pos,o=e.posMax;for(;;){if(++r>=o)return!1;let s=e.src.charCodeAt(r);if(s===60)return!1;if(s===62)break}let i=e.src.slice(n+1,r);if(H4.test(i)){let s=e.md.normalizeLink(i);if(!e.md.validateLink(s))return!1;if(!t){let a=e.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=e.push("text","",0);u.content=e.md.normalizeLinkText(i);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=i.length+2,!0}if(W4.test(i)){let s=e.md.normalizeLink("mailto:"+i);if(!e.md.validateLink(s))return!1;if(!t){let a=e.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=e.push("text","",0);u.content=e.md.normalizeLinkText(i);let l=e.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return e.pos+=i.length+2,!0}return!1}function V4(e){return/^<a[>\s]/i.test(e)}function G4(e){return/^<\/a\s*>/i.test(e)}function K4(e){let t=e|32;return t>=97&&t<=122}function ih(e,t){if(!e.md.options.html)return!1;let r=e.posMax,n=e.pos;if(e.src.charCodeAt(n)!==60||n+2>=r)return!1;let o=e.src.charCodeAt(n+1);if(o!==33&&o!==63&&o!==47&&!K4(o))return!1;let i=e.src.slice(n).match(OC);if(!i)return!1;if(!t){let s=e.push("html_inline","",0);s.content=i[0],V4(s.content)&&e.linkLevel++,G4(s.content)&&e.linkLevel--}return e.pos+=i[0].length,!0}var J4=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Y4=/^&([a-z][a-z0-9]{1,31});/i;function sh(e,t){let r=e.pos,n=e.posMax;if(e.src.charCodeAt(r)!==38||r+1>=n)return!1;if(e.src.charCodeAt(r+1)===35){let i=e.src.slice(r).match(J4);if(i){if(!t){let s=i[1][0].toLowerCase()==="x"?parseInt(i[1].slice(1),16):parseInt(i[1],10),a=e.push("text_special","",0);a.content=wc(s)?Ga(s):Ga(65533),a.markup=i[0],a.info="entity"}return e.pos+=i[0].length,!0}}else{let i=e.src.slice(r).match(Y4);if(i){let s=br(i[0]);if(s!==i[0]){if(!t){let a=e.push("text_special","",0);a.content=s,a.markup=i[0],a.info="entity"}return e.pos+=i[0].length,!0}}}return!1}function jC(e){let t={},r=e.length;if(!r)return;let n=0,o=-2,i=[];for(let s=0;s<r;s++){let a=e[s];if(i.push(0),(e[n].marker!==a.marker||o!==a.token-1)&&(n=s),o=a.token,a.length=a.length||0,!a.close)continue;t.hasOwnProperty(a.marker)||(t[a.marker]=[-1,-1,-1,-1,-1,-1]);let u=t[a.marker][(a.open?3:0)+a.length%3],l=n-i[n]-1,d=l;for(;l>u;l-=i[l]+1){let p=e[l];if(p.marker===a.marker&&p.open&&p.end<0){let f=!1;if((p.close||a.open)&&(p.length+a.length)%3===0&&(p.length%3!==0||a.length%3!==0)&&(f=!0),!f){let m=l>0&&!e[l-1].open?i[l-1]+1:0;i[s]=s-l+m,i[l]=m,a.open=!1,p.end=s,p.close=!1,d=-1,o=-2;break}}}d!==-1&&(t[a.marker][(a.open?3:0)+(a.length||0)%3]=d)}}function ah(e){let t=e.tokens_meta,r=e.tokens_meta.length;jC(e.delimiters);for(let n=0;n<r;n++)t[n]&&t[n].delimiters&&jC(t[n].delimiters)}function uh(e){let t,r,n=0,o=e.tokens,i=e.tokens.length;for(t=r=0;t<i;t++)o[t].nesting<0&&n--,o[t].level=n,o[t].nesting>0&&n++,o[t].type==="text"&&t+1<i&&o[t+1].type==="text"?o[t+1].content=o[t].content+o[t+1].content:(t!==r&&(o[r]=o[t]),r++);t!==r&&(o.length=r)}var lh=[["text",Km],["linkify",Jm],["newline",Ym],["escape",Xm],["backticks",Qm],["strikethrough",eh.tokenize],["emphasis",th.tokenize],["link",rh],["image",nh],["autolink",oh],["html_inline",ih],["entity",sh]],ch=[["balance_pairs",ah],["strikethrough",eh.postProcess],["emphasis",th.postProcess],["fragments_join",uh]];function Ja(){this.ruler=new gn;for(let e=0;e<lh.length;e++)this.ruler.push(lh[e][0],lh[e][1]);this.ruler2=new gn;for(let e=0;e<ch.length;e++)this.ruler2.push(ch[e][0],ch[e][1])}Ja.prototype.skipToken=function(e){let t=e.pos,r=this.ruler.getRules(""),n=r.length,o=e.md.options.maxNesting,i=e.cache;if(typeof i[t]<"u"){e.pos=i[t];return}let s=!1;if(e.level<o){for(let a=0;a<n;a++)if(e.level++,s=r[a](e,!0),e.level--,s){if(t>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;s||e.pos++,i[t]=e.pos};Ja.prototype.tokenize=function(e){let t=this.ruler.getRules(""),r=t.length,n=e.posMax,o=e.md.options.maxNesting;for(;e.pos<n;){let i=e.pos,s=!1;if(e.level<o){for(let a=0;a<r;a++)if(s=t[a](e,!1),s){if(i>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(e.pos>=n)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()};Ja.prototype.parse=function(e,t,r,n){let o=new this.State(e,t,r,n);this.tokenize(o);let i=this.ruler2.getRules(""),s=i.length;for(let a=0;a<s;a++)i[a](o)};Ja.prototype.State=BC;var qC=Ja;function $C(e){let t={};e=e||{},t.src_Any=fc.source,t.src_Cc=mc.source,t.src_Z=gc.source,t.src_P=Xo.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");let r="[><\uFF5C]";return t.src_pseudo_letter="(?:(?!"+r+"|"+t.src_ZPCc+")"+t.src_Any+")",t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth="(?:(?:(?!"+t.src_ZCc+"|[@/\\[\\]()]).)+@)?",t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator="(?=$|"+r+"|"+t.src_ZPCc+")(?!"+(e["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+t.src_ZPCc+"))",t.src_path="(?:[/?#](?:(?!"+t.src_ZCc+"|"+r+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+t.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+t.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+"|[']).)+\\'|\\'(?="+t.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+t.src_ZCc+"|[.]|$)|"+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+t.src_ZCc+"|$)|;(?!"+t.src_ZCc+"|$)|\\!+(?!"+t.src_ZCc+"|[!]|$)|\\?(?!"+t.src_ZCc+"|[?]|$))+|\\/)?",t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+"|"+t.src_pseudo_letter+"{1,63})",t.src_domain="(?:"+t.src_xn+"|(?:"+t.src_pseudo_letter+")|(?:"+t.src_pseudo_letter+"(?:-|"+t.src_pseudo_letter+"){0,61}"+t.src_pseudo_letter+"))",t.src_host="(?:(?:(?:(?:"+t.src_domain+")\\.)*"+t.src_domain+"))",t.tpl_host_fuzzy="(?:"+t.src_ip4+"|(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%)))",t.tpl_host_no_ip_fuzzy="(?:(?:(?:"+t.src_domain+")\\.)+(?:%TLDS%))",t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+t.src_ZPCc+"|>|$))",t.tpl_email_fuzzy="(^|"+r+'|"|\\(|'+t.src_ZCc+")("+t.src_email_name+"@"+t.tpl_host_fuzzy_strict+")",t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+t.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+t.tpl_host_port_fuzzy_strict+t.src_path+")",t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+t.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+")",t}function dh(e){return Array.prototype.slice.call(arguments,1).forEach(function(r){r&&Object.keys(r).forEach(function(n){e[n]=r[n]})}),e}function Cc(e){return Object.prototype.toString.call(e)}function Z4(e){return Cc(e)==="[object String]"}function X4(e){return Cc(e)==="[object Object]"}function Q4(e){return Cc(e)==="[object RegExp]"}function zC(e){return Cc(e)==="[object Function]"}function e8(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var HC={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function t8(e){return Object.keys(e||{}).reduce(function(t,r){return t||HC.hasOwnProperty(r)},!1)}var r8={"http:":{validate:function(e,t,r){let n=e.slice(t);return r.re.http||(r.re.http=new RegExp("^\\/\\/"+r.re.src_auth+r.re.src_host_port_strict+r.re.src_path,"i")),r.re.http.test(n)?n.match(r.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,r){let n=e.slice(t);return r.re.no_http||(r.re.no_http=new RegExp("^"+r.re.src_auth+"(?:localhost|(?:(?:"+r.re.src_domain+")\\.)+"+r.re.src_domain_root+")"+r.re.src_port+r.re.src_host_terminator+r.re.src_path,"i")),r.re.no_http.test(n)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:n.match(r.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,r){let n=e.slice(t);return r.re.mailto||(r.re.mailto=new RegExp("^"+r.re.src_email_name+"@"+r.re.src_host_strict,"i")),r.re.mailto.test(n)?n.match(r.re.mailto)[0].length:0}}},n8="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",o8="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");function i8(e){e.__index__=-1,e.__text_cache__=""}function s8(e){return function(t,r){let n=t.slice(r);return e.test(n)?n.match(e)[0].length:0}}function WC(){return function(e,t){t.normalize(e)}}function Ec(e){let t=e.re=$C(e.__opts__),r=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||r.push(n8),r.push(t.src_xn),t.src_tlds=r.join("|");function n(a){return a.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(n(t.tpl_email_fuzzy),"i"),t.link_fuzzy=RegExp(n(t.tpl_link_fuzzy),"i"),t.link_no_ip_fuzzy=RegExp(n(t.tpl_link_no_ip_fuzzy),"i"),t.host_fuzzy_test=RegExp(n(t.tpl_host_fuzzy_test),"i");let o=[];e.__compiled__={};function i(a,u){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+u)}Object.keys(e.__schemas__).forEach(function(a){let u=e.__schemas__[a];if(u===null)return;let l={validate:null,link:null};if(e.__compiled__[a]=l,X4(u)){Q4(u.validate)?l.validate=s8(u.validate):zC(u.validate)?l.validate=u.validate:i(a,u),zC(u.normalize)?l.normalize=u.normalize:u.normalize?i(a,u):l.normalize=WC();return}if(Z4(u)){o.push(a);return}i(a,u)}),o.forEach(function(a){e.__compiled__[e.__schemas__[a]]&&(e.__compiled__[a].validate=e.__compiled__[e.__schemas__[a]].validate,e.__compiled__[a].normalize=e.__compiled__[e.__schemas__[a]].normalize)}),e.__compiled__[""]={validate:null,normalize:WC()};let s=Object.keys(e.__compiled__).filter(function(a){return a.length>0&&e.__compiled__[a]}).map(e8).join("|");e.re.schema_test=RegExp("(^|(?!_)(?:[><\uFF5C]|"+t.src_ZPCc+"))("+s+")","i"),e.re.schema_search=RegExp("(^|(?!_)(?:[><\uFF5C]|"+t.src_ZPCc+"))("+s+")","ig"),e.re.schema_at_start=RegExp("^"+e.re.schema_search.source,"i"),e.re.pretest=RegExp("("+e.re.schema_test.source+")|("+e.re.host_fuzzy_test.source+")|@","i"),i8(e)}function a8(e,t){let r=e.__index__,n=e.__last_index__,o=e.__text_cache__.slice(r,n);this.schema=e.__schema__.toLowerCase(),this.index=r+t,this.lastIndex=n+t,this.raw=o,this.text=o,this.url=o}function ph(e,t){let r=new a8(e,t);return e.__compiled__[r.schema].normalize(r,e),r}function Pe(e,t){if(!(this instanceof Pe))return new Pe(e,t);t||t8(e)&&(t=e,e={}),this.__opts__=dh({},HC,t),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=dh({},r8,e),this.__compiled__={},this.__tlds__=o8,this.__tlds_replaced__=!1,this.re={},Ec(this)}Pe.prototype.add=function(t,r){return this.__schemas__[t]=r,Ec(this),this};Pe.prototype.set=function(t){return this.__opts__=dh(this.__opts__,t),this};Pe.prototype.test=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return!1;let r,n,o,i,s,a,u,l,d;if(this.re.schema_test.test(t)){for(u=this.re.schema_search,u.lastIndex=0;(r=u.exec(t))!==null;)if(i=this.testSchemaAt(t,r[2],u.lastIndex),i){this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=t.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(n=t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(s=n.index+n[1].length,(this.__index__<0||s<this.__index__)&&(this.__schema__="",this.__index__=s,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(d=t.indexOf("@"),d>=0&&(o=t.match(this.re.email_fuzzy))!==null&&(s=o.index+o[1].length,a=o.index+o[0].length,(this.__index__<0||s<this.__index__||s===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=a))),this.__index__>=0};Pe.prototype.pretest=function(t){return this.re.pretest.test(t)};Pe.prototype.testSchemaAt=function(t,r,n){return this.__compiled__[r.toLowerCase()]?this.__compiled__[r.toLowerCase()].validate(t,n,this):0};Pe.prototype.match=function(t){let r=[],n=0;this.__index__>=0&&this.__text_cache__===t&&(r.push(ph(this,n)),n=this.__last_index__);let o=n?t.slice(n):t;for(;this.test(o);)r.push(ph(this,n)),o=o.slice(this.__last_index__),n+=this.__last_index__;return r.length?r:null};Pe.prototype.matchAtStart=function(t){if(this.__text_cache__=t,this.__index__=-1,!t.length)return null;let r=this.re.schema_at_start.exec(t);if(!r)return null;let n=this.testSchemaAt(t,r[2],r[0].length);return n?(this.__schema__=r[2],this.__index__=r.index+r[1].length,this.__last_index__=r.index+r[0].length+n,ph(this,0)):null};Pe.prototype.tlds=function(t,r){return t=Array.isArray(t)?t:[t],r?(this.__tlds__=this.__tlds__.concat(t).sort().filter(function(n,o,i){return n!==i[o-1]}).reverse(),Ec(this),this):(this.__tlds__=t.slice(),this.__tlds_replaced__=!0,Ec(this),this)};Pe.prototype.normalize=function(t){t.schema||(t.url="http://"+t.url),t.schema==="mailto:"&&!/^mailto:/i.test(t.url)&&(t.url="mailto:"+t.url)};Pe.prototype.onCompile=function(){};var VC=Pe;var hh=ng(eT(),1);var tT={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}};var rT={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}};var nT={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}};var y8={default:tT,zero:rT,commonmark:nT},_8=/^(vbscript|javascript|file|data):/,w8=/^data:image\/(gif|png|jpeg|webp);/;function x8(e){let t=e.trim().toLowerCase();return _8.test(t)?w8.test(t):!0}var oT=["http:","https:","mailto:"];function S8(e){let t=Va(e,!0);if(t.hostname&&(!t.protocol||oT.indexOf(t.protocol)>=0))try{t.hostname=hh.default.toASCII(t.hostname)}catch{}return cc(Zo(t))}function v8(e){let t=Va(e,!0);if(t.hostname&&(!t.protocol||oT.indexOf(t.protocol)>=0))try{t.hostname=hh.default.toUnicode(t.hostname)}catch{}return Ha(Zo(t),Ha.defaultChars+"%")}function je(e,t){if(!(this instanceof je))return new je(e,t);t||_c(e)||(t=e||{},e="default"),this.inline=new qC,this.block=new FC,this.core=new TC,this.renderer=new wC,this.linkify=new VC,this.validateLink=x8,this.normalizeLink=S8,this.normalizeLinkText=v8,this.utils=Sm,this.helpers=Qo({},Tm),this.options={},this.configure(e),t&&this.set(t)}je.prototype.set=function(e){return Qo(this.options,e),this};je.prototype.configure=function(e){let t=this;if(_c(e)){let r=e;if(e=y8[r],!e)throw new Error('Wrong `markdown-it` preset "'+r+'", check name')}if(!e)throw new Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(r){e.components[r].rules&&t[r].ruler.enableOnly(e.components[r].rules),e.components[r].rules2&&t[r].ruler2.enableOnly(e.components[r].rules2)}),this};je.prototype.enable=function(e,t){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.enable(e,!0))},this),r=r.concat(this.inline.ruler2.enable(e,!0));let n=e.filter(function(o){return r.indexOf(o)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this};je.prototype.disable=function(e,t){let r=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(function(o){r=r.concat(this[o].ruler.disable(e,!0))},this),r=r.concat(this.inline.ruler2.disable(e,!0));let n=e.filter(function(o){return r.indexOf(o)<0});if(n.length&&!t)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this};je.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this};je.prototype.parse=function(e,t){if(typeof e!="string")throw new Error("Input data should be a String");let r=new this.core.State(e,this,t);return this.core.process(r),r.tokens};je.prototype.render=function(e,t){return t=t||{},this.renderer.render(this.parse(e,t),this.options,t)};je.prototype.parseInline=function(e,t){let r=new this.core.State(e,this,t);return r.inlineMode=!0,this.core.process(r),r.tokens};je.prototype.renderInline=function(e,t){return t=t||{},this.renderer.render(this.parseInline(e,t),this.options,t)};var gh=je;var bh="tab_clipboard_write",yh=async({items:e})=>{if(navigator.clipboard?.write==null)throw new Error("navigator.clipboard.write is not available");let t=navigator.clipboard,r=i=>{let s=atob(i),a=new Uint8Array(s.length);for(let u=0;u<s.length;u+=1)a[u]=s.charCodeAt(u);return a.buffer},n=(i,s)=>({types:Object.keys(i),presentationStyle:s,getType:async a=>{let u=i[a];if(u==null)throw new DOMException(`No fake clipboard entry for ${a}`,"NotFoundError");return u}}),o=e.map(i=>{let s={};for(let a of i.entries){let u;if(typeof a.text=="string")u=a.text;else if(typeof a.base64=="string")u=r(a.base64);else throw new Error("Clipboard entry must include text or base64");s[a.mime_type]=new Blob([u],{type:a.mime_type})}if(i.presentation_style!=null&&i.presentation_style!=="unspecified"){if(typeof ClipboardItem!="function"){if(t.__browserUseFakeClipboard!==!0)throw new Error("ClipboardItem is not available");return n(s,i.presentation_style)}return new ClipboardItem(s,{presentationStyle:i.presentation_style})}if(typeof ClipboardItem!="function"){if(t.__browserUseFakeClipboard!==!0)throw new Error("ClipboardItem is not available");return n(s,"unspecified")}return new ClipboardItem(s)});await t.write(o)},iT=y(bh,async(e,t)=>{let r=A(e.tab_id);return ac(e.items,bh),await Re({args:{items:e.items},commandType:bh,ctx:t,pageFunction:yh,tabId:r}),{}});var E8=new gh({breaks:!0,html:!1,linkify:!1,typographer:!1});async function bn(e,t,r){if(typeof e.text!="string")throw new Error(`${r} requires text`);let n=A(e.tab_id),o=e.includeRichText!==!1&&await T8(n,t),i=k8(e.text,o);ac(i,r),await Re({args:{items:i},commandType:r,ctx:t,pageFunction:yh,tabId:n,...e.target!=null?{target:e.target}:{}}),await Re({args:e.iabInputTargetToken==null?{replaceInputValue:e.replaceInputValue}:{iabInputTargetToken:e.iabInputTargetToken,replaceInputValue:e.replaceInputValue},commandType:r,ctx:t,pageFunction:sc,tabId:n,...e.target!=null?{target:e.target}:{}})}function C8(e){return I8(E8.render(e),e)}async function T8(e,t){let r=await t.tabs.get(e);return A8(r.url)}function A8(e){return R8(e)!=="spreadsheets"}function k8(e,t){let r=[{mime_type:"text/plain",text:e}];return t&&r.push({mime_type:"text/html",text:C8(e)}),[{entries:r,presentation_style:"unspecified"}]}function I8(e,t){let r=e.trim();if(t.trim().length===0)return _h(t);let n=_h(t),o=_h(Array.from(t).reverse(),!0),i="<p>",s="</p>";if(r.startsWith(i)&&r.endsWith(s)){let a=r.slice(i.length,-s.length);a.includes(i)||(r=n+a+o)}return r===e.trim()?n+r+o:r}function _h(e,t=!1){let r=[];for(let n of e){if(/\r|\n|\u2028|\u2029/.test(n)){r.push("<br>");continue}if(/\s/.test(n)){r.push("&nbsp;");continue}break}return t&&r.reverse(),r.join("")}function R8(e){if(e==null)return null;let t;try{t=new URL(e)}catch{return null}if(t.host!=="docs.google.com")return null;let r=t.pathname.split("/").filter(Boolean)[0];return r!=="document"&&r!=="spreadsheets"&&r!=="presentation"?null:r}var wh=y("cua_type",async(e,t)=>(await bn(e,t,wh.type),{}));var sT=y("browser_user_claim_tab",async(e,t)=>{let r=A(e.tab_id),n=await t.browserUser.claimTab(r);return{id:String(n.id),...n.title==null?{}:{title:n.title},...n.url==null?{}:{url:n.url}}});var aT=y("browser_user_history",async(e,t)=>{let r=P8(e);return{items:(await t.browserUser.history(r)).map(o=>({url:o.url,...o.title==null?{}:{title:o.title},dateVisited:o.dateVisited}))}});function P8(e){let t={};if(e.query!=null){if(typeof e.query!="string")throw new Error("browser_user_history requires query to be a string");t.query=e.query}if(e.limit!=null){if(!Number.isInteger(e.limit)||e.limit<=0)throw new Error("browser_user_history requires limit to be a positive integer");t.limit=e.limit}if(e.from!=null){if(typeof e.from!="string"||Number.isNaN(Date.parse(e.from)))throw new Error("browser_user_history requires from to be a valid date");t.from=e.from}if(e.to!=null){if(typeof e.to!="string"||Number.isNaN(Date.parse(e.to)))throw new Error("browser_user_history requires to to be a valid date");t.to=e.to}return t}var uT=y("browser_user_open_tabs",async(e,t)=>({tabs:(await t.browserUser.openTabs()).map(n=>({id:String(n.id),...n.title==null?{}:{title:n.title},...n.url==null?{}:{url:n.url},...n.lastOpened==null?{}:{lastOpened:n.lastOpened},...n.tabGroup==null?{}:{tabGroup:n.tabGroup}}))}));function qe(){return globalThis.nodeRepl?.requestMeta?.["x-codex-turn-metadata"]}function _r(e=qe()){if(e?.thread_source==="subagent"&&typeof e.thread_id=="string")return e.thread_id;let t=e?.session_id;return typeof t=="string"?t:void 0}function D8(){let e=qe();return["session_id","turn_id"].filter(r=>typeof e?.[r]!="string")}function Tc(){let e=D8();if(e.length!==0)throw new Error(`Missing required Codex turn metadata: ${e.join(", ")}`)}async function pT(e,t=Me()){return N8(e,t)}async function N8(e,t){if(t==null)return null;try{let[r,n]=await Promise.all([t.config.readRequirements(),t.config.read({cwd:t.cwd??globalThis.nodeRepl?.cwd??null,includeLayers:!1})]);return B8(O8(r,n),e)}catch{return"deny"}}function O8(e,t){let r={enabled:null,allowedDomains:[],deniedDomains:[],hardDenyAllowlistMisses:!1},n=yn(yn(e.requirements)?.network);n!=null&&(lT(r,n),r.hardDenyAllowlistMisses=vh(n,"managedAllowedDomainsOnly","managed_allowed_domains_only")??!1);let o=M8(t);return r.hardDenyAllowlistMisses?o!=null&&(vh(o,"enabled")===!1&&(r.enabled=!1),F8(r,o)):o!=null&&lT(r,o),r}function M8(e){let t=yn(e.config)??e,r=$8(t,"default_permissions","defaultPermissions");return r==null?null:yn(yn(yn(t.permissions)?.[r])?.network)??null}function lT(e,t){let r=vh(t,"enabled");r!=null&&(!r||e.enabled==null)&&(e.enabled=r);let[n,o]=fT(t);Sh(e.allowedDomains,n),Sh(e.deniedDomains,o)}function F8(e,t){let[,r]=fT(t);Sh(e.deniedDomains,r)}function fT(e){let t=yn(e.domains);if(t!=null){let r=[],n=[];for(let[o,i]of Object.entries(t))i==="allow"?r.push(o):i==="deny"&&n.push(o);return[r,n]}return[dT(e,"allowedDomains","allowed_domains"),dT(e,"deniedDomains","denied_domains")]}function B8(e,t){let r=L8(t);return r==null?null:e.enabled===!1||cT(e.deniedDomains,r)?"deny":!e.hardDenyAllowlistMisses||cT(e.allowedDomains,r)?null:"deny"}function L8(e){try{let t=new URL(e);return t.protocol!=="http:"&&t.protocol!=="https:"?null:Ya(t.host)}catch{return null}}function cT(e,t){return e.some(r=>U8(r,t))}function U8(e,t){let r=j8(e),n=Ya(t);if(r.length===0||n.length===0)return!1;if(r==="*")return!0;if(r.startsWith("**.")){let o=r.slice(3);return n===o||n.endsWith(`.${o}`)}return q8(r,n)}function j8(e){let t=e.trim();return t==="*"?"*":t.startsWith("**.")?`**.${Ya(t.slice(3))}`:t.startsWith("*.")?`*.${Ya(t.slice(2))}`:Ya(t)}function Ya(e){let t=e.trim();if(t.startsWith("[")){let r=t.indexOf("]");if(r!==-1)return xh(t.slice(1,r))}return(t.match(/:/g)??[]).length===1?xh(t.split(":")[0]??""):xh(t)}function xh(e){return e.toLowerCase().replace(/\.+$/u,"")}function q8(e,t){let n=`^${e.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`;return new RegExp(n,"u").test(t)}function Sh(e,t){for(let r of t)e.some(n=>n.toLowerCase()===r.toLowerCase())||e.push(r)}function yn(e){return e==null||typeof e!="object"||Array.isArray(e)?null:e}function vh(e,...t){for(let r of t)if(typeof e[r]=="boolean")return e[r]}function $8(e,...t){for(let r of t)if(typeof e[r]=="string")return e[r].trim()||null;return null}function dT(e,...t){for(let r of t){let n=e[r];if(Array.isArray(n))return n.filter(o=>typeof o=="string").map(o=>o.trim()).filter(o=>o.length>0)}return[]}function wr(e){return e?.privilegedNodeRepl??Me()}var z8="approval_mode",W8="history_approval_mode",H8="never_ask",V8="origins",G8="full_cdp",K8="downloads",J8="uploads",Ic="allowed",Rc="denied",Y8="download_approval_mode",Z8="upload_approval_mode",bT="browsing_history",mT="approvals_reviewer",X8="guardian_subagent",Q8="auto_review",e5=300*1e3,ni=new Map;async function yT(e,t){return Nc({conversationId:xr(),resource:{kind:"origin",origin:e},turn:Sr()},wr(t))}async function Pc(e,t,r){return Nc({conversationId:xr(),resource:{kind:"fileTransfer",origin:t,transferKind:e},turn:Sr()},wr(r))}async function _T(e,t){return Nc({conversationId:xr(),resource:{kind:"fullCdp",origin:e},turn:Sr()},wr(t))}async function wT(e){return Nc({conversationId:xr(),resource:{kind:"sensitiveData",sensitiveData:bT},turn:Sr()},wr(e))}async function xT(e,t,r){await Oc({conversationId:xr(),resource:{kind:"origin",origin:e},turn:Sr()},!0,t,wr(r))}async function Dc(e,t,r,n){await Oc({conversationId:xr(),resource:{kind:"fileTransfer",origin:t,transferKind:e},turn:Sr()},!1,r,wr(n))}async function ST(e,t,r){await Oc({conversationId:xr(),resource:{kind:"fullCdp",origin:e},turn:Sr()},!1,t,wr(r))}async function vT(e,t){await Oc({conversationId:xr(),resource:{kind:"sensitiveData",sensitiveData:bT},turn:Sr()},!1,e,wr(t))}async function Nc(e,t){let r=null;e.resource.kind==="origin"&&(r=await pT(e.resource.origin,t));try{let n=await Ch(t,Xi),o=i5(n,e.resource),i=Th(e.resource),s=i==null?{}:await o5(t,e.conversationId),a=hT(n,i),u=hT(s,i),l=w5(e.resource);return d5(e),u!=null&&Ac(u,Rc,l)?{decision:"deny",scope:"conversation",source:"browser-use-persisted-state"}:a!=null&&Ac(a,Rc,l)?{decision:"deny",scope:"global",source:"browser-use-persisted-state"}:r==="deny"?{decision:"deny",scope:"global",source:"codex-network-policy"}:p5(e)?{decision:"approve",scope:"turn",source:"guardian-origin-cache"}:u!=null&&Ac(u,Ic,l)?{decision:"approve",scope:"conversation",source:"browser-use-persisted-state"}:a!=null&&Ac(a,Ic,l)?{decision:"approve",scope:"global",source:"browser-use-persisted-state"}:o==="never_ask"?{decision:"approve",scope:"global",source:"browser-use-persisted-state"}:null}catch{return null}}async function Oc(e,t,r,n){try{if(t5(e,t,r))return;await r5(e,r,n)}catch{}}function t5(e,t,r){return m5(t,r)?(r.action==="accept"&&f5(e),!0):!1}async function r5(e,t,r){if(r==null)return;let n=t.action==="accept"?"approve":t.action==="decline"?"deny":null;if(n==null||!s5(e.resource))return;let o=u5(t)??(a5(e.resource)?"conversation":null);o!=null&&await n5(r,e,o,n)}async function n5(e,t,r,n){let o=l5(r,t.conversationId);if(o==null)return;let i=await Ch(e,o),s=Th(t.resource);if(s==null)return;let a=b5(i,s),[u,l]=n==="approve"?[Ic,Rc]:[Rc,Ic],d=S5(kc(t.resource));gT(a,l,kc(t.resource)),d!==kc(t.resource)&&gT(a,l,d),y5(a,u,d),await e.config.writeToml(o,i)}async function Ch(e,t){if(e==null)return{};let r=await e.config.readToml(t);return Mc(r)?r:{}}async function o5(e,t){let r=ET(t);return r==null?{}:Ch(e,r)}function xr(){let e=qe(),t=_r(e);return typeof t=="string"?t:h5(globalThis.nodeRepl?.requestMeta)}function Sr(){let e=qe(),t=_r(e);return typeof t=="string"&&typeof e?.turn_id=="string"?{sessionId:t,turnId:e.turn_id}:g5(globalThis.nodeRepl?.requestMeta)}function i5(e,t){let r;switch(t.kind){case"origin":r=z8;break;case"fileTransfer":r=t.transferKind==="download"?Y8:Z8;break;case"fullCdp":return"always_ask";case"sensitiveData":r=W8;break}return e[r]===H8?"never_ask":"always_ask"}function Th(e){switch(e.kind){case"origin":return V8;case"fileTransfer":return e.transferKind==="download"?K8:J8;case"fullCdp":return G8;case"sensitiveData":return null}}function kc(e){switch(e.kind){case"origin":case"fileTransfer":case"fullCdp":return e.origin;case"sensitiveData":return e.sensitiveData}}function s5(e){return Th(e)!=null}function a5(e){return e.kind==="origin"||e.kind==="fullCdp"}function u5(e){for(let t of[e.meta,e._meta,e.content]){let r=Mc(t)?t.persist:void 0;if(r==="session")return"conversation";if(r==="always")return"global"}return null}function l5(e,t){return e==="global"?Xi:ET(t)}function ET(e){return c5(e)?`browser/sessions/${e}.toml`:null}function c5(e){return typeof e=="string"&&e.length>0&&e.length<=128&&/^[A-Za-z0-9_-]+$/u.test(e)}function d5(e){let t=e.turn;if(t==null||e.resource.kind!=="origin")return;let r=ni.get(t.sessionId);if(r!=null){if(r.expiresAt<=Date.now()){ni.delete(t.sessionId);return}(r.turnId!==t.turnId||r.origin!==e.resource.origin)&&ni.delete(t.sessionId)}}function p5(e){let t=e.turn;if(t==null||e.resource.kind!=="origin")return!1;let r=ni.get(t.sessionId);return r==null?!1:r.expiresAt<=Date.now()?(ni.delete(t.sessionId),!1):r.turnId===t.turnId&&r.origin===e.resource.origin}function f5(e){let t=e.turn;t==null||e.resource.kind!=="origin"||ni.set(t.sessionId,{expiresAt:Date.now()+e5,origin:e.resource.origin,turnId:t.turnId})}function m5(e,t){if(!e)return!1;let r=t.meta?.[mT]??t._meta?.[mT];return r===X8||r===Q8}function h5(e){if(e!=null)for(let t of["conversation_id","conversationId","thread_id","threadId","session_id","sessionId"]){let r=e[t];if(typeof r=="string"&&r.trim().length>0)return r}}function g5(e){if(e==null)return;let t;for(let n of["conversation_id","thread_id","session_id"]){let o=e[n];if(typeof o=="string"&&o.trim().length>0){t=o;break}}let r;for(let n of["turn_id","turnId"]){let o=e[n];if(typeof o=="string"&&o.trim().length>0){r=o;break}}if(!(t==null||r==null))return{sessionId:t,turnId:r}}function hT(e,t){if(t==null)return null;let r=e[t];return Mc(r)?r:null}function b5(e,t){let r=e[t];if(r==null){let n={};return e[t]=n,n}if(!Mc(r))throw new Error(`browser-use table ${t} must be an object`);return r}function y5(e,t,r){let n=e[t];if(n==null){e[t]=[r];return}if(!Array.isArray(n))throw new Error(`browser-use table key ${t} must be an array`);let o=n.filter(i=>typeof i=="string");o.includes(r)||o.push(r),e[t]=o}function gT(e,t,r){let n=e[t];Array.isArray(n)&&(e[t]=n.filter(o=>o!==r))}function Ac(e,t,r){let n=e[t];return Array.isArray(n)?n.some(o=>typeof o=="string"&&_5(o.trim(),r)):!1}function _5(e,t){return e.includes("://")?Eh(e,t.raw):t.hostPort!=null?Eh(e,t.hostPort):!t.raw.includes("://")&&Eh(e,t.raw)}function w5(e){let t=kc(e),r=e.kind==="origin"||e.kind==="fileTransfer"||e.kind==="fullCdp"?x5(e.origin):null;return{raw:t,hostPort:r!=null&&r!==t?r:null}}function x5(e){let t=e.indexOf("://");if(t===-1)return null;let r=e.slice(0,t);if(r.toLowerCase()!=="http"&&r.toLowerCase()!=="https")return null;let n=e.slice(t+3),o=n.search(/[/?#]/u),s=(o===-1?n:n.slice(0,o)).split("@").at(-1)?.trim()??"";return s.length>0?s:null}function S5(e){let t="";for(let r of e)r==="*"?t+="\\*":r==="\\"?t+="\\\\":t+=r;return t}function Eh(e,t){let r=v5(e);if(r.length===1)return r[0]===t;let[n=""]=r,o=t;if(n.length>0){if(!o.startsWith(n))return!1;o=o.slice(n.length)}for(let s of r.slice(1,-1)){if(s.length===0)continue;let a=o.indexOf(s);if(a===-1)return!1;o=o.slice(a+s.length)}let i=r.at(-1)??"";return i.length===0||o.endsWith(i)}function v5(e){let t=[],r="";for(let n=0;n<e.length;n+=1){let o=e[n];if(o==="*"){t.push(r),r="";continue}if(o==="\\"){let i=e[n+1];if(i==="*"||i==="\\"){r+=i,n+=1;continue}}r+=o}return t.push(r),t}function Mc(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}async function CT(e,t,r){let n=await yT(t,r);if(n?.decision==="approve")return;if(n?.decision==="deny"){let s=n.source==="codex-network-policy"?`Browser Use cannot access ${t} because enterprise network policy blocks it.`:`The user has requested that ${t} should not be used.`;throw new Error(J(s))}let o=e();if(o==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to access ${t}. Please use another source or try another approach.`));let i=await o({message:`Allow Browser Use to access ${t}?`,meta:{codex_approval_kind:"mcp_tool_call",codex_request_type:"approval_request",connector_id:"browser-use",connector_name:"Browser Use",persist:"always",tool_name:"access_browser_origin",tool_title:"Access browser origin",tool_params:{origin:t},tool_params_display:[],origin:t}});if(await xT(t,i,r),i.action!=="accept")throw new Error(J(`The user has requested that ${t} should not be used.`))}async function TT(e,t,r){if((await wT(r))?.decision==="approve")return;let o=e();if(o==null)throw new Error("Browser Use encountered an error attempting to request permission to read browsing history. Please use another source or try another approach.");let i=await o({message:"Allow Browser Use to read your browsing history?",meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",tool_params:t,sensitive_data:"browsing_history"}});if(await vT(i,r),i.action!=="accept")throw new Error("The user has requested that browsing history not be read.")}function $e(e){let t=kT(e);return t==null?null:t.protocol==="file:"?E5(t):IT(t)}function AT(e){return IT(kT(e))}function kT(e){if(typeof e!="string"||e.trim().length===0)return null;try{return new URL(e)}catch{return null}}function IT(e){return e==null||e.protocol!=="http:"&&e.protocol!=="https:"?null:e.origin}function E5(e){return e.search="",e.hash="",e.href}import{Buffer as Lc}from"node:buffer";import{Buffer as Ah}from"node:buffer";import{endianness as RT}from"node:os";var De=4;function Fc(e){let t=Buffer.from(e,"utf8"),r=Buffer.alloc(De+t.length);return C5(r,t.length,0),t.copy(r,De),r}function oi(e,t=0){return RT()==="LE"?e.readUInt32LE(t):e.readUInt32BE(t)}function C5(e,t,r){RT()==="LE"?e.writeUInt32LE(t,r):e.writeUInt32BE(t,r)}function PT(e){let t=[],r=0;for(;e.length-r>=De;){let n=oi(e,r),o=De+n;if(e.length-r<o)break;let i=e.subarray(r+De,r+o).toString("utf8");r+=o;try{t.push(i)}catch{}}return{messages:t,remainingData:e.subarray(r)}}function Ih(){let e="privileged native pipe bridge is not available; browser-client is not trusted";return Qn()==="production"?e:`${e}. Browser Use loaded stale or overwritten bundled plugins. Another Codex app may have overwritten them. Ask the user to use Debug Menu > Plugins > Reload bundled plugins, then retry.`}function Za(){let e=globalThis.nodeRepl?.nativePipe;return e==null||typeof e.createConnection!="function"?null:e}var Bc=class e{constructor(t){this.socket=t;t!=null&&(t.on("data",r=>this.handleData(r)),t.on("error",r=>{this.socket===t&&this.markClosed(r)}),t.on("close",()=>{this.socket===t&&this.markClosed(new Error("native pipe closed before response"))}))}socket;messageCallback=null;frameDecoder=new kh;closeListeners=new Set;closePromise=null;terminalClose=null;static async create(t){let r=Za();if(r!=null){let n=await r.createConnection(t);return new e(n)}throw new Error(Ih())}sendMessage(t){if(this.socket==null)throw new Error("native pipe is closed");this.socket.write(Fc(JSON.stringify(t)))}setMessageCallback(t){this.messageCallback=t}addCloseListener(t){return this.closeListeners.add(t),this.terminalClose!=null&&Promise.resolve().then(()=>t(this.terminalClose?.error)).catch(()=>{}),()=>{this.closeListeners.delete(t)}}async close(){this.closePromise??=(async()=>{let t=this.socket;await this.markClosed(),t?.end()})(),await this.closePromise}handleData(t){for(let r of this.frameDecoder.push(t))this.messageCallback?.(JSON.parse(r))}async notifyCloseListeners(t){await Promise.allSettled([...this.closeListeners].map(async r=>r(t)))}async markClosed(t){this.terminalClose==null&&(this.terminalClose={error:t},this.socket=null,await this.notifyCloseListeners(t))}},kh=class{chunks=[];byteLength=0;chunkStart=0;push(t){this.append(t);let r=[];for(;this.byteLength>=De;){let n=oi(this.peekBytes(De)),o=De+n;if(this.byteLength<o)break;let i=this.consumeBytes(o);r.push(i.subarray(De).toString("utf8"))}return r}append(t){if(t.byteLength===0)return;let r=Ah.from(t.buffer,t.byteOffset,t.byteLength);this.chunks.push(r),this.byteLength+=r.byteLength}peekBytes(t){let r=this.chunks[this.chunkStart];if(r&&r.byteLength>=t)return r.subarray(0,t);let n=Ah.allocUnsafe(t),o=0;for(let i=this.chunkStart;i<this.chunks.length;i+=1){let s=this.chunks[i];if(!s)throw new Error("native pipe frame decoder underflow");let a=s.copy(n,o,0,t-o);if(o+=a,o===t)break}return n}consumeBytes(t){let r=this.chunks[this.chunkStart];if(r&&r.byteLength>=t){let i=r.subarray(0,t);return r.byteLength===t?this.discardFirstChunk():this.chunks[this.chunkStart]=r.subarray(t),this.byteLength-=t,i}let n=Ah.allocUnsafe(t),o=0;for(;o<t;){let i=this.chunks[this.chunkStart];if(!i)throw new Error("native pipe frame decoder underflow");let s=i.copy(n,o,0,t-o);o+=s,this.byteLength-=s,s===i.byteLength?this.discardFirstChunk():this.chunks[this.chunkStart]=i.subarray(s)}return n}discardFirstChunk(){if(this.chunkStart+=1,this.chunkStart===this.chunks.length){this.chunks.length=0,this.chunkStart=0;return}this.chunkStart>1024&&this.chunkStart*2>this.chunks.length&&(this.chunks.splice(0,this.chunkStart),this.chunkStart=0)}};var T5="BROWSER_AUTH_BROKER_SOCKET_PATH",A5=/^[A-Za-z0-9_-]{32,128}$/,Rh=128*1024,Uc=class e{constructor(t){this.socket=t;t.on("data",r=>this.handleData(r)),t.on("error",r=>this.fail(r)),t.on("close",()=>this.fail(new Error("browser auth broker closed unexpectedly")))}socket;registered=Ph();submission=Ph();completed=Ph();remainingData=Lc.alloc(0);challengeId=null;submissionReceived=!1;resultSent=!1;closed=!1;static async create(t,r){let n=Za(),o=globalThis.nodeRepl?.env[T5]?.trim();if(n==null||!o)throw new Error("browser auth broker is unavailable");let i=await n.createConnection(o),s=new e(i);return s.send({type:"register",expires_at:t,fields:r}),await s.registered.promise,s}get id(){if(this.challengeId==null)throw new Error("browser auth challenge is not registered");return this.challengeId}async waitForSubmission(){return await this.submission.promise}get hasSubmission(){return this.submissionReceived}async complete(t){return this.resultSent||(this.resultSent=!0,this.send({type:"result",challenge_id:this.id,status:t})),await this.completed.promise}close(){this.closed||(this.closed=!0,this.socket.end())}send(t){if(this.closed)throw new Error("browser auth broker is closed");let r=JSON.stringify(t);if(Lc.byteLength(r,"utf8")>Rh)throw new Error("browser auth broker message is too large");this.socket.write(Fc(r))}handleData(t){if(this.closed)return;if(this.remainingData=Lc.concat([this.remainingData,Lc.from(t)]),this.remainingData.byteLength>=De&&oi(this.remainingData)>Rh){this.fail(new Error("browser auth broker message is too large"));return}let r=PT(this.remainingData);if(this.remainingData=r.remainingData,this.remainingData.byteLength>=De&&oi(this.remainingData)>Rh){this.fail(new Error("browser auth broker message is too large"));return}for(let n of r.messages)try{this.handleMessage(JSON.parse(n))}catch(o){this.fail(o instanceof Error?o:new Error("invalid browser auth broker message"))}}handleMessage(t){if(!DT(t)||typeof t.type!="string")throw new Error("invalid browser auth broker message");if(t.type==="registered"){if(typeof t.challenge_id!="string"||!A5.test(t.challenge_id))throw new Error("invalid browser auth challenge id");this.challengeId=t.challenge_id,this.registered.resolve(t.challenge_id);return}if(t.type==="submission"){if(t.challenge_id!==this.id)throw new Error("browser auth challenge id mismatch");if(this.resultSent)return;let r=k5(t.fields);if(r==null)throw new Error("invalid browser auth submission");this.submissionReceived=!0,this.submission.resolve({fields:r});return}if(t.type==="completed"){if(t.challenge_id!==this.id||!I5(t.status))throw new Error("invalid browser auth completion");this.completed.resolve(t.status),this.submission.resolve({status:t.status});return}throw new Error("browser auth broker rejected the request")}fail(t){this.closed||(this.closed=!0,this.registered.reject(t),this.submission.reject(t),this.completed.reject(t),this.socket.end())}};function Ph(){let e=()=>{},t=()=>{},r={promise:new Promise((n,o)=>{e=n,t=o}),settled:!1,resolve(n){r.settled||(r.settled=!0,e(n))},reject(n){r.settled||(r.settled=!0,t(n))}};return r.promise.catch(()=>{}),r}function k5(e){if(!DT(e))return null;let t=Object.create(null);for(let[r,n]of Object.entries(e)){if(typeof n!="string")return null;t[r]=n}return t}function I5(e){return e==="submitted"||e==="declined"||e==="cancelled"||e==="unavailable"||e==="expired"||e==="origin_changed"||e==="page_changed"||e==="locator_invalid"||e==="submission_failed"}function DT(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}var jc=y("playwright_locator_click",async(e,t)=>(await t.playwright.clickLocator(e,1),{}));var qc=y("playwright_locator_count",async(e,t)=>({count:await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,r=>r.length)}));var ii=y("playwright_locator_fill",async(e,t)=>{if(typeof e.value!="string")throw new Error("playwright_locator_fill requires string value");let r=rc(t.isIabBackend);if(e.replace===!1){let a=await t.playwright.focusLocator(e,{...r!=null?{iabInputTargetToken:r}:{},selectText:!1,requireEditable:!0});return await bn({includeRichText:!1,...r!=null?{iabInputTargetToken:r}:{},replaceInputValue:!1,tab_id:e.tab_id,target:a,text:e.value},t,ii.type),{}}let n=["visible","enabled","editable"],o={...r!=null?{iabInputTargetToken:r}:{},states:n,value:e.value},{result:i,target:s}=await t.playwright.evaluateOnPlaywrightSelectorWithTarget(e.tab_id,e.selector,(a,u,l)=>{for(let f of l.states){let m=u.elementState(a,f);if(m.received==="error:notconnected")throw new Error("Element is not connected");if(!m.matches)throw new Error("Element is not "+f)}a.scrollIntoView({block:"center",inline:"nearest"});let d=u.fill(a,l.value);if(d==="error:notconnected")throw new Error("Element is not connected");if(d!=="done"&&d!=="needsinput")throw new Error(d);if(d==="done")return"done";let p=typeof u.retarget=="function"?u.retarget(a,"follow-label"):a;if(p==null)throw new Error("Element is not connected");return l.iabInputTargetToken==null||Object.defineProperty(p,"__codexIabInputTargetToken",{configurable:!0,value:l.iabInputTargetToken,writable:!0}),d},{arg:o,timeoutMs:e.timeout_ms});return i!=="needsinput"?{}:(await bn({includeRichText:!1,...r!=null?{iabInputTargetToken:r}:{},replaceInputValue:!0,tab_id:e.tab_id,target:s,text:e.value},t,ii.type),{})});var $c=y("playwright_locator_is_enabled",async(e,t)=>({value:await t.playwright.readElementState(e,"enabled")}));var zc=y("playwright_locator_is_visible",async(e,t)=>({value:await t.playwright.readElementState(e,"visible")}));var Wc=y("playwright_locator_press",async(e,t)=>{if(typeof e.value!="string"||!e.value)throw new Error("playwright_locator_press requires value");let r=A(e.tab_id),n=rc(t.isIabBackend),o=await t.playwright.focusLocator(e,{...n!=null?{iabInputTargetToken:n}:{},requireEditable:!1});return Ko(e.value)==="paste"?(await Yo({commandType:"playwright_locator_press",ctx:t,iabInputTargetToken:n,tabId:r,target:o}),{}):(await ic(t.cdp,o,e.value,{iabInputTargetToken:n}),{})});var R5=300*1e3,P5=16*1024,D5=" >> internal:control=enter-frame >> ",N5="nodeRepl.createElicitation is unavailable because the MCP client does not support form elicitation",MT=y(qo.Handoff,async(e,t)=>{if(!(t.clientInfo.capabilities?.tab?.some(d=>d.id===Oa.id)===!0))throw Zn(t.clientInfo.name,{type:qo.Handoff.commandType});if(!si(e.expires_at))return{status:"expired"};if(!B5(e))return{status:"locator_invalid"};let n=await FT(e.tab_id,e.origin,t);if(typeof n=="string")return{status:n};if(!await Hc(e,t))return{status:"locator_invalid"};let o=await Xa(e.tab_id,e.origin,n,t);if(o!=null)return{status:o};if(!si(e.expires_at))return{status:"expired"};let i=globalThis.nodeRepl?.createElicitation;if(i==null)return{status:"unavailable"};let s;try{s=await Uc.create(e.expires_at,e.fields.map(({id:d,required:p})=>({id:d,required:p})))}catch{return{status:"unavailable"}}let a=null,u=(async()=>{try{let d=await s.waitForSubmission();if("status"in d)return a=d.status,d.status;let p=await L5(d.fields,e,n,t);return a=p,await s.complete(p)}catch{return a??="unavailable",a}})(),l;try{l=await i({message:e.reason,requestedSchema:{type:"object",properties:{},additionalProperties:!1},meta:{codex_approval_kind:"browser_auth",codex_requires_user_input:!0,codex_guardian_compatible:!1,connector_id:"browser-use",connector_name:"Browser Use",browser_auth_challenge_id:s.id,origin:e.origin,reason:e.reason,expires_at:e.expires_at,fields:e.fields.map(({id:d,label:p,type:f,autocomplete:m,required:h})=>({id:d,label:p,type:f,autocomplete:m,required:h}))}})}catch(d){if(a=await OT(s,"unavailable"),await u,s.close(),M5(d))return{status:"unavailable"};throw d}if(a==null&&s.hasSubmission)a=await u;else if(a==null){let d=l.action==="decline"?"declined":l.action==="cancel"?"cancelled":"unavailable";a=await OT(s,d)}return await u,s.close(),{status:a}});function si(e){if(e==null||!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/.test(e))return!1;let t=Date.parse(e),r=Date.now();return Number.isFinite(t)&&t>r&&t<=r+R5}async function FT(e,t,r){let{frameTree:n}=await r.cdp.call(A(e),"Page.getFrameTree"),{id:o,loaderId:i,url:s}=n.frame;return $e(s)!==t?"origin_changed":!o||!i||!s?"page_changed":{frameId:o,loaderId:i,url:s}}async function Xa(e,t,r,n){let o=await FT(e,t,n);return typeof o=="string"?o:O5(r,o)?null:"page_changed"}function O5(e,t){return e.frameId===t.frameId&&e.loaderId===t.loaderId&&e.url===t.url}function M5(e){return e instanceof Error&&e.message===N5}async function Hc(e,t){try{let r=e.fields.map(n=>n.selector);for(let n of e.fields)if(!await F5(n,e,t))return!1;return await t.playwright.selectorsResolveToDistinctElements(e.tab_id,r,{timeoutMs:e.timeout_ms})?e.submit==null?!0:await BT(e.submit.selector,e,t)?e.submit.action==="press_enter"?!0:await t.playwright.selectorsResolveToDistinctElements(e.tab_id,[...r,e.submit.selector],{timeoutMs:e.timeout_ms}):!1:!1}catch{return!1}}async function F5(e,t,r){try{return await BT(e.selector,t,r,!0)?await r.playwright.evaluateOnPlaywrightSelector(t.tab_id,e.selector,(n,o,i)=>n.tagName!=="INPUT"?!1:n.type===i.expectedType,{arg:{expectedType:e.type},timeoutMs:t.timeout_ms}):!1}catch{return!1}}async function BT(e,t,r,n=!1){try{let o={browser_id:t.browser_id,tab_id:t.tab_id,selector:e,timeout_ms:t.timeout_ms},[{count:i},{value:s},{value:a}]=await Promise.all([qc(o,r),zc(o,r),$c(o,r)]);return i===1&&s===!0&&a===!0&&(!n||await r.playwright.readElementState(o,"editable"))}catch{return!1}}function B5(e){let t=new Set,r=new Set;for(let n of e.fields){if(t.has(n.id)||r.has(n.selector)||NT(n.selector))return!1;t.add(n.id),r.add(n.selector)}return e.submit==null?!0:!NT(e.submit.selector)&&(e.submit.action==="press_enter"||!r.has(e.submit.selector))}function NT(e){return e.includes(D5)}async function OT(e,t){try{return await e.complete(t)}catch{return"unavailable"}}async function L5(e,t,r,n){let o=U5(e,t.fields);if(o==null)return"submission_failed";try{if(!si(t.expires_at))return"expired";let i=await Xa(t.tab_id,t.origin,r,n);if(i!=null)return i;if(!await Hc(t,n))return"locator_invalid";let s=await Xa(t.tab_id,t.origin,r,n);if(s!=null)return s;if(!si(t.expires_at))return"expired";for(let u of t.fields){let l=o[u.id];if(l==null)continue;if(!si(t.expires_at))return"expired";let d=await Xa(t.tab_id,t.origin,r,n);if(d!=null)return d;if(!await Hc(t,n))return"locator_invalid";await ii({browser_id:t.browser_id,tab_id:t.tab_id,selector:u.selector,value:l,replace:!0,timeout_ms:t.timeout_ms},n)}if(t.submit==null)return"submitted";let a=await Xa(t.tab_id,t.origin,r,n);return a??(si(t.expires_at)?await Hc(t,n)?(t.submit.action==="click"?await jc({browser_id:t.browser_id,tab_id:t.tab_id,selector:t.submit.selector,timeout_ms:t.timeout_ms},n):await Wc({browser_id:t.browser_id,tab_id:t.tab_id,selector:t.submit.selector,value:"Enter",timeout_ms:t.timeout_ms},n),"submitted"):"locator_invalid":"expired")}catch{return"submission_failed"}}function U5(e,t){if(!j5(e))return null;let r=new Set(t.map(o=>o.id)),n=Object.create(null);for(let[o,i]of Object.entries(e)){if(!r.has(o)||typeof i!="string"||i.length>P5)return null;n[o]=i}for(let o of t)if(o.required&&!n[o.id])return null;return n}function j5(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}var LT=y(oe.WebMcpInvokeTool,async(e,t)=>{if(!(t.clientInfo.capabilities?.tab?.some(i=>i.id===cn.id)===!0))throw Zn(t.clientInfo.name,{type:oe.WebMcpInvokeTool.commandType});let n=A(e.tab_id);return{result:await t.cdp.evaluateJavascript(n,`(() => {
        const modelContext = navigator.modelContext;
        if (
          !modelContext ||
          typeof modelContext.getTools !== "function" ||
          typeof modelContext.executeTool !== "function"
        ) {
          throw new Error("WebMCP modelContext is unavailable in the current page.");
        }
        return Promise.resolve(modelContext.getTools())
          .then((tools) => {
            const tool = tools.find(
              (candidate) => candidate.name === ${JSON.stringify(e.tool_name)},
            );
            if (!tool) {
              throw new Error(
                ${JSON.stringify(`WebMCP tool not found: ${e.tool_name}`)},
              );
            }
            return modelContext.executeTool(
              tool,
              ${JSON.stringify(JSON.stringify(e.input??null))},
            );
          })
          .then((result) => {
            if (result == null) {
              return null;
            }

            try {
              return JSON.parse(result);
            } catch {
              return result;
            }
          });
      })()`,{awaitPromise:!0,timeoutMs:e.timeout_ms})??null}});var q5=1e4,$5="WebMCP listTools failed: no result returned.",UT=y(oe.WebMcpListTools,async(e,t)=>{if(!(t.clientInfo.capabilities?.tab?.some(i=>i.id===cn.id)===!0))throw Zn(t.clientInfo.name,{type:oe.WebMcpListTools.commandType});let n=A(e.tab_id),o=await t.cdp.evaluateJavascript(n,`(() => {
        const modelContext = navigator.modelContext;
        if (!modelContext || typeof modelContext.getTools !== "function") {
          throw new Error("WebMCP modelContext is unavailable in the current page.");
        }
        return Promise.resolve(modelContext.getTools()).then((tools) =>
          tools.map((tool) => ({
            name: tool.name,
            title: tool.title,
            description: tool.description,
            input_schema: tool.inputSchema ?? null,
            annotations: tool.annotations,
            origin: tool.origin,
            pageUrl: tool.pageUrl,
          })),
        );
      })()`,{awaitPromise:!0,timeoutMs:q5});if(!Array.isArray(o))throw new Error($5);return{tools:o.map(i=>{try{return{...i,input_schema:i.input_schema==null?null:JSON.parse(i.input_schema)}}catch{throw new Error("WebMCP tool inputSchema is not valid JSON.")}})}});var jT=y("dom_cua_click",async(e,t)=>{if(typeof e.node_id!="string"||e.node_id.length===0)throw new Error("dom_cua_click requires node_id");return await t.cua.clickDomCuaNode({clickCount:1,nodeId:e.node_id,tabId:A(e.tab_id),timeoutMs:e.timeout_ms}),{}});var qT=y("dom_cua_double_click",async(e,t)=>{if(typeof e.node_id!="string"||e.node_id.length===0)throw new Error("dom_cua_double_click requires node_id");return await t.cua.clickDomCuaNode({clickCount:2,nodeId:e.node_id,tabId:A(e.tab_id),timeoutMs:e.timeout_ms}),{}});var z5=50,W5=5e3,H5="browser-use-dom-cua",$T=new WeakSet,vr=new Map,_n=new Map;function HT(e){$T.has(e)||($T.add(e),e.addTabCleanupHandler(t=>{_n.delete(t);for(let r of vr.keys())r.startsWith(`${t}:`)&&vr.delete(r)}))}function VT(e,t){let r=_n.get(e),n=r?.mainFrameKey===t?r:{framesById:new Map,mainFrameKey:t,nextPublicId:1,nodeByPublicId:new Map,publicIdByFrameLocalRef:new Map};n.framesById.clear(),n.nodeByPublicId.clear(),n.publicIdByFrameLocalRef.size>W5&&(n.publicIdByFrameLocalRef.clear(),n.nextPublicId=1),_n.set(e,n)}function GT(e,t){let r=_n.get(e);r?.framesById.set(t.frameId,t)}function KT(e,t,r,n){let o=_n.get(e);if(o==null)throw new Error("DOM CUA snapshot state is missing");let i=K5(t,r),s=o.publicIdByFrameLocalRef.get(i);return s==null&&(s=String(o.nextPublicId++),o.publicIdByFrameLocalRef.set(i,s)),o.nodeByPublicId.set(s,{frameId:t.frameId,loaderId:t.loaderId,localRef:r,target:t.target,viewportClip:n}),s}function JT(e,t){let r=_n.get(e)?.nodeByPublicId.get(t);if(r==null)throw new Error(`DOM node ${t} is stale or missing`);return r}async function Qa(e,t,r,n,o,i){let s=await zT(e,t,r,n,i.timeoutMs);try{return await WT(e,t,s,o,i)}catch(a){if(!Y5(a))throw a;return vr.delete(XT(t,r,n)),s=await zT(e,t,r,n,i.timeoutMs),await WT(e,t,s,o,i)}}async function V5(e,t,r,n={}){let{backendNodeId:o}=await e.callTarget(t,"DOM.getFrameOwner",{frameId:r},{timeoutMs:n.timeoutMs}),{quads:i}=await e.callTarget(t,"DOM.getContentQuads",{backendNodeId:o},{timeoutMs:n.timeoutMs});return i[0]??null}async function YT(e,t,r,n){let o=_n.get(e);if(o==null)throw new Error(`Missing DOM CUA frame ${r}`);let i=o.framesById.get(r);if(i==null)throw new Error(`Missing DOM CUA frame ${r}`);let s=n;for(;i?.parentFrameId!=null;){let a=o.framesById.get(i.parentFrameId);if(a==null)throw new Error(`Missing parent DOM CUA frame ${i.frameId}`);for(s=G5(s,i,await V5(t,a.target,i.frameId),r),i=a;i.parentFrameId!=null;){let u=o.framesById.get(i.parentFrameId);if(u==null)throw new Error(`Missing parent DOM CUA frame ${i.frameId}`);if(!J5(i.target,u.target))break;i=u}}return s}function Nh(e,t){let r={bottom:Math.min(e.bottom,t.bottom),left:Math.max(e.left,t.left),right:Math.min(e.right,t.right),top:Math.max(e.top,t.top)};return r.right>r.left&&r.bottom>r.top?r:null}function ZT(e,t){let r=Nh(e,t);return r==null?null:{bottom:r.bottom-e.top,left:r.left-e.left,right:r.right-e.left,top:r.top-e.top}}function G5(e,t,r,n){let o=tc(e,t.size,r);if(o==null)throw new Error(`Missing frame geometry for DOM CUA frame ${n}`);return o}async function zT(e,t,r,n,o){let i=XT(t,r,n),s=vr.get(i);if(s!=null)return s;let u={executionContextId:(await e.callTarget(t,"Page.createIsolatedWorld",{frameId:r,grantUniveralAccess:!1,worldName:H5},{timeoutMs:o})).executionContextId};if(vr.set(i,u),vr.size>z5){let l=vr.keys().next().value;l!=null&&vr.delete(l)}return u}async function WT(e,t,r,n,o){return await e.callTarget(t,"Runtime.evaluate",{awaitPromise:!0,contextId:r.executionContextId,expression:n,returnByValue:o.returnByValue,timeout:o.timeoutMs},{timeoutMs:o.timeoutMs})}function K5(e,t){return`${e.frameId}:${e.loaderId??""}:${t}`}function XT(e,t,r){return`${Dh(e)}:${t}:${r??""}`}function Dh(e){return`${e.tabId}:${e.sessionId??""}:${e.targetId??""}`}function J5(e,t){return Dh(e)===Dh(t)}function Y5(e){let t=e instanceof Error?e.message:String(e);return/Cannot find context|Execution context was destroyed|context.*destroyed|context.*not found/i.test(t)}var Z5=new Set(["a","button","details","input","option","select","summary","textarea"]),X5=["aria-disabled","aria-label","contenteditable","href","name","placeholder","role","title","type","value"],Q5=["checked","disabled","multiple","readonly","required","selected"],e9=["button","checkbox","combobox","link","menuitem","option","radio","slider","spinbutton","switch","tab","textbox"],eu=2e4,Vc=200,t9=500,QT=1e3,e1="const __name = (target) => target;",t1=y("dom_cua_get_visible_dom",async(e,t)=>{let r=A(e.tab_id);return await r9(r,t.cdp)});async function r9(e,t){HT(t);let{frameTree:r}=await t.call(e,"Page.getFrameTree"),n=a9(r.frame);VT(e,n);let o={chars:0,lines:[]},i=await r1({cdp:t,childFrameDeadline:Date.now()+QT,frameReference:{frameId:r.frame.id,loaderId:r.frame.loaderId,target:{tabId:e}},output:o,tabId:e,viewportClip:void 0});return i?.viewportClip==null||!Oh(o)||await n1({childFrames:i.childFrames,cdp:t,childFrameDeadline:Date.now()+QT,frameReference:i.frame,output:o,tabId:e,viewportClip:i.viewportClip}),o.lines.join(`
`)}function n9(e,t,r){let n={booleanAttributeNames:Q5,codexOverlayRootId:r_,interactiveRoleNames:e9,interactiveTags:[...Z5],maxChars:e,maxElements:t,renderedAttributeNames:X5,viewportClip:r};return`(() => {
    ${e1}
    return (${f9.toString()})(${JSON.stringify(n)});
  })()`}async function r1(e){if(e.output.lines.length>=Vc||e.output.chars>=eu||e.frameReference.parentFrameId!=null&&Date.now()>=e.childFrameDeadline)return null;let t=e.frameReference;GT(e.tabId,t);let r=Vc-e.output.lines.length,n=eu-e.output.chars,o=await o9(e.cdp,t,n,r,e.viewportClip,t.parentFrameId==null?void 0:Mh(e.childFrameDeadline)).catch(s=>{if(t.parentFrameId!=null)return null;throw s});if(o==null)return null;let i=e.viewportClip==null?o.viewport:Nh(e.viewportClip,o.viewport);if(i==null)return{childFrames:[],frame:t,viewportClip:i};for(let s of o.items){if(e.output.lines.length>=Vc||e.output.chars>=eu)break;let a=KT(e.tabId,t,s.ref,i),u=s.line.replace(`node_id=${s.ref}`,`node_id=${a}`),l=u.length+(e.output.lines.length===0?0:1);if(e.output.chars+l>eu)break;e.output.lines.push(u),e.output.chars+=l}return{childFrames:o.frameElements,frame:t,viewportClip:i}}async function n1(e){if(Oh(e.output))for(let t of e.childFrames){if(!Oh(e.output)||Date.now()>=e.childFrameDeadline)break;let r=ZT(t.rect,e.viewportClip);if(r==null)continue;let n=await i9(e.cdp,e.frameReference,t.ref,Mh(e.childFrameDeadline)).catch(()=>null);if(n==null)continue;let o=await e.cdp.targetForFrameOrAttach(e.tabId,n,{timeoutMs:Mh(e.childFrameDeadline)},t.url==null?{}:{url:t.url}).catch(()=>null)??e.frameReference.target,i=await r1({cdp:e.cdp,childFrameDeadline:e.childFrameDeadline,frameReference:{frameId:n,parentFrameId:e.frameReference.frameId,size:t.size,target:o},output:e.output,tabId:e.tabId,viewportClip:r});i?.viewportClip!=null&&await n1({childFrames:i.childFrames,cdp:e.cdp,childFrameDeadline:e.childFrameDeadline,frameReference:i.frame,output:e.output,tabId:e.tabId,viewportClip:i.viewportClip})}}function Oh(e){return e.lines.length<Vc&&e.chars<eu}async function o9(e,t,r,n,o,i){let s=await Qa(e,t.target,t.frameId,t.loaderId,n9(r,n,o),{returnByValue:!0,timeoutMs:i});if(s.exceptionDetails!=null)throw new Error(o1(s.exceptionDetails));return u9(s.result.value)}async function i9(e,t,r,n){let o=await Qa(e,t.target,t.frameId,t.loaderId,s9(r),{returnByValue:!1,timeoutMs:n});if(o.exceptionDetails!=null)throw new Error(o1(o.exceptionDetails));let i=o.result.objectId;if(typeof i!="string")return null;try{let{node:s}=await e.callTarget(t.target,"DOM.describeNode",{objectId:i},{timeoutMs:n});return typeof s.frameId=="string"?s.frameId:null}finally{await e.callTarget(t.target,"Runtime.releaseObject",{objectId:i},{timeoutMs:n}).catch(()=>{})}}function s9(e){return`(() => {
    ${e1}
    const state = globalThis.__browserUseVisibleDomState;
    return state?.refToElement?.get(${JSON.stringify(e)}) ?? null;
  })()`}function Mh(e){return Math.max(1,Math.min(t9,e-Date.now()))}function a9(e){return`${e.id}:${e.loaderId??""}`}function u9(e){if(e==null||typeof e!="object")return null;let t=e;return!Array.isArray(t.items)||t.viewport==null?null:{frameElements:Array.isArray(t.frameElements)?t.frameElements.filter(l9):[],items:t.items.filter(d9),viewport:t.viewport}}function l9(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.ref=="string"&&p9(t.rect)&&(t.size==null||c9(t.size))&&(t.url==null||typeof t.url=="string")}function c9(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.height=="number"&&Number.isFinite(t.height)&&t.height>0&&typeof t.width=="number"&&Number.isFinite(t.width)&&t.width>0}function d9(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.ref=="string"&&typeof t.line=="string"}function p9(e){if(e==null||typeof e!="object")return!1;let t=e;return typeof t.bottom=="number"&&Number.isFinite(t.bottom)&&typeof t.left=="number"&&Number.isFinite(t.left)&&typeof t.right=="number"&&Number.isFinite(t.right)&&typeof t.top=="number"&&Number.isFinite(t.top)}function f9(e){let t=new Set(e.interactiveTags),r=new Set(e.interactiveRoleNames),n=[],o=[],i=0,s=!1,a=globalThis,u=a.__browserUseVisibleDomState??(a.__browserUseVisibleDomState={elementToRef:new WeakMap,nextId:1,refToElement:new Map});u.refToElement.clear();let l=window.visualViewport,d=l?{bottom:l.offsetTop+l.height,left:l.offsetLeft,right:l.offsetLeft+l.width,top:l.offsetTop}:{bottom:window.innerHeight,left:0,right:window.innerWidth,top:0},p=e.viewportClip==null?d:{bottom:Math.min(d.bottom,e.viewportClip.bottom),left:Math.max(d.left,e.viewportClip.left),right:Math.min(d.right,e.viewportClip.right),top:Math.max(d.top,e.viewportClip.top)},f=M=>(M.localName||M.nodeName||"").toLowerCase(),m=new Set(["noscript","script","style","template"]),h=M=>M.getAttribute("id")===e.codexOverlayRootId,_=M=>{let L=f(M);if(M.getAttribute("aria-hidden")==="true"||M.hasAttribute("hidden")||L==="input"&&M.getAttribute("type")==="hidden")return!1;let z=M.getAttribute("contenteditable"),Q=M.getAttribute("role");return t.has(L)||z!=null&&z.toLowerCase()!=="false"||M.hasAttribute("href")||M.hasAttribute("onclick")||Q!=null&&r.has(Q.trim().toLowerCase())||Number(M.getAttribute("tabindex")??-1)>=0},S=M=>{let L=f(M);return L==="frame"||L==="iframe"},D=M=>{let L=window.getComputedStyle(M);if(L.visibility!=="visible"||L.display==="none"||L.pointerEvents==="none"||Number(L.opacity)<=.01)return null;for(let z of M.getClientRects())if(!(z.width<=0||z.height<=0||z.right<=p.left||z.left>=p.right||z.bottom<=p.top||z.top>=p.bottom))return{bottom:z.bottom,left:z.left,right:z.right,top:z.top};return null},w=M=>D(M)!=null,x=M=>M.replace(/\s+/g," ").trim(),E=M=>M.replace(/[\t\n\f\r]+/g," ").replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;"),I=M=>{let L=[],z=0,Q=pe=>{if(!(z>=160)){if(pe.nodeType===Node.TEXT_NODE){let ge=x(pe.nodeValue||"");ge.length>0&&(L.push(ge),z+=ge.length+1);return}if(!(pe.nodeType===Node.ELEMENT_NODE&&m.has(f(pe)))){for(let ge of pe.childNodes||[]){if(z>=160)break;Q(ge)}if(pe.nodeType===Node.ELEMENT_NODE){let ge=pe;if(!ge.shadowRoot)return;for(let Ar of ge.shadowRoot.childNodes){if(z>=160)break;Q(Ar)}}}}};return Q(M),x(L.join(" ")).slice(0,160)},T=M=>{let L=u.elementToRef.get(M);return L==null&&(L=String(u.nextId++),u.elementToRef.set(M,L)),L},q=(M,L)=>{let z=[`node_id=${L}`];for(let ge of e.renderedAttributeNames){let Ar=M.getAttribute(ge);Ar!=null&&Ar!==""&&z.push(`${ge}="${E(Ar)}"`)}for(let ge of e.booleanAttributeNames)M.hasAttribute(ge)&&z.push(`${ge}="true"`);let Q=f(M),pe=I(M);return pe.length===0?`<${Q} ${z.join(" ")} />`:`<${Q} ${z.join(" ")}>${E(pe)}</${Q}>`},X=()=>s||o.length>=e.maxElements||i>=e.maxChars,ae=M=>{if(X())return;let L=T(M),z=q(M,L),Q=z.length+(o.length===0?0:1);if(i+Q>e.maxChars){s=!0;return}o.push({line:z,ref:L}),u.refToElement.set(L,M),i+=Q},we=M=>{if(n.length>=e.maxElements)return;let L=D(M);if(L==null)return;let z=T(M),Q=M.src,pe=M,ge=pe.clientWidth>0?pe.clientWidth:L.right-L.left,Ar=pe.clientHeight>0?pe.clientHeight:L.bottom-L.top;n.push({rect:L,ref:z,size:{height:Ar,width:ge},...Q.length>0?{url:Q}:{}}),u.refToElement.set(z,M)},he=M=>{if(X())return;if(M.nodeType===Node.DOCUMENT_NODE){let z=M.documentElement;z&&he(z);return}if(M.nodeType===Node.DOCUMENT_FRAGMENT_NODE){for(let z of M.children){if(X())break;he(z)}return}if(M.nodeType!==Node.ELEMENT_NODE)return;let L=M;if(!h(L)){S(L)&&we(L),_(L)&&w(L)&&ae(L),L.shadowRoot&&!X()&&he(L.shadowRoot);for(let z of L.children){if(X())break;he(z)}}};return he(document),{frameElements:n,items:o,viewport:d}}function o1(e){let t=e.exception;return typeof t?.value=="string"?t.value:t?.description??e.text??"Visible DOM evaluation failed"}var i1=y("dom_cua_keypress",async(e,t)=>(Array.isArray(e.keys)?Ko(e.keys):null)==="paste"?(await Yo({commandType:"dom_cua_keypress",ctx:t,tabId:e.tab_id}),{}):(await t.cua.dispatchKeyPress({commandName:"dom_cua_keypress",keys:e.keys,tabId:e.tab_id}),{}));var s1=y("dom_cua_scroll",async(e,t)=>{let r=A(e.tab_id);if(e.node_id!=null&&(typeof e.node_id!="string"||e.node_id.length===0))throw new Error("dom_cua_scroll requires node_id to be a string");if(e.node_id!=null)return await t.cua.scrollDomCuaNode({nodeId:e.node_id,scrollX:e.scroll_x,scrollY:e.scroll_y,tabId:r}),{};let n=await m9(t.cdp,r);return await t.cua.scrollPoint({modifiers:0,point:n,scrollX:e.scroll_x,scrollY:e.scroll_y,tabId:r}),{}});async function m9(e,t){let{cssVisualViewport:r}=await e.call(t,"Page.getLayoutMetrics");return{x:r.clientWidth/2,y:r.clientHeight/2}}var Fh=y("dom_cua_type",async(e,t)=>(await bn(e,t,Fh.type),{}));var a1=y("close_tab",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("close_tab requires a positive integer tab_id");return await t.cdp.closeTab(r),{}});var u1=y("create_tab",async(e,t)=>({id:(await t.tabs.create()).id.toString()}));var l1=y("finalize_tabs",async(e,t)=>{let n=(e.keep??[]).map(o=>({tabId:A(o.tab_id),status:o.status}));return await t.tabs.finalize(n),{}});var c1=y("list_tabs",async(e,t)=>({tabs:(await t.tabs.list()).map(n=>({id:n.id.toString(),...n.url==null?{}:{url:n.url},...n.title==null?{}:{title:n.title}}))}));var d1=y("name_session",async(e,t)=>{let r=e.name.trim();if(!r)throw new Error("name_session requires a name");return await t.nameSession(r),{}});var p1=y("navigate_tab_back",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_back requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=await t.cdp.call(r,"Page.getNavigationHistory"),i=o.entries[o.currentIndex-1];if(!i)throw new Error("Cannot navigate back: no previous page in history.");let s=t.cdp.waitForPageLoadEvent(r,{timeoutMs:n});return await t.cdp.call(r,"Page.navigateToHistoryEntry",{entryId:i.id}),await s,{}});var f1=y("navigate_tab_forward",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_forward requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=await t.cdp.call(r,"Page.getNavigationHistory"),i=o.entries[o.currentIndex+1];if(!i)throw new Error("Cannot navigate forward: no next page in history.");let s=t.cdp.waitForPageLoadEvent(r,{timeoutMs:n});return await t.cdp.call(r,"Page.navigateToHistoryEntry",{entryId:i.id}),await s,{}});var m1=y("navigate_tab_reload",async(e,t)=>{let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_reload requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=t.cdp.waitForPageLoadEvent(r,{timeoutMs:n});return await t.cdp.call(r,"Page.reload",{}),await o,{}});import h9 from"node:events";var g9="Page.navigationBlocked",h1=1e3;function ru(e){return e.sessionId!=null||e.targetId!=null}var Gc=class extends h9{constructor(r){super();this.api=r;this.api.addEventListener("onCDPEvent",n=>{let o=this.attachedTabIdForCdpEvent(n.source);o!=null&&(this.recordRawCdpEvent(o,n),this.handleTargetEvent(n),this.emit("event",n))}),this.addTabAttachHandler(async n=>{await this.call(n,"Page.enable"),await this.enableOopifAutoAttach(n)}),this.addTabCleanupHandler(async n=>{await this.detachAttachedFrameTargets(n)}),this.on("event",n=>{this.handleJavaScriptDialogOpening(n)})}api;fileChoosersById=new Map;attachedTabIds=new Set;tabAttachHandlers=new Set;tabCleanupHandlers=new Set;frameSessionsByTabId=new Map;frameSessionsBySessionId=new Map;attachedFrameTargetIdsByTabId=new Map;oopifAutoAttachTabIds=new Set;rawCdpEventsByTabId=new Map;rawCdpEventEvictedThroughSequenceByTabId=new Map;rawCdpEventSequenceByTabId=new Map;topLevelSecurityOriginsByTabId=new Map;async call(r,n,o,i={}){let s=Number(r);if(!Number.isFinite(s))throw new Error("callCdp requires numeric tab_id");return await this.callTarget({tabId:s},n,o,i)}async callTarget(r,n,o,i={}){return await this.executeTargetCdp(r,n,o,i)}async callRawCdp(r,n,o,i={}){let s=Number(r);if(!Number.isFinite(s))throw new Error("callRawCdp requires numeric tab_id");let{target:a,...u}=i;return await this.executeTargetCdp(this.rawCdpTarget(s,a),n,o,{...u,telemetryAttrs:S9(u.telemetryAttrs)})}async readRawCdpEvents(r,n={}){let o=Number(r);if(!Number.isFinite(o))throw new Error("readRawCdpEvents requires numeric tab_id");let i=n.afterSequence??(n.timeoutMs==null?void 0:this.rawCdpEventSequenceForTab(o));await this.ensureAttachedTab(o);let s=i??this.rawCdpEventSequenceForTab(o),a=this.rawCdpEventsResult(o,s,n);return a.events.length>0||a.truncated||n.timeoutMs==null||n.timeoutMs<=0?a:await new Promise(u=>{let l=!1,d=()=>{this.removeListener("event",f),this.removeListener("tabDetached",m),clearTimeout(h)},p=()=>{l||(l=!0,d(),u(this.rawCdpEventsResult(o,s,n)))},f=()=>{let _=this.rawCdpEventsResult(o,s,n);(_.events.length>0||_.truncated)&&p()},m=_=>{_===o&&p()},h=setTimeout(p,n.timeoutMs);this.addListener("event",f),this.addListener("tabDetached",m),f()})}async executeTargetCdp(r,n,o,i={}){return await this.ensureAttachedTab(r.tabId),await sm("browser_use.cdp.execute",{"browser_use.cdp.domain":x9(n),"browser_use.cdp.method":n,"browser_use.tab.id":r.tabId,"tab.id":r.tabId,...FE(),...v9(n,o),...i.telemetryAttrs},async()=>{try{return await this.api.executeCdp({target:r,method:n,commandParams:o??{},timeoutMs:i.timeoutMs})}catch(s){if((s==="Debugger unattached"||typeof s=="string"&&s.includes("Debugger is not attached"))&&(this.forgetAttachedTab(r.tabId),r.sessionId==null&&r.targetId==null))return this.executeTargetCdp(r,n,o,i);throw s}})}async enableOopifAutoAttach(r,n={}){let o=Number(r);if(!Number.isFinite(o))throw new Error("enableOopifAutoAttach requires numeric tab_id");this.oopifAutoAttachTabIds.has(o)||(await this.ensureAttachedTab(o),!this.oopifAutoAttachTabIds.has(o)&&(await this.enableOopifAutoAttachForTarget({tabId:o},n),this.oopifAutoAttachTabIds.add(o)))}targetForFrame(r,n){let o=Number(r);return Number.isFinite(o)?this.frameSessionsByTabId.get(o)?.get(n)?.target??null:null}async targetForFrameOrAttach(r,n,o={},i={}){if(n!=null){let h=this.targetForFrame(r,n);if(h!=null)return h}let s=Number(r);if(!Number.isFinite(s))return null;await this.ensureAttachedTab(s);let l=((await this.callTarget({tabId:s},"Target.getTargets",{},o).catch(()=>null))?.targetInfos.filter(h=>y9(h,s))??[]).filter(h=>_9(h,i)),d=l.find(h=>tu(h)===n),p=i.url==null?[]:l.filter(h=>h.url===i.url),f=tu(d)??(p.length===1?tu(p[0]):void 0)??n;return f==null?null:await this.attachDebuggerFrameTarget(s,f,n)??(n==null?null:this.targetForFrame(s,n))}async attachDebuggerFrameTarget(r,n,o){let i=`target:${n}`,s=this.frameSessionsBySessionId.get(i);if(s!=null)return o!=null&&this.setFrameSessionForFrame(r,o,s),s.target;let a=this.api;if(typeof a.attachTarget!="function"||!await a.attachTarget(r,n).then(()=>!0).catch(()=>!1))return null;let l={frameId:null,sessionId:i,target:{tabId:r,targetId:n},targetId:n};return this.frameSessionsBySessionId.set(i,l),this.setFrameSessionForFrame(r,o??n,l),this.rememberAttachedFrameTarget(r,n),await this.initializeAttachedFrameSession(l).catch(()=>{}),l.target}async evaluateJavascript(r,n,o={}){let i={expression:n,returnByValue:o.returnByValue??!0};o.awaitPromise!=null&&(i.awaitPromise=o.awaitPromise);let s=await this.call(r,"Runtime.evaluate",i,{telemetryAttrs:o.telemetryAttrs,timeoutMs:o.timeoutMs});if(s.exceptionDetails!=null)throw new Error(b9(s.exceptionDetails));return s.result?.value}async readDocumentState(r){try{return await this.evaluateJavascript(r,"({ href: window.location.href, readyState: document.readyState })",{telemetryAttrs:{"browser_use.cdp.eval.kind":"document_state"}})}catch{return}}async waitForPageLoadEvent(r,n){let o=n.classificationTimeoutMs??250,i=I9(r),s;try{s=await this.waitForEvent(i.tabId,u=>g1(u,i)&&(zt(u)||D9(u)),{timeoutMs:o,timeoutMessage:"Timed out waiting for page load start."})}catch{return}Er(s);let a;try{a=await this.waitForEvent(i.tabId,u=>g1(u,i)&&(zt(u)||N9(u)),{timeoutMs:n.timeoutMs,timeoutMessage:"Timed out waiting for page load completion."})}catch{return}Er(a)}waitForEvent(r,n,o){let i=Number(r);if(!Number.isFinite(i))throw new Error("waitForEvent requires numeric tab_id");return new Promise((s,a)=>{let u=!1,l=()=>{this.removeListener("event",m),clearTimeout(h),o.signal?.removeEventListener("abort",f)},d=_=>{u||(u=!0,l(),s(_))},p=_=>{u||(u=!0,l(),a(_))},f=()=>{p(new Error("waitForEvent aborted"))},m=_=>{if(_.source.tabId===i)try{n(_)&&d(_)}catch(S){p(S instanceof Error?S:new Error(`waitForEvent predicate failed: ${String(S)}`));return}},h=setTimeout(()=>{p(new Error(o.timeoutMessage))},o.timeoutMs);if(o.signal?.aborted){f();return}o.signal?.addEventListener("abort",f,{once:!0}),this.addListener("event",m)})}async detachAllTabs(){let r=[...this.attachedTabIds];await Promise.allSettled(r.map(async n=>this.detachTab(n)))}async closeTab(r){let n=Number(r);if(!Number.isFinite(n))throw new Error("closeTab requires numeric tab_id");let i=(await this.call(r,"Target.getTargets",{})).targetInfos.find(s=>"tabId"in s?s.tabId===n:!1);await this.ensureAttachedTab(n);try{await this.runTabCleanupHandlers(n);let s=tu(i);s!=null?await this.api.executeCdp({target:{tabId:n},method:"Target.closeTarget",commandParams:{targetId:s}}):await this.api.executeCdp({target:{tabId:n},method:"Page.close",commandParams:{}})}finally{this.forgetAttachedTab(n)}}async detachTab(r){let n=Number(r);if(!Number.isFinite(n))throw new Error("detachTab requires numeric tab_id");if(this.attachedTabIds.has(n))try{await this.runTabCleanupHandlers(n),await this.api.detach(n)}finally{this.forgetAttachedTab(n)}}addTabCleanupHandler(r){return this.tabCleanupHandlers.add(r),()=>{this.tabCleanupHandlers.delete(r)}}addTabAttachHandler(r){return this.tabAttachHandlers.add(r),()=>{this.tabAttachHandlers.delete(r)}}async runTabAttachHandlers(r){await Promise.allSettled([...this.tabAttachHandlers].map(async n=>n(r)))}async runTabCleanupHandlers(r){await Promise.allSettled([...this.tabCleanupHandlers].map(async n=>n(r)))}deleteFileChoosersForTab(r){for(let[n,o]of this.fileChoosersById)o.tabId===r&&this.fileChoosersById.delete(n)}async ensureAttachedTab(r){this.attachedTabIds.has(r)||(await this.api.attach(r),await this.enableFocusEmulation(r),this.attachedTabIds.add(r),this.emit("tabAttached",r),await this.runTabAttachHandlers(r))}async enableFocusEmulation(r){try{await this.api.executeCdp({target:{tabId:r},method:"Emulation.setFocusEmulationEnabled",commandParams:{enabled:!0}})}catch{}}async enableOopifAutoAttachForTarget(r,n={}){let o={autoAttach:!0,flatten:!0,waitForDebuggerOnStart:!1};try{await this.api.executeCdp({target:r,method:"Target.setAutoAttach",commandParams:{...o,filter:[{type:"iframe",exclude:!1}]},timeoutMs:n.timeoutMs})}catch{try{await this.api.executeCdp({target:r,method:"Target.setAutoAttach",commandParams:o,timeoutMs:n.timeoutMs})}catch{}}}recordRawCdpEvent(r,n){let o=n.source.targetId??(n.source.sessionId==null?void 0:this.frameSessionsBySessionId.get(n.source.sessionId)?.targetId),i={method:n.method,...n.params==null?{}:{params:A9(n.params)},sequence:this.nextRawCdpEventSequence(r),source:n.source,...o==null?{}:{trackedTargetId:o}},s=this.rawCdpEventsByTabId.get(r)??[];if(s.push(i),s.length>h1){let u=s.splice(0,s.length-h1).at(-1);u!=null&&this.rawCdpEventEvictedThroughSequenceByTabId.set(r,u.sequence)}this.rawCdpEventsByTabId.set(r,s)}attachedTabIdForCdpEvent(r){if(typeof r.tabId=="number")return this.attachedTabIds.has(r.tabId)?r.tabId:void 0;if(r.sessionId!=null)return this.frameSessionsBySessionId.get(r.sessionId)?.target.tabId;if(r.targetId!=null){for(let[n,o]of this.frameSessionsByTabId)if(o.has(r.targetId))return n}}rawCdpEventsResult(r,n,o){let i=this.rawCdpEventsByTabId.get(r)??[],s=n<(this.rawCdpEventEvictedThroughSequenceByTabId.get(r)??0),a=i.filter(m=>m.sequence>n&&T9(m,o.methods)&&this.matchesRawCdpEventTarget(m,o.target)),u=o.limit??a.length,l=a.slice(0,u).map(k9),d=a.length>l.length,p=l.at(-1);return{cursor:d&&p!=null?p.sequence:this.rawCdpEventSequenceForTab(r),events:l,hasMore:d,truncated:s}}rawCdpEventSequenceForTab(r){return this.rawCdpEventSequenceByTabId.get(r)??0}nextRawCdpEventSequence(r){let n=this.rawCdpEventSequenceForTab(r)+1;return this.rawCdpEventSequenceByTabId.set(r,n),n}rawCdpTarget(r,n){if(n?.sessionId!=null&&n.targetId!=null)throw new Error("CDP target must provide either sessionId or targetId, not both.");if(n?.sessionId!=null){let o=this.frameSessionsBySessionId.get(n.sessionId);if(o?.target.tabId!==r)throw new Error(`CDP session ${n.sessionId} is not attached to tab ${r}.`);return o.target}if(n?.targetId!=null){let o=this.frameSessionsByTabId.get(r)?.get(n.targetId);if(o==null)throw new Error(`CDP target ${n.targetId} is not attached to tab ${r}.`);return o.target}return{tabId:r}}matchesRawCdpEventTarget(r,n){return n?.sessionId!=null?r.source.sessionId===n.sessionId:n?.targetId==null?!0:r.source.targetId===n.targetId||r.trackedTargetId===n.targetId}discardRawCdpEventsForTab(r){let n=this.rawCdpEventSequenceForTab(r);n>0&&this.rawCdpEventEvictedThroughSequenceByTabId.set(r,Math.max(n,this.rawCdpEventEvictedThroughSequenceByTabId.get(r)??0)),this.rawCdpEventsByTabId.delete(r)}forgetAttachedTab(r){this.attachedTabIds.has(r)&&(this.deleteFileChoosersForTab(r),this.deleteFrameSessionsForTab(r),this.oopifAutoAttachTabIds.delete(r),this.discardRawCdpEventsForTab(r),this.topLevelSecurityOriginsByTabId.delete(r),this.attachedTabIds.delete(r),this.emit("tabDetached",r))}handleTargetEvent(r){if(r.method==="Target.attachedToTarget"){this.handleAttachedToTarget(r);return}if(r.method==="Target.detachedFromTarget"){this.handleDetachedFromTarget(r);return}if(r.method==="Page.frameNavigated"){if(C9(r)){let n=r.source.tabId,o=r.params.frame.securityOrigin;this.topLevelSecurityOriginsByTabId.get(n)!==o&&this.discardRawCdpEventsForTab(n),this.topLevelSecurityOriginsByTabId.set(n,o)}this.handleFrameNavigated(r);return}r.method==="Page.frameDetached"&&this.handleFrameDetached(r)}handleAttachedToTarget(r){let n=r.source.tabId,o=r.params.targetInfo,i=r.params.sessionId;if(typeof n!="number"||typeof i!="string"||!w9(o))return;let s=tu(o);if(s==null)return;let a=this.frameSessionsBySessionId.get(i);if(a!=null){this.setFrameSessionTargetId(n,s,a);return}let u={frameId:null,sessionId:i,target:{tabId:n,sessionId:i},targetId:s};this.frameSessionsBySessionId.set(i,u),this.setFrameSessionTargetId(n,s,u),this.initializeAttachedFrameSession(u).catch(()=>{})}handleDetachedFromTarget(r){let n=this.frameSessionsBySessionId.get(r.params.sessionId);n!=null&&this.deleteFrameSession(n)}handleFrameNavigated(r){let n=r.source.sessionId,o=r.source.tabId,i=r.params.frame.id;if(typeof o!="number"||typeof n!="string")return;let s=this.frameSessionsBySessionId.get(n);s!=null&&(s.frameId!=null&&s.frameId!==i||this.setFrameSessionForFrame(o,i,s))}handleFrameDetached(r){let n=r.source.tabId;if(typeof n!="number")return;let o=this.frameSessionsByTabId.get(n)?.get(r.params.frameId);o!=null&&this.deleteFrameSession(o)}async initializeAttachedFrameSession(r){await this.enableOopifAutoAttachForTarget(r.target),await this.api.executeCdp({target:r.target,method:"Page.enable",commandParams:{}}),await this.api.executeCdp({target:r.target,method:"Runtime.enable",commandParams:{}});let n=await this.api.executeCdp({target:r.target,method:"Page.getFrameTree",commandParams:{}});if(this.frameSessionsBySessionId.get(r.sessionId)!==r)return;let o=n.frameTree.frame.id;this.setFrameSessionForFrame(r.target.tabId,o,r)}setFrameSessionForFrame(r,n,o){let i=this.frameSessionsByTabId.get(r)??new Map;this.frameSessionsByTabId.set(r,i),o.frameId!=null&&o.frameId!==n&&i.delete(o.frameId),o.frameId=n,i.set(n,o)}setFrameSessionTargetId(r,n,o){let i=this.frameSessionsByTabId.get(r)??new Map;this.frameSessionsByTabId.set(r,i),o.targetId!==n&&o.targetId!==o.frameId&&i.delete(o.targetId),o.targetId=n,i.set(n,o)}deleteFrameSession(r){this.frameSessionsBySessionId.delete(r.sessionId);let n=this.frameSessionsByTabId.get(r.target.tabId);r.frameId!=null&&n?.delete(r.frameId),n?.delete(r.targetId)}deleteFrameSessionsForTab(r){let n=this.frameSessionsByTabId.get(r);if(n!=null){for(let o of n.values())this.frameSessionsBySessionId.delete(o.sessionId);this.frameSessionsByTabId.delete(r)}}rememberAttachedFrameTarget(r,n){let o=this.attachedFrameTargetIdsByTabId.get(r)??new Set;this.attachedFrameTargetIdsByTabId.set(r,o),o.add(n)}async detachAttachedFrameTargets(r){let n=this.attachedFrameTargetIdsByTabId.get(r);if(n==null)return;this.attachedFrameTargetIdsByTabId.delete(r);let o=this.api;typeof o.detachTarget=="function"&&await Promise.allSettled([...n].map(async i=>o.detachTarget(r,i)))}handleJavaScriptDialogOpening(r){if(r.method!=="Page.javascriptDialogOpening"||!r.params)return;let n=r.params.type,o=r.source.tabId;if(n!=="alert"&&n!=="beforeunload"||typeof o!="number")return;let i=typeof r.source.sessionId=="string"?{tabId:o,sessionId:r.source.sessionId}:{tabId:o};this.api.executeCdp({target:i,method:"Page.handleJavaScriptDialog",commandParams:{accept:!0}}).catch(()=>{})}};function b9(e){let t=e.exception?.value;return`Browser Use encountered an error interacting with this webpage: ${typeof t=="string"?t:e.exception?.description??e.text??"JavaScript evaluation failed"}`}function tu(e){if(typeof e?.targetId=="string")return e.targetId;if(typeof e?.id=="string")return e.id}function y9(e,t){return!("tabId"in e)||e.tabId==null?!0:e.tabId===t}function _9(e,t){return e.type==="iframe"?!0:e.type==="other"&&t.url!=null&&e.url===t.url}function w9(e){return e.type==="iframe"||e.type==="other"}function x9(e){return e.split(".",1)[0]??e}function S9(e){return{...e,"browser_use.cdp.domain":"full","browser_use.cdp.method":"full"}}function v9(e,t){return e!=="Runtime.evaluate"||!E9(t)?{}:{"browser_use.cdp.eval.await_promise":t.awaitPromise,"browser_use.cdp.eval.return_by_value":t.returnByValue}}function E9(e){return typeof e=="object"&&e!=null&&"expression"in e&&typeof e.expression=="string"}function zt(e){return e.method===g9}function Cr(e){return e.source.sessionId==null}function C9(e){return typeof e.source.tabId=="number"&&Cr(e)&&e.params.frame.parentId==null}function g1(e,t){return t.sessionId!=null?e.source.sessionId===t.sessionId:t.targetId!=null?e.source.targetId===t.targetId:Cr(e)}function T9(e,t){return t==null||t.includes(e.method)}function A9(e){return Object.fromEntries(Object.entries(e))}function k9(e){return{method:e.method,...e.params==null?{}:{params:e.params},sequence:e.sequence,source:e.source}}function I9(e){if(typeof e=="object")return e;let t=Number(e);if(!Number.isFinite(t))throw new Error("waitForPageLoadEvent requires numeric tab_id");return{tabId:t}}function Er(e){if(!(e==null||!zt(e)))throw new Error(R9(e))}function R9(e){let t=P9(e.params.url)??"this page";return J(`Browser Use is not permitted on ${t}.`)}function P9(e){if(typeof e!="string")return null;try{let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return null;t.username="",t.password="",t.search="",t.hash="";let r=t.toString();return t.pathname==="/"?r.slice(0,-1):r}catch{return null}}function D9(e){return e.method==="Page.frameStartedLoading"||e.method==="Page.frameNavigated"||e.method==="Page.navigatedWithinDocument"}function N9(e){return e.method==="Page.domContentEventFired"||e.method==="Page.loadEventFired"}var y1=y("navigate_tab_url",async(e,t)=>{if(typeof e.url!="string"||!e.url)throw new Error("navigate_tab_url requires a url");let r=Number(e.tab_id);if(!Number.isInteger(r)||r<=0)throw new Error("navigate_tab_url requires a positive integer tab_id");let n=typeof e.timeout_ms=="number"?e.timeout_ms:1e4,o=await t.cdp.readDocumentState(r),i=Kc(o?.href),s=Kc(e.url);await t.cdp.call(r,"Page.enable",{});let a=await O9(r,t),u=M9({mainFrameId:a,previousUrl:i,targetUrl:s}),l=new AbortController,d=t.cdp.waitForEvent(r,p=>Cr(p)&&(zt(p)||u(p)),{timeoutMs:n,timeoutMessage:`Timed out waiting for tab ${r} to navigate to ${e.url}.`,signal:l.signal}).then(p=>({event:p}),p=>l.signal.aborted?{event:void 0}:{error:p});try{let p=await t.cdp.call(r,"Page.navigate",{url:e.url});if(p.errorText){let m=q9(e.url)??"this page";throw new Error(`Browser Use cannot open ${m} in tab ${r}. Browser reported: ${j9(p.errorText,e.url,m)}`)}let f=await d;if("error"in f)throw f.error;Er(f.event)}finally{l.abort()}return{}});async function O9(e,t){try{return(await t.cdp.call(e,"Page.getFrameTree")).frameTree?.frame?.id}catch{return}}function M9({mainFrameId:e,previousUrl:t,targetUrl:r}){let n=!1;return o=>{if(F9(o))return b1(Kc(o.params?.url),t,r);if(B9(o,e)){let i=Kc(o.params.frame.url);b1(i,t,r)&&(n=!0)}return L9(o,e)&&(n=!0),n&&U9(o)}}function b1(e,t,r){return e==null?!1:r!=null&&e===r||t!=null&&e!==t?!0:t==null&&r==null}function F9(e){return e.method==="Page.navigatedWithinDocument"}function B9(e,t){if(e.method!=="Page.frameNavigated"||!Bh(e.params))return!1;let r=e.params.frame;return Bh(r)?t!=null?r.id===t:!("parentId"in r):!1}function L9(e,t){return e.method!=="Page.frameStartedLoading"||t==null||!Bh(e.params)?!1:e.params.frameId===t}function U9(e){return e.method==="Page.domContentEventFired"||e.method==="Page.loadEventFired"}function Kc(e){if(typeof e=="string")try{return new URL(e).href}catch{return e}}function j9(e,t,r){return e.replaceAll(t,r)}function q9(e){if(typeof e!="string")return null;try{let t=new URL(e);if(t.protocol!=="http:"&&t.protocol!=="https:")return null;t.username="",t.password="",t.search="",t.hash="";let r=t.toString();return t.pathname==="/"?r.slice(0,-1):r}catch{return null}}function Bh(e){return typeof e=="object"&&e!=null}var _1=" >> internal:control=enter-frame >> ",x1=y("playwright_dom_snapshot",async(e,t)=>{let r=se(e),n=await S1(t,e.tab_id,await t.playwright.evaluateOnPlaywrightPage(e.tab_id,o=>{let i=document.body||document.documentElement;return i?o.incrementalAriaSnapshot(i,{mode:"ai"}):{full:"",iframeDepths:{},iframeRefs:[]}},{timeoutMs:r}),r);return{dom_snapshot:W9(n)}});async function S1(e,t,r,n,o){let i=r.iframeRefs.filter(u=>u in r.iframeDepths);if(!i.length)return r.full;let s=new Map(await Promise.all(i.map(async u=>[u,await $9(e,t,u,n,o)]))),a=[];for(let u of r.full.split(`
`)){let l=z9(u);if(!l){a.push(u);continue}let d=s.get(l);if(!d){a.push(u);continue}let p=u.match(/^ */)?.[0]??"";a.push(u.endsWith(":")?u:`${u}:`),a.push(...d.split(`
`).map(f=>`${p}  ${f}`))}return a.join(`
`)}async function $9(e,t,r,n,o){try{let i=o?`${o}${_1}aria-ref=${r}`:`aria-ref=${r}`;if(await e.playwright.evaluateOnPlaywrightSelector(t,i,a=>{if(a.hasAttribute("hidden")||a.getAttribute("aria-hidden")==="true")return!0;let u=a.ownerDocument.defaultView;if(!u)return!0;let l=u.getComputedStyle(a);if(l.display==="none"||l.visibility==="hidden"||l.visibility==="collapse")return!0;let d=a.getBoundingClientRect();return d.width<=0||d.height<=0},{retry:!1,timeoutMs:n}))return null;let s=await e.playwright.evaluateOnPlaywrightSelector(t,`${i}${_1}body`,(a,u)=>u.incrementalAriaSnapshot(a,{mode:"ai"}),{retry:!1,timeoutMs:n});return await S1(e,t,s,n,i)}catch{return null}}function z9(e){return e.trimStart().startsWith("- iframe")?e.match(/\[ref=([^\]]+)\]/)?.[1]??null:null}function W9(e){return!e.startsWith("- ")&&!e.includes(`
- `)&&!e.includes(`
  - `)?e:E1(H9(e).flatMap(v1))}function H9(e){let t={children:[],indent:-1,line:""},r=[t];for(let n of e.split(`
`)){if(n.trim()==="")continue;let o=n.match(/^ */)?.[0].length??0,i={children:[],indent:o,line:n.slice(o)};for(;r.length>1&&o<=w1(r).indent;)r.pop();w1(r).children.push(i),r.push(i)}return t.children}function w1(e){let t=e.at(-1);if(t==null)throw new Error("Expected snapshot stack to be non-empty");return t}function v1(e){let t=e.children.flatMap(v1),r={children:t,line:V9(e.line)};return K9(r.line)?[]:G9(r.line)?t:[r]}function E1(e,t=0){let r=[],n="  ".repeat(t);for(let o of e){r.push(n+o.line);let i=E1(o.children,t+1);i!==""&&r.push(i)}return r.join(`
`)}function V9(e){return e.replace(/ \[ref=[^\]]+\]/g,"").replace(/ \[cursor=[^\]]+\]/g,"")}function G9(e){return/^- (generic|listitem|group)(?: \[[^\]]+\])*:?$/.test(e)}function K9(e){return/^- img(?: \[[^\]]+\])*:?$/.test(e)}var C1=y("playwright_download_path",async(e,t)=>{if(A(e.tab_id),typeof e.download_id!="string"||e.download_id.length===0)throw new Error("playwright_download_path requires a download_id");return{path:t.downloads.getPath(e.download_id)}});var J9='To enable file upload, go to chrome://extensions in Chrome, click Details under the Codex extension, and enable "Allow access to file URLs." See [here](https://developers.openai.com/codex/app/chrome-extension#upload-files) for details.',T1=y("playwright_file_chooser_set_files",async(e,t)=>{let r=A(e.tab_id),n=t.cdp.fileChoosersById.get(e.file_chooser_id);if(n==null)throw new Error(`Unknown file chooser id "${e.file_chooser_id}"`);let o=`File chooser "${e.file_chooser_id}" belongs to tab ${n.tabId}`;if(n.tabId!==r)throw new Error(o);if(e.files.length===0)throw new Error("fileChooser.setFiles requires at least one file");if(!n.isMultiple&&e.files.length>1)throw new Error("File chooser does not accept multiple files");await t.security.ensureFileUploadAllowed(r);try{await t.cdp.call(r,"DOM.setFileInputFiles",{backendNodeId:n.backendNodeId,files:e.files})}catch(i){throw Y9(i)?new Error(J9):i}return t.cdp.fileChoosersById.delete(e.file_chooser_id),{}});function Y9(e){return e==="Not allowed"?!0:e instanceof Error?e.message==="Not allowed":typeof e!="object"||e==null||!("message"in e)?!1:e.message==="Not allowed"}var A1=y("playwright_locator_dblclick",async(e,t)=>(await t.playwright.clickLocator(e,2),{}));var k1=y("playwright_locator_download_media",async(e,t)=>(await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,r=>{r.scrollIntoView({block:"center",inline:"nearest"});let n=r.closest?.("img, video, source, a[href]")??r.querySelector?.("img, video, source, a[href]")??r,o=(a,u)=>{let l=a[u];return typeof l=="string"?l:null},i=o(n,"currentSrc")??o(n,"src")??o(n,"href")??"";if(!i)throw new Error("Matched element does not expose a downloadable media URL");let s=document.createElement("a");return s.href=i,s.download=i.split("/").pop()?.split("?")[0]||"download",s.rel="noopener",s.style.display="none",document.body.appendChild(s),s.click(),s.remove(),!0},{timeoutMs:e.timeout_ms}),{}));var I1=y("playwright_locator_get_attribute",async(e,t)=>{if(typeof e.name!="string"||!e.name)throw new Error("playwright_locator_get_attribute requires name");return{value:await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,(r,n,o)=>r.getAttribute(o.name),{arg:{name:e.name},timeoutMs:e.timeout_ms})}});var R1=y("playwright_locator_inner_text",async(e,t)=>({value:await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,r=>"innerText"in r?String(r.innerText):"",{timeoutMs:e.timeout_ms})}));var P1=y("playwright_locator_all_text_contents",async(e,t)=>({values:await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,r=>r.map(n=>typeof n.textContent=="string"?n.textContent:""),{timeoutMs:e.timeout_ms})}));var D1=y("playwright_locator_select_option",async(e,t)=>(await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,(r,n,o)=>{let i=n.elementState(r,"enabled");if(i.received==="error:notconnected")throw new Error("Element is not connected");if(!i.matches)throw new Error("Element is not enabled");let s=n.selectOptions(r,o.selections);if(typeof s=="string"&&s.startsWith("error:"))throw new Error(s);return!0},{arg:{selections:e.selections??[]},timeoutMs:e.timeout_ms}),{}));var N1=y("playwright_locator_set_checked",async(e,t)=>{if(typeof e.checked!="boolean")throw new Error("playwright_locator_set_checked requires checked");let r=await t.playwright.readCheckedState(e);if(r.checked===e.checked)return{};if(r.isRadio&&!e.checked)throw new Error("Cannot uncheck a radio button");if(await t.playwright.clickLocator(e,1),(await t.playwright.readCheckedState(e)).checked!==e.checked)throw new Error(`Click did not change checked state to ${String(e.checked)}`);return{}});var O1=y("playwright_locator_text_content",async(e,t)=>({value:await t.playwright.evaluateOnPlaywrightSelector(e.tab_id,e.selector,r=>r.textContent,{timeoutMs:e.timeout_ms})}));var M1=y("playwright_locator_read_all",async(e,t)=>({values:await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,(r,n,o)=>{let i=u=>({attributes:Object.fromEntries(Array.from(u.attributes,l=>[l.name,l.value])),inner_text:"innerText"in u?String(u.innerText):"",text_content:u.textContent});if(!o.relativeSelector)return r.map(i);let s=n,a=s.parseSelector(o.relativeSelector);return r.map(u=>{let l=s.querySelectorAll(a,u);return l[0]?i(l[0]):null})},{arg:{relativeSelector:e.relative_selector},timeoutMs:e.timeout_ms})}));var F1=y("playwright_locator_wait_for",async(e,t)=>{let r=e.state??"visible";if(r!=="attached"&&r!=="detached"&&r!=="visible"&&r!=="hidden")throw new Error(`Unsupported waitFor state: ${String(r)}`);return await t.playwright.evaluateOnPlaywrightSelectorAll(e.tab_id,e.selector,(n,o,i)=>{let s=n[0]??null;if(i.state==="attached"){if(s)return!0;throw new Error("Element is not attached")}if(i.state==="detached"){if(!s)return!0;throw new Error("Element is still attached")}if(!s){if(i.state==="hidden")return!0;throw new Error("Element is not attached")}let a=o.elementState(s,i.state);if(a.received==="error:notconnected")throw new Error("Element is not connected");if(a.matches)return!0;throw new Error("Element is not "+i.state)},{arg:{state:r},timeoutMs:e.timeout_ms}),{}});var B1=y("playwright_wait_for_download",async(e,t)=>{let r=A(e.tab_id),n=se({...e,max:12e4});await t.downloads.enableDownload(r);try{return{download_id:(await t.downloads.waitForDownload(r,n)).id}}finally{await t.downloads.disableDownload(r)}});var L1=y("playwright_wait_for_file_chooser",async(e,t)=>{let r=A(e.tab_id),n=se(e);await t.cdp.call(r,"Page.enable"),await t.cdp.call(r,"Page.setInterceptFileChooserDialog",{enabled:!0});try{let o=await t.cdp.waitForEvent(r,Z9,{timeoutMs:n,timeoutMessage:`Timed out after ${n}ms waiting for file chooser.`}),i=crypto.randomUUID(),s=X9(r,o);return t.cdp.fileChoosersById.set(i,s),{file_chooser_id:i,is_multiple:s.isMultiple}}finally{await t.cdp.call(r,"Page.setInterceptFileChooserDialog",{enabled:!1}).catch(()=>{})}});function Z9(e){let t=U1(e);return e.method==="Page.fileChooserOpened"&&j1(t?.backendNodeId)}function X9(e,t){let r=U1(t);if(!j1(r?.backendNodeId))throw new Error("File chooser event did not include a backend node id");return{backendNodeId:r.backendNodeId,isMultiple:r.mode==="selectMultiple",tabId:e}}function U1(e){return e.params}function j1(e){return typeof e=="number"&&Number.isInteger(e)&&e>0}var q1=y("playwright_wait_for_load_state",async(e,t)=>(await Lh(e.tab_id,e.state,se(e),t),{}));async function Lh(e,t,r,n){let o=A(e),i=t??"load";if(i==="networkidle")throw new Error("playwright_wait_for_load_state does not support networkidle");await n.cdp.call(o,"Page.enable",{});let s=await n.cdp.readDocumentState(o);if(Q9(s?.readyState,i))return;let a=await n.cdp.waitForEvent(o,u=>Cr(u)&&(zt(u)||ej(u,i)),{timeoutMs:r,timeoutMessage:`Timed out waiting for ${i} in tab ${o}.`});Er(a)}function Q9(e,t){return t==="domcontentloaded"&&e==="interactive"||e==="complete"}function ej(e,t){return t==="domcontentloaded"&&e.method==="Page.domContentEventFired"||e.method==="Page.loadEventFired"}var $1=y("playwright_wait_for_timeout",async e=>(A(e.tab_id),await new Promise(t=>setTimeout(t,e.timeout_ms)),{}));var H1=y("playwright_wait_for_url",async(e,t)=>{if(typeof e.url!="string"||!e.url)throw new Error("playwright_wait_for_url requires a url");let r=A(e.tab_id),n=se(e),o=new RegExp(rj(e.url)),i=d=>o.test(d);await t.cdp.call(r,"Page.enable",{});let s=await t.cdp.readDocumentState(r);if(s?.href&&i(s.href))return await z1(e,n,t),{url:s.href};let a=await tj(r,t),u=await t.cdp.waitForEvent(r,d=>Cr(d)&&(zt(d)||W1(d,a,i)!=null),{timeoutMs:n,timeoutMessage:`Timed out waiting for URL ${e.url} in tab ${r}.`});Er(u);let l=W1(u,a,i);return await z1(e,n,t),l==null?{}:{url:l}});async function z1(e,t,r){switch(e.wait_until){case void 0:case"commit":return;case"load":case"domcontentloaded":case"networkidle":await Lh(e.tab_id,e.wait_until,t,r);return}}async function tj(e,t){try{return(await t.cdp.call(e,"Page.getFrameTree")).frameTree?.frame?.id}catch{return}}function W1(e,t,r){if(e.method==="Page.navigatedWithinDocument"){let a=Jc(e.params,"url");return a!=null&&r(a)?a:void 0}if(e.method!=="Page.frameNavigated"||!Uh(e.params)||!Uh(e.params.frame))return;let n=e.params.frame,o=Jc(n,"id"),i=Jc(n,"parentId");if(t!=null?o!==t:i!=null)return;let s=Jc(n,"url");return s!=null&&r(s)?s:void 0}function rj(e){let t="^";for(let r=0;r<e.length;){let n=e[r];if(n==null)break;if(n==="*"){let o=e[r+1]==="*";t+=o?".*":"[^/]*",r+=o?2:1;continue}t+=/[\\.^$|()[\]{}+?]/.test(n)?`\\${n}`:n,r+=1}return`${t}$`}function Jc(e,t){if(!Uh(e))return;let r=e[t];return typeof r=="string"?r:void 0}function Uh(e){return typeof e=="object"&&e!=null}var V1=y("selected_tab",async(e,t)=>({id:(await t.tabs.getActive()).id.toString()}));var G1="tab_clipboard_read",nj=async()=>{if(navigator.clipboard?.read==null)throw new Error("navigator.clipboard.read is not available");let e=n=>{let o=new Uint8Array(n),i=32768,s="";for(let a=0;a<o.length;a+=i){let u=o.subarray(a,a+i);s+=String.fromCharCode(...u)}return btoa(s)},t=await navigator.clipboard.read();return{items:await Promise.all(t.map(async n=>({entries:await Promise.all(n.types.map(async i=>{let s=await n.getType(i);return i.startsWith("text/")?{mime_type:i,text:await s.text()}:{mime_type:i,base64:e(await s.arrayBuffer())}})),presentation_style:n.presentationStyle??"unspecified"})))}},K1=y(G1,async(e,t)=>{let r=A(e.tab_id);return Re({args:{},commandType:G1,ctx:t,pageFunction:nj,tabId:r})});var J1="tab_clipboard_read_text",oj=async()=>{if(navigator.clipboard?.readText==null)throw new Error("navigator.clipboard.readText is not available");return navigator.clipboard.readText()},Y1=y(J1,async(e,t)=>{let r=A(e.tab_id);return{text:await Re({args:{},commandType:J1,ctx:t,pageFunction:oj,tabId:r})}});var ij=async({text:e})=>{if(navigator.clipboard?.writeText==null)throw new Error("navigator.clipboard.writeText is not available");await navigator.clipboard.writeText(e)},jh="tab_clipboard_write_text",Z1=y(jh,async(e,t)=>{let r=A(e.tab_id);if(typeof e.text!="string")throw new Error(`${jh} requires text`);return await Re({args:{text:e.text},commandType:jh,ctx:t,pageFunction:ij,tabId:r}),{}});async function Q1(e){return(await tA(e)).enabled}async function eA(e){let t=await tA(e);if(!t.enabled)throw new Error(J(t.reason))}function ai(e){switch(e){case"extension":case"iab":return!0;case"cdp":return!1}}async function tA({internalBuild:e=!1,privilegedNodeRepl:t=Me()}={}){if(!e)return nu("Full CDP access is disabled in this Browser Use build.");if(t==null)return nu("Full CDP access could not be verified for this Browser Use session.");try{let[r,n]=await Promise.all([t.config.readToml(Xi),t.config.readRequirements().catch(()=>({requirements:null}))]);return aj(n)===!1?nu("Full CDP access is disabled by enterprise policy."):r[zy]!==!0?nu("Full CDP access is disabled in browser config."):{enabled:!0}}catch{return nu("Full CDP access could not be verified from browser config.")}}function aj(e){let r=X1(X1(e.requirements)?.featureRequirements)?.[Wy];return typeof r=="boolean"?r:void 0}function X1(e){return e==null||typeof e!="object"||Array.isArray(e)?null:e}function nu(e){return{enabled:!1,reason:e}}var uj=new Set(["Accessibility","Audits","CacheStorage","Console","CSS","Database","Debugger","DOM","DOMDebugger","DOMSnapshot","Emulation","Fetch","IO","Input","Inspector","Log","Network","Overlay","Page","Performance","Profiler","Runtime","Storage","Target","Tracing","WebAudio","WebAuthn"]),lj=new Set(["CacheStorage","Database","Storage","Target","WebAuthn"]),cj=new Set(["DOM.getFileInfo","DOM.setFileInputFiles","Input.dispatchKeyEvent","Input.setInterceptDrags","Network.clearBrowserCookies","Network.deleteCookies","Network.deleteDeviceBoundSession","Network.enableDeviceBoundSessions","Network.getAllCookies","Network.getCookies","Network.getResponseBodyForInterception","Network.setCookie","Network.setCookieControls","Network.setCookies","Network.setExtraHTTPHeaders","Network.setRequestInterception","Network.takeResponseBodyForInterceptionAsStream","Page.addScriptToEvaluateOnLoad","Page.addScriptToEvaluateOnNewDocument","Page.crash","Page.deleteCookie","Page.disable","Page.getNavigationHistory","Page.resetNavigationHistory","Page.setAdBlockingEnabled","Page.setBypassCSP","Page.setDownloadBehavior","Page.setInterceptFileChooserDialog","Page.setRPHRegistrationMode","Page.setSPCTransactionMode","Tracing.requestMemoryDump"]),dj=new Map([["DOM.setFileInputFiles",'Use tab.playwright.waitForEvent("filechooser") and chooser.setFiles(...) instead.'],["Input.dispatchDragEvent",'Use tab.playwright.waitForEvent("filechooser") and chooser.setFiles(...) instead for file uploads.'],["Input.dispatchKeyEvent","Use tab.cua.type(...) or tab.cua.keypress(...) instead."],["Page.getNavigationHistory","For supported history navigation, use tab.back() or tab.forward() instead."],["Page.navigate","Use tab.goto(url) instead."],["Page.navigateToHistoryEntry","Use tab.back() or tab.forward() instead."],["Page.reload","Use tab.reload() instead."],["Page.setDownloadBehavior",'Use tab.playwright.waitForEvent("download") before triggering a download instead.'],["Page.setInterceptFileChooserDialog",'Use tab.playwright.waitForEvent("filechooser") and chooser.setFiles(...) instead.']]),nA=new Map([["Fetch.continueRequest",fj],["Fetch.continueResponse",rA],["Fetch.fulfillRequest",rA],["Input.dispatchDragEvent","block"],["Network.continueInterceptedRequest","block"],["Network.getCertificate","block"],["Network.loadNetworkResource","block"],["Network.replayXHR","block"],["Page.navigate","block"],["Page.navigateToHistoryEntry","block"]]);function oA(e,t){let r=gj(e),n=nA.get(e);if(r==null||!uj.has(r)||lj.has(r)||cj.has(e)||n==="block"||pj(e,t))throw new Error(sA(e))}function iA(e,t){let r=nA.get(e);if(r==="block")throw new Error(sA(e));return r?.(e,t)??[]}function sA(e){let t=dj.get(e);return t==null?"This method is not supported through raw CDP.":`This method is not supported through raw CDP. ${t}`}function pj(e,t){switch(e){case"Fetch.continueResponse":case"Fetch.fulfillRequest":return t?.binaryResponseHeaders!=null;case"Network.configureDurableMessages":return t?.maxTotalBufferSize!=null;case"Network.enable":return t?.enableDurableMessages===!0;case"Page.createIsolatedWorld":return t?.grantUniveralAccess===!0;case"Page.reload":return t?.scriptToEvaluateOnLoad!=null;case"Tracing.start":return hj(t);default:return!1}}function fj(e,t){return mj(e,t,"url")}function rA(e,t){let r=t?.responseHeaders;if(r==null)return[];if(!Array.isArray(r))throw new Error(`${e} responseHeaders must be an array when set.`);let n=[];for(let o of r){if(!aA(o)||typeof o.name!="string"||typeof o.value!="string")throw new Error(`${e} responseHeaders entries must include string name and value fields.`);o.name.trim().toLowerCase()==="location"&&n.push(o.value)}return n}function mj(e,t,r){if(t==null||!Object.hasOwn(t,r))return[];let n=t[r];if(typeof n!="string")throw new Error(`${e} ${r} must be a string when set.`);return[n]}function hj(e){let t=e?.traceConfig;return e?.perfettoConfig!=null||e?.tracingBackend==="system"||typeof e?.options=="string"&&e.options.split(",").some(r=>r.trim()==="enable-systrace")||aA(t)&&(t.enableSystrace===!0||t.memoryDumpConfig!=null)}function gj(e){let t=e.indexOf(".");return t>0?e.slice(0,t):null}function aA(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function Yc(e){if(e!=null)return{sessionId:e.session_id,targetId:e.target_id}}var uA=y(Ut.Call,async(e,t)=>{if(await t.assertFullCdpAccessEnabled(),!ai(t.clientInfo.type))throw new Error("Full CDP access is currently only available for Chrome and in-app browser tabs.");let r=Ut.Call.PayloadSchema.parse(e),n=A(r.tab_id),o=Yc(r.target);oA(r.method,r.params);let i=iA(r.method,r.params);await t.security.ensureFullCdpAllowed(n);for(let a of i)await t.security.ensureDestinationUrlAllowed(a);return await t.cdp.callRawCdp(n,r.method,r.params,{target:o,timeoutMs:r.timeout_ms??3e3})??{}});var lA=y(Ut.Events,async(e,t)=>{if(await t.assertFullCdpAccessEnabled(),!ai(t.clientInfo.type))throw new Error("Full CDP access is currently only available for Chrome and in-app browser tabs.");let r=Ut.Events.PayloadSchema.parse(e),n=A(r.tab_id);return await t.security.ensureFullCdpAllowed(n),await t.cdp.readRawCdpEvents(n,{afterSequence:r.after_sequence,limit:r.limit,methods:r.methods,target:Yc(r.target),timeoutMs:r.timeout_ms})});import{randomUUID as yj}from"node:crypto";import{mkdir as _j,writeFile as wj}from"node:fs/promises";import{tmpdir as xj}from"node:os";import{join as cA}from"node:path";var dA="tab_content_export_gsuite",Sj={document:new Set(["pdf","md","docx"]),spreadsheets:new Set(["pdf","xlsx","csv"]),presentation:new Set(["pdf","pptx"])},vj=new Set(["pdf","md","xlsx","csv","docx","pptx"]);async function Ej({exportUrl:e}){let t=await fetch(e,{method:"GET"});if(!t.ok)throw new Error("GSuite export request failed with HTTP "+t.status);let r=new Uint8Array(await t.arrayBuffer()),n=32768,o="";for(let i=0;i<r.length;i+=n){let s=r.subarray(i,i+n);o+=String.fromCharCode(...s)}return{base64:btoa(o)}}function Cj(e){return`(${Ej.toString()})(${JSON.stringify(e)})`}var Tj=async({tabId:e,exportUrl:t,cdp:r})=>{let n=await r.evaluateJavascript(e,Cj({exportUrl:t}),{awaitPromise:!0});if(n?.base64==null)throw new Error("Unable to export GSuite content for this tab");return n};function Aj(e){return e.replace(/^\s*\[[^\]]+\]:\s*<data:[^>]+>\s*\n?/gm,"").trim()}var pA=y(dA,async(e,t)=>{let r=A(e.tab_id),n=kj(e.format),o=await t.tabs.get(r),i=Ij(o.url);if(i==null)throw new Error("Tab is not a Google Workspace document");if(!Sj[i.docType].has(n))throw new Error("GSuite export type is not supported for this tab");let s=Dj(i,n);if(s==null)throw new Error("Unable to export GSuite content for this tab");let a=await Tj({exportUrl:s,tabId:r,cdp:t.cdp}),u=await Oj(o.title,n),l=Nj(a,n);if(l.length===0)throw new Error("Unable to export GSuite content for this tab");try{await wj(u,l)}catch(d){throw new Error("Unable to write exported content to disk",{cause:d})}return{path:u}});function kj(e){if(typeof e!="string"||!vj.has(e))throw new Error(`${dA} requires supported format`);return e}function Ij(e){if(e==null)return null;let t;try{t=new URL(e)}catch{return null}if(t.host!=="docs.google.com")return null;let r=t.pathname.split("/").filter(Boolean);if(r.length<3)return null;let n=r[0];if(!Pj(n))return null;let o=Rj(r);return o==null||r.at(-1)==="pub"?null:{docId:o,docType:n,url:t}}function Rj(e){let t=e.indexOf("d",1);if(!(t<0))return e[t+1]}function Pj(e){return e==="document"||e==="spreadsheets"||e==="presentation"}function Dj(e,t){if(e.docId==null||e.docId.length===0)return null;let r=new URL(`https://docs.google.com/${e.docType}/d/${e.docId}/export`);r.searchParams.set("format",t);let n=e.url.searchParams.get("tab");return n!=null&&r.searchParams.append("tab",n),r.hash=e.url.hash,r.toString()}function Nj(e,t){let r=Buffer.from(e.base64,"base64");return t==="md"?Buffer.from(Aj(r.toString("utf8")),"utf8"):r}async function Oj(e,t){let r=cA(xj(),"browser-use","exports");return await _j(r,{recursive:!0}),cA(r,`${Fj(Mj(e))}-${yj()}.${t}`)}function Mj(e){if(e==null)return"Asset";let t=e.split(" - "),r=t.at(-1);return t.length>1&&r?.startsWith("Google")===!0?t.slice(0,-1).join(" - "):e}function Fj(e,t="_"){let r=e.replaceAll(/[/\\?%*|"<>:]/g,t).trim();return r.length===0?"ExportedContent":r}var fA=y("tab_dev_logs",async(e,t)=>{let r=A(e.tab_id);return{logs:(await t.dev.logs({tabId:r,filter:e.filter,levels:e.levels,limit:e.limit})).map(({level:o,message:i,timestamp:s,url:a})=>({level:o,message:i,timestamp:s,...a==null?{}:{url:a}}))}});async function mA(e,t){try{let n=(await t.cdp.call(e,"Runtime.evaluate",{expression:"window.devicePixelRatio",returnByValue:!0},{telemetryAttrs:{"browser_use.cdp.eval.kind":"device_pixel_ratio"}}))?.result?.value;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return 1/n}catch{}return 1}var hA="jpeg";var gA=y("tab_screenshot",async(e,t)=>{let r=A(e.tab_id),n={format:hA,quality:80},o=Lj(e),i=await mA(r,t);if(o!=null)n.captureBeyondViewport=!0,n.clip={...o,scale:i};else if(e.fullPage===!0){let u=(await t.cdp.call(r,"Page.getLayoutMetrics")).cssContentSize;if(u?.width==null||u.height==null||u.width<=0||u.height<=0)throw new Error("Page.getLayoutMetrics returned no valid cssContentSize for full-page screenshot.");n.captureBeyondViewport=!0,n.clip={x:u.x??0,y:u.y??0,width:u.width,height:u.height,scale:i}}else{let{cssVisualViewport:a}=await t.cdp.call(r,"Page.getLayoutMetrics");n.clip={x:a.pageX,y:a.pageY,width:a.clientWidth,height:a.clientHeight,scale:i}}let s=await t.cdp.call(r,"Page.captureScreenshot",n);if(typeof s.data!="string"||!s.data)throw new Error(`Page.captureScreenshot returned no data for tab ${r}.`);return{data:s.data}});function Lj(e){if(!(e.cropX==null||e.cropY==null||e.cropWidth==null||e.cropHeight==null)){if(e.cropWidth<=0||e.cropHeight<=0)throw new Error("tab_screenshot crop width and height must be positive");return{x:e.cropX,y:e.cropY,width:e.cropWidth,height:e.cropHeight,scale:1}}}var Uj=8,jj=2e3,qj=200,$j=2e5,zj=20,Wj="browser-use-readonly-js",Hj=/\bimport\b(?:(?:\s+)|(?:\/\/[^\n\r]*(?:\r?\n|$))|(?:\/\*[\s\S]*?\*\/))*\(/,ui=new Map,_A=y(oe.PlaywrightEvaluate,async(e,t)=>{let r=A(e.tab_id),n=se(e),o=Gj(e.script),i=await t.cdp.call(r,"Page.getFrameTree",void 0,{telemetryAttrs:{"browser_use.cdp.eval.kind":"readonly_js_frame_tree"},timeoutMs:n}),s=Jj(i),a=await bA(t,r,s,n),u;try{u=await yA(t,r,a.executionContextId,o,n)}catch(l){if(!Vj(l))throw l;ui.delete(wA(r,s)),a=await bA(t,r,s,n),u=await yA(t,r,a.executionContextId,o,n)}return{value:Yj(u)}});async function bA(e,t,r,n){let o=wA(t,r),i=ui.get(o);if(i!=null)return i;let a={executionContextId:(await e.cdp.call(t,"Page.createIsolatedWorld",{frameId:r,grantUniveralAccess:!1,worldName:Wj},{telemetryAttrs:{"browser_use.cdp.eval.kind":"readonly_js_world"},timeoutMs:n})).executionContextId,frameId:r};if(ui.set(o,a),ui.size>zj){let u=ui.keys().next().value;u!=null&&ui.delete(u)}return a}async function yA(e,t,r,n,o){return await e.cdp.call(t,"Runtime.evaluate",{awaitPromise:!0,contextId:r,expression:n,returnByValue:!0,timeout:o},{telemetryAttrs:{"browser_use.cdp.eval.kind":"readonly_live_dom"},timeoutMs:o})}function wA(e,t){return`${e}:${t}`}function Vj(e){let t=e instanceof Error?e.message:String(e);return/Cannot find context|Execution context was destroyed|context.*destroyed|context.*not found/i.test(t)}function Gj(e){return Kj(e),`(() => {
  const RESULT_MAX_DEPTH = ${Uj};
  const RESULT_MAX_ARRAY_LENGTH = ${jj};
  const RESULT_MAX_OBJECT_KEYS = ${qj};
  const RESULT_MAX_STRING_LENGTH = ${$j};
  const ELEMENT_NODE = 1;
  const TEXT_NODE = 3;
  const COMMENT_NODE = 8;
  const DOCUMENT_NODE = 9;
  const DOCUMENT_TYPE_NODE = 10;
  const DOCUMENT_FRAGMENT_NODE = 11;
  const rawWindow = globalThis;
  const rawDocument = rawWindow.document;
  const wrapperToken = {};
  const nodeWrappers = new WeakMap();
  const rawNodesByWrapper = new WeakMap();
  const styleWrappers = new WeakSet();
  const mediaListWrappers = new WeakMap();
  const cssRuleWrappers = new WeakMap();
  const styleSheetWrappers = new WeakMap();
  const cssWrappers = new WeakSet();
  const rangeWrappers = new WeakMap();
  const rawRangesByWrapper = new WeakMap();
  const selectionWrappers = new WeakMap();
  const selectionAndRangeWrappers = new WeakSet();
  const fontFaceSetWrappers = new WeakMap();
  const mediaQueryListWrappers = new WeakMap();
  const readonlyApiWrappers = new WeakSet();

  // Define fixed data properties so sandbox bindings cannot be replaced,
  // deleted, or reconfigured by the evaluated script.
  const defineReadonly = (target, name, value) => {
    Object.defineProperty(target, name, {
      configurable: false,
      enumerable: true,
      value,
      writable: false,
    });
  };

  const defineHiddenReadonly = (target, name, value) => {
    Object.defineProperty(target, name, {
      configurable: false,
      enumerable: false,
      value,
      writable: false,
    });
  };

  const defineReadonlyGetter = (target, name, get) => {
    Object.defineProperty(target, name, {
      configurable: false,
      enumerable: true,
      get,
    });
  };

  const readonlyError = (name) =>
    new Error(
      name +
        " is not available in playwright.evaluate because the DOM is read-only",
    );

  const camelToHyphen = (value) =>
    String(value).replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());

  const ownKeys = (value) => Object.keys(value).slice(0, RESULT_MAX_OBJECT_KEYS);

  const makeReadonlyList = (items, configure) => {
    const list = Array.from(items);
    defineHiddenReadonly(list, "constructor", undefined);
    defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
    if (typeof configure === "function") configure(list);
    return Object.freeze(list);
  };

  const makeReadonlyAttribute = (attribute) =>
    Object.freeze({
      name: attribute.name,
      nodeName: attribute.name,
      nodeValue: attribute.value,
      specified: true,
      value: attribute.value,
    });

  const makeReadonlyAttributeList = (attributes) => {
    const list = Array.from(attributes, makeReadonlyAttribute);
    defineHiddenReadonly(list, "constructor", undefined);
    defineHiddenReadonly(list, "getNamedItem", (name) => {
      const attribute = attributes.getNamedItem(String(name));
      return attribute == null ? null : makeReadonlyAttribute(attribute);
    });
    defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
    return Object.freeze(list);
  };

  const makeReadonlyTokenList = (tokenList) => {
    if (tokenList == null) return undefined;
    const list = Array.from(tokenList, String);
    defineHiddenReadonly(list, "constructor", undefined);
    defineHiddenReadonly(list, "contains", (value) =>
      tokenList.contains(String(value)),
    );
    defineHiddenReadonly(list, "item", (index) => tokenList.item(index));
    defineHiddenReadonly(list, "value", tokenList.value);
    return Object.freeze(list);
  };

  const makeReadonlyTimeRanges = (ranges) => {
    if (ranges == null) return undefined;
    const list = [];
    for (let index = 0; index < ranges.length; index += 1) {
      list.push(Object.freeze({
        end: ranges.end(index),
        start: ranges.start(index),
      }));
    }
    defineHiddenReadonly(list, "constructor", undefined);
    defineHiddenReadonly(list, "end", (index) => ranges.end(Number(index)));
    defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
    defineHiddenReadonly(list, "start", (index) => ranges.start(Number(index)));
    return Object.freeze(list);
  };

  const makeReadonlyTrackList = (tracks) => {
    if (tracks == null) return undefined;
    const list = Array.from(tracks, (track) =>
      Object.freeze({
        enabled: track.enabled === true,
        id: typeof track.id === "string" ? track.id : "",
        kind: typeof track.kind === "string" ? track.kind : "",
        label: typeof track.label === "string" ? track.label : "",
        language: typeof track.language === "string" ? track.language : "",
        mode: typeof track.mode === "string" ? track.mode : undefined,
        selected: track.selected === true,
      }),
    );
    defineHiddenReadonly(list, "constructor", undefined);
    defineHiddenReadonly(list, "getTrackById", (id) =>
      list.find((track) => track.id === String(id)) ?? null,
    );
    defineHiddenReadonly(list, "item", (index) => list[index] ?? null);
    return Object.freeze(list);
  };

  const makeReadonlyDataset = (dataset) => {
    const output = Object.create(null);
    for (const key of Object.keys(dataset)) {
      defineReadonly(output, key, dataset[key]);
    }
    defineHiddenReadonly(output, "constructor", undefined);
    return Object.freeze(output);
  };

  const makeReadonlyRect = (rect) =>
    Object.freeze({
      bottom: rect.bottom,
      height: rect.height,
      left: rect.left,
      right: rect.right,
      top: rect.top,
      width: rect.width,
      x: rect.x,
      y: rect.y,
      toJSON() {
        return {
          bottom: rect.bottom,
          height: rect.height,
          left: rect.left,
          right: rect.right,
          top: rect.top,
          width: rect.width,
          x: rect.x,
          y: rect.y,
        };
      },
    });

  const makeReadonlyValidityState = (validity) => {
    if (validity == null) return undefined;
    return Object.freeze({
      badInput: validity.badInput === true,
      customError: validity.customError === true,
      patternMismatch: validity.patternMismatch === true,
      rangeOverflow: validity.rangeOverflow === true,
      rangeUnderflow: validity.rangeUnderflow === true,
      stepMismatch: validity.stepMismatch === true,
      tooLong: validity.tooLong === true,
      tooShort: validity.tooShort === true,
      typeMismatch: validity.typeMismatch === true,
      valid: validity.valid === true,
      valueMissing: validity.valueMissing === true,
    });
  };

  const makeNodeSummary = (node) => {
    const wrapper = wrapNode(node);
    return wrapper == null ? null : wrapper.toJSON();
  };

  class ReadonlyStyleDeclaration {
    #style;

    constructor(style, token) {
      if (token !== wrapperToken) throw readonlyError("CSSStyleDeclaration constructor");
      this.#style = style;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get length() {
      return this.#style.length;
    }

    get cssText() {
      return this.#style.cssText ?? "";
    }

    getPropertyValue(name) {
      return this.#style.getPropertyValue(String(name));
    }

    getPropertyPriority(name) {
      return this.#style.getPropertyPriority(String(name));
    }

    item(index) {
      return this.#style.item(Number(index)) ?? "";
    }

    *[Symbol.iterator]() {
      for (let index = 0; index < this.#style.length; index += 1) {
        yield this.item(index);
      }
    }

    toJSON() {
      const output = {};
      const length = Math.min(this.#style.length, RESULT_MAX_OBJECT_KEYS);
      for (let index = 0; index < length; index += 1) {
        const name = this.#style.item(index);
        output[name] = this.#style.getPropertyValue(name);
      }
      return output;
    }
  }

  const wrapStyle = (style) => {
    const wrapper = new Proxy(new ReadonlyStyleDeclaration(style, wrapperToken), {
      get(target, property, receiver) {
        if (property === Symbol.toStringTag) return "CSSStyleDeclaration";
        if (property === Symbol.iterator)
          return target[Symbol.iterator].bind(target);
        if (typeof property === "string") {
          if (/^\\d+$/.test(property)) return target.item(Number(property));
          if (property in target) {
            const value = Reflect.get(target, property, target);
            return typeof value === "function" ? value.bind(target) : value;
          }
          if (typeof style[property] === "function") return undefined;
          return (
            target.getPropertyValue(camelToHyphen(property)) ||
            target.getPropertyValue(property)
          );
        }
        return Reflect.get(target, property, receiver);
      },
      set() {
        throw readonlyError("CSSStyleDeclaration assignment");
      },
    });
    styleWrappers.add(wrapper);
    return wrapper;
  };

  // CSSOM wrappers expose stylesheet and rule reads without exposing mutation
  // methods like insertRule(), deleteRule(), replace(), or setProperty().
  // Inaccessible cssRules keep native browser behavior when read directly; the
  // serializer records that state without trying a network fallback.
  class ReadonlyMediaList {
    #media;

    constructor(media, token) {
      if (token !== wrapperToken) throw readonlyError("MediaList constructor");
      this.#media = media;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get length() {
      return this.#media.length;
    }

    get mediaText() {
      return this.#media.mediaText;
    }

    item(index) {
      return this.#media.item(Number(index)) ?? "";
    }

    *[Symbol.iterator]() {
      for (let index = 0; index < this.#media.length; index += 1) {
        yield this.item(index);
      }
    }

    toJSON() {
      return Array.from(this);
    }
  }

  const wrapMediaList = (media) => {
    if (media == null) return null;
    const existing = mediaListWrappers.get(media);
    if (existing != null) return existing;
    const wrapper = new ReadonlyMediaList(media, wrapperToken);
    mediaListWrappers.set(media, wrapper);
    cssWrappers.add(wrapper);
    return wrapper;
  };

  class ReadonlyCSSRule {
    #rule;

    constructor(rule, token) {
      if (token !== wrapperToken) throw readonlyError("CSSRule constructor");
      this.#rule = rule;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get conditionText() {
      return typeof this.#rule.conditionText === "string"
        ? this.#rule.conditionText
        : undefined;
    }

    get cssRules() {
      if (!("cssRules" in this.#rule)) return undefined;
      return makeReadonlyList(Array.from(this.#rule.cssRules, wrapCSSRule));
    }

    get cssText() {
      return this.#rule.cssText;
    }

    get href() {
      return typeof this.#rule.href === "string" ? this.#rule.href : undefined;
    }

    get keyText() {
      return typeof this.#rule.keyText === "string" ? this.#rule.keyText : undefined;
    }

    get media() {
      return "media" in this.#rule ? wrapMediaList(this.#rule.media) : undefined;
    }

    get name() {
      return typeof this.#rule.name === "string" ? this.#rule.name : undefined;
    }

    get parentRule() {
      return wrapCSSRule(this.#rule.parentRule);
    }

    get parentStyleSheet() {
      return wrapCSSStyleSheet(this.#rule.parentStyleSheet);
    }

    get selectorText() {
      return typeof this.#rule.selectorText === "string"
        ? this.#rule.selectorText
        : undefined;
    }

    get style() {
      return this.#rule.style == null ? undefined : wrapStyle(this.#rule.style);
    }

    get styleSheet() {
      return wrapCSSStyleSheet(this.#rule.styleSheet);
    }

    get type() {
      return this.#rule.type;
    }

    toJSON() {
      const output = {
        cssText: this.cssText,
        type: this.type,
      };
      for (const name of [
        "conditionText",
        "href",
        "keyText",
        "name",
        "selectorText",
      ]) {
        const value = this[name];
        if (value !== undefined) output[name] = value;
      }
      if (this.style !== undefined) output.style = this.style.toJSON();
      return output;
    }
  }

  const wrapCSSRule = (rule) => {
    if (rule == null) return null;
    const existing = cssRuleWrappers.get(rule);
    if (existing != null) return existing;
    const wrapper = new ReadonlyCSSRule(rule, wrapperToken);
    cssRuleWrappers.set(rule, wrapper);
    cssWrappers.add(wrapper);
    return wrapper;
  };

  class ReadonlyCSSStyleSheet {
    #sheet;

    constructor(sheet, token) {
      if (token !== wrapperToken) throw readonlyError("CSSStyleSheet constructor");
      this.#sheet = sheet;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get cssRules() {
      return makeReadonlyList(Array.from(this.#sheet.cssRules, wrapCSSRule));
    }

    get disabled() {
      return this.#sheet.disabled === true;
    }

    get href() {
      return this.#sheet.href;
    }

    get media() {
      return wrapMediaList(this.#sheet.media);
    }

    get ownerNode() {
      return wrapNode(this.#sheet.ownerNode);
    }

    get ownerRule() {
      return wrapCSSRule(this.#sheet.ownerRule);
    }

    get parentStyleSheet() {
      return wrapCSSStyleSheet(this.#sheet.parentStyleSheet);
    }

    get rules() {
      return this.cssRules;
    }

    get title() {
      return this.#sheet.title;
    }

    get type() {
      return this.#sheet.type;
    }

    toJSON() {
      const output = {
        disabled: this.disabled,
        href: this.href,
        media: this.media?.toJSON() ?? null,
        title: this.title,
        type: this.type,
      };
      try {
        output.ruleCount = this.cssRules.length;
      } catch (error) {
        output.ruleAccessError =
          error instanceof Error ? error.name || error.message : String(error);
      }
      return output;
    }
  }

  const wrapCSSStyleSheet = (sheet) => {
    if (sheet == null) return null;
    const existing = styleSheetWrappers.get(sheet);
    if (existing != null) return existing;
    const wrapper = new ReadonlyCSSStyleSheet(sheet, wrapperToken);
    styleSheetWrappers.set(sheet, wrapper);
    cssWrappers.add(wrapper);
    return wrapper;
  };

  const unwrapRange = (value) =>
    value != null && (typeof value === "object" || typeof value === "function")
      ? rawRangesByWrapper.get(value) ?? null
      : null;

  class ReadonlyRange {
    #range;

    constructor(range, token) {
      if (token !== wrapperToken) throw readonlyError("Range constructor");
      this.#range = range;
      rawRangesByWrapper.set(this, range);
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get collapsed() {
      return this.#range.collapsed === true;
    }

    get commonAncestorContainer() {
      return wrapNode(this.#range.commonAncestorContainer);
    }

    get endContainer() {
      return wrapNode(this.#range.endContainer);
    }

    get endOffset() {
      return this.#range.endOffset;
    }

    get startContainer() {
      return wrapNode(this.#range.startContainer);
    }

    get startOffset() {
      return this.#range.startOffset;
    }

    compareBoundaryPoints(how, sourceRange) {
      const rawRange = unwrapRange(sourceRange);
      if (rawRange == null) throw new TypeError("compareBoundaryPoints expects a Range");
      return this.#range.compareBoundaryPoints(Number(how), rawRange);
    }

    comparePoint(node, offset) {
      const rawNode = unwrapNode(node);
      if (rawNode == null) throw new TypeError("comparePoint expects a Node");
      return this.#range.comparePoint(rawNode, Number(offset));
    }

    getBoundingClientRect() {
      return makeReadonlyRect(this.#range.getBoundingClientRect());
    }

    getClientRects() {
      return makeReadonlyList(
        Array.from(this.#range.getClientRects(), makeReadonlyRect),
      );
    }

    intersectsNode(node) {
      const rawNode = unwrapNode(node);
      return rawNode != null && this.#range.intersectsNode(rawNode);
    }

    isPointInRange(node, offset) {
      const rawNode = unwrapNode(node);
      return rawNode != null && this.#range.isPointInRange(rawNode, Number(offset));
    }

    toJSON() {
      return {
        collapsed: this.collapsed,
        commonAncestorContainer: makeNodeSummary(this.#range.commonAncestorContainer),
        endOffset: this.endOffset,
        startOffset: this.startOffset,
        text: this.toString(),
      };
    }

    toString() {
      return this.#range.toString();
    }
  }

  const wrapRange = (range) => {
    if (range == null) return null;
    const existing = rangeWrappers.get(range);
    if (existing != null) return existing;
    const wrapper = new ReadonlyRange(range, wrapperToken);
    rangeWrappers.set(range, wrapper);
    selectionAndRangeWrappers.add(wrapper);
    return wrapper;
  };

  class ReadonlySelection {
    #selection;

    constructor(selection, token) {
      if (token !== wrapperToken) throw readonlyError("Selection constructor");
      this.#selection = selection;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get anchorNode() {
      return wrapNode(this.#selection.anchorNode);
    }

    get anchorOffset() {
      return this.#selection.anchorOffset;
    }

    get focusNode() {
      return wrapNode(this.#selection.focusNode);
    }

    get focusOffset() {
      return this.#selection.focusOffset;
    }

    get isCollapsed() {
      return this.#selection.isCollapsed === true;
    }

    get rangeCount() {
      return this.#selection.rangeCount;
    }

    get type() {
      return this.#selection.type;
    }

    containsNode(node, allowPartialContainment = false) {
      const rawNode = unwrapNode(node);
      return (
        rawNode != null &&
        this.#selection.containsNode(rawNode, Boolean(allowPartialContainment))
      );
    }

    getRangeAt(index) {
      return wrapRange(this.#selection.getRangeAt(Number(index)));
    }

    toJSON() {
      return {
        anchorNode: makeNodeSummary(this.#selection.anchorNode),
        anchorOffset: this.anchorOffset,
        focusNode: makeNodeSummary(this.#selection.focusNode),
        focusOffset: this.focusOffset,
        isCollapsed: this.isCollapsed,
        rangeCount: this.rangeCount,
        text: this.toString(),
        type: this.type,
      };
    }

    toString() {
      return this.#selection.toString();
    }
  }

  const wrapSelection = (selection) => {
    if (selection == null) return null;
    const existing = selectionWrappers.get(selection);
    if (existing != null) return existing;
    const wrapper = new ReadonlySelection(selection, wrapperToken);
    selectionWrappers.set(selection, wrapper);
    selectionAndRangeWrappers.add(wrapper);
    return wrapper;
  };

  class ReadonlyFontFaceSet {
    #fonts;

    constructor(fonts, token) {
      if (token !== wrapperToken) throw readonlyError("FontFaceSet constructor");
      this.#fonts = fonts;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get size() {
      return this.#fonts.size;
    }

    get status() {
      return this.#fonts.status;
    }

    check(font, text) {
      return this.#fonts.check(
        String(font),
        text === undefined ? undefined : String(text),
      );
    }

    toJSON() {
      return {
        size: this.size,
        status: this.status,
      };
    }
  }

  const wrapFontFaceSet = (fonts) => {
    if (fonts == null) return undefined;
    const existing = fontFaceSetWrappers.get(fonts);
    if (existing != null) return existing;
    const wrapper = new ReadonlyFontFaceSet(fonts, wrapperToken);
    fontFaceSetWrappers.set(fonts, wrapper);
    readonlyApiWrappers.add(wrapper);
    return wrapper;
  };

  class ReadonlyMediaQueryList {
    #query;

    constructor(query, token) {
      if (token !== wrapperToken) throw readonlyError("MediaQueryList constructor");
      this.#query = query;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get matches() {
      return this.#query.matches === true;
    }

    get media() {
      return this.#query.media;
    }

    toJSON() {
      return {
        matches: this.matches,
        media: this.media,
      };
    }
  }

  const wrapMediaQueryList = (query) => {
    if (query == null) return null;
    const existing = mediaQueryListWrappers.get(query);
    if (existing != null) return existing;
    const wrapper = new ReadonlyMediaQueryList(query, wrapperToken);
    mediaQueryListWrappers.set(query, wrapper);
    readonlyApiWrappers.add(wrapper);
    return wrapper;
  };

  class ReadonlyVisualViewport {
    #viewport;

    constructor(viewport, token) {
      if (token !== wrapperToken) throw readonlyError("VisualViewport constructor");
      this.#viewport = viewport;
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get height() {
      return this.#viewport.height;
    }

    get offsetLeft() {
      return this.#viewport.offsetLeft;
    }

    get offsetTop() {
      return this.#viewport.offsetTop;
    }

    get pageLeft() {
      return this.#viewport.pageLeft;
    }

    get pageTop() {
      return this.#viewport.pageTop;
    }

    get scale() {
      return this.#viewport.scale;
    }

    get width() {
      return this.#viewport.width;
    }

    toJSON() {
      return {
        height: this.height,
        offsetLeft: this.offsetLeft,
        offsetTop: this.offsetTop,
        pageLeft: this.pageLeft,
        pageTop: this.pageTop,
        scale: this.scale,
        width: this.width,
      };
    }
  }

  const wrapVisualViewport = (viewport) => {
    if (viewport == null) return null;
    const wrapper = new ReadonlyVisualViewport(viewport, wrapperToken);
    readonlyApiWrappers.add(wrapper);
    return wrapper;
  };

  class ReadonlyLocation {
    constructor() {
      defineHiddenReadonly(this, "constructor", undefined);
      Object.freeze(this);
    }

    get hash() {
      return rawWindow.location.hash;
    }

    get host() {
      return rawWindow.location.host;
    }

    get hostname() {
      return rawWindow.location.hostname;
    }

    get href() {
      return rawWindow.location.href;
    }

    get origin() {
      return rawWindow.location.origin;
    }

    get pathname() {
      return rawWindow.location.pathname;
    }

    get port() {
      return rawWindow.location.port;
    }

    get protocol() {
      return rawWindow.location.protocol;
    }

    get search() {
      return rawWindow.location.search;
    }

    toJSON() {
      return this.href;
    }

    toString() {
      return this.href;
    }
  }

  class ReadonlyNode {
    #node;

    constructor(node, token) {
      if (token !== wrapperToken) throw readonlyError("Node constructor");
      this.#node = node;
      rawNodesByWrapper.set(this, node);
      defineHiddenReadonly(this, "constructor", undefined);
      if (new.target === ReadonlyNode) Object.freeze(this);
    }

    get childNodes() {
      return makeReadonlyNodeList(this.#node.childNodes);
    }

    get firstChild() {
      return wrapNode(this.#node.firstChild);
    }

    get lastChild() {
      return wrapNode(this.#node.lastChild);
    }

    get nextSibling() {
      return wrapNode(this.#node.nextSibling);
    }

    get nodeName() {
      return this.#node.nodeName;
    }

    get name() {
      return typeof this.#node.name === "string" ? this.#node.name : undefined;
    }

    get nodeType() {
      return this.#node.nodeType;
    }

    get nodeValue() {
      return this.#node.nodeValue;
    }

    get publicId() {
      return typeof this.#node.publicId === "string" ? this.#node.publicId : undefined;
    }

    get systemId() {
      return typeof this.#node.systemId === "string" ? this.#node.systemId : undefined;
    }

    get isConnected() {
      return this.#node.isConnected === true;
    }

    get ownerDocument() {
      return wrapNode(this.#node.ownerDocument ?? rawDocument);
    }

    get parentElement() {
      return wrapNode(this.#node.parentElement);
    }

    get parentNode() {
      return wrapNode(this.#node.parentNode);
    }

    get previousSibling() {
      return wrapNode(this.#node.previousSibling);
    }

    get textContent() {
      return this.#node.textContent;
    }

    contains(node) {
      const rawNode = unwrapNode(node);
      return rawNode != null && this.#node.contains(rawNode);
    }

    getRootNode(options) {
      return wrapNode(
        typeof this.#node.getRootNode === "function"
          ? this.#node.getRootNode(options)
          : (this.#node.ownerDocument ?? rawDocument),
      );
    }

    toJSON() {
      return {
        name: this.name,
        nodeName: this.nodeName,
        nodeType: this.nodeType,
        publicId: this.publicId,
        systemId: this.systemId,
        textContent: this.textContent,
      };
    }
  }

  class ReadonlyElement extends ReadonlyNode {
    #element;

    constructor(element, token) {
      super(element, token);
      this.#element = element;
      Object.freeze(this);
    }

    get attributes() {
      return makeReadonlyAttributeList(this.#element.attributes);
    }

    get alt() {
      return typeof this.#element.alt === "string" ? this.#element.alt : "";
    }

    get ariaChecked() {
      return typeof this.#element.ariaChecked === "string"
        ? this.#element.ariaChecked
        : null;
    }

    get ariaControls() {
      return typeof this.#element.ariaControls === "string"
        ? this.#element.ariaControls
        : null;
    }

    get ariaCurrent() {
      return typeof this.#element.ariaCurrent === "string"
        ? this.#element.ariaCurrent
        : null;
    }

    get ariaDescribedBy() {
      return typeof this.#element.ariaDescribedBy === "string"
        ? this.#element.ariaDescribedBy
        : null;
    }

    get ariaDescription() {
      return typeof this.#element.ariaDescription === "string"
        ? this.#element.ariaDescription
        : null;
    }

    get ariaDisabled() {
      return typeof this.#element.ariaDisabled === "string"
        ? this.#element.ariaDisabled
        : null;
    }

    get ariaExpanded() {
      return typeof this.#element.ariaExpanded === "string"
        ? this.#element.ariaExpanded
        : null;
    }

    get ariaHasPopup() {
      return typeof this.#element.ariaHasPopup === "string"
        ? this.#element.ariaHasPopup
        : null;
    }

    get ariaHidden() {
      return typeof this.#element.ariaHidden === "string"
        ? this.#element.ariaHidden
        : null;
    }

    get ariaInvalid() {
      return typeof this.#element.ariaInvalid === "string"
        ? this.#element.ariaInvalid
        : null;
    }

    get action() {
      return typeof this.#element.action === "string" ? this.#element.action : "";
    }

    get allow() {
      return typeof this.#element.allow === "string" ? this.#element.allow : "";
    }

    get ariaLabel() {
      return typeof this.#element.ariaLabel === "string"
        ? this.#element.ariaLabel
        : null;
    }

    get ariaLabelledBy() {
      return typeof this.#element.ariaLabelledBy === "string"
        ? this.#element.ariaLabelledBy
        : null;
    }

    get ariaPressed() {
      return typeof this.#element.ariaPressed === "string"
        ? this.#element.ariaPressed
        : null;
    }

    get ariaSelected() {
      return typeof this.#element.ariaSelected === "string"
        ? this.#element.ariaSelected
        : null;
    }

    get ariaSort() {
      return typeof this.#element.ariaSort === "string"
        ? this.#element.ariaSort
        : null;
    }

    get ariaValueMax() {
      return typeof this.#element.ariaValueMax === "string"
        ? this.#element.ariaValueMax
        : null;
    }

    get ariaValueMin() {
      return typeof this.#element.ariaValueMin === "string"
        ? this.#element.ariaValueMin
        : null;
    }

    get ariaValueNow() {
      return typeof this.#element.ariaValueNow === "string"
        ? this.#element.ariaValueNow
        : null;
    }

    get ariaValueText() {
      return typeof this.#element.ariaValueText === "string"
        ? this.#element.ariaValueText
        : null;
    }

    get as() {
      return typeof this.#element.as === "string" ? this.#element.as : "";
    }

    get assignedElements() {
      if (typeof this.#element.assignedElements !== "function") return undefined;
      return (options = {}) =>
        makeReadonlyList(
          Array.from(
            this.#element.assignedElements({ flatten: options.flatten === true }),
            wrapNode,
          ),
        );
    }

    get assignedNodes() {
      if (typeof this.#element.assignedNodes !== "function") return undefined;
      return (options = {}) =>
        makeReadonlyList(
          Array.from(
            this.#element.assignedNodes({ flatten: options.flatten === true }),
            wrapNode,
          ),
        );
    }

    get assignedSlot() {
      return wrapNode(this.#element.assignedSlot);
    }

    get async() {
      return this.#element.async === true;
    }

    get autoplay() {
      return this.#element.autoplay === true;
    }

    get autocomplete() {
      return typeof this.#element.autocomplete === "string"
        ? this.#element.autocomplete
        : "";
    }

    get buffered() {
      return makeReadonlyTimeRanges(this.#element.buffered);
    }

    get checked() {
      return this.#element.checked === true;
    }

    get children() {
      return makeReadonlyNodeList(this.#element.children);
    }

    get caption() {
      return wrapNode(this.#element.caption);
    }

    get cellIndex() {
      return this.#element.cellIndex ?? -1;
    }

    get cells() {
      return makeReadonlyNodeList(this.#element.cells);
    }

    get clientHeight() {
      return this.#element.clientHeight ?? 0;
    }

    get clientLeft() {
      return this.#element.clientLeft ?? 0;
    }

    get clientTop() {
      return this.#element.clientTop ?? 0;
    }

    get clientWidth() {
      return this.#element.clientWidth ?? 0;
    }

    get classList() {
      return makeReadonlyTokenList(this.#element.classList);
    }

    get className() {
      const className = this.#element.className;
      if (typeof className === "string") return className;
      if (typeof className?.baseVal === "string") return className.baseVal;
      return "";
    }

    get colSpan() {
      return this.#element.colSpan ?? 1;
    }

    get content() {
      const content = this.#element.content;
      if (content === undefined) return undefined;
      return content != null && typeof content === "object" && "nodeType" in content
        ? wrapNode(content)
        : content;
    }

    get controls() {
      return this.#element.controls === true;
    }

    get crossOrigin() {
      return typeof this.#element.crossOrigin === "string"
        ? this.#element.crossOrigin
        : null;
    }

    get currentTime() {
      return this.#element.currentTime ?? 0;
    }

    get dataset() {
      return makeReadonlyDataset(this.#element.dataset);
    }

    get decoding() {
      return typeof this.#element.decoding === "string"
        ? this.#element.decoding
        : "";
    }

    get defaultSelected() {
      return this.#element.defaultSelected === true;
    }

    get defaultValue() {
      return typeof this.#element.defaultValue === "string"
        ? this.#element.defaultValue
        : "";
    }

    get defer() {
      return this.#element.defer === true;
    }

    get defaultMuted() {
      return this.#element.defaultMuted === true;
    }

    get defaultPlaybackRate() {
      return this.#element.defaultPlaybackRate ?? 1;
    }

    get disabled() {
      return this.#element.disabled === true;
    }

    get dir() {
      return typeof this.#element.dir === "string" ? this.#element.dir : "";
    }

    get download() {
      return typeof this.#element.download === "string"
        ? this.#element.download
        : "";
    }

    get complete() {
      return this.#element.complete === true;
    }

    get currentSrc() {
      return typeof this.#element.currentSrc === "string" ? this.#element.currentSrc : "";
    }

    get duration() {
      return this.#element.duration ?? 0;
    }

    get elements() {
      return makeReadonlyNodeList(this.#element.elements);
    }

    get ended() {
      return this.#element.ended === true;
    }

    get enctype() {
      return typeof this.#element.enctype === "string"
        ? this.#element.enctype
        : "";
    }

    get exportparts() {
      return typeof this.#element.exportparts === "string"
        ? this.#element.exportparts
        : "";
    }

    get firstElementChild() {
      return wrapNode(this.#element.firstElementChild);
    }

    get form() {
      return wrapNode(this.#element.form);
    }

    get formAction() {
      return typeof this.#element.formAction === "string"
        ? this.#element.formAction
        : "";
    }

    get formEnctype() {
      return typeof this.#element.formEnctype === "string"
        ? this.#element.formEnctype
        : "";
    }

    get formMethod() {
      return typeof this.#element.formMethod === "string"
        ? this.#element.formMethod
        : "";
    }

    get formNoValidate() {
      return this.#element.formNoValidate === true;
    }

    get formTarget() {
      return typeof this.#element.formTarget === "string"
        ? this.#element.formTarget
        : "";
    }

    get height() {
      return this.#element.height ?? 0;
    }

    get hash() {
      return typeof this.#element.hash === "string" ? this.#element.hash : "";
    }

    get hidden() {
      return this.#element.hidden === true;
    }

    get fetchPriority() {
      return typeof this.#element.fetchPriority === "string"
        ? this.#element.fetchPriority
        : "";
    }

    get host() {
      return typeof this.#element.host === "string" ? this.#element.host : "";
    }

    get hostname() {
      return typeof this.#element.hostname === "string"
        ? this.#element.hostname
        : "";
    }

    get href() {
      return typeof this.#element.href === "string" ? this.#element.href : "";
    }

    get hreflang() {
      return typeof this.#element.hreflang === "string"
        ? this.#element.hreflang
        : "";
    }

    get httpEquiv() {
      return typeof this.#element.httpEquiv === "string"
        ? this.#element.httpEquiv
        : "";
    }

    get htmlFor() {
      return typeof this.#element.htmlFor === "string" ? this.#element.htmlFor : "";
    }

    get id() {
      return this.#element.id;
    }

    get index() {
      return this.#element.index ?? -1;
    }

    get innerHTML() {
      return this.#element.innerHTML;
    }

    get innerText() {
      return this.#element.innerText;
    }

    get lastElementChild() {
      return wrapNode(this.#element.lastElementChild);
    }

    get labels() {
      return makeReadonlyNodeList(this.#element.labels);
    }

    get label() {
      return typeof this.#element.label === "string" ? this.#element.label : "";
    }

    get lang() {
      return typeof this.#element.lang === "string" ? this.#element.lang : "";
    }

    get length() {
      return this.#element.length ?? 0;
    }

    get loading() {
      return typeof this.#element.loading === "string"
        ? this.#element.loading
        : "";
    }

    get loop() {
      return this.#element.loop === true;
    }

    get list() {
      return wrapNode(this.#element.list);
    }

    get localName() {
      return this.#element.localName;
    }

    get maxLength() {
      return this.#element.maxLength ?? -1;
    }

    get minLength() {
      return this.#element.minLength ?? -1;
    }

    get media() {
      return typeof this.#element.media === "string" ? this.#element.media : "";
    }

    get max() {
      return typeof this.#element.max === "string" ? this.#element.max : "";
    }

    get method() {
      return typeof this.#element.method === "string" ? this.#element.method : "";
    }

    get min() {
      return typeof this.#element.min === "string" ? this.#element.min : "";
    }

    get multiple() {
      return this.#element.multiple === true;
    }

    get muted() {
      return this.#element.muted === true;
    }

    get name() {
      return typeof this.#element.name === "string" ? this.#element.name : "";
    }

    get namespaceURI() {
      return this.#element.namespaceURI;
    }

    get noValidate() {
      return this.#element.noValidate === true;
    }

    get naturalHeight() {
      return this.#element.naturalHeight ?? 0;
    }

    get naturalWidth() {
      return this.#element.naturalWidth ?? 0;
    }

    get nextElementSibling() {
      return wrapNode(this.#element.nextElementSibling);
    }

    get outerHTML() {
      return this.#element.outerHTML;
    }

    get offsetHeight() {
      return this.#element.offsetHeight ?? 0;
    }

    get offsetLeft() {
      return this.#element.offsetLeft ?? 0;
    }

    get offsetTop() {
      return this.#element.offsetTop ?? 0;
    }

    get offsetWidth() {
      return this.#element.offsetWidth ?? 0;
    }

    get options() {
      return makeReadonlyNodeList(this.#element.options);
    }

    get open() {
      return this.#element.open === true;
    }

    get origin() {
      return typeof this.#element.origin === "string" ? this.#element.origin : "";
    }

    get paused() {
      return this.#element.paused === true;
    }

    get part() {
      return makeReadonlyTokenList(this.#element.part);
    }

    get pathname() {
      return typeof this.#element.pathname === "string"
        ? this.#element.pathname
        : "";
    }

    get pattern() {
      return typeof this.#element.pattern === "string"
        ? this.#element.pattern
        : "";
    }

    get playbackRate() {
      return this.#element.playbackRate ?? 1;
    }

    get ping() {
      return typeof this.#element.ping === "string" ? this.#element.ping : "";
    }

    get played() {
      return makeReadonlyTimeRanges(this.#element.played);
    }

    get placeholder() {
      return typeof this.#element.placeholder === "string"
        ? this.#element.placeholder
        : "";
    }

    get port() {
      return typeof this.#element.port === "string" ? this.#element.port : "";
    }

    get poster() {
      return typeof this.#element.poster === "string" ? this.#element.poster : "";
    }

    get protocol() {
      return typeof this.#element.protocol === "string"
        ? this.#element.protocol
        : "";
    }

    get previousElementSibling() {
      return wrapNode(this.#element.previousElementSibling);
    }

    get readOnly() {
      return this.#element.readOnly === true;
    }

    get readyState() {
      return this.#element.readyState ?? 0;
    }

    get referrerPolicy() {
      return typeof this.#element.referrerPolicy === "string"
        ? this.#element.referrerPolicy
        : "";
    }

    get rel() {
      return typeof this.#element.rel === "string" ? this.#element.rel : "";
    }

    get relList() {
      return makeReadonlyTokenList(this.#element.relList);
    }

    get required() {
      return this.#element.required === true;
    }

    get role() {
      return typeof this.#element.role === "string" ? this.#element.role : null;
    }

    get sandbox() {
      return makeReadonlyTokenList(this.#element.sandbox);
    }

    get scrollHeight() {
      return this.#element.scrollHeight ?? 0;
    }

    get scrollLeft() {
      return this.#element.scrollLeft ?? 0;
    }

    get scrollTop() {
      return this.#element.scrollTop ?? 0;
    }

    get scrollWidth() {
      return this.#element.scrollWidth ?? 0;
    }

    get rowIndex() {
      return this.#element.rowIndex ?? -1;
    }

    get rows() {
      return makeReadonlyNodeList(this.#element.rows);
    }

    get rowSpan() {
      return this.#element.rowSpan ?? 1;
    }

    get sectionRowIndex() {
      return this.#element.sectionRowIndex ?? -1;
    }

    get selected() {
      return this.#element.selected === true;
    }

    get selectedOptions() {
      return makeReadonlyNodeList(this.#element.selectedOptions);
    }

    get selectedIndex() {
      return this.#element.selectedIndex ?? -1;
    }

    get selectionDirection() {
      return typeof this.#element.selectionDirection === "string"
        ? this.#element.selectionDirection
        : null;
    }

    get selectionEnd() {
      return this.#element.selectionEnd ?? null;
    }

    get selectionStart() {
      return this.#element.selectionStart ?? null;
    }

    get shadowRoot() {
      return wrapNode(this.#element.shadowRoot);
    }

    get search() {
      return typeof this.#element.search === "string" ? this.#element.search : "";
    }

    get seekable() {
      return makeReadonlyTimeRanges(this.#element.seekable);
    }

    get size() {
      return this.#element.size ?? 0;
    }

    get sizes() {
      return typeof this.#element.sizes === "string" ? this.#element.sizes : "";
    }

    get slot() {
      return typeof this.#element.slot === "string" ? this.#element.slot : "";
    }

    get src() {
      return typeof this.#element.src === "string" ? this.#element.src : "";
    }

    get srcdoc() {
      return typeof this.#element.srcdoc === "string" ? this.#element.srcdoc : "";
    }

    get srcset() {
      return typeof this.#element.srcset === "string" ? this.#element.srcset : "";
    }

    get step() {
      return typeof this.#element.step === "string" ? this.#element.step : "";
    }

    get style() {
      return wrapStyle(this.#element.style);
    }

    get tagName() {
      return this.#element.tagName;
    }

    get tabIndex() {
      return this.#element.tabIndex ?? -1;
    }

    get tBodies() {
      return makeReadonlyNodeList(this.#element.tBodies);
    }

    get tFoot() {
      return wrapNode(this.#element.tFoot);
    }

    get tHead() {
      return wrapNode(this.#element.tHead);
    }

    get target() {
      return typeof this.#element.target === "string" ? this.#element.target : "";
    }

    get text() {
      return typeof this.#element.text === "string"
        ? this.#element.text
        : this.textContent;
    }

    get textTracks() {
      return makeReadonlyTrackList(this.#element.textTracks);
    }

    get title() {
      return typeof this.#element.title === "string" ? this.#element.title : "";
    }

    get type() {
      return typeof this.#element.type === "string" ? this.#element.type : "";
    }

    get validationMessage() {
      return typeof this.#element.validationMessage === "string"
        ? this.#element.validationMessage
        : "";
    }

    get validity() {
      return makeReadonlyValidityState(this.#element.validity);
    }

    get value() {
      return typeof this.#element.value === "string" ? this.#element.value : "";
    }

    get valueAsNumber() {
      return this.#element.valueAsNumber ?? null;
    }

    get audioTracks() {
      return makeReadonlyTrackList(this.#element.audioTracks);
    }

    get videoHeight() {
      return this.#element.videoHeight ?? 0;
    }

    get videoTracks() {
      return makeReadonlyTrackList(this.#element.videoTracks);
    }

    get videoWidth() {
      return this.#element.videoWidth ?? 0;
    }

    get width() {
      return this.#element.width ?? 0;
    }

    get willValidate() {
      return this.#element.willValidate === true;
    }

    closest(selector) {
      return wrapNode(this.#element.closest(String(selector)));
    }

    getAttribute(name) {
      return this.#element.getAttribute(String(name));
    }

    getBoundingClientRect() {
      return makeReadonlyRect(this.#element.getBoundingClientRect());
    }

    getClientRects() {
      return makeReadonlyList(
        Array.from(this.#element.getClientRects(), makeReadonlyRect),
      );
    }

    getElementsByClassName(className) {
      return makeReadonlyNodeList(
        this.#element.getElementsByClassName(String(className)),
      );
    }

    getElementsByTagName(tagName) {
      return makeReadonlyNodeList(
        this.#element.getElementsByTagName(String(tagName)),
      );
    }

    hasAttribute(name) {
      return this.#element.hasAttribute(String(name));
    }

    matches(selector) {
      return this.#element.matches(String(selector));
    }

    querySelector(selector) {
      return wrapNode(this.#element.querySelector(String(selector)));
    }

    querySelectorAll(selector) {
      return makeReadonlyNodeList(
        this.#element.querySelectorAll(String(selector)),
      );
    }

    scroll(leftOrOptions, top) {
      this.scrollTo(leftOrOptions, top);
    }

    scrollBy(leftOrOptions, top) {
      if (typeof this.#element.scrollBy !== "function") {
        return;
      }
      if (
        leftOrOptions != null &&
        typeof leftOrOptions === "object" &&
        !Array.isArray(leftOrOptions)
      ) {
        this.#element.scrollBy({ ...leftOrOptions });
        return;
      }
      this.#element.scrollBy(Number(leftOrOptions ?? 0), Number(top ?? 0));
    }

    scrollIntoView(arg) {
      if (typeof this.#element.scrollIntoView !== "function") {
        return;
      }
      if (arg == null || typeof arg === "boolean") {
        this.#element.scrollIntoView(arg);
        return;
      }
      if (typeof arg === "object" && !Array.isArray(arg)) {
        this.#element.scrollIntoView({ ...arg });
        return;
      }
      this.#element.scrollIntoView(Boolean(arg));
    }

    scrollTo(leftOrOptions, top) {
      if (typeof this.#element.scrollTo !== "function") {
        return;
      }
      if (
        leftOrOptions != null &&
        typeof leftOrOptions === "object" &&
        !Array.isArray(leftOrOptions)
      ) {
        this.#element.scrollTo({ ...leftOrOptions });
        return;
      }
      this.#element.scrollTo(Number(leftOrOptions ?? 0), Number(top ?? 0));
    }

    toJSON() {
      return {
        id: this.id,
        tagName: this.tagName,
        textContent: this.textContent,
      };
    }
  }

  class ReadonlyDocumentFragment extends ReadonlyNode {
    #fragment;

    constructor(fragment, token) {
      super(fragment, token);
      this.#fragment = fragment;
      Object.freeze(this);
    }

    get activeElement() {
      return wrapNode(this.#fragment.activeElement);
    }

    get adoptedStyleSheets() {
      return makeReadonlyList(
        Array.from(this.#fragment.adoptedStyleSheets ?? [], wrapCSSStyleSheet),
      );
    }

    get childElementCount() {
      return this.#fragment.childElementCount ?? this.children.length;
    }

    get children() {
      return makeReadonlyNodeList(this.#fragment.children);
    }

    get firstElementChild() {
      return wrapNode(this.#fragment.firstElementChild);
    }

    get host() {
      return wrapNode(this.#fragment.host);
    }

    get innerHTML() {
      return typeof this.#fragment.innerHTML === "string"
        ? this.#fragment.innerHTML
        : "";
    }

    get lastElementChild() {
      return wrapNode(this.#fragment.lastElementChild);
    }

    get mode() {
      return typeof this.#fragment.mode === "string"
        ? this.#fragment.mode
        : undefined;
    }

    get styleSheets() {
      return makeReadonlyList(
        Array.from(this.#fragment.styleSheets ?? [], wrapCSSStyleSheet),
      );
    }

    getElementById(id) {
      return typeof this.#fragment.getElementById === "function"
        ? wrapNode(this.#fragment.getElementById(String(id)))
        : null;
    }

    querySelector(selector) {
      return typeof this.#fragment.querySelector === "function"
        ? wrapNode(this.#fragment.querySelector(String(selector)))
        : null;
    }

    querySelectorAll(selector) {
      return makeReadonlyNodeList(
        typeof this.#fragment.querySelectorAll === "function"
          ? this.#fragment.querySelectorAll(String(selector))
          : [],
      );
    }
  }

  class ReadonlyDocument extends ReadonlyNode {
    #document;

    constructor(document, token) {
      super(document, token);
      this.#document = document;
      Object.freeze(this);
    }

    get activeElement() {
      return wrapNode(this.#document.activeElement);
    }

    get body() {
      return wrapNode(this.#document.body);
    }

    get characterSet() {
      return this.#document.characterSet;
    }

    get cookie() {
      return undefined;
    }

    get contentType() {
      return this.#document.contentType;
    }

    get defaultView() {
      return windowObject;
    }

    get adoptedStyleSheets() {
      return makeReadonlyList(
        Array.from(this.#document.adoptedStyleSheets ?? [], wrapCSSStyleSheet),
      );
    }

    get compatMode() {
      return this.#document.compatMode;
    }

    get doctype() {
      return wrapNode(this.#document.doctype);
    }

    get documentElement() {
      return wrapNode(this.#document.documentElement);
    }

    get fonts() {
      return wrapFontFaceSet(this.#document.fonts);
    }

    get forms() {
      return makeReadonlyNodeList(this.#document.forms);
    }

    get head() {
      return wrapNode(this.#document.head);
    }

    get hidden() {
      return this.#document.hidden === true;
    }

    get images() {
      return makeReadonlyNodeList(this.#document.images);
    }

    get lastModified() {
      return this.#document.lastModified;
    }

    get links() {
      return makeReadonlyNodeList(this.#document.links);
    }

    get location() {
      return locationObject;
    }

    get readyState() {
      return this.#document.readyState;
    }

    get referrer() {
      return this.#document.referrer;
    }

    get scripts() {
      return makeReadonlyNodeList(this.#document.scripts);
    }

    get scrollingElement() {
      return wrapNode(this.#document.scrollingElement);
    }

    get styleSheets() {
      return makeReadonlyList(
        Array.from(this.#document.styleSheets ?? [], wrapCSSStyleSheet),
      );
    }

    get title() {
      return this.#document.title;
    }

    get URL() {
      return this.#document.URL;
    }

    get visibilityState() {
      return this.#document.visibilityState;
    }

    elementFromPoint(x, y) {
      return typeof this.#document.elementFromPoint === "function"
        ? wrapNode(this.#document.elementFromPoint(Number(x), Number(y)))
        : null;
    }

    elementsFromPoint(x, y) {
      return makeReadonlyNodeList(
        typeof this.#document.elementsFromPoint === "function"
          ? this.#document.elementsFromPoint(Number(x), Number(y))
          : [],
      );
    }

    getElementById(id) {
      return wrapNode(this.#document.getElementById(String(id)));
    }

    getElementsByClassName(className) {
      return makeReadonlyNodeList(
        this.#document.getElementsByClassName(String(className)),
      );
    }

    getElementsByName(name) {
      return makeReadonlyNodeList(
        this.#document.getElementsByName(String(name)),
      );
    }

    getElementsByTagName(tagName) {
      return makeReadonlyNodeList(this.#document.getElementsByTagName(String(tagName)));
    }

    querySelector(selector) {
      return wrapNode(this.#document.querySelector(String(selector)));
    }

    querySelectorAll(selector) {
      return makeReadonlyNodeList(
        this.#document.querySelectorAll(String(selector)),
      );
    }
  }

  // Raw DOM references are closure-owned, not methods on exposed wrappers.
  // That keeps helper APIs like contains() and getComputedStyle() usable without
  // adding a model-visible path back to the mutable DOM.
  const unwrapNode = (value) =>
    value != null && (typeof value === "object" || typeof value === "function")
      ? rawNodesByWrapper.get(value) ?? null
      : null;
  const unwrapElement = (value) => {
    const node = unwrapNode(value);
    return node?.nodeType === ELEMENT_NODE ? node : null;
  };

  const isElement = (node) => node?.nodeType === ELEMENT_NODE;
  const isDocument = (node) => node?.nodeType === DOCUMENT_NODE;
  const isDocumentFragment = (node) => node?.nodeType === DOCUMENT_FRAGMENT_NODE;

  const wrapNode = (node) => {
    if (node == null) return null;
    const existing = nodeWrappers.get(node);
    if (existing != null) return existing;
    const wrapper = isDocument(node)
      ? new ReadonlyDocument(node, wrapperToken)
      : isElement(node)
        ? new ReadonlyElement(node, wrapperToken)
        : isDocumentFragment(node)
          ? new ReadonlyDocumentFragment(node, wrapperToken)
          : new ReadonlyNode(node, wrapperToken);
    nodeWrappers.set(node, wrapper);
    return wrapper;
  };

  const wrapNodeCollectionResult = (value) => {
    if (value == null) return null;
    if (typeof value.nodeType === "number") return wrapNode(value);
    if (
      (typeof value === "object" || typeof value === "function") &&
      typeof value.length === "number"
    ) {
      return makeReadonlyNodeList(value);
    }
    return null;
  };

  const makeReadonlyNodeList = (nodes) => {
    const rawNodes = Array.from(nodes ?? []);
    return makeReadonlyList(rawNodes.map(wrapNode), (list) => {
      defineHiddenReadonly(list, "namedItem", (name) => {
        const key = String(name);
        const rawNamedItem =
          typeof nodes?.namedItem === "function"
            ? nodes.namedItem(key)
            : (rawNodes.find((node) => node?.id === key || node?.name === key) ??
              null);
        return wrapNodeCollectionResult(rawNamedItem);
      });
    });
  };

  const locationObject = new ReadonlyLocation();
  const windowObject = Object.create(null);
  const documentObject = wrapNode(rawDocument);

  const safeGetComputedStyle = (element, pseudoElement) => {
    const rawElement = unwrapElement(element);
    if (rawElement == null) throw new TypeError("getComputedStyle expects an Element");
    return wrapStyle(rawWindow.getComputedStyle(rawElement, pseudoElement));
  };

  const safeGetSelection = () =>
    typeof rawWindow.getSelection === "function"
      ? wrapSelection(rawWindow.getSelection())
      : null;

  const safeMatchMedia = (query) => {
    if (typeof rawWindow.matchMedia !== "function") return null;
    return wrapMediaQueryList(rawWindow.matchMedia(String(query)));
  };

  const isScrollOptionsObject = (value) =>
    value != null && typeof value === "object" && !Array.isArray(value);

  const finiteNumber = (value, fallback) => {
    if (value == null) return fallback;
    const number = Number(value);
    return Number.isFinite(number) ? number : fallback;
  };

  const safeWindowScrollTo = (leftOrOptions, top) => {
    if (typeof rawWindow.scrollTo !== "function") {
      throw new TypeError("scrollTo is not available");
    }
    if (isScrollOptionsObject(leftOrOptions)) {
      rawWindow.scrollTo({ ...leftOrOptions });
      return;
    }
    rawWindow.scrollTo(
      finiteNumber(leftOrOptions, 0),
      finiteNumber(top, 0),
    );
  };

  const safeWindowScrollBy = (leftOrOptions, top) => {
    const currentX = finiteNumber(rawWindow.scrollX, 0);
    const currentY = finiteNumber(rawWindow.scrollY, 0);
    if (typeof rawWindow.scrollBy === "function") {
      if (isScrollOptionsObject(leftOrOptions)) {
        rawWindow.scrollBy({ ...leftOrOptions });
        return;
      }
      rawWindow.scrollBy(
        finiteNumber(leftOrOptions, 0),
        finiteNumber(top, 0),
      );
      return;
    }
    if (isScrollOptionsObject(leftOrOptions)) {
      safeWindowScrollTo({
        left: currentX + finiteNumber(leftOrOptions.left, 0),
        top: currentY + finiteNumber(leftOrOptions.top, 0),
      });
      return;
    }
    safeWindowScrollTo(
      currentX + finiteNumber(leftOrOptions, 0),
      currentY + finiteNumber(top, 0),
    );
  };

  const safeSetTimeout = (callback, delay, ...args) => {
    if (typeof callback !== "function") {
      throw new TypeError("setTimeout callback must be a function");
    }
    if (typeof rawWindow.setTimeout !== "function") {
      throw new TypeError("setTimeout is not available");
    }
    return rawWindow.setTimeout(
      () => {
        callback(...args);
      },
      finiteNumber(delay, 0),
    );
  };

  const safeClearTimeout = (timeoutId) => {
    if (typeof rawWindow.clearTimeout === "function") {
      rawWindow.clearTimeout(timeoutId);
    }
  };

  const cssObject = Object.freeze({
    escape:
      typeof rawWindow.CSS?.escape === "function"
        ? (value) => rawWindow.CSS.escape(String(value))
        : undefined,
    supports:
      typeof rawWindow.CSS?.supports === "function"
        ? (property, value) =>
            value === undefined
              ? rawWindow.CSS.supports(String(property))
              : rawWindow.CSS.supports(String(property), String(value))
        : undefined,
  });

  defineHiddenReadonly(windowObject, "constructor", undefined);
  defineReadonly(windowObject, "CSS", cssObject);
  defineReadonly(windowObject, "document", documentObject);
  defineReadonly(windowObject, "location", locationObject);
  defineReadonly(windowObject, "self", windowObject);
  defineReadonly(windowObject, "top", windowObject);
  defineReadonly(windowObject, "window", windowObject);
  defineReadonly(windowObject, "getComputedStyle", safeGetComputedStyle);
  defineReadonly(windowObject, "getSelection", safeGetSelection);
  defineReadonly(windowObject, "matchMedia", safeMatchMedia);
  defineReadonly(windowObject, "clearTimeout", safeClearTimeout);
  defineReadonly(windowObject, "scroll", safeWindowScrollTo);
  defineReadonly(windowObject, "scrollBy", safeWindowScrollBy);
  defineReadonly(windowObject, "scrollTo", safeWindowScrollTo);
  defineReadonly(windowObject, "setTimeout", safeSetTimeout);
  defineReadonly(
    windowObject,
    "visualViewport",
    wrapVisualViewport(rawWindow.visualViewport),
  );
  for (const name of [
    "devicePixelRatio",
    "innerHeight",
    "innerWidth",
    "outerHeight",
    "outerWidth",
    "pageXOffset",
    "pageYOffset",
    "scrollX",
    "scrollY",
  ]) {
    defineReadonlyGetter(windowObject, name, () => rawWindow[name]);
  }
  Object.freeze(windowObject);

  const consoleObject = Object.freeze({
    debug() {},
    error() {},
    info() {},
    log() {},
    warn() {},
  });

  const cssRuleObject = Object.freeze({
    CHARSET_RULE: rawWindow.CSSRule?.CHARSET_RULE ?? 2,
    FONT_FACE_RULE: rawWindow.CSSRule?.FONT_FACE_RULE ?? 5,
    IMPORT_RULE: rawWindow.CSSRule?.IMPORT_RULE ?? 3,
    KEYFRAME_RULE: rawWindow.CSSRule?.KEYFRAME_RULE ?? 8,
    KEYFRAMES_RULE: rawWindow.CSSRule?.KEYFRAMES_RULE ?? 7,
    MEDIA_RULE: rawWindow.CSSRule?.MEDIA_RULE ?? 4,
    NAMESPACE_RULE: rawWindow.CSSRule?.NAMESPACE_RULE ?? 10,
    PAGE_RULE: rawWindow.CSSRule?.PAGE_RULE ?? 6,
    STYLE_RULE: rawWindow.CSSRule?.STYLE_RULE ?? 1,
    SUPPORTS_RULE: rawWindow.CSSRule?.SUPPORTS_RULE ?? 12,
  });

  const nodeObject = Object.freeze({
    COMMENT_NODE,
    DOCUMENT_FRAGMENT_NODE,
    DOCUMENT_NODE,
    DOCUMENT_TYPE_NODE,
    ELEMENT_NODE,
    TEXT_NODE,
  });
  const rangeObject = Object.freeze({
    END_TO_END: rawWindow.Range?.END_TO_END ?? 2,
    END_TO_START: rawWindow.Range?.END_TO_START ?? 3,
    START_TO_END: rawWindow.Range?.START_TO_END ?? 1,
    START_TO_START: rawWindow.Range?.START_TO_START ?? 0,
  });
  for (const name of ["createObjectURL", "revokeObjectURL"]) {
    defineHiddenReadonly(URL, name, undefined);
  }
  for (const namespace of [
    JSON,
    Math,
    Reflect,
    consoleObject,
    cssObject,
    cssRuleObject,
    nodeObject,
    rangeObject,
  ]) {
    Object.freeze(namespace);
  }

  // This object is the global allowlist used by the scope proxy below.
  // Anything not listed here resolves as undefined instead of falling through
  // to the isolated world's real global.
  const safeBindings = Object.freeze({
    Array,
    Boolean,
    console: consoleObject,
    CSS: cssObject,
    CSSRule: cssRuleObject,
    CSSRuleList: Array,
    CSSStyleDeclaration: ReadonlyStyleDeclaration,
    CSSStyleSheet: ReadonlyCSSStyleSheet,
    Date,
    document: documentObject,
    Element: ReadonlyElement,
    DocumentFragment: ReadonlyDocumentFragment,
    Error,
    getComputedStyle: safeGetComputedStyle,
    getSelection: safeGetSelection,
    HTMLCollection: Array,
    Infinity,
    isFinite,
    isNaN,
    JSON,
    location: locationObject,
    Map,
    Math,
    matchMedia: safeMatchMedia,
    MediaList: Array,
    NaN,
    Node: nodeObject,
    NodeList: Array,
    Number,
    Object,
    Promise,
    RangeError,
    Range: rangeObject,
    ReferenceError,
    Reflect,
    RegExp,
    Set,
    Selection: ReadonlySelection,
    String,
    StyleSheetList: Array,
    Symbol,
    ShadowRoot: ReadonlyDocumentFragment,
    clearTimeout: safeClearTimeout,
    scroll: safeWindowScrollTo,
    scrollBy: safeWindowScrollBy,
    scrollTo: safeWindowScrollTo,
    setTimeout: safeSetTimeout,
    TypeError,
    undefined,
    URIError,
    URL,
    URLSearchParams,
    visualViewport: windowObject.visualViewport,
    window: windowObject,
    self: windowObject,
    top: windowObject,
  });

  // The with-scope proxy claims every identifier lookup made by the user
  // script, so unlisted globals cannot leak through.
  const scope = new Proxy(Object.create(null), {
    defineProperty() {
      throw readonlyError("global defineProperty");
    },
    deleteProperty() {
      throw readonlyError("global delete");
    },
    get(_target, property) {
      if (property === Symbol.unscopables) return undefined;
      if (typeof property !== "string") return undefined;
      if (Object.prototype.hasOwnProperty.call(safeBindings, property)) {
        return safeBindings[property];
      }
      if (Object.prototype.hasOwnProperty.call(windowObject, property)) {
        return windowObject[property];
      }
      return undefined;
    },
    has() {
      return true;
    },
    set() {
      throw readonlyError("global assignment");
    },
  });

  const poisonConstructor = (prototype) => {
    try {
      Object.defineProperty(prototype, "constructor", {
        configurable: false,
        enumerable: false,
        value: undefined,
        writable: false,
      });
    } catch {}
  };

  // User code can create functions/classes/objects inside the isolated world.
  // Hide constructor links and freeze exposed intrinsics before it runs so those
  // objects cannot be used to climb back to a broader global or mutate helpers
  // that serialization relies on.
  const lockdownConstructors = (constructors) => {
    for (const constructor of constructors) {
      poisonConstructor(constructor.prototype);
      Object.freeze(constructor.prototype);
      Object.freeze(constructor);
    }
  };

  lockdownConstructors([
    Object,
    Function,
    Array,
    Promise,
    Map,
    Set,
    WeakMap,
    WeakSet,
    RegExp,
    Error,
    Number,
    String,
    Boolean,
    Date,
    URL,
    URLSearchParams,
    ReadonlyStyleDeclaration,
    ReadonlyMediaList,
    ReadonlyCSSRule,
    ReadonlyCSSStyleSheet,
    ReadonlyRange,
    ReadonlySelection,
    ReadonlyFontFaceSet,
    ReadonlyMediaQueryList,
    ReadonlyVisualViewport,
    ReadonlyLocation,
    ReadonlyNode,
    ReadonlyElement,
    ReadonlyDocumentFragment,
    ReadonlyDocument,
  ]);

  for (const prototype of [
    Object.getPrototypeOf(async function () {}),
    Object.getPrototypeOf(function* () {}),
    Object.getPrototypeOf(async function* () {}),
  ]) {
    if (prototype != null) {
      poisonConstructor(prototype);
      Object.freeze(prototype);
    }
  }

  const serializeResult = (value) => {
    // Runtime.evaluate returns only this bounded JSON-ish projection. Live DOM
    // wrappers never cross the boundary back to the caller.
    const seen = new WeakSet();

    const serializeNonObject = (current) => {
      switch (typeof current) {
        case "bigint":
          return current.toString();
        case "boolean":
        case "undefined":
          return current;
        case "function":
        case "symbol":
          return undefined;
        case "number":
          return Number.isFinite(current) ? current : null;
        case "string":
          return current.length > RESULT_MAX_STRING_LENGTH
            ? current.slice(0, RESULT_MAX_STRING_LENGTH) + "[Truncated]"
            : current;
        default:
          return current;
      }
    };

    const serializeArray = (items, depth) =>
      items
        .slice(0, RESULT_MAX_ARRAY_LENGTH)
        .map((item) => serialize(item, depth + 1));

    const serializeObject = (current, depth) => {
      if (depth > RESULT_MAX_DEPTH) return "[MaxDepth]";
      if (seen.has(current)) return "[Circular]";
      seen.add(current);
      if (
        rawNodesByWrapper.has(current) ||
        styleWrappers.has(current) ||
        cssWrappers.has(current) ||
        selectionAndRangeWrappers.has(current) ||
        readonlyApiWrappers.has(current)
      ) {
        return serialize(current.toJSON(), depth);
      }
      if (Array.isArray(current)) return serializeArray(current, depth);
      const output = {};
      for (const key of ownKeys(current)) {
        const serialized = serialize(current[key], depth + 1);
        if (serialized !== undefined) output[key] = serialized;
      }
      return output;
    };

    const serialize = (current, depth) =>
      current == null || typeof current !== "object"
        ? serializeNonObject(current)
        : serializeObject(current, depth);

    return serialize(value, 0);
  };

  const runUserScript = async () => {
    with (scope) {
      return await (async function () {
        "use strict";
${e}
      }).call(windowObject);
    }
  };

  return runUserScript().then(serializeResult);
})()`}function Kj(e){if(Hj.test(e))throw new Error("module loading is not available in playwright.evaluate")}function Jj(e){let t=e.frameTree.frame.id;if(!t)throw new Error("playwright.evaluate could not find a frame");return t}function Yj(e){if(e.exceptionDetails!=null){let r=e.exceptionDetails.exception?.description??e.exceptionDetails.text??"Runtime.evaluate failed";throw new Error(r)}let t=e.result;if(t!=null)return t.unserializableValue!=null?Zj(t.unserializableValue):t.value}function Zj(e){switch(e){case"-0":return-0;case"NaN":return null;case"Infinity":return null;case"-Infinity":return null}return/^-?\d+n$/.test(e)?e.slice(0,-1):e}var xA=y(ln.Bundle,async(e,t)=>{let r=A(e.tab_id),n=await t.tabs.get(r);return await t.pageAssets.bundle({assetIds:e.assetIds,documentUrl:n.url,inventoryId:e.inventoryId,kinds:e.kinds,tabId:r})});var SA=y(ln.List,async(e,t)=>{let r=A(e.tab_id),n=await t.tabs.get(r);return await t.pageAssets.list({documentUrl:n.url,tabId:r})});var Xj=e=>{if(e===null)return null;if(typeof e=="string"||typeof e=="boolean")return e;if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof String||e instanceof Boolean)return e.valueOf();if(e instanceof Number){let t=e.valueOf();return Number.isFinite(t)?t:void 0}},Qj=e=>typeof e=="number"&&Number.isInteger(e)&&e>0,vA=(e,t)=>{if(!Qj(t))return e;let r=t;if(e.length<=r)return e;let n=e.length-r;return`${e.slice(0,r)}[truncated ${n} chars]`},eq=(e,t)=>{switch(e.type){case"function":return e;case"error":case"object":return{...e,value:vA(e.value,t)};case"value":return typeof e.value!="string"?e:{...e,value:vA(e.value,t)}}},tq=async(e,t,r)=>{let{displayImage:n,displayValue:o}=e,i=null;try{if(t instanceof Uint8Array){await n(t);return}else if(t===void 0)i={type:"value",value:void 0};else if(typeof t=="function")i={type:"function",value:void 0};else{let s=Xj(t);s!==void 0&&(i={type:"value",value:s})}if(i===null){let s=JSON.stringify(t);s===void 0&&(s=String(t)),i={type:"object",value:s}}}catch(s){i={type:"error",value:String(s)}}i&&await o(eq(i,r))};function EA({displayBridge:e,displayTruncateMaxChars:t}){return r=>tq(e,r,t)}function Zc(e){return e?.type==="extension"||e?.type==="iab"&&e.metadata?.codexIabTabMode==="multiTab"}var Xc=class{constructor(t,r){this.api=t;this.clientInfo=r}api;clientInfo;async openTabs(){return await this.api.getUserTabs()}async history(t){return await this.api.getUserHistory(t)}async claimTab(t){if(!Zc(this.clientInfo))throw new Error("browser.user.claimTab is only available with the Chrome or multi-tab IAB backend.");return await this.api.claimUserTab(t)}};function CA(e){return e==="right"||e==="middle"?e:"left"}function $h(e){switch(e){case"right":return 2;case"middle":return 4;case"left":return 1}}var rq="const __name = (target) => target;";async function zh(e,t,r){let n=JT(e,r),o=await Qa(t,n.target,n.frameId,n.loaderId,nq(n.localRef,n.viewportClip),{returnByValue:!0});if(o.exceptionDetails!=null)throw new Error(sq(o.exceptionDetails));let i=iq(o.result.value);if(i==null)throw new Error(`DOM node ${r} is stale or missing`);return{point:await YT(e,t,n.frameId,i),target:n.target}}function nq(e,t){return`(() => {
    ${rq}
    return (${oq.toString()})(${JSON.stringify(e)}, ${JSON.stringify(t)});
  })()`}function oq(e,t){let n=globalThis.__browserUseVisibleDomState?.refToElement.get(e);if(!n?.isConnected)return null;n.scrollIntoView({block:"nearest",inline:"nearest"});let o=i=>{if(i.width<=0||i.height<=0)return null;let s=Math.max(i.left,t.left),a=Math.min(i.right,t.right),u=Math.max(i.top,t.top),l=Math.min(i.bottom,t.bottom);return a>s&&l>u?{x:s+(a-s)/2,y:u+(l-u)/2}:null};for(let i of n.getClientRects()){let s=o(i);if(s!=null)return s}return o(n.getBoundingClientRect())}function iq(e){if(e==null||typeof e!="object")return null;let t=e;return typeof t.x=="number"&&typeof t.y=="number"?{x:t.x,y:t.y}:null}function sq(e){let t=e.exception;return typeof t?.value=="string"?t.value:t?.description??e.text??"DOM node failed"}var Qc=class{constructor(t,r){this.cdp=t;this.ui=r}cdp;ui;async dispatchKeyPress(t){if(!Array.isArray(t.keys)||t.keys.length===0)throw new Error(`${t.commandName} requires a non-empty keys array`);await ic(this.cdp,A(t.tabId),t.keys)}async dispatchMouseMove(t,r,n){await this.ui.moveMouse(t,r.x,r.y),await this.cdp.call(t,"Input.dispatchMouseEvent",{type:"mouseMoved",x:r.x,y:r.y,button:"none",buttons:0,modifiers:n})}async getBackendNodeViewportPoint(t,r){await this.cdp.call(t,"DOM.scrollIntoViewIfNeeded",{backendNodeId:r});try{let{quads:i}=await this.cdp.call(t,"DOM.getContentQuads",{backendNodeId:r}),s=TA(i[0]);if(s!=null)return s}catch{}let{model:n}=await this.cdp.call(t,"DOM.getBoxModel",{backendNodeId:r}),o=TA(n.border);if(o==null)throw new Error(`Missing DOM geometry for backend node ${r}`);return o}async clickDomCuaNode(t){let{point:r,target:n}=await zh(t.tabId,this.cdp,t.nodeId);await this.clickPoint({clickCount:t.clickCount,...ru(n)?{loadTarget:n}:{},modifiers:0,point:r,tabId:t.tabId,timeoutMs:t.timeoutMs==null?void 0:se({timeout_ms:t.timeoutMs})})}async scrollDomCuaNode(t){let{point:r}=await zh(t.tabId,this.cdp,t.nodeId);await this.scrollPoint({modifiers:0,point:r,scrollX:t.scrollX,scrollY:t.scrollY,tabId:t.tabId})}async dragPath(t){let r=A(t.tabId),[n,...o]=t.path;if(!n)throw new Error("cua_drag requires a non-empty path");let i="left";await this.dispatchMouseMove(r,n,t.modifiers),await this.dispatchMouseDown({button:i,clickCount:1,modifiers:t.modifiers,point:n,tabId:r});let s=n,a=!1;try{for(let u of o)s=u,await this.dispatchPressedMouseMove(r,u,i,t.modifiers);a=!0,await this.dispatchMouseUp({button:i,clickCount:1,modifiers:t.modifiers,point:s,tabId:r})}finally{a||await this.dispatchMouseUp({button:i,clickCount:1,modifiers:t.modifiers,point:s,tabId:r}).catch(()=>{})}}async scrollPoint(t){let r=A(t.tabId),n=t.scrollX===0?0:-t.scrollX,o=t.scrollY===0?0:-t.scrollY;await this.dispatchMouseMove(r,t.point,t.modifiers),await this.cdp.call(r,"Input.synthesizeScrollGesture",{x:t.point.x,y:t.point.y,xDistance:n,yDistance:o,gestureSourceType:"mouse",preventFling:!0,speed:8e3})}async clickPoint(t){let r=A(t.tabId),n=se({timeout_ms:t.timeoutMs}),o=t.button??"left",i=t.loadTarget==null||!ru(t.loadTarget)?[r]:[t.loadTarget,r],s=Promise.all(i.map(async u=>this.cdp.waitForPageLoadEvent(u,{timeoutMs:n}))),a=s.catch(()=>{});try{await this.dispatchMouseMove(r,t.point,t.modifiers);for(let u=1;u<=t.clickCount;u+=1)await this.dispatchMouseDown({button:o,clickCount:u,modifiers:t.modifiers,point:t.point,tabId:r}),await this.dispatchMouseUp({button:o,clickCount:u,modifiers:t.modifiers,point:t.point,tabId:r})}catch(u){throw await a,u}await s}async dispatchMouseDown(t){await this.cdp.call(t.tabId,"Input.dispatchMouseEvent",{type:"mousePressed",x:t.point.x,y:t.point.y,button:t.button,buttons:$h(t.button),clickCount:t.clickCount,modifiers:t.modifiers})}async dispatchMouseUp(t){await this.dispatchCdpMouseRelease(t)}async dispatchPressedMouseMove(t,r,n,o){await this.ui.moveMouse(t,r.x,r.y,{waitForArrival:!1}),await this.cdp.call(t,"Input.dispatchMouseEvent",{type:"mouseMoved",x:r.x,y:r.y,button:n,buttons:$h(n),modifiers:o})}async dispatchCdpMouseRelease(t){await this.cdp.call(t.tabId,"Input.dispatchMouseEvent",{type:"mouseReleased",x:t.point.x,y:t.point.y,button:t.button,buttons:0,clickCount:t.clickCount,modifiers:t.modifiers})}};function TA(e){if(e==null||e.length<8)return null;let[t,r,n,o,i,s,a,u]=e;return{x:(t+n+i+a)/4,y:(r+o+s+u)/4}}var ed=class{constructor(t){this.cdp=t;this.cdp.addTabAttachHandler(r=>{if(!this.runtimeEnablePromises.has(r))return this.ensureRuntimeEnabled(r)}),this.cdp.on("tabDetached",r=>{this.logsByTabId.delete(r),this.runtimeEnabledTabIds.delete(r),this.runtimeEnablePromises.delete(r)}),this.cdp.on("event",r=>{this.handleCdpEvent(r)})}cdp;logsByTabId=new Map;runtimeEnabledTabIds=new Set;runtimeEnablePromises=new Map;async logs({tabId:t,filter:r,levels:n,limit:o=100}){await this.ensureRuntimeEnabled(t);let i=n?new Set(n):null;return(this.logsByTabId.get(t)??[]).filter(a=>!(r&&!a.message.includes(r)||i&&!i.has(a.level))).slice(-o)}async ensureRuntimeEnabled(t){if(this.runtimeEnabledTabIds.has(t))return;let r=this.runtimeEnablePromises.get(t);if(r){await r;return}let n=(async()=>{await this.cdp.call(t,"Runtime.enable"),this.runtimeEnabledTabIds.add(t)})();this.runtimeEnablePromises.set(t,n);try{await n}finally{this.runtimeEnablePromises.delete(t)}}handleCdpEvent(t){let r=t.source.tabId;if(typeof r=="number"){if(t.method==="Runtime.consoleAPICalled"){let n=aq(t.params);n&&this.pushLog(r,n);return}if(t.method==="Runtime.exceptionThrown"){let n=uq(t.params);n&&this.pushLog(r,n)}}}pushLog(t,r){let n=this.logsByTabId.get(t)??[];n.push(r),n.length>500&&n.splice(0,n.length-500),this.logsByTabId.set(t,n)}};function aq(e){return wn(e)?{level:pq(ou(e,"type")),message:cq(e.args),timestamp:new Date().toISOString(),...dq(e.stackTrace)}:null}function uq(e){if(!wn(e)||!wn(e.exceptionDetails))return null;let t=wn(e.exceptionDetails.exception)?e.exceptionDetails.exception:null;return{level:"error",message:lq(e.exceptionDetails,t),timestamp:new Date().toISOString(),...AA(ou(e.exceptionDetails,"url"))}}function lq(e,t){let r=t?.value;return typeof r=="string"?r:ou(t??{},"description")??ou(e,"text")??"Uncaught exception"}function cq(e){return!Array.isArray(e)||e.length===0?"":e.map(t=>wn(t)?t.type==="string"?String(t.value??""):t.value!==void 0?String(t.value):typeof t.description=="string"?t.description:"[object]":"[object]").join(" ")}function dq(e){if(!wn(e)||!Array.isArray(e.callFrames))return{};let[t]=e.callFrames;return wn(t)?AA(ou(t,"url")):{}}function AA(e){return e?{url:e}:{}}function pq(e){switch(e){case"debug":return"debug";case"info":return"info";case"warning":case"warn":return"warn";case"error":return"error";default:return"log"}}function ou(e,t){let r=e[t];return typeof r=="string"?r:void 0}function wn(e){return typeof e=="object"&&e!=null}import{EventEmitter as fq}from"node:events";var td=class extends fq{constructor(r,n,o,i){super();this.cdp=n;this.security=o;this.clientType=i;r.addEventListener("onDownloadChange",s=>{this.filenamesById.set(s.id,s.filename),this.emit("change",s)}),this.cdp.addTabAttachHandler(async s=>{await this.cdp.call(s,"Fetch.enable",{patterns:[{requestStage:"Response",resourceType:"Document"}]})}),this.cdp.on("tabDetached",async s=>{this.removeEnabledTab(s),this.allowedDownloadUrlsByTabId.delete(s),this.pendingDownloadRequestsByTabId.delete(s)}),this.cdp.on("event",s=>{this.handleCdpEvent(s).catch(()=>{})})}cdp;security;clientType;filenamesById=new Map;downloadEnabled=[];allowedDownloadUrlsByTabId=new Map;pendingDownloadRequestsByTabId=new Map;disposeList=[];async enableDownload(r){this.allowedDownloadUrlsByTabId.delete(r),this.downloadEnabled.includes(r)||this.downloadEnabled.push(r)}async disableDownload(r){this.removeEnabledTab(r),this.allowedDownloadUrlsByTabId.delete(r),await this.failPendingDownloadRequest(r)}async waitForDownload(r,n){let o=await this.waitForDownloadRequest(r,n);try{await this.security.ensureDownloadAllowed(r)}catch(i){throw await this.failPendingDownloadRequest(r,o.requestId),i}return this.pendingDownloadRequestsByTabId.delete(r),this.allowedDownloadUrlsByTabId.set(r,o.url),await this.cdp.call(r,"Fetch.continueResponse",{requestId:o.requestId}),await this.waitForCompletedDownload(r)}waitForDownloadRequest(r,n){let o=this.pendingDownloadRequestsByTabId.get(r);return o!=null?Promise.resolve(o):new Promise((i,s)=>{let a=setTimeout(()=>{l(),s(new Error(`Timed out after ${n}ms waiting for download.`))},n),u=(d,p)=>{d===r&&(l(),i(p))},l=()=>{clearTimeout(a),this.removeListener("request",u)};this.addListener("request",u)})}waitForCompletedDownload(r){return new Promise((n,o)=>{let i=null,s=a=>{if(i==null){if(a.status!=="started"||a.url!==this.allowedDownloadUrlsByTabId.get(r))return;i=a.id;return}if(a.id===i&&!(a.status==="started"||a.status==="in_progress"))switch(this.removeListener("change",s),a.status){case"complete":n(a);return;case"failed":o(new Error(`Download ${a.id} failed.`));return;case"canceled":o(new Error(`Download ${a.id} was canceled.`));return}};this.addListener("change",s)})}getPath(r){return this.filenamesById.get(r)??null}isDownload(r){return r.resourceType==="Document"&&!bq(r)&&(mq(r.responseHeaders)||!gq(hq(r.responseHeaders),this.clientType))}async handleCdpEvent(r){if(r.method!=="Fetch.requestPaused")return;let n=r.source.tabId;if(typeof n!="number")return;if(!this.isDownload(r.params)){await this.cdp.call(n,"Fetch.continueResponse",{requestId:r.params.requestId});return}if(!this.downloadEnabled.includes(n)){await this.cdp.call(n,"Fetch.failRequest",{requestId:r.params.requestId,errorReason:"BlockedByClient"});return}let i={requestId:r.params.requestId,url:r.params.request.url};this.pendingDownloadRequestsByTabId.set(n,i),this.removeEnabledTab(n),this.emit("request",n,i)}removeEnabledTab(r){let n=this.downloadEnabled.indexOf(r);n>=0&&this.downloadEnabled.splice(n,1)}async failPendingDownloadRequest(r,n){let o=this.pendingDownloadRequestsByTabId.get(r);o!=null&&(n!=null&&o.requestId!==n||(this.pendingDownloadRequestsByTabId.delete(r),await this.cdp.call(r,"Fetch.failRequest",{requestId:o.requestId,errorReason:"BlockedByClient"})))}};function mq(e){let t=Wh(e,"content-disposition");return/^attachment(?:\s*;|\s*$)/i.test(t??"")}function hq(e){return Wh(e,"content-type")?.split(";",1)[0]?.trim().toLowerCase()}function Wh(e,t){return e?.find(r=>r.name.toLowerCase()===t)?.value}function gq(e,t){return e==="text/html"||t==="iab"&&e==="application/pdf"}function bq(e){return yq(e.responseStatusCode)&&Wh(e.responseHeaders,"location")!=null}function yq(e){return e===301||e===302||e===303||e===307||e===308}import{randomUUID as BA}from"node:crypto";import{mkdir as kq,rm as Iq,writeFile as Vh}from"node:fs/promises";import{tmpdir as Rq}from"node:os";import{extname as Pq,join as nd}from"node:path";import{createHash as PA}from"node:crypto";var DA=["background-image","border-image-source","cursor","list-style-image","mask-image"];async function NA({cdp:e,tabId:t}){let r=await _q({cdp:e,tabId:t}),n=r.documents[0];if(n==null)return await IA({cdp:e,tabId:t});let o=su(r.strings,n.documentURL),i=new Map;for(let s of await IA({cdp:e,tabId:t}))MA(i,s);for(let s of wq(n,r.strings))for(let a of Sq(s,o))RA(i,a);for(let s of vq(n,r.strings,o))RA(i,s);return[...i.values()]}async function OA({cdp:e,tabId:t}){return(await e.evaluateJavascript(t,`Array.from(document.querySelectorAll("svg")).map((svg, index) => ({
        markup: svg.outerHTML,
        name:
          svg.getAttribute("aria-label") ||
          svg.querySelector("title")?.textContent?.trim() ||
          svg.id ||
          "svg-" + (index + 1),
      }))`)??[]).flatMap((n,o)=>n.markup?[{id:PA("sha256").update(`${o}:${n.markup}`).digest("hex").slice(0,16),markup:n.markup,name:n.name||`svg-${o+1}`}]:[])}async function _q({cdp:e,tabId:t}){return await e.call(t,"DOMSnapshot.captureSnapshot",{computedStyles:[...DA],includeDOMRects:!1})}function wq(e,t){return(e.nodes.backendNodeId??[]).flatMap((r,n)=>r<=0?[]:[{attributes:xq(e,t,n),nodeId:r,tagName:su(t,e.nodes.nodeName?.[n]).toLowerCase()}])}function xq(e,t,r){let n=e.nodes.attributes?.[r]??[],o={};for(let i=0;i<n.length;i+=2){let s=su(t,n[i]),a=su(t,n[i+1]);s.length>0&&(o[s]=a)}return o}function Sq(e,t){let r=[];switch(e.tagName){case"img":Tr(r,e,"src","image",t),kA(r,e,"srcset","image",t);break;case"source":Tr(r,e,"src","video",t),kA(r,e,"srcset","image",t);break;case"video":Tr(r,e,"poster","image",t),Tr(r,e,"src","video",t);break;case"script":Tr(r,e,"src","script",t);break;case"link":Tr(r,e,"href",e.attributes.rel==="stylesheet"?"stylesheet":"other",t);break;case"use":Tr(r,e,"href","image",t),Tr(r,e,"xlink:href","image",t);break}return r}function Tr(e,t,r,n,o){let i=t.attributes[r];i&&e.push(rd({kind:n,source:{kind:"attribute",nodeId:t.nodeId,property:r},url:Hh(i,o)}))}function kA(e,t,r,n,o){let i=t.attributes[r];if(i)for(let s of i.split(",")){let a=s.trim().split(/\s+/,1)[0];a&&e.push(rd({kind:n,source:{kind:"attribute",nodeId:t.nodeId,property:r},url:Hh(a,o)}))}}function vq(e,t,r){let n=[];for(let[o,i]of e.layout.nodeIndex.entries()){let s=e.nodes.backendNodeId?.[i];if(s==null||s<=0)continue;let a=e.layout.styles[o]??[];for(let[u,l]of DA.entries()){let d=su(t,a[u]);for(let p of Aq(d))n.push(rd({kind:"image",source:{kind:"computedStyle",nodeId:s,property:l},url:Hh(p,r)}))}}return n}async function IA({cdp:e,tabId:t}){return(await e.evaluateJavascript(t,`performance.getEntriesByType("resource").map((entry) => ({
        initiatorType: "initiatorType" in entry ? entry.initiatorType : undefined,
        name: entry.name,
      }))`)??[]).flatMap(n=>n.name?[rd({kind:Eq(n),source:{kind:"resource",property:n.initiatorType},url:n.name})]:[])}function Eq(e){let t=iu(e.name??"");if(t!=="other")return t;switch(e.initiatorType){case"css":return"stylesheet";case"font":return"font";case"img":return"image";case"script":return"script";case"video":return"video";default:return iu(e.name??"")}}function MA(e,t){let r=e.get(t.url);if(r==null){e.set(t.url,t);return}r.sources.push(...t.sources),r.kind==="other"&&t.kind!=="other"&&(r.kind=t.kind)}function RA(e,t){e.has(t.url)&&MA(e,t)}function rd({kind:e,source:t,url:r}){return{id:PA("sha256").update(r).digest("hex").slice(0,16),kind:e==="other"?iu(r):e,name:Cq(r),sources:[t],url:r}}function iu(e){let t=FA(e).toLowerCase();return/\.(avif|gif|ico|jpe?g|png|svg|webp)$/.test(t)?"image":/\.(mp4|mov|m4v|webm)$/.test(t)?"video":/\.(otf|ttf|woff2?)$/.test(t)?"font":/\.css$/.test(t)?"stylesheet":/\.m?js$/.test(t)?"script":"other"}function Cq(e){let r=FA(e).split("/").filter(Boolean).at(-1);if(r){let n=Tq(e);return n==null?r:`${r}#${n}`}return e}function FA(e){try{return new URL(e,"https://example.invalid").pathname}catch{return e.split(/[?#]/,1)[0]??e}}function Tq(e){try{return new URL(e,"https://example.invalid").hash.slice(1)||null}catch{return e.split("#",2)[1]||null}}function Aq(e){return[...e.matchAll(/url\((["']?)(.*?)\1\)/g)].map(t=>t[2]?.trim()).filter(t=>!!t)}function Hh(e,t){try{return new URL(e,t||void 0).toString()}catch{return e}}function su(e,t){return t==null||t<0?"":e[t]??""}var od=class{constructor(t,r){this.cdp=t;this.security=r}cdp;security;inventoriesById=new Map;async list({documentUrl:t,tabId:r}){let[n,o]=await Promise.all([NA({cdp:this.cdp,tabId:r}),OA({cdp:this.cdp,tabId:r})]),i=this.createInventory({assets:n,documentUrl:t,inlineSvgs:o,tabId:r});return{assets:n,id:i,inlineSvgs:o,pageUrl:t??null,summary:{byKind:Dq(n),inlineSvgCount:o.length,totalCount:n.length}}}async bundle({assetIds:t,documentUrl:r,inventoryId:n,kinds:o,tabId:i}){let s=performance.now(),a=this.getAssets({assetIds:t,documentUrl:r,inventoryId:n,kinds:o,tabId:i});if(a==null)throw new Error("Asset inventory is no longer valid for this page");if(a.missingAssetIds.length>0)throw new Error("Asset bundle request included unknown asset ids");if(t!=null&&a.assets.some(w=>!UA(w)))throw new Error("Asset bundle request included unsupported asset kinds");let u=a.assets.filter(UA);if(u.length===0)throw new Error("Asset bundle request matched no discovered assets");await this.security.ensurePageAssetDownloadAllowed(r);let l=nd(Rq(),"browser-use","assets",BA());await kq(l,{recursive:!0});let d=new Map,p,f=Promise.resolve(),m=w=>{let x=$e(w)??w,E=d.get(x);if(E!=null)return E;let I=f.then(async()=>{if(p!=null)throw p;try{await this.security.ensurePageAssetFallbackFetchAllowed(r,w)}catch(T){throw p=T instanceof Error?T:new Error("Page asset fallback download approval failed"),p}});return d.set(x,I),f=I.catch(()=>{}),I},h=await Promise.all(u.map(w=>Nq({cdp:this.cdp,directoryPath:l,ensureFallbackFetchAllowed:m,inventoryAsset:w,tabId:i})));if(p!=null)throw await Iq(l,{force:!0,recursive:!0}),p;let _=h.flatMap(w=>w.asset==null?[]:[w.asset]),S=h.flatMap(w=>w.failure==null?[]:[w.failure]),D=nd(l,"manifest.json");return await Vh(D,JSON.stringify({assets:_,failures:S},null,2)),{assets:_,directoryPath:l,failures:S,manifestPath:D,summary:{downloadedCount:_.length,elapsedMs:performance.now()-s,failedCount:S.length,requestedCount:u.length}}}createInventory({assets:t,documentUrl:r,inlineSvgs:n,tabId:o}){let i=BA(),s=new Map;for(let a of t)s.set(a.id,{source:"page-asset",asset:a});for(let a of n)s.set(a.id,{source:"inline-svg",asset:a});return this.inventoriesById.set(i,{assetsById:s,documentUrl:r,tabId:o}),i}getAssets({assetIds:t,documentUrl:r,inventoryId:n,kinds:o,tabId:i}){let s=this.inventoriesById.get(n);if(s==null||s.documentUrl!==r||s.tabId!==i)return null;let a=t?.filter(l=>!s.assetsById.has(l))??[];return{assets:(t==null?[...s.assetsById.values()]:t.flatMap(l=>{let d=s.assetsById.get(l);return d==null?[]:[d]})).filter(l=>o==null||o.includes(l.source==="inline-svg"?"image":l.asset.kind)),missingAssetIds:a}}};function Dq(e){let t={font:0,image:0,other:0,script:0,stylesheet:0,video:0};for(let r of e)t[r.kind]+=1;return t}async function Nq({cdp:e,directoryPath:t,ensureFallbackFetchAllowed:r,inventoryAsset:n,tabId:o}){try{if(n.source==="inline-svg"){let l=nd(t,`${n.asset.id}.svg`);return await Vh(l,n.asset.markup),{asset:{contentType:"image/svg+xml",id:n.asset.id,kind:"image",name:n.asset.name,path:l,url:`inline-svg:${n.asset.id}`}}}let i=n.asset,s=await Mq({cdp:e,ensureFallbackFetchAllowed:r,tabId:o,url:i.url}),a=jq(s.contentType);if(!Lq(i,a)){let l=jA({contentType:a,inventoryAsset:n,reason:`Asset response type ${a??"missing"} is not valid for ${i.kind}`});return qA(i.kind,a,"content_type_mismatch"),{failure:l}}let u=nd(t,`${i.id}${Pq(qq(i.url))}`);return await Vh(u,Buffer.from(s.base64,"base64")),{asset:{contentType:s.contentType,id:i.id,kind:i.kind,name:i.name,path:u,url:i.url}}}catch(i){return qA(n.source==="inline-svg"?"image":n.asset.kind,null,"request_failed"),{failure:jA({contentType:null,inventoryAsset:n,reason:i instanceof Error?i.message:"Asset bundling failed"})}}}async function Oq({url:e}){let t=await fetch(e,{credentials:"include",method:"GET"});if(!t.ok)throw new Error(`Asset request failed with HTTP ${t.status}`);let r=new Uint8Array(await t.arrayBuffer()),n=32768,o="";for(let i=0;i<r.length;i+=n)o+=String.fromCharCode(...r.subarray(i,i+n));return{base64:btoa(o),contentType:t.headers.get("content-type")}}async function Mq({cdp:e,ensureFallbackFetchAllowed:t,tabId:r,url:n}){let o=await Bq({cdp:e,tabId:r}),i;try{if(o==null)throw new Error("Unable to determine frame id");return await Fq({cdp:e,frameId:o,tabId:r,url:n})}catch(s){i=s}await t(n);try{let s=await e.evaluateJavascript(r,`(${Oq.toString()})(${JSON.stringify({url:n})})`,{awaitPromise:!0});if(s==null)throw new Error("Unable to bundle asset");return s}catch(s){throw new Error(`Loaded resource fetch failed: ${LA(i)}; page fetch failed: ${LA(s)}`,{cause:s})}}async function Fq({cdp:e,frameId:t,tabId:r,url:n}){await e.call(r,"Page.enable");let[o,i]=await Promise.all([e.call(r,"Page.getResourceContent",{frameId:t,url:n}),e.call(r,"Page.getResourceTree")]);return{base64:o.base64Encoded===!0?o.content:Buffer.from(o.content).toString("base64"),contentType:$A(i.frameTree,n)}}function LA(e){return e instanceof Error?e.message:"Asset bundling failed"}async function Bq({cdp:e,tabId:t}){return(await e.call(t,"Page.getFrameTree")).frameTree?.frame?.id??null}function $A(e,t){if(e==null)return null;let r=e.resources?.find(n=>n.url===t)?.mimeType;if(r!=null)return r;for(let n of e.childFrames??[]){let o=$A(n,t);if(o!=null)return o}return null}function UA(e){if(e.source==="inline-svg")return!0;switch(e.asset.kind){case"font":case"image":case"stylesheet":case"video":return!0;case"other":case"script":return!1}}function Lq(e,t){return Uq(e.kind,t)||t==="application/octet-stream"&&iu(e.url)===e.kind}function Uq(e,t){if(t==null)return e==="stylesheet";switch(e){case"font":return t.startsWith("font/")||t==="application/font-woff"||t==="application/font-woff2"||t==="application/vnd.ms-fontobject"||t==="application/x-font-opentype"||t==="application/x-font-ttf";case"image":return t.startsWith("image/");case"stylesheet":return t==="text/css";case"video":return t.startsWith("video/")}}function jA({contentType:e,inventoryAsset:t,reason:r}){return t.source==="inline-svg"?{contentType:e,id:t.asset.id,name:t.asset.name,reason:r,url:`inline-svg:${t.asset.id}`}:{contentType:e,id:t.asset.id,name:t.asset.name,reason:r,url:t.asset.url}}function qA(e,t,r){Ot("browser_use_page_asset_bundle_failed",r,{assetKind:e,contentType:t??"missing",failureType:r})}function jq(e){let t=e?.split(";",1)[0]?.trim().toLowerCase();return t?/^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/.test(t)?t:"invalid":null}function qq(e){try{return new URL(e).pathname}catch{return e.split(/[?#]/,1)[0]??e}}var id=class{constructor(t,r){this.api=t;this.clientInfo=r}api;clientInfo;async create(){return await this.api.createTab()}async list(){return await this.api.getTabs()}async finalize(t){if(!Zc(this.clientInfo))throw new Error("browser.tabs.finalize is only available with Chrome or multi-tab IAB.");await this.api.finalizeTabs(t)}async get(t){let r=await this.list(),n=r.find(o=>o.id===t);if(n==null){let o=r.length?r.map(i=>`${i.id}|${i.title??"<no title>"}|${i.url??"<no url>"}`).join(", "):"none";throw new Error(`Tab not found: ${t}. Existing tabs: ${o}`)}return n}async getActive(){let r=(await this.list()).find(n=>n.active);if(r==null)throw new Error("No active tab found");return r}};var zA='"use strict";var PlaywrightInjected=(()=>{var hr=Object.defineProperty;var Oi=Object.getOwnPropertyDescriptor;var $i=Object.getOwnPropertyNames;var Pi=Object.prototype.hasOwnProperty;var Di=(r,e)=>{for(var t in e)hr(r,t,{get:e[t],enumerable:!0})},Hi=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $i(e))!Pi.call(r,i)&&i!==t&&hr(r,i,{get:()=>e[i],enumerable:!(n=Oi(e,i))||n.enumerable});return r};var qi=r=>Hi(hr({},"__esModule",{value:!0}),r);var xo={};Di(xo,{InjectedScript:()=>nn});function an(r,e){if(r.role!==e.role||r.name!==e.name||!Bi(r,e)||Fe(r)!==Fe(e))return!1;let t=Object.keys(r.props),n=Object.keys(e.props);return t.length===n.length&&t.every(i=>r.props[i]===e.props[i])}function Fe(r){return r.box.cursor==="pointer"}function Bi(r,e){return r.active===e.active&&r.checked===e.checked&&r.disabled===e.disabled&&r.expanded===e.expanded&&r.invalid===e.invalid&&r.selected===e.selected&&r.level===e.level&&r.pressed===e.pressed}function ln(r,e,t={}){var u;let n=new r.LineCounter,i={keepSourceTokens:!0,lineCounter:n,...t},s=r.parseDocument(e,i),o=[],a=f=>[n.linePos(f[0]),n.linePos(f[1])],l=f=>{o.push({message:f.message,range:[n.linePos(f.pos[0]),n.linePos(f.pos[1])]})},c=(f,h)=>{for(let g of h.items){if(g instanceof r.Scalar&&typeof g.value=="string"){let E=Pt.parse(g,i,o);E&&(f.children=f.children||[],f.children.push(E));continue}if(g instanceof r.YAMLMap){p(f,g);continue}o.push({message:"Sequence items should be strings or maps",range:a(g.range||h.range)})}},p=(f,h)=>{var g;for(let m of h.items){if(f.children=f.children||[],!(m.key instanceof r.Scalar&&typeof m.key.value=="string")){o.push({message:"Only string keys are supported",range:a(m.key.range||h.range)});continue}let E=m.key,y=m.value;if(E.value==="text"){if(!(y instanceof r.Scalar&&typeof y.value=="string")){o.push({message:"Text value should be a string",range:a(m.value.range||h.range)});continue}f.children.push({kind:"text",text:fr(y.value)});continue}if(E.value==="/children"){if(!(y instanceof r.Scalar&&typeof y.value=="string")||y.value!=="contain"&&y.value!=="equal"&&y.value!=="deep-equal"){o.push({message:\'Strict value should be "contain", "equal" or "deep-equal"\',range:a(m.value.range||h.range)});continue}f.containerMode=y.value;continue}if(E.value.startsWith("/")){if(!(y instanceof r.Scalar&&typeof y.value=="string")){o.push({message:"Property value should be a string",range:a(m.value.range||h.range)});continue}f.props=(g=f.props)!=null?g:{},f.props[E.value.slice(1)]=fr(y.value);continue}let D=Pt.parse(E,i,o);if(!D)continue;if(y instanceof r.Scalar){let N=typeof y.value;if(N!=="string"&&N!=="number"&&N!=="boolean"){o.push({message:"Node value should be a string or a sequence",range:a(m.value.range||h.range)});continue}f.children.push({...D,children:[{kind:"text",text:fr(String(y.value))}]});continue}if(y instanceof r.YAMLSeq){f.children.push(D),c(D,y);continue}o.push({message:"Map values should be strings or sequences",range:a(m.value.range||h.range)})}},d={kind:"role",role:"fragment"};return s.errors.forEach(l),o.length?{errors:o,fragment:d}:(s.contents instanceof r.YAMLSeq||o.push({message:\'Aria snapshot must be a YAML sequence, elements starting with " -"\',range:s.contents?a(s.contents.range):[{line:0,col:0},{line:0,col:0}]}),o.length?{errors:o,fragment:d}:(c(d,s.contents),o.length?{errors:o,fragment:Fi}:((u=d.children)==null?void 0:u.length)===1&&(!d.containerMode||d.containerMode==="contain")?{fragment:d.children[0],errors:[]}:{fragment:d,errors:[]}))}var Fi={kind:"role",role:"fragment"};function cn(r){return r.replace(/[\\u200b\\u00ad]/g,"").replace(/[\\r\\n\\s\\t]+/g," ").trim()}function fr(r){return{raw:r,normalized:cn(r)}}var Pt=class r{static parse(e,t,n){try{return new r(e.value)._parse()}catch(i){if(i instanceof Dt){let s=t.prettyErrors===!1?i.message:i.message+`:\n\n`+e.value+`\n`+" ".repeat(i.pos)+`^\n`;return n.push({message:s,range:[t.lineCounter.linePos(e.range[0]),t.lineCounter.linePos(e.range[0]+i.pos)]}),null}throw i}}constructor(e){this._input=e,this._pos=0,this._length=e.length}_peek(){return this._input[this._pos]||""}_next(){return this._pos<this._length?this._input[this._pos++]:null}_eof(){return this._pos>=this._length}_isWhitespace(){return!this._eof()&&/\\s/.test(this._peek())}_skipWhitespace(){for(;this._isWhitespace();)this._pos++}_readIdentifier(e){this._eof()&&this._throwError(`Unexpected end of input when expecting ${e}`);let t=this._pos;for(;!this._eof()&&/[a-zA-Z]/.test(this._peek());)this._pos++;return this._input.slice(t,this._pos)}_readString(){let e="",t=!1;for(;!this._eof();){let n=this._next();if(t)e+=n,t=!1;else if(n==="\\\\")t=!0;else{if(n===\'"\')return e;e+=n}}this._throwError("Unterminated string")}_throwError(e,t=0){throw new Dt(e,t||this._pos)}_readRegex(){let e="",t=!1,n=!1;for(;!this._eof();){let i=this._next();if(t)e+=i,t=!1;else if(i==="\\\\")t=!0,e+=i;else{if(i==="/"&&!n)return{pattern:e};i==="["?(n=!0,e+=i):i==="]"&&n?(e+=i,n=!1):e+=i}}this._throwError("Unterminated regex")}_readStringOrRegex(){let e=this._peek();return e===\'"\'?(this._next(),cn(this._readString())):e==="/"?(this._next(),this._readRegex()):null}_readAttributes(e){let t=this._pos;for(;this._skipWhitespace(),this._peek()==="[";){this._next(),this._skipWhitespace(),t=this._pos;let n=this._readIdentifier("attribute");this._skipWhitespace();let i="";if(this._peek()==="=")for(this._next(),this._skipWhitespace(),t=this._pos;this._peek()!=="]"&&!this._isWhitespace()&&!this._eof();)i+=this._next();this._skipWhitespace(),this._peek()!=="]"&&this._throwError("Expected ]"),this._next(),this._applyAttribute(e,n,i||"true",t)}}_parse(){this._skipWhitespace();let e=this._readIdentifier("role");this._skipWhitespace();let t=this._readStringOrRegex()||"",n={kind:"role",role:e,name:t};return this._readAttributes(n),this._skipWhitespace(),this._eof()||this._throwError("Unexpected input"),n}_applyAttribute(e,t,n,i){if(t==="checked"){this._assert(n==="true"||n==="false"||n==="mixed",\'Value of "checked" attribute must be a boolean or "mixed"\',i),e.checked=n==="true"?!0:n==="false"?!1:"mixed";return}if(t==="disabled"){this._assert(n==="true"||n==="false",\'Value of "disabled" attribute must be a boolean\',i),e.disabled=n==="true";return}if(t==="expanded"){this._assert(n==="true"||n==="false",\'Value of "expanded" attribute must be a boolean\',i),e.expanded=n==="true";return}if(t==="active"){this._assert(n==="true"||n==="false",\'Value of "active" attribute must be a boolean\',i),e.active=n==="true";return}if(t==="invalid"){this._assert(n==="true"||n==="false"||n==="grammar"||n==="spelling",\'Value of "invalid" attribute must be a boolean, "grammar" or "spelling"\',i),e.invalid=n==="true"?!0:n==="false"?!1:n;return}if(t==="level"){this._assert(!isNaN(Number(n)),\'Value of "level" attribute must be a number\',i),e.level=Number(n);return}if(t==="pressed"){this._assert(n==="true"||n==="false"||n==="mixed",\'Value of "pressed" attribute must be a boolean or "mixed"\',i),e.pressed=n==="true"?!0:n==="false"?!1:"mixed";return}if(t==="selected"){this._assert(n==="true"||n==="false",\'Value of "selected" attribute must be a boolean\',i),e.selected=n==="true";return}this._assert(!1,`Unsupported attribute [${t}]`,i)}_assert(e,t,n){e||this._throwError(t||"Assertion error",n)}},Dt=class extends Error{constructor(e,t){super(e),this.pos=t}};function un(r,e){var o,a;function t(l,c,p){let d=1,u=p+d;for(let f of l.children||[])typeof f=="string"?(d++,u++):(d+=t(f,c,u),u+=d);if(!["none","presentation","fragment","iframe","generic"].includes(l.role)&&l.name){let f=c.get(l.role);f||(f=new Map,c.set(l.role,f));let h=f.get(l.name),g=d*100-p;(!h||h.sizeAndPosition<g)&&f.set(l.name,{node:l,sizeAndPosition:g})}return d}let n=new Map;r&&t(r,n,0);let i=new Map;t(e,i,0);let s=[];for(let[l,c]of i)for(let[p,d]of c)(o=n.get(l))!=null&&o.get(p)||s.push(d);return s.sort((l,c)=>c.sizeAndPosition-l.sizeAndPosition),(a=s[0])==null?void 0:a.node}var R=function(r,e,t){return r>=e&&r<=t};function B(r){return R(r,48,57)}function dn(r){return B(r)||R(r,65,70)||R(r,97,102)}function ji(r){return R(r,65,90)}function Wi(r){return R(r,97,122)}function Vi(r){return ji(r)||Wi(r)}function zi(r){return r>=128}function Ht(r){return Vi(r)||zi(r)||r===95}function hn(r){return Ht(r)||B(r)||r===45}function Qi(r){return R(r,0,8)||r===11||R(r,14,31)||r===127}function _e(r){return r===10}function J(r){return _e(r)||r===9||r===32}var Gi=1114111,Ue=class extends Error{constructor(e){super(e),this.name="InvalidCharacterError"}};function Ji(r){let e=[];for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===13&&r.charCodeAt(t+1)===10&&(n=10,t++),(n===13||n===12)&&(n=10),n===0&&(n=65533),R(n,55296,56319)&&R(r.charCodeAt(t+1),56320,57343)){let i=n-55296,s=r.charCodeAt(t+1)-56320;n=Math.pow(2,16)+i*Math.pow(2,10)+s,t++}e.push(n)}return e}function M(r){if(r<=65535)return String.fromCharCode(r);r-=Math.pow(2,16);let e=Math.floor(r/Math.pow(2,10))+55296,t=r%Math.pow(2,10)+56320;return String.fromCharCode(e)+String.fromCharCode(t)}function qt(r){let e=Ji(r),t=-1,n=[],i,s=0,o=0,a=0,l=function(){s+=1,a=o,o=0},c={line:s,column:o},p=function(x){return x>=e.length?-1:e[x]},d=function(x){if(x===void 0&&(x=1),x>3)throw"Spec Error: no more than three codepoints of lookahead.";return p(t+x)},u=function(x){return x===void 0&&(x=1),t+=x,i=p(t),_e(i)?l():o+=x,!0},f=function(){return t-=1,_e(i)?(s-=1,o=a):o-=1,c.line=s,c.column=o,!0},h=function(x){return x===void 0&&(x=i),x===-1},g=function(){},m=function(){},S=function(){if(E(),u(),J(i)){for(;J(d());)u();return new ne}else{if(i===34)return Ae();if(i===35)if(hn(d())||G(d(1),d(2))){let x=new tt("");return H(d(1),d(2),d(3))&&(x.type="id"),x.value=$t(),x}else return new _(i);else return i===36?d()===61?(u(),new br):new _(i):i===39?Ae():i===40?new Ke:i===41?new he:i===42?d()===61?(u(),new xr):new _(i):i===43?cr()?(f(),y()):new _(i):i===44?new Ge:i===45?cr()?(f(),y()):d(1)===45&&d(2)===62?(u(2),new Ve):U()?(f(),D()):new _(i):i===46?cr()?(f(),y()):new _(i):i===58?new ze:i===59?new Qe:i===60?d(1)===33&&d(2)===45&&d(3)===45?(u(3),new We):new _(i):i===64?H(d(1),d(2),d(3))?new et($t()):new _(i):i===91?new Xe:i===92?b()?(f(),D()):(m(),new _(i)):i===93?new Ce:i===94?d()===61?(u(),new mr):new _(i):i===123?new Je:i===124?d()===61?(u(),new gr):d()===124?(u(),new Ze):new _(i):i===125?new Ye:i===126?d()===61?(u(),new pr):new _(i):B(i)?(f(),y()):Ht(i)?(f(),D()):h()?new fe:new _(i)}},E=function(){for(;d(1)===47&&d(2)===42;)for(u(2);;)if(u(),i===42&&d()===47){u();break}else if(h()){m();return}},y=function(){let x=Ri();if(H(d(1),d(2),d(3))){let w=new Er;return w.value=x.value,w.repr=x.repr,w.type=x.type,w.unit=$t(),w}else if(d()===37){u();let w=new it;return w.value=x.value,w.repr=x.repr,w}else{let w=new nt;return w.value=x.value,w.repr=x.repr,w.type=x.type,w}},D=function(){let x=$t();if(x.toLowerCase()==="url"&&d()===40){for(u();J(d(1))&&J(d(2));)u();return d()===34||d()===39?new Y(x):J(d())&&(d(2)===34||d(2)===39)?new Y(x):re()}else return d()===40?(u(),new Y(x)):new pe(x)},Ae=function(x){x===void 0&&(x=i);let w="";for(;u();){if(i===x||h())return new ge(w);if(_e(i))return m(),f(),new je;i===92?h(d())?g():_e(d())?u():w+=M(N()):w+=M(i)}throw new Error("Internal error")},re=function(){let x=new rt("");for(;J(d());)u();if(h(d()))return x;for(;u();){if(i===41||h())return x;if(J(i)){for(;J(d());)u();return d()===41||h(d())?(u(),x):(ur(),new de)}else{if(i===34||i===39||i===40||Qi(i))return m(),ur(),new de;if(i===92)if(b())x.value+=M(N());else return m(),ur(),new de;else x.value+=M(i)}}throw new Error("Internal error")},N=function(){if(u(),dn(i)){let x=[i];for(let j=0;j<5&&dn(d());j++)u(),x.push(i);J(d())&&u();let w=parseInt(x.map(function(j){return String.fromCharCode(j)}).join(""),16);return w>Gi&&(w=65533),w}else return h()?65533:i},G=function(x,w){return!(x!==92||_e(w))},b=function(){return G(i,d())},H=function(x,w,j){return x===45?Ht(w)||w===45||G(w,j):Ht(x)?!0:x===92?G(x,w):!1},U=function(){return H(i,d(1),d(2))},Ni=function(x,w,j){return x===43||x===45?!!(B(w)||w===46&&B(j)):x===46?!!B(w):!!B(x)},cr=function(){return Ni(i,d(1),d(2))},$t=function(){let x="";for(;u();)if(hn(i))x+=M(i);else if(b())x+=M(N());else return f(),x;throw new Error("Internal parse error")},Ri=function(){let x="",w="integer";for((d()===43||d()===45)&&(u(),x+=M(i));B(d());)u(),x+=M(i);if(d(1)===46&&B(d(2)))for(u(),x+=M(i),u(),x+=M(i),w="number";B(d());)u(),x+=M(i);let j=d(1),dr=d(2),Ii=d(3);if((j===69||j===101)&&B(dr))for(u(),x+=M(i),u(),x+=M(i),w="number";B(d());)u(),x+=M(i);else if((j===69||j===101)&&(dr===43||dr===45)&&B(Ii))for(u(),x+=M(i),u(),x+=M(i),u(),x+=M(i),w="number";B(d());)u(),x+=M(i);let Mi=Li(x);return{type:w,value:Mi,repr:x}},Li=function(x){return+x},ur=function(){for(;u();){if(i===41||h())return;b()&&N(),g()}},on=0;for(;!h(d());)if(n.push(S()),on++,on>e.length*2)throw new Error("I\'m infinite-looping!");return n}var T=class{constructor(){this.tokenType=""}toJSON(){return{token:this.tokenType}}toString(){return this.tokenType}toSource(){return""+this}},je=class extends T{constructor(){super(...arguments);this.tokenType="BADSTRING"}},de=class extends T{constructor(){super(...arguments);this.tokenType="BADURL"}},ne=class extends T{constructor(){super(...arguments);this.tokenType="WHITESPACE"}toString(){return"WS"}toSource(){return" "}},We=class extends T{constructor(){super(...arguments);this.tokenType="CDO"}toSource(){return"<!--"}},Ve=class extends T{constructor(){super(...arguments);this.tokenType="CDC"}toSource(){return"-->"}},ze=class extends T{constructor(){super(...arguments);this.tokenType=":"}},Qe=class extends T{constructor(){super(...arguments);this.tokenType=";"}},Ge=class extends T{constructor(){super(...arguments);this.tokenType=","}},ie=class extends T{constructor(){super(...arguments);this.value="";this.mirror=""}},Je=class extends ie{constructor(){super();this.tokenType="{";this.value="{",this.mirror="}"}},Ye=class extends ie{constructor(){super();this.tokenType="}";this.value="}",this.mirror="{"}},Xe=class extends ie{constructor(){super();this.tokenType="[";this.value="[",this.mirror="]"}},Ce=class extends ie{constructor(){super();this.tokenType="]";this.value="]",this.mirror="["}},Ke=class extends ie{constructor(){super();this.tokenType="(";this.value="(",this.mirror=")"}},he=class extends ie{constructor(){super();this.tokenType=")";this.value=")",this.mirror="("}},pr=class extends T{constructor(){super(...arguments);this.tokenType="~="}},gr=class extends T{constructor(){super(...arguments);this.tokenType="|="}},mr=class extends T{constructor(){super(...arguments);this.tokenType="^="}},br=class extends T{constructor(){super(...arguments);this.tokenType="$="}},xr=class extends T{constructor(){super(...arguments);this.tokenType="*="}},Ze=class extends T{constructor(){super(...arguments);this.tokenType="||"}},fe=class extends T{constructor(){super(...arguments);this.tokenType="EOF"}toSource(){return""}},_=class extends T{constructor(t){super();this.tokenType="DELIM";this.value="";this.value=M(t)}toString(){return"DELIM("+this.value+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t}toSource(){return this.value==="\\\\"?`\\\\\n`:this.value}},se=class extends T{constructor(){super(...arguments);this.value=""}ASCIIMatch(t){return this.value.toLowerCase()===t.toLowerCase()}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t}},pe=class extends se{constructor(t){super();this.tokenType="IDENT";this.value=t}toString(){return"IDENT("+this.value+")"}toSource(){return st(this.value)}},Y=class extends se{constructor(t){super();this.tokenType="FUNCTION";this.value=t,this.mirror=")"}toString(){return"FUNCTION("+this.value+")"}toSource(){return st(this.value)+"("}},et=class extends se{constructor(t){super();this.tokenType="AT-KEYWORD";this.value=t}toString(){return"AT("+this.value+")"}toSource(){return"@"+st(this.value)}},tt=class extends se{constructor(t){super();this.tokenType="HASH";this.value=t,this.type="unrestricted"}toString(){return"HASH("+this.value+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t.type=this.type,t}toSource(){return this.type==="id"?"#"+st(this.value):"#"+Yi(this.value)}},ge=class extends se{constructor(t){super();this.tokenType="STRING";this.value=t}toString(){return\'"\'+fn(this.value)+\'"\'}},rt=class extends se{constructor(t){super();this.tokenType="URL";this.value=t}toString(){return"URL("+this.value+")"}toSource(){return\'url("\'+fn(this.value)+\'")\'}},nt=class extends T{constructor(){super();this.tokenType="NUMBER";this.type="integer",this.repr=""}toString(){return this.type==="integer"?"INT("+this.value+")":"NUMBER("+this.value+")"}toJSON(){let t=super.toJSON();return t.value=this.value,t.type=this.type,t.repr=this.repr,t}toSource(){return this.repr}},it=class extends T{constructor(){super();this.tokenType="PERCENTAGE";this.repr=""}toString(){return"PERCENTAGE("+this.value+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t.repr=this.repr,t}toSource(){return this.repr+"%"}},Er=class extends T{constructor(){super();this.tokenType="DIMENSION";this.type="integer",this.repr="",this.unit=""}toString(){return"DIM("+this.value+","+this.unit+")"}toJSON(){let t=this.constructor.prototype.constructor.prototype.toJSON.call(this);return t.value=this.value,t.type=this.type,t.repr=this.repr,t.unit=this.unit,t}toSource(){let t=this.repr,n=st(this.unit);return n[0].toLowerCase()==="e"&&(n[1]==="-"||R(n.charCodeAt(1),48,57))&&(n="\\\\65 "+n.slice(1,n.length)),t+n}};function st(r){r=""+r;let e="",t=r.charCodeAt(0);for(let n=0;n<r.length;n++){let i=r.charCodeAt(n);if(i===0)throw new Ue("Invalid character: the input contains U+0000.");R(i,1,31)||i===127||n===0&&R(i,48,57)||n===1&&R(i,48,57)&&t===45?e+="\\\\"+i.toString(16)+" ":i>=128||i===45||i===95||R(i,48,57)||R(i,65,90)||R(i,97,122)?e+=r[n]:e+="\\\\"+r[n]}return e}function Yi(r){r=""+r;let e="";for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===0)throw new Ue("Invalid character: the input contains U+0000.");n>=128||n===45||n===95||R(n,48,57)||R(n,65,90)||R(n,97,122)?e+=r[t]:e+="\\\\"+n.toString(16)+" "}return e}function fn(r){r=""+r;let e="";for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===0)throw new Ue("Invalid character: the input contains U+0000.");R(n,1,31)||n===127?e+="\\\\"+n.toString(16)+" ":n===34||n===92?e+="\\\\"+r[t]:e+=r[t]}return e}var O=class extends Error{};function gn(r,e){let t;try{t=qt(r),t[t.length-1]instanceof fe||t.push(new fe)}catch(b){let H=b.message+` while parsing css selector "${r}". Did you mean to CSS.escape it?`,U=(b.stack||"").indexOf(b.message);throw U!==-1&&(b.stack=b.stack.substring(0,U)+H+b.stack.substring(U+b.message.length)),b.message=H,b}let n=t.find(b=>b instanceof et||b instanceof je||b instanceof de||b instanceof Ze||b instanceof We||b instanceof Ve||b instanceof Qe||b instanceof Je||b instanceof Ye||b instanceof rt||b instanceof it);if(n)throw new O(`Unsupported token "${n.toSource()}" while parsing css selector "${r}". Did you mean to CSS.escape it?`);let i=0,s=new Set;function o(){return new O(`Unexpected token "${t[i].toSource()}" while parsing css selector "${r}". Did you mean to CSS.escape it?`)}function a(){for(;t[i]instanceof ne;)i++}function l(b=i){return t[b]instanceof pe}function c(b=i){return t[b]instanceof ge}function p(b=i){return t[b]instanceof nt}function d(b=i){return t[b]instanceof Ge}function u(b=i){return t[b]instanceof Ke}function f(b=i){return t[b]instanceof he}function h(b=i){return t[b]instanceof Y}function g(b=i){return t[b]instanceof _&&t[b].value==="*"}function m(b=i){return t[b]instanceof fe}function S(b=i){return t[b]instanceof _&&[">","+","~"].includes(t[b].value)}function E(b=i){return d(b)||f(b)||m(b)||S(b)||t[b]instanceof ne}function y(){let b=[D()];for(;a(),!!d();)i++,b.push(D());return b}function D(){return a(),p()||c()?t[i++].value:Ae()}function Ae(){let b={simples:[]};for(a(),S()?b.simples.push({selector:{functions:[{name:"scope",args:[]}]},combinator:""}):b.simples.push({selector:re(),combinator:""});;){if(a(),S())b.simples[b.simples.length-1].combinator=t[i++].value,a();else if(E())break;b.simples.push({combinator:"",selector:re()})}return b}function re(){let b="",H=[];for(;!E();)if(l()||g())b+=t[i++].toSource();else if(t[i]instanceof tt)b+=t[i++].toSource();else if(t[i]instanceof _&&t[i].value===".")if(i++,l())b+="."+t[i++].toSource();else throw o();else if(t[i]instanceof ze)if(i++,l())if(!e.has(t[i].value.toLowerCase()))b+=":"+t[i++].toSource();else{let U=t[i++].value.toLowerCase();H.push({name:U,args:[]}),s.add(U)}else if(h()){let U=t[i++].value.toLowerCase();if(e.has(U)?(H.push({name:U,args:y()}),s.add(U)):b+=`:${U}(${N()})`,a(),!f())throw o();i++}else throw o();else if(t[i]instanceof Xe){for(b+="[",i++;!(t[i]instanceof Ce)&&!m();)b+=t[i++].toSource();if(!(t[i]instanceof Ce))throw o();b+="]",i++}else throw o();if(!b&&!H.length)throw o();return{css:b||void 0,functions:H}}function N(){let b="",H=1;for(;!m()&&((u()||h())&&H++,f()&&H--,!!H);)b+=t[i++].toSource();return b}let G=y();if(!m())throw o();if(G.some(b=>typeof b!="object"||!("simples"in b)))throw new O(`Error while parsing css selector "${r}". Did you mean to CSS.escape it?`);return{selector:G,names:Array.from(s)}}var Sr=new Set(["internal:has","internal:has-not","internal:and","internal:or","internal:chain","left-of","right-of","above","below","near"]),Xi=new Set(["left-of","right-of","above","below","near"]),yr=new Set(["not","is","where","has","scope","light","visible","text","text-matches","text-is","has-text","above","below","right-of","left-of","near","nth-match"]);function ot(r){let e=Zi(r),t=[];for(let n of e.parts){if(n.name==="css"||n.name==="css:light"){n.name==="css:light"&&(n.body=":light("+n.body+")");let i=gn(n.body,yr);t.push({name:"css",body:i.selector,source:n.body});continue}if(Sr.has(n.name)){let i,s;try{let c=JSON.parse("["+n.body+"]");if(!Array.isArray(c)||c.length<1||c.length>2||typeof c[0]!="string")throw new O(`Malformed selector: ${n.name}=`+n.body);if(i=c[0],c.length===2){if(typeof c[1]!="number"||!Xi.has(n.name))throw new O(`Malformed selector: ${n.name}=`+n.body);s=c[1]}}catch{throw new O(`Malformed selector: ${n.name}=`+n.body)}let o={name:n.name,source:n.body,body:{parsed:ot(i),distance:s}},a=[...o.body.parsed.parts].reverse().find(c=>c.name==="internal:control"&&c.body==="enter-frame"),l=a?o.body.parsed.parts.indexOf(a):-1;l!==-1&&Ki(o.body.parsed.parts.slice(0,l+1),t.slice(0,l+1))&&o.body.parsed.parts.splice(0,l+1),t.push(o);continue}t.push({...n,source:n.body})}if(Sr.has(t[0].name))throw new O(`"${t[0].name}" selector cannot be first`);return{capture:e.capture,parts:t}}function Ki(r,e){return $({parts:r})===$({parts:e})}function $(r,e){return typeof r=="string"?r:r.parts.map((t,n)=>{let i=!0;!e&&n!==r.capture&&(t.name==="css"||t.name==="xpath"&&t.source.startsWith("//")||t.source.startsWith(".."))&&(i=!1);let s=i?t.name+"=":"";return`${n===r.capture?"*":""}${s}${t.source}`}).join(" >> ")}function mn(r,e){let t=(n,i)=>{for(let s of n.parts)e(s,i),Sr.has(s.name)&&t(s.body.parsed,!0)};t(r,!1)}function Zi(r){let e=0,t,n=0,i={parts:[]},s=()=>{let a=r.substring(n,e).trim(),l=a.indexOf("="),c,p;l!==-1&&a.substring(0,l).trim().match(/^[a-zA-Z_0-9-+:*]+$/)?(c=a.substring(0,l).trim(),p=a.substring(l+1)):a.length>1&&a[0]===\'"\'&&a[a.length-1]===\'"\'||a.length>1&&a[0]==="\'"&&a[a.length-1]==="\'"?(c="text",p=a):/^\\(*\\/\\//.test(a)||a.startsWith("..")?(c="xpath",p=a):(c="css",p=a);let d=!1;if(c[0]==="*"&&(d=!0,c=c.substring(1)),i.parts.push({name:c,body:p}),d){if(i.capture!==void 0)throw new O("Only one of the selectors can capture using * modifier");i.capture=i.parts.length-1}};if(!r.includes(">>"))return e=r.length,s(),i;let o=()=>{let l=r.substring(n,e).match(/^\\s*text\\s*=(.*)$/);return!!l&&!!l[1]};for(;e<r.length;){let a=r[e];a==="\\\\"&&e+1<r.length?e+=2:a===t?(t=void 0,e++):!t&&(a===\'"\'||a==="\'"||a==="`")&&!o()?(t=a,e++):!t&&a===">"&&r[e+1]===">"?(s(),e+=2,n=e):e++}return s(),i}function X(r,e){let t=0,n=r.length===0,i=()=>r[t]||"",s=()=>{let m=i();return++t,n=t>=r.length,m},o=m=>{throw n?new O(`Unexpected end of selector while parsing selector \\`${r}\\``):new O(`Error while parsing selector \\`${r}\\` - unexpected symbol "${i()}" at position ${t}`+(m?" during "+m:""))};function a(){for(;!n&&/\\s/.test(i());)s()}function l(m){return m>="\\x80"||m>="0"&&m<="9"||m>="A"&&m<="Z"||m>="a"&&m<="z"||m>="0"&&m<="9"||m==="_"||m==="-"}function c(){let m="";for(a();!n&&l(i());)m+=s();return m}function p(m){let S=s();for(S!==m&&o("parsing quoted string");!n&&i()!==m;)i()==="\\\\"&&s(),S+=s();return i()!==m&&o("parsing quoted string"),S+=s(),S}function d(){s()!=="/"&&o("parsing regular expression");let m="",S=!1;for(;!n;){if(i()==="\\\\")m+=s(),n&&o("parsing regular expression");else if(S&&i()==="]")S=!1;else if(!S&&i()==="[")S=!0;else if(!S&&i()==="/")break;m+=s()}s()!=="/"&&o("parsing regular expression");let E="";for(;!n&&i().match(/[dgimsuy]/);)E+=s();try{return new RegExp(m,E)}catch(y){throw new O(`Error while parsing selector \\`${r}\\`: ${y.message}`)}}function u(){let m="";return a(),i()==="\'"||i()===\'"\'?m=p(i()).slice(1,-1):m=c(),m||o("parsing property path"),m}function f(){a();let m="";return n||(m+=s()),!n&&m!=="="&&(m+=s()),["=","*=","^=","$=","|=","~="].includes(m)||o("parsing operator"),m}function h(){s();let m=[];for(m.push(u()),a();i()===".";)s(),m.push(u()),a();if(i()==="]")return s(),{name:m.join("."),jsonPath:m,op:"<truthy>",value:null,caseSensitive:!1};let S=f(),E,y=!0;if(a(),i()==="/"){if(S!=="=")throw new O(`Error while parsing selector \\`${r}\\` - cannot use ${S} in attribute with regular expression`);E=d()}else if(i()==="\'"||i()===\'"\')E=p(i()).slice(1,-1),a(),i()==="i"||i()==="I"?(y=!1,s()):(i()==="s"||i()==="S")&&(y=!0,s());else{for(E="";!n&&(l(i())||i()==="+"||i()===".");)E+=s();E==="true"?E=!0:E==="false"?E=!1:e||(E=+E,Number.isNaN(E)&&o("parsing attribute value"))}if(a(),i()!=="]"&&o("parsing attribute value"),s(),S!=="="&&typeof E!="string")throw new O(`Error while parsing selector \\`${r}\\` - cannot use ${S} in attribute with non-string matching value - ${E}`);return{name:m.join("."),jsonPath:m,op:S,value:E,caseSensitive:y}}let g={name:"",attributes:[]};for(g.name=c(),a();i()==="[";)g.attributes.push(h()),a();if(n||o(void 0),!g.name&&!g.attributes.length)throw new O(`Error while parsing selector \\`${r}\\` - selector cannot be empty`);return g}function at(r,e="\'"){let t=JSON.stringify(r),n=t.substring(1,t.length-1).replace(/\\\\"/g,\'"\');if(e==="\'")return e+n.replace(/[\']/g,"\\\\\'")+e;if(e===\'"\')return e+n.replace(/["]/g,\'\\\\"\')+e;if(e==="`")return e+n.replace(/[`]/g,"\\\\`")+e;throw new Error("Invalid escape char")}function lt(r){return r.charAt(0).toUpperCase()+r.substring(1)}function wr(r){return r.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z])([A-Z][a-z])/g,"$1_$2").toLowerCase()}function be(r){return`"${r.replace(/["\\\\]/g,e=>"\\\\"+e)}"`}var me;function bn(){me=new Map}function v(r){let e=me==null?void 0:me.get(r);return e===void 0&&(e=r.replace(/[\\u200b\\u00ad]/g,"").trim().replace(/\\s+/g," "),me==null||me.set(r,e)),e}function ct(r){return r.replace(/(^|[^\\\\])(\\\\\\\\)*\\\\([\'"`])/g,"$1$2$3")}function xn(r){return r.unicode||r.unicodeSets?String(r):String(r).replace(/(^|[^\\\\])(\\\\\\\\)*(["\'`])/g,"$1$2\\\\$3").replace(/>>/g,"\\\\>\\\\>")}function q(r,e){return typeof r!="string"?xn(r):`${JSON.stringify(r)}${e?"s":"i"}`}function L(r,e){return typeof r!="string"?xn(r):`"${r.replace(/\\\\/g,"\\\\\\\\").replace(/["]/g,\'\\\\"\')}"${e?"s":"i"}`}function es(r,e,t=""){if(r.length<=e)return r;let n=[...r];return n.length>e?n.slice(0,e-t.length).join("")+t:n.join("")}function vr(r,e){return es(r,e,"\\u2026")}function ke(r){return r.replace(/[.*+?^${}()|[\\]\\\\]/g,"\\\\$&")}function En(r,e){let t=r.length,n=e.length,i=0,s=0,o=Array(t+1).fill(null).map(()=>Array(n+1).fill(0));for(let a=1;a<=t;a++)for(let l=1;l<=n;l++)r[a-1]===e[l-1]&&(o[a][l]=o[a-1][l-1]+1,o[a][l]>i&&(i=o[a][l],s=a));return r.slice(s-i,s)}var Ao=new RegExp("([\\\\u001B\\\\u009B][[\\\\]()#?]*(?:(?:(?:[a-zA-Z\\\\d]*(?:;[-a-zA-Z\\\\d\\\\/#&.:=?%@~_]*)*)?\\\\u0007)|(?:(?:\\\\d{0,4}(?:;\\\\d{0,4})*)?[\\\\dA-PR-TZcf-ntqry=><~])))","g");function K(r,e,t=!1){return ts(r,e,t,1)[0]}function ts(r,e,t=!1,n=20,i){try{return Ne(new ns[r](i),ot(e),t,n)}catch{return[e]}}function Ne(r,e,t=!1,n=20){let i=[...e.parts],s=[],o=t?"frame-locator":"page";for(let a=0;a<i.length;a++){let l=i[a],c=o;if(o="locator",l.name==="internal:describe")continue;if(l.name==="nth"){l.body==="0"?s.push([r.generateLocator(c,"first",""),r.generateLocator(c,"nth","0")]):l.body==="-1"?s.push([r.generateLocator(c,"last",""),r.generateLocator(c,"nth","-1")]):s.push([r.generateLocator(c,"nth",l.body)]);continue}if(l.name==="visible"){s.push([r.generateLocator(c,"visible",l.body),r.generateLocator(c,"default",`visible=${l.body}`)]);continue}if(l.name==="internal:text"){let{exact:h,text:g}=ut(l.body);s.push([r.generateLocator(c,"text",g,{exact:h})]);continue}if(l.name==="internal:has-text"){let{exact:h,text:g}=ut(l.body);if(!h){s.push([r.generateLocator(c,"has-text",g,{exact:h})]);continue}}if(l.name==="internal:has-not-text"){let{exact:h,text:g}=ut(l.body);if(!h){s.push([r.generateLocator(c,"has-not-text",g,{exact:h})]);continue}}if(l.name==="internal:has"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"has",g)));continue}if(l.name==="internal:has-not"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"hasNot",g)));continue}if(l.name==="internal:and"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"and",g)));continue}if(l.name==="internal:or"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"or",g)));continue}if(l.name==="internal:chain"){let h=Ne(r,l.body.parsed,!1,n);s.push(h.map(g=>r.generateLocator(c,"chain",g)));continue}if(l.name==="internal:label"){let{exact:h,text:g}=ut(l.body);s.push([r.generateLocator(c,"label",g,{exact:h})]);continue}if(l.name==="internal:role"){let h=X(l.body,!0),g={attrs:[]};for(let m of h.attributes)if(m.name==="name"){if(g.exact!==void 0&&g.exact!==m.caseSensitive)throw new Error(`Conflicting exactness in internal:role selector: ${$({parts:[l]})}`);g.exact=m.caseSensitive,g.name=m.value}else if(m.name==="description"){if(g.exact!==void 0&&g.exact!==m.caseSensitive)throw new Error(`Conflicting exactness in internal:role selector: ${$({parts:[l]})}`);g.exact=m.caseSensitive,g.description=m.value}else m.name==="level"&&typeof m.value=="string"&&(m.value=+m.value),g.attrs.push({name:m.name==="include-hidden"?"includeHidden":m.name,value:m.value});s.push([r.generateLocator(c,"role",h.name,g)]);continue}if(l.name==="internal:testid"){let h=X(l.body,!0),{value:g}=h.attributes[0];s.push([r.generateLocator(c,"test-id",g)]);continue}if(l.name==="internal:attr"){let h=X(l.body,!0),{name:g,value:m,caseSensitive:S}=h.attributes[0],E=m,y=!!S;if(g==="placeholder"){s.push([r.generateLocator(c,"placeholder",E,{exact:y})]);continue}if(g==="alt"){s.push([r.generateLocator(c,"alt",E,{exact:y})]);continue}if(g==="title"){s.push([r.generateLocator(c,"title",E,{exact:y})]);continue}}if(l.name==="internal:control"&&l.body==="enter-frame"){let h=s[s.length-1],g=i[a-1],m=h.map(S=>r.chainLocators([S,r.generateLocator(c,"frame","")]));["xpath","css"].includes(g.name)&&m.push(r.generateLocator(c,"frame-locator",$({parts:[g]})),r.generateLocator(c,"frame-locator",$({parts:[g]},!0))),h.splice(0,h.length,...m),o="frame-locator";continue}let p=i[a+1],d=$({parts:[l]}),u=r.generateLocator(c,"default",d);if(p&&["internal:has-text","internal:has-not-text"].includes(p.name)){let{exact:h,text:g}=ut(p.body);if(!h){let m=r.generateLocator("locator",p.name==="internal:has-text"?"has-text":"has-not-text",g,{exact:h}),S={};p.name==="internal:has-text"?S.hasText=g:S.hasNotText=g;let E=r.generateLocator(c,"default",d,S);s.push([r.chainLocators([u,m]),E]),a++;continue}}let f;if(["xpath","css"].includes(l.name)){let h=$({parts:[l]},!0);f=r.generateLocator(c,"default",h)}s.push([u,f].filter(Boolean))}return rs(r,s,n)}function rs(r,e,t){let n=e.map(()=>""),i=[],s=o=>{if(o===e.length)return i.push(r.chainLocators(n)),i.length<t;for(let a of e[o])if(n[o]=a,!s(o+1))return!1;return!0};return s(0),i}function ut(r){let e=!1,t=r.match(/^\\/(.*)\\/([igm]*)$/);return t?{text:new RegExp(t[1],t[2])}:(r.endsWith(\'"\')?(r=JSON.parse(r),e=!0):r.endsWith(\'"s\')?(r=JSON.parse(r.substring(0,r.length-1)),e=!0):r.endsWith(\'"i\')&&(r=JSON.parse(r.substring(0,r.length-1)),e=!1),{exact:e,text:r})}var Tr=class{constructor(e){this.preferredQuote=e}generateLocator(e,t,n,i={}){switch(t){case"default":return i.hasText!==void 0?`locator(${this.quote(n)}, { hasText: ${this.toHasText(i.hasText)} })`:i.hasNotText!==void 0?`locator(${this.quote(n)}, { hasNotText: ${this.toHasText(i.hasNotText)} })`:`locator(${this.quote(n)})`;case"frame-locator":return`frameLocator(${this.quote(n)})`;case"frame":return"contentFrame()";case"nth":return`nth(${n})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter({ visible: ${n==="true"?"true":"false"} })`;case"role":let s=[];C(i.name)?s.push(`name: ${this.regexToSourceString(i.name)}`):typeof i.name=="string"&&s.push(`name: ${this.quote(i.name)}`),C(i.description)?s.push(`description: ${this.regexToSourceString(i.description)}`):typeof i.description=="string"&&s.push(`description: ${this.quote(i.description)}`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&s.push("exact: true");for(let{name:a,value:l}of i.attrs)s.push(`${a}: ${typeof l=="string"?this.quote(l):l}`);let o=s.length?`, { ${s.join(", ")} }`:"";return`getByRole(${this.quote(n)}${o})`;case"has-text":return`filter({ hasText: ${this.toHasText(n)} })`;case"has-not-text":return`filter({ hasNotText: ${this.toHasText(n)} })`;case"has":return`filter({ has: ${n} })`;case"hasNot":return`filter({ hasNot: ${n} })`;case"and":return`and(${n})`;case"or":return`or(${n})`;case"chain":return`locator(${n})`;case"test-id":return`getByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("getByText",n,!!i.exact);case"alt":return this.toCallWithExact("getByAltText",n,!!i.exact);case"placeholder":return this.toCallWithExact("getByPlaceholder",n,!!i.exact);case"label":return this.toCallWithExact("getByLabel",n,!!i.exact);case"title":return this.toCallWithExact("getByTitle",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToSourceString(e){return ct(String(e))}toCallWithExact(e,t,n){return C(t)?`${e}(${this.regexToSourceString(t)})`:n?`${e}(${this.quote(t)}, { exact: true })`:`${e}(${this.quote(t)})`}toHasText(e){return C(e)?this.regexToSourceString(e):this.quote(e)}toTestIdValue(e){return C(e)?this.regexToSourceString(e):this.quote(e)}quote(e){var t;return at(e,(t=this.preferredQuote)!=null?t:"\'")}},Ar=class{generateLocator(e,t,n,i={}){switch(t){case"default":return i.hasText!==void 0?`locator(${this.quote(n)}, has_text=${this.toHasText(i.hasText)})`:i.hasNotText!==void 0?`locator(${this.quote(n)}, has_not_text=${this.toHasText(i.hasNotText)})`:`locator(${this.quote(n)})`;case"frame-locator":return`frame_locator(${this.quote(n)})`;case"frame":return"content_frame";case"nth":return`nth(${n})`;case"first":return"first";case"last":return"last";case"visible":return`filter(visible=${n==="true"?"True":"False"})`;case"role":let s=[];C(i.name)?s.push(`name=${this.regexToString(i.name)}`):typeof i.name=="string"&&s.push(`name=${this.quote(i.name)}`),C(i.description)?s.push(`description=${this.regexToString(i.description)}`):typeof i.description=="string"&&s.push(`description=${this.quote(i.description)}`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&s.push("exact=True");for(let{name:a,value:l}of i.attrs){let c=typeof l=="string"?this.quote(l):l;typeof l=="boolean"&&(c=l?"True":"False"),s.push(`${wr(a)}=${c}`)}let o=s.length?`, ${s.join(", ")}`:"";return`get_by_role(${this.quote(n)}${o})`;case"has-text":return`filter(has_text=${this.toHasText(n)})`;case"has-not-text":return`filter(has_not_text=${this.toHasText(n)})`;case"has":return`filter(has=${n})`;case"hasNot":return`filter(has_not=${n})`;case"and":return`and_(${n})`;case"or":return`or_(${n})`;case"chain":return`locator(${n})`;case"test-id":return`get_by_test_id(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("get_by_text",n,!!i.exact);case"alt":return this.toCallWithExact("get_by_alt_text",n,!!i.exact);case"placeholder":return this.toCallWithExact("get_by_placeholder",n,!!i.exact);case"label":return this.toCallWithExact("get_by_label",n,!!i.exact);case"title":return this.toCallWithExact("get_by_title",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", re.IGNORECASE":"";return`re.compile(r"${ct(e.source).replace(/\\\\\\//,"/").replace(/"/g,\'\\\\"\')}"${t})`}toCallWithExact(e,t,n){return C(t)?`${e}(${this.regexToString(t)})`:n?`${e}(${this.quote(t)}, exact=True)`:`${e}(${this.quote(t)})`}toHasText(e){return C(e)?this.regexToString(e):`${this.quote(e)}`}toTestIdValue(e){return C(e)?this.regexToString(e):this.quote(e)}quote(e){return at(e,\'"\')}},_r=class{generateLocator(e,t,n,i={}){let s;switch(e){case"page":s="Page";break;case"frame-locator":s="FrameLocator";break;case"locator":s="Locator";break}switch(t){case"default":return i.hasText!==void 0?`locator(${this.quote(n)}, new ${s}.LocatorOptions().setHasText(${this.toHasText(i.hasText)}))`:i.hasNotText!==void 0?`locator(${this.quote(n)}, new ${s}.LocatorOptions().setHasNotText(${this.toHasText(i.hasNotText)}))`:`locator(${this.quote(n)})`;case"frame-locator":return`frameLocator(${this.quote(n)})`;case"frame":return"contentFrame()";case"nth":return`nth(${n})`;case"first":return"first()";case"last":return"last()";case"visible":return`filter(new ${s}.FilterOptions().setVisible(${n==="true"?"true":"false"}))`;case"role":let o=[];C(i.name)?o.push(`.setName(${this.regexToString(i.name)})`):typeof i.name=="string"&&o.push(`.setName(${this.quote(i.name)})`),C(i.description)?o.push(`.setDescription(${this.regexToString(i.description)})`):typeof i.description=="string"&&o.push(`.setDescription(${this.quote(i.description)})`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&o.push(".setExact(true)");for(let{name:l,value:c}of i.attrs)o.push(`.set${lt(l)}(${typeof c=="string"?this.quote(c):c})`);let a=o.length?`, new ${s}.GetByRoleOptions()${o.join("")}`:"";return`getByRole(AriaRole.${wr(n).toUpperCase()}${a})`;case"has-text":return`filter(new ${s}.FilterOptions().setHasText(${this.toHasText(n)}))`;case"has-not-text":return`filter(new ${s}.FilterOptions().setHasNotText(${this.toHasText(n)}))`;case"has":return`filter(new ${s}.FilterOptions().setHas(${n}))`;case"hasNot":return`filter(new ${s}.FilterOptions().setHasNot(${n}))`;case"and":return`and(${n})`;case"or":return`or(${n})`;case"chain":return`locator(${n})`;case"test-id":return`getByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact(s,"getByText",n,!!i.exact);case"alt":return this.toCallWithExact(s,"getByAltText",n,!!i.exact);case"placeholder":return this.toCallWithExact(s,"getByPlaceholder",n,!!i.exact);case"label":return this.toCallWithExact(s,"getByLabel",n,!!i.exact);case"title":return this.toCallWithExact(s,"getByTitle",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", Pattern.CASE_INSENSITIVE":"";return`Pattern.compile(${this.quote(ct(e.source))}${t})`}toCallWithExact(e,t,n,i){return C(n)?`${t}(${this.regexToString(n)})`:i?`${t}(${this.quote(n)}, new ${e}.${lt(t)}Options().setExact(true))`:`${t}(${this.quote(n)})`}toHasText(e){return C(e)?this.regexToString(e):this.quote(e)}toTestIdValue(e){return C(e)?this.regexToString(e):this.quote(e)}quote(e){return at(e,\'"\')}},Cr=class{generateLocator(e,t,n,i={}){switch(t){case"default":return i.hasText!==void 0?`Locator(${this.quote(n)}, new() { ${this.toHasText(i.hasText)} })`:i.hasNotText!==void 0?`Locator(${this.quote(n)}, new() { ${this.toHasNotText(i.hasNotText)} })`:`Locator(${this.quote(n)})`;case"frame-locator":return`FrameLocator(${this.quote(n)})`;case"frame":return"ContentFrame";case"nth":return`Nth(${n})`;case"first":return"First";case"last":return"Last";case"visible":return`Filter(new() { Visible = ${n==="true"?"true":"false"} })`;case"role":let s=[];C(i.name)?s.push(`NameRegex = ${this.regexToString(i.name)}`):typeof i.name=="string"&&s.push(`Name = ${this.quote(i.name)}`),C(i.description)?s.push(`DescriptionRegex = ${this.regexToString(i.description)}`):typeof i.description=="string"&&s.push(`Description = ${this.quote(i.description)}`),i.exact&&(typeof i.name=="string"||typeof i.description=="string")&&s.push("Exact = true");for(let{name:a,value:l}of i.attrs)s.push(`${lt(a)} = ${typeof l=="string"?this.quote(l):l}`);let o=s.length?`, new() { ${s.join(", ")} }`:"";return`GetByRole(AriaRole.${lt(n)}${o})`;case"has-text":return`Filter(new() { ${this.toHasText(n)} })`;case"has-not-text":return`Filter(new() { ${this.toHasNotText(n)} })`;case"has":return`Filter(new() { Has = ${n} })`;case"hasNot":return`Filter(new() { HasNot = ${n} })`;case"and":return`And(${n})`;case"or":return`Or(${n})`;case"chain":return`Locator(${n})`;case"test-id":return`GetByTestId(${this.toTestIdValue(n)})`;case"text":return this.toCallWithExact("GetByText",n,!!i.exact);case"alt":return this.toCallWithExact("GetByAltText",n,!!i.exact);case"placeholder":return this.toCallWithExact("GetByPlaceholder",n,!!i.exact);case"label":return this.toCallWithExact("GetByLabel",n,!!i.exact);case"title":return this.toCallWithExact("GetByTitle",n,!!i.exact);default:throw new Error("Unknown selector kind "+t)}}chainLocators(e){return e.join(".")}regexToString(e){let t=e.flags.includes("i")?", RegexOptions.IgnoreCase":"";return`new Regex(${this.quote(ct(e.source))}${t})`}toCallWithExact(e,t,n){return C(t)?`${e}(${this.regexToString(t)})`:n?`${e}(${this.quote(t)}, new() { Exact = true })`:`${e}(${this.quote(t)})`}toHasText(e){return C(e)?`HasTextRegex = ${this.regexToString(e)}`:`HasText = ${this.quote(e)}`}toTestIdValue(e){return C(e)?this.regexToString(e):this.quote(e)}toHasNotText(e){return C(e)?`HasNotTextRegex = ${this.regexToString(e)}`:`HasNotText = ${this.quote(e)}`}quote(e){return at(e,\'"\')}},kr=class{generateLocator(e,t,n,i={}){return JSON.stringify({kind:t,body:n,options:i})}chainLocators(e){let t=e.map(n=>JSON.parse(n));for(let n=0;n<t.length-1;++n)t[n].next=t[n+1];return JSON.stringify(t[0])}},ns={javascript:Tr,python:Ar,java:_r,csharp:Cr,jsonl:kr};function C(r){return r instanceof RegExp}function Nr(r,e,t){return`internal:attr=[${r}=${L(e,(t==null?void 0:t.exact)||!1)}]`}function Bt(r){return r.split(",")}function is(r){return r.includes(",")?JSON.stringify(r):r}function Sn(r,e){return`internal:testid=[${is(r)}=${L(e,!0)}]`}function yn(r,e){return"internal:label="+q(r,!!(e!=null&&e.exact))}function wn(r,e){return Nr("alt",r,e)}function vn(r,e){return Nr("title",r,e)}function Tn(r,e){return Nr("placeholder",r,e)}function An(r,e){return"internal:text="+q(r,!!(e!=null&&e.exact))}function _n(r,e={}){let t=[];return e.checked!==void 0&&t.push(["checked",String(e.checked)]),e.disabled!==void 0&&t.push(["disabled",String(e.disabled)]),e.selected!==void 0&&t.push(["selected",String(e.selected)]),e.expanded!==void 0&&t.push(["expanded",String(e.expanded)]),e.includeHidden!==void 0&&t.push(["include-hidden",String(e.includeHidden)]),e.level!==void 0&&t.push(["level",String(e.level)]),e.name!==void 0&&t.push(["name",L(e.name,!!e.exact)]),e.description!==void 0&&t.push(["description",L(e.description,!!e.exact)]),e.pressed!==void 0&&t.push(["pressed",String(e.pressed)]),`internal:role=${r}${t.map(([n,i])=>`[${n}=${i}]`).join("")}`}function Cn(r){return kn(r)?"\'"+r.replace(/\'/g,"\'\'")+"\'":r}function Ft(r){return kn(r)?\'"\'+r.replace(/[\\\\"\\x00-\\x1f\\x7f-\\x9f]/g,e=>{switch(e){case"\\\\":return"\\\\\\\\";case\'"\':return\'\\\\"\';case"\\b":return"\\\\b";case"\\f":return"\\\\f";case`\n`:return"\\\\n";case"\\r":return"\\\\r";case"	":return"\\\\t";default:return"\\\\x"+e.charCodeAt(0).toString(16).padStart(2,"0")}})+\'"\':r}function kn(r){return!!(r.length===0||/^\\s|\\s$/.test(r)||/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f-\\x9f]/.test(r)||/^-/.test(r)||/[\\n:](\\s|$)/.test(r)||/\\s#/.test(r)||/[\\n\\r]/.test(r)||/^[&*\\],?!>|@"\'#%]/.test(r)||/[{}`]/.test(r)||/^\\[/.test(r)||!isNaN(Number(r))||["y","n","yes","no","true","false","on","off","null"].includes(r.toLowerCase()))}var Nn={};function Rn(r){Nn=r}function pt(r,e){for(;e;){if(r.contains(e))return!0;e=Ln(e)}return!1}function I(r){if(r.parentElement)return r.parentElement;if(r.parentNode&&r.parentNode.nodeType===11&&r.parentNode.host)return r.parentNode.host}function Ut(r){let e=r;for(;e.parentNode;)e=e.parentNode;if(e.nodeType===11||e.nodeType===9)return e}function Ln(r){for(;r.parentElement;)r=r.parentElement;return I(r)}function xe(r,e,t){for(;r;){let n=r.closest(e);if(t&&n!==t&&(n!=null&&n.contains(t)))return;if(n)return n;r=Ln(r)}}function z(r,e){let t=e==="::before"?ht:e==="::after"?ft:dt;if(t&&t.has(r))return t.get(r);let n=r.ownerDocument&&r.ownerDocument.defaultView?r.ownerDocument.defaultView.getComputedStyle(r,e):void 0;return t==null||t.set(r,n),n}function Rr(r,e){if(e=e!=null?e:z(r),!e)return!0;if(Element.prototype.checkVisibility&&Nn.browserNameForWorkarounds!=="webkit"){if(!r.checkVisibility())return!1}else{let t=r.closest("details,summary");if(t!==r&&(t==null?void 0:t.nodeName)==="DETAILS"&&!t.open)return!1}return e.visibility==="visible"}function gt(r){let e=z(r);if(!e)return{visible:!0,inline:!1};let t=e.cursor;if(e.display==="contents"){for(let i=r.firstChild;i;i=i.nextSibling){if(i.nodeType===1&&W(i))return{visible:!0,inline:!1,cursor:t};if(i.nodeType===3&&Lr(i))return{visible:!0,inline:!0,cursor:t}}return{visible:!1,inline:!1,cursor:t}}if(!Rr(r,e))return{cursor:t,visible:!1,inline:!1};let n=r.getBoundingClientRect();return{cursor:t,visible:n.width>0&&n.height>0,inline:e.display==="inline"}}function W(r){return gt(r).visible}function Lr(r){let e=r.ownerDocument.createRange();e.selectNode(r);let t=e.getBoundingClientRect();return t.width>0&&t.height>0}function A(r){let e=r.tagName;return typeof e=="string"?e.toUpperCase():r instanceof HTMLFormElement?"FORM":r.tagName.toUpperCase()}var dt,ht,ft,In=0;function Re(){++In,dt!=null||(dt=new Map),ht!=null||(ht=new Map),ft!=null||(ft=new Map)}function Le(){--In||(dt=void 0,ht=void 0,ft=void 0)}function Mn(r){return r.hasAttribute("aria-label")||r.hasAttribute("aria-labelledby")}var On="article:not([role]), aside:not([role]), main:not([role]), nav:not([role]), section:not([role]), [role=article], [role=complementary], [role=main], [role=navigation], [role=region]",ss=[["aria-atomic",void 0],["aria-busy",void 0],["aria-controls",void 0],["aria-current",void 0],["aria-describedby",void 0],["aria-details",void 0],["aria-dropeffect",void 0],["aria-flowto",void 0],["aria-grabbed",void 0],["aria-hidden",void 0],["aria-keyshortcuts",void 0],["aria-label",["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"]],["aria-labelledby",["caption","code","deletion","emphasis","generic","insertion","paragraph","presentation","strong","subscript","superscript"]],["aria-live",void 0],["aria-owns",void 0],["aria-relevant",void 0],["aria-roledescription",["generic"]]];function qn(r,e){return ss.some(([t,n])=>!(n!=null&&n.includes(e||""))&&r.hasAttribute(t))}function Bn(r){return!Number.isNaN(Number(String(r.getAttribute("tabindex"))))}function os(r){return!Yn(r)&&(as(r)||Bn(r))}function as(r){let e=A(r);return["BUTTON","DETAILS","SELECT","TEXTAREA"].includes(e)?!0:e==="A"||e==="AREA"?r.hasAttribute("href"):e==="INPUT"?!r.hidden:!1}var Ir={A:r=>r.hasAttribute("href")?"link":null,AREA:r=>r.hasAttribute("href")?"link":null,ARTICLE:()=>"article",ASIDE:()=>"complementary",BLOCKQUOTE:()=>"blockquote",BUTTON:()=>"button",CAPTION:()=>"caption",CODE:()=>"code",DATALIST:()=>"listbox",DD:()=>"definition",DEL:()=>"deletion",DETAILS:()=>"group",DFN:()=>"term",DIALOG:()=>"dialog",DT:()=>"term",EM:()=>"emphasis",FIELDSET:()=>"group",FIGURE:()=>"figure",FOOTER:r=>xe(r,On)?null:"contentinfo",FORM:r=>Mn(r)?"form":null,H1:()=>"heading",H2:()=>"heading",H3:()=>"heading",H4:()=>"heading",H5:()=>"heading",H6:()=>"heading",HEADER:r=>xe(r,On)?null:"banner",HR:()=>"separator",HTML:()=>"document",IMG:r=>r.getAttribute("alt")===""&&!r.getAttribute("title")&&!qn(r)&&!Bn(r)?"presentation":"img",INPUT:r=>{let e=r.type.toLowerCase();if(e==="search")return r.hasAttribute("list")?"combobox":"searchbox";if(["email","tel","text","url",""].includes(e)){let t=Me(r,r.getAttribute("list"))[0];return t&&A(t)==="DATALIST"?"combobox":"textbox"}return e==="hidden"?null:e==="file"?"button":bs[e]||"textbox"},INS:()=>"insertion",LI:()=>"listitem",MAIN:()=>"main",MARK:()=>"mark",MATH:()=>"math",MENU:()=>"list",METER:()=>"meter",NAV:()=>"navigation",OL:()=>"list",OPTGROUP:()=>"group",OPTION:()=>"option",OUTPUT:()=>"status",P:()=>"paragraph",PROGRESS:()=>"progressbar",SEARCH:()=>"search",SECTION:r=>Mn(r)?"region":null,SELECT:r=>r.hasAttribute("multiple")||r.size>1?"listbox":"combobox",STRONG:()=>"strong",SUB:()=>"subscript",SUP:()=>"superscript",SVG:()=>"img",TABLE:()=>"table",TBODY:()=>"rowgroup",TD:r=>{let e=xe(r,"table"),t=e?Mr(e):"";return t==="grid"||t==="treegrid"?"gridcell":"cell"},TEXTAREA:()=>"textbox",TFOOT:()=>"rowgroup",TH:r=>{let e=r.getAttribute("scope");if(e==="col"||e==="colgroup")return"columnheader";if(e==="row"||e==="rowgroup")return"rowheader";let t=r.nextElementSibling,n=r.previousElementSibling,i=r.parentElement&&A(r.parentElement)==="TR"?r.parentElement:void 0;if(!t&&!n){if(i){let s=xe(i,"table");if(s&&s.rows.length<=1)return null}return"columnheader"}return $n(t)&&$n(n)?"columnheader":Pn(t)||Pn(n)?"rowheader":"columnheader"},THEAD:()=>"rowgroup",TIME:()=>"time",TR:()=>"row",UL:()=>"list"};function $n(r){return!!r&&A(r)==="TH"}function Pn(r){var e;return!r||A(r)!=="TD"?!1:!!((e=r.textContent)!=null&&e.trim()||r.children.length>0)}var ls={DD:["DL","DIV"],DIV:["DL"],DT:["DL","DIV"],LI:["OL","UL"],TBODY:["TABLE"],TD:["TR"],TFOOT:["TABLE"],TH:["TR"],THEAD:["TABLE"],TR:["THEAD","TBODY","TFOOT","TABLE"]};function Dn(r){var n;let e=((n=Ir[A(r)])==null?void 0:n.call(Ir,r))||"";if(!e)return null;let t=r;for(;t;){let i=I(t),s=ls[A(t)];if(!s||!i||!s.includes(A(i)))break;let o=Mr(i);if((o==="none"||o==="presentation")&&!Fn(i,o))return o;t=i}return e}var cs=["alert","alertdialog","application","article","banner","blockquote","button","caption","cell","checkbox","code","columnheader","combobox","complementary","contentinfo","definition","deletion","dialog","directory","document","emphasis","feed","figure","form","generic","grid","gridcell","group","heading","img","insertion","link","list","listbox","listitem","log","main","mark","marquee","math","meter","menu","menubar","menuitem","menuitemcheckbox","menuitemradio","navigation","none","note","option","paragraph","presentation","progressbar","radio","radiogroup","region","row","rowgroup","rowheader","scrollbar","search","searchbox","separator","slider","spinbutton","status","strong","subscript","superscript","switch","tab","table","tablist","tabpanel","term","textbox","time","timer","toolbar","tooltip","tree","treegrid","treeitem"];function Mr(r){return(r.getAttribute("role")||"").split(" ").map(t=>t.trim()).find(t=>cs.includes(t))||null}function Fn(r,e){return qn(r,e)||os(r)}function k(r){let e=Mr(r);if(!e)return Dn(r);if(e==="none"||e==="presentation"){let t=Dn(r);if(Fn(r,t))return t}return e}function Un(r){return r===null?void 0:r.toLowerCase()==="true"}function jn(r){return["STYLE","SCRIPT","NOSCRIPT","TEMPLATE"].includes(A(r))}function F(r){if(jn(r))return!0;let e=z(r),t=r.nodeName==="SLOT";if((e==null?void 0:e.display)==="contents"&&!t){for(let i=r.firstChild;i;i=i.nextSibling)if(i.nodeType===1&&!F(i)||i.nodeType===3&&Lr(i))return!1;return!0}return!(r.nodeName==="OPTION"&&!!r.closest("select"))&&!t&&!Rr(r,e)?!0:Wn(r)}function Wn(r){let e=Q==null?void 0:Q.get(r);if(e===void 0){if(e=!1,r.parentElement&&r.parentElement.shadowRoot&&!r.assignedSlot&&(e=!0),!e){let t=z(r);e=!t||t.display==="none"||Un(r.getAttribute("aria-hidden"))===!0}if(!e){let t=I(r);t&&(e=Wn(t))}Q==null||Q.set(r,e)}return e}function Me(r,e){if(!e)return[];let t=Ut(r);if(!t)return[];try{let n=e.split(" ").filter(s=>!!s),i=[];for(let s of n){let o=t.querySelector("#"+CSS.escape(s));o&&!i.includes(o)&&i.push(o)}return i}catch{return[]}}function Z(r){return r.trim()}function bt(r){return r.split("\\xA0").map(e=>e.replace(/\\r\\n/g,`\n`).replace(/[\\u200b\\u00ad]/g,"").replace(/\\s\\s*/g," ")).join("\\xA0").trim()}function Hn(r,e){let t=[...r.querySelectorAll(e)];for(let n of Me(r,r.getAttribute("aria-owns")))n.matches(e)&&t.push(n),t.push(...n.querySelectorAll(e));return t}function Ie(r,e){let t=e==="::before"?vt:e==="::after"?Tt:wt;if(t!=null&&t.has(r))return t==null?void 0:t.get(r);let n=z(r,e),i;if(n){let s=n.content;s&&s!=="none"&&s!=="normal"&&n.display!=="none"&&n.visibility!=="hidden"&&(i=us(r,s,!!e))}return e&&i!==void 0&&((n==null?void 0:n.display)||"inline")!=="inline"&&(i=" "+i+" "),t&&t.set(r,i),i}function us(r,e,t){if(!(!e||e==="none"||e==="normal"))try{let n=qt(e).filter(a=>!(a instanceof ne)),i=n.findIndex(a=>a instanceof _&&a.value==="/");if(i!==-1)n=n.slice(i+1);else if(!t)return;let s=[],o=0;for(;o<n.length;)if(n[o]instanceof ge)s.push(n[o].value),o++;else if(o+2<n.length&&n[o]instanceof Y&&n[o].value==="attr"&&n[o+1]instanceof pe&&n[o+2]instanceof he){let a=n[o+1].value;s.push(r.getAttribute(a)||""),o+=3}else return;return s.join("")}catch{}}function Or(r){let e=r.getAttribute("aria-labelledby");if(e===null)return null;let t=Me(r,e);return t.length?t:null}function ds(r,e){let t=["button","cell","checkbox","columnheader","gridcell","heading","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","row","rowheader","switch","tab","tooltip","treeitem"].includes(r),n=e&&["","caption","code","contentinfo","definition","deletion","emphasis","insertion","list","listitem","mark","none","paragraph","presentation","region","row","rowgroup","section","strong","subscript","superscript","table","term","time"].includes(r);return t||n}function ee(r,e){let t=e?Et:xt,n=t==null?void 0:t.get(r);return n===void 0&&(n="",["caption","code","definition","deletion","emphasis","generic","insertion","mark","paragraph","presentation","strong","subscript","suggestion","superscript","term","time"].includes(k(r)||"")||(n=bt(V(r,{includeHidden:e,visitedElements:new Set,embeddedInTargetElement:"self"}))),t==null||t.set(r,n)),n}function ae(r,e){let t=e?yt:St,n=t==null?void 0:t.get(r);if(n===void 0){if(n="",r.hasAttribute("aria-describedby")){let i=Me(r,r.getAttribute("aria-describedby"));n=bt(i.map(s=>V(s,{includeHidden:e,visitedElements:new Set,embeddedInDescribedBy:{element:s,hidden:F(s)}})).join(" "))}else r.hasAttribute("aria-description")?n=bt(r.getAttribute("aria-description")||""):n=bt(r.getAttribute("title")||"");t==null||t.set(r,n)}return n}var Vn=["application","checkbox","columnheader","combobox","gridcell","listbox","radiogroup","rowheader","searchbox","slider","spinbutton","switch","textbox","tree"];function $r(r){let e=r.getAttribute("aria-invalid");return!e||e.trim()===""||e.toLocaleLowerCase()==="false"?"false":e==="true"||e==="grammar"||e==="spelling"?e:"true"}function hs(r){if("validity"in r){let e=r.validity;return(e==null?void 0:e.valid)===!1}return!1}function zn(r){let e=oe,t=oe==null?void 0:oe.get(r);if(t===void 0){t="";let n=$r(r)!=="false",i=hs(r);if(n||i){let s=r.getAttribute("aria-errormessage");t=Me(r,s).map(l=>bt(V(l,{visitedElements:new Set,embeddedInDescribedBy:{element:l,hidden:F(l)}}))).join(" ").trim()}e==null||e.set(r,t)}return t}function V(r,e){var l,c,p,d;if(e.visitedElements.has(r))return"";let t={...e,embeddedInTargetElement:e.embeddedInTargetElement==="self"?"descendant":e.embeddedInTargetElement};if(!e.includeHidden){let u=!!((l=e.embeddedInLabelledBy)!=null&&l.hidden)||!!((c=e.embeddedInDescribedBy)!=null&&c.hidden)||!!((p=e.embeddedInNativeTextAlternative)!=null&&p.hidden)||!!((d=e.embeddedInLabel)!=null&&d.hidden);if(jn(r)||!u&&F(r))return e.visitedElements.add(r),""}let n=Or(r);if(!e.embeddedInLabelledBy){let u=(n||[]).map(f=>V(f,{...e,embeddedInLabelledBy:{element:f,hidden:F(f)},embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0,embeddedInLabel:void 0,embeddedInNativeTextAlternative:void 0})).join(" ");if(u)return u}let i=k(r)||"",s=A(r);if(e.embeddedInLabel||e.embeddedInLabelledBy||e.embeddedInTargetElement==="descendant"){let u=[...r.labels||[]].includes(r),f=(n||[]).includes(r);if(!u&&!f){if(i==="textbox")return e.visitedElements.add(r),s==="INPUT"||s==="TEXTAREA"?r.value:r.textContent||"";if(["combobox","listbox"].includes(i)){e.visitedElements.add(r);let h;if(s==="SELECT")h=[...r.selectedOptions],!h.length&&r.options.length&&h.push(r.options[0]);else{let g=i==="combobox"?Hn(r,"*").find(m=>k(m)==="listbox"):r;h=g?Hn(g,\'[aria-selected="true"]\').filter(m=>k(m)==="option"):[]}return!h.length&&s==="INPUT"?r.value:h.map(g=>V(g,t)).join(" ")}if(["progressbar","scrollbar","slider","spinbutton","meter"].includes(i))return e.visitedElements.add(r),r.hasAttribute("aria-valuetext")?r.getAttribute("aria-valuetext")||"":r.hasAttribute("aria-valuenow")?r.getAttribute("aria-valuenow")||"":r.getAttribute("value")||"";if(["menu"].includes(i))return e.visitedElements.add(r),""}}let o=r.getAttribute("aria-label")||"";if(Z(o))return e.visitedElements.add(r),o;if(!["presentation","none"].includes(i)){if(s==="INPUT"&&["button","submit","reset"].includes(r.type)){e.visitedElements.add(r);let u=r.value||"";return Z(u)?u:r.type==="submit"?"Submit":r.type==="reset"?"Reset":r.getAttribute("title")||""}if(s==="INPUT"&&r.type==="file"){e.visitedElements.add(r);let u=r.labels||[];return u.length&&!e.embeddedInLabelledBy?mt(u,e):"Choose File"}if(s==="INPUT"&&r.type==="image"){e.visitedElements.add(r);let u=r.labels||[];if(u.length&&!e.embeddedInLabelledBy)return mt(u,e);let f=r.getAttribute("alt")||"";if(Z(f))return f;let h=r.getAttribute("title")||"";return Z(h)?h:"Submit"}if(!n&&s==="BUTTON"){e.visitedElements.add(r);let u=r.labels||[];if(u.length)return mt(u,e)}if(!n&&s==="OUTPUT"){e.visitedElements.add(r);let u=r.labels||[];return u.length?mt(u,e):r.getAttribute("title")||""}if(!n&&(s==="TEXTAREA"||s==="SELECT"||s==="INPUT")){e.visitedElements.add(r);let u=r.labels||[];if(u.length)return mt(u,e);let f=s==="INPUT"&&["text","password","search","tel","email","url"].includes(r.type)||s==="TEXTAREA",h=r.getAttribute("placeholder")||"",g=r.getAttribute("title")||"";return!f||g?g:h}if(!n&&s==="FIELDSET"){e.visitedElements.add(r);for(let f=r.firstElementChild;f;f=f.nextElementSibling)if(A(f)==="LEGEND")return V(f,{...t,embeddedInNativeTextAlternative:{element:f,hidden:F(f)}});return r.getAttribute("title")||""}if(!n&&s==="FIGURE"){e.visitedElements.add(r);for(let f=r.firstElementChild;f;f=f.nextElementSibling)if(A(f)==="FIGCAPTION")return V(f,{...t,embeddedInNativeTextAlternative:{element:f,hidden:F(f)}});return r.getAttribute("title")||""}if(s==="IMG"){e.visitedElements.add(r);let u=r.getAttribute("alt")||"";return Z(u)?u:r.getAttribute("title")||""}if(s==="TABLE"){e.visitedElements.add(r);for(let f=r.firstElementChild;f;f=f.nextElementSibling)if(A(f)==="CAPTION")return V(f,{...t,embeddedInNativeTextAlternative:{element:f,hidden:F(f)}});let u=r.getAttribute("summary")||"";if(u)return u}if(s==="AREA"){e.visitedElements.add(r);let u=r.getAttribute("alt")||"";return Z(u)?u:r.getAttribute("title")||""}if(s==="SVG"||r.ownerSVGElement){e.visitedElements.add(r);for(let u=r.firstElementChild;u;u=u.nextElementSibling)if(A(u)==="TITLE"&&u.ownerSVGElement)return V(u,{...t,embeddedInLabelledBy:{element:u,hidden:F(u)}})}if(r.ownerSVGElement&&s==="A"){let u=r.getAttribute("xlink:title")||"";if(Z(u))return e.visitedElements.add(r),u}}let a=s==="SUMMARY"&&!["presentation","none"].includes(i);if(ds(i,e.embeddedInTargetElement==="descendant")||a||e.embeddedInLabelledBy||e.embeddedInDescribedBy||e.embeddedInLabel||e.embeddedInNativeTextAlternative){e.visitedElements.add(r);let u=fs(r,t);if(e.embeddedInTargetElement==="self"?Z(u):u)return u}if(!["presentation","none"].includes(i)||s==="IFRAME"){e.visitedElements.add(r);let u=r.getAttribute("title")||"";if(Z(u))return u}return e.visitedElements.add(r),""}function fs(r,e){let t=[],n=(s,o)=>{var a;if(!(o&&s.assignedSlot))if(s.nodeType===1){let l=((a=z(s))==null?void 0:a.display)||"inline",c=V(s,e);(l!=="inline"||s.nodeName==="BR")&&(c=" "+c+" "),t.push(c)}else s.nodeType===3&&t.push(s.textContent||"")};t.push(Ie(r,"::before")||"");let i=Ie(r);if(i!==void 0)t.push(i);else{let s=r.nodeName==="SLOT"?r.assignedNodes():[];if(s.length)for(let o of s)n(o,!1);else{for(let o=r.firstChild;o;o=o.nextSibling)n(o,!0);if(r.shadowRoot)for(let o=r.shadowRoot.firstChild;o;o=o.nextSibling)n(o,!0);for(let o of Me(r,r.getAttribute("aria-owns")))n(o,!0)}}return t.push(Ie(r,"::after")||""),t.join("")}var _t=["gridcell","option","row","tab","rowheader","columnheader","treeitem"];function jt(r){return A(r)==="OPTION"?r.selected:_t.includes(k(r)||"")?Un(r.getAttribute("aria-selected"))===!0:!1}var Ct=["checkbox","menuitemcheckbox","option","radio","switch","menuitemradio","treeitem"];function Wt(r){let e=Pr(r,!0);return e==="error"?!1:e}function Qn(r){return Pr(r,!0)}function Gn(r){return Pr(r,!1)}function Pr(r,e){let t=A(r);if(e&&t==="INPUT"&&r.indeterminate)return"mixed";if(t==="INPUT"&&["checkbox","radio"].includes(r.type))return r.checked;if(Ct.includes(k(r)||"")){let n=r.getAttribute("aria-checked");return n==="true"?!0:e&&n==="mixed"?"mixed":!1}return"error"}var ps=["checkbox","combobox","grid","gridcell","listbox","radiogroup","slider","spinbutton","textbox","columnheader","rowheader","searchbox","switch","treegrid"];function Jn(r){let e=A(r);return["INPUT","TEXTAREA","SELECT"].includes(e)?r.hasAttribute("readonly"):ps.includes(k(r)||"")?r.getAttribute("aria-readonly")==="true":r.isContentEditable?!1:"error"}var kt=["button"];function Vt(r){if(kt.includes(k(r)||"")){let e=r.getAttribute("aria-pressed");if(e==="true")return!0;if(e==="mixed")return"mixed"}return!1}var Nt=["application","button","checkbox","combobox","gridcell","link","listbox","menuitem","row","rowheader","tab","treeitem","columnheader","menuitemcheckbox","menuitemradio","rowheader","switch"];function zt(r){if(A(r)==="DETAILS")return r.open;if(Nt.includes(k(r)||"")){let e=r.getAttribute("aria-expanded");return e===null?void 0:e==="true"}}var Rt=["heading","listitem","row","treeitem"];function Qt(r){let e={H1:1,H2:2,H3:3,H4:4,H5:5,H6:6}[A(r)];if(e)return e;if(Rt.includes(k(r)||"")){let t=r.getAttribute("aria-level"),n=t===null?Number.NaN:Number(t);if(Number.isInteger(n)&&n>=1)return n}return 0}var Dr=["application","button","composite","gridcell","group","input","link","menuitem","scrollbar","separator","tab","checkbox","columnheader","combobox","grid","listbox","menu","menubar","menuitemcheckbox","menuitemradio","option","radio","radiogroup","row","rowheader","searchbox","select","slider","spinbutton","switch","tablist","textbox","toolbar","tree","treegrid","treeitem"];function Ee(r){return Yn(r)||Xn(r)}function Yn(r){return["BUTTON","INPUT","SELECT","TEXTAREA","OPTION","OPTGROUP"].includes(A(r))&&(r.hasAttribute("disabled")||gs(r)||ms(r))}function gs(r){return A(r)==="OPTION"&&!!r.closest("OPTGROUP[DISABLED]")}function ms(r){let e=r==null?void 0:r.closest("FIELDSET[DISABLED]");if(!e)return!1;let t=e.querySelector(":scope > LEGEND");return!t||!t.contains(r)}function Xn(r,e=!1){if(!r)return!1;if(e||Dr.includes(k(r)||"")){let t=(r.getAttribute("aria-disabled")||"").toLowerCase();return t==="true"?!0:t==="false"?!1:Xn(I(r),!0)}return!1}function mt(r,e){return[...r].map(t=>V(t,{...e,embeddedInLabel:{element:t,hidden:F(t)},embeddedInNativeTextAlternative:void 0,embeddedInLabelledBy:void 0,embeddedInDescribedBy:void 0,embeddedInTargetElement:void 0})).filter(t=>!!t).join(" ")}function Kn(r){let e=At,t=r,n,i=[];for(;t;t=I(t)){let s=e.get(t);if(s!==void 0){n=s;break}i.push(t);let o=z(t);if(!o){n=!0;break}let a=o.pointerEvents;if(a){n=a!=="none";break}}n===void 0&&(n=!0);for(let s of i)e.set(s,n);return n}var xt,Et,St,yt,oe,Q,wt,vt,Tt,At,Zn=0;function le(){Re(),++Zn,xt!=null||(xt=new Map),Et!=null||(Et=new Map),St!=null||(St=new Map),yt!=null||(yt=new Map),oe!=null||(oe=new Map),Q!=null||(Q=new Map),wt!=null||(wt=new Map),vt!=null||(vt=new Map),Tt!=null||(Tt=new Map),At!=null||(At=new Map)}function ce(){--Zn||(xt=void 0,Et=void 0,St=void 0,yt=void 0,oe=void 0,Q=void 0,wt=void 0,vt=void 0,Tt=void 0,At=void 0),Le()}var bs={button:"button",checkbox:"checkbox",image:"button",number:"spinbutton",radio:"radio",range:"slider",reset:"button",submit:"button"};var Es=0;function ii(r){let e=r.boxes;return r.mode==="ai"?{visibility:"ariaOrVisible",refs:"interactable",refPrefix:r.refPrefix,includeGenericRole:!0,renderActive:!r.doNotRenderActive,renderCursorPointer:!0,renderBoxes:e}:r.mode==="autoexpect"?{visibility:"ariaAndVisible",refs:"none",renderBoxes:e}:r.mode==="codegen"?{visibility:"aria",refs:"none",renderStringsAsRegex:!0,renderBoxes:e}:{visibility:"aria",refs:"none",renderBoxes:e}}function ye(r,e){let t=ii(e),n=new Set,i={root:{role:"fragment",name:"",children:[],props:{},box:gt(r),receivesPointerEvents:!0},elements:new Map,refs:new Map,iframeRefs:[]};qr(i.root,r);let s=(a,l,c)=>{if(n.has(l))return;if(n.add(l),l.nodeType===Node.TEXT_NODE&&l.nodeValue){if(!c)return;let g=l.nodeValue;a.role!=="textbox"&&g&&a.children.push(l.nodeValue||"");return}if(l.nodeType!==Node.ELEMENT_NODE)return;let p=l,d=!F(p),u=d;if(t.visibility==="ariaOrVisible"&&(u=d||W(p)),t.visibility==="ariaAndVisible"&&(u=d&&W(p)),t.visibility==="aria"&&!u)return;let f=[];if(p.hasAttribute("aria-owns")){let g=p.getAttribute("aria-owns").split(/\\s+/);for(let m of g){let S=r.ownerDocument.getElementById(m);S&&f.push(S)}}let h=u?Ss(p,t):null;h&&(h.ref&&(i.elements.set(h.ref,p),i.refs.set(p,h.ref),h.role==="iframe"&&i.iframeRefs.push(h.ref)),a.children.push(h)),o(h||a,p,f,u)};function o(a,l,c,p){var h;let u=(((h=z(l))==null?void 0:h.display)||"inline")!=="inline"||l.nodeName==="BR"?" ":"";u&&a.children.push(u),a.children.push(Ie(l,"::before")||"");let f=l.nodeName==="SLOT"?l.assignedNodes():[];if(f.length)for(let g of f)s(a,g,p);else{for(let g=l.firstChild;g;g=g.nextSibling)g.assignedSlot||s(a,g,p);if(l.shadowRoot)for(let g=l.shadowRoot.firstChild;g;g=g.nextSibling)s(a,g,p)}for(let g of c)s(a,g,p);if(a.children.push(Ie(l,"::after")||""),u&&a.children.push(u),a.children.length===1&&a.name===a.children[0]&&(a.children=[]),a.role==="link"&&l.hasAttribute("href")){let g=l.getAttribute("href");a.props.url=g}if(a.role==="textbox"&&l.hasAttribute("placeholder")&&l.getAttribute("placeholder")!==a.name){let g=l.getAttribute("placeholder");a.props.placeholder=g}}le();try{s(i.root,r,!0)}finally{ce()}return ws(i.root),ys(i.root),i}function ei(r,e){var i;if(e.refs==="none"||e.refs==="interactable"&&(!r.box.visible||!r.receivesPointerEvents))return;let t=Jt(r),n=t._ariaRef;(!n||n.role!==r.role||n.name!==r.name)&&(n={role:r.role,name:r.name,ref:((i=e.refPrefix)!=null?i:"")+"e"+ ++Es},t._ariaRef=n),r.ref=n.ref}function Ss(r,e){var c;let t=r.ownerDocument.activeElement===r;if(r.nodeName==="IFRAME"){let p={role:"iframe",name:"",children:[],props:{},box:gt(r),receivesPointerEvents:!0,active:t};return qr(p,r),ei(p,e),p}let n=e.includeGenericRole?"generic":null,i=(c=k(r))!=null?c:n;if(!i||i==="presentation"||i==="none")return null;let s=v(ee(r,!1)||""),o=Kn(r),a=gt(r);if(i==="generic"&&a.inline&&r.childNodes.length===1&&r.childNodes[0].nodeType===Node.TEXT_NODE)return null;let l={role:i,name:s,children:[],props:{},box:a,receivesPointerEvents:o,active:t};if(qr(l,r),ei(l,e),Ct.includes(i)&&(l.checked=Wt(r)),Dr.includes(i)&&(l.disabled=Ee(r)),Nt.includes(i)&&(l.expanded=zt(r)),Vn.includes(i)){let p=$r(r);l.invalid=p==="false"?!1:p==="true"?!0:p}return Rt.includes(i)&&(l.level=Qt(r)),kt.includes(i)&&(l.pressed=Vt(r)),_t.includes(i)&&(l.selected=jt(r)),(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&r.type!=="checkbox"&&r.type!=="radio"&&r.type!=="file"&&(l.children=[r.value]),l}function ys(r){let e=t=>{let n=[];for(let s of t.children||[]){if(typeof s=="string"){n.push(s);continue}let o=e(s);n.push(...o)}return t.role==="generic"&&!t.name&&n.length<=1&&n.every(s=>typeof s!="string"&&!!s.ref)?n:(t.children=n,[t])};e(r)}function ws(r){let e=(n,i)=>{if(!n.length)return;let s=v(n.join(""));s&&i.push(s),n.length=0},t=n=>{let i=[],s=[];for(let o of n.children||[])typeof o=="string"?s.push(o):(e(s,i),t(o),i.push(o));e(s,i),n.children=i.length?i:[],n.children.length===1&&n.children[0]===n.name&&(n.children=[])};t(r)}function vs(r,e){return e?r?typeof e=="string"?r===e:!!r.match(new RegExp(e.pattern)):!1:!0}function ti(r,e){if(!(e!=null&&e.normalized))return!0;if(!r)return!1;if(r===e.normalized||r===e.raw)return!0;let t=Ts(e);return t?!!r.match(t):!1}var Hr=Symbol("cachedRegex");function Ts(r){if(r[Hr]!==void 0)return r[Hr];let{raw:e}=r,t=e.startsWith("/")&&e.endsWith("/")&&e.length>1,n;try{n=t?new RegExp(e.slice(1,-1)):null}catch{n=null}return r[Hr]=n,n}function Br(r,e){let t=ye(r,{mode:"default"});return{matches:oi(t.root,e,!1,!1),received:{raw:Se(t,{mode:"default"}).text,regex:Se(t,{mode:"codegen"}).text}}}function si(r,e){let t=ye(r,{mode:"default"}).root;return oi(t,e,!0,!1).map(i=>Jt(i))}function Fr(r,e,t){var n;return typeof r=="string"&&e.kind==="text"?ti(r,e.text):r===null||typeof r!="object"||e.kind!=="role"||e.role!=="fragment"&&e.role!==r.role||e.checked!==void 0&&e.checked!==r.checked||e.disabled!==void 0&&e.disabled!==r.disabled||e.expanded!==void 0&&e.expanded!==r.expanded||e.invalid!==void 0&&e.invalid!==r.invalid||e.level!==void 0&&e.level!==r.level||e.pressed!==void 0&&e.pressed!==r.pressed||e.selected!==void 0&&e.selected!==r.selected||!vs(r.name,e.name)||!ti(r.props.url,(n=e.props)==null?void 0:n.url)?!1:e.containerMode==="contain"?ni(r.children||[],e.children||[]):e.containerMode==="equal"?ri(r.children||[],e.children||[],!1):e.containerMode==="deep-equal"||t?ri(r.children||[],e.children||[],!0):ni(r.children||[],e.children||[])}function ri(r,e,t){if(e.length!==r.length)return!1;for(let n=0;n<e.length;++n)if(!Fr(r[n],e[n],t))return!1;return!0}function ni(r,e){if(e.length>r.length)return!1;let t=r.slice(),n=e.slice();for(let i of n){let s=t.shift();for(;s&&!Fr(s,i,!1);)s=t.shift();if(!s)return!1}return!0}function oi(r,e,t,n){let i=[],s=(o,a)=>{if(Fr(o,e,n)){let l=typeof o=="string"?a:o;return l&&i.push(l),!t}if(typeof o=="string")return!1;for(let l of o.children||[])if(s(l,o))return!0;return!1};return s(r,null),i}function ai(r,e=new Map){r!=null&&r.ref&&e.set(r.ref,r);for(let t of(r==null?void 0:r.children)||[])typeof t!="string"&&ai(t,e);return e}function As(r,e){var s;let t=ai(e==null?void 0:e.root),n=new Map,i=(o,a)=>{let l=o.children.length===(a==null?void 0:a.children.length)&&an(o,a),c=l;for(let p=0;p<o.children.length;p++){let d=o.children[p],u=a==null?void 0:a.children[p];if(typeof d=="string")l&&(l=d===u),c&&(c=d===u);else{let f=typeof u!="string"?u:void 0;d.ref&&(f=t.get(d.ref));let h=i(d,f);(!f||!h&&!d.ref||f!==u)&&(c=!1),l&&(l=h&&f===u)}}return n.set(o,l?"same":c?"skip":"changed"),l};return i(r.root,t.get((s=e==null?void 0:e.root)==null?void 0:s.ref)),n}function _s(r,e){let t=[],n=i=>{let s=e.get(i);if(s!=="same")if(s==="skip")for(let o of i.children)typeof o!="string"&&n(o);else t.push(i)};for(let i of r)typeof i=="string"?t.push(i):n(i);return t}function Gt(r){return"  ".repeat(r)}function Se(r,e,t){let n=ii(e),i=[],s={},o=n.renderStringsAsRegex?ks:()=>!0,a=n.renderStringsAsRegex?Cs:h=>h,l=r.root.role==="fragment"?r.root.children:[r.root],c=As(r,t);t&&(l=_s(l,c));let p=(h,g)=>{if(e.depth&&g>e.depth)return;let m=Ft(a(h));m&&i.push(Gt(g)+"- text: "+m)},d=(h,g)=>{let m=h.role;if(h.name&&h.name.length<=900){let S=a(h.name);if(S){let E=S.startsWith("/")&&S.endsWith("/")?S:JSON.stringify(S);m+=" "+E}}if(h.checked==="mixed"&&(m+=" [checked=mixed]"),h.checked===!0&&(m+=" [checked]"),h.disabled&&(m+=" [disabled]"),h.expanded&&(m+=" [expanded]"),h.active&&n.renderActive&&(m+=" [active]"),(h.invalid==="grammar"||h.invalid==="spelling")&&(m+=` [invalid=${h.invalid}]`),h.invalid===!0&&(m+=" [invalid]"),h.level&&(m+=` [level=${h.level}]`),h.pressed==="mixed"&&(m+=" [pressed=mixed]"),h.pressed===!0&&(m+=" [pressed]"),h.selected===!0&&(m+=" [selected]"),h.ref&&(m+=` [ref=${h.ref}]`,g&&Fe(h)&&(m+=" [cursor=pointer]")),n.renderBoxes){let S=Jt(h);if(S){let E=S.getBoundingClientRect();m+=` [box=${Math.round(E.x)},${Math.round(E.y)},${Math.round(E.width)},${Math.round(E.height)}]`}}return m},u=h=>(h==null?void 0:h.children.length)===1&&typeof h.children[0]=="string"&&!Object.keys(h.props).length?h.children[0]:void 0,f=(h,g,m)=>{if(e.depth&&g>e.depth)return;if(h.role==="iframe"&&h.ref&&(s[h.ref]=g),c.get(h)==="same"&&h.ref){i.push(Gt(g)+`- ref=${h.ref} [unchanged]`);return}let S=!!t&&!g,E=Gt(g)+"- "+(S?"<changed> ":"")+Cn(d(h,m)),y=u(h),D=!!e.depth&&g===e.depth;if(!y&&(!h.children.length||D)&&!Object.keys(h.props).length)i.push(E);else if(y!==void 0)o(h,y)?i.push(E+": "+Ft(a(y))):i.push(E);else{i.push(E+":");for(let[N,G]of Object.entries(h.props))i.push(Gt(g+1)+"- /"+N+": "+Ft(G));let re=!!h.ref&&m&&Fe(h);for(let N of h.children)typeof N=="string"?p(o(h,N)?N:"",g+1):f(N,g+1,m&&!re)}};for(let h of l)typeof h=="string"?p(h,0):f(h,0,!!n.renderCursorPointer);return{text:i.join(`\n`),iframeDepths:s}}function Cs(r){let e=[{regex:/\\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\b/,replacement:"[0-9a-fA-F-]+"},{regex:/\\b[\\d,.]+[bkmBKM]+\\b/,replacement:"[\\\\d,.]+[bkmBKM]+"},{regex:/\\b\\d+[hmsp]+\\b/,replacement:"\\\\d+[hmsp]+"},{regex:/\\b[\\d,.]+[hmsp]+\\b/,replacement:"[\\\\d,.]+[hmsp]+"},{regex:/\\b\\d+,\\d+\\b/,replacement:"\\\\d+,\\\\d+"},{regex:/\\b\\d+\\.\\d{2,}\\b/,replacement:"\\\\d+\\\\.\\\\d+"},{regex:/\\b\\d{2,}\\.\\d+\\b/,replacement:"\\\\d+\\\\.\\\\d+"},{regex:/\\b\\d{2,}\\b/,replacement:"\\\\d+"}],t="",n=0,i=new RegExp(e.map(s=>"("+s.regex.source+")").join("|"),"g");return r.replace(i,(s,...o)=>{let a=o[o.length-2],l=o.slice(0,-2);t+=ke(r.slice(n,a));for(let c=0;c<l.length;c++)if(l[c]){let{replacement:p}=e[c];t+=p;break}return n=a+s.length,s}),t?(t+=ke(r.slice(n)),String(new RegExp(t))):r}function ks(r,e){if(!e.length)return!1;if(!r.name)return!0;let t=e.length<=200&&r.name.length<=200?En(e,r.name):"",n=e;for(;t&&n.includes(t);)n=n.replace(t,"");return n.trim().length/e.length>.1}var li=Symbol("element");function Jt(r){return r[li]}function qr(r,e){r[li]=e}function ci(r,e){let t=un(r,e);return t?Jt(t):void 0}var Ur=`:host{font-size:13px;font-family:system-ui,Ubuntu,Droid Sans,sans-serif;color:#333;color-scheme:light}svg{position:absolute;height:0}x-pw-tooltip{backdrop-filter:blur(5px);background-color:#fff;border-radius:6px;box-shadow:0 .5rem 1.2rem #0000004d;display:none;font-size:12.8px;font-weight:400;left:0;line-height:1.5;max-width:600px;position:absolute;top:0;padding:0;flex-direction:column;overflow:hidden}x-pw-tooltip-line{display:flex;max-width:600px;padding:6px;user-select:none;cursor:pointer}x-pw-tooltip-footer{display:flex;max-width:600px;padding:6px;user-select:none;color:#777}x-pw-dialog{background-color:#fff;pointer-events:auto;border-radius:6px;box-shadow:0 .5rem 1.2rem #0000004d;display:flex;flex-direction:column;position:absolute;z-index:10;font-size:13px}x-pw-dialog:not(.autosize){width:400px;height:150px}x-pw-dialog-body{display:flex;flex-direction:column;flex:auto}x-pw-dialog-body label{margin:5px 8px;display:flex;flex-direction:row;align-items:center}x-pw-highlight{position:absolute;top:0;left:0;width:0;height:0}x-pw-action-point{position:absolute;width:20px;height:20px;background:red;border-radius:10px;margin:-10px 0 0 -10px;z-index:2}x-pw-action-cursor{position:absolute;width:18px;height:22px;pointer-events:none;z-index:4;filter:drop-shadow(0 1px 2px rgba(0,0,0,.4))}x-pw-action-cursor svg{width:100%;height:100%;position:static}x-pw-title{position:absolute;backdrop-filter:blur(5px);background-color:#00000080;color:#fff;border-radius:6px;padding:6px;font-size:24px;line-height:1.4;white-space:nowrap;user-select:none;z-index:3}x-pw-user-overlays,x-pw-user-overlay{position:absolute;inset:0}@keyframes pw-fade-out{0%{opacity:1}to{opacity:0}}x-pw-separator{height:1px;margin:6px 9px;background:#949494e5}x-pw-tool-gripper{height:28px;width:24px;margin:2px 0;cursor:grab}x-pw-tool-gripper:active{cursor:grabbing}x-pw-tool-gripper>x-div{width:16px;height:16px;margin:6px 4px;clip-path:url(#icon-gripper);background-color:#555}x-pw-tools-list>label{display:flex;align-items:center;margin:0 10px;user-select:none}x-pw-tools-list{display:flex;width:100%;border-bottom:1px solid #dddddd}x-pw-tool-item{pointer-events:auto;height:28px;width:28px;border-radius:3px}x-pw-tool-item:not(.disabled){cursor:pointer}x-pw-tool-item:not(.disabled):hover{background-color:#dbdbdb}x-pw-tool-item.toggled{background-color:#8acae480}x-pw-tool-item.toggled:not(.disabled):hover{background-color:#8acae4c4}x-pw-tool-item>x-div{width:16px;height:16px;margin:6px;background-color:#3a3a3a}x-pw-tool-item.disabled>x-div{background-color:#61616180;cursor:default}x-pw-tool-item.record.toggled{background-color:transparent}x-pw-tool-item.record.toggled:not(.disabled):hover{background-color:#dbdbdb}x-pw-tool-item.record.toggled>x-div{background-color:#a1260d}x-pw-tool-item.record.disabled.toggled>x-div{opacity:.8}x-pw-tool-item.accept>x-div{background-color:#388a34}x-pw-tool-item.record>x-div{clip-path:url(#icon-circle-large-filled)}x-pw-tool-item.record.toggled>x-div{clip-path:url(#icon-stop-circle)}x-pw-tool-item.pick-locator>x-div{clip-path:url(#icon-inspect)}x-pw-tool-item.text>x-div{clip-path:url(#icon-whole-word)}x-pw-tool-item.visibility>x-div{clip-path:url(#icon-eye)}x-pw-tool-item.value>x-div{clip-path:url(#icon-symbol-constant)}x-pw-tool-item.snapshot>x-div{clip-path:url(#icon-gist)}x-pw-tool-item.accept>x-div{clip-path:url(#icon-check)}x-pw-tool-item.cancel>x-div{clip-path:url(#icon-close)}x-pw-tool-item.succeeded>x-div{clip-path:url(#icon-pass);background-color:#388a34!important}x-pw-overlay{position:absolute;top:0;max-width:min-content;z-index:2147483647;background:transparent;pointer-events:auto}x-pw-overlay x-pw-tools-list{background-color:#fffd;box-shadow:#0000001a 0 5px 5px;border-radius:3px;border-bottom:none}x-pw-overlay x-pw-tool-item{margin:2px}textarea.text-editor{font-family:system-ui,Ubuntu,Droid Sans,sans-serif;flex:auto;border:none;margin:6px 10px;color:#333;outline:1px solid transparent!important;resize:none;padding:0;font-size:13px}textarea.text-editor.does-not-match{outline:1px solid red!important}x-div{display:block}x-spacer{flex:auto}*{box-sizing:border-box}*[hidden]{display:none!important}x-locator-editor{flex:none;width:100%;height:60px;padding:4px;border-bottom:1px solid #dddddd;outline:1px solid transparent}x-locator-editor.does-not-match{outline:1px solid red}.CodeMirror{width:100%!important;height:100%!important}x-pw-action-list{flex:auto;display:flex;flex-direction:column;user-select:none}x-pw-action-item{padding:6px 10px;cursor:pointer;overflow:hidden}x-pw-action-item:hover{background-color:#f2f2f2}x-pw-action-item:last-child{border-bottom-left-radius:6px;border-bottom-right-radius:6px}\n`;var Oe=class{constructor(e){this._renderedEntries=[];this._userOverlays=new Map;this._userOverlayHidden=!1;this._language="javascript";this._elementHighlightSelectors=new Map;this._injectedScript=e;let t=e.document;if(this._isUnderTest=e.isUnderTest,this._glassPaneElement=t.createElement("x-pw-glass"),this._glassPaneElement.setAttribute("popover","manual"),this._glassPaneElement.style.inset="0",this._glassPaneElement.style.width="100%",this._glassPaneElement.style.height="100%",this._glassPaneElement.style.maxWidth="none",this._glassPaneElement.style.maxHeight="none",this._glassPaneElement.style.padding="0",this._glassPaneElement.style.margin="0",this._glassPaneElement.style.border="none",this._glassPaneElement.style.overflow="visible",this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.display="flex",this._glassPaneElement.style.backgroundColor="transparent",this._actionPointElement=t.createElement("x-pw-action-point"),this._actionPointElement.setAttribute("hidden","true"),this._actionCursorElement=t.createElement("x-pw-action-cursor"),this._actionCursorElement.style.visibility="hidden",this._actionCursorElement.appendChild(this._createCursorSvg(t)),this._titleElement=t.createElement("x-pw-title"),this._titleElement.setAttribute("hidden","true"),this._userOverlayContainer=t.createElement("x-pw-user-overlays"),this._userOverlayContainer.setAttribute("hidden","true"),this._glassPaneShadow=this._glassPaneElement.attachShadow({mode:this._isUnderTest?"open":"closed"}),typeof this._glassPaneShadow.adoptedStyleSheets.push=="function"){let n=new this._injectedScript.window.CSSStyleSheet;n.replaceSync(Ur),this._glassPaneShadow.adoptedStyleSheets.push(n)}else{let n=this._injectedScript.document.createElement("style");n.textContent=Ur,this._glassPaneShadow.appendChild(n)}this._glassPaneShadow.appendChild(this._actionPointElement),this._glassPaneShadow.appendChild(this._actionCursorElement),this._glassPaneShadow.appendChild(this._titleElement),this._glassPaneShadow.appendChild(this._userOverlayContainer)}install(){this._injectedScript.document.documentElement&&((!this._injectedScript.document.documentElement.contains(this._glassPaneElement)||this._glassPaneElement.nextElementSibling)&&this._injectedScript.document.documentElement.appendChild(this._glassPaneElement),this._bringToFront())}_bringToFront(){this._glassPaneElement.hidePopover(),this._glassPaneElement.showPopover()}setLanguage(e){this._language=e}addElementHighlight(e,t){let n=$(e);this._elementHighlightSelectors.set(n,{selector:e,cssStyle:t}),this._ensureElementHighlightRaf()}removeElementHighlight(e){let t=$(e);this._elementHighlightSelectors.delete(t)&&this._elementHighlightSelectors.size===0&&(this._rafRequest&&(this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0),this.clearHighlight())}_ensureElementHighlightRaf(){if(this._rafRequest)return;let e=()=>{let t=[];for(let{selector:n,cssStyle:i}of this._elementHighlightSelectors.values()){let s=this._injectedScript.querySelectorAll(n,this._injectedScript.document.documentElement),o=K(this._language,$(n)),a=s.length>1?"#f6b26b7f":"#6fa8dc7f";for(let l=0;l<s.length;++l){let c=s.length>1?` [${l+1} of ${s.length}]`:"";t.push({element:s[l],color:a,tooltipText:o+c,cssStyle:i})}}this.updateHighlight(t),this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)};this._rafRequest=this._injectedScript.utils.builtins.requestAnimationFrame(e)}uninstall(){this._rafRequest&&(this._injectedScript.utils.builtins.cancelAnimationFrame(this._rafRequest),this._rafRequest=void 0),this._elementHighlightSelectors.clear(),this._glassPaneElement.remove()}showActionPoint(e,t,n){this._actionPointElement.style.top=t+"px",this._actionPointElement.style.left=e+"px",this._actionPointElement.hidden=!1,n?this._actionPointElement.style.animation=`pw-fade-out ${n}ms ease-out forwards`:this._actionPointElement.style.animation=""}hideActionPoint(){this._actionPointElement.hidden=!0}moveActionCursor(e,t,n){let i=n?Math.max(80,Math.min(n*.6,400)):0;this._actionCursorElement.style.transition=`top ${i}ms ease, left ${i}ms ease`,this._actionCursorElement.style.left=e+"px",this._actionCursorElement.style.top=t+"px",this._actionCursorElement.style.visibility="visible"}hideActionCursor(){this._actionCursorElement.style.visibility="hidden"}_createCursorSvg(e){let t="http://www.w3.org/2000/svg",n=e.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 18 22");let i=e.createElementNS(t,"path");return i.setAttribute("d","M1 1 L1 17 L5.5 13 L8 20.5 L11 19.5 L8.5 12 L15 12 Z"),i.setAttribute("fill","white"),i.setAttribute("stroke","black"),i.setAttribute("stroke-width","1.5"),i.setAttribute("stroke-linejoin","round"),n.appendChild(i),n}showActionTitle(e,t,n,i){if(this._titleElement.textContent=e,this._titleElement.hidden=!1,t){let s=t/4;this._titleElement.style.animation=`pw-fade-out ${s}ms ease-out ${t-s}ms forwards`}else this._titleElement.style.animation="";switch(this._titleElement.style.top="",this._titleElement.style.bottom="",this._titleElement.style.left="",this._titleElement.style.right="",this._titleElement.style.transform="",n){case"top-left":this._titleElement.style.top="6px",this._titleElement.style.left="6px";break;case"top":this._titleElement.style.top="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-left":this._titleElement.style.bottom="6px",this._titleElement.style.left="6px";break;case"bottom":this._titleElement.style.bottom="6px",this._titleElement.style.left="50%",this._titleElement.style.transform="translateX(-50%)";break;case"bottom-right":this._titleElement.style.bottom="6px",this._titleElement.style.right="6px";break;default:this._titleElement.style.top="6px",this._titleElement.style.right="6px";break}i&&(this._titleElement.style.fontSize=i+"px")}hideActionTitle(){this._titleElement.hidden=!0}addUserOverlay(e,t){let n=this._injectedScript.document.createElement("div");n.className="x-pw-user-overlay",n.innerHTML=t;for(let i of n.querySelectorAll("script"))i.remove();for(let i of n.querySelectorAll("*"))for(let s of[...i.attributes])s.name.startsWith("on")&&i.removeAttribute(s.name);return this._userOverlays.set(e,n),this._userOverlayContainer.appendChild(n),this._userOverlayContainer.hidden=this._userOverlayHidden,e}getUserOverlay(e){return this._userOverlays.get(e)}removeUserOverlay(e){let t=this._userOverlays.get(e);t&&(t.remove(),this._userOverlays.delete(e)),this._userOverlays.size===0&&(this._userOverlayContainer.hidden=!0)}setUserOverlaysVisible(e){this._userOverlayHidden=!e,this._userOverlayContainer.hidden=!e||this._userOverlays.size===0}clearHighlight(){var e,t;for(let n of this._renderedEntries)(e=n.highlightElement)==null||e.remove(),(t=n.tooltipElement)==null||t.remove();this._renderedEntries=[]}maskElements(e,t){this.updateHighlight(e.map(n=>({element:n,color:t})))}updateHighlight(e){if(!this._highlightIsUpToDate(e)){this.clearHighlight();for(let t of e){let n=this._createHighlightElement();this._glassPaneShadow.appendChild(n);let i;if(t.tooltipText){i=this._injectedScript.document.createElement("x-pw-tooltip"),this._glassPaneShadow.appendChild(i),i.style.top="0",i.style.left="0",i.style.display="flex";let s=this._injectedScript.document.createElement("x-pw-tooltip-line");s.textContent=t.tooltipText,i.appendChild(s)}this._renderedEntries.push({targetElement:t.element,box:ui(t.box),color:t.color,borderColor:t.borderColor,fadeDuration:t.fadeDuration,cssStyle:t.cssStyle,tooltipElement:i,highlightElement:n})}for(let t of this._renderedEntries){if(!t.box&&!t.targetElement||(t.box=t.box||t.targetElement.getBoundingClientRect(),!t.tooltipElement))continue;let{anchorLeft:n,anchorTop:i}=this.tooltipPosition(t.box,t.tooltipElement);t.tooltipTop=i,t.tooltipLeft=n}for(let t of this._renderedEntries){t.tooltipElement&&(t.tooltipElement.style.top=t.tooltipTop+"px",t.tooltipElement.style.left=t.tooltipLeft+"px");let n=t.box;t.highlightElement.style.backgroundColor=t.color,t.highlightElement.style.left=n.x+"px",t.highlightElement.style.top=n.y+"px",t.highlightElement.style.width=n.width+"px",t.highlightElement.style.height=n.height+"px",t.highlightElement.style.display="block",t.borderColor&&(t.highlightElement.style.border="2px solid "+t.borderColor),t.fadeDuration&&(t.highlightElement.style.animation=`pw-fade-out ${t.fadeDuration}ms ease-out forwards`),t.cssStyle&&(t.highlightElement.style.cssText+=";"+t.cssStyle),this._isUnderTest&&console.error("Highlight box for test: "+JSON.stringify({x:n.x,y:n.y,width:n.width,height:n.height}))}}}firstBox(){var e;return(e=this._renderedEntries[0])==null?void 0:e.box}firstTooltipBox(){let e=this._renderedEntries[0];if(!(!e||!e.tooltipElement||e.tooltipLeft===void 0||e.tooltipTop===void 0))return{x:e.tooltipLeft,y:e.tooltipTop,left:e.tooltipLeft,top:e.tooltipTop,width:e.tooltipElement.offsetWidth,height:e.tooltipElement.offsetHeight,bottom:e.tooltipTop+e.tooltipElement.offsetHeight,right:e.tooltipLeft+e.tooltipElement.offsetWidth,toJSON:()=>{}}}tooltipPosition(e,t){let n=t.offsetWidth,i=t.offsetHeight,s=this._glassPaneElement.offsetWidth,o=this._glassPaneElement.offsetHeight,a=Math.max(5,e.left);a+n>s-5&&(a=s-n-5);let l=Math.max(0,e.bottom)+5;return l+i>o-5&&(Math.max(0,e.top)>i+5?l=Math.max(0,e.top)-i-5:l=o-5-i),{anchorLeft:a,anchorTop:l}}_highlightIsUpToDate(e){if(e.length!==this._renderedEntries.length)return!1;for(let t=0;t<this._renderedEntries.length;++t){if(e[t].element!==this._renderedEntries[t].targetElement||e[t].color!==this._renderedEntries[t].color||e[t].cssStyle!==this._renderedEntries[t].cssStyle)return!1;let n=this._renderedEntries[t].box;if(!n)return!1;let i=e[t].box?ui(e[t].box):e[t].element.getBoundingClientRect();if(i.top!==n.top||i.right!==n.right||i.bottom!==n.bottom||i.left!==n.left)return!1}return!0}_createHighlightElement(){return this._injectedScript.document.createElement("x-pw-highlight")}appendChild(e){this._glassPaneShadow.appendChild(e)}onGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="auto",this._glassPaneElement.style.backgroundColor="rgba(0, 0, 0, 0.3)",this._glassPaneElement.addEventListener("click",e)}offGlassPaneClick(e){this._glassPaneElement.style.pointerEvents="none",this._glassPaneElement.style.backgroundColor="transparent",this._glassPaneElement.removeEventListener("click",e)}};function ui(r){if(r)return new DOMRect(r.x,r.y,r.width,r.height)}function Rs(r,e,t){let n=r.left-e.right;if(!(n<0||t!==void 0&&n>t))return n+Math.max(e.bottom-r.bottom,0)+Math.max(r.top-e.top,0)}function Ls(r,e,t){let n=e.left-r.right;if(!(n<0||t!==void 0&&n>t))return n+Math.max(e.bottom-r.bottom,0)+Math.max(r.top-e.top,0)}function Is(r,e,t){let n=e.top-r.bottom;if(!(n<0||t!==void 0&&n>t))return n+Math.max(r.left-e.left,0)+Math.max(e.right-r.right,0)}function Ms(r,e,t){let n=r.top-e.bottom;if(!(n<0||t!==void 0&&n>t))return n+Math.max(r.left-e.left,0)+Math.max(e.right-r.right,0)}function Os(r,e,t){let n=t===void 0?50:t,i=0;return r.left-e.right>=0&&(i+=r.left-e.right),e.left-r.right>=0&&(i+=e.left-r.right),e.top-r.bottom>=0&&(i+=e.top-r.bottom),r.top-e.bottom>=0&&(i+=r.top-e.bottom),i>n?void 0:i}var di=["left-of","right-of","above","below","near"];function Yt(r,e,t,n){let i=e.getBoundingClientRect(),s={"left-of":Ls,"right-of":Rs,above:Is,below:Ms,near:Os}[r],o;for(let a of t){if(a===e)continue;let l=s(i,a.getBoundingClientRect(),n);l!==void 0&&(o===void 0||l<o)&&(o=l)}return o}function jr(r,e){let t=typeof r=="string"&&!e.caseSensitive?r.toUpperCase():r,n=typeof e.value=="string"&&!e.caseSensitive?e.value.toUpperCase():e.value;return e.op==="<truthy>"?!!t:e.op==="="?n instanceof RegExp?typeof t=="string"&&!!t.match(n):t===n:typeof t!="string"||typeof n!="string"?!1:e.op==="*="?t.includes(n):e.op==="^="?t.startsWith(n):e.op==="$="?t.endsWith(n):e.op==="|="?t===n||t.startsWith(n+"-"):e.op==="~="?t.split(" ").includes(n):!1}function Xt(r){let e=r.ownerDocument;return r.nodeName==="SCRIPT"||r.nodeName==="NOSCRIPT"||r.nodeName==="STYLE"||e.head&&e.head.contains(r)}function P(r,e){let t=r.get(e);if(t===void 0){if(t={full:"",normalized:"",immediate:[]},!Xt(e)){let n="";if(e instanceof HTMLInputElement&&(e.type==="submit"||e.type==="button"))t={full:e.value,normalized:v(e.value),immediate:[e.value]};else{for(let i=e.firstChild;i;i=i.nextSibling)if(i.nodeType===Node.TEXT_NODE)t.full+=i.nodeValue||"",n+=i.nodeValue||"";else{if(i.nodeType===Node.COMMENT_NODE)continue;n&&t.immediate.push(n),n="",i.nodeType===Node.ELEMENT_NODE&&(t.full+=P(r,i).full)}n&&t.immediate.push(n),e.shadowRoot&&(t.full+=P(r,e.shadowRoot).full),t.full&&(t.normalized=v(t.full))}}r.set(e,t)}return t}function $e(r,e,t){if(Xt(e)||!t(P(r,e)))return"none";for(let n=e.firstChild;n;n=n.nextSibling)if(n.nodeType===Node.ELEMENT_NODE&&t(P(r,n)))return"selfAndChildren";return e.shadowRoot&&t(P(r,e.shadowRoot))?"selfAndChildren":"self"}function Kt(r,e){let t=Or(e);if(t)return t.map(s=>P(r,s));let n=e.getAttribute("aria-label");if(n!==null&&n.trim())return[{full:n,normalized:v(n),immediate:[n]}];let i=e.nodeName==="INPUT"&&e.type!=="hidden";if(["BUTTON","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"].includes(e.nodeName)||i){let s=e.labels;if(s)return[...s].map(o=>P(r,o))}return[]}var hi=["selected","checked","pressed","expanded","level","disabled","name","description","include-hidden"];hi.sort();function Lt(r,e,t){if(!e.includes(t))throw new Error(`"${r}" attribute is only supported for roles: ${e.slice().sort().map(n=>`"${n}"`).join(", ")}`)}function Pe(r,e){if(r.op!=="<truthy>"&&!e.includes(r.value))throw new Error(`"${r.name}" must be one of ${e.map(t=>JSON.stringify(t)).join(", ")}`)}function De(r,e){if(!e.includes(r.op))throw new Error(`"${r.name}" does not support "${r.op}" matcher`)}function $s(r,e){let t={role:e};for(let n of r)switch(n.name){case"checked":{Lt(n.name,Ct,e),Pe(n,[!0,!1,"mixed"]),De(n,["<truthy>","="]),t.checked=n.op==="<truthy>"?!0:n.value;break}case"pressed":{Lt(n.name,kt,e),Pe(n,[!0,!1,"mixed"]),De(n,["<truthy>","="]),t.pressed=n.op==="<truthy>"?!0:n.value;break}case"selected":{Lt(n.name,_t,e),Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.selected=n.op==="<truthy>"?!0:n.value;break}case"expanded":{Lt(n.name,Nt,e),Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.expanded=n.op==="<truthy>"?!0:n.value;break}case"level":{if(Lt(n.name,Rt,e),typeof n.value=="string"&&(n.value=+n.value),n.op!=="="||typeof n.value!="number"||Number.isNaN(n.value))throw new Error(\'"level" attribute must be compared to a number\');t.level=n.value;break}case"disabled":{Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.disabled=n.op==="<truthy>"?!0:n.value;break}case"name":{if(n.op==="<truthy>")throw new Error(\'"name" attribute must have a value\');if(typeof n.value!="string"&&!(n.value instanceof RegExp))throw new Error(\'"name" attribute must be a string or a regular expression\');t.name=n.value,t.nameOp=n.op,t.nameExact=n.caseSensitive;break}case"description":{if(n.op==="<truthy>")throw new Error(\'"description" attribute must have a value\');if(typeof n.value!="string"&&!(n.value instanceof RegExp))throw new Error(\'"description" attribute must be a string or a regular expression\');t.description=n.value,t.descriptionOp=n.op,t.descriptionExact=n.caseSensitive;break}case"include-hidden":{Pe(n,[!0,!1]),De(n,["<truthy>","="]),t.includeHidden=n.op==="<truthy>"?!0:n.value;break}default:throw new Error(`Unknown attribute "${n.name}", must be one of ${hi.map(i=>`"${i}"`).join(", ")}.`)}return t}function Ps(r,e,t){let n=[],i=o=>{if(k(o)===e.role&&!(e.selected!==void 0&&jt(o)!==e.selected)&&!(e.checked!==void 0&&Wt(o)!==e.checked)&&!(e.pressed!==void 0&&Vt(o)!==e.pressed)&&!(e.expanded!==void 0&&zt(o)!==e.expanded)&&!(e.level!==void 0&&Qt(o)!==e.level)&&!(e.disabled!==void 0&&Ee(o)!==e.disabled)&&!(!e.includeHidden&&F(o))){if(e.name!==void 0){let a=v(ee(o,!!e.includeHidden));if(typeof e.name=="string"&&(e.name=v(e.name)),t&&!e.nameExact&&e.nameOp==="="&&(e.nameOp="*="),!jr(a,{name:"",jsonPath:[],op:e.nameOp||"=",value:e.name,caseSensitive:!!e.nameExact}))return}if(e.description!==void 0){let a=v(ae(o,!!e.includeHidden));if(typeof e.description=="string"&&(e.description=v(e.description)),t&&!e.descriptionExact&&e.descriptionOp==="="&&(e.descriptionOp="*="),!jr(a,{name:"",jsonPath:[],op:e.descriptionOp||"=",value:e.description,caseSensitive:!!e.descriptionExact}))return}n.push(o)}},s=o=>{let a=[];o.shadowRoot&&a.push(o.shadowRoot);for(let l of o.querySelectorAll("*"))i(l),l.shadowRoot&&a.push(l.shadowRoot);a.forEach(s)};return s(r),n}function Wr(r){return{queryAll:(e,t)=>{let n=X(t,!0),i=n.name.toLowerCase();if(!i)throw new Error("Role must not be empty");let s=$s(n.attributes,i);le();try{return Ps(e,s,r)}finally{ce()}}}}var er=class{constructor(){this._retainCacheCounter=0;this._cacheText=new Map,this._cacheQueryCSS=new Map,this._cacheMatches=new Map,this._cacheQuery=new Map,this._cacheMatchesSimple=new Map,this._cacheMatchesParents=new Map,this._cacheCallMatches=new Map,this._cacheCallQuery=new Map,this._cacheQuerySimple=new Map,this._engines=new Map,this._engines.set("not",qs),this._engines.set("is",Mt),this._engines.set("where",Mt),this._engines.set("has",Ds),this._engines.set("scope",Hs),this._engines.set("light",Bs),this._engines.set("visible",Fs),this._engines.set("text",Us),this._engines.set("text-is",js),this._engines.set("text-matches",Ws),this._engines.set("has-text",Vs),this._engines.set("right-of",It("right-of")),this._engines.set("left-of",It("left-of")),this._engines.set("above",It("above")),this._engines.set("below",It("below")),this._engines.set("near",It("near")),this._engines.set("nth-match",zs);let e=[...this._engines.keys()];e.sort();let t=[...yr];if(t.sort(),e.join("|")!==t.join("|"))throw new Error(`Please keep customCSSNames in sync with evaluator engines: ${e.join("|")} vs ${t.join("|")}`)}begin(){++this._retainCacheCounter}end(){--this._retainCacheCounter,this._retainCacheCounter||(this._cacheQueryCSS.clear(),this._cacheMatches.clear(),this._cacheQuery.clear(),this._cacheMatchesSimple.clear(),this._cacheMatchesParents.clear(),this._cacheCallMatches.clear(),this._cacheCallQuery.clear(),this._cacheQuerySimple.clear(),this._cacheText.clear())}_cached(e,t,n,i){e.has(t)||e.set(t,[]);let s=e.get(t),o=s.find(l=>n.every((c,p)=>l.rest[p]===c));if(o)return o.result;let a=i();return s.push({rest:n,result:a}),a}_checkSelector(e){if(!(typeof e=="object"&&e&&(Array.isArray(e)||"simples"in e&&e.simples.length)))throw new Error(`Malformed selector "${e}"`);return e}matches(e,t,n){let i=this._checkSelector(t);this.begin();try{return this._cached(this._cacheMatches,e,[i,n.scope,n.pierceShadow,n.originalScope],()=>Array.isArray(i)?this._matchesEngine(Mt,e,i,n):(this._hasScopeClause(i)&&(n=this._expandContextForScopeMatching(n)),this._matchesSimple(e,i.simples[i.simples.length-1].selector,n)?this._matchesParents(e,i,i.simples.length-2,n):!1))}finally{this.end()}}query(e,t){let n=this._checkSelector(t);this.begin();try{return this._cached(this._cacheQuery,n,[e.scope,e.pierceShadow,e.originalScope],()=>{if(Array.isArray(n))return this._queryEngine(Mt,e,n);this._hasScopeClause(n)&&(e=this._expandContextForScopeMatching(e));let i=this._scoreMap;this._scoreMap=new Map;let s=this._querySimple(e,n.simples[n.simples.length-1].selector);return s=s.filter(o=>this._matchesParents(o,n,n.simples.length-2,e)),this._scoreMap.size&&s.sort((o,a)=>{let l=this._scoreMap.get(o),c=this._scoreMap.get(a);return l===c?0:l===void 0?1:c===void 0?-1:l-c}),this._scoreMap=i,s})}finally{this.end()}}_markScore(e,t){this._scoreMap&&this._scoreMap.set(e,t)}_hasScopeClause(e){return e.simples.some(t=>t.selector.functions.some(n=>n.name==="scope"))}_expandContextForScopeMatching(e){if(e.scope.nodeType!==1)return e;let t=I(e.scope);return t?{...e,scope:t,originalScope:e.originalScope||e.scope}:e}_matchesSimple(e,t,n){return this._cached(this._cacheMatchesSimple,e,[t,n.scope,n.pierceShadow,n.originalScope],()=>{if(e===n.scope||t.css&&!this._matchesCSS(e,t.css))return!1;for(let i of t.functions)if(!this._matchesEngine(this._getEngine(i.name),e,i.args,n))return!1;return!0})}_querySimple(e,t){return t.functions.length?this._cached(this._cacheQuerySimple,t,[e.scope,e.pierceShadow,e.originalScope],()=>{let n=t.css,i=t.functions;n==="*"&&i.length&&(n=void 0);let s,o=-1;n!==void 0?s=this._queryCSS(e,n):(o=i.findIndex(a=>this._getEngine(a.name).query!==void 0),o===-1&&(o=0),s=this._queryEngine(this._getEngine(i[o].name),e,i[o].args));for(let a=0;a<i.length;a++){if(a===o)continue;let l=this._getEngine(i[a].name);l.matches!==void 0&&(s=s.filter(c=>this._matchesEngine(l,c,i[a].args,e)))}for(let a=0;a<i.length;a++){if(a===o)continue;let l=this._getEngine(i[a].name);l.matches===void 0&&(s=s.filter(c=>this._matchesEngine(l,c,i[a].args,e)))}return s}):this._queryCSS(e,t.css||"*")}_matchesParents(e,t,n,i){return n<0?!0:this._cached(this._cacheMatchesParents,e,[t,n,i.scope,i.pierceShadow,i.originalScope],()=>{let{selector:s,combinator:o}=t.simples[n];if(o===">"){let a=Zt(e,i);return!a||!this._matchesSimple(a,s,i)?!1:this._matchesParents(a,t,n-1,i)}if(o==="+"){let a=Vr(e,i);return!a||!this._matchesSimple(a,s,i)?!1:this._matchesParents(a,t,n-1,i)}if(o===""){let a=Zt(e,i);for(;a;){if(this._matchesSimple(a,s,i)){if(this._matchesParents(a,t,n-1,i))return!0;if(t.simples[n-1].combinator==="")break}a=Zt(a,i)}return!1}if(o==="~"){let a=Vr(e,i);for(;a;){if(this._matchesSimple(a,s,i)){if(this._matchesParents(a,t,n-1,i))return!0;if(t.simples[n-1].combinator==="~")break}a=Vr(a,i)}return!1}if(o===">="){let a=e;for(;a;){if(this._matchesSimple(a,s,i)){if(this._matchesParents(a,t,n-1,i))return!0;if(t.simples[n-1].combinator==="")break}a=Zt(a,i)}return!1}throw new Error(`Unsupported combinator "${o}"`)})}_matchesEngine(e,t,n,i){if(e.matches)return this._callMatches(e,t,n,i);if(e.query)return this._callQuery(e,n,i).includes(t);throw new Error(\'Selector engine should implement "matches" or "query"\')}_queryEngine(e,t,n){if(e.query)return this._callQuery(e,n,t);if(e.matches)return this._queryCSS(t,"*").filter(i=>this._callMatches(e,i,n,t));throw new Error(\'Selector engine should implement "matches" or "query"\')}_callMatches(e,t,n,i){return this._cached(this._cacheCallMatches,t,[e,i.scope,i.pierceShadow,i.originalScope,...n],()=>e.matches(t,n,i,this))}_callQuery(e,t,n){return this._cached(this._cacheCallQuery,e,[n.scope,n.pierceShadow,n.originalScope,...t],()=>e.query(n,t,this))}_matchesCSS(e,t){return e.matches(t)}_queryCSS(e,t){return this._cached(this._cacheQueryCSS,t,[e.scope,e.pierceShadow,e.originalScope],()=>{let n=[];function i(s){if(n=n.concat([...s.querySelectorAll(t)]),!!e.pierceShadow){s.shadowRoot&&i(s.shadowRoot);for(let o of s.querySelectorAll("*"))o.shadowRoot&&i(o.shadowRoot)}}return i(e.scope),n})}_getEngine(e){let t=this._engines.get(e);if(!t)throw new Error(`Unknown selector engine "${e}"`);return t}},Mt={matches(r,e,t,n){if(e.length===0)throw new Error(\'"is" engine expects non-empty selector list\');return e.some(i=>n.matches(r,i,t))},query(r,e,t){if(e.length===0)throw new Error(\'"is" engine expects non-empty selector list\');let n=[];for(let i of e)n=n.concat(t.query(r,i));return e.length===1?n:zr(n)}},Ds={matches(r,e,t,n){if(e.length===0)throw new Error(\'"has" engine expects non-empty selector list\');return n.query({...t,scope:r},e).length>0}},Hs={matches(r,e,t,n){if(e.length!==0)throw new Error(\'"scope" engine expects no arguments\');let i=t.originalScope||t.scope;return i.nodeType===9?r===i.documentElement:r===i},query(r,e,t){if(e.length!==0)throw new Error(\'"scope" engine expects no arguments\');let n=r.originalScope||r.scope;if(n.nodeType===9){let i=n.documentElement;return i?[i]:[]}return n.nodeType===1?[n]:[]}},qs={matches(r,e,t,n){if(e.length===0)throw new Error(\'"not" engine expects non-empty selector list\');return!n.matches(r,e,t)}},Bs={query(r,e,t){return t.query({...r,pierceShadow:!1},e)},matches(r,e,t,n){return n.matches(r,e,{...t,pierceShadow:!1})}},Fs={matches(r,e,t,n){if(e.length)throw new Error(\'"visible" engine expects no arguments\');return W(r)}},Us={matches(r,e,t,n){if(e.length!==1||typeof e[0]!="string")throw new Error(\'"text" engine expects a single string\');let i=v(e[0]).toLowerCase(),s=o=>o.normalized.toLowerCase().includes(i);return $e(n._cacheText,r,s)==="self"}},js={matches(r,e,t,n){if(e.length!==1||typeof e[0]!="string")throw new Error(\'"text-is" engine expects a single string\');let i=v(e[0]),s=o=>!i&&!o.immediate.length?!0:o.immediate.some(a=>v(a)===i);return $e(n._cacheText,r,s)!=="none"}},Ws={matches(r,e,t,n){if(e.length===0||typeof e[0]!="string"||e.length>2||e.length===2&&typeof e[1]!="string")throw new Error(\'"text-matches" engine expects a regexp body and optional regexp flags\');let i=new RegExp(e[0],e.length===2?e[1]:void 0),s=o=>i.test(o.full);return $e(n._cacheText,r,s)==="self"}},Vs={matches(r,e,t,n){if(e.length!==1||typeof e[0]!="string")throw new Error(\'"has-text" engine expects a single string\');if(Xt(r))return!1;let i=v(e[0]).toLowerCase();return(o=>o.normalized.toLowerCase().includes(i))(P(n._cacheText,r))}};function It(r){return{matches(e,t,n,i){let s=t.length&&typeof t[t.length-1]=="number"?t[t.length-1]:void 0,o=s===void 0?t:t.slice(0,t.length-1);if(t.length<1+(s===void 0?0:1))throw new Error(`"${r}" engine expects a selector list and optional maximum distance in pixels`);let a=i.query(n,o),l=Yt(r,e,a,s);return l===void 0?!1:(i._markScore(e,l),!0)}}}var zs={query(r,e,t){let n=e[e.length-1];if(e.length<2)throw new Error(\'"nth-match" engine expects non-empty selector list and an index argument\');if(typeof n!="number"||n<1)throw new Error(\'"nth-match" engine expects a one-based index as the last argument\');let i=Mt.query(r,e.slice(0,e.length-1),t);return n--,n<i.length?[i[n]]:[]}};function Zt(r,e){if(r!==e.scope)return e.pierceShadow?I(r):r.parentElement||void 0}function Vr(r,e){if(r!==e.scope)return r.previousElementSibling||void 0}function zr(r){let e=new Map,t=[],n=[];function i(o){let a=e.get(o);if(a)return a;let l=I(o);return l?i(l).children.push(o):t.push(o),a={children:[],taken:!1},e.set(o,a),a}for(let o of r)i(o).taken=!0;function s(o){let a=e.get(o);if(a.taken&&n.push(o),a.children.length>1){let l=new Set(a.children);a.children=[];let c=o.firstElementChild;for(;c&&a.children.length<l.size;)l.has(c)&&a.children.push(c),c=c.nextElementSibling;for(c=o.shadowRoot?o.shadowRoot.firstElementChild:null;c&&a.children.length<l.size;)l.has(c)&&a.children.push(c),c=c.nextElementSibling}a.children.forEach(s)}return t.forEach(s),n}var mi=10,He=mi/2,fi=1,Qs=2,Gs=10,Js=50,Jr=100,bi=120,xi=140,Ei=160,rr=180,Si=200,pi=250,Ys=bi+He,Xs=xi+He,gi=Jr+He,Ks=Ei+He,Zs=rr+He,eo=Si+He,to=300,ro=500,Yr=510,Qr=520,yi=530,Xr=1e4,no=1e7,io=1e3;function Zr(r,e,t){var i;r._evaluator.begin();let n={allowText:new Map,disallowText:new Map};le(),Re();try{let s=[];if(t.forTextExpect){let l=Ot(r,e.ownerDocument.documentElement,t);for(let c=e;c;c=I(c)){let p=we(n,r,c,{...t,noText:!0});if(!p)continue;if(ve(p)<=io){l=p;break}}s=[nr(l)]}else{if(!e.matches("input,textarea,select")&&!e.isContentEditable){let l=xe(e,"button,select,input,[role=button],[role=checkbox],[role=radio],a,[role=link]",t.root);l&&W(l)&&(e=l)}if(t.multiple){let l=we(n,r,e,t),c=we(n,r,e,{...t,noText:!0}),p=[l,c];if(n.allowText.clear(),n.disallowText.clear(),l&&Gr(l)&&p.push(we(n,r,e,{...t,noCSSId:!0})),c&&Gr(c)&&p.push(we(n,r,e,{...t,noText:!0,noCSSId:!0})),p=p.filter(Boolean),!p.length){let d=Ot(r,e,t);p.push(d),Gr(d)&&p.push(Ot(r,e,{...t,noCSSId:!0}))}s=[...new Set(p.map(d=>nr(d)))]}else{let l=we(n,r,e,t)||Ot(r,e,t);s=[nr(l)]}}let o=s[0],a=r.parseSelector(o);return{selector:o,selectors:s,elements:r.querySelectorAll(a,(i=t.root)!=null?i:e.ownerDocument)}}finally{Le(),ce(),r._evaluator.end()}}function we(r,e,t,n){var a;if(n.root&&!pt(n.root,t))throw new Error("Target element must belong to the root\'s subtree");if(t===n.root)return[{engine:"css",selector:":scope",score:1}];if(t.ownerDocument.documentElement===t)return[{engine:"css",selector:"html",score:1}];let i=null,s=l=>{(!i||ve(l)<ve(i))&&(i=l)},o=[];if(!n.noText)for(let l of oo(e,t,!n.isRecursive))o.push({candidate:l,isTextCandidate:!0});for(let l of so(e,t,n))n.omitInternalEngines&&l.engine.startsWith("internal:")||o.push({candidate:[l],isTextCandidate:!1});o.sort((l,c)=>ve(l.candidate)-ve(c.candidate));for(let{candidate:l,isTextCandidate:c}of o){let p=e.querySelectorAll(e.parseSelector(nr(l)),(a=n.root)!=null?a:t.ownerDocument);if(!p.includes(t))continue;if(p.length===1){s(l);break}let d=p.indexOf(t);if(!(d>5)&&(s([...l,{engine:"nth",selector:String(d),score:Xr}]),!n.isRecursive))for(let u=I(t);u&&u!==n.root;u=I(u)){let f=p.filter(D=>pt(u,D)&&D!==u),h=f.indexOf(t);if(f.length>5||h===-1||h===d&&f.length>1)continue;let g=f.length===1?l:[...l,{engine:"nth",selector:String(h),score:Xr}];if(i&&ve([{engine:"",selector:"",score:1},...g])>=ve(i))continue;let S=!!n.noText||c,E=S?r.disallowText:r.allowText,y=E.get(u);y===void 0&&(y=we(r,e,u,{...n,isRecursive:!0,noText:S})||Ot(e,u,n),E.set(u,y)),y&&s([...y,...g])}}return i}function so(r,e,t){let n=[],i=Bt(t.testIdAttributeName);{for(let a of["data-testid","data-test-id","data-test"])!i.includes(a)&&e.getAttribute(a)&&n.push({engine:"css",selector:`[${a}=${be(e.getAttribute(a))}]`,score:Qs});if(!t.noCSSId){let a=e.getAttribute("id");a&&!ao(a)&&n.push({engine:"css",selector:wi(a),score:ro})}n.push({engine:"css",selector:te(e),score:yi})}if(e.nodeName==="IFRAME"){for(let a of["name","title"])e.getAttribute(a)&&n.push({engine:"css",selector:`${te(e)}[${a}=${be(e.getAttribute(a))}]`,score:Gs});for(let a of i)e.getAttribute(a)&&n.push({engine:"css",selector:`[${a}=${be(e.getAttribute(a))}]`,score:fi});return Kr([n]),n}for(let a of i)e.getAttribute(a)&&n.push({engine:"internal:testid",selector:`[${a}=${L(e.getAttribute(a),!0)}]`,score:fi});if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){let a=e;if(a.placeholder){n.push({engine:"internal:attr",selector:`[placeholder=${L(a.placeholder,!0)}]`,score:Ys});for(let l of Te(a.placeholder))n.push({engine:"internal:attr",selector:`[placeholder=${L(l.text,!1)}]`,score:bi-l.scoreBonus})}}let s=Kt(r._evaluator._cacheText,e);for(let a of s){let l=a.normalized;n.push({engine:"internal:label",selector:q(l,!0),score:Xs});for(let c of Te(l))n.push({engine:"internal:label",selector:q(c.text,!1),score:xi-c.scoreBonus})}let o=k(e);return o&&!["none","presentation"].includes(o)&&n.push({engine:"internal:role",selector:o,score:Yr}),e.getAttribute("name")&&["BUTTON","FORM","FIELDSET","FRAME","IFRAME","INPUT","KEYGEN","OBJECT","OUTPUT","SELECT","TEXTAREA","MAP","META","PARAM"].includes(e.nodeName)&&n.push({engine:"css",selector:`${te(e)}[name=${be(e.getAttribute("name"))}]`,score:Qr}),["INPUT","TEXTAREA"].includes(e.nodeName)&&e.getAttribute("type")!=="hidden"&&e.getAttribute("type")&&n.push({engine:"css",selector:`${te(e)}[type=${be(e.getAttribute("type"))}]`,score:Qr}),["INPUT","TEXTAREA","SELECT"].includes(e.nodeName)&&e.getAttribute("type")!=="hidden"&&n.push({engine:"css",selector:te(e),score:Qr+1}),Kr([n]),n}function oo(r,e,t){if(e.nodeName==="SELECT")return[];let n=[],i=e.getAttribute("title");if(i){n.push([{engine:"internal:attr",selector:`[title=${L(i,!0)}]`,score:eo}]);for(let c of Te(i))n.push([{engine:"internal:attr",selector:`[title=${L(c.text,!1)}]`,score:Si-c.scoreBonus}])}let s=e.getAttribute("alt");if(s&&["APPLET","AREA","IMG","INPUT"].includes(e.nodeName)){n.push([{engine:"internal:attr",selector:`[alt=${L(s,!0)}]`,score:Ks}]);for(let c of Te(s))n.push([{engine:"internal:attr",selector:`[alt=${L(c.text,!1)}]`,score:Ei-c.scoreBonus}])}let o=P(r._evaluator._cacheText,e).normalized,a=o?Te(o):[];if(o){if(t){o.length<=80&&n.push([{engine:"internal:text",selector:q(o,!0),score:Zs}]);for(let p of a)n.push([{engine:"internal:text",selector:q(p.text,!1),score:rr-p.scoreBonus}])}let c={engine:"css",selector:te(e),score:yi};for(let p of a)n.push([c,{engine:"internal:has-text",selector:q(p.text,!1),score:rr-p.scoreBonus}]);if(t&&o.length<=80){let p=new RegExp("^"+ke(o)+"$");n.push([c,{engine:"internal:has-text",selector:q(p,!1),score:pi}])}}let l=k(e);if(l&&!["none","presentation"].includes(l)){let c=ee(e,!1);if(c&&!c.match(/^\\p{Co}+$/u)){let p={engine:"internal:role",selector:`${l}[name=${L(c,!0)}]`,score:gi};n.push([p]);for(let u of Te(c))n.push([{engine:"internal:role",selector:`${l}[name=${L(u.text,!1)}]`,score:Jr-u.scoreBonus}]);let d=ae(e,!1);if(d){n.push([{engine:"internal:role",selector:`${l}[name=${L(c,!0)}][description=${L(d,!0)}]`,score:gi+1}]);for(let u of Te(c))n.push([{engine:"internal:role",selector:`${l}[name=${L(u.text,!1)}][description=${L(d,!1)}]`,score:Jr-u.scoreBonus+1}])}}else{let p={engine:"internal:role",selector:`${l}`,score:Yr},d=ae(e,!1);d&&n.push([{engine:"internal:role",selector:`${l}[description=${L(d,!0)}]`,score:Yr+1}]);for(let u of a)n.push([p,{engine:"internal:has-text",selector:q(u.text,!1),score:rr-u.scoreBonus}]);if(t&&o.length<=80){let u=new RegExp("^"+ke(o)+"$");n.push([p,{engine:"internal:has-text",selector:q(u,!1),score:pi}])}}}return Kr(n),n}function wi(r){return/^[a-zA-Z][a-zA-Z0-9\\-\\_]+$/.test(r)?"#"+r:`[id=${be(r)}]`}function Gr(r){return r.some(e=>e.engine==="css"&&(e.selector.startsWith("#")||e.selector.startsWith(\'[id="\')))}function Ot(r,e,t){var a;let n=(a=t.root)!=null?a:e.ownerDocument,i=[];function s(l){let c=i.slice();l&&c.unshift(l);let p=c.join(" > "),d=r.parseSelector(p);return r.querySelector(d,n,!1)===e?p:void 0}function o(l){let c={engine:"css",selector:l,score:no},p=r.parseSelector(l),d=r.querySelectorAll(p,n);if(d.length===1)return[c];let u={engine:"nth",selector:String(d.indexOf(e)),score:Xr};return[c,u]}for(let l=e;l&&l!==n;l=I(l)){let c="";if(l.id&&!t.noCSSId){let u=wi(l.id),f=s(u);if(f)return o(f);c=u}let p=l.parentNode,d=[...l.classList].map(lo);for(let u=0;u<d.length;++u){let f="."+d.slice(0,u+1).join("."),h=s(f);if(h)return o(h);!c&&p&&p.querySelectorAll(f).length===1&&(c=f)}if(p){let u=[...p.children],f=l.nodeName,g=u.filter(S=>S.nodeName===f).indexOf(l)===0?te(l):`${te(l)}:nth-child(${1+u.indexOf(l)})`,m=s(g);if(m)return o(m);c||(c=g)}else c||(c=te(l));i.unshift(c)}return o(s())}function Kr(r){for(let e of r)for(let t of e)t.score>Js&&t.score<to&&(t.score+=Math.min(mi,t.selector.length/10|0))}function nr(r){let e=[],t="";for(let{engine:n,selector:i}of r)e.length&&(t!=="css"||n!=="css"||i.startsWith(":nth-match("))&&e.push(">>"),t=n,n==="css"?e.push(i):e.push(`${n}=${i}`);return e.join(" ")}function ve(r){let e=0;for(let t=0;t<r.length;t++)e+=r[t].score*(r.length-t);return e}function ao(r){let e,t=0;for(let n=0;n<r.length;++n){let i=r[n],s;if(!(i==="-"||i==="_")){if(i>="a"&&i<="z"?s="lower":i>="A"&&i<="Z"?s="upper":i>="0"&&i<="9"?s="digit":s="other",s==="lower"&&e==="upper"){e=s;continue}e&&e!==s&&++t,e=s}}return t>=r.length/4}function tr(r,e){if(r.length<=e)return r;r=r.substring(0,e);let t=r.match(/^(.*)\\b(.+?)$/);return t?t[1].trimEnd():""}function Te(r){let e=[];{let t=r.match(/^([\\d.,]+)[^.,\\w]/),n=t?t[1].length:0;if(n){let i=tr(r.substring(n).trimStart(),80);e.push({text:i,scoreBonus:i.length<=30?2:1})}}{let t=r.match(/[^.,\\w]([\\d.,]+)$/),n=t?t[1].length:0;if(n){let i=tr(r.substring(0,r.length-n).trimEnd(),80);e.push({text:i,scoreBonus:i.length<=30?2:1})}}return r.length<=30?e.push({text:r,scoreBonus:0}):(e.push({text:tr(r,80),scoreBonus:0}),e.push({text:tr(r,30),scoreBonus:1})),e=e.filter(t=>t.text),e.length||e.push({text:r.substring(0,80),scoreBonus:0}),e}function te(r){return r.nodeName.toLocaleLowerCase().replace(/[:\\.]/g,e=>"\\\\"+e)}function lo(r){let e="";for(let t=0;t<r.length;t++)e+=co(r,t);return e}function co(r,e){let t=r.charCodeAt(e);return t===0?"\\uFFFD":t>=1&&t<=31||t>=48&&t<=57&&(e===0||e===1&&r.charCodeAt(0)===45)?"\\\\"+t.toString(16)+" ":e===0&&t===45&&r.length===1?"\\\\"+r.charAt(e):t>=128||t===45||t===95||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122?r.charAt(e):"\\\\"+r.charAt(e)}var en={queryAll(r,e){e.startsWith("/")&&r.nodeType!==Node.DOCUMENT_NODE&&(e="."+e);let t=[],n=r.ownerDocument||r;if(!n)return t;let i=n.evaluate(e,r,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE);for(let s=i.iterateNext();s;s=i.iterateNext())s.nodeType===Node.ELEMENT_NODE&&t.push(s);return t}};var qe=Symbol("selector"),Be=class Be{constructor(e,t,n){if(n!=null&&n.hasText&&(t+=` >> internal:has-text=${q(n.hasText,!1)}`),n!=null&&n.hasNotText&&(t+=` >> internal:has-not-text=${q(n.hasNotText,!1)}`),n!=null&&n.has&&(t+=" >> internal:has="+JSON.stringify(n.has[qe])),n!=null&&n.hasNot&&(t+=" >> internal:has-not="+JSON.stringify(n.hasNot[qe])),(n==null?void 0:n.visible)!==void 0&&(t+=` >> visible=${n.visible?"true":"false"}`),this[qe]=t,t){let o=e.parseSelector(t);this.element=e.querySelector(o,e.document,!1),this.elements=e.querySelectorAll(o,e.document)}let i=t,s=this;s.locator=(o,a)=>new Be(e,i?i+" >> "+o:o,a),s.getByTestId=o=>s.locator(Sn(e.testIdAttributeNameForStrictErrorAndConsoleCodegen(),o)),s.getByAltText=(o,a)=>s.locator(wn(o,a)),s.getByLabel=(o,a)=>s.locator(yn(o,a)),s.getByPlaceholder=(o,a)=>s.locator(Tn(o,a)),s.getByText=(o,a)=>s.locator(An(o,a)),s.getByTitle=(o,a)=>s.locator(vn(o,a)),s.getByRole=(o,a={})=>s.locator(_n(o,a)),s.filter=o=>new Be(e,t,o),s.first=()=>s.locator("nth=0"),s.last=()=>s.locator("nth=-1"),s.nth=o=>s.locator(`nth=${o}`),s.and=o=>new Be(e,i+" >> internal:and="+JSON.stringify(o[qe])),s.or=o=>new Be(e,i+" >> internal:or="+JSON.stringify(o[qe]))}},tn=Be,ir=class{constructor(e){this._injectedScript=e}install(){this._injectedScript.window.playwright||(this._injectedScript.window.playwright={$:(e,t)=>this._querySelector(e,!!t),$$:e=>this._querySelectorAll(e),inspect:e=>this._inspect(e),selector:e=>this._selector(e),generateLocator:(e,t)=>this._generateLocator(e,t),ariaSnapshot:(e,t)=>this._injectedScript.ariaSnapshot(e||this._injectedScript.document.body,t||{mode:"default"}),resume:()=>this._resume(),...new tn(this._injectedScript,"")},delete this._injectedScript.window.playwright.filter,delete this._injectedScript.window.playwright.first,delete this._injectedScript.window.playwright.last,delete this._injectedScript.window.playwright.nth,delete this._injectedScript.window.playwright.and,delete this._injectedScript.window.playwright.or)}_querySelector(e,t){if(typeof e!="string")throw new Error("Usage: playwright.query(\'Playwright >> selector\').");let n=this._injectedScript.parseSelector(e);return this._injectedScript.querySelector(n,this._injectedScript.document,t)}_querySelectorAll(e){if(typeof e!="string")throw new Error("Usage: playwright.$$(\'Playwright >> selector\').");let t=this._injectedScript.parseSelector(e);return this._injectedScript.querySelectorAll(t,this._injectedScript.document)}_inspect(e){if(typeof e!="string")throw new Error("Usage: playwright.inspect(\'Playwright >> selector\').");this._injectedScript.window.inspect(this._querySelector(e,!1))}_selector(e){if(!(e instanceof Element))throw new Error("Usage: playwright.selector(element).");return this._injectedScript.generateSelectorSimple(e)}_generateLocator(e,t){if(!(e instanceof Element))throw new Error("Usage: playwright.locator(element).");let n=this._injectedScript.generateSelectorSimple(e);return K(t||"javascript",n)}_resume(){if(!this._injectedScript.window.__pw_resume)return!1;this._injectedScript.window.__pw_resume().catch(()=>{})}};function uo(r){try{return r instanceof RegExp||Object.prototype.toString.call(r)==="[object RegExp]"}catch{return!1}}function ho(r){try{return r instanceof Date||Object.prototype.toString.call(r)==="[object Date]"}catch{return!1}}function fo(r){try{return r instanceof URL||Object.prototype.toString.call(r)==="[object URL]"}catch{return!1}}function po(r){var e;try{return r instanceof Error||r&&((e=Object.getPrototypeOf(r))==null?void 0:e.name)==="Error"}catch{return!1}}function go(r,e){try{return r instanceof e||Object.prototype.toString.call(r)===`[object ${e.name}]`}catch{return!1}}function mo(r){try{return r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]"}catch{return!1}}var Ai={i8:Int8Array,ui8:Uint8Array,ui8c:Uint8ClampedArray,i16:Int16Array,ui16:Uint16Array,i32:Int32Array,ui32:Uint32Array,f32:Float32Array,f64:Float64Array,bi64:BigInt64Array,bui64:BigUint64Array};function vi(r){if("toBase64"in r)return r.toBase64();let e=Array.from(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(t=>String.fromCharCode(t)).join("");return btoa(e)}function Ti(r,e){let t=atob(r),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);return new e(n.buffer)}function sr(r,e=[],t=new Map){if(!Object.is(r,void 0)){if(typeof r=="object"&&r){if("ref"in r)return t.get(r.ref);if("v"in r)return r.v==="undefined"?void 0:r.v==="null"?null:r.v==="NaN"?NaN:r.v==="Infinity"?1/0:r.v==="-Infinity"?-1/0:r.v==="-0"?-0:void 0;if("d"in r)return new Date(r.d);if("u"in r)return new URL(r.u);if("bi"in r)return BigInt(r.bi);if("e"in r){let n=new Error(r.e.m);return n.name=r.e.n,n.stack=r.e.s,n}if("r"in r)return new RegExp(r.r.p,r.r.f);if("a"in r){let n=[];t.set(r.id,n);for(let i of r.a)n.push(sr(i,e,t));return n}if("o"in r){let n={};t.set(r.id,n);for(let{k:i,v:s}of r.o)i!=="__proto__"&&(n[i]=sr(s,e,t));return n}if("h"in r)return e[r.h];if("ta"in r)return Ti(r.ta.b,Ai[r.ta.k]);if("ab"in r)return Ti(r.ab.b,Uint8Array).buffer}return r}}function _i(r,e){return rn(r,e,{visited:new Map,lastId:0})}function rn(r,e,t){if(r&&typeof r=="object"){if(typeof globalThis.Window=="function"&&r instanceof globalThis.Window)return"ref: <Window>";if(typeof globalThis.Document=="function"&&r instanceof globalThis.Document)return"ref: <Document>";if(typeof globalThis.Node=="function"&&r instanceof globalThis.Node)return"ref: <Node>"}return Ci(r,e,t)}function Ci(r,e,t){var s;let n=e(r);if("fallThrough"in n)r=n.fallThrough;else return n;if(typeof r=="symbol")return{v:"undefined"};if(Object.is(r,void 0))return{v:"undefined"};if(Object.is(r,null))return{v:"null"};if(Object.is(r,NaN))return{v:"NaN"};if(Object.is(r,1/0))return{v:"Infinity"};if(Object.is(r,-1/0))return{v:"-Infinity"};if(Object.is(r,-0))return{v:"-0"};if(typeof r=="boolean"||typeof r=="number"||typeof r=="string")return r;if(typeof r=="bigint")return{bi:r.toString()};if(po(r)){let o;return(s=r.stack)!=null&&s.startsWith(r.name+": "+r.message)?o=r.stack:o=`${r.name}: ${r.message}\n${r.stack}`,{e:{n:r.name,m:r.message,s:o}}}if(ho(r))return{d:r.toJSON()};if(fo(r))return{u:r.toJSON()};if(uo(r))return{r:{p:r.source,f:r.flags}};for(let[o,a]of Object.entries(Ai))if(go(r,a))return{ta:{b:vi(r),k:o}};if(mo(r))return{ab:{b:vi(new Uint8Array(r))}};let i=t.visited.get(r);if(i)return{ref:i};if(Array.isArray(r)){let o=[],a=++t.lastId;t.visited.set(r,a);for(let l=0;l<r.length;++l)o.push(rn(r[l],e,t));return{a:o,id:a}}if(typeof r=="object"){let o=[],a=++t.lastId;t.visited.set(r,a);for(let c of Object.keys(r)){let p;try{p=r[c]}catch{continue}c==="toJSON"&&typeof p=="function"?o.push({k:c,v:{o:[],id:0}}):o.push({k:c,v:rn(p,e,t)})}let l;try{o.length===0&&r.toJSON&&typeof r.toJSON=="function"&&(l={value:r.toJSON()})}catch{}return l?Ci(l.value,e,t):{o,id:a}}}var or=class{constructor(e,t){var n,i,s,o,a,l,c,p;this.global=e,this.isUnderTest=t,e.__pwClock?this.builtins=e.__pwClock.builtins:this.builtins={setTimeout:(n=e.setTimeout)==null?void 0:n.bind(e),clearTimeout:(i=e.clearTimeout)==null?void 0:i.bind(e),setInterval:(s=e.setInterval)==null?void 0:s.bind(e),clearInterval:(o=e.clearInterval)==null?void 0:o.bind(e),requestAnimationFrame:(a=e.requestAnimationFrame)==null?void 0:a.bind(e),cancelAnimationFrame:(l=e.cancelAnimationFrame)==null?void 0:l.bind(e),requestIdleCallback:(c=e.requestIdleCallback)==null?void 0:c.bind(e),cancelIdleCallback:(p=e.cancelIdleCallback)==null?void 0:p.bind(e),performance:e.performance,Intl:e.Intl,Date:e.Date,AbortSignal:e.AbortSignal},this.isUnderTest&&(e.builtins=this.builtins)}evaluate(e,t,n,i,...s){let o=s.slice(0,i),a=s.slice(i),l=[];for(let p=0;p<o.length;p++)l[p]=sr(o[p],a);let c=this.global.eval(n);return e===!0?c=c(...l):e===!1?c=c:typeof c=="function"&&(c=c(...l)),t?this._promiseAwareJsonValueNoThrow(c):c}jsonValue(e,t){if(t!==void 0)return _i(t,n=>({fallThrough:n}))}_promiseAwareJsonValueNoThrow(e){let t=n=>{try{return this.jsonValue(!0,n)}catch{return}};return e&&typeof e=="object"&&typeof e.then=="function"?(async()=>{let n=await e;return t(n)})():t(e)}};var nn=class{constructor(e,t){this._testIdAttributeNameForStrictErrorAndConsoleCodegen="data-testid";this._lastAriaSnapshotForTrack=new Map;this.utils={asLocator:K,cacheNormalizedWhitespaces:bn,elementText:P,getAriaRole:k,getElementAccessibleDescription:ae,getElementAccessibleName:ee,isElementVisible:W,isInsideScope:pt,normalizeWhiteSpace:v,parseAriaSnapshot:ln,generateAriaTree:ye,findNewElement:ci,builtins:null};this.window=e,this.document=e.document,this.isUnderTest=t.isUnderTest,this.utils.builtins=new or(e,t.isUnderTest).builtins,this._sdkLanguage=t.sdkLanguage,this._testIdAttributeNameForStrictErrorAndConsoleCodegen=t.testIdAttributeName,this._evaluator=new er,this.consoleApi=new ir(this),this.onGlobalListenersRemoved=new Set,this._autoClosingTags=new Set(["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","MENUITEM","META","PARAM","SOURCE","TRACK","WBR"]),this._booleanAttributes=new Set(["checked","selected","disabled","readonly","multiple"]),this._eventTypes=new Map([["auxclick","mouse"],["click","mouse"],["dblclick","mouse"],["mousedown","mouse"],["mouseeenter","mouse"],["mouseleave","mouse"],["mousemove","mouse"],["mouseout","mouse"],["mouseover","mouse"],["mouseup","mouse"],["mouseleave","mouse"],["mousewheel","mouse"],["keydown","keyboard"],["keyup","keyboard"],["keypress","keyboard"],["textInput","keyboard"],["touchstart","touch"],["touchmove","touch"],["touchend","touch"],["touchcancel","touch"],["pointerover","pointer"],["pointerout","pointer"],["pointerenter","pointer"],["pointerleave","pointer"],["pointerdown","pointer"],["pointerup","pointer"],["pointermove","pointer"],["pointercancel","pointer"],["gotpointercapture","pointer"],["lostpointercapture","pointer"],["focus","focus"],["blur","focus"],["drag","drag"],["dragstart","drag"],["dragend","drag"],["dragover","drag"],["dragenter","drag"],["dragleave","drag"],["dragexit","drag"],["drop","drag"],["wheel","wheel"],["deviceorientation","deviceorientation"],["deviceorientationabsolute","deviceorientation"],["devicemotion","devicemotion"]]),this._hoverHitTargetInterceptorEvents=new Set(["mousemove"]),this._tapHitTargetInterceptorEvents=new Set(["pointerdown","pointerup","touchstart","touchend","touchcancel"]),this._mouseHitTargetInterceptorEvents=new Set(["mousedown","mouseup","pointerdown","pointerup","click","auxclick","dblclick","contextmenu"]),this._allHitTargetInterceptorEvents=new Set([...this._hoverHitTargetInterceptorEvents,...this._tapHitTargetInterceptorEvents,...this._mouseHitTargetInterceptorEvents]),this._engines=new Map,this._engines.set("xpath",en),this._engines.set("xpath:light",en),this._engines.set("role",Wr(!1)),this._engines.set("text",this._createTextEngine(!0,!1)),this._engines.set("text:light",this._createTextEngine(!1,!1)),this._engines.set("id",this._createAttributeEngine("id",!0)),this._engines.set("id:light",this._createAttributeEngine("id",!1)),this._engines.set("data-testid",this._createAttributeEngine("data-testid",!0)),this._engines.set("data-testid:light",this._createAttributeEngine("data-testid",!1)),this._engines.set("data-test-id",this._createAttributeEngine("data-test-id",!0)),this._engines.set("data-test-id:light",this._createAttributeEngine("data-test-id",!1)),this._engines.set("data-test",this._createAttributeEngine("data-test",!0)),this._engines.set("data-test:light",this._createAttributeEngine("data-test",!1)),this._engines.set("css",this._createCSSEngine()),this._engines.set("nth",{queryAll:()=>[]}),this._engines.set("visible",this._createVisibleEngine()),this._engines.set("internal:control",this._createControlEngine()),this._engines.set("internal:has",this._createHasEngine()),this._engines.set("internal:has-not",this._createHasNotEngine()),this._engines.set("internal:and",{queryAll:()=>[]}),this._engines.set("internal:or",{queryAll:()=>[]}),this._engines.set("internal:chain",this._createInternalChainEngine()),this._engines.set("internal:label",this._createInternalLabelEngine()),this._engines.set("internal:text",this._createTextEngine(!0,!0)),this._engines.set("internal:has-text",this._createInternalHasTextEngine()),this._engines.set("internal:has-not-text",this._createInternalHasNotTextEngine()),this._engines.set("internal:attr",this._createNamedAttributeEngine()),this._engines.set("internal:testid",this._createTestIdEngine()),this._engines.set("internal:role",Wr(!0)),this._engines.set("internal:describe",this._createDescribeEngine()),this._engines.set("aria-ref",this._createAriaRefEngine());for(let{name:n,source:i}of t.customEngines)this._engines.set(n,this.eval(i));this._stableRafCount=t.stableRafCount,this._browserName=t.browserName,this._shouldPrependErrorPrefix=!!t.shouldPrependErrorPrefix,this._isUtilityWorld=!!t.isUtilityWorld,Rn({browserNameForWorkarounds:t.browserName}),this._setupGlobalListenersRemovalDetection(),this._setupHitTargetInterceptors(),this.isUnderTest&&(this.window.__injectedScript=this)}eval(e){return this.window.eval(e)}testIdAttributeNameForStrictErrorAndConsoleCodegen(){return this._testIdAttributeNameForStrictErrorAndConsoleCodegen}parseSelector(e){let t=ot(e);return mn(t,n=>{if(!this._engines.has(n.name))throw this.createStacklessError(`Unknown engine "${n.name}" while parsing selector ${e}`)}),t}generateSelector(e,t){return Zr(this,e,t)}generateSelectorSimple(e,t){return Zr(this,e,{...t,testIdAttributeName:this._testIdAttributeNameForStrictErrorAndConsoleCodegen}).selector}querySelector(e,t,n){let i=this.querySelectorAll(e,t);if(n&&i.length>1)throw this.strictModeViolationError(e,i);return this.checkDeprecatedSelectorUsage(e,i),i[0]}_queryNth(e,t){let n=[...e],i=+t.body;return i===-1&&(i=n.length-1),new Set(n.slice(i,i+1))}_queryLayoutSelector(e,t,n){let i=t.name,s=t.body,o=[],a=this.querySelectorAll(s.parsed,n);for(let l of e){let c=Yt(i,l,a,s.distance);c!==void 0&&o.push({element:l,score:c})}return o.sort((l,c)=>l.score-c.score),new Set(o.map(l=>l.element))}ariaSnapshot(e,t){return this.incrementalAriaSnapshot(e,t).full}incrementalAriaSnapshot(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Can only capture aria snapshot of Element nodes.");let n=ye(e,t),i=Se(n,t),s;if(t.track){let o=this._lastAriaSnapshotForTrack.get(t.track);o&&(s=Se(n,t,o).text),this._lastAriaSnapshotForTrack.set(t.track,n)}return this._lastAriaSnapshotForQuery=n,{full:i.text,incremental:s,iframeRefs:n.iframeRefs,iframeDepths:i.iframeDepths}}ariaSnapshotForRecorder(){let e=ye(this.document.body,{mode:"ai"}),{text:t}=Se(e,{mode:"ai"});return{ariaSnapshot:t,refs:e.refs}}getAllElementsMatchingExpectAriaTemplate(e,t){return si(e.documentElement,t)}querySelectorAll(e,t){if(e.capture!==void 0){if(e.parts.some(i=>i.name==="nth"))throw this.createStacklessError("Can\'t query n-th element in a request with the capture.");let n={parts:e.parts.slice(0,e.capture+1)};if(e.capture<e.parts.length-1){let i={parts:e.parts.slice(e.capture+1)},s={name:"internal:has",body:{parsed:i},source:$(i)};n.parts.push(s)}return this.querySelectorAll(n,t)}if(!t.querySelectorAll)throw this.createStacklessError("Node is not queryable.");if(e.capture!==void 0)throw this.createStacklessError("Internal error: there should not be a capture in the selector.");if(t.nodeType===11&&e.parts.length===1&&e.parts[0].name==="css"&&e.parts[0].source===":scope")return[t];this._evaluator.begin();try{let n=new Set([t]);for(let i of e.parts)if(i.name==="nth")n=this._queryNth(n,i);else if(i.name==="internal:and"){let s=this.querySelectorAll(i.body.parsed,t);n=new Set(s.filter(o=>n.has(o)))}else if(i.name==="internal:or"){let s=this.querySelectorAll(i.body.parsed,t);n=new Set(zr(new Set([...n,...s])))}else if(di.includes(i.name))n=this._queryLayoutSelector(n,i,t);else{let s=new Set;for(let o of n){let a=this._queryEngineAll(i,o);for(let l of a)s.add(l)}n=s}return[...n]}finally{this._evaluator.end()}}_queryEngineAll(e,t){let n=this._engines.get(e.name).queryAll(t,e.body);for(let i of n)if(!("nodeName"in i))throw this.createStacklessError(`Expected a Node but got ${Object.prototype.toString.call(i)}`);return n}_createAttributeEngine(e,t){let n=i=>[{simples:[{selector:{css:`[${e}=${JSON.stringify(i)}]`,functions:[]},combinator:""}]}];return{queryAll:(i,s)=>this._evaluator.query({scope:i,pierceShadow:t},n(s))}}_createCSSEngine(){return{queryAll:(e,t)=>this._evaluator.query({scope:e,pierceShadow:!0},t)}}_createTextEngine(e,t){return{queryAll:(i,s)=>{let{matcher:o,kind:a}=lr(s,t),l=[],c=null,p=u=>{if(a==="lax"&&c&&c.contains(u))return!1;let f=$e(this._evaluator._cacheText,u,o);f==="none"&&(c=u),(f==="self"||f==="selfAndChildren"&&a==="strict"&&!t)&&l.push(u)};i.nodeType===Node.ELEMENT_NODE&&p(i);let d=this._evaluator._queryCSS({scope:i,pierceShadow:e},"*");for(let u of d)p(u);return l}}}_createInternalHasTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let n=e,i=P(this._evaluator._cacheText,n),{matcher:s}=lr(t,!0);return s(i)?[n]:[]}}}_createInternalHasNotTextEngine(){return{queryAll:(e,t)=>{if(e.nodeType!==1)return[];let n=e,i=P(this._evaluator._cacheText,n),{matcher:s}=lr(t,!0);return s(i)?[]:[n]}}}_createInternalLabelEngine(){return{queryAll:(e,t)=>{let{matcher:n}=lr(t,!0);return this._evaluator._queryCSS({scope:e,pierceShadow:!0},"*").filter(s=>Kt(this._evaluator._cacheText,s).some(o=>n(o)))}}}_createNamedAttributeEngine(){return{queryAll:(t,n)=>{let i=X(n,!0);if(i.name||i.attributes.length!==1)throw new Error("Malformed attribute selector: "+n);let{name:s}=i.attributes[0],o=ki(i.attributes[0]);return this._evaluator._queryCSS({scope:t,pierceShadow:!0},`[${s}]`).filter(l=>o(l.getAttribute(s)))}}}_createTestIdEngine(){return{queryAll:(t,n)=>{let i=X(n,!0);if(i.name||i.attributes.length!==1)throw new Error("Malformed test id selector: "+n);let s=Bt(i.attributes[0].name),o=ki(i.attributes[0]),a=s.map(c=>`[${c}]`).join(",");return this._evaluator._queryCSS({scope:t,pierceShadow:!0},a).filter(c=>s.some(p=>{let d=c.getAttribute(p);return d!==null&&o(d)}))}}}_createDescribeEngine(){return{queryAll:t=>t.nodeType!==1?[]:[t]}}_createControlEngine(){return{queryAll(e,t){if(t==="enter-frame")return[];if(t==="return-empty")return[];if(t==="component")return e.nodeType!==1?[]:[e.childElementCount===1?e.firstElementChild:e];throw new Error(`Internal error, unknown internal:control selector ${t}`)}}}_createHasEngine(){return{queryAll:(t,n)=>t.nodeType!==1?[]:!!this.querySelector(n.parsed,t,!1)?[t]:[]}}_createHasNotEngine(){return{queryAll:(t,n)=>t.nodeType!==1?[]:!!this.querySelector(n.parsed,t,!1)?[]:[t]}}_createVisibleEngine(){return{queryAll:(t,n)=>{if(t.nodeType!==1)return[];let i=n==="true";return W(t)===i?[t]:[]}}}_createInternalChainEngine(){return{queryAll:(t,n)=>this.querySelectorAll(n.parsed,t)}}extend(e,t){let n=this.window.eval(`\n    (() => {\n      const module = {};\n      ${e}\n      return module.exports.default();\n    })()`);return new n(this,t)}async viewportRatio(e){return await new Promise(t=>{let n=new IntersectionObserver(i=>{t(i[0].intersectionRatio),n.disconnect()});n.observe(e),this.utils.builtins.requestAnimationFrame(()=>{})})}getElementBorderWidth(e){if(e.nodeType!==Node.ELEMENT_NODE||!e.ownerDocument||!e.ownerDocument.defaultView)return{left:0,top:0};let t=e.ownerDocument.defaultView.getComputedStyle(e);return{left:parseInt(t.borderLeftWidth||"",10),top:parseInt(t.borderTopWidth||"",10)}}describeIFrameStyle(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return"error:notconnected";let t=e.ownerDocument.defaultView;for(let i=e;i;i=I(i))if(t.getComputedStyle(i).transform!=="none")return"transformed";let n=t.getComputedStyle(e);return{left:parseInt(n.borderLeftWidth||"",10)+parseInt(n.paddingLeft||"",10),top:parseInt(n.borderTopWidth||"",10)+parseInt(n.paddingTop||"",10)}}retarget(e,t){let n=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement;if(!n)return null;if(t==="none")return n;if(!n.matches("input, textarea, select")&&!n.isContentEditable&&(t==="button-link"?n=n.closest("button, [role=button], a, [role=link]")||n:n=n.closest("button, [role=button], [role=checkbox], [role=radio]")||n),t==="follow-label"&&!n.matches("a, input, textarea, button, select, [role=link], [role=button], [role=checkbox], [role=radio]")&&!n.isContentEditable){let i=n.closest("label");i&&i.control&&(n=i.control)}return n}async checkElementStates(e,t){if(t.includes("stable")){let n=await this._checkElementIsStable(e);if(n===!1)return{missingState:"stable"};if(n==="error:notconnected")return"error:notconnected"}for(let n of t)if(n!=="stable"){let i=this.elementState(e,n);if(i.received==="error:notconnected")return"error:notconnected";if(!i.matches)return{missingState:n}}}async _checkElementIsStable(e){let t=Symbol("continuePolling"),n,i=0,s=0,o=()=>{let d=this.retarget(e,"no-follow-label");if(!d)return"error:notconnected";let u=this.utils.builtins.performance.now();if(this._stableRafCount>1&&u-s<15)return t;s=u;let f=d.getBoundingClientRect(),h={x:f.top,y:f.left,width:f.width,height:f.height};if(n){if(!(h.x===n.x&&h.y===n.y&&h.width===n.width&&h.height===n.height))return!1;if(++i>=this._stableRafCount)return!0}return n=h,t},a,l,c=new Promise((d,u)=>{a=d,l=u}),p=()=>{try{let d=o();d!==t?a(d):this.utils.builtins.requestAnimationFrame(p)}catch(d){l(d)}};return this.utils.builtins.requestAnimationFrame(p),c}_createAriaRefEngine(){return{queryAll:(t,n)=>{var s,o;let i=(o=(s=this._lastAriaSnapshotForQuery)==null?void 0:s.elements)==null?void 0:o.get(n);return i&&i.isConnected?[i]:[]}}}elementState(e,t){let n=this.retarget(e,["visible","hidden"].includes(t)?"none":"follow-label");if(!n||!n.isConnected)return t==="hidden"?{matches:!0,received:"hidden"}:{matches:!1,received:"error:notconnected"};if(t==="visible"||t==="hidden"){let i=W(n);return{matches:t==="visible"?i:!i,received:i?"visible":"hidden"}}if(t==="disabled"||t==="enabled"){let i=Ee(n);return{matches:t==="disabled"?i:!i,received:i?"disabled":"enabled"}}if(t==="editable"){let i=Ee(n),s=Jn(n);if(s==="error")throw this.createStacklessError("Element is not an <input>, <textarea>, <select> or [contenteditable] and does not have a role allowing [aria-readonly]");return{matches:!i&&!s,received:i?"disabled":s?"readOnly":"editable"}}if(t==="checked"||t==="unchecked"){let i=t==="checked",s=Gn(n);if(s==="error")throw this.createStacklessError("Not a checkbox or radio button");let o=n.nodeName==="INPUT"&&n.type==="radio";return{matches:i===s,received:s?"checked":"unchecked",isRadio:o}}if(t==="indeterminate"){let i=Qn(n);if(i==="error")throw this.createStacklessError("Not a checkbox or radio button");return{matches:i==="mixed",received:i===!0?"checked":i===!1?"unchecked":"mixed"}}throw this.createStacklessError(`Unexpected element state "${t}"`)}selectOptions(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()!=="select")throw this.createStacklessError("Element is not a <select> element");let i=n,s=[...i.options],o=[],a=t.slice();for(let l=0;l<s.length;l++){let c=s[l],p=v(c.label),d=u=>{if(u instanceof Node)return c===u;let f=g=>g===c.label||v(g)===p,h=!0;return u.valueOrLabel!==void 0&&(h=h&&(u.valueOrLabel===c.value||f(u.valueOrLabel))),u.value!==void 0&&(h=h&&u.value===c.value),u.label!==void 0&&(h=h&&f(u.label)),u.index!==void 0&&(h=h&&u.index===l),h};if(a.some(d)){if(!this.elementState(c,"enabled").matches)return"error:optionnotenabled";if(o.push(c),i.multiple)a=a.filter(u=>!d(u));else{a=[];break}}}return a.length?"error:optionsnotfound":(i.value=void 0,o.forEach(l=>l.selected=!0),i.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),i.dispatchEvent(new Event("change",{bubbles:!0})),o.map(l=>l.value))}fill(e,t){let n=this.retarget(e,"follow-label");if(!n)return"error:notconnected";if(n.nodeName.toLowerCase()==="input"){let i=n,s=i.type.toLowerCase(),o=new Set(["color","date","time","datetime-local","month","range","week"]);if(!new Set(["","email","number","password","search","tel","text","url"]).has(s)&&!o.has(s))throw this.createStacklessError(`Input of type "${s}" cannot be filled`);if(s==="number"&&(t=t.trim(),isNaN(Number(t))))throw this.createStacklessError("Cannot type text into input[type=number]");if(s==="color"&&(t=t.toLowerCase()),o.has(s)){if(t=t.trim(),i.focus(),i.value=t,i.value!==t)throw this.createStacklessError("Malformed value");return n.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),n.dispatchEvent(new Event("change",{bubbles:!0})),"done"}}else if(n.nodeName.toLowerCase()!=="textarea"){if(!n.isContentEditable)throw this.createStacklessError("Element is not an <input>, <textarea> or [contenteditable] element")}return this.selectText(n),"needsinput"}selectText(e){let t=this.retarget(e,"follow-label");if(!t)return"error:notconnected";if(t.nodeName.toLowerCase()==="input"){let s=t;return s.select(),s.focus(),"done"}if(t.nodeName.toLowerCase()==="textarea"){let s=t;return s.selectionStart=0,s.selectionEnd=s.value.length,s.focus(),"done"}t.focus();let n=t.ownerDocument.createRange();n.selectNodeContents(t);let i=t.ownerDocument.defaultView.getSelection();return i&&(i.removeAllRanges(),i.addRange(n)),"done"}_activelyFocused(e){let t=e.getRootNode().activeElement,n=t===e&&!!e.ownerDocument&&e.ownerDocument.hasFocus();return{activeElement:t,isFocused:n}}focusNode(e,t){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");let{activeElement:n,isFocused:i}=this._activelyFocused(e);if(e.isContentEditable&&!i&&n&&n.blur&&n.blur(),e.focus(),e.focus(),t&&!i&&e.nodeName.toLowerCase()==="input")try{e.setSelectionRange(0,0)}catch{}return"done"}blurNode(e){if(!e.isConnected)return"error:notconnected";if(e.nodeType!==Node.ELEMENT_NODE)throw this.createStacklessError("Node is not an element");return e.blur(),"done"}setInputFiles(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"Node is not of type HTMLElement";let n=e;if(n.nodeName!=="INPUT")return"Not an <input> element";let i=n;if((i.getAttribute("type")||"").toLowerCase()!=="file")return"Not an input[type=file] element";let o=t.map(l=>{let c=Uint8Array.from(atob(l.buffer),p=>p.charCodeAt(0));return new File([c],l.name,{type:l.mimeType,lastModified:l.lastModifiedMs})}),a=new DataTransfer;for(let l of o)a.items.add(l);i.files=a.files,i.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})),i.dispatchEvent(new Event("change",{bubbles:!0}))}expectHitTarget(e,t){var p;let n=[],i=t;for(;i;){let d=Ut(i);if(!d||(n.push(d),d.nodeType===9))break;i=d.host}let s;for(let d=n.length-1;d>=0;d--){let u=n[d],f=u.elementsFromPoint(e.x,e.y),h=u.elementFromPoint(e.x,e.y);if(h&&f[0]&&I(h)===f[0]){let m=this.window.getComputedStyle(h);(m==null?void 0:m.display)==="contents"&&f.unshift(h)}f[0]&&f[0].shadowRoot===u&&f[1]===h&&f.shift();let g=f[0];if(!g||(s=g,d&&g!==n[d-1].host))break}let o=[];for(;s&&s!==t;)o.push(s),s=(p=s.assignedSlot)!=null?p:I(s);if(s===t)return"done";let a=this.previewNode(o[0]||this.document.documentElement),l,c=t;for(;c;){let d=o.indexOf(c);if(d!==-1){d>1&&(l=this.previewNode(o[d-1]));break}c=I(c)}return l?{hitTargetDescription:`${a} from ${l} subtree`}:{hitTargetDescription:a}}setupHitTargetInterceptor(e,t,n,i){let s=this.retarget(e,"button-link");if(!s||!s.isConnected)return"error:notconnected";if(n){let p=this.expectHitTarget(n,s);if(p!=="done")return p.hitTargetDescription}if(t==="drag")return{stop:()=>"done"};let o={hover:this._hoverHitTargetInterceptorEvents,tap:this._tapHitTargetInterceptorEvents,mouse:this._mouseHitTargetInterceptorEvents}[t],a,l=p=>{if(!o.has(p.type)||!p.isTrusted&&!p.__pwTrustedSynthetic)return;let d=this.window.TouchEvent&&p instanceof this.window.TouchEvent?p.touches[0]:p;a===void 0&&d&&(a=this.expectHitTarget({x:d.clientX,y:d.clientY},s)),(i||a!=="done"&&a!==void 0)&&(p.preventDefault(),p.stopPropagation(),p.stopImmediatePropagation())},c=()=>(this._hitTargetInterceptor===l&&(this._hitTargetInterceptor=void 0),a||"done");return this._hitTargetInterceptor=l,{stop:c}}dispatchEvent(e,t,n){var o,a,l,c,p;let i,s={bubbles:!0,cancelable:!0,composed:!0,...n};switch(this._eventTypes.get(t)){case"mouse":i=new MouseEvent(t,s);break;case"keyboard":i=new KeyboardEvent(t,s);break;case"touch":{if(this._browserName==="webkit"){let d=f=>{var m,S,E;if(f instanceof Touch)return f;let h=f.pageX;h===void 0&&f.clientX!==void 0&&(h=f.clientX+(((m=this.document.scrollingElement)==null?void 0:m.scrollLeft)||0));let g=f.pageY;return g===void 0&&f.clientY!==void 0&&(g=f.clientY+(((S=this.document.scrollingElement)==null?void 0:S.scrollTop)||0)),this.document.createTouch(this.window,(E=f.target)!=null?E:e,f.identifier,h,g,f.screenX,f.screenY,f.radiusX,f.radiusY,f.rotationAngle,f.force)},u=f=>f instanceof TouchList||!f?f:this.document.createTouchList(...f.map(d));(o=s.target)!=null||(s.target=e),s.touches=u(s.touches),s.targetTouches=u(s.targetTouches),s.changedTouches=u(s.changedTouches),i=new TouchEvent(t,s)}else(a=s.target)!=null||(s.target=e),s.touches=(l=s.touches)==null?void 0:l.map(d=>{var u;return d instanceof Touch?d:new Touch({...d,target:(u=d.target)!=null?u:e})}),s.targetTouches=(c=s.targetTouches)==null?void 0:c.map(d=>{var u;return d instanceof Touch?d:new Touch({...d,target:(u=d.target)!=null?u:e})}),s.changedTouches=(p=s.changedTouches)==null?void 0:p.map(d=>{var u;return d instanceof Touch?d:new Touch({...d,target:(u=d.target)!=null?u:e})}),i=new TouchEvent(t,s);break}case"pointer":i=new PointerEvent(t,s);break;case"focus":i=new FocusEvent(t,s);break;case"drag":i=new DragEvent(t,s);break;case"wheel":i=new WheelEvent(t,s);break;case"deviceorientation":try{i=new DeviceOrientationEvent(t,s)}catch{let{bubbles:d,cancelable:u,alpha:f,beta:h,gamma:g,absolute:m}=s;i=this.document.createEvent("DeviceOrientationEvent"),i.initDeviceOrientationEvent(t,d,u,f,h,g,m)}break;case"devicemotion":try{i=new DeviceMotionEvent(t,s)}catch{let{bubbles:d,cancelable:u,acceleration:f,accelerationIncludingGravity:h,rotationRate:g,interval:m}=s;i=this.document.createEvent("DeviceMotionEvent"),i.initDeviceMotionEvent(t,d,u,f,h,g,m)}break;default:i=new Event(t,s);break}e.dispatchEvent(i)}previewNode(e){if(e.nodeType===Node.TEXT_NODE)return ar(`#text=${e.nodeValue||""}`);if(e.nodeType!==Node.ELEMENT_NODE)return ar(`<${e.nodeName.toLowerCase()} />`);let t=e,n=[];for(let l=0;l<t.attributes.length;l++){let{name:c,value:p}=t.attributes[l];c!=="style"&&(!p&&this._booleanAttributes.has(c)?n.push(` ${c}`):n.push(` ${c}="${p}"`))}n.sort((l,c)=>l.length-c.length);let i=vr(n.join(""),500);if(this._autoClosingTags.has(t.nodeName))return ar(`<${t.nodeName.toLowerCase()}${i}/>`);let s=t.childNodes,o=!1;if(s.length<=5){o=!0;for(let l=0;l<s.length;l++)o=o&&s[l].nodeType===Node.TEXT_NODE}let a=o?t.textContent||"":s.length?"\\u2026":"";return ar(`<${t.nodeName.toLowerCase()}${i}>${vr(a,50)}</${t.nodeName.toLowerCase()}>`)}_generateSelectors(e){this._evaluator.begin(),le(),Re();try{let t=this._isUtilityWorld&&this._browserName==="firefox"?2:10;return e.slice(0,t).map(i=>({preview:this.previewNode(i),selector:this.generateSelectorSimple(i)})).map((i,s)=>`${s+1}) ${i.preview} aka ${K(this._sdkLanguage,i.selector)}`)}finally{Le(),ce(),this._evaluator.end()}}strictModeViolationError(e,t){let n=this._generateSelectors(t).map(i=>`\n    `+i);return n.length<t.length&&n.push(`\n    ...`),this.createStacklessError(`strict mode violation: ${K(this._sdkLanguage,$(e))} resolved to ${t.length} elements:${n.join("")}\n`)}checkDeprecatedSelectorUsage(e,t){let n=new Set(["_react","_vue","xpath:light","text:light","id:light","data-testid:light","data-test-id:light","data-test:light"]);if(!t.length)return;let i=e.parts.find(o=>n.has(o.name));if(!i)return;let s=this._generateSelectors(t).map(o=>`\n    `+o);throw s.length<t.length&&s.push(`\n    ...`),this.createStacklessError(`"${i.name}" selector is not supported: ${K(this._sdkLanguage,$(e))} resolved to ${t.length} element${t.length===1?"":"s"}:${s.join("")}\n`)}createStacklessError(e){let t=this._shouldPrependErrorPrefix?new Error("Error: "+e):new Error(e);return this._browserName==="firefox"?(t.stack="",t):(delete t.stack,t)}createHighlight(){return new Oe(this)}maskSelectors(e,t){let n=this._createHighlight(),i=[];for(let s of e)i.push(this.querySelectorAll(s,this.document.documentElement));n.maskElements(i.flat(),t)}_createHighlight(){return this._highlight&&this.hideHighlight(),this._highlight=new Oe(this),this._highlight.install(),this._highlight}_ensureHighlight(){return this._highlight||(this._highlight=new Oe(this),this._highlight.install()),this._highlight}addHighlight(e,t){this._ensureHighlight().addElementHighlight(e,t)}removeHighlight(e){this._ensureHighlight().removeElementHighlight(e)}setScreencastAnnotation(e){var i;let t=this._ensureHighlight();if(!e){t.updateHighlight([]),t.hideActionPoint(),t.hideActionTitle(),t.hideActionCursor();return}let n=(i=e.duration)!=null?i:500;e.box&&t.updateHighlight([{box:e.box,color:"rgba(0, 128, 255, 0.15)",borderColor:"rgba(0, 128, 255, 0.6)",fadeDuration:n}]),e.point&&(e.cursor!=="none"&&t.moveActionCursor(e.point.x,e.point.y,n),t.showActionPoint(e.point.x,e.point.y,n)),e.actionTitle&&t.showActionTitle(e.actionTitle,n,e.position,e.fontSize)}addUserOverlay(e,t){this._ensureHighlight().addUserOverlay(e,t)}getUserOverlay(e){return this._ensureHighlight().getUserOverlay(e)}removeUserOverlay(e){this._ensureHighlight().removeUserOverlay(e)}setUserOverlaysVisible(e){this._ensureHighlight().setUserOverlaysVisible(e)}hideHighlight(){this._highlight&&(this._highlight.uninstall(),delete this._highlight)}markTargetElements(e){let t=new CustomEvent("__playwright_reset_targets__",{bubbles:!0,cancelable:!0,composed:!0});this.document.dispatchEvent(t);let n=new CustomEvent("__playwright_mark_target__",{bubbles:!0,cancelable:!0,composed:!0});for(let i of e)i.dispatchEvent(n)}_setupGlobalListenersRemovalDetection(){let e="__playwright_global_listeners_check__",t=!1,n=()=>t=!0;this.window.addEventListener(e,n),new MutationObserver(i=>{if(i.some(o=>Array.from(o.addedNodes).includes(this.document.documentElement))&&(t=!1,this.window.dispatchEvent(new CustomEvent(e)),!t)){this.window.addEventListener(e,n);for(let o of this.onGlobalListenersRemoved)o()}}).observe(this.document,{childList:!0})}_setupHitTargetInterceptors(){let e=n=>{var i;return(i=this._hitTargetInterceptor)==null?void 0:i.call(this,n)},t=()=>{for(let n of this._allHitTargetInterceptorEvents)this.window.addEventListener(n,e,{capture:!0,passive:!1})};t(),this.onGlobalListenersRemoved.add(t)}async expect(e,t,n){let i=await this._expectCore(e,t,n),s=i.matches!==t.isNot?void 0:this._ariaSnapshotForExpect(e,t);return i.received===void 0&&s===void 0?{matches:i.matches,missingReceived:i.missingReceived}:{matches:i.matches,received:{value:i.received,ariaSnapshot:s},missingReceived:i.missingReceived}}_ariaSnapshotForExpect(e,t){let n=t.expression;if(!(n==="to.have.count"||n.endsWith(".array"))&&n!=="to.match.aria"){if(e&&W(e)){let i=n==="to.have.text";return this._renderAriaSnapshot(e,{mode:"default",depth:i?void 0:1})}if(this.document.body)return this._renderAriaSnapshot(this.document.body,{mode:"default"})}}_renderAriaSnapshot(e,t){return Se(ye(e,t),t).text}async _expectCore(e,t,n){var s,o;if(t.expression==="to.have.count"||t.expression.endsWith(".array"))return this.expectArray(n,t);if(!e){if(!t.isNot&&t.expression==="to.be.hidden")return{matches:!0};if(t.isNot&&t.expression==="to.be.visible")return{matches:!1};if(!t.isNot&&t.expression==="to.be.detached")return{matches:!0};if(t.isNot&&t.expression==="to.be.attached")return{matches:!1};if(t.isNot&&t.expression==="to.be.in.viewport")return{matches:!1};if(t.expression==="to.have.title"&&((s=t==null?void 0:t.expectedText)!=null&&s[0])){let a=new ue(t.expectedText[0]),l=this.document.title;return{received:l,matches:a.matches(l)}}if(t.expression==="to.have.url"&&((o=t==null?void 0:t.expectedText)!=null&&o[0])){let a=new ue(t.expectedText[0]),l=this.document.location.href;return{received:l,matches:a.matches(l)}}if(t.expression==="to.match.aria"&&!t.selector){if(!this.document.body)return{matches:t.isNot,missingReceived:!0};let a=Br(this.document.body,t.expectedValue);return{received:a.received,matches:!!a.matches.length}}return{matches:t.isNot,missingReceived:!0}}return await this.expectSingleElement(e,t)}async expectSingleElement(e,t){var i,s;let n=t.expression;{let o;if(n==="to.have.attribute"){let a=e.hasAttribute(t.expressionArg);o={matches:a,received:a?"attribute present":"attribute not present"}}else if(n==="to.be.checked"){let{checked:a,indeterminate:l}=t.expectedValue;if(l){if(a!==void 0)throw this.createStacklessError("Can\'t assert indeterminate and checked at the same time");o=this.elementState(e,"indeterminate")}else o=this.elementState(e,a===!1?"unchecked":"checked")}else if(n==="to.be.disabled")o=this.elementState(e,"disabled");else if(n==="to.be.editable")o=this.elementState(e,"editable");else if(n==="to.be.readonly")o=this.elementState(e,"editable"),o.matches=!o.matches;else if(n==="to.be.empty")if(e.nodeName==="INPUT"||e.nodeName==="TEXTAREA"){let a=e.value;o={matches:!a,received:a?"notEmpty":"empty"}}else{let a=(i=e.textContent)==null?void 0:i.trim();o={matches:!a,received:a?"notEmpty":"empty"}}else if(n==="to.be.enabled")o=this.elementState(e,"enabled");else if(n==="to.be.focused"){let a=this._activelyFocused(e).isFocused;o={matches:a,received:a?"focused":"inactive"}}else n==="to.be.hidden"?o=this.elementState(e,"hidden"):n==="to.be.visible"?o=this.elementState(e,"visible"):n==="to.be.attached"?o={matches:!0,received:"attached"}:n==="to.be.detached"&&(o={matches:!1,received:"attached"});if(o){if(o.received==="error:notconnected")throw this.createStacklessError("Element is not connected");return o}}if(n==="to.have.property"){let o=e,a=t.expressionArg.split(".");for(let p=0;p<a.length-1;p++){if(typeof o!="object"||!(a[p]in o))return{received:void 0,matches:!1};o=o[a[p]]}let l=o[a[a.length-1]],c=sn(l,t.expectedValue);return{received:l,matches:c}}if(n==="to.be.in.viewport"){let o=await this.viewportRatio(e);return{received:`viewport ratio ${o}`,matches:o>0&&o>((s=t.expectedNumber)!=null?s:0)-1e-9}}if(n==="to.have.values"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="SELECT"||!e.multiple)throw this.createStacklessError("Not a select element with a multiple attribute");let o=[...e.selectedOptions].map(a=>a.value);return o.length!==t.expectedText.length?{received:o,matches:!1}:{received:o,matches:o.map((a,l)=>new ue(t.expectedText[l]).matches(a)).every(Boolean)}}if(n==="to.match.aria"){let o=Br(e,t.expectedValue);return{received:o.received,matches:!!o.matches.length}}{let o;if(n==="to.have.attribute.value"){let a=e.getAttribute(t.expressionArg);if(a===null)return{received:null,matches:!1};o=a}else if(["to.have.class","to.contain.class"].includes(n)){if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);return{received:e.classList.toString(),matches:new ue(t.expectedText[0]).matchesClassList(this,e.classList,n==="to.contain.class")}}else if(n==="to.have.css")o=this.window.getComputedStyle(e,t.pseudo?`::${t.pseudo}`:void 0).getPropertyValue(t.expressionArg);else if(n==="to.have.id")o=e.id;else if(n==="to.have.text")o=t.useInnerText?e.innerText:P(new Map,e).full;else if(n==="to.have.accessible.name")o=ee(e,!1);else if(n==="to.have.accessible.description")o=ae(e,!1);else if(n==="to.have.accessible.error.message")o=zn(e);else if(n==="to.have.role")o=k(e)||"";else if(n==="to.have.value"){if(e=this.retarget(e,"follow-label"),e.nodeName!=="INPUT"&&e.nodeName!=="TEXTAREA"&&e.nodeName!=="SELECT")throw this.createStacklessError("Not an input element");o=e.value}if(o!==void 0&&t.expectedText){let a=new ue(t.expectedText[0]);return{received:o,matches:a.matches(o)}}}throw this.createStacklessError("Unknown expect matcher: "+n)}expectArray(e,t){let n=t.expression;if(n==="to.have.count"){let l=e.length,c=l===t.expectedNumber;return{received:l,matches:c}}if(!t.expectedText)throw this.createStacklessError("Expected text is not provided for "+n);if(["to.have.class.array","to.contain.class.array"].includes(n)){let l=e.map(d=>d.classList),c=l.map(String);if(l.length!==t.expectedText.length)return{received:c,matches:!1};let p=this._matchSequentially(t.expectedText,l,(d,u)=>d.matchesClassList(this,u,n==="to.contain.class.array"));return{received:c,matches:p}}if(!["to.contain.text.array","to.have.text.array"].includes(n))throw this.createStacklessError("Unknown expect matcher: "+n);let i=e.map(l=>t.useInnerText?l.innerText:P(new Map,l).full),s=n!=="to.contain.text.array";if(!(i.length===t.expectedText.length||!s))return{received:i,matches:!1};let a=this._matchSequentially(t.expectedText,i,(l,c)=>l.matches(c));return{received:i,matches:a}}_matchSequentially(e,t,n){let i=e.map(a=>new ue(a)),s=0,o=0;for(;s<i.length&&o<t.length;)n(i[s],t[o])&&++s,++o;return s===i.length}};function ar(r){return r.replace(/\\n/g,"\\u21B5").replace(/\\t/g,"\\u21C6")}function ki(r){let{value:e,caseSensitive:t}=r;if(e instanceof RegExp)return i=>!!i.match(e);if(t)return i=>i===e;let n=e.toLowerCase();return i=>i.toLowerCase().includes(n)}function bo(r){if(r=r.substring(1,r.length-1),!r.includes("\\\\"))return r;let e=[],t=0;for(;t<r.length;)r[t]==="\\\\"&&t+1<r.length&&t++,e.push(r[t++]);return e.join("")}function lr(r,e){if(r[0]==="/"&&r.lastIndexOf("/")>0){let i=r.lastIndexOf("/"),s=new RegExp(r.substring(1,i),r.substring(i+1));return{matcher:o=>s.test(o.full),kind:"regex"}}let t=e?JSON.parse.bind(JSON):bo,n=!1;return r.length>1&&r[0]===\'"\'&&r[r.length-1]===\'"\'?(r=t(r),n=!0):e&&r.length>1&&r[0]===\'"\'&&r[r.length-2]===\'"\'&&r[r.length-1]==="i"?(r=t(r.substring(0,r.length-1)),n=!1):e&&r.length>1&&r[0]===\'"\'&&r[r.length-2]===\'"\'&&r[r.length-1]==="s"?(r=t(r.substring(0,r.length-1)),n=!0):r.length>1&&r[0]==="\'"&&r[r.length-1]==="\'"&&(r=t(r),n=!0),r=v(r),n?e?{kind:"strict",matcher:s=>s.normalized===r}:{matcher:s=>!r&&!s.immediate.length?!0:s.immediate.some(o=>v(o)===r),kind:"strict"}:(r=r.toLowerCase(),{kind:"lax",matcher:i=>i.normalized.toLowerCase().includes(r)})}var ue=class{constructor(e){if(this._normalizeWhiteSpace=e.normalizeWhiteSpace,this._ignoreCase=e.ignoreCase,this._string=e.matchSubstring?void 0:this.normalize(e.string),this._substring=e.matchSubstring?this.normalize(e.string):void 0,e.regexSource){let t=new Set((e.regexFlags||"").split(""));e.ignoreCase===!1&&t.delete("i"),e.ignoreCase===!0&&t.add("i"),this._regex=new RegExp(e.regexSource,[...t].join(""))}}matches(e){return this._regex||(e=this.normalize(e)),this._string!==void 0?e===this._string:this._substring!==void 0?e.includes(this._substring):this._regex?!!this._regex.test(e):!1}matchesClassList(e,t,n){if(n){if(this._regex)throw e.createStacklessError("Partial matching does not support regular expressions. Please provide a string value.");return this._string.split(/\\s+/g).filter(Boolean).every(i=>t.contains(i))}return this.matches(t.toString())}normalize(e){return e&&(this._normalizeWhiteSpace&&(e=v(e)),this._ignoreCase&&(e=e.toLocaleLowerCase()),e)}};function sn(r,e){if(r===e)return!0;if(r&&e&&typeof r=="object"&&typeof e=="object"){if(r.constructor!==e.constructor)return!1;if(Array.isArray(r)){if(r.length!==e.length)return!1;for(let n=0;n<r.length;++n)if(!sn(r[n],e[n]))return!1;return!0}if(r instanceof RegExp)return r.source===e.source&&r.flags===e.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===e.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===e.toString();let t=Object.keys(r);if(t.length!==Object.keys(e).length)return!1;for(let n=0;n<t.length;++n)if(!e.hasOwnProperty(t[n]))return!1;for(let n of t)if(!sn(r[n],e[n]))return!1;return!0}return typeof r=="number"&&typeof e=="number"?isNaN(r)&&isNaN(e):!1}return qi(xo);})();\n';var Kh={block:"center",inline:"nearest"},$q="Frame target is not available for this iframe selector path",zq=[Kh,{block:"end",inline:"end"},{block:"start",inline:"start"}],sd=class e{constructor(t,r){this.cdp=t;this.cua=r;t.addListener("tabDetached",n=>{for(let o of this.playwrightInjectedTargets)(o===String(n)||o.startsWith(`${n}:`))&&this.playwrightInjectedTargets.delete(o)})}cdp;cua;playwrightInjectedTargets=new Set;static injectedConstant="__codexPlaywrightInjected";async resolvePlaywrightSelector(t,r){if(!Number.isFinite(t))throw new Error("resolvePlaywrightSelector requires numeric tab_id");if(!await this.evaluateWithPlaywrightInjected(t,`(() => {
        ${au}
        const injected = window.${e.injectedConstant};
        const parsed = injected.parseSelector(${JSON.stringify(r)});
        const element = querySelectorStrictWithVisibleFallback(injected, parsed, document);

        if (!element) {
          return false;
        }

        element.setAttribute("data-codex-playwright-match", "1");
        return true;
      })()`,{telemetryAttrs:Wt({operation:hr("resolve_selector"),phase:"selector_eval"})}))throw new Error(`No element found for locator: ${r}`);try{return await this.resolveCssSelector(t,"[data-codex-playwright-match='1']")}finally{await this.cdp.call(t,"Runtime.evaluate",{expression:`(() => {
        const element = document.querySelector("[data-codex-playwright-match='1']");
        if (element) {
          element.removeAttribute("data-codex-playwright-match");
        }
      })()`,returnByValue:!0},{telemetryAttrs:Wt({operation:hr("resolve_selector"),phase:"css_marker_cleanup"})})}}async evaluateOnPlaywrightSelector(t,r,n,o={}){return(await this.evaluateOnPlaywrightSelectorWithTarget(t,r,n,o)).result}async evaluateOnPlaywrightSelectorWithTarget(t,r,n,o={}){let i=se({timeout_ms:o.timeoutMs}),s=Date.now(),a=n.toString();for(;;)try{return await this.evaluateSingleSelectorWithTarget(HA(t),r,a,o.arg,{timeoutMs:i,telemetryAttrs:Wt({operation:hr("locator"),phase:"selector_eval"})})}catch(u){if(WA(u)||o.retry===!1)throw u;if(Date.now()-s>=i){let l=u instanceof Error?u.message:String(u);throw new Error(`Timed out after ${i}ms waiting for selector ${r}: ${l}`,{cause:u})}await new Promise(l=>setTimeout(l,100))}}async evaluateOnPlaywrightSelectorAll(t,r,n,o={}){let i=se({timeout_ms:o.timeoutMs}),s=Date.now(),a=n.toString();for(;;)try{return await this.evaluateSelectorAllInTarget(HA(t),r,a,o.arg,{timeoutMs:i,telemetryAttrs:Wt({operation:hr("locator"),phase:"selector_all_eval"})})}catch(u){if(WA(u)||o.retry===!1)throw u;if(Date.now()-s>=i){let l=u instanceof Error?u.message:String(u);throw new Error(`Timed out after ${i}ms waiting for selector ${r}: ${l}`,{cause:u})}await new Promise(l=>setTimeout(l,100))}}async evaluateOnPlaywrightPage(t,r,n={}){let o=r.toString();return await this.evaluateWithPlaywrightInjected(t,`(async () => {
          const injected = window.${e.injectedConstant};
          return await (${o})(injected, ${Gh(n.arg)});
        })()`,{telemetryAttrs:Wt({operation:hr("page"),phase:"page_eval"}),timeoutMs:n.timeoutMs})}async selectorsResolveToDistinctElements(t,r,n={}){return r.length<2?!0:await this.evaluateWithPlaywrightInjected(t,`(() => {
        ${au}
        const injected = window.${e.injectedConstant};
        const elements = ${JSON.stringify(r)}.map((selector) => {
          const parsed = injected.parseSelector(selector);
          return querySelectorStrictWithVisibleFallback(injected, parsed, document);
        });
        return elements.every(
          (element, index) => element != null && elements.indexOf(element) === index
        );
      })()`,{telemetryAttrs:Wt({operation:hr("locator"),phase:"selector_identity_eval"}),timeoutMs:n.timeoutMs})}async clickLocator(t,r){let n=A(t.tab_id),o=se(t),i=CA("button"in t?t.button:void 0),s=dn("modifiers"in t?t.modifiers:void 0),a="force"in t?t.force===!0:!1,u=a?[]:["visible","enabled"];await this.performPointerAction(t,{actionName:r===1?"click":"dblclick",dispatch:async l=>{await this.cua.clickPoint({button:i,clickCount:r,...ru(l.target)?{loadTarget:l.target}:{},modifiers:s,point:l.point,tabId:n,timeoutMs:o})},force:a,requiredStates:u,timeoutMs:o})}async focusLocator(t,r){let n=["visible","enabled"];r.requireEditable&&n.push("editable");let{target:o}=await this.evaluateOnPlaywrightSelectorWithTarget(t.tab_id,t.selector,(i,s,a)=>{for(let d of a.states){let p=s.elementState(i,d);if(p.received==="error:notconnected")throw new Error("Element is not connected");if(!p.matches)throw new Error("Element is not "+d)}let u=a.retargetInput?s.retarget(i,"follow-label"):i;if(u==null)throw new Error("Element is not connected");i.scrollIntoView({block:"center",inline:"nearest"});let l=a.selectText?s.selectText(u):s.focusNode(u,!1);if(l!=="done")throw new Error(String(l));return a.iabInputTargetToken!=null&&Object.defineProperty(u,"__codexIabInputTargetToken",{configurable:!0,value:a.iabInputTargetToken,writable:!0}),!0},{arg:{iabInputTargetToken:r.iabInputTargetToken,retargetInput:r.requireEditable||r.selectText===!0,selectText:r.selectText===!0,states:n},timeoutMs:t.timeout_ms});return o}async readCheckedState(t){return await this.evaluateOnPlaywrightSelector(t.tab_id,t.selector,(r,n)=>{let o=n.elementState(r,"checked");if(o.received==="error:notconnected")throw new Error("Element is not connected");return{checked:!!o.matches,isRadio:!!o.isRadio}},{timeoutMs:t.timeout_ms})}async readElementState(t,r){return await this.evaluateOnPlaywrightSelectorAll(t.tab_id,t.selector,(n,o,i)=>{let s=n[0]??null;if(!s)return!1;let a=o.elementState(s,i.stateName);return a.received==="error:notconnected"?!1:!!a.matches},{arg:{stateName:r},timeoutMs:t.timeout_ms})}async performPointerAction(t,r){let n=r.force?[Kh]:zq,o=null;for(let i of n){let s=await this.resolvePointerActionTarget(t,{requiredStates:r.requiredStates,scrollAlignment:i});if(o=r.force?null:await this.obstructingFrameHitTarget(s,{timeoutMs:r.timeoutMs}),o==null){await r.dispatch(s);return}}throw new Error(`Element does not receive pointer events at the ${r.actionName} point; ${o??"another element"} intercepts the ${r.actionName}`)}async resolvePointerActionTarget(t,r){let n=await this.evaluateOnPlaywrightSelectorWithTarget(t.tab_id,t.selector,async(i,s,a,u)=>{let l={async waitForAnimationFrame(){await new Promise(p=>{let f=i.ownerDocument?.defaultView;if(typeof f?.requestAnimationFrame=="function"){f.requestAnimationFrame(()=>p());return}if(typeof setTimeout=="function"){setTimeout(p,0);return}p()})},sameRect(p,f){return p.left===f.left&&p.top===f.top&&p.width===f.width&&p.height===f.height},async waitForStableBoundingRect(){let p=i.getBoundingClientRect(),f=0;for(let m=0;m<10;m+=1){await l.waitForAnimationFrame();let h=i.getBoundingClientRect();if(l.sameRect(p,h)){if(f+=1,p=h,f>=2)break;continue}f=0,p=h}return p}};for(let p of a.requiredStates){let f=s.elementState(i,p);if(f.received==="error:notconnected")throw new Error("Element is not connected");if(!f.matches)throw new Error("Element is not "+p)}i.scrollIntoView({block:a.scrollAlignment.block,inline:a.scrollAlignment.inline,behavior:"instant"});let d=await l.waitForStableBoundingRect();for(let p of a.requiredStates){let f=s.elementState(i,p);if(f.received==="error:notconnected")throw new Error("Element is not connected");if(!f.matches)throw new Error("Element is not "+p)}if(!d||d.width<=0||d.height<=0)throw new Error("Element does not have a clickable bounding box");return u.prepareFrameChainForPointerAction({x:Math.max(0,d.left+d.width/2),y:Math.max(0,d.top+d.height/2)},a.scrollAlignment)},{arg:{requiredStates:r.requiredStates,scrollAlignment:r.scrollAlignment??Kh},timeoutMs:t.timeout_ms}),o=await this.currentTopLevelPointForAction(n.result,n.oopifFrameChain,{timeoutMs:t.timeout_ms});return{frameBoundaries:o.frameBoundaries,point:o.point,target:n.target}}async currentTopLevelPointForAction(t,r,n={}){if(!r?.length)return{frameBoundaries:[],point:t};let o=t,i=[];for(let s of r.slice().reverse()){let a=await this.currentPointInParentFrame(s,o,n);o=a.point,i.push({frame:s,ownerBackendNodeId:a.backendNodeId,point:o})}return{frameBoundaries:i,point:o}}async currentPointInParentFrame(t,r,n={}){if(t.frameId==null)throw new Error("Cannot recompute OOPIF frame offset without a frame id");let{backendNodeId:o}=await this.callCdpTarget(t.parentTarget,"DOM.getFrameOwner",{frameId:t.frameId},n),{quads:i}=await this.callCdpTarget(t.parentTarget,"DOM.getContentQuads",{backendNodeId:o},n),s=i[0],a=tc(r,t.size,s);if(a==null)throw new Error("Frame owner does not have content quads");return{backendNodeId:o,point:a}}async obstructingFrameHitTarget(t,r={}){for(let n of t.frameBoundaries.slice().reverse()){let o=await this.obstructingFrameBoundaryHitTarget(n,r);if(o!=null)return o}return null}async obstructingFrameBoundaryHitTarget(t,r={}){try{let n=await this.callCdpTarget(t.frame.parentTarget,"DOM.getNodeForLocation",{x:Math.round(t.point.x),y:Math.round(t.point.y),includeUserAgentShadowDOM:!0},{timeoutMs:r.timeoutMs,telemetryAttrs:Wt({operation:hr("locator"),phase:"hit_target_check"})});return n.backendNodeId===t.ownerBackendNodeId?null:await this.describeBackendNodeForHitTarget(t.frame.parentTarget,n.backendNodeId,r)}catch{return null}}async describeBackendNodeForHitTarget(t,r,n={}){try{let{node:o}=await this.callCdpTarget(t,"DOM.describeNode",{backendNodeId:r},n),i=o.localName||o.nodeName?.toLowerCase()||"unknown",s=Array.isArray(o.attributes)?o.attributes:[],a=GA(s,"id"),u=GA(s,"class");return`<${i}${a?`#${a}`:""}${u?`.${u.trim().split(/\s+/).slice(0,3).join(".")}`:""}>`}catch{return"another element"}}async resolveCssSelector(t,r){let{root:n}=await this.callCdpTarget({tabId:t},"DOM.getDocument",{depth:-1,pierce:!0}),{nodeId:o}=await this.callCdpTarget({tabId:t},"DOM.querySelector",{nodeId:n.nodeId,selector:r});if(!o)throw new Error(`No element found for locator: ${r}`);let{node:i}=await this.callCdpTarget({tabId:t},"DOM.describeNode",{nodeId:o});return i.backendNodeId}async evaluateSingleSelectorWithTarget(t,r,n,o,i={}){let s=await this.resolveSelectorTarget(t,r,i);return{result:await this.evaluateSingleSelectorInResolvedTarget(s,n,o,i),oopifFrameChain:s.oopifFrameChain,target:s.target}}async evaluateSingleSelectorInResolvedTarget(t,r,n,o={}){return await this.evaluateWithPlaywrightInjectedInTarget(t.target,`(async () => {
          ${au}
          ${e.selectorScopeFunctions()}
          const initialInjected = window.${e.injectedConstant};
          const parsed = initialInjected.parseSelector(${JSON.stringify(t.selector)});
          const scope = selectorScopeFor(initialInjected, parsed);
          const element = scope
            ? querySelectorStrictWithVisibleFallback(scope.injected, scope.parsed, scope.root)
            : null;
          if (!element) throw new Error("No element matched selector");
          return await (${r})(element, scope.injected, ${Gh(n)}, scope);
        })()`,o)}async evaluateSelectorAllInTarget(t,r,n,o,i={}){let s=await this.resolveSelectorTarget(t,r,i);return await this.evaluateWithPlaywrightInjectedInTarget(s.target,`(async () => {
          ${au}
          ${e.selectorScopeFunctions()}
          const initialInjected = window.${e.injectedConstant};
          const parsed = initialInjected.parseSelector(${JSON.stringify(s.selector)});
          const scope = selectorScopeFor(initialInjected, parsed);
          const elements = scope
            ? scope.injected.querySelectorAll(scope.parsed, scope.root)
            : [];
          const scopedInjected = scope ? scope.injected : initialInjected;
          return await (${n})(elements, scopedInjected, ${Gh(o)});
        })()`,i)}async resolveSelectorTarget(t,r,n={}){let o=t,i=r;for(;;){let s=await this.frameRouteForFirstOopif(o,i,n);if(s==null)return{oopifFrameChain:o.oopifFrameChain,selector:i,target:o.target};o=s,i=s.selector}}async frameRouteForFirstOopif(t,r,n={}){if(!r.includes(Jh)||!Jq(this.cdp))return null;await this.cdp.enableOopifAutoAttach(t.target.tabId,n);let o=`codex-${Date.now()}-${Math.random().toString(16).slice(2)}`,i;try{i=await this.evaluateWithPlaywrightInjectedInTarget(t.target,`(() => {
          ${au}
          ${e.selectorScopeFunctions()}
          const initialInjected = window.${e.injectedConstant};
          const parsedSelector = initialInjected.parseSelector(${JSON.stringify(r)});
          let currentRoot = document;
          let currentInjected = initialInjected;
          let enterFrameCount = 0;
          let partStart = 0;

          while (true) {
            const enterFrameIndex = parsedSelector.parts.findIndex(
              (part, index) =>
                index >= partStart &&
                part.name === "internal:control" &&
                part.body === "enter-frame"
            );

            if (enterFrameIndex === -1) return { matched: false };

            const frameSelector = sliceParsedSelector(
              parsedSelector,
              partStart,
              enterFrameIndex
            );
            const frameElement = querySelectorStrictWithVisibleFallback(
              currentInjected,
              frameSelector,
              currentRoot
            );
            if (!frameElement) return { matched: false };

            const tagName = String(frameElement.localName || frameElement.tagName || "").toLowerCase();
            if (tagName !== "iframe" && tagName !== "frame") {
              throw new Error("internal:control=enter-frame must target a frame element");
            }

            const state = currentInjected.elementState(frameElement, "visible");
            if (state.received === "error:notconnected") {
              throw new Error("Frame is not connected");
            }

            if (!state.matches) {
              throw new Error("Frame is not visible");
            }

            frameElement.scrollIntoView({
              block: "center",
              inline: "nearest",
              behavior: "instant",
            });
            enterFrameCount += 1;

            let frameWindow;
            let frameDocument;
            try {
              frameWindow = frameElement.contentWindow;
              frameDocument = frameElement.contentDocument || frameWindow?.document;
            } catch {
              frameElement.setAttribute("data-codex-playwright-frame-match", ${JSON.stringify(o)});
              return {
                enterFrameCount,
                frameName: frameElement.name || undefined,
                frameUrl: frameElement.src || undefined,
                matched: true,
                size: frameContentSize(frameElement),
              };
            }

            if (!frameWindow || !frameDocument) {
              frameElement.setAttribute("data-codex-playwright-frame-match", ${JSON.stringify(o)});
              return {
                enterFrameCount,
                frameName: frameElement.name || undefined,
                frameUrl: frameElement.src || undefined,
                matched: true,
                size: frameContentSize(frameElement),
              };
            }

            currentRoot = frameDocument;
            currentInjected = injectedForWindow(initialInjected, frameWindow);
            partStart = enterFrameIndex + 1;
          }
        })()`,n)}catch(s){throw await this.removeFrameMarker(t.target,o,n),s}if(!i.matched)return null;try{let s=await this.frameIdForMarkedFrameElement(t.target,o,n).then(async u=>u??await this.frameIdForFrameMatch(t.target,i,n)),a=await this.targetForFrame(t.target.tabId,s,{...i.frameUrl!=null?{url:i.frameUrl}:{}},n);if(a==null)throw new Error($q);return{oopifFrameChain:[...t.oopifFrameChain,{frameId:s,parentTarget:t.target,size:i.size}],selector:Vq(r,i.enterFrameCount??1),target:a}}finally{await this.removeFrameMarker(t.target,o,n)}}async frameIdForFrameMatch(t,r,n={}){if(r.frameUrl==null)return null;let{frameTree:o}=await this.callCdpTarget(t,"Page.getFrameTree",void 0,n),i=KA(o).filter(s=>s.url!==r.frameUrl?!1:r.frameName==null||s.name===r.frameName);return i.length===1?i[0]?.id??null:null}async targetForFrame(t,r,n,o={}){if(r!=null){let i=this.cdp.targetForFrame(t,r);if(i!=null)return i}return Yq(this.cdp)?await this.cdp.targetForFrameOrAttach(t,r,o,n):null}async frameIdForMarkedFrameElement(t,r,n={}){let i=(await this.callCdpTarget(t,"Runtime.evaluate",{expression:VA(r),returnByValue:!1},n).catch(()=>null))?.result?.objectId;if(typeof i=="string")try{let{node:l}=await this.callCdpTarget(t,"DOM.describeNode",{objectId:i},n);if(typeof l.frameId=="string")return l.frameId}finally{await this.callCdpTarget(t,"Runtime.releaseObject",{objectId:i},n).catch(()=>{})}let{root:s}=await this.callCdpTarget(t,"DOM.getDocument",{depth:-1,pierce:!0}),{nodeId:a}=await this.callCdpTarget(t,"DOM.querySelector",{nodeId:s.nodeId,selector:`[data-codex-playwright-frame-match='${r}']`},n);if(!a)return null;let{node:u}=await this.callCdpTarget(t,"DOM.describeNode",{nodeId:a},n);return typeof u.frameId=="string"?u.frameId:null}async removeFrameMarker(t,r,n={}){await this.callCdpTarget(t,"Runtime.evaluate",{expression:`(() => {
          const element = ${VA(r)};
          if (element) element.removeAttribute("data-codex-playwright-frame-match");
        })()`,returnByValue:!0},n).catch(()=>{})}async evaluateWithPlaywrightInjected(t,r,n){let o=A(t);return await this.evaluateWithPlaywrightInjectedInTarget({tabId:o},r,n)}async evaluateWithPlaywrightInjectedInTarget(t,r,n={}){await this.ensurePlaywrightInjectedInTarget(t,n);let o=await this.callCdpTarget(t,"Runtime.evaluate",{expression:r,returnByValue:!0,awaitPromise:!0,...n.timeoutMs==null||n.timeoutMs<=0?{}:{timeout:n.timeoutMs}},{telemetryAttrs:n.telemetryAttrs,timeoutMs:n.timeoutMs});return Hq(o)}async ensurePlaywrightInjected(t,r={}){let n=Number(t);if(!Number.isFinite(n))throw new Error("ensurePlaywrightInjected requires numeric tab_id");await this.ensurePlaywrightInjectedInTarget({tabId:n},r)}async ensurePlaywrightInjectedInTarget(t,r={}){let n=Gq(t),o=Wq(r.telemetryAttrs)??"unknown";if(this.playwrightInjectedTargets.has(n)){let{result:i}=await this.callCdpTarget(t,"Runtime.evaluate",{expression:`!!window.${e.injectedConstant}`,returnByValue:!0},{timeoutMs:r.timeoutMs,telemetryAttrs:Wt({operation:o,phase:"inject_check"})});if(i.value)return;this.playwrightInjectedTargets.delete(n)}await this.callCdpTarget(t,"Runtime.evaluate",{expression:`(() => {
        if (!window.${e.injectedConstant}) {
          ${zA}
          window.${e.injectedConstant} = new PlaywrightInjected.InjectedScript(window, {
            isUnderTest: false,
            sdkLanguage: "javascript",
            testIdAttributeName: "data-testid",
            stableRafCount: 1,
            browserName: "chromium",
            customEngines: [],
          });
        }
      })()`,returnByValue:!0},{timeoutMs:r.timeoutMs,telemetryAttrs:Wt({operation:o,phase:"inject_install"})}),this.playwrightInjectedTargets.add(n)}async callCdpTarget(t,r,n,o={}){let i=this.cdp;return typeof i.callTarget=="function"?await i.callTarget(t,r,n,o):await this.cdp.call(t.tabId,r,n,o)}static selectorScopeFunctions(){return`
function injectedForWindow(rootInjected, targetWindow) {
  if (!targetWindow) throw new Error("Frame window is not available");
  if (targetWindow.${e.injectedConstant}) {
    return targetWindow.${e.injectedConstant};
  }

  targetWindow.${e.injectedConstant} = new rootInjected.constructor(targetWindow, {
    isUnderTest: false,
    sdkLanguage: "javascript",
    testIdAttributeName: "data-testid",
    stableRafCount: 1,
    browserName: "chromium",
    customEngines: [],
  });
  return targetWindow.${e.injectedConstant};
}

const unsupportedFrameAccessMessage =
  "Cross-origin or out-of-process iframes are not supported by this runtime selector path";

function sliceParsedSelector(parsedSelector, startIndex, endIndex) {
  const sliced = {
    ...parsedSelector,
    parts: parsedSelector.parts.slice(startIndex, endIndex),
  };

  if (parsedSelector.capture === undefined) {
    delete sliced.capture;
  } else if (
    parsedSelector.capture >= startIndex &&
    parsedSelector.capture < endIndex
  ) {
    sliced.capture = parsedSelector.capture - startIndex;
  } else {
    delete sliced.capture;
  }

  return sliced;
}

function frameContentSize(frameElement) {
  const rect = frameElement.getBoundingClientRect();
  if (!rect || rect.width <= 0 || rect.height <= 0) {
    throw new Error("Frame does not have an actionable bounding box");
  }

  const clientWidth = Number(frameElement.clientWidth) || rect.width;
  const clientHeight = Number(frameElement.clientHeight) || rect.height;
  if (clientWidth <= 0 || clientHeight <= 0) {
    throw new Error("Frame does not have an actionable bounding box");
  }

  return {
    height: clientHeight,
    width: clientWidth,
  };
}

function frameContentGeometry(frameElement) {
  const rect = frameElement.getBoundingClientRect();
  if (!rect || rect.width <= 0 || rect.height <= 0) {
    throw new Error("Frame does not have an actionable bounding box");
  }

  const offsetWidth = Number(frameElement.offsetWidth) || rect.width;
  const offsetHeight = Number(frameElement.offsetHeight) || rect.height;
  const clientWidth = Number(frameElement.clientWidth);
  const clientHeight = Number(frameElement.clientHeight);
  if (
    offsetWidth <= 0 ||
    offsetHeight <= 0 ||
    clientWidth <= 0 ||
    clientHeight <= 0
  ) {
    throw new Error("Frame does not have an actionable bounding box");
  }

  const scaleX = rect.width / offsetWidth;
  const scaleY = rect.height / offsetHeight;
  return {
    left: rect.left + (Number(frameElement.clientLeft) || 0) * scaleX,
    scaleX,
    scaleY,
    top: rect.top + (Number(frameElement.clientTop) || 0) * scaleY,
  };
}

function pointThroughFrameElement(point, frameElement) {
  const geometry = frameContentGeometry(frameElement);
  return {
    x: geometry.left + point.x * geometry.scaleX,
    y: geometry.top + point.y * geometry.scaleY,
  };
}

function prepareFrameChainForPointerAction(frameChain, point, scrollAlignment) {
  const block = scrollAlignment?.block ?? "center";
  const inline = scrollAlignment?.inline ?? "nearest";
  let currentPoint = point;

  for (const frameScope of frameChain.slice().reverse()) {
    frameScope.element.scrollIntoView({
      block,
      inline,
      behavior: "instant",
    });

    const state = frameScope.injected.elementState(frameScope.element, "visible");
    if (state.received === "error:notconnected") {
      throw new Error("Frame is not connected");
    }

    if (!state.matches) {
      throw new Error("Frame is not visible");
    }

    currentPoint = pointThroughFrameElement(currentPoint, frameScope.element);
  }

  return currentPoint;
}

function selectorScopeFor(initialInjected, parsedSelector) {
  let currentRoot = document;
  let currentInjected = initialInjected;
  const frameChain = [];
  let partStart = 0;

  while (true) {
    const enterFrameIndex = parsedSelector.parts.findIndex(
      (part, index) =>
        index >= partStart &&
        part.name === "internal:control" &&
        part.body === "enter-frame"
    );

    if (enterFrameIndex === -1) {
      return {
        frameChain,
        injected: currentInjected,
        prepareFrameChainForPointerAction: (point, scrollAlignment) =>
          prepareFrameChainForPointerAction(frameChain, point, scrollAlignment),
        root: currentRoot,
        parsed: sliceParsedSelector(
          parsedSelector,
          partStart,
          parsedSelector.parts.length
        ),
      };
    }

    const frameSelector = sliceParsedSelector(
      parsedSelector,
      partStart,
      enterFrameIndex
    );
    const frameElement = querySelectorStrictWithVisibleFallback(
      currentInjected,
      frameSelector,
      currentRoot
    );

    if (!frameElement) return null;
    const tagName = String(frameElement.localName || frameElement.tagName || "").toLowerCase();
    if (tagName !== "iframe" && tagName !== "frame") {
      throw new Error("internal:control=enter-frame must target a frame element");
    }

    let frameWindow;
    let frameDocument;
    try {
      frameWindow = frameElement.contentWindow;
      frameDocument = frameElement.contentDocument || frameWindow?.document;
    } catch {
      throw new Error(unsupportedFrameAccessMessage);
    }

    if (!frameWindow || !frameDocument) {
      throw new Error(unsupportedFrameAccessMessage);
    }

    frameChain.push({ element: frameElement, injected: currentInjected });
    currentRoot = frameDocument;
    currentInjected = injectedForWindow(initialInjected, frameWindow);
    partStart = enterFrameIndex + 1;
  }
}
`}};function Wt(e){return{"browser_use.playwright.operation":e.operation,"browser_use.playwright.phase":e.phase}}function Wq(e){let t=e?.["browser_use.playwright.operation"];return typeof t=="string"?t:void 0}function Hq(e){if(e.exceptionDetails){let t=e.exceptionDetails.exception?.value,r=e.exceptionDetails.exception?.description??e.exceptionDetails.text??(t==null?"Playwright selector evaluation failed.":String(t));throw new Error(`Browser Use encountered an error interacting with this webpage: ${r}`)}return e.result?.value}function WA(e){return String(e instanceof Error?e.message:e).includes("strict mode violation:")}var au=`
function querySelectorStrictWithVisibleFallback(injected, parsedSelector, root) {
  const matches = injected.querySelectorAll(parsedSelector, root);
  if (!matches.length) {
    injected.checkDeprecatedSelectorUsage(parsedSelector, matches);
    return null;
  }

  if (matches.length === 1) {
    injected.checkDeprecatedSelectorUsage(parsedSelector, matches);
    return matches[0];
  }

  const visibleMatches = matches.filter((element) => {
    const state = injected.elementState(element, "visible");
    return !!state.matches;
  });
  if (visibleMatches.length === 1) return visibleMatches[0];

  throw injected.strictModeViolationError(parsedSelector, matches);
}
`;function Gh(e){return JSON.stringify(e)??"undefined"}var Jh=" >> internal:control=enter-frame >> ";function HA(e){return{oopifFrameChain:[],target:{tabId:A(e)}}}function Vq(e,t){return e.split(Jh).slice(t).join(Jh)}function KA(e){return[e.frame,...(e.childFrames??[]).flatMap(t=>KA(t))]}function Gq(e){return e.sessionId!=null?`${e.tabId}:${e.sessionId}`:e.targetId!=null?`${e.tabId}:${e.targetId}`:String(e.tabId)}function VA(e){return Kq("data-codex-playwright-frame-match",e)}function Kq(e,t){return`(() => {
    const markerSelector = ${JSON.stringify(`[${e}="${t}"]`)};
    const findMarkedFrameElement = (root) => {
      const directMatch = root.querySelector(markerSelector);
      if (directMatch) return directMatch;

      for (const frame of root.querySelectorAll("iframe, frame")) {
        try {
          const frameDocument = frame.contentDocument || frame.contentWindow?.document;
          if (!frameDocument) continue;

          const childMatch = findMarkedFrameElement(frameDocument);
          if (childMatch) return childMatch;
        } catch {
          // Cross-process descendants are expected here; the marker lives on a
          // reachable frame element before we enter the target process.
        }
      }

      return null;
    };

    return findMarkedFrameElement(document);
  })()`}function GA(e,t){for(let r=0;r<e.length;r+=2)if(e[r]===t)return e[r+1]}function Jq(e){return typeof e.enableOopifAutoAttach=="function"&&typeof e.targetForFrame=="function"}function Yq(e){return typeof e.targetForFrameOrAttach=="function"}var ad=class{constructor(t){this.api=t}api;async moveMouse(t,r,n,o={}){try{let i=this.api.moveMouse({tabId:t,...o.waitForArrival===!1?{waitForArrival:!1}:{},x:r,y:n});if(o.waitForArrival===!1){i.catch(()=>{});return}await i}catch{}}};async function JA(e,t,r,n){let o=$e(r);if(o==null)throw new Error(J(`Browser Use could not determine the current page origin before attempting to ${t} files from ${r}.`));let i=await Pc(t,o,n);if(i?.decision==="approve")return;if(i?.decision==="deny")throw new Error(J(t==="download"?`The user has requested that files not be downloaded from ${r}.`:`The user has requested that files not be uploaded to ${r}.`));let s=e();if(s==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to ${t} files on ${r}. Please use another source or try another approach.`));let a=await s({message:t==="download"?`Allow download from ${r}?`:`Allow upload to ${r}?`,meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",persist:["session","always"],tool_params:{},file_transfer:t,origin:o}});if(await Dc(t,o,a,n),a.action!=="accept")throw new Error(J(t==="download"?`The user has requested that files not be downloaded from ${r}.`:`The user has requested that files not be uploaded to ${r}.`))}async function YA(e,t,r){let n=AT(t);if(n==null)throw new Error(J("Raw CDP access requires a current web page origin."));let o=await _T(n,r);if(o?.decision==="approve")return;if(o?.decision==="deny")throw new Error(J(`The user has requested that raw CDP not be used on ${n}.`));let i=e();if(i==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to use raw CDP on ${n}. Please try another approach.`));let s=await i({message:`Allow Browser Use to use full CDP access on ${n}`,meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",persist:"always",riskLevel:"high",tool_name:"access_browser_origin_with_raw_cdp",tool_title:"Use raw CDP on browser origin",tool_params:{origin:n},tool_params_display:[],full_cdp_access:!0,origin:n}});if(await ST(n,s,r),s.action!=="accept")throw new Error(J(`The user has requested that raw CDP not be used on ${n}.`))}async function ZA(e,t,r){let n=$e(t);if(n==null)throw new Error(J(`Browser Use could not determine the current page origin before attempting to download page assets from ${t??"the current page"}.`));await QA(e,n,`I need your permission to download assets used by ${new URL(n).host||n}`,r)}async function XA(e,t,r,n){let o=$e(r);o==null||o===$e(t)||await QA(e,o,`I need your permission to download an asset from ${new URL(o).host||o}`,n)}async function QA(e,t,r,n){let o=await Pc("download",t,n);if(o?.decision==="approve")return;if(o?.decision==="deny")throw new Error(J(`The user has requested that files not be downloaded from ${t}.`));let i=e();if(i==null)throw new Error(J(`Browser Use encountered an error attempting to request permission to download page assets from ${t}. Please use another source or try another approach.`));let s=await i({message:r,meta:{codex_approval_kind:"mcp_tool_call",connector_id:"browser-use",connector_name:"Browser Use",persist:["session","always"],tool_params:{asset_origins:[t]},tool_params_display:[{name:"asset_origins",display_name:"Download from",value:t}]}});if(await Dc("download",t,s,n),s.action!=="accept")throw new Error(J(`The user has requested that files not be downloaded from ${t}.`))}var ek=async(e,t)=>{let r=Me()?.fetch;if(r==null)throw new Error(J("Browser Use cannot determine if this website is allowed. Please try again later or use another source."));return r(e,t)};var Zq=1440*60*1e3,Yh=class{constructor(t=Date.now,r=qe){this.now=t;this.getTurnMetadata=r}now;getTurnMetadata;cache=new Map;inflightRequests=new Map;async throwIfBlocksUrl(t,r){if(typeof t!="string")return;let n=this.getTurnMetadata(),o=t_(t,{conversationId:n?.session_id,turnId:n?.turn_id,urlRequestSource:r==null?Hu:`${Hu}:${r}`});if(o==null)return;let i;try{i=await this.isBlocked(o)}catch{return}if(i)throw new Error(J(`Browser Use is not permitted on ${o.displayUrl}.`))}async isBlocked(t){let r=this.fetchBlocked(t),n=this.cachedBlocked(t.cacheKey);if(n!=null)return r.catch(()=>{}),n;let o=this.inflightRequests.get(t.cacheKey);if(o!=null)return r.catch(()=>{}),o;let i=r.then(s=>(this.cache.set(t.cacheKey,{blocked:s,timestampMs:this.now()}),s)).finally(()=>{this.inflightRequests.get(t.cacheKey)===i&&this.inflightRequests.delete(t.cacheKey)});return this.inflightRequests.set(t.cacheKey,i),i}cachedBlocked(t){let r=this.cache.get(t);return r==null||this.now()-r.timestampMs>=Zq?(r!=null&&this.cache.delete(t),null):r.blocked}async fetchBlocked(t){let r=await ek(t.endpoint,{method:"GET"});if(!r.ok)throw new Error(J(`Browser Use cannot determine if ${t.displayUrl} is allowed. Please try again later or use another source.`));let n=await r.json();return e_(n)}},Xq=new Yh;async function tk(e,t){await Xq.throwIfBlocksUrl(e,t)}var Qq=new Set(["navigate_tab_url"]),e$="browser_user_history",t$="disabled-for-local-testing",r$=new Set(["browser_user_claim_tab","browser_user_open_tabs","close_tab","create_tab","list_tabs","name_session","playwright_wait_for_timeout","selected_tab"]),ud=class{constructor(t,r){this.tabs=t;this.browserBackend=r}tabs;browserBackend;async ensureCommandAllowed(t){if(xn())return;if(t.type===e$){await TT(li,i$(t.params));return}let r=n$(t);switch(r.kind){case"none":return;case"targetUrl":await this.ensureUrlOriginAllowed(r.url);return;case"currentTab":await this.ensureCurrentTabOriginAllowed(r.tabId);return}}async ensureDownloadAllowed(t){xn()||await this.ensureCurrentTabFileTransferAllowed(t,"download")}async ensureFileUploadAllowed(t){xn()||await this.ensureCurrentTabFileTransferAllowed(t,"upload")}async ensurePageAssetDownloadAllowed(t){xn()||await ZA(li,t)}async ensurePageAssetFallbackFetchAllowed(t,r){xn()||await XA(li,t,r)}async ensureFullCdpAllowed(t){if(xn())return;let n=(await this.tabs.get(t)).url;if(typeof n!="string"||n.trim().length===0)throw new Error(J("Browser Use could not determine the current page URL before attempting to use raw CDP."));await YA(li,n)}async ensureDestinationUrlAllowed(t){xn()||await this.ensureUrlOriginAllowed(t)}async ensureUrlOriginAllowed(t){c$(t),await tk(t,this.browserBackend);let r=$e(t);r!=null&&await CT(li,r)}async ensureCurrentTabOriginAllowed(t){let r=await this.tabs.get(t);await this.ensureUrlOriginAllowed(r.url)}async ensureCurrentTabFileTransferAllowed(t,r){let o=(await this.tabs.get(t)).url;if(typeof o!="string"||o.trim().length===0)throw new Error(J(`Browser Use could not determine the current page URL before attempting to ${r} files.`));await JA(li,r,o)}};function li(){let e=Me()?.createElicitation;if(e==null)throw new Error("Browser security unavailable outside node repl");return e}function xn(){return a_()===t$}function n$(e){if(r$.has(e.type))return{kind:"none"};if(Qq.has(e.type))return{kind:"targetUrl",url:ok(e.params,"url")};let t=o$(e.params);return t==null?{kind:"none"}:{kind:"currentTab",tabId:t}}function o$(e){let t=ok(e,"tab_id"),r=Number(t);return!Number.isInteger(r)||r<=0?null:r}function ok(e,t){if(ik(e))return e[t]}function i$(e){if(!ik(e))return{max_results:100};let t={};return s$(e,t,"query"),t.date_range=u$(e.from,e.to),t.max_results=a$(e.limit),t}function s$(e,t,r){let n=e[r];typeof n=="string"&&(t[r]=n)}function a$(e){return typeof e=="number"?e:100}function u$(e,t){let r=rk(e),n=rk(t);return r!=null&&n!=null?`${r} to ${n}`:r!=null?`Since ${r}`:n!=null?`Before ${n}`:"All history"}function rk(e){return typeof e!="string"?null:l$(e)}function l$(e){let t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}).format(new Date(t))}function c$(e){if(typeof e=="string"&&!qy(e))throw new Error(J("Browser Use cannot visit the requested page because its URL is blocked by the Browser Use URL policy."))}function ik(e){return typeof e=="object"&&e!=null}var ld=class{constructor(t,r,n){this.api=t;this.browserId=r;this.clientInfo=n;this.isIabBackend=n.type==="iab",this.cdp=new Gc(t),this.browserUser=new Xc(t,n),this.ui=new ad(t),this.cua=new Qc(this.cdp,this.ui),this.dev=new ed(this.cdp),this.tabs=new id(t,n),this.playwright=new sd(this.cdp,this.cua),this.security=new ud(this.tabs,n.type),this.downloads=new td(t,this.cdp,this.security,n.type),this.pageAssets=new od(this.cdp,this.security),this.removeCloseListener=t.addCloseListener(()=>this.dispose())}api;browserId;clientInfo;cdp;browserUser;isIabBackend;cua;dev;downloads;pageAssets;tabs;playwright;ui;security;removeCloseListener;disposePromise;async nameSession(t){await this.api.nameSession(t)}async executeUnhandledCommand(t){return await this.api.executeUnhandledCommand(t)}async assertFullCdpAccessEnabled(){await eA()}async dispose(){this.disposePromise??=(async()=>{this.removeCloseListener(),await this.cdp.detachAllTabs(),await this.api.close()})(),await this.disposePromise}};import{readdir as lk}from"node:fs/promises";import C$,{platform as ck}from"node:os";import dk from"node:path";import{readFile as w$}from"fs/promises";import{resolve as x$}from"path";import{resolve as d$}from"path";import{homedir as p$,platform as f$}from"os";var cd=d$(p$(),f$()==="win32"?"AppData\\Local\\Google\\Chrome\\User Data":"Library/Application Support/Google/Chrome");import{ClassicLevel as m$}from"./node_modules/classic-level.mjs";import{resolve as Zh}from"path";import{tmpdir as h$}from"os";import{cp as g$,mkdtemp as b$,rm as sk}from"fs/promises";import{existsSync as y$}from"fs";var ak=async(e,t)=>{let r=Zh(cd,e,"Local Extension Settings",t);if(!y$(r))return null;let n=await b$(Zh(_$(),"codex"));await g$(r,n,{recursive:!0}),await sk(Zh(n,"LOCK"));let o=new m$(n,{createIfMissing:!1,keyEncoding:"utf8",valueEncoding:"utf8"});try{await o.open();let i=await o.get("extensionInstanceId");if(!i)return null;let s=JSON.parse(i);return typeof s!="string"?null:s}finally{await o.close(),await sk(n,{force:!0,recursive:!0})}},_$=()=>"nodeRepl"in globalThis&&globalThis.nodeRepl?globalThis.nodeRepl.tmpDir:h$();var uk=async e=>{if(e.type!=="extension"||!e.metadata?.extensionInstanceId||!e.metadata.extensionId)return e;let t=await S$(e.metadata.extensionId,e.metadata.extensionInstanceId);return t?{...e,metadata:{...e.metadata,profileName:t.name,profileIsLastUsed:t.isLastUsed.toString(),profileOrdering:t.orderingIndex.toString()}}:e},S$=async(e,t)=>(await v$(e)).find(o=>o.instanceId===t)||null,v$=async e=>{let t=await E$();return await Promise.all(t.map(async r=>({...r,instanceId:await ak(r.id,e).catch(n=>(ue(n),null))})))},E$=async()=>{let e=x$(cd,"Local State"),t=JSON.parse(await w$(e,"utf8"));return t.profile.profiles_order.map((r,n)=>{let o=t.profile.info_cache[r];return o?{id:r,name:o.name,isLastUsed:t.profile.last_used===r,orderingIndex:n,avatarUrl:o.avatar_icon}:null}).filter(r=>!!r)};var T$=5e3,Qh=Xy(C$.platform()),A$=async(e,{codexSessionId:t})=>{let r=Gu(Vy),n=e.filter(i=>i.info.type==="iab"),o=k$(n,t,r);return await Promise.all(n.filter(i=>!o.includes(i)).map(async({api:i})=>i.close())),[...e.filter(i=>i.info.type!=="iab"),...o]},k$=(e,t,r)=>t==null?[]:e.filter(n=>n.info.metadata?.codexSessionId===t&&(r==null||n.info.metadata.codexAppBuildFlavor===r));var pk=async e=>{Tc();let t=B$(),r=await I$(),n=r.pipes,o=await Promise.all(n.map(l=>R$(l,e))),i=o.map(l=>"browser"in l?l.browser:null).filter(l=>l!=null),s=await A$(i,t),a={backendCounts:j$(s),browserCount:s.length,candidatePipeCount:o.length,currentCodexSessionId:t.codexSessionId??null,currentThreadId:t.threadId??null,currentThreadSource:t.threadSource??null,currentTurnId:t.turnId??null,discoveredIabCandidates:i.filter(l=>l.info.type==="iab").map(l=>({codexAppBuildFlavor:l.info.metadata?.codexAppBuildFlavor??null,codexSessionId:l.info.metadata?.codexSessionId??null})),failures:o.map(l=>"failure"in l?l.failure:null).filter(l=>l!=null).slice(0,8),iabBrowserCount:s.filter(l=>l.info.type==="iab").length,pipeListingError:r.error,pipeListingPipeCount:r.pipes.length},u=i.filter(l=>l.info.type==="iab").length;if(a.iabBrowserCount===0){let l=F$(u);L$(a,l,u)}return{browsers:s,diagnostics:a}};async function I$(){try{return{error:null,pipes:await N$()}}catch(e){return{error:fk(e),pipes:[]}}}async function R$(e,t){let r=null,n="pipe-connect";try{let o=await Bc.create(e);r=t(o),n="backend-info-request";let i=await P$(r.getInfo()),s=await uk(i).catch(a=>(ue(a),i));return{browser:{id:crypto.randomUUID().substring(8),api:r,info:await D$(s)}}}catch(o){return await r?.close(),ue(o),{failure:`${n}/${fk(o)}`}}}async function P$(e,t=T$){let r;try{return await Promise.race([e,new Promise((n,o)=>{r=setTimeout(()=>o(new Error(`Timed out after ${t}ms waiting for browser backend info.`)),t)})])}finally{r!==void 0&&clearTimeout(r)}}async function D$(e,{isFullCdpEnabled:t=Q1}={}){if(!ai(e.type)||!await t())return e;let r=e.capabilities?.tab??[];return r.some(n=>n.id===Uo.id)?e:{...e,capabilities:{...e.capabilities,tab:[...r,Uo.info]}}}function fk(e){if(typeof e=="string")return e;if(e==null||typeof e!="object")return String(e);let t=Xh(e,"name"),r=Xh(e,"message")?.trim()??"",n=Xh(e,"code"),o=n!=null&&!r.startsWith(`${n}:`)?n:null,s=[t,o].filter(a=>typeof a=="string"&&a.length>0).join(": ");return s.length>0?r.length===0?s:`${s}: ${r}`:r.length>0?r:String(e)}var N$=()=>ck()==="win32"?M$():O$(),O$=async()=>(await lk(Qh)).map(t=>dk.resolve(Qh,t)),M$=async()=>{let e="\\\\.\\pipe\\";return(await lk(e)).map(n=>dk.resolve(e,n)).filter(n=>n.startsWith(Qh))};function F$(e){return U$()==null?"missing-session-metadata":e===0?"no-iab-backends":"no-session-match"}function B$(){let e=qe();return{codexSessionId:_r(e),threadId:typeof e?.thread_id=="string"?e.thread_id:void 0,threadSource:typeof e?.thread_source=="string"?e.thread_source:void 0,turnId:typeof e?.turn_id=="string"?e.turn_id:void 0}}function L$(e,t,r){Fl("browser_use_backend_discovery_failed",t,{backend:"iab",browserCount:String(e.browserCount),candidatePipeCount:String(e.candidatePipeCount),discoveredIabBrowserCount:String(r),failureCount:String(e.failures.length),failures:JSON.stringify(e.failures),iabBrowserCount:String(e.iabBrowserCount),pipeListingError:e.pipeListingError??"none",pipeListingPipeCount:String(e.pipeListingPipeCount),platform:ck(),reason:t,release:Nt})}var U$=()=>_r(qe());function Xh(e,t){let r=e[t];return typeof r=="string"&&r.length>0?r:null}function j$(e){let t={cdp:0,extension:0,iab:0};for(let r of e)t[r.info.type]+=1;return t}function q$(e){return`extension=${e.extension}, iab=${e.iab}, cdp=${e.cdp}`}function mk(e){let t=[`Discovered backends: ${q$(e.backendCounts)}.`];return e.failures.length>0&&t.push(`Discovery errors: ${e.failures.join("; ")}.`),e.iabBrowserCount===0&&e.discoveredIabCandidates.length>0&&t.push(`IAB candidates: ${e.discoveredIabCandidates.map(({codexAppBuildFlavor:r,codexSessionId:n})=>`${n??"none"}@${r??"none"}`).join(", ")}.`),e.pipeListingError!=null&&t.push(`Pipe listing error: ${e.pipeListingError}.`),t.join(" ")}var $$="Cannot access a chrome-extension:// URL of different extension",z$="Chrome is blocking automation because another extension UI is open on this page. Complete or dismiss that extension UI in Chrome, then ask me to continue.";function hk(e){return W$(e)?new Error(z$,{cause:e instanceof Error?e:void 0}):e instanceof Error?e:new Error(gk(e))}function W$(e){return gk(e).includes($$)}function gk(e){if(e instanceof Error)return e.message;if(e&&typeof e=="object"&&"message"in e){let t=e.message;if(typeof t=="string")return t}return String(e??"")}function H$(e){return`Downloads are not supported by ${e.name}.`}var V$=new Set(["playwright_download_path","playwright_wait_for_download","cua_download_media","dom_cua_download_media","playwright_locator_download_media"]);function G$(e){return V$.has(e)}function bk({browserInfo:e,commandType:t}){if(G$(t)&&e.type==="iab")throw new Error(H$(e))}function K$(e){return`File uploads are not supported by ${e.name}.`}var J$=new Set(["playwright_file_chooser_set_files","playwright_wait_for_file_chooser"]);function Y$(e){return J$.has(e)}function yk({browserInfo:e,commandType:t}){if(Y$(t)&&e.type==="iab")throw new Error(K$(e))}var Z$={cdp:"cdp",extension:"chrome",iab:"iab"};function eg(e){switch(e){case"extension":return"extension";case"iab":return"iab";case"cdp":return"cdp"}}function dd(e){return e==="extension"||e==="iab"||e==="cdp"}function uu(e){return Z$[e]}function _k({browserId:e,clientInfo:t,requestedBrowserId:r}){return dd(r)?eg(t.type)===r:e===r}var X$={chrome:"The Chrome Browser Use plugin is not available in this context.",iab:"The Browser Use plugin is not available in this context.",cdp:"The CDP Browser Use backend is not available in this context."};function wk(e){if(e==="cdp")return;let t=xk();if(!(t==null||t.includes(e)))throw new Error(Q$(e))}function Q$(e){return X$[e]}function tg(e){if(e==="cdp")return!0;let t=xk();return t==null||t.includes(e)}function xk(){return i_()}var pd=class{ping(){return"pong"}};var fd=class extends Qi{constructor(r,n,o){super(r);this.apiTransport=r;this.getTurnMetadata=o;this.registerRequestHandlerObject(n)}apiTransport;getTurnMetadata;lastSessionParams=null;addEventListener=super.addEventListener;ping(){return this.sendRequest("ping")}executeCdp(r){return this.sendSessionRequest("executeCdp",r)}attach(r){return this.sendSessionRequest("attach",{tabId:r})}attachTarget(r,n){return this.sendSessionRequest("attachTarget",{tabId:r,targetId:n})}detach(r){return this.sendSessionRequest("detach",{tabId:r})}detachTarget(r,n){return this.sendSessionRequest("detachTarget",{tabId:r,targetId:n})}getTabs(){return this.sendSessionRequest("getTabs",{})}getUserTabs(){return this.sendSessionRequest("getUserTabs",{})}getUserHistory(r){return this.sendSessionRequest("getUserHistory",r)}claimUserTab(r){return this.sendSessionRequest("claimUserTab",{tabId:r})}createTab(){return this.sendSessionRequest("createTab",{})}finalizeTabs(r){return this.sendSessionRequest("finalizeTabs",{keep:r})}nameSession(r){return this.sendSessionRequest("nameSession",{name:r})}executeUnhandledCommand(r){return this.sendSessionRequest("executeUnhandledCommand",r)}moveMouse(r){return this.sendSessionRequest("moveMouse",r)}getInfo(){return this.sendSessionRequest("getInfo",{})}addCloseListener(r){return this.apiTransport.addCloseListener?.(r)??(()=>{})}async close(){await this.apiTransport.close?.()}sendSessionRequest(r,n){return this.sendRequest(r,{...n,...this.getSessionParams()})}getSessionParams(){let r=this.getTurnMetadata();if(r==null&&this.lastSessionParams!=null)return{...this.lastSessionParams,session_context:"cached"};let n=_r(r);if(typeof n!="string")throw new Error("Missing required browser session_id");let o=r?.turn_id;if(typeof o!="string")throw new Error("Missing required browser turn_id");return this.lastSessionParams={session_id:n,turn_id:o},{...this.lastSessionParams,session_context:"live"}}};import{platform as md}from"node:os";import{access as e7,readFile as t7}from"node:fs/promises";var r7=/^(?:[A-Za-z0-9_-]+\/)*[A-Za-z0-9_-]+$/u,Sk;async function n7(e=[new URL("../docs/",import.meta.url),new URL("../references/",import.meta.url)]){for(let t of e)try{return await e7(t),t}catch(r){if(!i7(r))throw r}throw new Error("Packaged browser documentation directory is missing.")}async function vk(e,t){if(typeof e!="string"||!r7.test(e))throw new Error("Documentation name must be a relative path without an extension.");return await t7(new URL(`${e}.md`,await(t??o7())),"utf8")}function o7(){return Sk??=n7(),Sk}function i7(e){return e!=null&&typeof e=="object"&&"code"in e&&e.code==="ENOENT"}var s7=Object.values(qh),a7="codex/toolSurface",rg=null;function u7(e,t){e.nodeRepl?.setResponseMeta({[a7]:{kind:"browserUse",backend:t}})}async function sye({globals:e}){ax(),Ot("browser_use_invocation_started","multi",{backend:"multi",platform:md(),release:Nt});let t=e,r,n,o;try{if(Za()==null)throw new Error(Ih());Tc();let l=new pd;({browsers:r,diagnostics:n}=await pk(p=>new fd(p,l,qe))),o=await c7(r)}catch(l){let d=l instanceof Error?l.name||"Error":typeof l;throw Ot("browser_use_setup_failed",d,{backend:"multi",phase:"runtime-setup",platform:md(),reason:d,release:Nt}),l}let i=o.map(l=>new ld(l.api,l.id,l.info));rg&&await rg(),rg=async()=>{await Promise.all(i.map(l=>l.dispose()))};let s=d7(e),a=EA({displayBridge:s,displayTruncateMaxChars:1e5}),u=new $a({browserInfos:o.map(({id:l,info:d})=>{let p=eg(d.type);return{capabilities:s_(d.capabilities),id:l,name:d.name,type:p,metadata:d.metadata}}),documentation:new za(vk),transport:new Wa({displaySideEffect:a,async executeAgentCommand(l){Ot("browser_use_agent_command",l.type);let{type:d,...p}=l;if("browser_id"in p){if(dd(p.browser_id)){let h=uu(p.browser_id);tg(h)||Ek({diagnostics:n,reason:"backend-disabled",requestedBrowserId:p.browser_id}),wk(h)}let f=i.find(h=>_k({browserId:h.browserId,clientInfo:h.clientInfo,requestedBrowserId:p.browser_id}));if(!f)throw Ek({diagnostics:n,reason:"not-discovered",requestedBrowserId:p.browser_id}),new Error(l7(p.browser_id,n));jf(f.clientInfo.type),u7(e,uu(f.clientInfo.type)),bk({browserInfo:f.clientInfo,commandType:d}),yk({browserInfo:f.clientInfo,commandType:d});let m=s7.find(h=>h.type===d);try{return await f.security.ensureCommandAllowed({type:d,params:p}),m?await m(p,f):await ec(d,p,async()=>await f.executeUnhandledCommand({type:d,...p}))}catch(h){throw hk(h)}}throw new Error("Browser ID must be provided")}})});t.agent=u,t.display=a,Ot("browser_use_setup"),Ot("browser_use_invocation_ready","multi",{backend:"multi",backendCounts:JSON.stringify(n.backendCounts),platform:md(),release:Nt})}function Ek({diagnostics:e,reason:t,requestedBrowserId:r}){Ot("browser_use_requested_browser_unavailable",t,{backend:dd(r)?uu(r):"unknown",backendCounts:JSON.stringify(e.backendCounts),browserCount:String(e.browserCount),iabBrowserCount:String(e.iabBrowserCount),platform:md(),reason:t,release:Nt,requestedBrowserId:r})}function l7(e,t){return`Failed to connect to browser "${e}". `+mk(t)}async function c7(e){let t=[],r=[];for(let n of e)tg(uu(n.info.type))?t.push(n):r.push(n);return await Promise.all(r.map(({api:n})=>n.close())),t}var d7=e=>({displayImage:async t=>{await e.nodeRepl?.emitImage(t)},displayValue:async t=>{let r=e.console;if(r&&typeof r.log=="function"){r.log(t);return}console.log(t)}});export{sye as setupBrowserRuntime};
