1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="5e0e5df1-4523-41fd-bf72-7818822f78c4",e._sentryDebugIdIdentifier="sentry-dbid-5e0e5df1-4523-41fd-bf72-7818822f78c4")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[678],{659:(e,t,n)=>{n.d(t,{l:()=>r});var r="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"},1774:(e,t,n)=>{n.d(t,{v:()=>s});var r=n(11713),i=n(40562);function s(e){return new r.c(function(t){(0,i.Tg)(e()).subscribe(t)})}},2259:(e,t,n)=>{n.d(t,{w:()=>r});var r=new(n(11713)).c(function(e){return e.complete()})},2559:(e,t,n)=>{n.d(t,{c:()=>p});var r=n(56530),i=n(92666),s=n(88765),o=n(43917),a=n(27616),l=n(32605),u=n(40562),c=n(11713),d=n(19554),h=n(60689);function p(e,t){void 0===t&&(t=r.E);var n,p,f,g,m=(n=e,p=t,void 0===n&&(n=0),void 0===f&&(f=r.b),g=-1,null!=p&&((0,d.m)(p)?f=p:g=p),new c.c(function(e){var t=(0,h.v)(n)?n-f.now():n;t<0&&(t=0);var r=0;return f.schedule(function(){e.closed||(e.next(r++),0<=g?this.schedule(void 0,g):e.complete())},t)}));return function e(t,n){return n?function(r){return(0,i.x)(n.pipe((0,s.s)(1),(0,o.w)()),r.pipe(e(t)))}:(0,l.Z)(function(e,n){return(0,u.Tg)(t(e,n)).pipe((0,s.s)(1),(0,a.T)(function(){return e}))})}(function(){return m})}},2695:(e,t,n)=>{n.d(t,{Q:()=>a});var r=n(43356),i=n(57304),s=n(40562),o=n(99949);function a(e){return(0,r.N)(function(t,n){(0,s.Tg)(e).subscribe((0,i._)(n,function(){return n.complete()},o.l)),n.closed||t.subscribe(n)})}},8677:(e,t,n)=>{n.d(t,{yQ:()=>b});var r=e=>"function"==typeof e?e:function(){return e},i="undefined"!=typeof window?window:null,s=("undefined"!=typeof self?self:null)||i||globalThis,o={connecting:0,open:1,closing:2,closed:3},a={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},l={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},u={longpoll:"longpoll",websocket:"websocket"},c={complete:4},d="base64url.bearer.phx.",h=class{constructor(e,t,n,r){this.channel=e,this.event=t,this.payload=n||function(){return{}},this.receivedResp=null,this.timeout=r,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(e){this.timeout=e,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(e,t){return this.hasReceived(e)&&t(this.receivedResp.response),this.recHooks.push({status:e,callback:t}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:e,response:t,_ref:n}){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.cancelRefEvent(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,e=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=e,this.matchReceive(e)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}trigger(e,t){this.channel.trigger(this.refEvent,{status:e,response:t})}},p=class{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},f=class{constructor(e,t,n){this.state=a.closed,this.topic=e,this.params=r(t||{}),this.socket=n,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new h(this,l.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new p(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=a.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e
1=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=a.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=a.closed,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=a.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new h(this,l.leave,r({}),this.timeout).send(),this.state=a.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(l.reply,(e,t)=>{this.trigger(this.replyEventName(t),e)})}join(e=this.timeout){if(!this.joinedOnce)return this.timeout=e,this.joinedOnce=!0,this.rejoin(),this.joinPush;throw Error("tried to join multiple times. 'join' can only be called a single time per channel instance")}onClose(e){this.on(l.close,e)}onError(e){return this.on(l.error,t=>e(t))}on(e,t){let n=this.bindingRef++;return this.bindings.push({event:e,ref:n,callback:t}),n}off(e,t){this.bindings=this.bindings.filter(n=>n.event!==e||void 0!==t&&t!==n.ref)}canPush(){return this.socket.isConnected()&&this.isJoined()}push(e,t,n=this.timeout){if(t=t||{},!this.joinedOnce)throw Error(`tried to push '${e}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let r=new h(this,e,function(){return t},n);return this.canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}leave(e=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=a.leaving;let t=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(l.close,"leave")},n=new h(this,l.leave,r({}),e);return n.receive("ok",()=>t()).receive("timeout",()=>t()),n.send(),this.canPush()||n.trigger("ok",{}),n}onMessage(e,t,n){return t}
1isMember(e,t,n,r){return this.topic===e&&(!r||r===this.joinRef()||(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:e,event:t,payload:n,joinRef:r}),!1))}joinRef(){return this.joinPush.ref}rejoin(e=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=a.joining,this.joinPush.resend(e))}trigger(e,t,n,r){let i=this.onMessage(e,t,n,r);if(t&&!i)throw Error("channel onMessage callbacks must return the payload, modified or unmodified");let s=this.bindings.filter(t=>t.event===e);for(let e=0;e<s.length;e++)s[e].callback(i,n,r||this.joinRef())}replyEventName(e){return`chan_reply_${e}`}isClosed(){return this.state===a.closed}isErrored(){return this.state===a.errored}isJoined(){return this.state===a.joined}isJoining(){return this.state===a.joining}isLeaving(){return this.state===a.leaving}},g=class{static request(e,t,n,r,i,o,a){if(s.XDomainRequest){let n=new s.XDomainRequest;return this.xdomainRequest(n,e,t,r,i,o,a)}if(s.XMLHttpRequest){let l=new s.XMLHttpRequest;return this.xhrRequest(l,e,t,n,r,i,o,a)}if(s.fetch&&s.AbortController)return this.fetchRequest(e,t,n,r,i,o,a);throw Error("No suitable XMLHttpRequest implementation found")}static fetchRequest(e,t,n,r,i,o,a){let l={method:e,headers:n,body:r},u=null;return i&&(u=new AbortController,setTimeout(()=>u.abort(),i),l.signal=u.signal),s.fetch(t,l).then(e=>e.text()).then(e=>this.parseJSON(e)).then(e=>a&&a(e)).catch(e=>{"AbortError"===e.name&&o?o():a&&a(null)}),u}static xdomainRequest(e,t,n,r,i,s,o){return e.timeout=i,e.open(t,n),e.onload=()=>{let t=this.parseJSON(e.responseText);o&&o(t)},s&&(e.ontimeout=s),e.onprogress=()=>{},e.send(r),e}static xhrRequest(e,t,n,r,i,s,o,a){for(let[i,o]of(e.open(t,n,!0),e.timeout=s,Object.entries(r)))e.setRequestHeader(i,o);return e.onerror=()=>a&&a(null),e.onreadystatechange=()=>{e.readyState===c.complete&&a&&a(this.parseJSON(e.responseText))},o&&(e.ontimeout=o),e.send(i),e}static parseJSON(e){if(!e||""===e)return null;try{return JSON.parse(e)}catch{return console&&console.log("failed to parse JSON response",e),null}}static serialize(e,t){let n=[];for(var r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=t?`${t}[${r}]`:r,s=e[r];"object"==typeof s?n.push(this.serialize(s,i)):n.push(encodeURIComponent(i)+"="+encodeURIComponent(s))}return n.join("&")}static appendParams(e,t){if(0===Object.keys(t).length)return e;let n=e.match(/\?/)?"&":"?";return`${e}${n}${this.serialize(t)}`}},m=class{constructor(e,t){t&&2===t.length&&t[1].startsWith(d)&&(this.authToken=atob(t[1].slice(d.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(e),this.readyState=o.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(e){return e.replace("ws://","http://").replace("wss://","https://").replace(RegExp("(.*)/"+u.websocket),"$1/"+u.longpoll)}endpointURL(){return g.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(e,t,n){this.close(e,t,n),this.readyState=o.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===o.open||this.readyState===o.connecting}poll(){let e={Accept:"application/json"};this.authToken&&(e["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",e,null,()=>this.ontimeout(),e=>{if(e){var{status:t,token:n,messages:r}=e;if(410===t&&null!==this.token){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else t=0;switch(t){case 200:r.forEach(e=>{setTimeout(()=>this.onmessage({data:e}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=o.open,this.onopen({}),this.poll();break;
1case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw Error(`unhandled poll status ${t}`)}})}send(e){"string"!=typeof e&&(e=(e=>{let t="",n=new Uint8Array(e),r=n.byteLength;for(let e=0;e<r;e++)t+=String.fromCharCode(n[e]);return btoa(t)})(e)),this.currentBatch?this.currentBatch.push(e):this.awaitingBatchAck?this.batchBuffer.push(e):(this.currentBatch=[e],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(e,t=0){this.awaitingBatchAck=!0;let n=t+100,r=e.slice(t,n);this.ajax("POST",{"Content-Type":"application/x-ndjson"},r.join("\n"),()=>this.ontimeout(),t=>{t&&200===t.status?n<e.length?this.batchSend(e,n):this.batchBuffer.length>0?(this.batchSend(this.batchBuffer),this.batchBuffer=[]):this.awaitingBatchAck=!1:(this.awaitingBatchAck=!1,this.onerror(t&&t.status),this.closeAndRetry(1011,"internal server error",!1))})}close(e,t,n){for(let e of this.reqs)e.abort();this.readyState=o.closed;let r=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:e,reason:t,wasClean:n});this.batchBuffer=[],this.awaitingBatchAck=!1,clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,"undefined"!=typeof CloseEvent?this.onclose(new CloseEvent("close",r)):this.onclose(r)}ajax(e,t,n,r,i){let s,o=()=>{this.reqs.delete(s),r()};s=g.request(e,this.endpointURL(),t,n,this.timeout,o,e=>{this.reqs.delete(s),this.isActive()&&i(e)}),this.reqs.add(s)}},v={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(e,t){return e.payload.constructor===ArrayBuffer?t(this.binaryEncode(e)):t(JSON.stringify([e.join_ref,e.ref,e.topic,e.event,e.payload]))},decode(e,t){if(e.constructor===ArrayBuffer)return t(this.binaryDecode(e));{let[n,r,i,s,o]=JSON.parse(e);return t({join_ref:n,ref:r,topic:i,event:s,payload:o})}},binaryEncode(e){let{join_ref:t,ref:n,event:r,topic:i,payload:s}=e,o=new TextEncoder,a=o.encode(t),l=o.encode(n),u=o.encode(i),c=o.encode(r);this.assertFieldSize(a.byteLength,"join_ref"),this.assertFieldSize(l.byteLength,"ref"),this.assertFieldSize(u.byteLength,"topic"),this.assertFieldSize(c.byteLength,"event");let d=this.META_LENGTH+a.byteLength+l.byteLength+u.byteLength+c.byteLength,h=new ArrayBuffer(this.HEADER_LENGTH+d),p=new Uint8Array(h),f=new DataView(h),g=0;f.setUint8(g++,this.KINDS.push),f.setUint8(g++,a.byteLength),f.setUint8(g++,l.byteLength),f.setUint8(g++,u.byteLength),f.setUint8(g++,c.byteLength),p.set(a,g),g+=a.byteLength,p.set(l,g),g+=l.byteLength,p.set(u,g),g+=u.byteLength,p.set(c,g),g+=c.byteLength;var m=new Uint8Array(h.byteLength+s.byteLength);return m.set(p,0),m.set(new Uint8Array(s),h.byteLength),m.buffer},assertFieldSize(e,t){if(e>255)throw Error(`unable to convert ${t} to binary: must be less than or equal to 255 bytes, but is ${e} bytes`)},binaryDecode(e){let t=new DataView(e),n=t.getUint8(0),r=new TextDecoder;switch(n){case this.KINDS.push:return this.decodePush(e,t,r);case this.KINDS.reply:return this.decodeReply(e,t,r);case this.KINDS.broadcast:return this.decodeBroadcast(e,t,r)}},decodePush(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),s=t.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=n.decode(e.slice(o,o+r));o+=r;let l=n.decode(e.slice(o,o+i));o+=i;let u=n.decode(e.slice(o,o+s));return o+=s,{join_ref:a,ref:null,topic:l,event:u,payload:e.slice(o,e.byteLength)}},decodeReply(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),s=t.getUint8(3),o=t.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,u=n.decode(e.slice(a,a+r));a+=r;let c=n.decode(e.slice(a,a+i));a+=i;let d=n.decode(e.slice(a,a+s));a+=s;let h=n.decode(e.slice(a,a+o));a+=o;let p=e.slice(a,e.byteLength);return{join_ref:u,ref:c,topic:d,event:l.reply,payload:{status:h,response:p}}},decodeBroadcast(e,t,n){let r=t.getUint8(1),i=t.getUint8(2),s=this.HEADER_LENGTH+2,o=n.decode(e.slice(s,s+r));s+=r;let a=n.decode(e.slice(s,s+i));return s+=i,{join_ref:null,ref:null,topic:o,event:a,payload:e.slice(s,e.byteLength)}}},b=class{constructor(e,t={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=t.timeout||1e4,this.transport=t.transport||s.WebSocket||m,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=t.longPollFallbackMs,this.fallbackTimer=null,this.sessionStore=t.sessionStorage||s&&s.sessionStorage,this.establishedConnections=0,this.defaultEncoder=v.encode.bind(v),this.defaultDecoder=v.decode.bind(v),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=t.binaryType||"arraybuffer",this.connectClock=1,this.transport!==m?(this.encode=t.encode||this.defaultEncoder,this.decode=t.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;i&&i.addEventListener&&(i.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),n=this.connectClock)}),i.addEventListener("pageshow",e=>{n===this.connectClock&&(n=null,this.connect())}),i.addEventListener("visibilitychange",()=>{this.handleVisibilityChange()}),i.document&&i.document.addEventListener("resume",()=>{this.handleVisibilityChange()})),this.heartbeatIntervalMs=t.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>t.rejoinAfterMs?t.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>t.reconnectAfterMs?t.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=t.logger||null,!this.logger&&t.debug&&(this.logger=(e,t,n)=>{console.log(`${e}: ${t}`,n)}),this.longpollerTimeout=t.longpollerTimeout||2e4,this.params=r(t.params||{}),this.endPoint=`${e}/${u.websocket}`,this.vsn=t.vsn||"2.0.0",this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new p(()=>
1{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(()=>this.connect())},this.reconnectAfterMs),this.authToken=t.authToken&&r(t.authToken)}get pageHidden(){return!!i&&!!i.document&&"hidden"===i.document.visibilityState}handleVisibilityChange(){this.pageHidden||this.isConnected()||this.closeWasClean||this.teardown(()=>this.connect())}getLongPollTransport(){return m}replaceTransport(e){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=e}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let e=g.appendParams(g.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return"/"!==e.charAt(0)?e:"/"===e.charAt(1)?`${this.protocol()}:${e}`:`${this.protocol()}://${location.host}${e}`}disconnect(e,t,n){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,e&&e()},t,n)}connect(e){e&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=r(e)),(!this.conn||this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==m?this.connectWithF
1allback(m,this.longPollFallbackMs):this.transportConnect())}log(e,t,n){this.logger&&this.logger(e,t,n)}hasLogger(){return null!==this.logger}onOpen(e){let t=this.makeRef();return this.stateChangeCallbacks.open.push([t,e]),t}onClose(e){let t=this.makeRef();return this.stateChangeCallbacks.close.push([t,e]),t}onError(e){let t=this.makeRef();return this.stateChangeCallbacks.error.push([t,e]),t}onMessage(e){let t=this.makeRef();return this.stateChangeCallbacks.message.push([t,e]),t}ping(e){if(!this.isConnected())return!1;let t=this.makeRef(),n=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:t});let r=this.onMessage(i=>{i.ref===t&&(this.off([r]),e(Date.now()-n))});return!0}transportName(e){return e===m?"LongPoll":e.name}transportConnect(){let e;this.connectClock++,this.closeWasClean=!1,this.authToken&&(e=["phoenix",`${d}${btoa(this.authToken()).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),e),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(e){return this.sessionStore&&this.sessionStore.getItem(e)}storeSession(e,t){this.sessionStore&&this.sessionStore.setItem(e,t)}connectWithFallback(e,t=2500){let n,r;clearTimeout(this.fallbackTimer);let i=!1,s=!0,o=this.transportName(e),a=t=>{this.log("transport",`falling back to ${o}...`,t),this.off([n,r]),s=!1,this.replaceTransport(e),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,t),r=this.onError(e=>{this.log("transport","error",e),s&&!i&&(clearTimeout(this.fallbackTimer),a(e))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(i=!0,!s){let t=this.transportName(e);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${t}`,"true"),this.log("transport",`established ${t} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,t),this.ping(e=>{this.log("transport","connected to primary after",e),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`${this.transportName(this.transport)} connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,e])=>e())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError("heartbeat_timeout"),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),1e3,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(e,t,n){if(!this.conn)return e&&e();let r=this.conn;this.waitForBufferDone(r,()=>{t?r.close(t,n||""):r.close(),this.waitForSocketClosed(r,()=>{this.conn===r&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),e&&e()})})}waitForBufferDone(e,t,n=1){if(5===n||!e.bufferedAmount)return void t();setTimeout(()=>{this.waitForBufferDone(e,t,n+1)},150*n)}waitForSocketClosed(e,t,n=1){if(5===n||e.readyState===o.closed)return void t();setTimeout(()=>{this.waitForSocketClosed(e,t,n+1)},150*n)}onConnClose(e){this.conn&&(this.conn.onclose=()=>{});let t=e&&e.code;this.hasLogger()&&this.log("transport","close",e),this.triggerChanError("connection_closed"),this.clearHeartbeats(),this.closeWasClean||1e3===t||this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,t])=>t(e))}onConnError(e){this.hasLogger()&&this.log("transport","error",e);let t=this.transport,n=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,r])=>{r(e,t,n)}),(t===this.transport||n>0)&&this.triggerChanError("connection_error")}
1triggerChanError(e){this.channels.forEach(t=>{t.isErrored()||t.isLeaving()||t.isClosed()||t.trigger(l.error,{source:"transport",reason:e})})}connectionState(){switch(this.conn&&this.conn.readyState){case o.connecting:return"connecting";case o.open:return"open";case o.closing:return"closing";default:return"closed"}}isConnected(){return"open"===this.connectionState()}remove(e){this.off(e.stateChangeRefs),this.channels=this.channels.filter(t=>t!==e)}off(e){for(let t in this.stateChangeCallbacks)this.stateChangeCallbacks[t]=this.stateChangeCallbacks[t].filter(([t])=>-1===e.indexOf(t))}channel(e,t={}){let n=new f(e,t,this);return this.channels.push(n),n}push(e){if(this.hasLogger()){let{topic:t,event:n,payload:r,ref:i,join_ref:s}=e;this.log("push",`${t} ${n} (${s}, ${i})`,r)}this.isConnected()?this.encode(e,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(e,e=>this.conn.send(e)))}makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}sendHeartbeat(){(!this.pendingHeartbeatRef||this.isConnected())&&(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}onConnMessage(e){this.decode(e.data,e=>{let{topic:t,event:n,payload:r,ref:i,join_ref:s}=e;i&&i===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${r.status||""} ${t} ${n} ${i&&"("+i+")"||""}`,r);for(let e=0;e<this.channels.length;e++){let o=this.channels[e];o.isMember(t,n,r,s)&&o.trigger(n,r,i,s)}for(let t=0;t<this.stateChangeCallbacks.message.length;t++){let[,n]=this.stateChangeCallbacks.message[t];n(e)}})}leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t.isJoined()||t.isJoining()));t&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${e}"`),t.leave())}}},8917:(e,t,n)=>{n.d(t,{R:()=>a});var r=n(70324),i=function(e){function t(t,n){return e.call(this)||this}return(0,r.C6)(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(n(43532).yU),s={setInterval:function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=s.delegate;return(null==o?void 0:o.setInterval)?o.setInterval.apply(o,(0,r.fX)([e,t],(0,r.zs)(n))):setInterval.apply(void 0,(0,r.fX)([e,t],(0,r.zs)(n)))},clearInterval:function(e){var t=s.delegate;return((null==t?void 0:t.clearInterval)||clearInterval)(e)},delegate:void 0},o=n(86540),a=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return(0,r.C6)(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var n,r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!=(n=this.id)?n:this.requestAsyncId(i,this.id,t),this},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),s.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&s.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,(0,o.o)(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(i)},10489:(e,t,n)=>{n.d(t,{Ar:()=>nP,qB:()=>nM,N4:()=>t6,BR:()=>no,I$:()=>t4,bt:()=>nT,l8:()=>na});var r,i={};n.r(i),n.d(i,{JsonPatchError:()=>b,_areEquals:()=>x,applyOperation:()=>S,applyPatch:()=>w,applyReducer:()=>A,deepClone:()=>y,getValueByPointer:()=>k,validate:()=>_,validator:()=>I});var s={};n.r(s),n.d(s,{compare:()=>j,generate:()=>P,observe:()=>L,unobserve:()=>O});var o=n(97789),a=n(59666),l=function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]}
vendor: 2,001 bytes, line 1
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),u=Object.prototype.hasOwnProperty;function c(e,t){return u.call(e,t)}function d(e){if(Array.isArray(e)){for(var t=Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var r=[];for(var i in e)c(e,i)&&r.push(i);return r}function h(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function p(e){for(var t,n=0,r=e.length;n<r;){if((t=e.charCodeAt(n))>=48&&t<=57){n++;continue}return!1}return!0}function f(e){return -1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function g(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function m(e,t){var n=[e];for(var r in t){var i="object"==typeof t[r]?JSON.stringify(t[r],null,2):t[r];void 0!==i&&n.push(r+": "+i)}return n.join("\n")}var v=function(e){function t(t,n,r,i,s){var o=this.constructor,a=e.call(this,m(t,{name:n,index:r,operation:i,tree:s}))||this;return a.name=n,a.index=r,a.operation=i,a.tree=s,Object.setPrototypeOf(a,o.prototype),a.message=m(t,{name:n,index:r,operation:i,tree:s}),a}return l(t,e),t}(Error),b=v,y=h,E={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=k(n,this.path);r&&(r=h(r));var i=S(n,{op:"remove",path:this.from}).removed;return S(n,{op:"add",path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=k(n,this.from);return S(n,{op:"add",path:this.path,value:h(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:x(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}}
1,T={add:function(e,t,n){return p(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:E.move,copy:E.copy,test:E.test,_get:E._get};function k(e,t){if(""==t)return e;var n={op:"_get",path:t};return S(e,n),n.value}function S(e,t,n,r,i,s){if(void 0===n&&(n=!1),void 0===r&&(r=!0),void 0===i&&(i=!0),void 0===s&&(s=0),n&&("function"==typeof n?n(t,0,e,t.path):I(t,0)),""===t.path){var o={newDocument:e};if("add"===t.op)return o.newDocument=t.value,o;if("replace"===t.op)return o.newDocument=t.value,o.removed=e,o;if("move"===t.op||"copy"===t.op)return o.newDocument=k(e,t.from),"move"===t.op&&(o.removed=e),o;else if("test"===t.op){if(o.test=x(e,t.value),!1===o.test)throw new b("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o.newDocument=e,o}else if("remove"===t.op)return o.removed=e,o.newDocument=null,o;else if("_get"===t.op)return t.value=e,o;else if(!n)return o;else throw new b("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e)}r||(e=h(e));var a=(t.path||"").split("/"),l=e,u=1,c=a.length,d=void 0,f=void 0,m=void 0;for(m="function"==typeof n?n:I;;){if((f=a[u])&&-1!=f.indexOf("~")&&(f=g(f)),i&&("__proto__"==f||"prototype"==f&&u>0&&"constructor"==a[u-1]))throw TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===d&&(void 0===l[f]?d=a.slice(0,u).join("/"):u==c-1&&(d=t.path),void 0!==d&&m(t,0,e,d)),u++,Array.isArray(l)){if("-"===f)f=l.length;else if(n&&!p(f))throw new b("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);else p(f)&&(f=~~f);if(u>=c){if(n&&"add"===t.op&&f>l.length)throw new b("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var o=T[t.op].call(t,l,f,e);if(!1===o.test)throw new b("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}}else if(u>=c){var o=E[t.op].call(t,l,f,e);if(!1===o.test)throw new b("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return o}if(l=l[f],n&&u<c&&(!l||"object"!=typeof l))throw new b("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}function w(e,t,n,r,i){if(void 0===r&&(r=!0),void 0===i&&(i=!0),n&&!Array.isArray(t))throw new b("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=h(e));for(var s=Array(t.length),o=0,a=t.length;o<a;o++)s[o]=S(e,t[o],n,!0,i,o),e=s[o].newDocument;return s.newDocument=e,s}function A(e,t,n){var r=S(e,t);if(!1===r.test)throw new b("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return r.newDocument}function I(e,t,n,r){if("object"!=typeof e||null===e||Array.isArray(e))throw new b("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(E[e.op]){if("string"!=typeof e.path)throw new b("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);else if(0!==e.path.indexOf("/")&&e.path.length>0)throw new b('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);else if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new b("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);else if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new b("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);else if(("add"===e.op||"replace"===e.op||"test"===e.op)&&function e(t){if(void 0===t)return!0;if(t){if(Array.isArray(t)){for(var n=0,r=t.length;n<r;n++)if(e(t[n]))return!0}else if("object"==typeof t){for(var i=d(t),s=i.length,o=0;o<s;o++)if(e(t[i[o]]))return!0}}return!1}(e.value))throw new b("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);else if(n){if("add"==e.op){var i=e.path.split("/").length,s=r.split("/").length;if(i!==s+1&&i!==s)throw new b("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new b("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var o=_([{op:"_get",path:e.from,value:void 0}],n);if(o&&"OPERATION_PATH_UNRESOLVABLE"===o.name)throw new b("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new b("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function _(e,t,n){try{if(!Array.isArray(e))throw new b("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)w(h(t),h(e),n||!0);else{n=n||I;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(e){if(e instanceof b)return e;throw e}}function x(e,t){if(e===t)return!0;
1if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,i,s=Array.isArray(e),o=Array.isArray(t);if(s&&o){if((r=e.length)!=t.length)return!1;for(n=r;0!=n--;)if(!x(e[n],t[n]))return!1;return!0}if(s!=o)return!1;var a=Object.keys(e);if((r=a.length)!==Object.keys(t).length)return!1;for(n=r;0!=n--;)if(!t.hasOwnProperty(a[n]))return!1;for(n=r;0!=n--;)if(!x(e[i=a[n]],t[i]))return!1;return!0}return e!=e&&t!=t}var N=new WeakMap,C=function(e){this.observers=new Map,this.obj=e},R=function(e,t){this.callback=e,this.observer=t};function O(e,t){t.unobserve()}function L(e,t){var n=N.get(e);if(n){var r,i=n.observers.get(t);r=i&&i.observer}else n=new C(e),N.set(e,n);if(r)return r;if(r={},n.value=h(e),t){r.callback=t,r.next=null;var s=function(){P(r)},o=function(){clearTimeout(r.next),r.next=setTimeout(s)};"undefined"!=typeof window&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return r.patches=[],r.object=e,r.unobserve=function(){var e,t;P(r),clearTimeout(r.next),e=n,t=r,e.observers.delete(t.callback),"undefined"!=typeof window&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},n.observers.set(t,new R(t,r)),r}function P(e,t){void 0===t&&(t=!1);var n=N.get(e.object);M(n.value,e.object,e.patches,"",t),e.patches.length&&w(n.value,e.patches);var r=e.patches;return r.length>0&&(e.patches=[],e.callback&&e.callback(r)),r}function M(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var s=d(t),o=d(e),a=!1,l=o.length-1;l>=0;l--){var u=o[l],p=e[u];if(c(t,u)&&(void 0!==t[u]||void 0===p||!1!==Array.isArray(t))){var g=t[u];"object"==typeof p&&null!=p&&"object"==typeof g&&null!=g&&Array.isArray(p)===Array.isArray(g)?M(p,g,n,r+"/"+f(u),i):p!==g&&(i&&n.push({op:"test",path:r+"/"+f(u),value:h(p)}),n.push({op:"replace",path:r+"/"+f(u),value:h(g)}))}else Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+f(u),value:h(p)}),n.push({op:"remove",path:r+"/"+f(u)}),a=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}))}if(a||s.length!=o.length)for(var l=0;l<s.length;l++){var u=s[l];c(e,u)||void 0===t[u]||n.push({op:"add",path:r+"/"+f(u),value:h(t[u])})}}}function j(e,t,n){void 0===n&&(n=!1);var r=[];return M(e,t,r,"",n),r}let D=Object.assign({},i,s,{JsonPatchError:v,deepClone:h,escapePathComponent:f,unescapePathComponent:g});var $=n(96483),B=n(2259),U=n(65048),G=n(1774),z=n(63582),Y=n(11713),H=n(73513),F=n(87725),V=n(32605),Z=n(51236),X=n(19729),K=n(87181),q=n(89605);function W(e,t){return(0,q.T)(t)?(0,V.Z)(e,t,1):(0,V.Z)(e,1)}var J=n(63105),Q=n(43356),ee=n(57304),et=n(58428);n(53660);var en=n(27616),er=n(2695),ei=n(70441),es=n(91887);function eo(e){return" \r\n ".indexOf(e)>=0}function ea(e){for(var t,n,r,i=["topLevel"],s=0,o=function(e){return i.push(e)},a=function(e){return i[i.length-1]=e},l=function(e){null==t&&(t=s,n=i.length,r=e)},u=function(e){e===r&&(t=void 0,n=void 0,r=void 0)},c=function(){return i.pop()},d=function(){return s--},h=function(e){if("0"<=e&&e<="9")return void o("number");switch(e){case'"':o("string");return;case"-":o("numberNeedsDigit");return;case"t":o("true");return;case"f":o("false");return;case"n":o("null");return;case"[":o("arrayNeedsValue");return;case"{":o("objectNeedsKey");return}},p=e.length;s<p;s++){var f=e[s];switch(i[i.length-1]){case"topLevel":h(f);break;case"string":switch(f){case'"':c();break;case"\\":l("stringEscape"),o("stringEscaped")}break;case"stringEscaped":"u"===f?o("stringUnicode"):(u("stringEscape"),c());break;case"stringUnicode":s-e.lastIndexOf("u",s)==4&&(u("stringEscape"),c());break;case"number":"."===f?a("numberNeedsDigit"):"e"===f||"E"===f?a("numberNeedsExponent"):(f<"0"||f>"9")&&(d(),c());break;case"numberNeedsDigit":a("number");break;
1case"numberNeedsExponent":a("+"===f||"-"===f?"numberNeedsDigit":"number");break;case"true":case"false":case"null":(f<"a"||f>"z")&&(d(),c());break;case"arrayNeedsValue":"]"===f?c():eo(f)||(u("collectionItem"),a("arrayNeedsComma"),h(f));break;case"arrayNeedsComma":"]"===f?c():","===f&&(l("collectionItem"),a("arrayNeedsValue"));break;case"objectNeedsKey":"}"===f?c():'"'===f&&(l("collectionItem"),a("objectNeedsColon"),o("string"));break;case"objectNeedsColon":":"===f&&a("objectNeedsValue");break;case"objectNeedsValue":eo(f)||(u("collectionItem"),a("objectNeedsComma"),h(f));break;case"objectNeedsComma":"}"===f?c():","===f&&(l("collectionItem"),a("objectNeedsKey"))}}null!=n&&(i.length=n);for(var g=[null!=t?e.slice(0,t):e],m=function(t){return g.push(t.slice(e.length-e.lastIndexOf(t[0])))},v=i.length-1;v>=0;v--)switch(i[v]){case"string":g.push('"');break;case"numberNeedsDigit":case"numberNeedsExponent":g.push("0");break;case"true":m("true");break;case"false":m("false");break;case"null":m("null");break;case"arrayNeedsValue":case"arrayNeedsComma":g.push("]");break;case"objectNeedsKey":case"objectNeedsColon":case"objectNeedsValue":case"objectNeedsComma":g.push("}")}return g.join("")}function el(){let e=this.buf,t=this.pos,n=0,r=0;for(let i=0;i<28;i+=7){let s=e[t++];if(n|=(127&s)<<i,(128&s)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}let i=e[t++];if(n|=(15&i)<<28,r=(112&i)>>4,(128&i)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}for(let i=3;i<=31;i+=7){let s=e[t++];if(r|=(127&s)<<i,(128&s)==0){this.pos=t,this.assertBounds(),this.varint64Lo=n,this.varint64Hi=r;return}}throw Error("invalid varint")}function eu(e){let t="-"===e[0];t&&(e=e.slice(1));let n=0,r=0;function i(t,i){let s=Number(e.slice(t,i));r*=1e6,(n=1e6*n+s)>=0x100000000&&(r+=n/0x100000000|0,n%=0x100000000)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),t?eh(n,r):ed(n,r)}function ec(e,t){if({lo:e,hi:t}={lo:e>>>0,hi:t>>>0},t<=2097151)return String(0x100000000*t+e);let n=0xffffff&e,r=(e>>>24|t<<8)&0xffffff,i=t>>16&65535,s=n+6777216*r+6710656*i,o=r+8147497*i,a=2*i;return s>=1e7&&(o+=Math.floor(s/1e7),s%=1e7),o>=1e7&&(a+=Math.floor(o/1e7),o%=1e7),a.toString()+ep(o)+ep(s)}function ed(e,t){return{lo:0|e,hi:0|t}}function eh(e,t){return t=~t,e?e=~e+1:t+=1,ed(e,t)}let ep=e=>{let t=String(e);return"0000000".slice(t.length)+t};function ef(){let e=this.buf[this.pos++];if((128&e)==0)return this.assertBounds(),e;let t=127&e;if(t|=(127&(e=this.buf[this.pos++]))<<7,(128&e)==0||(t|=(127&(e=this.buf[this.pos++]))<<14,(128&e)==0)||(t|=(127&(e=this.buf[this.pos++]))<<21,(128&e)==0))return this.assertBounds(),t;t|=(15&(e=this.buf[this.pos++]))<<28;for(let t=5;(128&e)!=0&&t<10;t++)e=this.buf[this.pos++];if((128&e)!=0)throw Error("invalid varint");return this.assertBounds(),t>>>0}var eg=n(42922);let em=function(){let e=new DataView(new ArrayBuffer(8));if("function"==typeof BigInt&&"function"==typeof e.getBigInt64&&"function"==typeof e.getBigUint64&&"function"==typeof e.setBigInt64&&"function"==typeof e.setBigUint64&&(globalThis.Deno||globalThis.Bun||"object"!=typeof eg||"object"!=typeof eg.env||"1"!==eg.env.BUF_BIGINT_DISABLE)){let t=BigInt("-9223372036854775808"),n=BigInt("9223372036854775807"),r=BigInt("0"),i=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(e){let r="bigint"==typeof e?e:BigInt(e);if(r>n||r<t)throw Error(`invalid int64: ${e}`);return r},uParse(e){let t="bigint"==typeof e?e:BigInt(e);if(t>i||t<r)throw Error(`invalid uint64: ${e}`);return t},enc(t){return e.setBigInt64(0,this.parse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},uEnc(t){return e.setBigInt64(0,this.uParse(t),!0),{lo:e.getInt32(0,!0),hi:e.getInt32(4,!0)}},dec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigInt64(0,!0)),uDec:(t,n)=>(e.setInt32(0,t,!0),e.setInt32(4,n,!0),e.getBigUint64(0,!0))}}return{zero:"0",supported:!1,parse:e=>("string"!=typeof e&&(e=e.toString()),ev(e),e),uParse:e=>("string"!=typeof e&&(e=e.toString()),eb(e),e),enc:e=>("string"!=typeof e&&(e=e.toString()),ev(e),eu(e)),uEnc:e=>("string"!=typeof e&&(e=e.toString()),eb(e),eu(e)),dec:(e,t)=>(function(e,t){let n=ed(e,t),r=0x80000000&n.hi;r&&(n=eh(n.lo,n.hi));let i=ec(n.lo,n.hi);return r?"-"+i:i})(e,t),uDec:(e,t)=>ec(e,t)}}();function ev(e){if(!/^-?[0-9]+$/.test(e))throw Error("invalid int64: "+e)}function eb(e){if(!/^[0-9]+$/.test(e))throw Error("invalid uint64: "+e)}let ey=Symbol.for("@bufbuild/protobuf/text-encoding");function eE(){let e=globalThis;if(!e[ey]){var t;let n,r=new e.TextEncoder,i=new e.TextDecoder,s={encodeUtf8:e=>r.encode(e),decodeUtf8:(t,r)=>r?(n||(n=new e.TextDecoder("utf-8",{fatal:!0})),n.decode(t)):i.decode(t),checkUtf8(e){try{return encodeURIComponent(e),!0}catch(e){return!1}}};r.encodeInto&&(s.encodeUtf8Into=r.encodeInto.bind(r));let o=String.prototype.isWellFormed;o&&(s.checkUtf8=e=>o.call(e)),globalThis[ey]=Object.assign(Object.assign({},s),{encodeUtf8Into:null!=(t=s.encodeUtf8Into)?t:eT(s.encodeUtf8.bind(s))})}return e[ey]}function eT(e){return(t,n)=>{let r=e(t);return n.set(r),{written:r.byteLength}}}!function(e){e[e.Varint=0]="Varint",e[e.Bit64=1]="Bit64",e[e.LengthDelimited=2]="LengthDelimited",e[e.StartGroup=3]="StartGroup",e[e.EndGroup=4]="EndGroup",e[e.Bit32=5]="Bit32"}(r||(r={}));class ek{constructor(e){this.stackPos=[],this.encodeUtf8Into=e?eT(e):eE().encodeUtf8Into,this.buffer=eA,this.viewCache=eI,this.pos=0}
1ensureCapacity(e){let t=this.pos+e;if(t>this.buffer.length){let e=this.buffer.length||eS;for(;e<t;)e*=2;let n=new Uint8Array(e);this.pos>0&&n.set(this.buffer),this.buffer=n}}view(){let e=this.buffer,t=this.viewCache;if(t.byteLength===e.byteLength)return t;let n=new DataView(e.buffer);return this.viewCache=n,n}finish(){let e=this.buffer.slice(0,this.pos);return this.pos=0,this.stackPos=[],e}fork(){return this.stackPos.push(this.pos),this.ensureCapacity(ew),this.buffer[this.pos++]=0,this}join(){let e=this.stackPos.pop();if(void 0===e)throw Error("invalid state, fork stack empty");let t=this.pos-e-ew,n=ex(t);return n>ew&&(this.ensureCapacity(n-ew),this.buffer.copyWithin(e+n,e+ew,this.pos)),this.pos=e,this.uint32(t),this.pos+=t,this}tag(e,t){return this.uint32((e<<3|t)>>>0)}raw(e){return this.ensureCapacity(e.length),this.buffer.set(e,this.pos),this.pos+=e.length,this}uint32(e){if(eR(e),this.ensureCapacity(5),e<128)return this.buffer[this.pos++]=e,this;for(;e>127;)this.buffer[this.pos++]=127&e|128,e>>>=7;return this.buffer[this.pos++]=e,this}int32(e){if(eC(e),e>=0)return this.uint32(e);this.ensureCapacity(10);for(let t=0;t<9;t++)this.buffer[this.pos++]=127&e|128,e>>=7;return this.buffer[this.pos++]=1,this}bool(e){return this.ensureCapacity(1),this.buffer[this.pos++]=+!!e,this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){"string"!=typeof e&&(e=String(e));let t=e.length;if(t<=e_){this.ensureCapacity(t+1);let n=this.buffer,r=this.pos;n[r++]=t;let i=0;for(;i<t;i++){let t=e.charCodeAt(i);if(t>127)break;n[r++]=t}if(i==t)return this.pos=r,this}this.ensureCapacity(3*t+5);let n=ex(t),r=this.buffer,i=this.pos,{written:s}=this.encodeUtf8Into(e,r.subarray(i+n)),o=ex(s);return o!=n&&r.copyWithin(i+o,i+n,i+n+s),this.uint32(s),this.pos+=s,this}float(e){return function(e){if("string"==typeof e){let t=e;if(Number.isNaN(e=Number(e))&&"NaN"!==t)throw Error("invalid float32: "+t)}else if("number"!=typeof e)throw Error("invalid float32: "+typeof e);if(Number.isFinite(e)&&(e>34028234663852886e22||e<-34028234663852886e22))throw Error("invalid float32: "+e)}(e),this.ensureCapacity(4),this.view().setFloat32(this.pos,e,!0),this.pos+=4,this}double(e){return this.ensureCapacity(8),this.view().setFloat64(this.pos,e,!0),this.pos+=8,this}fixed32(e){return eR(e),this.ensureCapacity(4),this.view().setUint32(this.pos,e,!0),this.pos+=4,this}sfixed32(e){return eC(e),this.ensureCapacity(4),this.view().setInt32(this.pos,e,!0),this.pos+=4,this}sint32(e){return eC(e),this.uint32((e<<1^e>>31)>>>0)}sfixed64(e){let t=em.enc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}fixed64(e){let t=em.uEnc(e);this.ensureCapacity(8);let n=this.view();return n.setInt32(this.pos,t.lo,!0),n.setInt32(this.pos+4,t.hi,!0),this.pos+=8,this}int64(e){let t=em.enc(e);return this.writeVarint64(t.lo,t.hi)}sint64(e){let t=em.enc(e),n=t.hi>>31,r=t.lo<<1^n,i=(t.hi<<1|t.lo>>>31)^n;return this.writeVarint64(r,i)}uint64(e){let t=em.uEnc(e);return this.writeVarint64(t.lo,t.hi)}writeVarint64(e,t){this.ensureCapacity(10);let n=this.buffer,r=this.pos;for(let i=0;i<28;i+=7){let s=e>>>i,o=s>>>7!=0||0!=t;if(n[r++]=(o?128|s:s)&255,!o)return this.pos=r,this}let i=e>>>28&15|(7&t)<<4,s=t>>3!=0;if(n[r++]=(s?128|i:i)&255,!s)return this.pos=r,this;for(let e=3;e<31;e+=7){let i=t>>>e,s=i>>>7!=0;if(n[r++]=(s?128|i:i)&255,!s)return this.pos=r,this}return n[r++]=t>>>31&1,this.pos=r,this}}let eS=128,ew=1,eA=new Uint8Array(0),eI=new DataView(eA.buffer),e_=32;function ex(e){return e<128?1:e<16384?2:e<2097152?3:e<0x10000000?4:5}class eN{constructor(e,t=eE().decodeUtf8){this.decodeUtf8=t,this.varint64Lo=0,this.varint64Hi=0,this.varint64=el,this.uint32=ef,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}tag(){let e=this.pos,t=this.uint32(),n=this.pos-e;if(n>5||5==n&&this.buf[this.pos-1]>15)throw Error("illegal tag: varint overflows uint32");let r=t>>>3,i=7&t;if(r<=0||i>5)throw Error("illegal tag: field no "+r+" wire type "+i);return[r,i]}skip(e,t,n=100){let i=this.pos;switch(e){case r.Varint:for(;128&this.buf[this.pos++];);break;case r.Bit64:this.pos+=4;case r.Bit32:this.pos+=4;break;case r.LengthDelimited:let s=this.uint32();this.pos+=s;break;case r.StartGroup:if(n<=0)throw Error("maximum recursion depth reached");for(;;){let[e,i]=this.tag();if(i===r.EndGroup){if(void 0!==t&&e!==t)throw Error("invalid end group tag");break}this.skip(i,e,n-1)}break;default:throw Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw RangeError("premature EOF")}int32(){return 0|this.uint32()}sint32(){let e=this.uint32();return e>>>1^-(1&e)}int64(){return this.varint64(),em.dec(this.varint64Lo,this.varint64Hi)}uint64(){return this.varint64(),em.uDec(this.varint64Lo,this.varint64Hi)}sint64(){this.varint64();let e=this.varint64Lo,t=this.varint64Hi,n=-(1&e);return e=(e>>>1|(1&t)<<31)^n,t=t>>>1^n,em.dec(e,t)}bool(){let e=this.buf[this.pos];return e<128?(this.pos++,0!==e):(this.varint64(),0!==this.varint64Lo||0!==this.varint64Hi)}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return em.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return em.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),t=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(t,t+e)}string(e){let t=this.bytes(),n=t.length;if(n<=e_){let r=Array(n);for(let i=0;i<n;i++){let n=t[i];if(n>127)return this.decodeUtf8(t,e);r[i]=n}return String.fromCharCode.apply(String,r)}return this.decodeUtf8(t,e)}}function eC(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw Error("invalid int32: "+typeof e);if(!Number.isInteger(e)||e>0x7fffffff||e<-0x80000000)throw Error("invalid int32: "+e)}function eR(e){if("string"==typeof e)e=Number(e);else if("number"!=typeof e)throw Error("invalid uint32: "+typeof e);if(!Number.isInteger(e)||e>0xffffffff||e<0)throw Error("invalid uint32: "+e)}let eO=function(e){return e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function eL(){return{fields:{}}}let eP={encode:(e,t=new ek)=>
1(Object.entries(e.fields).forEach(([e,n])=>{void 0!==n&&ej.encode({key:e,value:n},t.uint32(10).fork()).join()}),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eL();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:{if(10!==e)break;let t=ej.decode(n,n.uint32());void 0!==t.value&&(i.fields[t.key]=t.value);continue}}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>eP.fromPartial(e??{}),fromPartial(e){let t=eL();return t.fields=Object.entries(e.fields??{}).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),t},wrap(e){let t=eL();if(void 0!==e)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function eM(){return{key:"",value:void 0}}let ej={encode:(e,t=new ek)=>(""!==e.key&&t.uint32(10).string(e.key),void 0!==e.value&&e$.encode(e$.wrap(e.value),t.uint32(18).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eM();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.key=n.string();continue;case 2:if(18!==e)break;i.value=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>ej.fromPartial(e??{}),fromPartial(e){let t=eM();return t.key=e.key??"",t.value=e.value??void 0,t}};function eD(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}let e$={encode:(e,t=new ek)=>(void 0!==e.nullValue&&t.uint32(8).int32(e.nullValue),void 0!==e.numberValue&&t.uint32(17).double(e.numberValue),void 0!==e.stringValue&&t.uint32(26).string(e.stringValue),void 0!==e.boolValue&&t.uint32(32).bool(e.boolValue),void 0!==e.structValue&&eP.encode(eP.wrap(e.structValue),t.uint32(42).fork()).join(),void 0!==e.listValue&&eU.encode(eU.wrap(e.listValue),t.uint32(50).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eD();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;i.nullValue=n.int32();continue;case 2:if(17!==e)break;i.numberValue=n.double();continue;case 3:if(26!==e)break;
1i.stringValue=n.string();continue;case 4:if(32!==e)break;i.boolValue=n.bool();continue;case 5:if(42!==e)break;i.structValue=eP.unwrap(eP.decode(n,n.uint32()));continue;case 6:if(50!==e)break;i.listValue=eU.unwrap(eU.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>e$.fromPartial(e??{}),fromPartial(e){let t=eD();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=eD();if(null===e)t.nullValue=eO.NULL_VALUE;else if("boolean"==typeof e)t.boolValue=e;else if("number"==typeof e)t.numberValue=e;else if("string"==typeof e)t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if("object"==typeof e)t.structValue=e;else if(void 0!==e)throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(void 0!==e.stringValue)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;else if(e?.nullValue!==void 0)return null}};function eB(){return{values:[]}}let eU={encode(e,t=new ek){for(let n of e.values)e$.encode(e$.wrap(n),t.uint32(10).fork()).join();return t},decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eB();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.values.push(e$.unwrap(e$.decode(n,n.uint32())));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>eU.fromPartial(e??{}),fromPartial(e){let t=eB();return t.values=e.values?.map(e=>e)||[],t},wrap(e){let t=eB();return t.values=e??[],t},unwrap:e=>e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e},eG=function(e){return e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.REPLACE=2]="REPLACE",e[e.MOVE=3]="MOVE",e[e.COPY=4]="COPY",e[e.TEST=5]="TEST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function ez(){return{op:0,path:"",from:void 0,value:void 0}}let eY={encode:(e,t=new ek)=>(0!==e.op&&t.uint32(8).int32(e.op),""!==e.path&&t.uint32(18).string(e.path),void 0!==e.from&&t.uint32(26).string(e.from),void 0!==e.value&&e$.encode(e$.wrap(e.value),t.uint32(34).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=ez();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;i.op=n.int32();continue;case 2:if(18!==e)break;i.path=n.string();continue;case 3:if(26!==e)break;i.from=n.string();continue;case 4:if(34!==e)break;i.value=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>eY.fromPartial(e??{}),fromPartial(e){let t=ez();return t.op=e.op??0,t.path=e.path??"",t.from=e.from??void 0,t.value=e.value??void 0,t}};function eH(){return{id:"",type:"",function:void 0}}let eF={encode:(e,t=new ek)=>(""!==e.id&&t.uint32(10).string(e.id),""!==e.type&&t.uint32(18).string(e.type),void 0!==e.function&&eZ.encode(e.function,t.uint32(26).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eH();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=n.string();continue;case 2:if(18!==e)break;i.type=n.string();continue;case 3:if(26!==e)break;i.function=eZ.decode(n,n.uint32());continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>eF.fromPartial(e??{}),fromPartial(e){let t=eH();return t.id=e.id??"",t.type=e.type??"",t.function=void 0!==e.function&&null!==e.function?eZ.fromPartial(e.function):void 0,t}};function eV(){return{name:"",arguments:""}}let eZ={encode:(e,t=new ek)=>(""!==e.name&&t.uint32(10).string(e.name),""!==e.arguments&&t.uint32(18).string(e.arguments),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eV();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.name=n.string();continue;case 2:if(18!==e)break;i.arguments=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>eZ.fromPartial(e??{}),fromPartial(e){let t=eV();return t.name=e.name??"",t.arguments=e.arguments??"",t}};function eX(){return{value:"",mimeType:""}}let eK={encode:(e,t=new ek)=>(""!==e.value&&t.uint32(10).string(e.value),""!==e.mimeType&&t.uint32(18).string(e.mimeType),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eX();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.value=n.string();continue;case 2:if(18!==e)break;i.mimeType=n.string();continue}if((7&e)==4||0===e)break;
1n.skip(7&e)}return i},create:e=>eK.fromPartial(e??{}),fromPartial(e){let t=eX();return t.value=e.value??"",t.mimeType=e.mimeType??"",t}};function eq(){return{value:"",mimeType:void 0}}let eW={encode:(e,t=new ek)=>(""!==e.value&&t.uint32(10).string(e.value),void 0!==e.mimeType&&t.uint32(18).string(e.mimeType),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eq();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.value=n.string();continue;case 2:if(18!==e)break;i.mimeType=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>eW.fromPartial(e??{}),fromPartial(e){let t=eq();return t.value=e.value??"",t.mimeType=e.mimeType??void 0,t}};function eJ(){return{data:void 0,url:void 0}}let eQ={encode:(e,t=new ek)=>(void 0!==e.data&&eK.encode(e.data,t.uint32(10).fork()).join(),void 0!==e.url&&eW.encode(e.url,t.uint32(18).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=eJ();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.data=eK.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.url=eW.decode(n,n.uint32());continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>eQ.fromPartial(e??{}),fromPartial(e){let t=eJ();return t.data=void 0!==e.data&&null!==e.data?eK.fromPartial(e.data):void 0,t.url=void 0!==e.url&&null!==e.url?eW.fromPartial(e.url):void 0,t}},e0={encode:(e,t=new ek)=>(""!==e.text&&t.uint32(10).string(e.text),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i={text:""};for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.text=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>e0.fromPartial(e??{}),fromPartial(e){let t={text:""};return t.text=e.text??"",t}};function e1(){return{source:void 0,metadata:void 0}}let e3={encode:(e,t=new ek)=>(void 0!==e.source&&eQ.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&e$.encode(e$.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=e1();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=eQ.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>e3.fromPartial(e??{}),fromPartial(e){let t=e1();return t.source=void 0!==e.source&&null!==e.source?eQ.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function e2(){return{source:void 0,metadata:void 0}}let e4={encode:(e,t=new ek)=>(void 0!==e.source&&eQ.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&e$.encode(e$.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=e2();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=eQ.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>e4.fromPartial(e??{}),fromPartial(e){let t=e2();return t.source=void 0!==e.source&&null!==e.source?eQ.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function e6(){return{source:void 0,metadata:void 0}}let e5={encode:(e,t=new ek)=>(void 0!==e.source&&eQ.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&e$.encode(e$.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=e6();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=eQ.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>e5.fromPartial(e??{}),fromPartial(e){let t=e6();return t.source=void 0!==e.source&&null!==e.source?eQ.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function e8(){return{source:void 0,metadata:void 0}}let e7={encode:(e,t=new ek)=>(void 0!==e.source&&eQ.encode(e.source,t.uint32(10).fork()).join(),void 0!==e.metadata&&e$.encode(e$.wrap(e.metadata),t.uint32(18).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=e8();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.source=eQ.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.metadata=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;
1n.skip(7&e)}return i},create:e=>e7.fromPartial(e??{}),fromPartial(e){let t=e8();return t.source=void 0!==e.source&&null!==e.source?eQ.fromPartial(e.source):void 0,t.metadata=e.metadata??void 0,t}};function e9(){return{text:void 0,image:void 0,audio:void 0,video:void 0,document:void 0}}let te={encode:(e,t=new ek)=>(void 0!==e.text&&e0.encode(e.text,t.uint32(10).fork()).join(),void 0!==e.image&&e3.encode(e.image,t.uint32(18).fork()).join(),void 0!==e.audio&&e4.encode(e.audio,t.uint32(26).fork()).join(),void 0!==e.video&&e5.encode(e.video,t.uint32(34).fork()).join(),void 0!==e.document&&e7.encode(e.document,t.uint32(42).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=e9();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.text=e0.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.image=e3.decode(n,n.uint32());continue;case 3:if(26!==e)break;i.audio=e4.decode(n,n.uint32());continue;case 4:if(34!==e)break;i.video=e5.decode(n,n.uint32());continue;case 5:if(42!==e)break;i.document=e7.decode(n,n.uint32());continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>te.fromPartial(e??{}),fromPartial(e){let t=e9();return t.text=void 0!==e.text&&null!==e.text?e0.fromPartial(e.text):void 0,t.image=void 0!==e.image&&null!==e.image?e3.fromPartial(e.image):void 0,t.audio=void 0!==e.audio&&null!==e.audio?e4.fromPartial(e.audio):void 0,t.video=void 0!==e.video&&null!==e.video?e5.fromPartial(e.video):void 0,t.document=void 0!==e.document&&null!==e.document?e7.fromPartial(e.document):void 0,t}};function tt(){return{id:"",role:"",content:void 0,name:void 0,toolCalls:[],toolCallId:void 0,error:void 0,contentParts:[]}}let tn={encode(e,t=new ek){for(let n of(""!==e.id&&t.uint32(10).string(e.id),""!==e.role&&t.uint32(18).string(e.role),void 0!==e.content&&t.uint32(26).string(e.content),void 0!==e.name&&t.uint32(34).string(e.name),e.toolCalls))eF.encode(n,t.uint32(42).fork()).join();for(let n of(void 0!==e.toolCallId&&t.uint32(50).string(e.toolCallId),void 0!==e.error&&t.uint32(58).string(e.error),e.contentParts))te.encode(n,t.uint32(66).fork()).join();return t},decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tt();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=n.string();continue;case 2:if(18!==e)break;i.role=n.string();continue;case 3:if(26!==e)break;i.content=n.string();continue;case 4:if(34!==e)break;i.name=n.string();continue;case 5:if(42!==e)break;i.toolCalls.push(eF.decode(n,n.uint32()));continue;case 6:if(50!==e)break;i.toolCallId=n.string();continue;case 7:if(58!==e)break;i.error=n.string();continue;case 8:if(66!==e)break;i.contentParts.push(te.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tn.fromPartial(e??{}),fromPartial(e){let t=tt();return t.id=e.id??"",t.role=e.role??"",t.content=e.content??void 0,t.name=e.name??void 0,t.toolCalls=e.toolCalls?.map(e=>eF.fromPartial(e))||[],t.toolCallId=e.toolCallId??void 0,t.error=e.error??void 0,t.contentParts=e.contentParts?.map(e=>te.fromPartial(e))||[],t}};function tr(){return{id:"",reason:"",message:void 0,toolCallId:void 0,responseSchema:void 0,expiresAt:void 0,metadata:void 0}}let ti={encode:(e,t=new ek)=>(""!==e.id&&t.uint32(10).string(e.id),""!==e.reason&&t.uint32(18).string(e.reason),void 0!==e.message&&t.uint32(26).string(e.message),void 0!==e.toolCallId&&t.uint32(34).string(e.toolCallId),void 0!==e.responseSchema&&e$.encode(e$.wrap(e.responseSchema),t.uint32(42).fork()).join(),void 0!==e.expiresAt&&t.uint32(50).string(e.expiresAt),void 0!==e.metadata&&e$.encode(e$.wrap(e.metadata),t.uint32(58).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tr();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.id=n.string();continue;case 2:if(18!==e)break;i.reason=n.string();continue;case 3:if(26!==e)break;i.message=n.string();continue;case 4:if(34!==e)break;i.toolCallId=n.string();continue;case 5:if(42!==e)break;i.responseSchema=e$.unwrap(e$.decode(n,n.uint32()));continue;case 6:if(50!==e)break;i.expiresAt=n.string();continue;case 7:if(58!==e)break;i.metadata=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;
1n.skip(7&e)}return i},create:e=>ti.fromPartial(e??{}),fromPartial(e){let t=tr();return t.id=e.id??"",t.reason=e.reason??"",t.message=e.message??void 0,t.toolCallId=e.toolCallId??void 0,t.responseSchema=e.responseSchema??void 0,t.expiresAt=e.expiresAt??void 0,t.metadata=e.metadata??void 0,t}},ts=function(e){return e[e.TEXT_MESSAGE_START=0]="TEXT_MESSAGE_START",e[e.TEXT_MESSAGE_CONTENT=1]="TEXT_MESSAGE_CONTENT",e[e.TEXT_MESSAGE_END=2]="TEXT_MESSAGE_END",e[e.TOOL_CALL_START=3]="TOOL_CALL_START",e[e.TOOL_CALL_ARGS=4]="TOOL_CALL_ARGS",e[e.TOOL_CALL_END=5]="TOOL_CALL_END",e[e.STATE_SNAPSHOT=6]="STATE_SNAPSHOT",e[e.STATE_DELTA=7]="STATE_DELTA",e[e.MESSAGES_SNAPSHOT=8]="MESSAGES_SNAPSHOT",e[e.RAW=9]="RAW",e[e.CUSTOM=10]="CUSTOM",e[e.RUN_STARTED=11]="RUN_STARTED",e[e.RUN_FINISHED=12]="RUN_FINISHED",e[e.RUN_ERROR=13]="RUN_ERROR",e[e.STEP_STARTED=14]="STEP_STARTED",e[e.STEP_FINISHED=15]="STEP_FINISHED",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e}({});function to(){return{type:0,timestamp:void 0,rawEvent:void 0}}let ta={encode:(e,t=new ek)=>(0!==e.type&&t.uint32(8).int32(e.type),void 0!==e.timestamp&&t.uint32(16).int64(e.timestamp),void 0!==e.rawEvent&&e$.encode(e$.wrap(e.rawEvent),t.uint32(26).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=to();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(8!==e)break;i.type=n.int32();continue;case 2:if(16!==e)break;i.timestamp=function(e){let t=globalThis.Number(e.toString());if(t>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(t<globalThis.Number.MIN_SAFE_INTEGER)throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");return t}(n.int64());continue;case 3:if(26!==e)break;i.rawEvent=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>ta.fromPartial(e??{}),fromPartial(e){let t=to();return t.type=e.type??0,t.timestamp=e.timestamp??void 0,t.rawEvent=e.rawEvent??void 0,t}};function tl(){return{baseEvent:void 0,messageId:"",role:void 0,name:void 0}}let tu={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.messageId&&t.uint32(18).string(e.messageId),void 0!==e.role&&t.uint32(26).string(e.role),void 0!==e.name&&t.uint32(34).string(e.name),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tl();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue;case 3:if(26!==e)break;i.role=n.string();continue;case 4:if(34!==e)break;i.name=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tu.fromPartial(e??{}),fromPartial(e){let t=tl();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.role=e.role??void 0,t.name=e.name??void 0,t}};function tc(){return{baseEvent:void 0,messageId:"",delta:""}}let td={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.messageId&&t.uint32(18).string(e.messageId),""!==e.delta&&t.uint32(26).string(e.delta),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tc();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue;case 3:if(26!==e)break;i.delta=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>td.fromPartial(e??{}),fromPartial(e){let t=tc();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t.delta=e.delta??"",t}};function th(){return{baseEvent:void 0,messageId:""}}let tp={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.messageId&&t.uint32(18).string(e.messageId),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=th();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue}if((7&e)==4||0===e)break;
1n.skip(7&e)}return i},create:e=>tp.fromPartial(e??{}),fromPartial(e){let t=th();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??"",t}};function tf(){return{baseEvent:void 0,toolCallId:"",toolCallName:"",parentMessageId:void 0}}let tg={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.toolCallId&&t.uint32(18).string(e.toolCallId),""!==e.toolCallName&&t.uint32(26).string(e.toolCallName),void 0!==e.parentMessageId&&t.uint32(34).string(e.parentMessageId),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tf();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue;case 3:if(26!==e)break;i.toolCallName=n.string();continue;case 4:if(34!==e)break;i.parentMessageId=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tg.fromPartial(e??{}),fromPartial(e){let t=tf();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.toolCallName=e.toolCallName??"",t.parentMessageId=e.parentMessageId??void 0,t}};function tm(){return{baseEvent:void 0,toolCallId:"",delta:""}}let tv={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.toolCallId&&t.uint32(18).string(e.toolCallId),""!==e.delta&&t.uint32(26).string(e.delta),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tm();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue;case 3:if(26!==e)break;i.delta=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tv.fromPartial(e??{}),fromPartial(e){let t=tm();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t.delta=e.delta??"",t}};function tb(){return{baseEvent:void 0,toolCallId:""}}let ty={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.toolCallId&&t.uint32(18).string(e.toolCallId),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tb();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>ty.fromPartial(e??{}),fromPartial(e){let t=tb();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??"",t}};function tE(){return{baseEvent:void 0,snapshot:void 0}}let tT={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.snapshot&&e$.encode(e$.wrap(e.snapshot),t.uint32(18).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tE();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.snapshot=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tT.fromPartial(e??{}),fromPartial(e){let t=tE();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.snapshot=e.snapshot??void 0,t}};function tk(){return{baseEvent:void 0,delta:[]}}let tS={encode(e,t=new ek){for(let n of(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),e.delta))eY.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tk();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.delta.push(eY.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tS.fromPartial(e??{}),fromPartial(e){let t=tk();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.delta=e.delta?.map(e=>eY.fromPartial(e))||[],t}};function tw(){return{baseEvent:void 0,messages:[]}}let tA={encode(e,t=new ek){for(let n of(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),e.messages))tn.encode(n,t.uint32(18).fork()).join();return t},decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tw();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messages.push(tn.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;
1n.skip(7&e)}return i},create:e=>tA.fromPartial(e??{}),fromPartial(e){let t=tw();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.messages=e.messages?.map(e=>tn.fromPartial(e))||[],t}};function tI(){return{baseEvent:void 0,event:void 0,source:void 0}}let t_={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.event&&e$.encode(e$.wrap(e.event),t.uint32(18).fork()).join(),void 0!==e.source&&t.uint32(26).string(e.source),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tI();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.event=e$.unwrap(e$.decode(n,n.uint32()));continue;case 3:if(26!==e)break;i.source=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>t_.fromPartial(e??{}),fromPartial(e){let t=tI();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.event=e.event??void 0,t.source=e.source??void 0,t}};function tx(){return{baseEvent:void 0,name:"",value:void 0}}let tN={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.name&&t.uint32(18).string(e.name),void 0!==e.value&&e$.encode(e$.wrap(e.value),t.uint32(26).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tx();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.name=n.string();continue;case 3:if(26!==e)break;i.value=e$.unwrap(e$.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tN.fromPartial(e??{}),fromPartial(e){let t=tx();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.name=e.name??"",t.value=e.value??void 0,t}};function tC(){return{baseEvent:void 0,threadId:"",runId:""}}let tR={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.threadId&&t.uint32(18).string(e.threadId),""!==e.runId&&t.uint32(26).string(e.runId),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tC();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.threadId=n.string();continue;case 3:if(26!==e)break;i.runId=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tR.fromPartial(e??{}),fromPartial(e){let t=tC();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t}};function tO(){return{baseEvent:void 0,threadId:"",runId:"",result:void 0,outcome:"",interrupts:[]}}let tL={encode(e,t=new ek){for(let n of(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.threadId&&t.uint32(18).string(e.threadId),""!==e.runId&&t.uint32(26).string(e.runId),void 0!==e.result&&e$.encode(e$.wrap(e.result),t.uint32(34).fork()).join(),""!==e.outcome&&t.uint32(42).string(e.outcome),e.interrupts))ti.encode(n,t.uint32(50).fork()).join();return t},decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tO();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.threadId=n.string();continue;case 3:if(26!==e)break;i.runId=n.string();continue;case 4:if(34!==e)break;i.result=e$.unwrap(e$.decode(n,n.uint32()));continue;case 5:if(42!==e)break;i.outcome=n.string();continue;case 6:if(50!==e)break;i.interrupts.push(ti.decode(n,n.uint32()));continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tL.fromPartial(e??{}),fromPartial(e){let t=tO();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.threadId=e.threadId??"",t.runId=e.runId??"",t.result=e.result??void 0,t.outcome=e.outcome??"",t.interrupts=e.interrupts?.map(e=>ti.fromPartial(e))||[],t}};function tP(){return{baseEvent:void 0,code:void 0,message:""}}let tM={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.code&&t.uint32(18).string(e.code),""!==e.message&&t.uint32(26).string(e.message),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tP();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.code=n.string();continue;case 3:if(26!==e)break;i.message=n.string();continue}if((7&e)==4||0===e)break;
1n.skip(7&e)}return i},create:e=>tM.fromPartial(e??{}),fromPartial(e){let t=tP();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.code=e.code??void 0,t.message=e.message??"",t}};function tj(){return{baseEvent:void 0,stepName:""}}let tD={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.stepName&&t.uint32(18).string(e.stepName),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tj();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.stepName=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tD.fromPartial(e??{}),fromPartial(e){let t=tj();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function t$(){return{baseEvent:void 0,stepName:""}}let tB={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),""!==e.stepName&&t.uint32(18).string(e.stepName),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=t$();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.stepName=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tB.fromPartial(e??{}),fromPartial(e){let t=t$();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.stepName=e.stepName??"",t}};function tU(){return{baseEvent:void 0,messageId:void 0,role:void 0,delta:void 0,name:void 0}}let tG={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.messageId&&t.uint32(18).string(e.messageId),void 0!==e.role&&t.uint32(26).string(e.role),void 0!==e.delta&&t.uint32(34).string(e.delta),void 0!==e.name&&t.uint32(42).string(e.name),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tU();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.messageId=n.string();continue;case 3:if(26!==e)break;i.role=n.string();continue;case 4:if(34!==e)break;i.delta=n.string();continue;case 5:if(42!==e)break;i.name=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tG.fromPartial(e??{}),fromPartial(e){let t=tU();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.messageId=e.messageId??void 0,t.role=e.role??void 0,t.delta=e.delta??void 0,t.name=e.name??void 0,t}};function tz(){return{baseEvent:void 0,toolCallId:void 0,toolCallName:void 0,parentMessageId:void 0,delta:void 0}}let tY={encode:(e,t=new ek)=>(void 0!==e.baseEvent&&ta.encode(e.baseEvent,t.uint32(10).fork()).join(),void 0!==e.toolCallId&&t.uint32(18).string(e.toolCallId),void 0!==e.toolCallName&&t.uint32(26).string(e.toolCallName),void 0!==e.parentMessageId&&t.uint32(34).string(e.parentMessageId),void 0!==e.delta&&t.uint32(42).string(e.delta),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tz();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.baseEvent=ta.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.toolCallId=n.string();continue;case 3:if(26!==e)break;i.toolCallName=n.string();continue;case 4:if(34!==e)break;i.parentMessageId=n.string();continue;case 5:if(42!==e)break;i.delta=n.string();continue}if((7&e)==4||0===e)break;n.skip(7&e)}return i},create:e=>tY.fromPartial(e??{}),fromPartial(e){let t=tz();return t.baseEvent=void 0!==e.baseEvent&&null!==e.baseEvent?ta.fromPartial(e.baseEvent):void 0,t.toolCallId=e.toolCallId??void 0,t.toolCallName=e.toolCallName??void 0,t.parentMessageId=e.parentMessageId??void 0,t.delta=e.delta??void 0,t}};function tH(){return{textMessageStart:void 0,textMessageContent:void 0,textMessageEnd:void 0,toolCallStart:void 0,toolCallArgs:void 0,toolCallEnd:void 0,stateSnapshot:void 0,stateDelta:void 0,messagesSnapshot:void 0,raw:void 0,custom:void 0,runStarted:void 0,runFinished:void 0,runError:void 0,stepStarted:void 0,stepFinished:void 0,textMessageChunk:void 0,toolCallChunk:void 0}}let tF={encode:(e,t=new ek)=>(void 0!==e.textMessageStart&&tu.encode(e.textMessageStart,t.uint32(10).fork()).join(),void 0!==e.textMessageContent&&td.encode(e.textMessageContent,t.uint32(18).fork()).join(),void 0!==e.textMessageEnd&&tp.encode(e.textMessageEnd,t.uint32(26).fork()).join(),void 0!==e.toolCallStart&&tg.encode(e.toolCallStart,t.uint32(34).fork()).join(),void 0!==e.toolCallArgs&&tv.encode(e.toolCallArgs,t.uint32(42).fork()).join(),void 0!==e.toolCallEnd&&ty.encode(e.toolCallEnd,t.uint32(50).fork()).join(),void 0!==e.stateSnapshot&&tT.encode(e.stateSnapshot,t.uint32(58).fork()).join(),void 0!==e.stateDelta&&tS.encode(e.stateDelta,t.uint32(66).fork()).join(),void 0!==e.messagesSnapshot&&tA.encode(e.messagesSnapshot,t.uint32(74).fork()).join(),void 0!==e.raw&&t_.encode(e.raw,t.uint32(82).fork()).join(),void 0!==e.custom&&tN.encode(e.custom,t.uint32(90).fork()).join(),void 0!==e.runStarted&&tR.encode(e.runStarted,t.uint32(98).fork()).join(),void 0!==e.runFinished&&tL.encode(e.runFinished,t.uint32(106).fork()).join(),void 0!==e.runError&&tM.encode(e.runError,t.uint32(114).fork()).join(),void 0!==e.stepStarted&&tD.encode(e.stepStarted,t.uint32(122).fork()).join(),void 0!==e.stepFinished&&tB.encode(e.stepFinished,t.uint32(130).fork()).join(),void 0!==e.textMessageChunk&&tG.encode(e.textMessageChunk,t.uint32(138).fork()).join(),void 0!==e.toolCallChunk&&tY.encode(e.toolCallChunk,t.uint32(146).fork()).join(),t),decode(e,t){let n=e instanceof eN?e:new eN(e),r=void 0===t?n.len:n.pos+t,i=tH();for(;n.pos<r;){let e=n.uint32();switch(e>>>3){case 1:if(10!==e)break;i.textMessageStart=tu.decode(n,n.uint32());continue;case 2:if(18!==e)break;i.textMessageContent=td.decode(n,n.uint32());continue;case 3:if(26!==e)break;i.textMessageEnd=tp.decode(n,n.uint32());continue;case 4:if(34!==e)break;i.toolCallStart=tg.decode(n,n.uint32());continue;case 5:if(42!==e)break;i.toolCallArgs=tv.decode(n,n.uint32());continue;case 6:if(50!==e)break;i.toolCallEnd=ty.decode(n,n.uint32());continue;case 7:if(58!==e)break;i.stateSnapshot=tT.decode(n,n.uint32());continue;case 8:if(66!==e)break;i.stateDelta=tS.decode(n,n.uint32());continue;case 9:if(74!==e)break;i.messagesSnapshot=tA.decode(n,n.uint32());continue;case 10:if(82!==e)break;i.raw=t_.decode(n,n.uint32());continue;case 11:if(90!==e)break;i.custom=tN.decode(n,n.uint32());continue;case 12:if(98!==e)break;i.runStarted=tR.decode(n,n.uint32());continue;case 13:if(106!==e)break;i.runFinished=tL.decode(n,n.uint32());continue;case 14:if(114!==e)break;i.runError=tM.decode(n,n.uint32());continue;case 15:if(122!==e)break;i.stepStarted=tD.decode(n,n.uint32());continue;case 16:if(130!==e)break;i.stepFinished=tB.decode(n,n.uint32());continue;case 17:if(138!==e)break;i.textMessageChunk=tG.decode(n,n.uint32());continue;case 18:if(146!==e)break;i.toolCallChunk=tY.decode(n,n.uint32());continue}if((7&e)==4||0===e)break;
1n.skip(7&e)}return i},create:e=>tF.fromPartial(e??{}),fromPartial(e){let t=tH();return t.textMessageStart=void 0!==e.textMessageStart&&null!==e.textMessageStart?tu.fromPartial(e.textMessageStart):void 0,t.textMessageContent=void 0!==e.textMessageContent&&null!==e.textMessageContent?td.fromPartial(e.textMessageContent):void 0,t.textMessageEnd=void 0!==e.textMessageEnd&&null!==e.textMessageEnd?tp.fromPartial(e.textMessageEnd):void 0,t.toolCallStart=void 0!==e.toolCallStart&&null!==e.toolCallStart?tg.fromPartial(e.toolCallStart):void 0,t.toolCallArgs=void 0!==e.toolCallArgs&&null!==e.toolCallArgs?tv.fromPartial(e.toolCallArgs):void 0,t.toolCallEnd=void 0!==e.toolCallEnd&&null!==e.toolCallEnd?ty.fromPartial(e.toolCallEnd):void 0,t.stateSnapshot=void 0!==e.stateSnapshot&&null!==e.stateSnapshot?tT.fromPartial(e.stateSnapshot):void 0,t.stateDelta=void 0!==e.stateDelta&&null!==e.stateDelta?tS.fromPartial(e.stateDelta):void 0,t.messagesSnapshot=void 0!==e.messagesSnapshot&&null!==e.messagesSnapshot?tA.fromPartial(e.messagesSnapshot):void 0,t.raw=void 0!==e.raw&&null!==e.raw?t_.fromPartial(e.raw):void 0,t.custom=void 0!==e.custom&&null!==e.custom?tN.fromPartial(e.custom):void 0,t.runStarted=void 0!==e.runStarted&&null!==e.runStarted?tR.fromPartial(e.runStarted):void 0,t.runFinished=void 0!==e.runFinished&&null!==e.runFinished?tL.fromPartial(e.runFinished):void 0,t.runError=void 0!==e.runError&&null!==e.runError?tM.fromPartial(e.runError):void 0,t.stepStarted=void 0!==e.stepStarted&&null!==e.stepStarted?tD.fromPartial(e.stepStarted):void 0,t.stepFinished=void 0!==e.stepFinished&&null!==e.stepFinished?tB.fromPartial(e.stepFinished):void 0,t.textMessageChunk=void 0!==e.textMessageChunk&&null!==e.textMessageChunk?tG.fromPartial(e.textMessageChunk):void 0,t.toolCallChunk=void 0!==e.toolCallChunk&&null!==e.toolCallChunk?tY.fromPartial(e.toolCallChunk):void 0,t}},tV=e=>{if(e&&"object"==typeof e){if(e.data)return{type:"data",value:e.data.value,mimeType:e.data.mimeType};if(e.url)return{type:"url",value:e.url.value,mimeType:e.url.mimeType}}},tZ=e=>{if(e&&"object"==typeof e){if(e.text)return{type:"text",text:e.text.text};if(e.image)return{type:"image",source:tV(e.image.source),metadata:e.image.metadata};if(e.audio)return{type:"audio",source:tV(e.audio.source),metadata:e.audio.metadata};if(e.video)return{type:"video",source:tV(e.video.source),metadata:e.video.metadata};if(e.document)return{type:"document",source:tV(e.document.source),metadata:e.document.metadata}}},tX="application/vnd.ag-ui.event+proto";var tK=n(44964);let tq=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,tW=e=>{if("string"!=typeof e)throw TypeError("Invalid argument expected string");let t=e.match(tq);
1if(!t)throw Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},tJ=e=>"*"===e||"x"===e||"X"===e,tQ=e=>{let t=parseInt(e,10);return isNaN(t)?e:t},t0=(e,t)=>{if(tJ(e)||tJ(t))return 0;let[n,r]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(tQ(e),tQ(t));return n>r?1:n<r?-1:0},t1=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){let r=t0(e[n]||"0",t[n]||"0");if(0!==r)return r}return 0},t3=(e,t)=>{let n=tW(e),r=tW(t),i=n.pop(),s=r.pop(),o=t1(n,r);return 0!==o?o:i&&s?t1(i.split("."),s.split(".")):i||s?i?-1:1:0};var t2=n(42922);let t4=e=>{if("function"==typeof structuredClone)return structuredClone(e);try{return JSON.parse(JSON.stringify(e))}catch{return Array.isArray(e)?[...e]:{...e}}};function t6(){return(0,o.A)()}function t5(e){if(Object.freeze(e),"object"==typeof e&&e)for(let t of Object.values(e))"object"==typeof t&&t&&!Object.isFrozen(t)&&t5(t);return e}function t8(e,t,n){let r=0,i=[e,t],s=new WeakSet;for(;i.length>0;){let e=i.pop();if("string"==typeof e){if((r+=e.length)>n)return!0}else if("object"==typeof e&&e){if(s.has(e))continue;if(s.add(e),Array.isArray(e))for(let t=0;t<e.length;t++)i.push(e[t]);else{let t=Object.keys(e);for(let s=0;s<t.length;s++){let o=t[s];if((r+=o.length)>n)return!0;i.push(e[o])}}}}return!1}async function t7(e,t,n,r){let i="u">typeof t2&&void 0!==t2.env,s=i&&!!t2.env.VITEST_WORKER_ID,o=i&&!!t2.env.VITEST_WORKER_ID,a=o&&!t8(t,n,524288),l=a?t4(t):t,u=a?t4(n):n,c=!1,d=!1,h;for(let t of e)try{a&&(t5(l),t5(u));let e=await r(t,l,u);if(void 0===e)continue;let n=!1;if(void 0!==e.messages&&e.messages!==l&&(l=t4(e.messages),c=!0,n=!0),void 0!==e.state&&e.state!==u&&(u=t4(e.state),d=!0,n=!0),a&&n&&t8(l,u,524288)&&(a=!1),h=e.stopPropagation,!0===h)break}catch(e){if(o&&e instanceof TypeError){if(s)throw e;console.error("AG-UI: Subscriber attempted to mutate frozen inputs in-place. Return mutations via AgentStateMutation instead of mutating directly.",e)}else s||console.error("Subscriber error:",e);continue}return{...c?{messages:Object.isFrozen(l)?t4(l):l}:{},...d?{state:Object.isFrozen(u)?t4(u):u}:{},...void 0===h?{}:{stopPropagation:h}}}function t9(e){if(!e)return{enabled:!1,events:!1,lifecycle:!1,verbose:!1};if(!0===e)return{enabled:!0,events:!0,lifecycle:!0,verbose:!0};let t=e.events??!0,n=e.lifecycle??!0;return{enabled:t||n,events:t,lifecycle:n,verbose:e.verbose??!1}}function ne(e){return e instanceof nt?e:!0===e?new nt(t9(!0)):void 0}var nt=class{constructor(e){this.config=e}event(e,t,n,r){this.config.events&&(this.config.verbose?console.debug(`[${e}] ${t}`,"string"==typeof n?n:JSON.stringify(n)):console.debug(`[${e}] ${t}`,r??n))}lifecycle(e,t,n){this.config.lifecycle&&(n?console.debug(`[${e}] ${t}`,n):console.debug(`[${e}] ${t}`))}get eventsEnabled(){return this.config.events}get lifecycleEnabled(){return this.config.lifecycle}get enabled(){return this.config.enabled}};function nn(e){return e.enabled?new nt(e):void 0}let nr=(e,t,n,r,i)=>{var s;let o=ne(i),l=t4(n.messages),u=t4(e.state),c={},d=e=>{void 0!==e.messages&&(l=e.messages,c.messages=e.messages),void 0!==e.state&&(u=e.state,c.state=e.state)},h=()=>{let e=t4(c);return c={},void 0!==e.messages||void 0!==e.state?(0,$.of)(e):B.w};return t.pipe(W(async t=>{let i=await t7(r,l,u,(r,i,s)=>r.onEvent?.({event:t,agent:n,input:e,messages:i,state:s}));if(d(i),!0===i.stopPropagation?o?.event("APPLY","Event dropped:",t,{type:t.type,reason:"stopPropagation by subscriber"}):o?.event("APPLY","Event applied:",t,{type:t.type,subscribers:r.length}),!0===i.stopPropagation)return h();switch(t.type){case a.Bx.TEXT_MESSAGE_START:{let i=await t7(r,l,u,(r,i,s)=>r.onTextMessageStartEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation){let{messageId:e,role:n="assistant",name:r}=t;if(!l.find(t=>t.id===e)){let t={id:e,role:n,content:"",...void 0!==r&&{name:r}};l.push(t),d({messages:l})}}return h()}case a.Bx.TEXT_MESSAGE_CONTENT:{let{messageId:i,delta:s}=t,o=l.find(e=>e.id===i);if(!o)return console.warn(`TEXT_MESSAGE_CONTENT: No message found with ID '${i}'`),h();let a=await t7(r,l,u,(r,i,s)=>r.onTextMessageContentEvent?.({event:t,messages:i,state:s,agent:n,input:e,textMessageBuffer:"string"==typeof o.content?o.content:""}));return d(a),!0!==a.stopPropagation&&(o.content=`${"string"==typeof o.content?o.content:""}${s}`,d({messages:l})),h()}case a.Bx.TEXT_MESSAGE_END:{let{messageId:i}
1=t,s=l.find(e=>e.id===i);return s?(d(await t7(r,l,u,(r,i,o)=>r.onTextMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,textMessageBuffer:"string"==typeof s.content?s.content:""}))),await Promise.all(r.map(t=>{t.onNewMessage?.({message:s,messages:l,state:u,agent:n,input:e})}))):console.warn(`TEXT_MESSAGE_END: No message found with ID '${i}'`),h()}case a.Bx.TOOL_CALL_START:{let i=await t7(r,l,u,(r,i,s)=>r.onToolCallStartEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation){let{toolCallId:e,toolCallName:n,parentMessageId:r}=t,i=function(e,t,n){if(t){let r=e.find(e=>e.id===t);if(r?.role==="assistant")return r;r&&console.warn(`TOOL_CALL_START: parentMessageId '${t}' matches a '${r.role}' message, not assistant â falling back to toolCallId`);let i={id:r?n:t,role:"assistant",toolCalls:[]};return e.push(i),i}let r={id:n,role:"assistant",toolCalls:[]};return e.push(r),r}(l,r,e);i.toolCalls??=[],i.toolCalls.push({id:e,type:"function",function:{name:n,arguments:""}}),d({messages:l})}return h()}case a.Bx.TOOL_CALL_ARGS:{let{toolCallId:i,delta:s}=t,o=l.find(e=>e.toolCalls?.some(e=>e.id===i));if(!o)return console.warn(`TOOL_CALL_ARGS: No message found containing tool call with ID '${i}'`),h();let a=o.toolCalls?.find(e=>e.id===i);if(!a)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${i}'`),h();let c=await t7(r,l,u,(r,i,s)=>{let o=a.function.arguments,l=a.function.name,u={};try{u=ea(o)}catch{}return r.onToolCallArgsEvent?.({event:t,messages:i,state:s,agent:n,input:e,toolCallBuffer:o,toolCallName:l,partialToolCallArgs:u})});return d(c),!0!==c.stopPropagation&&(a.function.arguments+=s,d({messages:l})),h()}case a.Bx.TOOL_CALL_END:{let{toolCallId:i}=t,s=l.find(e=>e.toolCalls?.some(e=>e.id===i));if(!s)return console.warn(`TOOL_CALL_END: No message found containing tool call with ID '${i}'`),h();let o=s.toolCalls?.find(e=>e.id===i);return o?(d(await t7(r,l,u,(r,i,s)=>{let a=o.function.arguments,l=o.function.name,u={};try{u=JSON.parse(a)}catch{}return r.onToolCallEndEvent?.({event:t,messages:i,state:s,agent:n,input:e,toolCallName:l,toolCallArgs:u})})),await Promise.all(r.map(t=>{t.onNewToolCall?.({toolCall:o,messages:l,state:u,agent:n,input:e})}))):console.warn(`TOOL_CALL_END: No tool call found with ID '${i}'`),h()}case a.Bx.TOOL_CALL_RESULT:{let i=await t7(r,l,u,(r,i,s)=>r.onToolCallResultEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation){let{messageId:i,toolCallId:s,content:o,role:a}=t,c={id:i,toolCallId:s,role:a||"tool",content:o},h=l.findIndex(e=>"assistant"===e.role&&e.toolCalls?.some(e=>e.id===s));if(-1===h)l.push(c);else{let e=h+1;for(;e<l.length&&"tool"===l[e].role;)e++;l.splice(e,0,c)}await Promise.all(r.map(t=>{t.onNewMessage?.({message:c,messages:l,state:u,agent:n,input:e})})),d({messages:l})}return h()}case a.Bx.STATE_SNAPSHOT:{let i=await t7(r,l,u,(r,i,s)=>r.onStateSnapshotEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation){let{snapshot:e}=t;d({state:u=e})}return h()}case a.Bx.STATE_DELTA:{let i=await t7(r,l,u,(r,i,s)=>r.onStateDeltaEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation){let{delta:e}=t;try{u=D.applyPatch(u,e,!0,!1).newDocument,d({state:u})}catch(n){let t=n instanceof Error?n.message:String(n);console.warn(`Failed to apply state patch: 2Current state: ${JSON.stringify(u,null,2)} 3Patch operations: ${JSON.stringify(e,null,2)} 4Error: ${t}`)}}return h()}case a.Bx.MESSAGES_SNAPSHOT:{let i=await t7(r,l,u,(r,i,s)=>r.onMessagesSnapshotEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation){let{messages:e}=t,n=new Map(e.map(e=>[e.id,e])),r=e.some(e=>"reasoning"===e.role),i=e=>"activity"===e.role||"reasoning"===e.role&&!r,s=new Set((l=l.filter(e=>i(e)||n.has(e.id)).map(e=>i(e)?e:n.get(e.id))).map(e=>e.id));for(let t of e)s.has(t.id)||l.push(t);d({messages:l})}return h()}case a.Bx.ACTIVITY_SNAPSHOT:{let i=l.findIndex(e=>e.id===t.messageId),s=i>=0?l[i]:void 0,o=s?.role==="activity"?s:void 0,a=t.replace??!0,c=await t7(r,l,u,(r,i,a)=>r.onActivitySnapshotEvent?.({event:t,messages:i,state:a,agent:n,input:e,activityMessage:o,existingMessage:s}));if(d(c),!0!==c.stopPropagation){let s={id:t.messageId,role:"activity",activityType:t.activityType,content:t4(t.content)},c;-1===i?(l.push(s),c=s):o?a&&(l[i]={...o,activityType:t.activityType,content:t4(t.content)}):a&&(l[i]=s,c=s),d({messages:l}),c&&await Promise.all(r.map(t=>t.onNewMessage?.({message:c,messages:l,state:u,agent:n,input:e})))}return h()}case a.Bx.ACTIVITY_DELTA:{let i=l.findIndex(e=>e.id===t.messageId);if(-1===i)return h();let s=l[i];if("activity"!==s.role)return console.warn(`ACTIVITY_DELTA: Message '${t.messageId}' is not an activity message`),h();let o=await t7(r,l,u,(r,i,o)=>r.onActivityDeltaEvent?.({event:t,messages:i,state:o,agent:n,input:e,activityMessage:s}));if(d(o),!0!==o.stopPropagation)try{let e=t4(s.content??{}),n=D.applyPatch(e,t.patch??[],!0,!1).newDocument;l[i]={...s,content:t4(n),activityType:t.activityType},d({messages:l})}catch(n){let e=n instanceof Error?n.message:String(n);console.warn(`Failed to apply activity patch for '${t.messageId}': ${e}`)}return h()}case a.Bx.RAW:return d(await t7(r,l,u,(r,i,s)=>r.onRawEvent?.({event:t,messages:i,state:s,agent:n,input:e}))),h();case a.Bx.CUSTOM:return d(await t7(r,l,u,(r,i,s)=>r.onCustomEvent?.({event:t,messages:i,state:s,agent:n,input:e}))),h();case a.Bx.RUN_STARTED:{let i=await t7(r,l,u,(r,i,s)=>r.onRunStartedEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation&&t.input?.messages){for(let e of t.input.messages)l.find(t=>
4t.id===e.id)||l.push(e);d({messages:l})}return h()}case a.Bx.RUN_FINISHED:{let i=t.outcome?.type==="interrupt"?{event:t,outcome:"interrupt",interrupts:t.outcome.interrupts}:{event:t,outcome:"success",result:t.result},s=await t7(r,l,u,(t,r,s)=>t.onRunFinishedEvent?.({...i,messages:r,state:s,agent:n,input:e}));return d(s),!0!==s.stopPropagation&&(n.pendingInterrupts="interrupt"===i.outcome?[...i.interrupts]:[]),h()}case a.Bx.RUN_ERROR:return d(await t7(r,l,u,(r,i,s)=>r.onRunErrorEvent?.({event:t,messages:i,state:s,agent:n,input:e}))),h();case a.Bx.STEP_STARTED:return d(await t7(r,l,u,(r,i,s)=>r.onStepStartedEvent?.({event:t,messages:i,state:s,agent:n,input:e}))),h();case a.Bx.STEP_FINISHED:return d(await t7(r,l,u,(r,i,s)=>r.onStepFinishedEvent?.({event:t,messages:i,state:s,agent:n,input:e}))),h();case a.Bx.TEXT_MESSAGE_CHUNK:throw Error("TEXT_MESSAGE_CHUNK must be tranformed before being applied");case a.Bx.TOOL_CALL_CHUNK:throw Error("TOOL_CALL_CHUNK must be tranformed before being applied");case a.Bx.THINKING_START:case a.Bx.THINKING_END:case a.Bx.THINKING_TEXT_MESSAGE_START:case a.Bx.THINKING_TEXT_MESSAGE_CONTENT:case a.Bx.THINKING_TEXT_MESSAGE_END:return h();case a.Bx.REASONING_START:return d(await t7(r,l,u,(r,i,s)=>r.onReasoningStartEvent?.({event:t,messages:i,state:s,agent:n,input:e}))),h();case a.Bx.REASONING_MESSAGE_START:{let i=await t7(r,l,u,(r,i,s)=>r.onReasoningMessageStartEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(i),!0!==i.stopPropagation){let{messageId:e}=t;l.find(t=>t.id===e)||(l.push({id:e,role:"reasoning",content:""}),d({messages:l}))}return h()}case a.Bx.REASONING_MESSAGE_CONTENT:{let{messageId:i,delta:s}=t,o=l.find(e=>e.id===i);if(!o)return console.warn(`REASONING_MESSAGE_CONTENT: No message found with ID '${i}'`),h();let a=await t7(r,l,u,(r,i,s)=>r.onReasoningMessageContentEvent?.({event:t,messages:i,state:s,agent:n,input:e,reasoningMessageBuffer:"string"==typeof o.content?o.content:""}));return d(a),!0!==a.stopPropagation&&(o.content=`${"string"==typeof o.content?o.content:""}${s}`,d({messages:l})),h()}case a.Bx.REASONING_MESSAGE_END:{let{messageId:i}=t,s=l.find(e=>e.id===i);return s?(d(await t7(r,l,u,(r,i,o)=>r.onReasoningMessageEndEvent?.({event:t,messages:i,state:o,agent:n,input:e,reasoningMessageBuffer:"string"==typeof s.content?s.content:""}))),await Promise.all(r.map(t=>{t.onNewMessage?.({message:s,messages:l,state:u,agent:n,input:e})}))):console.warn(`REASONING_MESSAGE_END: No message found with ID '${i}'`),h()}case a.Bx.REASONING_MESSAGE_CHUNK:throw Error("REASONING_MESSAGE_CHUNK must be transformed before being applied");case a.Bx.REASONING_END:return d(await t7(r,l,u,(r,i,s)=>r.onReasoningEndEvent?.({event:t,messages:i,state:s,agent:n,input:e}))),h();case a.Bx.REASONING_ENCRYPTED_VALUE:{let{subtype:i,entityId:s,encryptedValue:o}=t,a=await t7(r,l,u,(r,i,s)=>r.onReasoningEncryptedValueEvent?.({event:t,messages:i,state:s,agent:n,input:e}));if(d(a),!0!==a.stopPropagation){let e=!1;if("tool-call"===i){for(let t of l)if("assistant"===t.role&&t.toolCalls){let n=t.toolCalls.find(e=>e.id===s);if(n){n.encryptedValue=o,e=!0;break}}}else{let t=l.find(e=>e.id===s);t?.role!=="activity"&&t&&(t.encryptedValue=o,e=!0)}e&&(c.messages=l)}return h()}}return t.type,h()}),(0,J.U)(),r.length>0?(s={},(0,Q.N)(function(e,t){var n=!1;e.subscribe((0,ee._)(t,function(e){n=!0,t.next(e)},function(){n||t.next(s),t.complete()}))})):e=>e)},ni=e=>t=>{let n=ne(e),r=new Map,i=new Map,s=!1,o=!1,l=!1,u=new Map,c=!1,d=!1,h=!1;return t.pipe((0,V.Z)(e=>{let t=e.type;if(n?.event("VERIFY","Event:",e,{type:e.type}),o)return(0,U.$)(()=>new a.$e(`Cannot send event type '${t}': The run has already errored with 'RUN_ERROR'. No further events can be sent.`));if(s&&t!==a.Bx.RUN_ERROR&&t!==a.Bx.RUN_STARTED)return(0,U.$)(()=>new a.$e(`Cannot send event type '${t}': The run has already finished with 'RUN_FINISHED'. Start a new run with 'RUN_STARTED'.`));if(l){if(t===a.Bx.RUN_STARTED){if(h&&!s)return(0,U.$)(()=>new a.$e("Cannot send 'RUN_STARTED' while a run is still active. The previous run must be finished with 'RUN_FINISHED' before starting a new run."));s&&(r.clear(),i.clear(),u.clear(),c=!1,d=!1,s=!1,o=!1,h=!0)}}else if(l=!0,t!==a.Bx.RUN_STARTED&&t!==a.Bx.RUN_ERROR)return(0,U.$)(()=>new a.$e("First event must be 'RUN_STARTED'"));switch(t){case a.Bx.TEXT_MESSAGE_START:{let t=e.messageId;return r.has(t)?(0,U.$)(()=>new a.$e(`Cannot send 'TEXT_MESSAGE_START' event: A text message with ID '${t}' is already in progress. Complete it with 'TEXT_MESSAGE_END' first.`)):(r.set(t,!0),(0,$.of)(e))}case a.Bx.TEXT_MESSAGE_CONTENT:{let t=e.messageId;return r.has(t)?(0,$.of)(e):(0,U.$)(()=>new a.$e(`Cannot send 'TEXT_MESSAGE_CONTENT' event: No active text message found with ID '${t}'. Start a text message with 'TEXT_MESSAGE_START' first.`))}case a.Bx.TEXT_MESSAGE_END:{let t=e.messageId;return r.has(t)?(r.delete(t),(0,$.of)(e)):(0,U.$)(()=>new a.$e(`Cannot send 'TEXT_MESSAGE_END' event: No active text message found with ID '${t}'. A 'TEXT_MESSAGE_START' event must be sent first.`))}case a.Bx.TOOL_CALL_START:{let t=e.toolCallId;return i.has(t)?(0,U.$)(()=>new a.$e(`Cannot send 'TOOL_CALL_START' event: A tool call with ID '${t}' is already in progress. Complete it with 'TOOL_CALL_END' first.`)):(i.set(t,!0),(0,$.of)(e))}case a.Bx.TOOL_CALL_ARGS:{let t=e.toolCallId;return i.has(t)?(0,$.of)(e):(0,U.$)(()=>new a.$e(`Cannot send 'TOOL_CALL_ARGS' event: No active tool call found with ID '${t}'. Start a tool call with 'TOOL_CALL_START' first.`))}case a.Bx.TOOL_CALL_END:{let t=e.toolCallId;return i.has(t)?(i.delete(t),(0,$.of)(e)):(0,U.$)(()=>new a.$e(`Cannot send 'TOOL_CALL_END' event: No active tool call found with ID '${t}'. A 'TOOL_CALL_START' event must be sent first.`))}case a.Bx.STEP_STARTED:{let t=e.stepName;return u.has(t)?(0,U.$)(()=>new a.$e(`Step "${t}" is already active for 'STEP_STARTED'`)):(u.set(t,!0),(0,$.of)(e))}case a.Bx.STEP_FINISHED:{let t=e.stepName;return u.has(t)?(u.delete(t),(0,$.of)(e)):(0,U.$)(()=>new a.$e(`Cannot send 'STEP_FINISHED' for step "${t}" that was not started`))}case a.Bx.RUN_STARTED:return h=!0,(0,$.of)(e);case a.Bx.RUN_FINISHED:if(u.size>0){let e=Array.from(u.keys()).join(", ");return(0,U.$)(()=>new a.$e(`Cannot send 'RUN_FINISHED' while steps are still active: ${e}`))}if(r.size>0){let e=Array.from(r.keys()).join(", ");return(0,U.$)(()=>new a.$e(`Cannot send 'RUN_FINISHED' while text messages are still active: ${e}`))}if(i.size>0){let e=Array.from(i.keys()).join(", ");return(0,U.$)(()=>new a.$e(`Cannot send 'RUN_FINISHED' while tool calls are still active: ${e}`))}return s=!0,(0,$.of)(e);case a.Bx.RUN_ERROR:return o=!0,(0,$.of)(e);case a.Bx.CUSTOM:return(0,$.of)(e);case a.Bx.THINKING_TEXT_MESSAGE_START:return c?d?(0,U.$)(()=>new a.$e("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking message is already in progress. Complete it with 'THINKING_TEXT_MESSAGE_END' first.")):(d=!0,(0,$.of)(e)):(0,U.$)(()=>new a.$e("Cannot send 'THINKING_TEXT_MESSAGE_START' event: A thinking step is not in progress. Create one with 'THINKING_START' first."));case a.Bx.THINKING_TEXT_MESSAGE_CONTENT:return d?(0,$.of)(e):(0,U.$)(()=>new a.$e("Cannot send 'THINKING_TEXT_MESSAGE_CONTENT' event: No active thinking message found. Start a message with 'THINKING_TEXT_MESSAGE_START' first."));case a.Bx.THINKING_TEXT_MESSAGE_END:return d?(d=!1,(0,$.of)(e)):(0,U.$)(()=>new a.$e("Cannot send 'THINKING_TEXT_MESSAGE_END' event: No active thinking message found. A 'THINKING_TEXT_MESSAGE_START' event must be sent first."));case a.Bx.THINKING_START:return c?(0,U.$)(()=>new a.$e("Cannot send 'THINKING_START' event: A thinking step is already in progress. End it with 'THINKING_END' first.")):(c=!0,(0,$.of)(e));case a.Bx.THINKING_END:return c?(c=!1,(0,$.of)(e)):(0,U.$)(()=>new a.$e("Cannot send 'THINKING_END' event: No active thinking step found. A 'THINKING_START' event must be sent first."));default:return(0,$.of)(e)}}))},ns=function(e){return e.HEADERS="headers",e.DATA="data",e}({}),no=e=>(0,G.v)(()=>(0,z.H)(e())).pipe((0,et.n)(e=>{if(!e.ok){let t=e.headers.get("content-type")||"";return(0,z.H)(e.text()).pipe((0,V.Z)(n=>{let r=n;if(t.includes("application/json"))try{r=JSON.parse(n)}catch{}let i=Error(`HTTP ${e.status}: ${"string"==typeof r?r:JSON.stringify(r)}`);return i.status=e.status,i.payload=r,(0,U.$)(()=>i)}))}let t={type:ns.HEADERS,status:e.status,headers:e.headers},n=e.body?.getReader();return n?new Y.c(e=>(e.next(t),(async()=>{try{for(;;){let{done:t,value:r}=await n.read();if(t)break;let i={type:ns.DATA,data:r};e.next(i)}e.complete()}catch(t){e.error(t)}})(),()=>{n.cancel().catch(e=>{if(e?.name!=="AbortError")throw e})})):(0,U.$)(()=>Error("Failed to getReader() from response"))})),na=(e,t)=>{let n=ne(t),r=new H.B,i=new F.m,s=!1;return e.subscribe({next:e=>{if(i.next(e),e.type!==ns.HEADERS||s)s||r.error(Error("No headers event received before data events"));else{s=!0;let t=e.headers.get("content-type");n?.lifecycle("HTTP","Stream format detected:",{contentType:t,parser:t===tX?"protobuf":"sse"}),t===tX?(e=>{let t=new H.B,n=new Uint8Array;function r(){for(;n.length>=4;){let e=4+new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(n.length<e)break;try{let r=n.slice(4,e),i=function(e){let t=Object.values(tF.decode(e)).find(e=>void 0!==e);if(!t)throw Error("Invalid event");
4if(t.type=ts[t.baseEvent.type],t.timestamp=t.baseEvent.timestamp,t.rawEvent=t.baseEvent.rawEvent,delete t.baseEvent,t.type===a.Bx.MESSAGES_SNAPSHOT)for(let e of t.messages){if("user"===e.role&&Array.isArray(e.contentParts)){let t=e.contentParts.map(e=>tZ(e)).filter(e=>void 0!==e);t.length>0&&(e.content=t)}Array.isArray(e.contentParts)&&0===e.contentParts.length&&(e.contentParts=void 0),e.toolCalls?.length===0&&(e.toolCalls=void 0)}if(t.type===a.Bx.RUN_FINISHED){let e="string"==typeof t.outcome&&""!==t.outcome?t.outcome:void 0,n=Array.isArray(t.interrupts)?t.interrupts:[];delete t.interrupts,"interrupt"===e?t.outcome={type:"interrupt",interrupts:n}:"success"===e?t.outcome={type:"success"}:delete t.outcome}if(t.type===a.Bx.STATE_DELTA)for(let e of t.delta)e.op=eG[e.op].toLowerCase(),Object.keys(e).forEach(t=>{void 0===e[t]&&delete e[t]});return Object.keys(t).forEach(e=>{void 0===t[e]&&delete t[e]}),a.rV.parse(t)}(r);t.next(i),n=n.slice(e)}catch(n){let e=n instanceof Error?n.message:String(n);t.error(Error(`Failed to decode protocol buffer message: ${e}`));return}}}return e.subscribe({next:e=>{if(e.type!==ns.HEADERS&&e.type===ns.DATA&&e.data){let t=new Uint8Array(n.length+e.data.length);t.set(n,0),t.set(e.data,n.length),n=t,r()}},error:e=>t.error(e),complete:()=>{if(n.length>0)try{r()}catch{console.warn("Incomplete or invalid protocol buffer data at stream end")}t.complete()}}),t.asObservable()})(i).subscribe({next:e=>r.next(e),error:e=>r.error(e),complete:()=>r.complete()}):((e,t)=>{let n=ne(t),r=new H.B,i=new TextDecoder("utf-8",{fatal:!1}),s="";function o(e){let t=e.split(` 5`),i=[];for(let e of t)e.startsWith("data:")&&i.push(e.slice(5).replace(/^ /,""));if(i.length>0)try{let e=i.join(` 6`),t=JSON.parse(e);n?.event("SSE","Event received:",t,{type:t.type}),r.next(t)}catch(e){r.error(e)}}return e.subscribe({next:e=>{if(e.type!==ns.HEADERS&&e.type===ns.DATA&&e.data){let t=i.decode(e.data,{stream:!0}),n=(s+=t).split(/\n\n/);for(let e of(s=n.pop()||"",n))o(e)}},error:e=>r.error(e),complete:()=>{s&&o(s+=i.decode()),r.complete()}}),r.asObservable()})(i,n).subscribe({next:e=>{try{let t=a.rV.parse(e);n?.event("HTTP","Event validated:",t,{type:t.type,valid:!0}),r.next(t)}catch(t){n?.event("HTTP","Event invalid:",{json:e,error:String(t)}),r.error(t)}},error:e=>{if(e?.name==="AbortError"){r.next({type:a.Bx.RUN_ERROR,message:e.message||"Request aborted",code:"abort",rawEvent:e}),r.complete();return}return r.error(e)},complete:()=>r.complete()})}},error:e=>{i.error(e),r.error(e)},complete:()=>{i.complete()}}),r.asObservable()},nl=tK.k5(["TextMessageStart","TextMessageContent","TextMessageEnd","ActionExecutionStart","ActionExecutionArgs","ActionExecutionEnd","ActionExecutionResult","AgentStateMessage","MetaEvent","RunStarted","RunFinished","RunError","NodeStarted","NodeFinished"]),nu=tK.k5(["LangGraphInterruptEvent","PredictState","Exit"]),nc=tK.Ik({type:tK.eu(nl.enum.TextMessageStart),messageId:tK.Yj(),parentMessageId:tK.Yj().optional(),role:tK.Yj().optional()}),nd=tK.Ik({type:tK.eu(nl.enum.TextMessageContent),messageId:tK.Yj(),content:tK.Yj()}),nh=tK.Ik({type:tK.eu(nl.enum.TextMessageEnd),messageId:tK.Yj()}),np=tK.Ik({type:tK.eu(nl.enum.ActionExecutionStart),actionExecutionId:tK.Yj(),actionName:tK.Yj(),parentMessageId:tK.Yj().optional()}),nf=tK.Ik({type:tK.eu(nl.enum.ActionExecutionArgs),actionExecutionId:tK.Yj(),args:tK.Yj()}),ng=tK.Ik({type:tK.eu(nl.enum.ActionExecutionEnd),actionExecutionId:tK.Yj()}),nm=tK.Ik({type:tK.eu(nl.enum.ActionExecutionResult),actionName:tK.Yj(),actionExecutionId:tK.Yj(),result:tK.Yj()}),nv=tK.Ik({type:tK.eu(nl.enum.AgentStateMessage),threadId:tK.Yj(),agentName:tK.Yj(),nodeName:tK.Yj(),runId:tK.Yj(),active:tK.zM(),role:tK.Yj(),state:tK.Yj(),running:tK.zM()}),nb=tK.Ik({type:tK.eu(nl.enum.MetaEvent),name:nu,value:tK.bz()}),ny=tK.Ik({type:tK.eu(nl.enum.RunError),message:tK.Yj(),code:tK.Yj().optional()});tK.gM("type",[nc,nd,nh,np,nf,ng,nm,nv,nb,ny]),tK.Ik({id:tK.Yj(),role:tK.Yj(),content:tK.Yj(),parentMessageId:tK.Yj().optional()}),tK.Ik({id:tK.Yj(),name:tK.Yj(),arguments:tK.bz(),parentMessageId:tK.Yj().optional()}),tK.Ik({id:tK.Yj(),result:tK.bz(),actionExecutionId:tK.Yj(),actionName:tK.Yj()});let nE=e=>{if("string"==typeof e)return e;if(!Array.isArray(e))return;let t=e.filter(e=>"text"===e.type).map(e=>e.text).filter(e=>e.length>0);if(0!==t.length)return t.join(` 7`)},nT=e=>t=>{let n=ne(e),r,i,s,o,l=()=>"text"===o?[(()=>{if(!r||"text"!==o)throw Error("No text message to close");let e={type:a.Bx.TEXT_MESSAGE_END,messageId:r.messageId};return o=void 0,r=void 0,n?.event("TRANSFORM","TEXT_MESSAGE_END",e,{messageId:e.messageId}),e})()]:"tool"===o?[(()=>{if(!i||"tool"!==o)throw Error("No tool call to close");let e={type:a.Bx.TOOL_CALL_END,toolCallId:i.toolCallId};return o=void 0,i=void 0,n?.event("TRANSFORM","TOOL_CALL_END",e,{toolCallId:e.toolCallId}),e})()]:"reasoning"===o?[(()=>{if(!s||"reasoning"!==o)throw Error("No reasoning message to close");let e={type:a.Bx.REASONING_MESSAGE_END,messageId:s.messageId};return o=void 0,s=void 0,n?.event("TRANSFORM","REASONING_MESSAGE_END",e,{messageId:e.messageId}),e})()]:[];return t.pipe((0,V.Z)(e=>{switch(e.type){case a.Bx.TEXT_MESSAGE_START:case a.Bx.TEXT_MESSAGE_CONTENT:case a.Bx.TEXT_MESSAGE_END:case a.Bx.TOOL_CALL_START:case a.Bx.TOOL_CALL_ARGS:case a.Bx.TOOL_CALL_END:case a.Bx.TOOL_CALL_RESULT:case a.Bx.STATE_SNAPSHOT:case a.Bx.STATE_DELTA:case a.Bx.MESSAGES_SNAPSHOT:case a.Bx.CUSTOM:case a.Bx.RUN_STARTED:case a.Bx.RUN_FINISHED:case a.Bx.RUN_ERROR:case a.Bx.STEP_STARTED:case a.Bx.STEP_FINISHED:case a.Bx.THINKING_START:case a.Bx.THINKING_END:case a.Bx.THINKING_TEXT_MESSAGE_START:case a.Bx.THINKING_TEXT_MESSAGE_CONTENT:case a.Bx.THINKING_TEXT_MESSAGE_END:case a.Bx.REASONING_START:case a.Bx.REASONING_MESSAGE_START:case a.Bx.REASONING_MESSAGE_CONTENT:case a.Bx.REASONING_MESSAGE_END:case a.Bx.REASONING_END:return[...l(),e];case a.Bx.RAW:case a.Bx.ACTIVITY_SNAPSHOT:case a.Bx.ACTIVITY_DELTA:case a.Bx.REASONING_ENCRYPTED_VALUE:return[e];case a.Bx.TEXT_MESSAGE_CHUNK:let t=[];if(("text"!==o||void 0!==e.messageId&&e.messageId!==r?.messageId)&&t.pu
7sh(...l()),"text"!==o){if(void 0===e.messageId)throw Error("First TEXT_MESSAGE_CHUNK must have a messageId");r={messageId:e.messageId,name:e.name},o="text";let i={type:a.Bx.TEXT_MESSAGE_START,messageId:e.messageId,role:e.role||"assistant",...void 0!==e.name&&{name:e.name}};t.push(i),n?.event("TRANSFORM","TEXT_MESSAGE_START",i,{messageId:e.messageId})}if(void 0!==e.delta){let i={type:a.Bx.TEXT_MESSAGE_CONTENT,messageId:r.messageId,delta:e.delta};t.push(i),n?.event("TRANSFORM","TEXT_MESSAGE_CONTENT",i,{messageId:r.messageId})}return t;case a.Bx.TOOL_CALL_CHUNK:let u=[];if(("tool"!==o||void 0!==e.toolCallId&&e.toolCallId!==i?.toolCallId)&&u.push(...l()),"tool"!==o){if(void 0===e.toolCallId)throw Error("First TOOL_CALL_CHUNK must have a toolCallId");if(void 0===e.toolCallName)throw Error("First TOOL_CALL_CHUNK must have a toolCallName");i={toolCallId:e.toolCallId,toolCallName:e.toolCallName,parentMessageId:e.parentMessageId},o="tool";let t={type:a.Bx.TOOL_CALL_START,toolCallId:e.toolCallId,toolCallName:e.toolCallName,parentMessageId:e.parentMessageId};u.push(t),n?.event("TRANSFORM","TOOL_CALL_START",t,{toolCallId:e.toolCallId,toolCallName:e.toolCallName})}if(void 0!==e.delta){let t={type:a.Bx.TOOL_CALL_ARGS,toolCallId:i.toolCallId,delta:e.delta};u.push(t),n?.event("TRANSFORM","TOOL_CALL_ARGS",t,{toolCallId:i.toolCallId})}return u;case a.Bx.REASONING_MESSAGE_CHUNK:let c=[];if(("reasoning"!==o||e.messageId&&e.messageId!==s?.messageId)&&c.push(...l()),"reasoning"!==o){if(void 0===e.messageId)throw Error("First REASONING_MESSAGE_CHUNK must have a messageId");s={messageId:e.messageId},o="reasoning";let t={type:a.Bx.REASONING_MESSAGE_START,messageId:e.messageId};c.push(t),n?.event("TRANSFORM","REASONING_MESSAGE_START",t,{messageId:e.messageId})}if(void 0!==e.delta){let t={type:a.Bx.REASONING_MESSAGE_CONTENT,messageId:s.messageId,delta:e.delta};c.push(t),n?.event("TRANSFORM","REASONING_MESSAGE_CONTENT",t,{messageId:s.messageId})}return c}return e.type,[]}),(0,Z.j)(()=>{l()}))};var nk=class{runNext(e,t){return t.run(e).pipe(nT(!1))}runNextWithState(e,t){let n=t4(e.messages||[]),r=t4(e.state||{}),i=new F.m;return nr(e,i,t,[]).subscribe(e=>{void 0!==e.messages&&(n=e.messages),void 0!==e.state&&(r=e.state)}),this.runNext(e,t).pipe(W(async e=>(i.next(e),await new Promise(e=>setTimeout(e,0)),{event:e,messages:t4(n),state:t4(r)})))}},nS=class extends nk{constructor(e){super(),this.fn=e}run(e,t){return this.fn(e,t)}};function nw(e){let t=e.content;if(Array.isArray(t)){let n=t.filter(e=>"object"==typeof e&&!!e&&"type"in e&&"text"===e.type&&"string"==typeof e.text).map(e=>e.text).join("");return{...e,content:n}}return"string"==typeof t?e:{...e,content:""}}var nA=class extends nk{run(e,t){let{parentRunId:n,...r}=e,i={...r,messages:r.messages.map(nw)};return this.runNext(i,t)}};let nI="THINKING_START",n_="THINKING_END",nx="THINKING_TEXT_MESSAGE_START",nN="THINKING_TEXT_MESSAGE_CONTENT",nC="THINKING_TEXT_MESSAGE_END";var nR=class extends nk{constructor(...e){super(...e),this.currentReasoningId=null,this.currentMessageId=null}warnAboutTransformation(e,t){"u">typeof t2&&void 0!==t2.env&&t2.env.SUPPRESS_TRANSFORMATION_WARNINGS||console.warn(`AG-UI is converting ${e} to ${t}. To remove this warning, upgrade your AG-UI integration package (e.g. @ag-ui/langgraph). To surpress it, set SUPPRESS_TRANSFORMATION_WARNINGS=true in your .env file.`)}run(e,t){return this.currentReasoningId=null,this.currentMessageId=null,this.runNext(e,t).pipe((0,en.T)(e=>this.transformEvent(e)))}transformEvent(e){switch(e.type){case nI:{this.currentReasoningId=t6();let{title:t,...n}=e;return this.warnAboutTransformation(nI,a.Bx.REASONING_START),{...n,type:a.Bx.REASONING_START,messageId:this.currentReasoningId}}case nx:return this.currentMessageId=t6(),this.warnAboutTransformation(nx,a.Bx.REASONING_MESSAGE_START),{...e,type:a.Bx.REASONING_MESSAGE_START,messageId:this.currentMessageId,role:"assistant"};case nN:{let{delta:t,...n}=e;return this.warnAboutTransformation(nN,a.Bx.REASONING_MESSAGE_CONTENT),{...n,type:a.Bx.REASONING_MESSAGE_CONTENT,messageId:this.currentMessageId??t6(),delta:t}}case nC:{let t=this.currentMessageId??t6();return this.warnAboutTransformation(nC,a.Bx.REASONING_MESSAGE_END),{...e,type:a.Bx.REASONING_MESSAGE_END,messageId:t}}case n_:{let t=this.currentReasoningId??t6();return this.warnAboutTransformation(n_,a.Bx.REASONING_END),{...e,type:a.Bx.REASONING_END,messageId:t}}default:return e}}};function nO(e){let t=e.content;if(!Array.isArray(t))return e;let n=t.map(e=>{var t;let n;return"object"==typeof e&&e&&"type"in e&&"binary"===e.type&&"mimeType"in e&&"string"==typeof e.mimeType?(n=(t=e.mimeType).startsWith("image/")?"image":t.startsWith("audio/")?"audio":t.startsWith("video/")?"video":"document",e.data?{type:n,source:{type:"data",value:e.data,mimeType:e.mimeType}
7,...e.filename?{metadata:{filename:e.filename}}:{}}:e.url?{type:n,source:{type:"url",value:e.url,mimeType:e.mimeType},...e.filename?{metadata:{filename:e.filename}}:{}}:e):e});return{...e,content:n}}var nL=class extends nk{run(e,t){let n={...e,messages:e.messages.map(nO)};return this.runNext(n,t)}},nP=class{get maxVersion(){return"0.0.57"}get debug(){return this._debug}set debug(e){this._debug=t9(e),this._debugLogger=nn(this._debug)}get debugLogger(){return this._debugLogger}set debugLogger(e){"boolean"==typeof e?this._debugLogger=e?nn(t9(!0)):void 0:this._debugLogger=e}constructor({agentId:e,description:t,threadId:n,initialMessages:r,initialState:i,debug:s}={}){this.subscribers=[],this.isRunning=!1,this.pendingInterrupts=[],this.middlewares=[],this.agentId=e,this.description=t??"",this.threadId=n??(0,o.A)(),this.messages=t4(r??[]),this.state=t4(i??{}),this._debug=t9(s),this._debugLogger=nn(this._debug),0>=t3(this.maxVersion,"0.0.39")&&this.middlewares.unshift(new nA),0>=t3(this.maxVersion,"0.0.45")&&this.middlewares.unshift(new nR),0>=t3(this.maxVersion,"0.0.47")&&this.middlewares.unshift(new nL)}subscribe(e){return this.subscribers.push(e),{unsubscribe:()=>{this.subscribers=this.subscribers.filter(t=>t!==e)}}}use(...e){let t=e.map(e=>"function"==typeof e?new nS(e):e);return this.middlewares.push(...t),this}async runAgent(e,t){try{let n;this.isRunning=!0,this.agentId=this.agentId??(0,o.A)();let r=this.prepareRunAgentInput(e);this.debugLogger?.lifecycle("LIFECYCLE","Run started:",{agentId:this.agentId,threadId:this.threadId});let i,s=new Set(this.messages.map(e=>e.id)),a=[{onRunFinishedEvent:e=>{"success"===e.outcome&&(i=e.result)}},...this.subscribers,t??{}];await this.onInitialize(r,a),this.activeRunDetach$=new H.B,this.activeRunCompletionPromise=new Promise(e=>{n=e}),await (0,X.s)((0,K.F)(()=>0===this.middlewares.length?this.run(r):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(r),nT(this.debugLogger),ni(this.debugLogger),e=>e.pipe((0,er.Q)(this.activeRunDetach$)),e=>this.apply(r,e,a),e=>this.processApplyEvents(r,e,a),(0,ei.W)(e=>(this.debugLogger?.lifecycle("LIFECYCLE","Run errored:",{agentId:this.agentId,error:e instanceof Error?e.message:String(e)}),this.isRunning=!1,this.onError(r,e,a))),(0,Z.j)(()=>{this.debugLogger?.lifecycle("LIFECYCLE","Run finished:",{agentId:this.agentId,threadId:this.threadId}),this.isRunning=!1,this.onFinalize(r,a),n?.(),n=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))((0,$.of)(null)));let l=t4(this.messages).filter(e=>!s.has(e.id));return{result:i,newMessages:l}}finally{this.isRunning=!1}}connect(e){throw new a.Qk}async connectAgent(e,t){try{let n;this.isRunning=!0,this.agentId=this.agentId??(0,o.A)();let r=this.prepareRunAgentInput(e),i,s=new Set(this.messages.map(e=>e.id)),l=[{onRunFinishedEvent:e=>{"success"===e.outcome&&(i=e.result)}},...this.subscribers,t??{}];await this.onInitialize(r,l),this.activeRunDetach$=new H.B,this.activeRunCompletionPromise=new Promise(e=>{n=e}),await (0,X.s)((0,K.F)(()=>(0,G.v)(()=>this.connect(r)),nT(this.debugLogger),ni(this.debugLogger),e=>e.pipe((0,er.Q)(this.activeRunDetach$)),e=>this.apply(r,e,l),e=>this.processApplyEvents(r,e,l),(0,ei.W)(e=>(this.isRunning=!1,e instanceof a.Qk?B.w:this.onError(r,e,l))),(0,Z.j)(()=>{this.isRunning=!1,this.onFinalize(r,l),n?.(),n=void 0,this.activeRunCompletionPromise=void 0,this.activeRunDetach$=void 0}))((0,$.of)(null)),{defaultValue:void 0});let u=t4(this.messages).filter(e=>!s.has(e.id));return{result:i,newMessages:u}}finally{this.isRunning=!1}}abortRun(){}async detachActiveRun(){if(!this.activeRunDetach$)return;let e=this.activeRunCompletionPromise??Promise.resolve();this.activeRunDetach$.next(),this.activeRunDetach$?.complete(),await e}apply(e,t,n){return nr(e,t,this,n,this.debugLogger)}
7processApplyEvents(e,t,n){return t.pipe((0,es.M)(t=>{t.messages&&(this.messages=t.messages,n.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),t.state&&(this.state=t.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))}))}prepareRunAgentInput(e){let t=t4(this.messages).filter(e=>"activity"!==e.role);return{threadId:this.threadId,runId:e?.runId||(0,o.A)(),tools:t4(e?.tools??[]),context:t4(e?.context??[]),forwardedProps:t4(e?.forwardedProps??{}),state:t4(this.state),messages:t,...e?.resume===void 0?{}:{resume:t4(e.resume)}}}async onInitialize(e,t){if(this.pendingInterrupts.length>0){let t=new Set((e.resume??[]).map(e=>e.interruptId)),n=this.pendingInterrupts.map(e=>e.id).filter(e=>!t.has(e));if(n.length>0)throw new a.$e(`Thread has ${n.length} pending interrupt(s) not addressed by resume: ${n.join(", ")}`);for(let e of this.pendingInterrupts)if(function(e,t=new Date){return void 0!==e.expiresAt&&new Date(e.expiresAt)<=t}(e))throw new a.$e(`Interrupt ${e.id} expired at ${e.expiresAt}`)}let n=await t7(t,this.messages,this.state,(t,n,r)=>t.onRunInitialized?.({messages:n,state:r,agent:this,input:e}));(void 0!==n.messages||void 0!==n.state)&&(n.messages&&(this.messages=n.messages,e.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),n.state&&(this.state=n.state,e.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}onError(e,t,n){return(0,z.H)(t7(n,this.messages,this.state,(n,r,i)=>n.onRunFailed?.({error:t,messages:r,state:i,agent:this,input:e}))).pipe((0,en.T)(r=>{if((void 0!==r.messages||void 0!==r.state)&&(void 0!==r.messages&&(this.messages=r.messages,n.forEac
7h(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),void 0!==r.state&&(this.state=r.state,n.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})}))),!0!==r.stopPropagation){let e=String(t);if("AbortError"!==t.name&&"Fetch is aborted"!==t.message&&"signal is aborted without reason"!==t.message&&"component unmounted"!==t.message&&"component unmounted"!==e)throw console.error("Agent execution failed:",t),t}return{}}))}async onFinalize(e,t){let n=await t7(t,this.messages,this.state,(t,n,r)=>t.onRunFinalized?.({messages:n,state:r,agent:this,input:e}));(void 0!==n.messages||void 0!==n.state)&&(void 0!==n.messages&&(this.messages=n.messages,t.forEach(t=>{t.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this,input:e})})),void 0!==n.state&&(this.state=n.state,t.forEach(t=>{t.onStateChanged?.({state:this.state,messages:this.messages,agent:this,input:e})})))}clone(){let e=Object.create(Object.getPrototypeOf(this));return e.agentId=this.agentId,e.description=this.description,e.threadId=this.threadId,e.messages=t4(this.messages),e.state=t4(this.state),e._debug=this._debug,e._debugLogger=this._debugLogger,e.isRunning=this.isRunning,e.subscribers=[...this.subscribers],e.middlewares=[...this.middlewares],e.pendingInterrupts=t4(this.pendingInterrupts),e}addMessage(e){this.messages.push(e),(async()=>{for(let t of this.subscribers)await t.onNewMessage?.({message:e,messages:this.messages,state:this.state,agent:this});if("assistant"===e.role&&e.toolCalls)for(let t of e.toolCalls)for(let e of this.subscribers)await e.onNewToolCall?.({toolCall:t,messages:this.messages,state:this.state,agent:this});for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}addMessages(e){this.messages.push(...e),(async()=>{for(let t of e){for(let e of this.subscribers)await e.onNewMessage?.({message:t,messages:this.messages,state:this.state,agent:this});if("assistant"===t.role&&t.toolCalls)for(let e of t.toolCalls)for(let t of this.subscribers)await t.onNewToolCall?.({toolCall:e,messages:this.messages,state:this.state,agent:this})}for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setMessages(e){this.messages=t4(e),(async()=>{for(let e of this.subscribers)await e.onMessagesChanged?.({messages:this.messages,state:this.state,agent:this})})()}setState(e){this.state=t4(e),(async()=>{for(let e of this.subscribers)await e.onStateChanged?.({messages:this.messages,state:this.state,agent:this})})()}legacy_to_be_removed_runAgentBridged(e){let t,n,r;this.agentId=this.agentId??(0,o.A)();let i=this.prepareRunAgentInput(e);return(0===this.middlewares.length?this.run(i):this.middlewares.reduceRight((e,t)=>({run:n=>t.run(n,e),get messages(){return e.messages},get state(){return e.state}}),this).run(i)).pipe(nT(this.debugLogger),ni(this.debugLogger),(t=this.threadId,n=i.runId,r=this.agentId,e=>{let i={},s=!0,o=!0,l="",u=null,c=null,d=[],h={},p=e=>{"object"==typeof e&&e&&("messages"in e&&delete e.messages,i=e)};return e.pipe((0,V.Z)(e=>{switch(e.type){case a.Bx.TEXT_MESSAGE_START:return[{type:nl.enum.TextMessageStart,messageId:e.messageId,role:e.role}];case a.Bx.TEXT_MESSAGE_CONTENT:return[{type:nl.enum.TextMessageContent,messageId:e.messageId,content:e.delta}];case a.Bx.TEXT_MESSAGE_END:return[{type:nl.enum.TextMessageEnd,messageId:e.messageId}];case a.Bx.TOOL_CALL_START:return d.push({id:e.toolCallId,type:"function",function:{name:e.toolCallName,arguments:""}}),o=!0,h[e.toolCallId]=e.toolCallName,[{type:nl.enum.ActionExecutionStart,actionExecutionId:e.toolCallId,actionName:e.toolCallName,parentMessageId:e.parentMessageId}];case a.Bx.TOOL_CALL_ARGS:{let a=d.find(t=>t.id===e.toolCallId);if(!a)return console.warn(`TOOL_CALL_ARGS: No tool call found with ID '${e.toolCallId}'`),[];a.function.arguments+=e.delta;let u=!1;if(c){let e=c.find(e=>e.tool==a.function.name);if(e)try{let t=JSON.parse(ea(a.function.arguments));e.tool_argument&&e.tool_argument in t?(p({...i,[e.state_key]:t[e.tool_argument]}
7),u=!0):e.tool_argument||(p({...i,[e.state_key]:t}),u=!0)}catch{}}return[{type:nl.enum.ActionExecutionArgs,actionExecutionId:e.toolCallId,args:e.delta},...u?[{type:nl.enum.AgentStateMessage,threadId:t,agentName:r,nodeName:l,runId:n,running:s,role:"assistant",state:JSON.stringify(i),active:o}]:[]]}case a.Bx.TOOL_CALL_END:return[{type:nl.enum.ActionExecutionEnd,actionExecutionId:e.toolCallId}];case a.Bx.TOOL_CALL_RESULT:return[{type:nl.enum.ActionExecutionResult,actionExecutionId:e.toolCallId,result:e.content,actionName:h[e.toolCallId]||"unknown"}];case a.Bx.RAW:return[];case a.Bx.CUSTOM:switch(e.name){case"Exit":s=!1;break;case"PredictState":c=e.value}return[{type:nl.enum.MetaEvent,name:e.name,value:e.value}];case a.Bx.STATE_SNAPSHOT:return p(e.snapshot),[{type:nl.enum.AgentStateMessage,threadId:t,agentName:r,nodeName:l,runId:n,running:s,role:"assistant",state:JSON.stringify(i),active:o}];case a.Bx.STATE_DELTA:{let a=D.applyPatch(i,e.delta,!0,!1);return a?(p(a.newDocument),[{type:nl.enum.AgentStateMessage,threadId:t,agentName:r,nodeName:l,runId:n,running:s,role:"assistant",state:JSON.stringify(i),active:o}]):[]}case a.Bx.MESSAGES_SNAPSHOT:return u=e.messages,[{type:nl.enum.AgentStateMessage,threadId:t,agentName:r,nodeName:l,runId:n,running:s,role:"assistant",state:JSON.stringify({...i,...u?{messages:u}:{}}),active:!0}];case a.Bx.RUN_STARTED:return[];case a.Bx.RUN_FINISHED:return u&&(i.messages=u),0===Object.keys(i).length?[]:[{type:nl.enum.AgentStateMessage,threadId:t,agentName:r,nodeName:l,runId:n,running:s,role:"assistant",state:JSON.stringify({...i,...u?{messages:function(e){let t=[];for(let n of e)if("assistant"===n.role||"user"===n.role||"system"===n.role){let e=nE(n.content);if(e){let r={id:n.id,role:n.role,content:e};t.push(r)}if("assistant"===n.role&&n.toolCalls&&n.toolCalls.length>0)for(let e of n.toolCalls){let r={id:e.id,name:e.function.name,arguments:JSON.parse(e.function.arguments),parentMessageId:n.id};t.push(r)}}else if("tool"===n.role){let r="unknown";for(let t of e)if("assistant"===t.role&&t.toolCalls?.length){for(let e of t.toolCalls)if(e.id===n.toolCallId){r=e.function.name;break}}let i={id:n.id,result:n.content,actionExecutionId:n.toolCallId,actionName:r};t.push(i)}return t}(u)}:{}}),active:!1}];case a.Bx.RUN_ERROR:return[{type:nl.enum.RunError,message:e.message,code:e.code}];case a.Bx.STEP_STARTED:return l=e.stepName,d=[],c=null,[{type:nl.enum.AgentStateMessage,threadId:t,agentName:r,nodeName:l,runId:n,running:s,role:"assistant",state:JSON.stringify(i),active:!0}];case a.Bx.STEP_FINISHED:return d=[],c=null,[{type:nl.enum.AgentStateMessage,threadId:t,agentName:r,nodeName:l,runId:n,running:s,role:"assistant",state:JSON.stringify(i),active:!1}];default:return[]}}))}),e=>e.pipe((0,en.T)(e=>(this.debugLogger?.event("LEGACY","Event:",e,{type:e.type}),e))))}},nM=class extends nP{requestInit(e){return{method:"POST",headers:{...this.headers,"Content-Type":"application/json",Accept:"text/event-stream"},body:JSON.stringify(e),signal:this.abortController.signal}}runAgent(e,t){return this.abortController=e?.abortController??new AbortController,super.runAgent(e,t)}abortRun(){this.abortController.abort(),super.abortRun()}constructor(e){super(e),this.abortController=new AbortController,this.url=e.url,this.headers=t4(e.headers??{}),this.fetch=e.fetch??((e,t)=>fetch(e,t))}run(e){return na(no(()=>this.fetch(this.url,this.requestInit(e))),this.debugLogger)}clone(){let e=super.clone();e.url=this.url,e.headers=t4(this.headers??{}),e.fetch=this.fetch;let t=new AbortController,n=this.abortController.signal;return n.aborted&&t.abort(n.reason),e.abortController=t,e}}},10637:(e,t,n)=>{function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}n.d(t,{A:()=>ey});let i=Object.entries,s=Object.setPrototypeOf,o=Object.isFrozen,a=Object.getPrototypeOf,l=Object.getOwnPropertyDescriptor,u=Object.freeze,c=Object.seal,d=Object.create,h="undefined"!=typeof Reflect&&Reflect,p=h.apply,f=h.construct;u||(u=function(e){return e}),c||(c=function(e){return e}),p||(p=function(e,t){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}
7),f||(f=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});let g=M(Array.prototype.forEach),m=M(Array.prototype.lastIndexOf),v=M(Array.prototype.pop),b=M(Array.prototype.push),y=M(Array.prototype.splice),E=Array.isArray,T=M(String.prototype.toLowerCase),k=M(String.prototype.toString),S=M(String.prototype.match),w=M(String.prototype.replace),A=M(String.prototype.indexOf),I=M(String.prototype.trim),_=M(Number.prototype.toString),x=M(Boolean.prototype.toString),N="undefined"==typeof BigInt?null:M(BigInt.prototype.toString),C="undefined"==typeof Symbol?null:M(Symbol.prototype.toString),R=M(Object.prototype.hasOwnProperty),O=M(Object.prototype.toString),L=M(RegExp.prototype.test),P=(eb=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return f(eb,t)});function M(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return p(e,t,r)}}function j(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:T;if(s&&s(e,null),!E(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){let e=n(i);e!==i&&(o(t)||(t[r]=e),i=e)}e[i]=!0}return e}function D(e){let t=d(null);for(let s of i(e)){var n=function(e){if(Array.isArray(e))return e}(s)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,s,o,a=[],l=!0,u=!1;try{s=(n=n.call(e)).next,!1;for(;!(l=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return a}}(s,2)||function(e,t){if(e){if("string"==typeof e)return r(e,2);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(s,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();let i=n[0],o=n[1];R(e,i)&&(E(o)?t[i]=function(e){for(let t=0;t<e.length;t++)R(e,t)||(e[t]=null);return e}(o):o&&"object"==typeof o&&o.constructor===Object?t[i]=D(o):t[i]=o)}return t}function $(e,t){for(;null!==e;){let n=l(e,t);if(n){if(n.get)return M(n.get);if("function"==typeof n.value)return M(n.value)}e=a(e)}return function(){return null}}let B=u(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),U=u(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),G=u(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),z=u(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Y=u(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),H=u(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),F=u(["#text"]),V=u(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","
7spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Z=u(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),X=u(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),K=u(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),q=c(/{{[\w\W]*|^[\w\W]*}}/g),W=c(/<%[\w\W]*|^[\w\W]*%>/g),J=c(/\${[\w\W]*/g),Q=c(/^data-[\-\w.\u00B7-\uFFFF]+$/),ee=c(/^aria-[\-\w]+$/),et=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),en=c(/^(?:\w+script|data):/i),er=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ei=c(/^html$/i),es=c(/^[a-z][.\w]*(-[.\w]+)+$/i),eo=c(/<[/\w!]/g),ea=c(/<[/\w]/g),el=c(/<\/no(script|embed|frames)/i),eu=c(/\/>/i),ec={element:1,text:3,processingInstruction:7,comment:8,document:9,documentFragment:11},ed=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],eh=u(j({},ed)),ep=function(){let e={};return g(ed,t=>{e[t]=c(RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),u(e)}(),ef=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null,r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},eg=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},em=function(e,t,n,r){return R(e,t)&&E(e[t])?j(r.base?D(r.base):{},e[t],r.transform):n},ev=function(e,t,n){let r=R(e,t)?e[t]:void 0;return r&&"object"==typeof r?D(r):n()};var eb,ey=function e(){let t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"undefined"==typeof window?null:window,s=t=>e(t);if(s.version="3.4.14",s.removed=[],!r||!r.document||r.document.nodeType!==ec.document||!r.Element)return s.isSupported=!1,s;let o=r.document,a=o,l=a.currentScript;r.DocumentFragment;let h=r.HTMLTemplateElement,p=r.Node,f=r.Element,M=r.NodeFilter;void 0===r.NamedNodeMap&&(r.NamedNodeMap||r.MozNamedAttrMap),r.HTMLFormElement;let ed=r.DOMParser,eb=r.trustedTypes,ey=f.prototype,eE=$(ey,"cloneNode"),eT=$(ey,"remove"),ek=$(ey,"nextSibling"),eS=$(ey,"childNodes"),ew=$(ey,"parentNode"),eA=$(ey,"shadowRoot"),eI=$(ey,"attributes"),e_=p&&p.prototype?$(p.prototype,"nodeType"):null,ex=p&&p.prototype?$(p.prototype,"nodeName"):null,eN=p&&p.prototype?$(p.prototype,"ownerDocument"):null,eC=function(e){return e_?e_(e):e.nodeType},eR=function(e){return ex?ex(e):e.nodeName};if("function"==typeof h){let e=o.createElement("template");e.content&&e.content.ownerDocument&&(o=e.content.ownerDocument)}let eO="",eL=!1,eP=0,eM=function(){if(eP>0)throw P('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ej=function(e){eM(),eP++;try{return t.createHTML(e)}finally{eP--}},eD=function(e){eM(),eP++;try{return t.createScriptURL(e)}finally{eP--}},e$=o,eB=e$.implementation,eU=e$.createNodeIterator,eG=e$.createDocumentFragment,ez=e$.getElementsByTagName,eY=a.importNode,eH=eg();s.isSupported="function"==typeof i&&"function"==typeof ew&&eB&&void 0!==eB.createHTMLDocument;let eF=et,eV=null,eZ=j({},[...B,...U,...G,...Y,...F]),eX=null,eK=j({},[...V,...Z,...X,...K]),eq=Object.seal(d(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}}
7)),eW=null,eJ=null,eQ=Object.seal(d(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),e0=!0,e1=!0,e3=!1,e2=!0,e4=!1,e6=!0,e5=!1,e8=!1,e7=null,e9=null,te=!1,tt=!1,tn=!1,tr=!1,ti=!0,ts=!1,to="user-content-",ta=!0,tl=!1,tu={},tc=null,td=j({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),th=null,tp=j({},["audio","video","img","source","image","track"]),tf=null,tg=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),tm="http://www.w3.org/1998/Math/MathML",tv="http://www.w3.org/2000/svg",tb="http://www.w3.org/1999/xhtml",ty=tb,tE=!1,tT=null,tk=j({},[tm,tv,tb],k),tS=u(["mi","mo","mn","ms","mtext"]),tw=j({},tS),tA=u(["annotation-xml"]),tI=j({},tA),t_=j({},["title","style","font","a","script"]),tx=null,tN=["application/xhtml+xml","text/html"],tC=null,tR=null,tO=o.createElement("form"),tL=function(e){return e instanceof RegExp||e instanceof Function},tP=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(tR&&tR===e)return;e&&"object"==typeof e||(e={}),e=D(e),tC="application/xhtml+xml"===(tx=-1===tN.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE)?k:T,eV=em(e,"ALLOWED_TAGS",eZ,{transform:tC}),eX=em(e,"ALLOWED_ATTR",eK,{transform:tC}),tT=em(e,"ALLOWED_NAMESPACES",tk,{transform:k}),tf=em(e,"ADD_URI_SAFE_ATTR",tg,{transform:tC,base:tg}),th=em(e,"ADD_DATA_URI_TAGS",tp,{transform:tC,base:tp}),tc=em(e,"FORBID_CONTENTS",td,{transform:tC}),eW=em(e,"FORBID_TAGS",D({}),{transform:tC}),eJ=em(e,"FORBID_ATTR",D({}),{transform:tC}),tu=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?D(e.USE_PROFILES):e.USE_PROFILES),e0=!1!==e.ALLOW_ARIA_ATTR,e1=!1!==e.ALLOW_DATA_ATTR,e3=e.ALLOW_UNKNOWN_PROTOCOLS||!1,e2=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,e4=e.SAFE_FOR_TEMPLATES||!1,e6=!1!==e.SAFE_FOR_XML,e5=e.WHOLE_DOCUMENT||!1,tt=e.RETURN_DOM||!1,tn=e.RETURN_DOM_FRAGMENT||!1,tr=e.RETURN_TRUSTED_TYPE||!1,te=e.FORCE_BODY||!1,ti=!1!==e.SANITIZE_DOM,ts=e.SANITIZE_NAMED_PROPS||!1,ta=!1!==e.KEEP_CONTENT,tl=e.IN_PLACE||!1,eF=!function(e){try{return L(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?et:e.ALLOWED_URI_REGEXP,ty="string"==typeof e.NAMESPACE?e.NAMESPACE:tb,tw=ev(e,"MATHML_TEXT_INTEGRATION_POINTS",()=>j({},tS)),tI=ev(e,"HTML_INTEGRATION_POINTS",()=>j({},tA));let r=ev(e,"CUSTOM_ELEMENT_HANDLING",()=>d(null));if(eq=d(null),R(r,"tagNameCheck")&&tL(r.tagNameCheck)&&(eq.tagNameCheck=r.tagNameCheck),R(r,"attributeNameCheck")&&tL(r.attributeNameCheck)&&(eq.attributeNameCheck=r.attributeNameCheck),R(r,"allowCustomizedBuiltInElements")&&"boolean"==typeof r.allowCustomizedBuiltInElements&&(eq.allowCustomizedBuiltInElements=r.allowCustomizedBuiltInElements),c(eq),e4&&(e1=!1),tn&&(tt=!0),tu&&(eV=j({},F),eX=d(null),!0===tu.html&&(j(eV,B),j(eX,V)),!0===tu.svg&&(j(eV,U),j(eX,Z),j(eX,K)),!0===tu.svgFilters&&(j(eV,G),j(eX,Z),j(eX,K)),!0===tu.mathMl&&(j(eV,Y),j(eX,X),j(eX,K))),eQ.tagCheck=null,eQ.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?eQ.tagCheck=e.ADD_TAGS:E(e.ADD_TAGS)&&(eV===eZ&&(eV=D(eV)),j(eV,e.ADD_TAGS,tC))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?eQ.attributeCheck=e.ADD_ATTR:E(e.ADD_ATTR)&&(eX===eK&&(eX=D(eX)),j(eX,e.ADD_ATTR,tC))),R(e,"ADD_FORBID_CONTENTS")&&E(e.ADD_FORBID_CONTENTS)&&(tc===td&&(tc=D(tc)),j(tc,e.ADD_FORBID_CONTENTS,tC)),ta&&(eV["#text"]=!0),e5&&j(eV,["html","head","body"]),eV.table&&(j(eV,["tbody"]),delete eW.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw P('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw P('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let n=t;t=e.TRUSTED_TYPES_POLICY;try{eO=ej("")}catch(e){throw t=n,e}}else null===e.TRUSTED_TYPES_POLICY?(t=void 0,eO=""):(void 0===t&&(eL||(n=ef(eb,l),eL=!0),t=n),t&&"string"==typeof eO&&(eO=ej("")));u&&u(e),tR=e},tM=j({},[...U,...G,...z]),tj=j({},[...Y,...H]),tD=function(e){var t,n,r;let i=ew(e);i&&i.tagName||(i={namespaceURI:ty,tagName:"template"});let s=T(e.tagName),o=T(i.tagName);return!!tT[e.namespaceURI]&&(e.namespaceURI===tv?(t=i).namespaceURI===tb?"svg"===s:t.namespaceURI===tm?"svg"===s&&("annotation-xml"===o||tw[o]):!!tM[s]:e.namespaceURI===tm?(n=i).namespaceURI===tb?"math"===s:n.namespaceURI===tv?"math"===s&&tI[o]:!!tj[s]:e.namespaceURI===tb?((r=i).namespaceURI!==tv||!!tI[o])&&(r.namespaceURI!==tm||!!tw[o])&&!tj[s]&&(t_[s]||!tM[s]):"application/xhtml+xml"===tx&&!!tT[e.namespaceURI])},t$=function(e){b(s.removed,{element:e});try{ew(e).removeChild(e)}catch(t){if(eT(e),!ew(e))throw P("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},tB=function(e,t,n){try{e.removeAttributeNode(t)}catch(t){try{e.removeAttribute(n)}catch(e){}}},tU=function(e){tY(e);let t=eS(e);if(t){let e=[];g(t,t=>{b(e,t)}),g(e,e=>{try{eT(e)}catch(e){}})}let n=eI(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;"string"==typeof i&&tB(e,r,i)}},tG=function(e,t,n){if(!n)try{n=t.getAttributeNode(e)}catch(e){n=null}b(s.removed,{attribute:n||null,from:t});try{n?t.removeAttributeNode(n):t.removeAttribute(e)}catch(n){try{t.removeAttribute(e)}catch(e){}}if("is"===e)if(tt||tn)try{t$(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},tz=function(e){let t=eI(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;"string"!=typeof i||eX[tC(i)]||tB(e,r,i)}},tY=function(e){let t=[e];for(;t.length>0;){let e=t.pop();eC(e)===ec.element&&tz(e);let n=eS(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},tH=function(e,t){return!!e6&&("patchsrc"===e||"for"===e&&"label"!==t&&"output"!==t)},tF=function(e){if(!e6)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=eC(e);if(n===ec.processingInstruction||n===ec.comment&&L(ea,e.data)){try{eT(e)}catch(e){}continue}if(n===ec.element){let t=tC(eR(e));try{e.hasAttribute&&e.hasAttribute("patchsrc")&&e.removeAttribute("patchsrc"),e.hasAttribute&&e.hasAttribute("for")&&tH("for",t)&&e.removeAttribute("for")}catch(e){}}let r=eS(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},tV=function(e){let n=null,r=null;if(te)e="<remove></remove>"+e;else{let t=S(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===tx&&ty===tb&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");let i=t?ej(e):e;if(ty===tb)try{n=new ed().parseFromString(i,tx)}catch(e){}if(!n||!n.documentElement){n=eB.createDocument(ty,"template",null);try{n.documentElement.innerHTML=tE?eO:i}catch(e){}}let s=n.body||n.documentElement;return(e&&r&&s.insertBefore(o.createTextNode(r),s.childNodes[0]||null),ty===tb)?ez.call(n,e5?"html":"body")[0]:e5?n.documentElement:s},tZ=function(e){let t=eN?eN(e):e.ownerDocument;return eU.call(t||e,e,M.SHOW_ELEMENT|M.SHOW_COMMENT|M.SHOW_TEXT|M.SHOW_PROCESSING_INSTRUCTION|M.SHOW_CDATA_SECTION,null)},tX=function(e){return e=w(e,q," "),e=w(e,W," "),e=w(e,J," ")},tK=function(e){var t;e.normalize();let n=eN?eN(e):e.ownerDocument,r=eU.call(n||e,e,M.SHOW_TEXT|M.SHOW_COMMENT|M.SHOW_CDATA_SECTION|M.SHOW_PROCESSING_INSTRUCTION,null),i=r.nextNode();for(;i;)i.data=tX(i.data),i=r.nextNode();let s=null==(t=e.querySelectorAll)?void 0:t.call(e,"template");s&&g(s,e=>{tW(e.content)&&tK(e.content)})},tq=function(e){let t=ex?ex(e):null;return"string"==typeof t&&"form"===tC(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==eI(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==e_(e)||e.childNodes!==eS(e))},tW=function(e){if(!e_||"object"!=typeof e||null===e)return!1;try{return e_(e)===ec.documentFragment}catch(e){return!1}},tJ=function(e){if(!e_||"object"!=typeof e||null===e)return!1;try{return"number"==typeof e_(e)}catch(e){return!1}};function tQ(e,t,n){0!==e.length&&g(e,e=>{e.call(s,t,n,tR)})}let t0=function(e,t){if(e instanceof RegExp)return L(e,t);if(e instanceof Function){for(var n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return!!e(t,...r)}return!1},t1=function(e,t,n){if(!eW[t]&&t8(t)&&t0(eq.tagNameCheck,t))return!1;if(ta&&!tc[t]){let t=ew(e),r=eS(e);if(r&&t){let i=r.length;for(let s=i-1;s>=0;--s){let i=e===n?eE(r[s],!0):r[s];t.insertBefore(i,ek(e))}}}return t$(e),!0},t3=function(e,t,n,r){return 0===e.length?t:t===n||t===r?D(t):t},t2=function(e,t){return e!==t&&null===ew(e)&&(tl&&tY(e),!0)},t4=function(e,t){if(tQ(eH.beforeSanitizeElements,e,null),t2(e,t))return!0;
7if(tq(e))return t$(e),!0;let n=tC(eR(e));if(eV=t3(eH.uponSanitizeElement,eV,eZ,e7),tQ(eH.uponSanitizeElement,e,{tagName:n,allowedTags:eV}),t2(e,t))return!0;if(e6&&e.hasChildNodes()&&!tJ(e.firstElementChild)&&L(eo,e.textContent)&&L(eo,e.innerHTML)||e6&&e.namespaceURI===tb&&eh[n]&&(tJ(e.firstElementChild)||"string"==typeof e.textContent&&L(ep[n],e.textContent))||e.nodeType===ec.processingInstruction||e6&&e.nodeType===ec.comment&&L(ea,e.data))return t$(e),!0;if(eW[n]||!(eQ.tagCheck instanceof Function&&eQ.tagCheck(n))&&!eV[n]){let r=t1(e,n,t);return!1===r&&tQ(eH.afterSanitizeElements,e,null),r}if(eC(e)===ec.element&&!tD(e)||("noscript"===n||"noembed"===n||"noframes"===n)&&L(el,e.innerHTML))return t$(e),!0;if(e4&&e.nodeType===ec.text){let t=tX(e.textContent);e.textContent!==t&&(b(s.removed,{element:e.cloneNode()}),e.textContent=t)}return tQ(eH.afterSanitizeElements,e,null),!1},t6=function(e,t,n){if(eJ[t]||tH(t,e)||ti&&("id"===t||"name"===t)&&(n in o||n in tO))return!1;let r=eX[t]||eQ.attributeCheck instanceof Function&&eQ.attributeCheck(t,e);return!!(e1&&L(Q,t)||e0&&L(ee,t))||(r?!(!(tf[t]||L(eF,w(n,er,"")))&&("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==A(n,"data:")||!th[e])&&(!e3||L(en,w(n,er,""))))||!n:t8(e)&&t0(eq.tagNameCheck,e)&&t0(eq.attributeNameCheck,t,e)||"is"===t&&eq.allowCustomizedBuiltInElements&&t0(eq.tagNameCheck,n))},t5=j({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),t8=function(e){return!t5[T(e)]&&L(es,e)},t7=function(e,n,r,i){if(t&&"object"==typeof eb&&"function"==typeof eb.getAttributeType&&!r)switch(eb.getAttributeType(e,n)){case"TrustedHTML":return ej(i);case"TrustedScriptURL":return eD(i)}return i},t9=function(e,t,n,r){try{n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),tq(e)?t$(e):v(s.removed)}catch(n){tG(t,e)}},ne=function(e){tQ(eH.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||tq(e))return;let n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:eX=t3(eH.uponSanitizeAttribute,eX,eK,e9),forceKeepAttr:void 0},r=t.length,i=tC(e.nodeName);for(;r--;){let s=t[r],o=s.name,a=s.namespaceURI,l=s.value,u=tC(o),c="value"===o?l:I(l);if(n.attrName=u,n.attrValue=c,n.keepAttr=!0,n.forceKeepAttr=void 0,tQ(eH.uponSanitizeAttribute,e,n),c=n.attrValue,ts&&("id"===u||"name"===u)&&0!==A(c,to)&&(tG(o,e,s),c=to+c),e6&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,c)||"attributename"===u&&S(c,"href")){tG(o,e,s);continue}if(!n.forceKeepAttr){if(!n.keepAttr||!e2&&L(eu,c)||(e4&&(c=tX(c)),!t6(i,u,c))){tG(o,e,s);continue}(c=t7(i,u,a,c))!==l&&t9(e,o,a,c)}}tQ(eH.afterSanitizeAttributes,e,null)},nt=function(e){let t=null,n=tZ(e);for(tQ(eH.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(tQ(eH.uponSanitizeShadowNode,t,null),t4(t,e),ne(t),tW(t.content)&&nt(t.content),eC(t)===ec.element){let e=eA(t);tW(e)&&(nn(e),nt(e))}tQ(eH.afterSanitizeShadowDOM,e,null)},nn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){nt(e.shadow);continue}let n=e.node,r=eC(n)===ec.element,i=eS(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=ex?ex(n):null;if("string"==typeof e&&"template"===tC(e)){let e=n.content;tW(e)&&t.push({node:e,shadow:null})}}if(r){let e=eA(n);tW(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return s.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=null,i=null,o=null,l=null;if((tE=!e)&&(e="\x3c!--\x3e"),"string"!=typeof e&&!tJ(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return _(e);case"boolean":return x(e);case"bigint":return N?N(e):"0";case"symbol":return C?C(e):"Symbol()";case"undefined":default:return O(e);case"function":case"object":{if(null===e)return O(e);let t=$(e,"toString");if("function"==typeof t){let n=t(e);return"string"==typeof n?n:O(n)}return O(e)}}}(e)))throw P("dirty is not a string, aborting");if(!s.isSupported)return e;e8?(eV=e7,eX=e9):tP(n),(eH.uponSanitizeElement.length>0||eH.uponSanitizeAttribute.length>0)&&(eV=D(eV)),eH.uponSanitizeAttribute.length>0&&(eX=D(eX)),s.removed=[];let u=tl&&"string"!=typeof e&&tJ(e);
7if(u){tF(e);let t=eR(e);if("string"==typeof t){let n=tC(t);if(!eV[n]||eW[n])throw tU(e),P("root node is forbidden and cannot be sanitized in-place")}if(tq(e))throw tU(e),P("root node is clobbered and cannot be sanitized in-place");try{nn(e)}catch(t){throw tU(e),t}}else if(tJ(e))(i=(r=tV("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType===ec.element&&"BODY"===i.nodeName||"HTML"===i.nodeName?r=i:r.appendChild(i),nn(i);else{if(!tt&&!e4&&!e5&&-1===e.indexOf("<"))return t&&tr?ej(e):e;if(!(r=tV(e)))return tt?null:tr?eO:""}r&&te&&t$(r.firstChild);let c=u?e:r;try{let e=tZ(c);for(;o=e.nextNode();)t4(o,c),ne(o),tW(o.content)&&nt(o.content)}catch(t){throw u&&(tU(e),g(s.removed,e=>{e.element&&tY(e.element)})),t}if(u)return g(s.removed,e=>{e.element&&tY(e.element)}),e4&&tK(e),e;if(tt){if(e4&&tK(r),tn)for(l=eG.call(r.ownerDocument);r.firstChild;)l.appendChild(r.firstChild);else l=r;return(eX.shadowroot||eX.shadowrootmode)&&(l=eY.call(a,l,!0)),l}let d=e5?r.outerHTML:r.innerHTML;return e5&&eV["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&L(ei,r.ownerDocument.doctype.name)&&(d="<!DOCTYPE "+r.ownerDocument.doctype.name+">\n"+d),e4&&(d=tX(d)),t&&tr?ej(d):d},s.setConfig=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};tP(e),e8=!0,e7=eV,e9=eX},s.clearConfig=function(){tR=null,e8=!1,e7=null,e9=null,t=n,eO=""},s.isValidAttribute=function(e,t,n){return tR||tP({}),t6(tC(e),tC(t),n)},s.addHook=function(e,t){"function"==typeof t&&R(eH,e)&&b(eH[e],t)},s.removeHook=function(e,t){if(R(eH,e)){if(void 0!==t){let n=m(eH[e],t);return -1===n?void 0:y(eH[e],n,1)[0]}return v(eH[e])}},s.removeHooks=function(e){R(eH,e)&&(eH[e]=[])},s.removeAllHooks=function(){eH=eg()},s}()},11713:(e,t,n)=>{n.d(t,{c:()=>c});var r=n(74087),i=n(43532),s=n(56360),o=n(87181),a=n(45738),l=n(89605),u=n(68352),c=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var s=this,o=!function(e){return e&&e instanceof r.vU||e&&(0,l.T)(e.next)&&(0,l.T)(e.error)&&(0,l.T)(e.complete)&&(0,i.Uv)(e)}(e)?new r.Ms(e,t,n):e;return(0,u.Y)(function(){var e=s.operator,t=s.source;o.add(e?e.call(o,t):t?s._subscribe(o):s._trySubscribe(o))}),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=d(t))(function(t,i){var s=new r.Ms({next:function(t){try{e(t)}catch(e){i(e),s.unsubscribe()}},error:i,complete:t});n.subscribe(s)})},e.prototype._subscribe=function(e){var t;return null==(t=this.source)?void 0:t.subscribe(e)},e.prototype[s.s]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0,o.m)(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=d(e))(function(e,n){var r;t.subscribe(function(e){return r=e},function(e){return n(e)},function(){return e(r)})})},e.create=function(t){return new e(t)},e}();function d(e){var t;return null!=(t=null!=e?e:a.$.Promise)?t:Promise}},13946:(e,t,n)=>{n.d(t,{t:()=>i});var r=n(70324),i=function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}return(0,r.C6)(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return n.closed||t.next(this._value),n},t.prototype.getValue=function(){var e=this.hasError,t=this.thrownError,n=this._value;if(e)throw t;return this._throwIfClosed(),n},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(n(73513).B)},19554:(e,t,n)=>{n.d(t,{m:()=>i});var r=n(89605);function i(e){return e&&(0,r.T)(e.schedule)}},19729:(e,t,n)=>{n.d(t,{s:()=>i});var r=n(52900);function i(e,t){var n="object"==typeof t;return new Promise(function(i,s){var o,a=!1;e.subscribe({next:function(e){o=e,a=!0},error:s,complete:function(){a?i(o):n?i(t.defaultValue):s(new r.G)}})})}},20773:(e,t,n)=>{n.d(t,{u:()=>l});var r=n(70324),i=n(40562),s=n(73513),o=n(74087),a=n(43356);function l(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new s.B}:t,r=e.resetOnError,l=void 0===r||r,c=e.resetOnComplete,d=void 0===c||c,h=e.resetOnRefCountZero,p=void 0===h||h;return function(e){var t,r,s,c=0,h=!1,f=!1,g=function(){null==r||r.unsubscribe(),r=void 0},m=function(){g(),t=s=void 0,h=f=!1},v=function(){var e=t;m(),null==e||e.unsubscribe()};return(0,a.N)(function(e,a){c++,f||h||g();var b=s=null!=s?s:n();a.add(function(){0!=--c||f||h||(r=u(v,p))}),b.subscribe(a),!t&&c>0&&(t=new o.Ms({next:function(e){return b.next(e)},error:function(e){f=!0,g(),r=u(m,l,e),b.error(e)},complete:function(){h=!0,g(),r=u(m,d),b.complete()}}),(0,i.Tg)(e).subscribe(t))})(e)}}function u(e,t){for(var n=[],s=2;s<arguments.length;s++)n[s-2]=arguments[s];if(!0===t)return void e();if(!1!==t){var a=new o.Ms({next:function(){a.unsubscribe(),e()}});return(0,i.Tg)(t.apply(void 0,(0,r.fX)([],(0,r.zs)(n)))).subscribe(a)}}},23305:(e,t,n)=>{n.d(t,{L:()=>r});function r(e){return TypeError("You provided "+(null!==e&&"object"==typeof e?"an invali
7d object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}},23461:(e,t,n)=>{n.d(t,{T:()=>i});var r=n(89605);function i(e){return Symbol.asyncIterator&&(0,r.T)(null==e?void 0:e[Symbol.asyncIterator])}},26e3:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.ALL=t.COLLECTION=t.ATOM=t.SPECIAL=t.INF=t._INFINITY=t.INFINITY=t.NAN=t.BOOL=t.NULL=t.OBJ=t.ARR=t.NUM=t.STR=void 0,t.STR=1,t.NUM=2,t.ARR=4,t.OBJ=8,t.NULL=16,t.BOOL=32,t.NAN=64,t.INFINITY=128,t._INFINITY=256,t.INF=t.INFINITY|t._INFINITY,t.SPECIAL=t.NULL|t.BOOL|t.INF|t.NAN,t.ATOM=t.STR|t.NUM|t.SPECIAL,t.COLLECTION=t.ARR|t.OBJ,t.ALL=t.ATOM|t.COLLECTION,t.Allow={STR:t.STR,NUM:t.NUM,ARR:t.ARR,OBJ:t.OBJ,NULL:t.NULL,BOOL:t.BOOL,NAN:t.NAN,INFINITY:t.INFINITY,_INFINITY:t._INFINITY,INF:t.INF,SPECIAL:t.SPECIAL,ATOM:t.ATOM,COLLECTION:t.COLLECTION,ALL:t.ALL},t.default=t.Allow},26947:(e,t,n)=>{n.d(t,{q:()=>o});var r=n(70324),i=n(92666),s=n(96483);function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return(0,i.x)(t,s.of.apply(void 0,(0,r.fX)([],(0,r.zs)(e))))}}},27062:(e,t,n)=>{n.d(t,{q:()=>r});function r(e,t){if(function(e){let t=e["~standard"];return null!=t&&"object"==typeof t&&"jsonSchema"in t&&null!=t.jsonSchema&&"object"==typeof t.jsonSchema&&"input"in t.jsonSchema&&"function"==typeof t.jsonSchema.input}(e))return e["~standard"].jsonSchema.input({target:"draft-07"});if("function"==typeof e.toJSONSchema)return e.toJSONSchema();let n=e["~standard"].vendor;if("zod"===n&&t?.zodToJsonSchema)return t.zodToJsonSchema(e,{$refStrategy:"none"});throw Error(`Cannot convert schema to JSON Schema. The schema (vendor: "${n}") does not implement Standard JSON Schema V1 and no zodToJsonSchema fallback is available. Use a library that supports Standard JSON Schema (e.g., Zod 3.24+, Valibot v1+, ArkType v2+) or pass a zodToJsonSchema function in options.`)}},27616:(e,t,n)=>{n.d(t,{T:()=>s});var r=n(43356),i=n(57304);function s(e,t){return(0,r.N)(function(n,r){var s=0;n.subscribe((0,i._)(r,function(n){r.next(e.call(t,n,s++))}))})}},29984:(e,t,n)=>{function r(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}n.d(t,{xI:()=>em});var i=r(),s={exec:()=>null};function o(e,t=""){let n="string"==typeof e?e:e.source,r={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(l.caret,"$1"),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var a=(()=>{try{return!!RegExp("(?<=1)(?<!1)")}catch{return!1}})(),l={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},u=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,c=/(?:[*+-]|\d{1,9}[.)])/,d=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,h=o(d).replace(/bull/g,c).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),p=o(d).replace(/bull/g,c).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),f=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,g=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,m=o(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",g).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),v=o(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,c).getRegex(),b="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",y=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,E=o("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>
7)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",y).replace("tag",b).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),T=o(f).replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",b).getRegex(),k={blockquote:o(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",T).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:m,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:u,html:E,lheading:h,list:v,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:T,table:s,text:/^[^\n]+/},S=o("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",b).getRegex(),w={...k,lheading:p,table:S,paragraph:o(f).replace("hr",u).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",S).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",b).getRegex()},A={...k,html:o(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",y).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:s,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:o(f).replace("hr",u).replace("heading",` *#{1,6} *[^ 8]`).replace("lheading",h).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},I=/^( {2,}|\\)\n(?!\s*$)/,_=/[\p{P}\p{S}]/u,x=/[\s\p{P}\p{S}]/u,N=/[^\s\p{P}\p{S}]/u,C=o(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,x).getRegex(),R=/(?!~)[\p{P}\p{S}]/u,O=o(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",a?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),L=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,P=o(L,"u").replace(/punct/g,_).getRegex(),M=o(L,"u").replace(/punct/g,R).getRegex(),j="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",D=o(j,"gu").replace(/notPunctSpace/g,N).replace(/punctSpace/g,x).replace(/punct/g,_).getRegex(),$=o(j,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,R).getRegex(),B=o("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,N).replace(/punctSpace/g,x).replace(/punct/g,_).getRegex(),U=o(/\\(punct)/,"gu").replace(/punct/g,_).getRegex(),G=o(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[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])?)+(?![-_])/).getRegex(),z=o(y).replace("(?:--\x3e|$)","--\x3e").getRegex(),Y=o("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",z).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),H=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,F=o(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",H).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),V=o(/^!?\[(label)\]\[(ref)\]/).replace("label",H).replace("ref",g).getRegex(),Z=o(/^!?\[(ref)\](?:\[\])?/).replace("ref",g).getRegex(),X=o("reflink|nolink(?!\\()","g").replace("reflink",V).replace("nolink",Z).getRegex(),K=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,q={_backpedal:s,anyPunctuation:U,autolink:G,blockSkip:O,br:I,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:s,emStrongLDelim:P,emStrongRDelimAst:D,emStrongRDelimUnd:B,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:F,nolink:Z,punctuation:C,reflink:V,reflinkSearch:X,tag:Y,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:s},W={...q,link:o(/^!?\[(label)\]\((.*?)\)/).replace("label",H).getRegex(),reflink:o(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",H).getRegex()},J={...q,emStrongRDelimAst:$,emStrongLDelim:M,url:o(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",K).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:o(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",K).getRegex()},Q={...J,br:o(I).replace("{2,}","*").getRegex(),text:o(J.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ee={normal:k,gfm:w,pedantic:A},et={normal:q,gfm:J,breaks:Q,pedantic:W},en={"&":"&","<":"<",">":">",'"':""","'":"'"},er=e=>en[e];function ei(e,t){if(t){if(l.escapeTest.test(e))return e.replace(l.escapeReplace,er)}else if(l.escapeTestNoEncode.test(e))return e.replace(l.escapeReplaceNoEncode,er);return e}function es(e){try{e=encodeURI(e).replace(l.percentDecode,"%")}catch{return null}return e}function eo(e,t){let n=e.replace(l.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(l.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;r<n.length;r++)n[r]=n[r].trim().replace(l.slashPipe,"|");return n}function ea(e,t,n){let r=e.length;if(0===r)return"";let i=0;for(;i<r;){let s=e.charAt(r-i-1);if(s!==t||n)if(s!==t&&n)i++;else break;else i++}return e.slice(0,r-i)}function el(e,t,n,r,i){let s=t.href,o=t.title||null,a=e[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:"!"===e[0].charAt(0)?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}var eu=class{options;rules;lexer;constructor(e){this.options=e||i}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:ea(e,` 9`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=function(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(null===r)return t;let i=r[1];return t.split(` 10`).map(e=>{let t=e.match(n.other.beginningSpace);if(null===t)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(` 11`)}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=ea(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:ea(t[0],` 12`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=ea(t[0],` 13`).split(` 14`),n="",r="",i=[];for(;e.length>0;){let t=!1,s=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))s.push(e[o]),t=!0;else if(t)break;else s.push(e[o]);e=e.slice(o);let a=s.join(` 15`),l=a.replace(this.rules.other.blockquoteSetextReplace,` 16 $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n} 17${a}`:a,r=r?`${r} 18${l}`:l;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,i,!0),this.lexer.state.top=u,0===e.length)break;let c=i.at(-1);if(c?.type==="code")break;if(c?.type==="blockquote"){let t=c.raw+` 19`+e.join(` 20`),s=this.blockquote(t);i[i.length-1]=s,n=n.substring(0,n.length-c.raw.length)+s.raw,r=r.substring(0,r.length-c.text.length)+s.text;break}if(c?.type==="list"){let t=c.raw+` 21`+e.join(` 22`),s=this.list(t);i[i.length-1]=s,n=n.substring(0,n.length-c.raw.length)+s.raw,r=r.substring(0,r.length-c.raw.length)+s.raw,e=t.substring(i.at(-1).raw.length).split(` 23`);continue}}return{type:"blockquote",raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);
23if(t){let n=t[1].trim(),r=n.length>1,i={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");let s=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r="",a="";if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let l=t[2].split(` 24`,1)[0].replace(this.rules.other.listReplaceTabs,e=>" ".repeat(3*e.length)),u=e.split(` 25`,1)[0],c=!l.trim(),d=0;if(this.options.pedantic?(d=2,a=l.trimStart()):c?d=t[1].length+1:(d=(d=t[2].search(this.rules.other.nonSpaceChar))>4?1:d,a=l.slice(d),d+=t[1].length),c&&this.rules.other.blankLine.test(u)&&(r+=u+` 26`,e=e.substring(u.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),s=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let h=e.split(` 27`,1)[0],p;if(u=h,p=this.options.pedantic?u=u.replace(this.rules.other.listReplaceNesting," "):u.replace(this.rules.other.tabCharGlobal," "),i.test(u)||s.test(u)||o.test(u)||t.test(u)||n.test(u))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!u.trim())a+=` 28`+p.slice(d);else{if(c||l.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||i.test(l)||s.test(l)||n.test(l))break;a+=` 29`+u}c||u.trim()||(c=!0),r+=h+` 30`,e=e.substring(h.length+1),l=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let h=null,p;this.options.gfm&&(h=this.rules.other.listIsTask.exec(a))&&(p="[ ] "!==h[0],a=a.replace(this.rules.other.listReplaceTask,"")),i.items.push({type:"list_item",raw:r,task:!!h,checked:p,loose:!1,text:a,tokens:[]}),i.raw+=r}let a=i.items.at(-1);if(!a)return;a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>"space"===e.type);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=eo(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(` 31`):[],s={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?s.align.push("right"):this.rules.other.tableAlignCenter.test(e)?s.align.push("center"):this.rules.other.tableAlignLeft.test(e)?s.align.push("left"):s.align.push(null);for(let e=0;e<n.length;e++)s.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:s.align[e]});for(let e of i)s.rows.push(eo(e,s.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:s.align[t]})));return s}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===` 32`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=ea(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(")"))return -1;let n=0;for(let r=0;r<e.length;r++)if("\\"===e[r])r++;else if("("===e[r])n++;else if(e[r]===t[1]&&--n<0)return r;return n>0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],r="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),el(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:r&&r.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return el(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,s,o=n,a=0,l="*"===r[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+n);null!=(r=l.exec(t));){if(!(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6]))continue;if(s=[...i].length,r[3]||r[4]){o+=s;continue}if((r[5]||r[6])&&n%3&&!((n+s)%3)){a+=s;continue}if((o-=s)>0)continue;s=Math.min(s,s+o+a);let t=[...r[0]][0].length,l=e.slice(0,n+r.index+t+s);if(Math.min(n,s)%2){let e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}let u=l.slice(2,-2);return{type:"strong",raw:l,text:u,tokens:this.lexer.inlineTokens(u)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return n="@"===t[2]?"mailto:"+(e=t[1]):e=t[1],{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])n="mailto:"+(e=t[0]);else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(r!==t[0]);e=t[0],n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},ec=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||i,this.options.tokenizer=this.options.tokenizer||new eu,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:l,block:ee.normal,inline:et.normal};this.options.pedantic?(t.block=ee.pedantic,t.inline=et.pedantic):this.options.gfm&&(t.block=ee.gfm,this.options.breaks?t.inline=et.breaks:t.inline=et.gfm),this.tokenizer.rules=t}static get rules(){return{block:ee,inline:et}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(l.carriageReturn,` 33`),this.blockTokens(e,this.tokens);for(let e=0;
33e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(l.tabCharGlobal," ").replace(l.spaceLine,""));e;){let r;if(this.options.extensions?.block?.some(n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0)))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);1===r.raw.length&&void 0!==n?n.raw+=` 34`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type==="paragraph"||n?.type==="text"?(n.raw+=(n.raw.endsWith(` 35`)?"":` 36`)+r.raw,n.text+=` 37`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if((r=this.tokenizer.fences(e))||(r=this.tokenizer.heading(e))||(r=this.tokenizer.hr(e))||(r=this.tokenizer.blockquote(e))||(r=this.tokenizer.list(e))||(r=this.tokenizer.html(e))){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type==="paragraph"||n?.type==="text"?(n.raw+=(n.raw.endsWith(` 38`)?"":` 39`)+r.raw,n.text+=` 40`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if((r=this.tokenizer.table(e))||(r=this.tokenizer.lheading(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{"number"==typeof(r=e.call({lexer:this},n))&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let s=t.at(-1);n&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(` 41`)?"":` 42`)+r.raw,s.text+=` 43`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type==="text"?(n.raw+=(n.raw.endsWith(` 44`)?"":` 45`)+r.raw,n.text+=` 46`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r=e,i=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(r));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(r));)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(r));)n=i[2]?i[2].length:0,r=r.slice(0,i.index+n)+"["+"a".repeat(i[0].length-n-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let s=!1,o="";for(;e;){let n;if(s||(o=""),s=!1,this.options.extensions?.inline?.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))continue;if((n=this.tokenizer.escape(e))||(n=this.tokenizer.tag(e))||(n=this.tokenizer.link(e))){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length);let r=t.at(-1);"text"===n.type&&r?.type==="text"?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if((n=this.tokenizer.emStrong(e,r,o))||(n=this.tokenizer.codespan(e))||(n=this.tokenizer.br(e))||(n=this.tokenizer.del(e))||(n=this.tokenizer.autolink(e))||!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{"number"==typeof(r=e.call({lexer:this},n))&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),s=!0;let r=t.at(-1);r?.type==="text"?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},ed=class{options;parser;constructor(e){this.options=e||i}space(e){return""}code({text:e,lang:t,escaped:n}
46){let r=(t||"").match(l.notSpaceStart)?.[0],i=e.replace(l.endingNewline,"")+` 47`;return r?'<pre><code class="language-'+ei(r)+'">'+(n?i:ei(i,!0))+`</code></pre> 48`:"<pre><code>"+(n?i:ei(i,!0))+`</code></pre> 49`}blockquote({tokens:e}){return`<blockquote> 50${this.parser.parse(e)}</blockquote> 51`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}> 52`}hr(e){return`<hr> 53`}list(e){let t=e.ordered,n=e.start,r="";for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+`> 54`+r+"</"+i+`> 55`}listitem(e){let t="";if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=n+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=n+" "+ei(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):t+=n+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li> 56`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p> 57`}table(e){let t="",n="";for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r="";for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n="";for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table> 58<thead> 59`+t+`</thead> 60`+r+`</table> 61`}tablerow({text:e}){return`<tr> 62${e}</tr> 63`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}> 64`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${ei(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=es(e);if(null===i)return r;let s='<a href="'+(e=i)+'"';return t&&(s+=' title="'+ei(t)+'"'),s+=">"+r+"</a>"}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=es(e);if(null===i)return ei(n);e=i;let s=`<img src="${e}" alt="${n}"`;return t&&(s+=` title="${ei(t)}"`),s+=">"}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:ei(e.text)}},eh=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ep=class e{options;renderer;textRenderer;constructor(e){this.options=e||i,this.options.renderer=this.options.renderer||new ed,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new eh}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(i.type)){n+=e||"";continue}}switch(i.type){case"space":n+=this.renderer.space(i);continue;case"hr":n+=this.renderer.hr(i);continue;case"heading":n+=this.renderer.heading(i);continue;case"code":n+=this.renderer.code(i);continue;case"table":n+=this.renderer.table(i);continue;case"blockquote":n+=this.renderer.blockquote(i);continue;case"list":n+=this.renderer.list(i);continue;case"html":n+=this.renderer.html(i);continue;case"def":n+=this.renderer.def(i);continue;case"paragraph":n+=this.renderer.paragraph(i);continue;case"text":{let s=i,o=this.renderer.text(s);for(;r+1<e.length&&"text"===e[r+1].type;)s=e[++r],o+=` 65`+this.renderer.text(s);t?n+=this.renderer.paragraph({type:"paragraph",raw:o,text:o,tokens:[{type:"text",raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n="";for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){n+=e||"";continue}}switch(i.type){case"escape":case"text":n+=t.text(i);break;case"html":n+=t.html(i);break;case"link":n+=t.link(i);break;case"image":n+=t.image(i);break;case"strong":n+=t.strong(i);break;case"em":n+=t.em(i);break;case"codespan":n+=t.codespan(i);break;case"br":n+=t.br(i);break;case"del":n+=t.del(i);break;default:{let e='Token with "'+i.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return n}},ef=class{options;block;constructor(e){this.options=e||i}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?ec.lex:ec.lexInline}provideParser(){return this.block?ep.parse:ep.parseInline}},eg=new class{defaults=r();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ep;Renderer=ed;TextRenderer=eh;Lexer=ec;Tokenizer=eu;Hooks=ef;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case"table":for(let e of r.header)n=n.concat(this.walkTokens(e.tokens,t));for(let e of r.rows)for(let r of e)n=n.concat(this.walkTokens(r.tokens,t));break;case"list":n=n.concat(this.walkTokens(r.items,t));break;default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};
65return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return!1===r&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new ed(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let r=e.renderer[n],i=t[n];t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new eu(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let r=e.tokenizer[n],i=t[n];t[n]=(...e)=>{let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new ef;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let r=e.hooks[n],i=t[n];ef.passThroughHooks.has(n)?t[n]=e=>{if(this.defaults.async&&ef.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await r.call(t,e);return i.call(t,n)})();let s=r.call(t,e);return i.call(t,s)}:t[n]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await r.apply(t,e);return!1===n&&(n=await i.apply(t,e)),n})();let n=r.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ec.lex(e,t??this.defaults)}parser(e,t){return ep.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},s=this.onError(!!i.silent,!!i.async);if(!0===this.defaults.async&&!1===r.async)return s(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return s(Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return s(Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await (i.hooks?await i.hooks.provideLexer():e?ec.lex:ec.lexInline)(n,i),s=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(s,i.walkTokens));let o=await (i.hooks?await i.hooks.provideParser():e?ep.parse:ep.parseInline)(s,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(s);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?ec.lex:ec.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?ep.parse:ep.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return s(e)}}}onError(e,t){return n=>{if(n.message+=` 66Please report this to https://github.com/markedjs/marked.`,e){let e="<p>An error occurred:</p><pre>"+ei(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function em(e,t){return eg.parse(e,t)}em.options=em.setOptions=function(e){return eg.setOptions(e),em.defaults=eg.defaults,i=em.defaults,em},em.getDefaults=r,em.defaults=i,em.use=function(...e){return eg.use(...e),em.defaults=eg.defaults,i=em.defaults,em},em.walkTokens=function(e,t){return eg.walkTokens(e,t)},em.parseInline=eg.parseInline,em.Parser=ep,em.parser=ep.parse,em.Renderer=ed,em.TextRenderer=eh,em.Lexer=ec,em.lexer=ec.lex,em.Tokenizer=eu,em.Hooks=ef,em.parse=em,em.o
66ptions,em.setOptions,em.use,em.walkTokens,em.parseInline,ep.parse,ec.lex},31969:(e,t,n)=>{n.d(t,{N:()=>r});function r(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var s=t.schedule(function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()},r);if(e.add(s),!i)return s}},32605:(e,t,n)=>{n.d(t,{Z:()=>function e(t,n,l){return(void 0===l&&(l=1/0),(0,a.T)(n))?e(function(e,s){return(0,r.T)(function(t,r){return n(e,t,s,r)})((0,i.Tg)(t(e,s)))},l):("number"==typeof n&&(l=n),(0,s.N)(function(e,n){var r,s,a,u,c,d,h,p,f;return r=l,a=[],u=0,c=0,d=!1,h=function(){!d||a.length||u||n.complete()},p=function(e){return u<r?f(e):a.push(e)},f=function(e){u++;var l=!1;(0,i.Tg)(t(e,c++)).subscribe((0,o._)(n,function(e){s?p(e):n.next(e)},function(){l=!0},void 0,function(){if(l)try{for(u--;a.length&&u<r;)!function(){var e=a.shift();f(e)}();h()}catch(e){n.error(e)}}))},e.subscribe((0,o._)(n,p,function(){d=!0,h()})),function(){}}))}});var r=n(27616),i=n(40562),s=n(43356),o=(n(31969),n(57304)),a=n(89605)},34076:(e,t,n)=>{n.d(t,{m:()=>s});var r=n(45738),i=n(73944);function s(e){i.f.setTimeout(function(){var t=r.$.onUnhandledError;if(t)t(e);else throw e})}},34629:(e,t,n)=>{n.d(t,{w:()=>d});var r=n(56530),i=n(60689),s=n(43356),o=n(40562),a=n(55755),l=n(57304),u=n(31969),c=(0,a.L)(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function d(e,t){var n=(0,i.v)(e)?{first:e}:"number"==typeof e?{each:e}:e,a=n.first,c=n.each,d=n.with,p=void 0===d?h:d,f=n.scheduler,g=void 0===f?null!=t?t:r.E:f,m=n.meta,v=void 0===m?null:m;if(null==a&&null==c)throw TypeError("No timeout provided.");return(0,s.N)(function(e,t){var n,r,i=null,s=0,d=function(e){r=(0,u.N)(t,g,function(){try{n.unsubscribe(),(0,o.Tg)(p({meta:v,lastValue:i,seen:s})).subscribe(t)}catch(e){t.error(e)}},e)};n=e.subscribe((0,l._)(t,function(e){null==r||r.unsubscribe(),s++,t.next(i=e),c>0&&d(c)},void 0,void 0,function(){(null==r?void 0:r.closed)||null==r||r.unsubscribe(),i=null})),s||d(null!=a?"number"==typeof a?a:a-g.now():c)})}function h(e){throw new c(e)}},37227:(e,t,n)=>{n.d(t,{D:()=>r});function r(e){return e}},38294:(e,t,n)=>{n.d(t,{t:()=>s});var r=n(87725),i=n(20773);function s(e,t,n){var s,o,a,l,u=!1;return e&&"object"==typeof e?(l=void 0===(s=e.bufferSize)?1/0:s,t=void 0===(o=e.windowTime)?1/0:o,u=void 0!==(a=e.refCount)&&a,n=e.scheduler):l=null!=e?e:1/0,(0,i.u)({connector:function(){return new r.m(l,t,n)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:u})}},40562:(e,t,n)=>{n.d(t,{Tg:()=>g});var r=n(70324),i=n(80853),s=n(99818),o=n(11713),a=n(54591),l=n(23461),u=n(23305),c=n(78443),d=n(55754),h=n(89605),p=n(34076),f=n(56360);function g(e){if(e instanceof o.c)return e;if(null!=e){var t,n,g,v,b;if((0,a.l)(e)){return t=e,new o.c(function(e){var n=t[f.s]();if((0,h.T)(n.subscribe))return n.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")})}if((0,i.X)(e)){return n=e,new o.c(function(e){for(var t=0;t<n.length&&!e.closed;t++)e.next(n[t]);e.complete()})}if((0,s.y)(e)){return g=e,new o.c(function(e){g.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,p.m)})}if((0,l.T)(e))return m(e);if((0,c.x)(e)){return v=e,new o.c(function(e){var t,n;try{for(var i=(0,r.Ju)(v),s=i.next();!s.done;s=i.next()){var o=s.value;if(e.next(o),e.closed)return}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}e.complete()})}if((0,d.U)(e)){return b=e,m((0,d.C)(b))}}throw(0,u.L)(e)}function m(e){return new o.c(function(t){(function(e,t){var n,i,s,o;return(0,r.sH)(this,void 0,void 0,function(){var a;return(0,r.YH)(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),n=(0,r.xN)(e),l.label=1;case 1:return[4,n.next()];case 2:if((i=l.sent()).done)return[3,4];if(a=i.value,t.next(a),t.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s={error:l.sent()},[3,11];
66case 6:if(l.trys.push([6,,9,10]),!(i&&!i.done&&(o=n.return)))return[3,8];return[4,o.call(n)];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})})(e,t).catch(function(e){return t.error(e)})})}},43356:(e,t,n)=>{n.d(t,{N:()=>i});var r=n(89605);function i(e){return function(t){if((0,r.T)(null==t?void 0:t.lift))return t.lift(function(t){try{return e(t,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}},43532:(e,t,n)=>{n.d(t,{Kn:()=>l,yU:()=>a,Uv:()=>u});var r=n(70324),i=n(89605),s=(0,n(55755).L)(function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(e,t){return t+1+") "+e.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}),o=n(86540),a=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e,t,n,o,a,l=this._parentage;if(l)if(this._parentage=null,Array.isArray(l))try{for(var u=(0,r.Ju)(l),d=u.next();!d.done;d=u.next())d.value.remove(this)}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=u.return)&&t.call(u)}finally{if(e)throw e.error}}else l.remove(this);var h=this.initialTeardown;if((0,i.T)(h))try{h()}catch(e){a=e instanceof s?e.errors:[e]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=(0,r.Ju)(p),g=f.next();!g.done;g=f.next()){var m=g.value;try{c(m)}catch(e){a=null!=a?a:[],e instanceof s?a=(0,r.fX)((0,r.fX)([],(0,r.zs)(a)),(0,r.zs)(e.errors)):a.push(e)}}}catch(e){n={error:e}}finally{try{g&&!g.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}if(a)throw new s(a)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)c(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!=(n=this._finalizers)?n:[]).push(e)}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&(0,o.o)(t,e)},t.prototype.remove=function(e){var n=this._finalizers;n&&(0,o.o)(n,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),l=a.EMPTY;function u(e){return e instanceof a||e&&"closed"in e&&(0,i.T)(e.remove)&&(0,i.T)(e.add)&&(0,i.T)(e.unsubscribe)}function c(e){(0,i.T)(e)?e():e.unsubscribe()}},43917:(e,t,n)=>{n.d(t,{w:()=>o});var r=n(43356),i=n(57304),s=n(99949);function o(){return(0,r.N)(function(e,t){e.subscribe((0,i._)(t,s.l))})}},45738:(e,t,n)=>{n.d(t,{$:()=>r});var r={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1}},47486:(e,t,n)=>{n.d(t,{Z:()=>o});var r=n(91559),i=n(43356),s=n(57304);function o(){return(0,i.N)(function(e,t){e.subscribe((0,s._)(t,function(e){return(0,r.gV)(e,t)}))})}},48663:(e,t,n)=>{n.d(t,{S:()=>s});var r=n(43356),i=n(57304);function s(e,t){var n;return(0,r.N)((n=arguments.length>=2,function(r,s){var o=n,a=t,l=0;r.subscribe((0,i._)(s,function(t){var n=l++;a=o?e(a,t,n):(o=!0,t),s.next(a)},void 0))}))}},49998:(e,t,n)=>{n.d(t,{h:()=>l});var r=n(63105),i=n(40562),s=n(2259),o=n(75380),a=n(63582);function l(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(0,o.lI)(e),l=(0,o.R0)(e,1/0);return e.length?1===e.length?(0,i.Tg)(e[0]):(0,r.U)(l)((0,a.H)(e,n)):s.w}},50782:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||("get"in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};
66Object.defineProperty(t,"__esModule",{value:!0}),t.Allow=t.MalformedJSON=t.PartialJSON=t.parseJSON=t.parse=void 0;let s=n(26e3);Object.defineProperty(t,"Allow",{enumerable:!0,get:function(){return s.Allow}}),i(n(26e3),t);class o extends Error{}t.PartialJSON=o;class a extends Error{}function l(e,t=s.Allow.ALL){if("string"!=typeof e)throw TypeError(`expecting str, got ${typeof e}`);if(!e.trim())throw Error(`${e} is empty`);return u(e.trim(),t)}t.MalformedJSON=a,t.parseJSON=l;let u=(e,t)=>{let n=e.length,r=0,i=e=>{throw new o(`${e} at position ${r}`)},l=e=>{throw new a(`${e} at position ${r}`)},u=()=>(f(),r>=n&&i("Unexpected end of input"),'"'===e[r])?c():"{"===e[r]?d():"["===e[r]?h():"null"===e.substring(r,r+4)||s.Allow.NULL&t&&n-r<4&&"null".startsWith(e.substring(r))?(r+=4,null):"true"===e.substring(r,r+4)||s.Allow.BOOL&t&&n-r<4&&"true".startsWith(e.substring(r))?(r+=4,!0):"false"===e.substring(r,r+5)||s.Allow.BOOL&t&&n-r<5&&"false".startsWith(e.substring(r))?(r+=5,!1):"Infinity"===e.substring(r,r+8)||s.Allow.INFINITY&t&&n-r<8&&"Infinity".startsWith(e.substring(r))?(r+=8,1/0):"-Infinity"===e.substring(r,r+9)||s.Allow._INFINITY&t&&1<n-r&&n-r<9&&"-Infinity".startsWith(e.substring(r))?(r+=9,-1/0):"NaN"===e.substring(r,r+3)||s.Allow.NAN&t&&n-r<3&&"NaN".startsWith(e.substring(r))?(r+=3,NaN):p(),c=()=>{let o=r,a=!1;for(r++;r<n&&('"'!==e[r]||a&&"\\"===e[r-1]);)a="\\"===e[r]&&!a,r++;if('"'==e.charAt(r))try{return JSON.parse(e.substring(o,++r-Number(a)))}catch(e){l(String(e))}else if(s.Allow.STR&t)try{return JSON.parse(e.substring(o,r-Number(a))+'"')}catch(t){return JSON.parse(e.substring(o,e.lastIndexOf("\\"))+'"')}i("Unterminated string literal")},d=()=>{r++,f();let o={};try{for(;"}"!==e[r];){if(f(),r>=n&&s.Allow.OBJ&t)return o;let i=c();f(),r++;try{let e=u();o[i]=e}catch(e){if(s.Allow.OBJ&t)return o;throw e}f(),","===e[r]&&r++}}catch(e){if(s.Allow.OBJ&t)return o;i("Expected '}' at end of object")}return r++,o},h=()=>{r++;let n=[];try{for(;"]"!==e[r];)n.push(u()),f(),","===e[r]&&r++}catch(e){if(s.Allow.ARR&t)return n;i("Expected ']' at end of array")}return r++,n},p=()=>{if(0===r){"-"===e&&l("Not sure what '-' is");try{return JSON.parse(e)}catch(n){if(s.Allow.NUM&t)try{return JSON.parse(e.substring(0,e.lastIndexOf("e")))}catch(e){}l(String(n))}}let o=r;for("-"===e[r]&&r++;e[r]&&-1===",]}".indexOf(e[r]);)r++;r!=n||s.Allow.NUM&t||i("Unterminated number literal");try{return JSON.parse(e.substring(o,r))}catch(t){"-"===e.substring(o,r)&&i("Not sure what '-' is");try{return JSON.parse(e.substring(o,e.lastIndexOf("e")))}catch(e){l(String(e))}}},f=()=>{for(;r<n&&" \n\r ".includes(e[r]);)r++};return u()};t.parse=l},51236:(e,t,n)=>{n.d(t,{j:()=>i});var r=n(43356);function i(e){return(0,r.N)(function(t,n){try{t.subscribe(n)}finally{n.add(e)}})}},52900:(e,t,n)=>{n.d(t,{G:()=>r});var r=(0,n(55755).L)(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})},53660:(e,t,n)=>{n.d(t,{p:()=>s});var r=n(43356),i=n(57304);function s(e,t){return(0,r.N)(function(n,r){var s=0;n.subscribe((0,i._)(r,function(n){return e.call(t,n,s++)&&r.next(n)}))})}},54591:(e,t,n)=>{n.d(t,{l:()=>s});var r=n(56360),i=n(89605);function s(e){return(0,i.T)(e[r.s])}},55151:(e,t,n)=>{n.d(t,{v:()=>r});let r=console},55754:(e,t,n)=>{n.d(t,{C:()=>s,U:()=>o});var r=n(70324),i=n(89605);function s(e){return(0,r.AQ)(this,arguments,function(){var t,n,i;return(0,r.YH)(this,function(s){switch(s.label){case 0:t=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,(0,r.N3)(t.read())];case 3:if(i=(n=s.sent()).value,!n.done)return[3,5];return[4,(0,r.N3)(void 0)];case 4:return[2,s.sent()];case 5:return[4,(0,r.N3)(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function o(e){return(0,i.T)(null==e?void 0:e.getReader)}},55755:(e,t,n)=>{n.d(t,{L:()=>r});function r(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}},56360:(e,t,n)=>{n.d(t,{s:()=>r});var r="function"==typeof Symbol&&Symbol.observable||"@@observable"},56530:(e,t,n)=>{n.d(t,{E:()=>i,b:()=>s});var r=n(8917),i=new(n(81120)).q(r.R),s=i}
66,57304:(e,t,n)=>{n.d(t,{_:()=>i});var r=n(70324);function i(e,t,n,r,i){return new s(e,t,n,r,i)}var s=function(e){function t(t,n,r,i,s,o){var a=e.call(this,t)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,a._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,a._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,a}return(0,r.C6)(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),n||null==(t=this.onFinalize)||t.call(this)}},t}(n(74087).vU)},58425:(e,t,n)=>{n.d(t,{HJ:()=>s,j:()=>i});var r=n(50782);function i(e){try{let t=r.parse(e);if(t&&"object"==typeof t&&!Array.isArray(t))return t;return{}}catch{return{}}}function s(e,t){return n=>Math.min(e*2**(n-1),t)}},58428:(e,t,n)=>{n.d(t,{n:()=>o});var r=n(40562),i=n(43356),s=n(57304);function o(e,t){return(0,i.N)(function(n,i){var o=null,a=0,l=!1,u=function(){return l&&!o&&i.complete()};n.subscribe((0,s._)(i,function(n){null==o||o.unsubscribe();var l=0,c=a++;(0,r.Tg)(e(n,c)).subscribe(o=(0,s._)(i,function(e){return i.next(t?t(n,e,c,l++):e)},function(){o=null,u()}))},function(){l=!0,u()}))})}},59173:(e,t,n)=>{let r;n.d(t,{Ik:()=>A});let i=Symbol("Let zodToJsonSchema decide on which parser to use"),s={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"};var o=n(44964);let a=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function l(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?a(t,e.currentPath):t.join("/")}}function u(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function c(e,t,n,r,i){e[t]=n,u(e,t,r,i)}function d(e,t){return k(e.type._def,t)}let h={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(void 0===r&&(r=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),r),ipv4Cidr:/^(?:(?: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])$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function p(e,t){let n={type:"string"};if(e.checks)for(let r of e.checks)switch(r.kind){case"min":c(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":c(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":m(n,"email",r.message,t);break;case"format:idn-email":m(n,"idn-email",r.message,t);break;case"pattern:zod":v(n,h.email,r.message,t)}break;case"url":m(n,"uri",r.message,t);break;case"uuid":m(n,"uuid",r.message,t);break;case"regex":v(n,r.regex,r.message,t);break;case"cuid":v(n,h.cuid,r.message,t);break;case"cuid2":v(n,h.cuid2,r.message,t);break;case"startsWith":v(n,RegExp(`^${f(r.value,t)}`),r.message,t);break;case"endsWith":v(n,RegExp(`${f(r.value,t)}$`),r.message,t);break;case"datetime":m(n,"date-time",r.message,t);break;case"date":m(n,"date",r.message,t);break;case"time":m(n,"time",r.message,t);break;case"duration":m(n,"duration",r.message,t);break;case"length":c(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t),c(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":v(n,RegExp(f(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&m(n,"ipv4",r.message,t),"v4"!==r.version&&m(n,"ipv6",r.message,t);break;case"base64url":v(n,h.base64url,r.message,t);break;case"jwt":v(n,h.jwt,r.message,t);break;case"cidr":"v6"!==r.version&&v(n,h.ipv4Cidr,r.message,t),"v4"!==r.version&&v(n,h.ipv6Cidr,r.message,t);break;case"emoji":v(n,h.emoji(),r.message,t);break;case"ulid":v(n,h.ulid,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":m(n,"binary",r.message,t);break;case"contentEncoding:base64":c(n,"contentEncoding","base64",r.message,t);break;case"pattern:zod":v(n,h.base64,r.message,t)}break;case"nanoid":v(n,h.nanoid,r.message,t)}return n}function f(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;
66n++)g.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}let g=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function m(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):c(e,"format",t,n,r)}function v(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:b(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):c(e,"pattern",b(t,r),n,r)}function b(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},r=n.i?e.source.toLowerCase():e.source,i="",s=!1,o=!1,a=!1;for(let e=0;e<r.length;e++){if(s){i+=r[e],s=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){a?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),a=!1):"-"===r[e+1]&&r[e+2]?.match(/[a-z]/)?(i+=r[e],a=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if("^"===r[e]){i+=`(^|(?<=[\r 67]))`;continue}else if("$"===r[e]){i+=`($|(?=[\r 68]))`;continue}}if(n.s&&"."===r[e]){i+=o?`${r[e]}\r 69`:`[${r[e]}\r 70]`;continue}i+=r[e],"\\"===r[e]?s=!0:o&&"]"===r[e]?o=!1:o||"["!==r[e]||(o=!0)}try{new RegExp(i)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function y(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===o.kY.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:k(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]})??l(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let n={type:"object",additionalProperties:k(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return n;if(e.keyType?._def.typeName===o.kY.ZodString&&e.keyType._def.checks?.length){let{type:r,...i}=p(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===o.kY.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===o.kY.ZodBranded&&e.keyType._def.type._def.typeName===o.kY.ZodString&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=d(e.keyType._def,t);return{...n,propertyNames:i}}return n}let E={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},T=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>k(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function k(e,t,n=!1){let r=t.seen.get(e);if(t.override){let s=t.override?.(e,t,r,n);if(s!==i)return s}if(r&&!n){let e=S(r,t);if(void 0!==e)return e}let s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);let a=((e,t,n)=>{switch(t){case o.kY.ZodString:return p(e,n);case o.kY.ZodNumber:var r,i,s,a,h,f,g,m,v,b=e,S=n;let w={type:"number"};if(!b.checks)return w;for(let e of b.checks)switch(e.kind){case"int":w.type="integer",u(w,"type",e.message,S);break;case"min":"jsonSchema7"===S.target?e.inclusive?c(w,"minimum",e.value,e.message,S):c(w,"exclusiveMinimum",e.value,e.message,S):(e.inclusive||(w.exclusiveMinimum=!0),c(w,"minimum",e.value,e.message,S));break;case"max":"jsonSchema7"===S.target?e.inclusive?c(w,"maximum",e.value,e.message,S):c(w,"exclusiveMaximum",e.value,e.message,S):(e.inclusive||(w.exclusiveMaximum=!0),c(w,"maximum",e.value,e.message,S));break;case"multipleOf":c(w,"multipleOf",e.value,e.message,S)}return w;case o.kY.ZodObject:return function(e,t){let n="openAi"===t.target,r={type:"object",properties:{}},i=[],s=e.shape();for(let e in s){let o=s[e];if(void 0===o||void 0===o._def)continue;let a=function(e){try{return e.isOptional()}catch{return!0}}(o);a&&n&&("ZodOptional"===o._def.typeName&&(o=o._def.innerType),o.isNullable()||(o=o.nullable()),a=!1);let l=k(o._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(r.properties[e]=l,a||i.push(e))}i.length&&(r.required=i);let o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return k(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(r.additionalProperties=o),r}(e,n);case o.kY.ZodBigInt:var A=e,I=n;let _={type:"integer",format:"int64"};if(!A.checks)return _;for(let e of A.checks)switch(e.kind){case"min":"jsonSchema7"===I.target?e.inclusive?c(_,"minimum",e.value,e.message,I):c(_,"exclusiveMinimum",e.value,e.message,I):(e.inclusive||(_.exclusiveMinimum=!0),c(_,"minimum",e.value,e.message,I));break;case"max":"jsonSchema7"===I.target?e.inclusive?c(_,"maximum",e.value,e.message,I):c(_,"exclusiveMaximum",e.value,e.message,I):(e.inclusive||(_.exclusiveMaximum=!0),c(_,"maximum",e.value,e.message,I));break;case"multipleOf":c(_,"multipleOf",e.value,e.message,I)}return _;case o.kY.ZodBoolean:return{type:"boolean"};
70case o.kY.ZodDate:return function e(t,n,r){let i=r??n.dateStrategy;if(Array.isArray(i))return{anyOf:i.map((r,i)=>e(t,n,r))};switch(i){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":var s=t,o=n;let a={type:"integer",format:"unix-time"};if("openApi3"===o.target)return a;for(let e of s.checks)switch(e.kind){case"min":c(a,"minimum",e.value,e.message,o);break;case"max":c(a,"maximum",e.value,e.message,o)}return a}}(e,n);case o.kY.ZodUndefined:return{not:l(n)};case o.kY.ZodNull:return"openApi3"===n.target?{enum:["null"],nullable:!0}:{type:"null"};case o.kY.ZodArray:var x=e,N=n;let C={type:"array"};return x.type?._def&&x.type?._def?.typeName!==o.kY.ZodAny&&(C.items=k(x.type._def,{...N,currentPath:[...N.currentPath,"items"]})),x.minLength&&c(C,"minItems",x.minLength.value,x.minLength.message,N),x.maxLength&&c(C,"maxItems",x.maxLength.value,x.maxLength.message,N),x.exactLength&&(c(C,"minItems",x.exactLength.value,x.exactLength.message,N),c(C,"maxItems",x.exactLength.value,x.exactLength.message,N)),C;case o.kY.ZodUnion:case o.kY.ZodDiscriminatedUnion:var R=e,O=n;if("openApi3"===O.target)return T(R,O);let L=R.options instanceof Map?Array.from(R.options.values()):R.options;if(L.every(e=>e._def.typeName in E&&(!e._def.checks||!e._def.checks.length))){let e=L.reduce((e,t)=>{let n=E[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(L.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=L.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===L.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:L.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(L.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:L.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return T(R,O);case o.kY.ZodIntersection:var P=e,M=n;let j=[k(P.left._def,{...M,currentPath:[...M.currentPath,"allOf","0"]}),k(P.right._def,{...M,currentPath:[...M.currentPath,"allOf","1"]})].filter(e=>!!e),D="jsonSchema2019-09"===M.target?{unevaluatedProperties:!1}:void 0,$=[];return j.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)$.push(...e.allOf),void 0===e.unevaluatedProperties&&(D=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:n,...r}=e;t=r}else D=void 0;$.push(t)}}),$.length?{allOf:$,...D}:void 0;case o.kY.ZodTuple:return r=e,i=n,r.rest?{type:"array",minItems:r.items.length,items:r.items.map((e,t)=>k(e._def,{...i,currentPath:[...i.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:k(r.rest._def,{...i,currentPath:[...i.currentPath,"additionalItems"]})}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((e,t)=>k(e._def,{...i,currentPath:[...i.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case o.kY.ZodRecord:return y(e,n);case o.kY.ZodLiteral:var B=e,U=n;let G=typeof B.value;return"bigint"!==G&&"number"!==G&&"boolean"!==G&&"string"!==G?{type:Array.isArray(B.value)?"array":"object"}:"openApi3"===U.target?{type:"bigint"===G?"integer":G,enum:[B.value]}:{type:"bigint"===G?"integer":G,const:B.value};case o.kY.ZodEnum:return{type:"string",enum:Array.from(e.values)};case o.kY.ZodNativeEnum:var z=e;let Y=z.values,H=Object.keys(z.values).filter(e=>"number"!=typeof Y[Y[e]]).map(e=>Y[e]),F=Array.from(new Set(H.map(e=>typeof e)));return{type:1===F.length?"string"===F[0]?"string":"number":["string","number"],enum:H};case o.kY.ZodNullable:var V=e,Z=n;if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(V.innerType._def.typeName)&&(!V.innerType._def.checks||!V.innerType._def.checks.length))return"openApi3"===Z.target?{type:E[V.innerType._def.typeName],nullable:!0}:{type:[E[V.innerType._def.typeName],"null"]};if("openApi3"===Z.target){let e=k(V.innerType._def,{...Z,currentPath:[...Z.currentPath]});return e&&"$ref"in e?{allOf:[e],nullable:!0}:e&&{...e,nullable:!0}}let X=k(V.innerType._def,{...Z,currentPath:[...Z.currentPath,"anyOf","0"]});return X&&{anyOf:[X,{type:"null"}]};case o.kY.ZodOptional:var K=e,q=n;if(q.currentPath.toString()===q.propertyPath?.toString())return k(K.innerType._def,q);let W=k(K.innerType._def,{...q,currentPath:[...q.currentPath,"anyOf","1"]});return W?{anyOf:[{not:l(q)},W]}:l(q);case o.kY.ZodMap:return s=e,"record"===(a=n).mapStrategy?y(s,a):{type:"array",maxItems:125,items:{type:"array",items:[k(s.keyType._def,{...a,currentPath:[...a.currentPath,"items","items","0"]})||l(a),k(s.valueType._def,{...a,currentPath:[...a.currentPath,"items","items","1"]})||l(a)],minItems:2,maxItems:2}};case o.kY.ZodSet:var J=e,Q=n;let ee={type:"array",uniqueItems:!0,items:k(J.valueType._def,{...Q,currentPath:[...Q.currentPath,"items"]})};return J.minSize&&c(ee,"minItems",J.minSize.value,J.minSize.message,Q),J.maxSize&&c(ee,"maxItems",J.maxSize.value,J.maxSize.message,Q),ee;case o.kY.ZodLazy:return()=>e.getter()._def;
70case o.kY.ZodPromise:return k(e.type._def,n);case o.kY.ZodNaN:case o.kY.ZodNever:return"openAi"===(h=n).target?void 0:{not:l({...h,currentPath:[...h.currentPath,"not"]})};case o.kY.ZodEffects:return f=e,"input"===(g=n).effectStrategy?k(f.schema._def,g):l(g);case o.kY.ZodAny:case o.kY.ZodUnknown:return l(n);case o.kY.ZodDefault:return m=e,v=n,{...k(m.innerType._def,v),default:m.defaultValue()};case o.kY.ZodBranded:return d(e,n);case o.kY.ZodReadonly:case o.kY.ZodCatch:return k(e.innerType._def,n);case o.kY.ZodPipeline:var et=e,en=n;if("input"===en.pipeStrategy)return k(et.in._def,en);if("output"===en.pipeStrategy)return k(et.out._def,en);let er=k(et.in._def,{...en,currentPath:[...en.currentPath,"allOf","0"]}),ei=k(et.out._def,{...en,currentPath:[...en.currentPath,"allOf",er?"1":"0"]});return{allOf:[er,ei].filter(e=>void 0!==e)};case o.kY.ZodFunction:case o.kY.ZodVoid:case o.kY.ZodSymbol:default:return}})(e,e.typeName,t),h="function"==typeof a?k(a(),t):a;if(h&&w(e,t,h),t.postProcess){let n=t.postProcess(h,e,t);return s.jsonSchema=h,n}return s.jsonSchema=h,h}let S=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:a(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),l(t);return"seen"===t.$refStrategy?l(t):void 0}},w=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),A=(e,t)=>{let n=(e=>{let t=(e=>"string"==typeof e?{...s,name:e}:{...s,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}})(t),r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:k(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??l(n)}),{}):void 0,i="string"==typeof t?t:t?.nameStrategy==="title"?void 0:t?.name,o=k(e._def,void 0===i?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??l(n),a="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==a&&(o.title=a),n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));let u=void 0===i?r?{...o,[n.definitionPath]:r}:o:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,i].join("/"),[n.definitionPath]:{...r,[i]:o}};return"jsonSchema7"===n.target?u.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===n.target||"openAi"===n.target)&&(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in u||"oneOf"in u||"allOf"in u||"type"in u&&Array.isArray(u.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),u}},59666:(e,t,n)=>{n.d(t,{$e:()=>L,Bx:()=>K,Qk:()=>P,rV:()=>eP});var r=n(44964),i=n(35575);let s=r.Ik({name:r.Yj(),arguments:r.Yj()}),o=r.Ik({id:r.Yj(),type:r.eu("function"),function:s,encryptedValue:r.Yj().optional()}),a=r.Ik({id:r.Yj(),role:r.Yj(),content:r.Yj().optional(),name:r.Yj().optional(),encryptedValue:r.Yj().optional()}),l=r.Ik({type:r.eu("text"),text:r.Yj()}),u=r.Ik({type:r.eu("data"),value:r.Yj(),mimeType:r.Yj()}),c=r.Ik({type:r.eu("url"),value:r.Yj(),mimeType:r.Yj().optional()}),d=r.gM("type",[u,c]),h=r.Ik({type:r.eu("image"),source:d,metadata:r.L5().optional()}),p=r.Ik({type:r.eu("audio"),source:d,metadata:r.L5().optional()}),f=r.Ik({type:r.eu("video"),source:d,metadata:r.L5().optional()}),g=r.Ik({type:r.eu("document"),source:d,metadata:r.L5().optional()}),m=r.Ik({type:r.eu("binary"),mimeType:r.Yj(),id:r.Yj().optional(),url:r.Yj().optional(),data:r.Yj().optional(),filename:r.Yj().optional()}),v=(e,t)=>
70{e.id||e.url||e.data||t.addIssue({code:i.eq.custom,message:"BinaryInputContent requires at least one of id, url, or data.",path:["id"]})};m.superRefine((e,t)=>{v(e,t)});let b=r.gM("type",[l,h,p,f,g,m]).superRefine((e,t)=>{"binary"===e.type&&v(e,t)}),y=a.extend({role:r.eu("developer"),content:r.Yj()}),E=a.extend({role:r.eu("system"),content:r.Yj()}),T=a.extend({role:r.eu("assistant"),content:r.Yj().optional(),toolCalls:r.YO(o).optional()}),k=a.extend({role:r.eu("user"),content:r.KC([r.Yj(),r.YO(b)])}),S=r.Ik({id:r.Yj(),content:r.Yj(),role:r.eu("tool"),toolCallId:r.Yj(),error:r.Yj().optional(),encryptedValue:r.Yj().optional()}),w=r.Ik({id:r.Yj(),role:r.eu("activity"),activityType:r.Yj(),content:r.g1(r.bz())}),A=r.Ik({id:r.Yj(),role:r.eu("reasoning"),content:r.Yj(),encryptedValue:r.Yj().optional()}),I=r.gM("role",[y,E,T,k,S,w,A]);r.KC([r.eu("developer"),r.eu("system"),r.eu("assistant"),r.eu("user"),r.eu("tool"),r.eu("activity"),r.eu("reasoning")]);let _=r.Ik({description:r.Yj(),value:r.Yj()}),x=r.Ik({name:r.Yj(),description:r.Yj(),parameters:r.bz(),metadata:r.g1(r.bz()).optional()}),N=r.Ik({id:r.Yj(),reason:r.Yj(),message:r.Yj().optional(),toolCallId:r.Yj().optional(),responseSchema:r.g1(r.bz()).optional(),expiresAt:r.Yj().optional(),metadata:r.g1(r.bz()).optional()}),C=r.Ik({interruptId:r.Yj(),status:r.k5(["resolved","cancelled"]),payload:r.bz().optional()}),R=r.Ik({threadId:r.Yj(),runId:r.Yj(),parentRunId:r.Yj().optional(),state:r.bz(),messages:r.YO(I),tools:r.YO(x),context:r.YO(_),forwardedProps:r.bz(),resume:r.YO(C).optional()}),O=r.bz();var L=class extends Error{constructor(e){super(e)}},P=class extends L{constructor(){super("Connect not implemented. This method is not supported by the current agent.")}};let M=r.Ik({name:r.Yj(),description:r.Yj().optional()}),j=r.Ik({name:r.Yj().optional(),type:r.Yj().optional(),description:r.Yj().optional(),version:r.Yj().optional(),provider:r.Yj().optional(),documentationUrl:r.Yj().optional(),metadata:r.g1(r.L5()).optional()}),D=r.Ik({streaming:r.zM().optional(),websocket:r.zM().optional(),httpBinary:r.zM().optional(),pushNotifications:r.zM().optional(),resumable:r.zM().optional()}),$=r.Ik({supported:r.zM().optional(),items:r.YO(x).optional(),parallelCalls:r.zM().optional(),clientProvided:r.zM().optional()}),B=r.Ik({structuredOutput:r.zM().optional(),supportedMimeTypes:r.YO(r.Yj()).optional()}),U=r.Ik({snapshots:r.zM().optional(),deltas:r.zM().optional(),memory:r.zM().optional(),persistentState:r.zM().optional()}),G=r.Ik({supported:r.zM().optional(),delegation:r.zM().optional(),handoffs:r.zM().optional(),subAgents:r.YO(M).optional()}),z=r.Ik({supported:r.zM().optional(),streaming:r.zM().optional(),encrypted:r.zM().optional()}),Y=r.Ik({image:r.zM().optional(),audio:r.zM().optional(),video:r.zM().optional(),pdf:r.zM().optional(),file:r.zM().optional()}),H=r.Ik({image:r.zM().optional(),audio:r.zM().optional()}),F=r.Ik({input:Y.optional(),output:H.optional()}),V=r.Ik({codeExecution:r.zM().optional(),sandboxed:r.zM().optional(),maxIterations:r.ai().optional(),maxExecutionTime:r.ai().optional()}),Z=r.Ik({supported:r.zM().optional(),approvals:r.zM().optional(),interventions:r.zM().optional(),feedback:r.zM().optional(),interrupts:r.zM().optional(),approveWithEdits:r.zM().optional()});r.Ik({identity:j.optional(),transport:D.optional(),tools:$.optional(),output:B.optional(),state:U.optional(),multiAgent:G.optional(),reasoning:z.optional(),multimodal:F.optional(),execution:V.optional(),humanInTheLoop:Z.optional(),custom:r.g1(r.L5()).optional()});let X=r.KC([r.eu("developer"),r.eu("system"),r.eu("assistant"),r.eu("user")]),K=function(e){return e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.STATE_SNAPSHOT="STATE_
70SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.ACTIVITY_SNAPSHOT="ACTIVITY_SNAPSHOT",e.ACTIVITY_DELTA="ACTIVITY_DELTA",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e.REASONING_START="REASONING_START",e.REASONING_MESSAGE_START="REASONING_MESSAGE_START",e.REASONING_MESSAGE_CONTENT="REASONING_MESSAGE_CONTENT",e.REASONING_MESSAGE_END="REASONING_MESSAGE_END",e.REASONING_MESSAGE_CHUNK="REASONING_MESSAGE_CHUNK",e.REASONING_END="REASONING_END",e.REASONING_ENCRYPTED_VALUE="REASONING_ENCRYPTED_VALUE",e}({}),q=r.Ik({type:r.fc(K),timestamp:r.ai().optional(),rawEvent:r.bz().optional()}).passthrough(),W=q.extend({type:r.eu(K.TEXT_MESSAGE_START),messageId:r.Yj(),role:X.default("assistant"),name:r.Yj().optional()}),J=q.extend({type:r.eu(K.TEXT_MESSAGE_CONTENT),messageId:r.Yj(),delta:r.Yj()}),Q=q.extend({type:r.eu(K.TEXT_MESSAGE_END),messageId:r.Yj()}),ee=q.extend({type:r.eu(K.TEXT_MESSAGE_CHUNK),messageId:r.Yj().optional(),role:X.optional(),delta:r.Yj().optional(),name:r.Yj().optional()}),et=q.extend({type:r.eu(K.THINKING_TEXT_MESSAGE_START)}),en=J.omit({messageId:!0,type:!0}).extend({type:r.eu(K.THINKING_TEXT_MESSAGE_CONTENT)}),er=q.extend({type:r.eu(K.THINKING_TEXT_MESSAGE_END)}),ei=q.extend({type:r.eu(K.TOOL_CALL_START),toolCallId:r.Yj(),toolCallName:r.Yj(),parentMessageId:r.Yj().optional()}),es=q.extend({type:r.eu(K.TOOL_CALL_ARGS),toolCallId:r.Yj(),delta:r.Yj()}),eo=q.extend({type:r.eu(K.TOOL_CALL_END),toolCallId:r.Yj()}),ea=q.extend({messageId:r.Yj(),type:r.eu(K.TOOL_CALL_RESULT),toolCallId:r.Yj(),content:r.Yj(),role:r.eu("tool").optional()}),el=q.extend({type:r.eu(K.TOOL_CALL_CHUNK),toolCallId:r.Yj().optional(),toolCallName:r.Yj().optional(),parentMessageId:r.Yj().optional(),delta:r.Yj().optional()}),eu=q.extend({type:r.eu(K.THINKING_START),title:r.Yj().optional()}),ec=q.extend({type:r.eu(K.THINKING_END)}),ed=q.extend({type:r.eu(K.STATE_SNAPSHOT),snapshot:O}),eh=q.extend({type:r.eu(K.STATE_DELTA),delta:r.YO(r.bz())}),ep=q.extend({type:r.eu(K.MESSAGES_SNAPSHOT),messages:r.YO(I)}),ef=q.extend({type:r.eu(K.ACTIVITY_SNAPSHOT),messageId:r.Yj(),activityType:r.Yj(),content:r.g1(r.bz()),replace:r.zM().optional().default(!0)}),eg=q.extend({type:r.eu(K.ACTIVITY_DELTA),messageId:r.Yj(),activityType:r.Yj(),patch:r.YO(r.bz())}),em=q.extend({type:r.eu(K.RAW),event:r.bz(),source:r.Yj().optional()}),ev=q.extend({type:r.eu(K.CUSTOM),name:r.Yj(),value:r.bz()}),eb=q.extend({type:r.eu(K.RUN_STARTED),threadId:r.Yj(),runId:r.Yj(),parentRunId:r.Yj().optional(),input:R.optional()}),ey=r.Ik({type:r.eu("success")}).strict(),eE=r.Ik({type:r.eu("interrupt"),interrupts:r.YO(N).min(1)}).strict(),eT=r.gM("type",[ey,eE]),ek=q.extend({type:r.eu(K.RUN_FINISHED),threadId:r.Yj(),runId:r.Yj(),result:r.bz().optional(),outcome:eT.nullable().optional().transform(e=>e??void 0)}),eS=q.extend({type:r.eu(K.RUN_ERROR),message:r.Yj(),code:r.Yj().optional()}),ew=q.extend({type:r.eu(K.STEP_STARTED),stepName:r.Yj()}),eA=q.extend({type:r.eu(K.STEP_FINISHED),stepName:r.Yj()}),eI=r.KC([r.eu("tool-call"),r.eu("message")]),e_=q.extend({type:r.eu(K.REASONING_START),messageId:r.Yj()}),ex=q.extend({type:r.eu(K.REASONING_MESSAGE_START),messageId:r.Yj(),role:r.eu("reasoning")}),eN=q.extend({type:r.eu(K.REASONING_MESSAGE_CONTENT),messageId:r.Yj(),delta:r.Yj()}),eC=q.extend({type:r.eu(K.REASONING_MESSAGE_END),messageId:r.Yj()}),eR=q.extend({type:r.eu(K.REASONING_MESSAGE_CHUNK),messageId:r.Yj().optional(),delta:r.Yj().optional()}),eO=q.extend({type:r.eu(K.REASONING_END),messageId:r.Yj()}),eL=q.extend({type:r.eu(K.REASONING_ENCRYPTED_VALUE),subtype:eI,entityId:r.Yj(),encryptedValue:r.Yj()}),eP=r.gM("type",[W,J,Q,ee,eu,ec,et,en,er,ei,es,eo,el,ea,ed,eh,ep,ef,eg,em,ev,eb,ek,eS,ew,eA,e_,ex,eN,eC,eR,eO,eL])},60689:(e,t,n)=>{n.d(t,{v:()=>r});function r(e){return e instanceof Date&&!isNaN(e)}},63105:(e,t,n)=>{n.d(t,{U:()=>s});var r=n(32605),i=n(37227);function s(e){return void 0===e&&(e=1/0),(0,r.Z)(i.D,e)}},63457:(e,t,n)=>{n.d(t,{E:()=>c});var r=n(70324),i=n(43356),s=n(57304),o=n(40562),a=n(37227),l=n(99949),u=n(75380);function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(0,u.ms)(e);return(0,i.N)(function(t,i){for(var u=e.length,c=Array(u),d=e.map(function(){return!1}),h=!1,p=function(t){(0,o.Tg)(e[t]).subscribe((0,s._)(i,function(e){c[t]=e,!h&&!d[t]&&(
70d[t]=!0,(h=d.every(a.D))&&(d=null))},l.l))},f=0;f<u;f++)p(f);t.subscribe((0,s._)(i,function(e){if(h){var t=(0,r.fX)([e],(0,r.zs)(c));i.next(n?n.apply(void 0,(0,r.fX)([],(0,r.zs)(t))):t)}}))})}},63582:(e,t,n)=>{n.d(t,{H:()=>y});var r=n(40562),i=n(94119),s=n(43356);function o(e,t){return void 0===t&&(t=0),(0,s.N)(function(n,r){r.add(e.schedule(function(){return n.subscribe(r)},t))})}var a=n(11713),l=n(659),u=n(89605),c=n(31969);function d(e,t){if(!e)throw Error("Iterable cannot be null");return new a.c(function(n){(0,c.N)(n,t,function(){var r=e[Symbol.asyncIterator]();(0,c.N)(n,t,function(){r.next().then(function(e){e.done?n.complete():n.next(e.value)})},0,!0)})})}var h=n(54591),p=n(99818),f=n(80853),g=n(78443),m=n(23461),v=n(23305),b=n(55754);function y(e,t){return t?function(e,t){if(null!=e){if((0,h.l)(e))return(0,r.Tg)(e).pipe(o(t),(0,i.Q)(t));if((0,f.X)(e))return new a.c(function(n){var r=0;return t.schedule(function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())})});if((0,p.y)(e))return(0,r.Tg)(e).pipe(o(t),(0,i.Q)(t));if((0,m.T)(e))return d(e,t);if((0,g.x)(e))return new a.c(function(n){var r;return(0,c.N)(n,t,function(){r=e[l.l](),(0,c.N)(n,t,function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){n.error(e);return}i?n.complete():n.next(t)},0,!0)}),function(){return(0,u.T)(null==r?void 0:r.return)&&r.return()}});if((0,b.U)(e))return d((0,b.C)(e),t)}throw(0,v.L)(e)}(e,t):(0,r.Tg)(e)}},63806:(e,t,n)=>{function r(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}catch{return!1}}function i(e){if("string"!=typeof e)return;let t=e.trim();return t.length>0?t:void 0}function s(e){return"number"==typeof e&&Number.isSafeInteger(e)&&e>=0}function o(e){if(!r(e)||1!==e.schemaVersion)return;let t=function(e){if(!r(e))return;let t=i(e.organizationName),n=i(e.projectName);if(void 0!==t&&void 0!==n)return{organizationName:t,projectName:n}}(e.identity),n=function(e){if(!r(e))return;let t=i(e.code),n=i(e.label);if(void 0!==t&&void 0!==n)return{code:t,label:n}}(e.plan),o=function(e){if(r(e))switch(e.state){case"valid":case"none":case"expired":case"unknown":return{state:e.state};default:return}}(e.license),a=function(e){if(!r(e))return;let t=function(e){switch(e){case"manage_plan":case"renew":case"enable_intelligence":return e;default:return}}(e.kind),n=function(e){let t,n=i(e);if(void 0===n||n.includes("?")||n.includes("#"))return;let r=n.indexOf("://");if(r<1)return;let s=n.slice(r+3),o=s.indexOf("/");if((-1===o?s:s.slice(0,o)).includes("@"))return;try{t=new URL(n)}catch{return}if(0===t.hostname.length||t.username||t.password)return;if("https:"===t.protocol)return n;let a="localhost"===t.hostname||"127.0.0.1"===t.hostname||"[::1]"===t.hostname;if("http:"===t.protocol&&a)return n}(e.url);if(void 0!==t&&void 0!==n)return{kind:t,url:n}}(e.action),l=function(e){if(!r(e))return;let t=function(e){if(r(e)){if("finite"===e.kind){if("number"!=typeof e.value||!Number.isSafeInteger(e.value)||e.value<1)return;return{kind:"finite",value:e.value}}if("unlimited"===e.kind)return{kind:"unlimited"};if("unknown"===e.kind)return{kind:"unknown"}}}(e.limit),n=e.used;if(!s(n)||void 0===t)return;let i=function(e,t){try{let n=Object.getOwnPropertyDescriptor(e,t);return void 0!==n&&"value"in n?n.value:void 0}catch{return}}(e,"expiringSoonCount"),o=s(i)?i:void 0;return{used:n,limit:t,...void 0===o?{}:{expiringSoonCount:o}}}(e.usage);return{schemaVersion:1,...void 0===t?{}:{identity:t},...void 0===n?{}:{plan:n},...void 0===o?{}:{license:o},...void 0===a?{}:{action:a},...void 0===l?{}:{usage:l}}}n.d(t,{f:()=>o})},63902:(e,t,n)=>{n.d(t,{F:()=>o});var r=n(37227),i=n(43356),s=n(57304);function o(e,t){return void 0===t&&(t=r.D),e=null!=e?e:a,(0,i.N)(function(n,r){var i,o=!0;n.subscribe((0,s._)(r,function(n){var s=t(n);(o||!e(i,s))&&(o=!1,i=s,r.next(n))}))})}function a(e,t){return e===t}},65048:(e,t,n)=>{n.d(t,{$:()=>s});var r=n(11713),i=n(89605);function s(e,t){var n=(0,i.T)(e)?e:function(){return e},s=function(e){return e.error(n())};return new r.c(t?function(e){return t.schedule(s,0,e)}:s)}},68218:(e,t,n)=>{n.d(t,{R:()=>i,v:()=>r});let r="sse",i="intelligence"}
70,68352:(e,t,n)=>{n.d(t,{Y:()=>s,l:()=>o});var r=n(45738),i=null;function s(e){if(r.$.useDeprecatedSynchronousErrorHandling){var t=!i;if(t&&(i={errorThrown:!1,error:null}),e(),t){var n=i,s=n.errorThrown,o=n.error;if(i=null,s)throw o}}else e()}function o(e){r.$.useDeprecatedSynchronousErrorHandling&&i&&(i.errorThrown=!0,i.error=e)}},70441:(e,t,n)=>{n.d(t,{W:()=>function e(t){return(0,s.N)(function(n,s){var o,a=null,l=!1;a=n.subscribe((0,i._)(s,void 0,void 0,function(i){o=(0,r.Tg)(t(i,e(t)(n))),a?(a.unsubscribe(),a=null,o.subscribe(s)):l=!0})),l&&(a.unsubscribe(),a=null,o.subscribe(s))})}});var r=n(40562),i=n(57304),s=n(43356)},72984:(e,t,n)=>{let r;function i(e,...t){return"function"==typeof e?e(...t):e}n.d(t,{xG:()=>w});var s=class{#e=!0;#t;#n;#r;#i;#s;#o;#a;#l=0;#u=5;#c=!1;#d=!1;#h=null;#p=()=>{this.debugLog("Connected to event bus"),this.#s=!0,this.#c=!1,this.debugLog("Emitting queued events",this.#i),this.#i.forEach(e=>this.emitEventToBus(e)),this.#i=[],this.stopConnectLoop(),this.#n().removeEventListener("tanstack-connect-success",this.#p)};#f=()=>{if(this.#l<this.#u){this.#l++,this.dispatchCustomEvent("tanstack-connect",{});return}this.#n().removeEventListener("tanstack-connect",this.#f),this.#d=!0,this.debugLog("Max retries reached, giving up on connection"),this.stopConnectLoop()};#g=()=>{this.#c||(this.#c=!0,this.#n().addEventListener("tanstack-connect-success",this.#p),this.#f())};constructor({pluginId:e,debug:t=!1,enabled:n=!0,reconnectEveryMs:r=300}){this.#t=e,this.#e=n,this.#n=this.getGlobalTarget,this.#r=t,this.debugLog(" Initializing event subscription for plugin",this.#t),this.#i=[],this.#s=!1,this.#d=!1,this.#o=null,this.#a=r}startConnectLoop(){null!==this.#o||this.#s||(this.debugLog(`Starting connect loop (every ${this.#a}ms)`),this.#o=setInterval(this.#f,this.#a))}stopConnectLoop(){this.#c=!1,null!==this.#o&&(clearInterval(this.#o),this.#o=null,this.#i=[],this.debugLog("Stopped connect loop"))}debugLog(...e){this.#r&&console.log(`ð´ [tanstack-devtools:${this.#t}-plugin]`,...e)}getGlobalTarget(){if("undefined"!=typeof globalThis&&globalThis.__TANSTACK_EVENT_TARGET__)return this.debugLog("Using global event target"),globalThis.__TANSTACK_EVENT_TARGET__;if("undefined"!=typeof window&&void 0!==window.addEventListener)return this.debugLog("Using window as event target"),window;let e="undefined"!=typeof EventTarget?new EventTarget:void 0;return void 0===e||void 0===e.addEventListener?(this.debugLog("No event mechanism available, running in non-web environment"),{addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!1}):(this.debugLog("Using new EventTarget as fallback"),e)}getPluginId(){return this.#t}dispatchCustomEventShim(e,t){try{let n=new Event(e,{detail:t});this.#n().dispatchEvent(n)}catch(e){this.debugLog("Failed to dispatch shim event")}}dispatchCustomEvent(e,t){try{this.#n().dispatchEvent(new CustomEvent(e,{detail:t}))}catch(n){this.dispatchCustomEventShim(e,t)}}emitEventToBus(e){this.debugLog("Emitting event to client bus",e),this.dispatchCustomEvent("tanstack-dispatch-event",e)}createEventPayload(e,t){return{type:`${this.#t}:${e}`,payload:t,pluginId:this.#t}}emit(e,t){if(!this.#e)return void this.debugLog("Event bus client is disabled, not emitting event",e,t);if(this.#h&&(this.debugLog("Emitting event to internal event target",e,t),this.#h.dispatchEvent(new CustomEvent(`${this.#t}:${e}`,{detail:this.createEventPayload(e,t)}))),this.#d)return void this.debugLog("Previously failed to connect, not emitting to bus");if(!this.#s){this.debugLog("Bus not available, will be pushed as soon as connected"),this.#i.push(this.createEventPayload(e,t)),"undefined"==typeof CustomEvent||this.#c||(this.#g(),this.startConnectLoop());return}return this.emitEventToBus(this.createEventPayload(e,t))}on(e,t,n){let r=n?.withEventTarget??!1,i=`${this.#t}:${e}`;if(r&&(this.#h||(this.#h=new EventTarget),this.#h.addEventListener(i,e=>{t(e.detail)})),!this.#e)return this.debugLog("Event bus client is disabled, not registering event",i),()=>{};let s=e=>{this.debugLog("Received event from bus",e.detail),t(e.detail)};return this.#n().addEventListener(i,s),this.debugLog("Registered event to bus",i),()=>{r&&this.#h?.removeEventListener(i,s),this.#n().removeEventListener(i,s)}}onAll(e){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let t=t=>{e(t.detail)};return this.#n().addEventListener("tanstack-devtools-global",t),()=>this.#n().removeEventListener("tanstack-devtools-global",t)}onAllPluginEvents(e){if(!this.#e)return this.debugLog("Event bus client is disabled, not registering event"),()=>{};let t=t=>{let n=t.detail;this.#t&&n.pluginId!==this.#t||e(n)};return this.#n().addEventListener("tanstack-devtools-global",t),()=>this.#n().removeEventListener("tanstack-devtools-global",t)}};let o=new Map;function a(e){if(void 0!==e)try{return JSON.parse(JSON.stringify(e))}catch{return null}}let l=new class extends s{constructor(e){super({pluginId:"pacer",debug:e?.debug,reconnectEveryMs:1e3})}};var u=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(u||{});
70function c(e,t,n){let r="object"==typeof e,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}let d=[],h=0,{link:p,unlink:f,propagate:g,checkDirty:m,shallowPropagate:v}=function({update:e,notify:t,unwatched:n}){return{link:function(e,t,n){let r=t.depsTail;if(void 0!==r&&r.dep===e)return;let i=void 0!==r?r.nextDep:t.deps;if(void 0!==i&&i.dep===e){i.version=n,t.depsTail=i;return}let s=e.subsTail;if(void 0!==s&&s.version===n&&s.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:s,nextSub:void 0};void 0!==i&&(i.prevDep=o),void 0!==r?r.nextDep=o:t.deps=o,void 0!==s?s.nextSub=o:e.subs=o},unlink:function(e,t=e.sub){let r=e.dep,i=e.prevDep,s=e.nextDep,o=e.nextSub,a=e.prevSub;return void 0!==s?s.prevDep=i:t.depsTail=i,void 0!==i?i.nextDep=s:t.deps=s,void 0!==o?o.prevSub=a:r.subsTail=a,void 0!==a?a.nextSub=o:void 0===(r.subs=o)&&n(r),s},propagate:function(e){let n,r=e.nextSub;e:for(;;){let i=e.sub,s=i.flags;if(60&s?12&s?4&s?!(48&s)&&function(e,t){let n=t.depsTail;for(;void 0!==n;){if(n===e)return!0;n=n.prevDep}return!1}(e,i)?(i.flags=40|s,s&=1):s=0:i.flags=-9&s|32:s=0:i.flags=32|s,2&s&&t(i),1&s){let t=i.subs;if(void 0!==t){let i=(e=t).nextSub;void 0!==i&&(n={value:r,prev:n},r=i);continue}}if(void 0!==(e=r)){r=e.nextSub;continue}for(;void 0!==n;
70)if(e=n.value,n=n.prev,void 0!==e){r=e.nextSub;continue e}break}},checkDirty:function(t,n){let i,s=0,o=!1;e:for(;;){let a=t.dep,l=a.flags;if(16&n.flags)o=!0;else if((17&l)==17){if(e(a)){let e=a.subs;void 0!==e.nextSub&&r(e),o=!0}}else if((33&l)==33){(void 0!==t.nextSub||void 0!==t.prevSub)&&(i={value:t,prev:i}),t=a.deps,n=a,++s;continue}if(!o){let e=t.nextDep;if(void 0!==e){t=e;continue}}for(;s--;){let s=n.subs,a=void 0!==s.nextSub;if(a?(t=i.value,i=i.prev):t=s,o){if(e(n)){a&&r(s),n=t.sub;continue}o=!1}else n.flags&=-33;n=t.sub;let l=t.nextDep;if(void 0!==l){t=l;continue e}}return o}},shallowPropagate:r};function r(e){do{let n=e.sub,r=n.flags;(48&r)==32&&(n.flags=16|r,(6&r)==2&&t(n))}while(void 0!==(e=e.nextSub))}}({update:e=>e._update(),notify(e){d[y++]=e,e.flags&=~u.Watching},unwatched(e){void 0!==e.depsTail&&(e.depsTail=void 0,e.flags=u.Mutable|u.Dirty,E(e))}}),b=0,y=0;function E(e){let t=e.depsTail,n=void 0!==t?t.nextDep:e.deps;for(;void 0!==n;)n=f(n,e)}class T{constructor(e){this.atom=function(e,t){let n="function"==typeof e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?u.None:u.Mutable,get:()=>(void 0!==r&&p(i,r,h),i._snapshot),subscribe(e){let t=c(e),n={current:!1},s=function(e){let t=()=>{let t=r;r=n,++h,n.depsTail=void 0,n.flags=u.Watching|u.RecursedCheck;try{return e()}finally{r=t,n.flags&=~u.RecursedCheck,E(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:u.Watching|u.RecursedCheck,notify(){let e=this.flags;e&u.Dirty||e&u.Pending&&m(this.deps,this)?t():this.flags=u.Watching},stop(){this.flags=u.None,this.depsTail=void 0,E(this)}};return t(),n}(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{s.stop()}}},_update(t){let s=r,o=(void 0)??Object.is;if(n)r=i,++h,i.depsTail=void 0;else if(void 0===t)return!1;n&&(i.flags=u.Mutable|u.RecursedCheck);try{let r=i._snapshot,s="function"==typeof t?t(r):void 0===t&&n?e(r):t;if(void 0===r||!o(r,s))return i._snapshot=s,!0;return!1}finally{r=s,n&&(i.flags&=~u.RecursedCheck),E(i)}}};return n?(i.flags=u.Mutable|u.Dirty,i.get=function(){let e=i.flags;if(e&u.Dirty||e&u.Pending&&m(i.deps,i)){if(i._update()){let e=i.subs;void 0!==e&&v(e)}}else e&u.Pending&&(i.flags=e&~u.Pending);return void 0!==r&&p(i,r,h),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;if(void 0!==e&&(g(e),v(e),1)){for(;b<y;){let e=d[b];d[b++]=void 0,e.notify()}b=0,y=0}}},i}(e)}setState(e){this.atom.set(e)}get state(){return this.atom.get()}get(){return this.state}subscribe(e){return this.atom.subscribe(c(e))}}function k(){return{executionCount:0,isPending:!1,lastArgs:void 0,lastExecutionTime:0,nextExecutionTime:0,status:"idle",maybeExecuteCount:0}}let S={enabled:!0,leading:!0,trailing:!0,wait:0};var w=class{#m;constructor(e,t){this.fn=e,this.store=new T(k()),this.setOptions=e=>{this.options={...this.options,...e},this.#v()||this.cancel()},this.maybeExecute=(...e)=>{this.#b({maybeExecuteCount:this.store.state.maybeExecuteCount+1});let t=Date.now(),n=t-this.store.state.lastExecutionTime,r=this.#y();if(this.options.leading&&n>=r)this.#E(...e);else if(this.#b({lastArgs:e}),!this.#m&&this.options.trailing){let e=r-(this.store.state.lastExecutionTime?t-this.store.state.lastExecutionTime:0);this.#b({isPending:!0}),this.#m=setTimeout(()=>{let{lastArgs:e}=this.store.state;void 0!==e&&this.#E(...e)},e)}},this.flush=()=>{this.store.state.isPending&&this.store.state.lastArgs&&this.#E(...this.store.state.lastArgs)},this.cancel=()=>{this.#T(),this.#b({lastArgs:void 0,isPending:!1})},this.reset=()=>{this.#b(k())},this.key=t.key,this.options={...S,...t},this.#b(this.options.initialState??{}),this.key&&l.on("d-Throttler",e=>{e.payload.key===this.key&&(this.#b(e.payload.store.state),this.setOptions(e.payload.options))})}#b=e=>{this.store.setState(t=>{let n={...t,...e},{isPending:r}=n;return{...n,status:this.#v()?r?"pending":"idle":"disabled"}}),((e,t)=>{let n=t.key;n&&(o.set(n,t),l.emit(e,function(e){var t;return{key:e.key,store:{state:a("function"==typeof(t=e.store).get?t.get():t.state)},options:a(e.options)}}({...t,key:n})))})("Throttler",this)};#v=()=>!!i(this.options.enabled,this);#y=()=>i(this.options.wait,this);#E=(...e)=>{if(!this.#v())return;this.fn(...e);let t=Date.now(),n=t+this.#y();this.#T(),this.#b({executionCount:this.store.state.executionCount+1,lastExecutionTime:t,nextExecutionTime:n,isPending:!1,lastArgs:void 0}),this.options.onExecute?.(e,this),setTimeout(()=>{this.store.state.isPending||this.#b({nextExecutionTime:void 0})},this.#y())};#T=()=>{this.#m&&(clearTimeout(this.#m),this.#m=void 0)}}},73268:(e,t,n)=>{n.d(t,{t:()=>s});var r=n(11713),i=n(99949),s=new r.c(i.l)},73513:(e,t,n)=>{n.d(t,{B:()=>u});var r=n(70324),i=n(11713),s=n(43532),o=(0,n(55755).L)(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),a=n(86540),l=n(68352),u=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,r.C6)(t,e),t.prototype.lift=function(e){var t=new c(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new o},t.prototype.next=function(e){var t=this;(0,l.Y)(function(){var n,i;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var s=(0,r.Ju)(t.currentObservers),o=s.next();!o.done;o=s.next())o.value.next(e)}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var t=this;(0,l.Y)(function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;(0,l.Y)(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null==(e=this.observers)?void 0:e.length)>0}
70,enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this.hasError,r=this.isStopped,i=this.observers;return n||r?s.Kn:(this.currentObservers=null,i.push(e),new s.yU(function(){t.currentObservers=null,(0,a.o)(i,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,n=this.thrownError,r=this.isStopped;t?e.error(n):r&&e.complete()},t.prototype.asObservable=function(){var e=new i.c;return e.source=this,e},t.create=function(e,t){return new c(e,t)},t}(i.c),c=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,r.C6)(t,e),t.prototype.next=function(e){var t,n;null==(n=null==(t=this.destination)?void 0:t.next)||n.call(t,e)},t.prototype.error=function(e){var t,n;null==(n=null==(t=this.destination)?void 0:t.error)||n.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=null==(e=this.destination)?void 0:e.complete)||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!=(n=null==(t=this.source)?void 0:t.subscribe(e))?n:s.Kn},t}(u)},73944:(e,t,n)=>{n.d(t,{f:()=>i});var r=n(70324),i={setTimeout:function(e,t){for(var n=[],s=2;s<arguments.length;s++)n[s-2]=arguments[s];var o=i.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,(0,r.fX)([e,t],(0,r.zs)(n))):setTimeout.apply(void 0,(0,r.fX)([e,t],(0,r.zs)(n)))},clearTimeout:function(e){var t=i.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0}},74087:(e,t,n)=>{n.d(t,{Ms:()=>v,vU:()=>p});var r=n(70324),i=n(89605),s=n(43532),o=n(45738),a=n(34076),l=n(99949),u=c("C",void 0,void 0);function c(e,t,n){return{kind:e,value:t,error:n}}var d=n(73944),h=n(68352),p=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,(0,s.Uv)(t)&&t.add(n)):n.destination=E,n}return(0,r.C6)(t,e),t.create=function(e,t,n){return new v(e,t,n)},t.prototype.next=function(e){this.isStopped?y(c("N",e,void 0),this):this._next(e)},t.prototype.error=function(e){this.isStopped?y(c("E",void 0,e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?y(u,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(s.yU),f=Function.prototype.bind;function g(e,t){return f.call(e,t)}var m=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){b(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){b(e)}else b(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){b(e)}},e}(),v=function(e){function t(t,n,r){var s,a,l=e.call(this)||this;return(0,i.T)(t)||!t?s={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:l&&o.$.useDeprecatedNextContext?((a=Object.create(t)).unsubscribe=function(){return l.unsubscribe()},s={next:t.next&&g(t.next,a),error:t.error&&g(t.error,a),complete:t.complete&&g(t.complete,a)}):s=t,l.destination=new m(s),l}return(0,r.C6)(t,e),t}(p);function b(e){o.$.useDeprecatedSynchronousErrorHandling?(0,h.l)(e):(0,a.m)(e)}function y(e,t){var n=o.$.onStoppedNotification;n&&d.f.setTimeout(function(){return n(e,t)})}var E={closed:!0,next:l.l,error:function(e){throw e},complete:l.l}},75380:(e,t,n)=>{n.d(t,{R0:()=>l,lI:()=>a,ms:()=>o});var r=n(89605),i=n(19554);function s(e){return e[e.length-1]}function o(e){return(0,r.T)(s(e))?e.pop():void 0}function a(e){return(0,i.m)(s(e))?e.pop():void 0}function l(e,t){return"number"==typeof s(e)?e.pop():t}},76719:(e,t,n)=>{n.d(t,{Ji:()=>s,kr:()=>a,y6:()=>o});var r=n(75834),i=n(7701),s=class extends i.Wp{constructor(e){super(e),this._renderToolCalls=[],this._hookRenderToolCalls=new Map,this._cachedMergedRenderToolCalls=null,this._renderCustomMessages=[],this._renderActivityMessages=[],this._interruptElement=null,this._renderToolCalls=e.renderToolCalls??[],this._renderCustomMessages=e.renderCustomMessages??[],this._renderActivityMessages=e.renderActivityMessages??[]}get renderCustomMessages(){return this._renderCustomMessages}get renderActivityMessages(){return this._renderActivityMessages}get renderToolCalls(){if(0===this._hookRenderToolCalls.size)return this._renderToolCalls;if(this._cachedMergedRenderToolCalls)return this._cachedMergedRenderToolCalls;let e=new Map;for(let t of this._renderToolCalls)e.set(`${t.agentId??""}:${t.name}`,t);for(let[t,n]of this._hookRenderToolCalls)e.set(t,n);return this._cachedMergedRenderToolCalls=Array.from(e.values()),this._cachedMergedRenderToolCalls}setRenderActivityMessages(e){this._renderActivityMessages=e}setRenderCustomMessages(e){this._renderCustomMessages=e}setRenderToolCalls(e){this._renderToolCalls=e,this._cachedMergedRenderToolCalls=null,this._notifyRenderToolCallsChanged()}addHookRenderToolCall(e){let t=`${e.agentId??""}:${e.name}`;this._hookRenderToolCalls.set(t,e),this._cachedMergedRenderToolCalls=null,this._notifyRenderToolCallsChanged()}removeHookRenderToolCall(e,t){let n=`${t??""}:${e}`;this._hookRenderToolCalls.delete(n)&&(this._cachedMergedRenderToolCalls=null,this._notifyRenderToolCallsChanged())}_notifyRenderToolCallsChanged(){this.notifySubscribers(e=>{e.onRenderToolCallsChanged&&e.onRenderToolCallsChanged({copilotkit:this,renderToolCalls:this.renderToolCalls})},"Subscriber onRenderToolCallsChanged error:")}get interruptElement(){return this._interruptElement}setInterruptElement(e){this._interruptElement=e,this.notifySubscribers(e=>{e.onInterruptElementChanged?.({copilotkit:this,interruptElement:this._interruptElement})},"Subscriber onInterruptElementChanged error:")}subscribe(e){return super.subscribe(e)}async waitForPendingFrameworkUpdates(){await new Promise(e=>setTimeout(e,0))}};let o=(0,r.createContext)(null),a=()=>{let e=(0,r.useContext)(o),[,t]=(0,r.useReducer)(e=>e+1,0);if(!e)throw Error("useCopilotKit must be used within CopilotKitProvider");return(0,r.useEffect)(()=>{let n=e.copilotkit.subscribe({onRuntimeConnectionStatusChanged:()=>{t()},onHeadersChanged:()=>{t()}});return()=>{n.unsubscribe()}},[]),e};(0,r.createContext)({status:null,license:null,checkFeature:()=>!0,getLimit:()=>null})}
70,76952:(e,t,n)=>{n.d(t,{N4:()=>i});var r=n(97789);function i(){return(0,r.A)()}},78443:(e,t,n)=>{n.d(t,{x:()=>s});var r=n(659),i=n(89605);function s(e){return(0,i.T)(null==e?void 0:e[r.l])}},78591:(e,t,n)=>{n.d(t,{D:()=>h});var r=n(85093),i=n(92036),s=n(77728),o=n(26514),a=(0,i.R)((e,t)=>{let n=(0,r.$)();return(0,o.jsx)(s.B.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});a.displayName="MenuCommand";var l=n(85092),u=n(57883),c=n(97104),d=n(86726),h=(0,i.R)((e,t)=>{let{icon:n,iconSpacing:r="0.75rem",command:i,commandSpacing:s="0.75rem",children:h,...p}=e,f=(0,c.Os)(p,t),g=n||i?(0,o.jsx)("span",{style:{pointerEvents:"none",flex:1},children:h}):h;return(0,o.jsxs)(l.m,{...f,className:(0,d.cx)("chakra-menu__menuitem",f.className),children:[n&&(0,o.jsx)(u.Z,{fontSize:"0.8em",marginEnd:r,children:n}),g,i&&(0,o.jsx)(a,{marginStart:s,children:i})]})});h.displayName="MenuItem"},78758:(e,t,n)=>{n.d(t,{z:()=>m});var r=n(11713),i=Array.isArray,s=Object.getPrototypeOf,o=Object.prototype,a=Object.keys,l=n(63582),u=n(37227),c=n(70324),d=n(27616),h=Array.isArray,p=n(75380),f=n(57304),g=n(31969);function m(){for(var e,t,n,g=[],m=0;m<arguments.length;m++)g[m]=arguments[m];var b=(0,p.lI)(g),y=(0,p.ms)(g),E=function(e){if(1===e.length){var t,n=e[0];if(i(n))return{args:n,keys:null};if((t=n)&&"object"==typeof t&&s(t)===o){var r=a(n);return{args:r.map(function(e){return n[e]}),keys:r}}}return{args:e,keys:null}}(g),T=E.args,k=E.keys;if(0===T.length)return(0,l.H)([],b);var S=new r.c((e=T,t=b,void 0===(n=k?function(e){return k.reduce(function(t,n,r){return t[n]=e[r],t},{})}:u.D)&&(n=u.D),function(r){v(t,function(){for(var i=e.length,s=Array(i),o=i,a=i,u=function(i){v(t,function(){var u=(0,l.H)(e[i],t),c=!1;u.subscribe((0,f._)(r,function(e){s[i]=e,!c&&(c=!0,a--),a||r.next(n(s.slice()))},function(){--o||r.complete()}))},r)},c=0;c<i;c++)u(c)},r)}));return y?S.pipe((0,d.T)(function(e){return h(e)?y.apply(void 0,(0,c.fX)([],(0,c.zs)(e))):y(e)})):S}function v(e,t,n){e?(0,g.N)(n,e,t):t()}},80853:(e,t,n)=>{n.d(t,{X:()=>r});var r=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},81120:(e,t,n)=>{n.d(t,{q:()=>o});var r=n(70324),i=n(86151),s=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=i.U.now,e}(),o=function(e){function t(t,n){void 0===n&&(n=s.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return(0,r.C6)(t,e),t.prototype.flush=function(e){var t,n=this.actions;if(this._active)return void n.push(e);this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=n.shift());if(this._active=!1,t){for(;e=n.shift();)e.unsubscribe();throw t}},t}(s)},82949:(e,t,n)=>{n.d(t,{K:()=>i});var r=n(63105);function i(){return(0,r.U)(1)}},85531:(e,t,n)=>{n.d(t,{$:()=>u});var r=n(70324),i=n(43356),s=n(82949),o=n(75380),a=n(63582);function l(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(0,o.lI)(e);return(0,i.N)(function(t,i){(0,s.K)()((0,a.H)((0,r.fX)([t],(0,r.zs)(e)),n)).subscribe(i)})}function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return l.apply(void 0,(0,r.fX)([],(0,r.zs)(e)))}},86151:(e,t,n)=>{n.d(t,{U:()=>r});var r={now:function(){return(r.delegate||Date).now()},delegate:void 0}},86540:(e,t,n)=>{n.d(t,{o:()=>r});function r(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}},86583:(e,t,n)=>{n.d(t,{_:()=>s});var r=n(52900),i=n(74087);function s(e,t){var n="object"==typeof t;return new Promise(function(s,o){var a=new i.Ms({next:function(e){s(e),a.unsubscribe()},error:o,complete:function(){n?s(t.defaultValue):o(new r.G)}});e.subscribe(a)})}},87181:(e,t,n)=>{n.d(t,{F:()=>i,m:()=>s});var r=n(37227);function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return s(e)}function s(e){return 0===e.length?r.D:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)}}},87666:(e,t,n)=>{n.d(t,{_:()=>i});let r={enabled:!1,events:!1,lifecycle:!1,verbose:!1};function i(e){if(!e)return r;
70if(!0===e)return{enabled:!0,events:!0,lifecycle:!0,verbose:!1};let t=e.events??!0,n=e.lifecycle??!0,i=t||n;return{enabled:i,events:t,lifecycle:n,verbose:i&&(e.verbose??!1)}}},87725:(e,t,n)=>{n.d(t,{m:()=>o});var r=n(70324),i=n(73513),s=n(86151),o=function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=s.U);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return(0,r.C6)(t,e),t.prototype.next=function(t){var n=this.isStopped,r=this._buffer,i=this._infiniteTimeWindow,s=this._timestampProvider,o=this._windowTime;!n&&(r.push(t),i||r.push(s.now()+o)),this._trimBuffer(),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},t.prototype._trimBuffer=function(){var e=this._bufferSize,t=this._timestampProvider,n=this._buffer,r=this._infiniteTimeWindow,i=(r?1:2)*e;if(e<1/0&&i<n.length&&n.splice(0,n.length-i),!r){for(var s=t.now(),o=0,a=1;a<n.length&&n[a]<=s;a+=2)o=a;o&&n.splice(0,o+1)}},t}(i.B)},88434:(e,t,n)=>{n.d(t,{$:()=>f});var r,i=n(70324),s=n(8917),o=1,a={};function l(e){return e in a&&(delete a[e],!0)}var u={setImmediate:function(e){var t=o++;return a[t]=!0,r||(r=Promise.resolve()),r.then(function(){return l(t)&&e()}),t},clearImmediate:function(e){l(e)}},c=u.setImmediate,d=u.clearImmediate,h={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=h.delegate;return((null==n?void 0:n.setImmediate)||c).apply(void 0,(0,i.fX)([],(0,i.zs)(e)))},clearImmediate:function(e){var t=h.delegate;return((null==t?void 0:t.clearImmediate)||d)(e)},delegate:void 0},p=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return(0,i.C6)(t,e),t.prototype.requestAsyncId=function(t,n,r){return(void 0===r&&(r=0),null!==r&&r>0)?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=h.setImmediate(t.flush.bind(t,void 0))))},t.prototype.recycleAsyncId=function(t,n,r){if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var i,s=t.actions;null!=n&&(null==(i=s[s.length-1])?void 0:i.id)!==n&&(h.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},t}(s.R),f=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,i.C6)(t,e),t.prototype.flush=function(e){this._active=!0;var t,n=this._scheduled;this._scheduled=void 0;var r=this.actions;e=e||r.shift();do if(t=e.execute(e.state,e.delay))break;while((e=r[0])&&e.id===n&&r.shift());if(this._active=!1,t){for(;(e=r[0])&&e.id===n&&r.shift();)e.unsubscribe();throw t}},t}(n(81120).q))(p)},88765:(e,t,n)=>{n.d(t,{s:()=>o});var r=n(2259),i=n(43356),s=n(57304);function o(e){return e<=0?function(){return r.w}:(0,i.N)(function(t,n){var r=0;t.subscribe((0,s._)(n,function(t){++r<=e&&(n.next(t),e<=r&&n.complete())}))})}},89605:(e,t,n)=>{n.d(t,{T:()=>r});function r(e){return"function"==typeof e}},91559:(e,t,n)=>{n.d(t,{Eg:()=>l,gV:()=>u});var r,i=n(2259),s=n(96483),o=n(65048),a=n(89605);!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(r||(r={}));var l=function(){function e(e,t,n){this.kind=e,this.value=t,this.error=n,this.hasValue="N"===e}return e.prototype.observe=function(e){return u(this,e)},e.prototype.do=function(e,t,n){var r=this.kind,i=this.value,s=this.error;return"N"===r?null==e?void 0:e(i):"E"===r?null==t?void 0:t(s):null==n?void 0:n()},e.prototype.accept=function(e,t,n){return(0,a.T)(null==e?void 0:e.next)?this.observe(e):this.do(e,t,n)},e.prototype.toObservable=function(){var e=this.kind,t=this.value,n=this.error,r="N"===e?(0,s.of)(t):"E"===e?(0,o.$)(function(){return n}):"C"===e?i.w:0;if(!r)throw TypeError("Unexpected notification kind "+e);return r},e.createNext=function(t){return new e("N",t)},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e}();function u(e,t){var n,r,i,s=e.kind,o=e.value,a=e.error;if("string"!=typeof s)throw TypeError('Invalid notification, missing "kind"');"N"===s?null==(n=t.next)||n.call(t,o):"E"===s?null==(r=t.error)||r.call(t,a):null==(i=t.complete)||i.call(t)}},91887:(e,t,n)=>{n.d(t,{M:()=>a});var r=n(89605),i=n(43356),s=n(57304),o=n(37227);function a(e,t,n){var a=(0,r.T)(e)||t||n?{next:e,error:t,complete:n}:e;return a?(0,i.N)(function(e,t){null==(n=a.subscribe)||n.call(a);var n,r=!0;e.subscribe((0,s._)(t,function(e){var n;null==(n=a.next)||n.call(a,e),t.next(e)},function(){var e;r=!1,null==(e=a.complete)||e.call(a),t.complete()},function(e){var n;r=!1,null==(n=a.error)||n.call(a,e),t.error(e)},function(){var e,t;r&&(null==(e=a.unsubscribe)||e.call(a)),null==(t=a.finalize)||t.call(a)}))}):o.D}},92666:(e,t,n)=>{n.d(t,{x:()=>o});var r=n(82949),i=n(75380),s=n(63582);function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0,r.K)()((0,s.H)(e,(0,i.lI)(e)))}},94119:(e,t,n)=>{n.d(t,{Q:()=>o});var r=n(31969),i=n(43356),s=n(57304);function o(e,t){return void 0===t&&(t=0),(0,i.N)(function(n,i){n.subscribe((0,s._)(i,function(n){return(0,r.N)(i,e,function(){return i.next(n)},t)},function(){return(0,r.N)(i,e,function(){return i.complete()},t)},function(n){return(0,r.N)(i,e,function(){return i.error(n)},t)}))})}},95546:(e,t,n)=>{n.d(t,{cz:()=>g,fJ:()=>y,pi:()=>S,CJ:()=>T,Pt:()=>k});var r=n(76719),i=n(75834);let s="default";var o=n(76952),a=n(58425),l=n(26514),u=n(10489),c=n(7701);function d(e){return null!==e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)}let h={chatInputPlaceholder:"Type a message...",chatInputToolbarStartTranscribeButtonLabel:"Transcribe",chatInputToolbarCancelTranscribeButtonLabel:"Cancel",chatInputToolbarFinishTranscribeButtonLabel:"Finish",chatInputToolbarAddButtonLabel:"Add attachments",chatInputToolbarToolsButtonLabel:"Tools",assistantMessageToolbarCopyCodeLabel:"Copy",assistantMessageToolbarCopyCodeCopiedLabel:"Copied",assistantMessageToolbarCopyMessageLabel:"Copy",assistantMessageToolbarInspectorLabel:"View in Inspector",assistantMessageToolbarInspectorLocalOnlyLabel:"Local Only",assistantMessageToolbarThumbsUpLabel:"Good response",assistantMessageToolbarThumbsDownLabel:"Bad response",assistantMessageToolbarReadAloudLabel:"Read aloud",assistantMessageToolbarRegenerateLabel:"Regenerate",userMe
70ssageToolbarCopyMessageLabel:"Copy",userMessageToolbarEditMessageLabel:"Edit",chatDisclaimerText:"AI can make mistakes. Please verify important information.",chatToggleOpenLabel:"Open chat",chatToggleCloseLabel:"Close chat",modalHeaderTitle:"CopilotKit Chat",welcomeMessageText:"How can I help you today?"};function p(){return"undefined"!=typeof window&&"function"==typeof window.matchMedia&&window.matchMedia("(max-width: 767px)").matches}let f=(0,i.createContext)(null),g=({children:e,labels:t,agentId:n,threadId:r,hasExplicitThreadId:a,isModalDefaultOpen:u})=>{let c=(0,i.useContext)(f),g=function(e){let t=(0,i.useRef)(e);return t.current===e||d(t.current)&&d(e)&&function(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}(t.current,e)||(t.current=e),t.current}(t),m=(0,i.useMemo)(()=>({...h,...c?.labels,...g}),[g,c?.labels]),v=n??c?.agentId??s,b=void 0!==r&&!1!==a,[y,E]=(0,i.useState)(null),T=(0,i.useMemo)(()=>b?r:y?y.threadId:c?.threadId?c.threadId:r||(0,o.N4)(),[b,r,c?.threadId,y]),k=!!b||(y?.explicit??a??!1)||!!c?.hasExplicitThreadId,[S,w]=(0,i.useState)(u??!0),A=void 0!==u,I=(0,i.useCallback)(e=>{w(e),c?.setModalOpen(e)},[c?.setModalOpen]),_=(0,i.useRef)(!1);(0,i.useEffect)(()=>{if(A){if(!_.current){_.current=!0;return}c?.isModalOpen!==void 0&&w(c.isModalOpen)}},[c?.isModalOpen,A]);let x=A?S:c?.isModalOpen??S,N=A?I:c?.setModalOpen??w,[C,R]=(0,i.useState)(!1),[O,L]=(0,i.useState)(0),P=(0,i.useRef)(()=>{});P.current=N;let M=(0,i.useRef)([]),j=(0,i.useCallback)(e=>(M.current.push(e),()=>{M.current=M.current.filter(t=>t!==e)}),[]),D=(0,i.useCallback)(e=>{if(R(e),e&&p()){let e=M.current;(e.length>0?e[e.length-1]:P.current)(!1)}},[]),$=(0,i.useCallback)(()=>(L(e=>e+1),()=>{L(e=>Math.max(0,e-1))}),[]),B=c?c.drawerOpen:C,U=c?c.setDrawerOpen:D,G=c?c.drawerRegistered:O>0,z=c?c.registerDrawer:$,Y=c?c.ɵregisterModalCloser:j;(0,i.useEffect)(()=>{if(A)return Y(N)},[A,Y,N]);let H=(0,i.useRef)(b);H.current=b;let F=(0,i.useCallback)((e,t)=>{E({threadId:e,explicit:t?.explicit??!0})},[]),V=(0,i.useCallback)(()=>{E({threadId:(0,o.N4)(),explicit:!1})},[]),Z=c?.setActiveThreadId,X=c?.startNewThread,K=(0,i.useCallback)((e,t)=>H.current?void console.warn("[CopilotKit] Ignoring setActiveThreadId(): threadId is controlled via the `threadId` prop on CopilotChatConfigurationProvider."):Z?void Z(e,t):void F(e,t),[Z,F]),q=(0,i.useCallback)(()=>H.current?void console.warn("[CopilotKit] Ignoring startNewThread(): threadId is controlled via the `threadId` prop on CopilotChatConfigurationProvider."):X?void X():void V(),[X,V]),W=(0,i.useCallback)(e=>{e&&p()&&U(!1),N(e)},[N,U]),J=(0,i.useMemo)(()=>({labels:m,agentId:v,threadId:T,hasExplicitThreadId:k,isModalOpen:x,setModalOpen:W,drawerOpen:B,setDrawerOpen:U,drawerRegistered:G,registerDrawer:z,ɵregisterModalCloser:Y,setActiveThreadId:K,startNewThread:q}),[m,v,T,k,x,W,B,U,G,z,Y,K,q]);return(0,l.jsx)(f.Provider,{value:J,children:e})},m=()=>(0,i.useContext)(f),v=function(e){return e.OnMessagesChanged="OnMessagesChanged",e.OnStateChanged="OnStateChanged",e.OnRunStatusChanged="OnRunStatusChanged",e}({}),b=[v.OnMessagesChanged,v.OnStateChanged,v.OnRunStatusChanged];function y({agentId:e,threadId:t,runtimeAgentId:n,updates:o,throttleMs:a}={}){if(null!=t&&null==n)throw Error(`useAgent: \`threadId\` requires \`runtimeAgentId\`. A threadId is written onto a single agent, but an agent resolved by agentId alone is shared, so scoping a thread to it would clobber other useAgent callers. Pass a distinct local \`agentId\` and the runtime agent to route to, e.g. useAgent({ agentId: "chat-1", runtimeAgentId: "${e??"default"}", threadId }).`);if(null!=n&&null==t)throw Error(`useAgent: \`runtimeAgentId\` requires \`threadId\`. A proxied agent exists to scope a thread to a private instance; without a threadId it behaves like the shared agent while adding a registration and a local agentId to keep unique. Either pass the thread, e.g. useAgent({ agentId: "${e??"chat-1"}", runtimeAgentId: "${n}", threadId }), or bind to the agent directly with useAgent({ agentId: "${n}" }).`);if(null!=n&&null==e)throw Error(`useAgent: \`runtimeAgentId\` requires an explicit \`agentId\`. The proxied agent is registered under \`agentId\`, and the usual fallbacks (chat configuration, then "${s}") name agents that already exist â registering over one throws or shadows it. Pick a local id for this hook, e.g. useAgent({ agentId: "chat-1", runtimeAgentId: "${n}", threadId }).`);let l=m(),d=e??l?.agentId??s,{copilotkit:h}=(0,r.kr)(),p=h.defaultThrottleMs,[,f]=(0,i.useReducer)(e=>e+1,0),g=(0,i.useMemo)(()=>o??b,[JSON.stringify(o)]),E=(0,i.useRef)(new Map),[T,k]=(0,i.useState)(null);(0,i.useEffect)(()=>
70{if(null==n)return void k(null);let{agent:e,unregister:t}=h.registerProxiedAgent({agentId:d,runtimeAgentId:n});return E.current.delete(d),k(e),()=>{t(),k(null)}},[h,d,n]);let{agent:S,isReady:w}=(0,i.useMemo)(()=>{if(null!=n){if(T)return E.current.delete(d),{agent:T,isReady:!0};let e=E.current.get(d);if(e)return h.applyHeadersToAgent(e),{agent:e,isReady:!1};let t=new c.h9({runtimeUrl:h.runtimeUrl,agentId:d,runtimeAgentId:n,transport:h.runtimeTransport,runtimeMode:"pending"});return h.applyHeadersToAgent(t),E.current.set(d,t),{agent:t,isReady:!1}}let e=h.getAgent(d);if(e)return E.current.delete(d),{agent:e,isReady:!0};let t=void 0!==h.runtimeUrl,r=h.runtimeConnectionStatus;if(t&&(r===c.Ub.Disconnected||r===c.Ub.Connecting)||t&&r===c.Ub.Error){let e=E.current.get(d);if(e)return{agent:e,isReady:!1};let t=new c.h9({runtimeUrl:h.runtimeUrl,agentId:d,transport:h.runtimeTransport,credentials:h.credentials,runtimeMode:"pending"});return h.applyHeadersToAgent(t),E.current.set(d,t),{agent:t,isReady:!1}}let i=Object.keys(h.agents??{}),s=t?`runtimeUrl=${h.runtimeUrl}`:"no runtimeUrl";throw Error(`useAgent: Agent '${d}' not found after runtime sync (${s}). `+(i.length?`Known agents: [${i.join(", ")}]`:"No agents registered.")+" Verify your runtime /info and/or agents__unsafe_dev_only.")},[d,n,T,h.agents,h.runtimeConnectionStatus,h.runtimeUrl,h.runtimeTransport,h.credentials,JSON.stringify(h.headers)]);(0,i.useEffect)(()=>{if(0===g.length)return;let e=!0,t={},n=!1,r=()=>{e&&(n||(n=!0,queueMicrotask(()=>{n=!1,e&&f()})))};g.includes(v.OnMessagesChanged)&&(t.onMessagesChanged=r),g.includes(v.OnStateChanged)&&(t.onStateChanged=r),g.includes(v.OnRunStatusChanged)&&(t.onRunInitialized=r,t.onRunFinalized=r,t.onRunFailed=r,t.onRunErrorEvent=r);let i=h.subscribeToAgentWithOptions(S,t,{throttleMs:a});return()=>{e=!1,i.unsubscribe()}},[S,f,a,p,g]),(0,i.useEffect)(()=>{S instanceof u.qB&&h.applyHeadersToAgent(S),S instanceof c.h9&&(S.credentials=h.credentials)},[S,JSON.stringify(h.headers),h.credentials]);let A=l?.threadId,I=l?.hasExplicitThreadId,_=t??(I?A:void 0);return(0,i.useEffect)(()=>{_&&(S.threadId=_)},[S,_]),{agent:S,isReady:w}}let E=[];function T(e,t){let{copilotkit:n}=(0,r.kr)();(0,i.useEffect)(()=>{let t=e.name;return n.getTool({toolName:t,agentId:e.agentId})&&(console.warn(`Tool '${t}' already exists for agent '${e.agentId||"global"}'. Overriding with latest registration.`),n.removeTool(t,e.agentId)),n.addTool(e),e.render&&n.addHookRenderToolCall({name:t,args:e.parameters,agentId:e.agentId,render:e.render}),()=>{n.removeTool(t,e.agentId)}},[e.name,e.available,n,JSON.stringify(t??E)])}function k({agentId:e}={}){let{copilotkit:t}=(0,r.kr)(),n=m(),o=(0,i.useMemo)(()=>e??n?.agentId??s,[e,n?.agentId]),[a,l]=(0,i.useState)(()=>t.getSuggestions(o).suggestions),[u,c]=(0,i.useState)(()=>t.getSuggestions(o).isLoading);return(0,i.useEffect)(()=>{let e=t.getSuggestions(o);l(e.suggestions),c(e.isLoading)},[t,o]),(0,i.useEffect)(()=>{let e=t.subscribe({onSuggestionsChanged:({agentId:e,suggestions:t})=>{e===o&&l(t)},onSuggestionsStartedLoading:({agentId:e})=>{e===o&&c(!0)},onSuggestionsFinishedLoading:({agentId:e})=>{e===o&&c(!1)},onSuggestionsConfigChanged:()=>{let e=t.getSuggestions(o);l(e.suggestions),c(e.isLoading)}});return()=>{e.unsubscribe()}},[t,o]),{suggestions:a,reloadSuggestions:(0,i.useCallback)(()=>{t.reloadSuggestions(o)},[t,o]),clearSuggestions:(0,i.useCallback)(()=>{t.clearSuggestions(o)},[t,o]),isLoading:u}}function S(e,t){let{copilotkit:n}=(0,r.kr)(),o=m(),a=t??[],l=(0,i.useMemo)(()=>o?.agentId??s,[o?.agentId]),u=(0,i.useMemo)(()=>e?e.consumerAgentId:void 0,[e]),c=(0,i.useRef)({serialized:null,config:null}),{normalizedConfig:d,serializedConfig:h}=(0,i.useMemo)(()=>{let t;if(!e||"disabled"===e.available)return c.current={serialized:null,config:null},{normalizedConfig:null,serializedConfig:null};if("instructions"in e)t={...e};else{let n=e.suggestions.map(e=>({...e,isLoading:e.isLoading??!1}));t={...e,suggestions:n}}let n=JSON.stringify(t),r=c.current;return r.serialized===n&&r.config?{normalizedConfig:r.config,serializedConfig:n}:(c.current={serialized:n,config:t},{normalizedConfig:t,serializedConfig:n})}
70,[e,l,...a]),p=(0,i.useRef)(null);p.current=d;let f=(0,i.useRef)(null),g=(0,i.useMemo)(()=>{if(!d)return l;let e=d.consumerAgentId;return e&&"*"!==e?e:l},[d,l]),v=void 0===u||"*"===u,b=(0,i.useMemo)(()=>!!d&&"instructions"in d,[d]),y=(0,i.useCallback)(()=>{if(d){if(v){let e=new Set;for(let t of Object.values(n.agents??{})){let r=t.agentId;r&&(e.add(r),t.isRunning||n.reloadSuggestions(r))}g&&!e.has(g)&&n.reloadSuggestions(g);return}g&&n.reloadSuggestions(g)}},[n,v,d,g]);(0,i.useEffect)(()=>{if(!h||!p.current)return;let e=n.addSuggestionsConfig(p.current);return y(),()=>{n.removeSuggestionsConfig(e)}},[n,h,y]),(0,i.useEffect)(()=>{if(!d){f.current=null;return}h&&f.current===h||(h&&(f.current=h),y())},[d,y,h]),(0,i.useEffect)(()=>{d&&0!==a.length&&y()},[a.length,d,y,...a]),(0,i.useEffect)(()=>{if(!d||!b||!g||n.getAgent(g))return;let e=n.subscribe({onAgentsChanged:()=>{n.getAgent(g)&&(y(),e.unsubscribe())}});return()=>{e.unsubscribe()}},[n,d,b,g,y])}i.memo(function({toolCall:e,toolMessage:t,RenderComponent:n,isExecuting:r}){let s=(0,i.useMemo)(()=>(0,a.j)(e.function.arguments),[e.function.arguments]),o=e.function.name;return t?(0,l.jsx)(n,{name:o,toolCallId:e.id,args:s,status:c.t4.Complete,result:t.content}):r?(0,l.jsx)(n,{name:o,toolCallId:e.id,args:s,status:c.t4.Executing,result:void 0}):(0,l.jsx)(n,{name:o,toolCallId:e.id,args:s,status:c.t4.InProgress,result:void 0})},(e,t)=>e.toolCall.id===t.toolCall.id&&e.toolCall.function.name===t.toolCall.function.name&&e.toolCall.function.arguments===t.toolCall.function.arguments&&e.toolMessage?.content===t.toolMessage?.content&&e.isExecuting===t.isExecuting&&e.RenderComponent===t.RenderComponent)},96483:(e,t,n)=>{n.d(t,{of:()=>s});var r=n(75380),i=n(63582);function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=(0,r.lI)(e);return(0,i.H)(e,n)}},97789:(e,t,n)=>{let r;n.d(t,{A:()=>a});let i={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)},s=new Uint8Array(16),o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));let a=function(e,t,n){if(i.randomUUID&&!t&&!e)return i.randomUUID();let a=(e=e||{}).random??e.rng?.()??function(){if(!r){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");r=crypto.getRandomValues.bind(crypto)}return r(s)}();if(a.length<16)throw Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((n=n||0)<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=a[e];return t}return function(e,t=0){return(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase()}(a)}},99337:(e,t,n)=>{n.d(t,{$:()=>a});var r=n(70324),i=n(57304),s=n(11713),o=n(40562);function a(e,t){void 0===t&&(t={});var n=t.selector,a=(0,r.Tt)(t,["selector"]);return new s.c(function(t){var s=new AbortController,l=s.signal,u=!0,c=a.signal;if(c)if(c.aborted)s.abort();else{var d=function(){l.aborted||s.abort()};c.addEventListener("abort",d),t.add(function(){return c.removeEventListener("abort",d)})}var h=(0,r.Cl)((0,r.Cl)({},a),{signal:l}),p=function(e){u=!1,t.error(e)};return fetch(e,h).then(function(e){n?(0,o.Tg)(n(e)).subscribe((0,i._)(t,void 0,function(){u=!1,t.complete()},p)):(u=!1,t.next(e),t.complete())}).catch(p),function(){u&&s.abort()}})}},99818:(e,t,n)=>{n.d(t,{y:()=>i});var r=n(89605);function i(e){return(0,r.T)(null==e?void 0:e.then)}},99949:(e,t,n)=>{n.d(t,{l:()=>r});function r(){}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.