@tung-engineering/agent-platform-web-sdk 0.0.66 → 0.0.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var o_=Object.defineProperty,s_=Object.defineProperties;var i_=Object.getOwnPropertyDescriptors;var Nl=Object.getOwnPropertySymbols;var a_=Object.prototype.hasOwnProperty,c_=Object.prototype.propertyIsEnumerable;var Dl=Math.pow,ki=(ae,Pe,$e)=>Pe in ae?o_(ae,Pe,{enumerable:!0,configurable:!0,writable:!0,value:$e}):ae[Pe]=$e,v=(ae,Pe)=>{for(var $e in Pe||(Pe={}))a_.call(Pe,$e)&&ki(ae,$e,Pe[$e]);if(Nl)for(var $e of Nl(Pe))c_.call(Pe,$e)&&ki(ae,$e,Pe[$e]);return ae},j=(ae,Pe)=>s_(ae,i_(Pe));var de=(ae,Pe,$e)=>ki(ae,typeof Pe!="symbol"?Pe+"":Pe,$e);var I=(ae,Pe,$e)=>new Promise((yi,is)=>{var wi=Kt=>{try{Jr($e.next(Kt))}catch(Yr){is(Yr)}},xi=Kt=>{try{Jr($e.throw(Kt))}catch(Yr){is(Yr)}},Jr=Kt=>Kt.done?yi(Kt.value):Promise.resolve(Kt.value).then(wi,xi);Jr(($e=$e.apply(ae,Pe)).next())});var AgentPlatformWebSdk=(function(ae){"use strict";var _l,Ho;const Ml=[`
1
+ var d_=Object.defineProperty,p_=Object.defineProperties;var h_=Object.getOwnPropertyDescriptors;var Ul=Object.getOwnPropertySymbols;var f_=Object.prototype.hasOwnProperty,g_=Object.prototype.propertyIsEnumerable;var jl=Math.pow,ki=(ie,Ie,Ne)=>Ie in ie?d_(ie,Ie,{enumerable:!0,configurable:!0,writable:!0,value:Ne}):ie[Ie]=Ne,v=(ie,Ie)=>{for(var Ne in Ie||(Ie={}))f_.call(Ie,Ne)&&ki(ie,Ne,Ie[Ne]);if(Ul)for(var Ne of Ul(Ie))g_.call(Ie,Ne)&&ki(ie,Ne,Ie[Ne]);return ie},j=(ie,Ie)=>p_(ie,h_(Ie));var ue=(ie,Ie,Ne)=>ki(ie,typeof Ie!="symbol"?Ie+"":Ie,Ne);var L=(ie,Ie,Ne)=>new Promise((yi,is)=>{var wi=Qt=>{try{Wr(Ne.next(Qt))}catch(Jr){is(Jr)}},xi=Qt=>{try{Wr(Ne.throw(Qt))}catch(Jr){is(Jr)}},Wr=Qt=>Qt.done?yi(Qt.value):Promise.resolve(Qt.value).then(wi,xi);Wr((Ne=Ne.apply(ie,Ie)).next())});var AgentPlatformWebSdk=(function(ie){"use strict";var wl,Ho;const Zl=[`
2
2
  :where([data-ap-sdk][popover]) {
3
3
  position: fixed;
4
4
  margin: 0;
@@ -1315,11 +1315,11 @@ button.ap-sdk-list-item__link {
1315
1315
  border-bottom: 2px solid #d1d5db;
1316
1316
  }
1317
1317
  `].join(`
1318
- `);let Si=!1;function fr(){if(Si)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Ml,document.head.appendChild(e),Si=!0}function Vr(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Xr(e,t=200){var r;const n=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const Ul=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Kr(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=d=>{if(i.has(d)||o.length>=8)return;const u=e.getAttribute(d);if(!u)return;i.add(d);const h=u.length>80?u.slice(0,80)+"…":u;o.push(`[${d}="${h}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of Ul)a(d);return`${t}${n}${r}${o.join("")}`}function jl(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>{var o;return((o=r.textContent)!=null?o:"").trim()}).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function Zl(e,t=5,n=10){function r(o,i){const a=Kr(o),d=" ".repeat(i),u=Array.from(o.children).slice(0,n);if(i>=t||u.length===0){const h=jl(o);return h?`${d}${a} "${h}"`:`${d}${a}`}return[`${d}${a}`,...u.map(h=>r(h,i+1))].join(`
1319
- `)}return r(e,0)}const ql='section, article, aside, nav, main, header, footer, form, fieldset, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"], [role="banner"], [role="contentinfo"], [role="form"], [role="search"], [role="dialog"]',Hl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function Qr(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Fl(e){var n;const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const r of Array.from(t)){let o=r.parentElement;for(;o&&o!==e&&!o.matches(ql);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function Bl(e,t=80){var a,d,u;const n=Hl[e.tagName.toLowerCase()];if(n){const h=(d=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:d.trim();if(h)return Qr(h,t)}const r=Fl(e);if(r)return Qr(r,t);const o=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(o)return Qr(o,t);const i=e.getAttribute("aria-labelledby");if(i){const h=i.split(/\s+/).map(p=>{var m,g,k;return(k=(g=(m=document.getElementById(p))==null?void 0:m.textContent)==null?void 0:g.trim())!=null?k:""}).filter(Boolean).join(" ");if(h)return Qr(h,t)}return""}function Gl(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Bl(o),a=i&&!r.has(i)?`${Kr(o)} ["${i}"]`:Kr(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||Kr(e)}function Ti(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function gr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Ei(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>gr('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>gr('meta[property="og:title"]')),ogDescription:e(()=>gr('meta[property="og:description"]')),ogType:e(()=>gr('meta[property="og:type"]')),ogSiteName:e(()=>gr('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?Ti(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function Wl(e){const t=[];let n=e;for(;n&&t.length<6;){let r=n.tagName.toLowerCase();n.id?r+=`#${n.id}`:n.classList.length&&(r+=`.${Array.from(n.classList).slice(0,2).join(".")}`),t.unshift(r),n=n.parentElement}return t.join(" > ")}function Jl(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),d=o.tagName.toLowerCase();r=a?`${d}: ${Ti(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function Yl(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
1320
- `)}const Un=new Set;let jn=null,eo=!1,as=!1;function Vl(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function Xl(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch(r){}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Un.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Vl(r))return!0}return!1}function Ai(){const e=Xl(),t=e&&!as;as=e;for(const n of Un){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch(o){}try{n.showPopover()}catch(o){}}}else try{n.showPopover()}catch(o){}}}function Ci(e){if(!(e instanceof Node))return!1;for(const t of Un)if(t===e||t.contains(e))return!0;return!1}function Zn(e){(Ci(e.target)||"relatedTarget"in e&&Ci(e.relatedTarget))&&e.stopPropagation()}function Kl(){eo||(window.addEventListener("focusin",Zn,!0),window.addEventListener("focusout",Zn,!0),window.addEventListener("pointerdown",Zn,!0),eo=!0),!jn&&(jn=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&Ai()}),jn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Zt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Un.add(e),Kl(),Ai())}function qt(e){if(Un.delete(e),Un.size===0&&(jn&&(jn.disconnect(),jn=null),eo&&(window.removeEventListener("focusin",Zn,!0),window.removeEventListener("focusout",Zn,!0),window.removeEventListener("pointerdown",Zn,!0),eo=!1),as=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function cs(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),Zt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{qt(t),t.remove()}}}const Pi=/^cc-|current-password|new-password/i,Ql=/token|secret|password|apikey|auth/i,ls="[redacted]";function eu(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Pi.test(t)}function Ri(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ls);const r=n.getAttribute("autocomplete");r&&Pi.test(r)&&n.setAttribute("value",ls);for(const o of Array.from(n.attributes))Ql.test(o.name)&&n.setAttribute(o.name,ls)}}const tu="🎯 Click any element to capture";let Qt=null,Re=null,De=null;function mr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function nu(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function Li(e){Qt==null||Qt.update(e)}function Ii(e){const t=Ei(),n=Wl(e),r=Jl(e);let o;try{const i=e.cloneNode(!0);Ri(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return v(v({pageUrl:window.location.href,pageTitle:document.title,elementText:Xr(e),cssSelector:Vr(e),innerTree:Zl(e),outerTree:Gl(e),elementOuterHtml:o,ancestry:n},r),t)}function us(e,t){De&&De();const n=nu();Qt=cs(),Re=document.createElement("div"),Re.className="ap-sdk-picker-cursor",Re.setAttribute("data-ap-sdk","1"),Re.textContent=n?"Tap any element to preview":tu,document.body.appendChild(Re),Zt(Re);let r=null,o=null;const i=p=>{De==null||De(),e(Ii(p),p)},a=p=>{if(o=p,Li(p),!Re)return;Re.classList.add("ap-sdk-picker-cursor--confirm"),Re.innerHTML="";const m=document.createElement("span");m.className="ap-sdk-picker-cursor__label",m.textContent=`<${p.tagName.toLowerCase()}>`;const g=document.createElement("button");g.type="button",g.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",g.textContent="✕ Cancel",g.setAttribute("data-ap-sdk","1"),g.setAttribute("aria-label","Cancel picking"),g.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation(),De==null||De(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const y=document.createElement("button");y.type="button",y.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",y.textContent="✓ Select",y.setAttribute("data-ap-sdk","1"),y.addEventListener("click",A=>{A.preventDefault(),A.stopPropagation(),o&&i(o)}),Re.appendChild(m),Re.appendChild(g),Re.appendChild(k),Re.appendChild(y)},d=p=>{mr(p.target)||(r=p.target,Li(r))},u=p=>{var g;if(mr(p.target))return;p.preventDefault(),p.stopImmediatePropagation();const m=(g=p.target)!=null?g:r;if(m){if(n){a(m);return}i(m)}},h=p=>{p.key==="Escape"&&(De==null||De(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",u,{capture:!0}),document.addEventListener("keydown",h,{capture:!0}),De=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",u,{capture:!0}),document.removeEventListener("keydown",h,{capture:!0}),Re&&qt(Re),Re==null||Re.remove(),Qt==null||Qt.destroy(),Qt=null,Re=null,o=null,De=null}}function ds(){De==null||De()}function qn(){return De!==null}const to={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function w(e,t,n){var d;function r(u,h){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:h,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,h);const p=a.prototype,m=Object.keys(p);for(let g=0;g<m.length;g++){const k=m[g];k in u||(u[k]=p[k].bind(u))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var m;var h;const p=n!=null&&n.Parent?new i:this;r(p,u),(m=(h=p._zod).deferred)!=null||(h.deferred=[]);for(const g of p._zod.deferred)g();return p}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var h,p;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(p=(h=u==null?void 0:u._zod)==null?void 0:h.traits)==null?void 0:p.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class Hn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class zi extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $i={};function en(e){return $i}function Oi(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ps(e,t){return typeof t=="bigint"?t.toString():t}function no(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hs(e){return e==null}function fs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function ru(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u!=null&&u[1]&&(o=Number.parseInt(u[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/Dl(10,i)}const Ni=Symbol("evaluating");function se(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ni)return r===void 0&&(r=Ni,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function bn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function tn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Di(e){return JSON.stringify(e)}function ou(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Mi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function br(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const su=no(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function Fn(e){if(br(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(br(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ui(e){return Fn(e)?v({},e):Array.isArray(e)?[...e]:e}const iu=new Set(["string","number","symbol"]);function Bn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function nn(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?j(v({},t),{error:()=>t.error}):t}function au(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const cu={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function lu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=tn(e._zod.def,{get shape(){const a={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(a[d]=n.shape[d])}return bn(this,"shape",a),a},checks:[]});return nn(e,i)}function uu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=tn(e._zod.def,{get shape(){const a=v({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return bn(this,"shape",a),a},checks:[]});return nn(e,i)}function du(e,t){if(!Fn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=tn(e._zod.def,{get shape(){const i=v(v({},e._zod.def.shape),t);return bn(this,"shape",i),i}});return nn(e,o)}function pu(e,t){if(!Fn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=tn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t);return bn(this,"shape",r),r}});return nn(e,n)}function hu(e,t){const n=tn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t._zod.def.shape);return bn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return nn(e,n)}function fu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=tn(t._zod.def,{get shape(){const d=t._zod.def.shape,u=v({},d);if(n)for(const h in n){if(!(h in d))throw new Error(`Unrecognized key: "${h}"`);n[h]&&(u[h]=e?new e({type:"optional",innerType:d[h]}):d[h])}else for(const h in d)u[h]=e?new e({type:"optional",innerType:d[h]}):d[h];return bn(this,"shape",u),u},checks:[]});return nn(t,a)}function gu(e,t,n){const r=tn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=v({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return bn(this,"shape",i),i}});return nn(t,r)}function Gn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Wn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function ro(e){return typeof e=="string"?e:e==null?void 0:e.message}function rn(e,t,n){var o,i,a,d,u,h,p,m,g,k,y;const r=j(v({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const A=(y=(k=(m=(h=ro((d=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:d.call(a,e)))!=null?h:ro((u=t==null?void 0:t.error)==null?void 0:u.call(t,e)))!=null?m:ro((p=n.customError)==null?void 0:p.call(n,e)))!=null?k:ro((g=n.localeError)==null?void 0:g.call(n,e)))!=null?y:"Invalid input";r.message=A}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function gs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function kr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:v({},t)}const ji=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ps,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Zi=w("$ZodError",ji),qi=w("$ZodError",ji,{Parent:Error});function mu(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function bu(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(i))):a[u]=a[u]||{_errors:[]},a=a[u],d++}}};return r(e),n}const ms=e=>(t,n,r,o)=>{var d;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Hn;if(a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(h=>rn(h,i,en())));throw Mi(u,o==null?void 0:o.callee),u}return a.value},bs=e=>(t,n,r,o)=>I(null,null,function*(){var d;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(h=>rn(h,i,en())));throw Mi(u,o==null?void 0:o.callee),u}return a.value}),oo=e=>(t,n,r)=>{const o=r?j(v({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Hn;return i.issues.length?{success:!1,error:new(e!=null?e:Zi)(i.issues.map(a=>rn(a,o,en())))}:{success:!0,data:i.value}},ku=oo(qi),so=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>rn(a,o,en())))}:{success:!0,data:i.value}}),_u=so(qi),vu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ms(e)(t,n,o)},yu=e=>(t,n,r)=>ms(e)(t,n,r),wu=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bs(e)(t,n,o)}),xu=e=>(t,n,r)=>I(null,null,function*(){return bs(e)(t,n,r)}),Su=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oo(e)(t,n,o)},Tu=e=>(t,n,r)=>oo(e)(t,n,r),Eu=e=>(t,n,r)=>I(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return so(e)(t,n,o)}),Au=e=>(t,n,r)=>I(null,null,function*(){return so(e)(t,n,r)}),Cu=/^[cC][^\s-]{8,}$/,Pu=/^[0-9a-z]+$/,Ru=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Lu=/^[0-9a-vA-V]{20}$/,Iu=/^[A-Za-z0-9]{27}$/,zu=/^[a-zA-Z0-9_-]{21}$/,$u=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ou=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Hi=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Nu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Du="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Mu(){return new RegExp(Du,"u")}const Uu=/^(?:(?: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])$/,ju=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Zu=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,qu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Hu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fi=/^[A-Za-z0-9_-]*$/,Fu=/^\+[1-9]\d{6,14}$/,Bi="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Bu=new RegExp(`^${Bi}$`);function Gi(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Gu(e){return new RegExp(`^${Gi(e)}$`)}function Wu(e){const t=Gi({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Bi}T(?:${r})$`)}const Ju=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Yu=/^-?\d+$/,Wi=/^-?\d+(?:\.\d+)?$/,Vu=/^(?:true|false)$/i,Xu=/^[^A-Z]*$/,Ku=/^[^a-z]*$/,st=w("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),Ji={number:"number",bigint:"bigint",object:"date"},Yi=w("$ZodCheckLessThan",(e,t)=>{st.init(e,t);const n=Ji[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vi=w("$ZodCheckGreaterThan",(e,t)=>{st.init(e,t);const n=Ji[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qu=w("$ZodCheckMultipleOf",(e,t)=>{st.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):ru(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ed=w("$ZodCheckNumberFormat",(e,t)=>{var a;st.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=cu[t.format];e._zod.onattach.push(d=>{const u=d._zod.bag;u.format=t.format,u.minimum=o,u.maximum=i,n&&(u.pattern=Yu)}),e._zod.check=d=>{const u=d.value;if(n){if(!Number.isInteger(u)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?d.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<o&&d.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>i&&d.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),td=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;st.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const d=gs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),nd=w("$ZodCheckMinLength",(e,t)=>{var r;var n;st.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const d=gs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),rd=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;st.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const d=gs(i),u=a>t.length;o.issues.push(j(v({origin:d},u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),io=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;st.init(e,t),e._zod.onattach.push(a=>{var u;const d=a._zod.bag;d.format=t.format,t.pattern&&((u=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(j(v({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),od=w("$ZodCheckRegex",(e,t)=>{io.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),sd=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Xu),io.init(e,t)}),id=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ku),io.init(e,t)}),ad=w("$ZodCheckIncludes",(e,t)=>{st.init(e,t);const n=Bn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),cd=w("$ZodCheckStartsWith",(e,t)=>{var r;st.init(e,t);const n=new RegExp(`^${Bn(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),ld=w("$ZodCheckEndsWith",(e,t)=>{var r;st.init(e,t);const n=new RegExp(`.*${Bn(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),ud=w("$ZodCheckOverwrite",(e,t)=>{st.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class dd{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1318
+ `);let Si=!1;function fr(){if(Si)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=Zl,document.head.appendChild(e),Si=!0}function Yr(e){if(e===document.body)return"body";const t=[];let n=e;for(;n&&n!==document.body;){if(n.id){t.unshift(`#${CSS.escape(n.id)}`);break}let r=n.tagName.toLowerCase();const o=n.parentElement;if(o){const i=Array.from(o.children).filter(a=>a.tagName===n.tagName);if(i.length>1){const a=i.indexOf(n)+1;r+=`:nth-of-type(${a})`}}t.unshift(r),n=n.parentElement}return t.join(" > ")||e.tagName.toLowerCase()}function Vr(e,t=200){var r;const n=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}const ql=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function Xr(e){const t=e.tagName.toLowerCase(),n=e.id?`#${e.id}`:"",r=e.classList.length?"."+Array.from(e.classList).join("."):"",o=[],i=new Set,a=d=>{if(i.has(d)||o.length>=8)return;const u=e.getAttribute(d);if(!u)return;i.add(d);const p=u.length>80?u.slice(0,80)+"…":u;o.push(`[${d}="${p}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of ql)a(d);return`${t}${n}${r}${o.join("")}`}function Hl(e,t=80){const n=Array.from(e.childNodes).filter(r=>r.nodeType===Node.TEXT_NODE).map(r=>{var o;return((o=r.textContent)!=null?o:"").trim()}).filter(Boolean).join(" ");return n.length>t?n.slice(0,t)+"…":n}function Fl(e,t=5,n=10){function r(o,i){const a=Xr(o),d=" ".repeat(i),u=Array.from(o.children).slice(0,n);if(i>=t||u.length===0){const p=Hl(o);return p?`${d}${a} "${p}"`:`${d}${a}`}return[`${d}${a}`,...u.map(p=>r(p,i+1))].join(`
1319
+ `)}return r(e,0)}const Bl='section, article, aside, nav, main, header, footer, form, fieldset, dialog, [role="region"], [role="navigation"], [role="main"], [role="complementary"], [role="banner"], [role="contentinfo"], [role="form"], [role="search"], [role="dialog"]',Gl={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function Kr(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function Wl(e){var n;const t=e.querySelectorAll('h1, h2, h3, h4, h5, h6, [role="heading"]');for(const r of Array.from(t)){let o=r.parentElement;for(;o&&o!==e&&!o.matches(Bl);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function Jl(e,t=80){var a,d,u;const n=Gl[e.tagName.toLowerCase()];if(n){const p=(d=(a=e.querySelector(n))==null?void 0:a.textContent)==null?void 0:d.trim();if(p)return Kr(p,t)}const r=Wl(e);if(r)return Kr(r,t);const o=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(o)return Kr(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var g,m,k;return(k=(m=(g=document.getElementById(h))==null?void 0:g.textContent)==null?void 0:m.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return Kr(p,t)}return""}function Yl(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":Jl(o),a=i&&!r.has(i)?`${Xr(o)} ["${i}"]`:Xr(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||Xr(e)}function Ti(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function gr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Ei(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>gr('meta[name="description"]')),canonicalUrl:e(()=>{var t;return((t=document.querySelector('link[rel="canonical"]'))==null?void 0:t.href)||void 0}),lang:e(()=>document.documentElement.lang||void 0),ogTitle:e(()=>gr('meta[property="og:title"]')),ogDescription:e(()=>gr('meta[property="og:description"]')),ogType:e(()=>gr('meta[property="og:type"]')),ogSiteName:e(()=>gr('meta[property="og:site_name"]')),viewportWidth:e(()=>window.innerWidth),viewportHeight:e(()=>window.innerHeight),scrollX:e(()=>Math.round(window.scrollX)),scrollY:e(()=>Math.round(window.scrollY)),selectionText:e(()=>{var n;const t=(n=window.getSelection())==null?void 0:n.toString().trim();return t?Ti(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function Vl(e){const t=[];let n=e;for(;n&&t.length<6;){let r=n.tagName.toLowerCase();n.id?r+=`#${n.id}`:n.classList.length&&(r+=`.${Array.from(n.classList).slice(0,2).join(".")}`),t.unshift(r),n=n.parentElement}return t.join(" > ")}function Xl(e){const t=e.getAttribute("role")||void 0,n=e.getAttribute("aria-label")||void 0;let r;const o=e.closest("section, article, main, nav, aside, header, footer, [role]");if(o){const i=o.querySelector("h1, h2, h3, h4, h5, h6"),a=o.getAttribute("aria-label")||((i==null?void 0:i.textContent)||"").trim(),d=o.tagName.toLowerCase();r=a?`${d}: ${Ti(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function Kl(e,t){const n=[e.trim(),"",`Page: ${t.pageTitle} (${t.pageUrl})`];return t.description&&n.push(`Description: ${t.description}`),t.selectionText&&n.push(`Selection: ${t.selectionText}`),t.elementText&&n.push(`Selected element: ${t.elementText}`),t.elementRole&&n.push(` Role: ${t.elementRole}`),t.elementAriaLabel&&n.push(` ARIA label: ${t.elementAriaLabel}`),t.enclosingSection&&n.push(`Section: ${t.enclosingSection}`),t.ancestry&&n.push(`Ancestry: ${t.ancestry}`),t.cssSelector&&n.push(`Selector: ${t.cssSelector}`),n.join(`
1320
+ `)}const Mn=new Set;let Un=null,Qr=!1,as=!1;function Ql(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function eu(){const e=document.querySelectorAll("dialog[open]");for(let n=0;n<e.length;n++)try{if(e[n].matches(":modal"))return!0}catch(r){}const t=document.querySelectorAll('[role="dialog"], [role="alertdialog"]');for(let n=0;n<t.length;n++){const r=t[n];if(!(Mn.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&Ql(r))return!0}return!1}function Ai(){const e=eu(),t=e&&!as;as=e;for(const n of Mn){n.hasAttribute("inert")&&n.removeAttribute("inert"),n.getAttribute("aria-hidden")==="true"&&n.removeAttribute("aria-hidden");const r=n.contains(document.activeElement);if(n.matches(":popover-open")){if(t&&!r){try{n.hidePopover()}catch(o){}try{n.showPopover()}catch(o){}}}else try{n.showPopover()}catch(o){}}}function Ci(e){if(!(e instanceof Node))return!1;for(const t of Mn)if(t===e||t.contains(e))return!0;return!1}function jn(e){(Ci(e.target)||"relatedTarget"in e&&Ci(e.relatedTarget))&&e.stopPropagation()}function tu(){Qr||(window.addEventListener("focusin",jn,!0),window.addEventListener("focusout",jn,!0),window.addEventListener("pointerdown",jn,!0),Qr=!0),!Un&&(Un=new MutationObserver(e=>{e.some(n=>n.type==="childList"||n.attributeName==="open"&&n.target.tagName==="DIALOG"||n.attributeName==="inert"||n.attributeName==="aria-hidden"||n.attributeName==="role")&&Ai()}),Un.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function jt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),Mn.add(e),tu(),Ai())}function Zt(e){if(Mn.delete(e),Mn.size===0&&(Un&&(Un.disconnect(),Un=null),Qr&&(window.removeEventListener("focusin",jn,!0),window.removeEventListener("focusout",jn,!0),window.removeEventListener("pointerdown",jn,!0),Qr=!1),as=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function cs(e="ap-sdk-highlight"){const t=document.createElement("div");return t.className=e,t.setAttribute("data-ap-sdk","1"),t.style.display="none",document.body.appendChild(t),jt(t),{el:t,update:i=>{const a=i.getBoundingClientRect();t.style.top=`${a.top}px`,t.style.left=`${a.left}px`,t.style.width=`${a.width}px`,t.style.height=`${a.height}px`,t.style.display="block"},hide:()=>{t.style.display="none"},destroy:()=>{Zt(t),t.remove()}}}const Pi=/^cc-|current-password|new-password/i,nu=/token|secret|password|apikey|auth/i,ls="[redacted]";function ru(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Pi.test(t)}function Ri(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ls);const r=n.getAttribute("autocomplete");r&&Pi.test(r)&&n.setAttribute("value",ls);for(const o of Array.from(n.attributes))nu.test(o.name)&&n.setAttribute(o.name,ls)}}const ou="🎯 Click any element to capture";let en=null,ze=null,Me=null;function mr(e){return e instanceof Element?e.closest("[data-ap-sdk]")!==null||e.closest(".ap-sdk-panel")!==null||e.closest(".ap-sdk-highlight")!==null||e.closest(".ap-sdk-picker-cursor")!==null:!1}function su(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function Li(e){en==null||en.update(e)}function Ii(e){const t=Ei(),n=Vl(e),r=Xl(e);let o;try{const i=e.cloneNode(!0);Ri(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return v(v({pageUrl:window.location.href,pageTitle:document.title,elementText:Vr(e),cssSelector:Yr(e),innerTree:Fl(e),outerTree:Yl(e),elementOuterHtml:o,ancestry:n},r),t)}function us(e,t){Me&&Me();const n=su();en=cs(),ze=document.createElement("div"),ze.className="ap-sdk-picker-cursor",ze.setAttribute("data-ap-sdk","1"),ze.textContent=n?"Tap any element to preview":ou,document.body.appendChild(ze),jt(ze);let r=null,o=null;const i=h=>{Me==null||Me(),e(Ii(h),h)},a=h=>{if(o=h,Li(h),!ze)return;ze.classList.add("ap-sdk-picker-cursor--confirm"),ze.innerHTML="";const g=document.createElement("span");g.className="ap-sdk-picker-cursor__label",g.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),Me==null||Me(),t()});const k=document.createElement("button");k.type="button",k.className="ap-sdk-picker-cursor__btn",k.textContent="⬆ Parent",k.setAttribute("data-ap-sdk","1"),k.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const y=document.createElement("button");y.type="button",y.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",y.textContent="✓ Select",y.setAttribute("data-ap-sdk","1"),y.addEventListener("click",E=>{E.preventDefault(),E.stopPropagation(),o&&i(o)}),ze.appendChild(g),ze.appendChild(m),ze.appendChild(k),ze.appendChild(y)},d=h=>{mr(h.target)||(r=h.target,Li(r))},u=h=>{var m;if(mr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const g=(m=h.target)!=null?m:r;if(g){if(n){a(g);return}i(g)}},p=h=>{h.key==="Escape"&&(Me==null||Me(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",u,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Me=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",u,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),ze&&Zt(ze),ze==null||ze.remove(),en==null||en.destroy(),en=null,ze=null,o=null,Me=null}}function ds(){Me==null||Me()}function Zn(){return Me!==null}const eo={TASK_STATUS_UPDATED:"task:status:updated",TASK_INTERACTION_CREATED:"task:interaction:created",TASK_INTERACTION_ANSWERED:"task:interaction:answered",TASK_BROWSER_COMMAND_CREATED:"task:browser-command:created"};function w(e,t,n){var d;function r(u,p){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,p);const h=a.prototype,g=Object.keys(h);for(let m=0;m<g.length;m++){const k=g[m];k in u||(u[k]=h[k].bind(u))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(u){var g;var p;const h=n!=null&&n.Parent?new i:this;r(h,u),(g=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:u=>{var p,h;return n!=null&&n.Parent&&u instanceof n.Parent?!0:(h=(p=u==null?void 0:u._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class qn extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class zi extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const $i={};function tn(e){return $i}function Oi(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ps(e,t){return typeof t=="bigint"?t.toString():t}function to(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function hs(e){return e==null}function fs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function iu(e,t){const n=(e.toString().split(".")[1]||"").length,r=t.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const u=r.match(/\d?e-(\d?)/);u!=null&&u[1]&&(o=Number.parseInt(u[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/jl(10,i)}const Ni=Symbol("evaluating");function re(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Ni)return r===void 0&&(r=Ni,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function bn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function nn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Di(e){return JSON.stringify(e)}function au(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Mi="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function br(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const cu=to(()=>{var e;if(typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch(t){return!1}});function Hn(e){if(br(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(br(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ui(e){return Hn(e)?v({},e):Array.isArray(e)?[...e]:e}const lu=new Set(["string","number","symbol"]);function Fn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rn(e,t,n){const r=new e._zod.constr(t!=null?t:e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?j(v({},t),{error:()=>t.error}):t}function uu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const du={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function pu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=nn(e._zod.def,{get shape(){const a={};for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(a[d]=n.shape[d])}return bn(this,"shape",a),a},checks:[]});return rn(e,i)}function hu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=nn(e._zod.def,{get shape(){const a=v({},e._zod.def.shape);for(const d in t){if(!(d in n.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete a[d]}return bn(this,"shape",a),a},checks:[]});return rn(e,i)}function fu(e,t){if(!Hn(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=nn(e._zod.def,{get shape(){const i=v(v({},e._zod.def.shape),t);return bn(this,"shape",i),i}});return rn(e,o)}function gu(e,t){if(!Hn(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=nn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t);return bn(this,"shape",r),r}});return rn(e,n)}function mu(e,t){const n=nn(e._zod.def,{get shape(){const r=v(v({},e._zod.def.shape),t._zod.def.shape);return bn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return rn(e,n)}function bu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=nn(t._zod.def,{get shape(){const d=t._zod.def.shape,u=v({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(u[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)u[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return bn(this,"shape",u),u},checks:[]});return rn(t,a)}function ku(e,t,n){const r=nn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=v({},o);if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return bn(this,"shape",i),i}});return rn(t,r)}function Bn(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function Gn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function no(e){return typeof e=="string"?e:e==null?void 0:e.message}function on(e,t,n){var o,i,a,d,u,p,h,g,m,k,y;const r=j(v({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const E=(y=(k=(g=(p=no((d=(a=(i=e.inst)==null?void 0:i._zod.def)==null?void 0:a.error)==null?void 0:d.call(a,e)))!=null?p:no((u=t==null?void 0:t.error)==null?void 0:u.call(t,e)))!=null?g:no((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:no((m=n.localeError)==null?void 0:m.call(n,e)))!=null?y:"Invalid input";r.message=E}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function gs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function kr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:v({},t)}const ji=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ps,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Zi=w("$ZodError",ji),qi=w("$ZodError",ji,{Parent:Error});function _u(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function vu(e,t=n=>n.message){const n={_errors:[]},r=o=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a}));else if(i.code==="invalid_key")r({issues:i.issues});else if(i.code==="invalid_element")r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let a=n,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(t(i))):a[u]=a[u]||{_errors:[]},a=a[u],d++}}};return r(e),n}const ms=e=>(t,n,r,o)=>{var d;const i=r?Object.assign(r,{async:!1}):{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new qn;if(a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>on(p,i,tn())));throw Mi(u,o==null?void 0:o.callee),u}return a.value},bs=e=>(t,n,r,o)=>L(null,null,function*(){var d;const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=yield a),a.issues.length){const u=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>on(p,i,tn())));throw Mi(u,o==null?void 0:o.callee),u}return a.value}),ro=e=>(t,n,r)=>{const o=r?j(v({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new qn;return i.issues.length?{success:!1,error:new(e!=null?e:Zi)(i.issues.map(a=>on(a,o,tn())))}:{success:!0,data:i.value}},yu=ro(qi),oo=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=yield i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>on(a,o,tn())))}:{success:!0,data:i.value}}),wu=oo(qi),xu=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ms(e)(t,n,o)},Su=e=>(t,n,r)=>ms(e)(t,n,r),Tu=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return bs(e)(t,n,o)}),Eu=e=>(t,n,r)=>L(null,null,function*(){return bs(e)(t,n,r)}),Au=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ro(e)(t,n,o)},Cu=e=>(t,n,r)=>ro(e)(t,n,r),Pu=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return oo(e)(t,n,o)}),Ru=e=>(t,n,r)=>L(null,null,function*(){return oo(e)(t,n,r)}),Lu=/^[cC][^\s-]{8,}$/,Iu=/^[0-9a-z]+$/,zu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,$u=/^[0-9a-vA-V]{20}$/,Ou=/^[A-Za-z0-9]{27}$/,Nu=/^[a-zA-Z0-9_-]{21}$/,Du=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Hi=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Uu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ju="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Zu(){return new RegExp(ju,"u")}const qu=/^(?:(?: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])$/,Hu=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,Fu=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,Bu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Gu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fi=/^[A-Za-z0-9_-]*$/,Wu=/^\+[1-9]\d{6,14}$/,Bi="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Ju=new RegExp(`^${Bi}$`);function Gi(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Yu(e){return new RegExp(`^${Gi(e)}$`)}function Vu(e){const t=Gi({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${Bi}T(?:${r})$`)}const Xu=e=>{var n,r;const t=e?`[\\s\\S]{${(n=e==null?void 0:e.minimum)!=null?n:0},${(r=e==null?void 0:e.maximum)!=null?r:""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ku=/^-?\d+$/,Wi=/^-?\d+(?:\.\d+)?$/,Qu=/^(?:true|false)$/i,ed=/^[^A-Z]*$/,td=/^[^a-z]*$/,rt=w("$ZodCheck",(e,t)=>{var r,o;var n;(r=e._zod)!=null||(e._zod={}),e._zod.def=t,(o=(n=e._zod).onattach)!=null||(n.onattach=[])}),Ji={number:"number",bigint:"bigint",object:"date"},Yi=w("$ZodCheckLessThan",(e,t)=>{rt.init(e,t);const n=Ji[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.maximum:o.exclusiveMaximum)!=null?a:Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Vi=w("$ZodCheckGreaterThan",(e,t)=>{rt.init(e,t);const n=Ji[typeof t.value];e._zod.onattach.push(r=>{var a;const o=r._zod.bag,i=(a=t.inclusive?o.minimum:o.exclusiveMinimum)!=null?a:Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),nd=w("$ZodCheckMultipleOf",(e,t)=>{rt.init(e,t),e._zod.onattach.push(n=>{var o;var r;(o=(r=n._zod.bag).multipleOf)!=null||(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):iu(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),rd=w("$ZodCheckNumberFormat",(e,t)=>{var a;rt.init(e,t),t.format=t.format||"float64";const n=(a=t.format)==null?void 0:a.includes("int"),r=n?"int":"number",[o,i]=du[t.format];e._zod.onattach.push(d=>{const u=d._zod.bag;u.format=t.format,u.minimum=o,u.maximum=i,n&&(u.pattern=Ku)}),e._zod.check=d=>{const u=d.value;if(n){if(!Number.isInteger(u)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?d.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):d.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}u<o&&d.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>i&&d.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),od=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;rt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.maximum)!=null?a:Number.POSITIVE_INFINITY;t.maximum<i&&(o._zod.bag.maximum=t.maximum)}),e._zod.check=o=>{const i=o.value;if(i.length<=t.maximum)return;const d=gs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),sd=w("$ZodCheckMinLength",(e,t)=>{var r;var n;rt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{var a;const i=(a=o._zod.bag.minimum)!=null?a:Number.NEGATIVE_INFINITY;t.minimum>i&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const i=o.value;if(i.length>=t.minimum)return;const d=gs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),id=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;rt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!hs(i)&&i.length!==void 0}),e._zod.onattach.push(o=>{const i=o._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=o=>{const i=o.value,a=i.length;if(a===t.length)return;const d=gs(i),u=a>t.length;o.issues.push(j(v({origin:d},u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),so=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;rt.init(e,t),e._zod.onattach.push(a=>{var u;const d=a._zod.bag;d.format=t.format,t.pattern&&((u=d.patterns)!=null||(d.patterns=new Set),d.patterns.add(t.pattern))}),t.pattern?(o=(n=e._zod).check)!=null||(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push(j(v({origin:"string",code:"invalid_format",format:t.format,input:a.value},t.pattern?{pattern:t.pattern.toString()}:{}),{inst:e,continue:!t.abort}))}):(i=(r=e._zod).check)!=null||(r.check=()=>{})}),ad=w("$ZodCheckRegex",(e,t)=>{so.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),cd=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ed),so.init(e,t)}),ld=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=td),so.init(e,t)}),ud=w("$ZodCheckIncludes",(e,t)=>{rt.init(e,t);const n=Fn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),dd=w("$ZodCheckStartsWith",(e,t)=>{var r;rt.init(e,t);const n=new RegExp(`^${Fn(t.prefix)}.*`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),pd=w("$ZodCheckEndsWith",(e,t)=>{var r;rt.init(e,t);const n=new RegExp(`.*${Fn(t.suffix)}$`);(r=t.pattern)!=null||(t.pattern=n),e._zod.onattach.push(o=>{var a;const i=o._zod.bag;(a=i.patterns)!=null||(i.patterns=new Set),i.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),hd=w("$ZodCheckOverwrite",(e,t)=>{rt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class fd{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
1321
1321
  `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){var i;const t=Function,n=this==null?void 0:this.args,o=[...((i=this==null?void 0:this.content)!=null?i:[""]).map(a=>` ${a}`)];return new t(...n,o.join(`
1322
- `))}}const pd={major:4,minor:3,patch:5},be=w("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pd;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const u of d._zod.onattach)u(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(h,p,m)=>{let g=Gn(h),k;for(const y of p){if(y._zod.def.when){if(!y._zod.def.when(h))continue}else if(g)continue;const A=h.issues.length,Z=y._zod.check(h);if(Z instanceof Promise&&(m==null?void 0:m.async)===!1)throw new Hn;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>I(null,null,function*(){yield Z,h.issues.length!==A&&(g||(g=Gn(h,A)))}));else{if(h.issues.length===A)continue;g||(g=Gn(h,A))}}return k?k.then(()=>h):h},u=(h,p,m)=>{if(Gn(h))return h.aborted=!0,h;const g=d(p,r,m);if(g instanceof Promise){if(m.async===!1)throw new Hn;return g.then(k=>e._zod.parse(k,m))}return e._zod.parse(g,m)};e._zod.run=(h,p)=>{if(p.skipChecks)return e._zod.parse(h,p);if(p.direction==="backward"){const g=e._zod.parse({value:h.value,issues:[]},j(v({},p),{skipChecks:!0}));return g instanceof Promise?g.then(k=>u(k,h,p)):u(g,h,p)}const m=e._zod.parse(h,p);if(m instanceof Promise){if(p.async===!1)throw new Hn;return m.then(g=>d(g,r,p))}return d(m,r,p)}}se(e,"~standard",()=>({validate:d=>{var u;try{const h=ku(e,d);return h.success?{value:h.data}:{issues:(u=h.error)==null?void 0:u.issues}}catch(h){return _u(e,d).then(p=>{var m;return p.success?{value:p.data}:{issues:(m=p.error)==null?void 0:m.issues}})}},vendor:"zod",version:1}))}),ks=w("$ZodString",(e,t)=>{var n,r,o;be.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:Ju(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),ke=w("$ZodStringFormat",(e,t)=>{io.init(e,t),ks.init(e,t)}),hd=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ou),ke.init(e,t)}),fd=w("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=Hi(i))}else(r=t.pattern)!=null||(t.pattern=Hi());ke.init(e,t)}),gd=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Nu),ke.init(e,t)}),md=w("$ZodURL",(e,t)=>{ke.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),bd=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Mu()),ke.init(e,t)}),kd=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=zu),ke.init(e,t)}),_d=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Cu),ke.init(e,t)}),vd=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Pu),ke.init(e,t)}),yd=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ru),ke.init(e,t)}),wd=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Lu),ke.init(e,t)}),xd=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Iu),ke.init(e,t)}),Sd=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Wu(t)),ke.init(e,t)}),Td=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Bu),ke.init(e,t)}),Ed=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Gu(t)),ke.init(e,t)}),Ad=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=$u),ke.init(e,t)}),Cd=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Uu),ke.init(e,t),e._zod.bag.format="ipv4"}),Pd=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ju),ke.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Rd=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Zu),ke.init(e,t)}),Ld=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=qu),ke.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Xi(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const Id=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Hu),ke.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Xi(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function zd(e){if(!Fi.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xi(n)}const $d=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Fi),ke.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{zd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Od=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Fu),ke.init(e,t)});function Nd(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const Dd=w("$ZodJWT",(e,t)=>{ke.init(e,t),e._zod.check=n=>{Nd(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ki=w("$ZodNumber",(e,t)=>{var n;be.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:Wi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(v({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),Md=w("$ZodNumberFormat",(e,t)=>{ed.init(e,t),Ki.init(e,t)}),Ud=w("$ZodBoolean",(e,t)=>{be.init(e,t),e._zod.pattern=Vu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),jd=w("$ZodAny",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),Zd=w("$ZodUnknown",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),qd=w("$ZodNever",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Qi(e,t,n){e.issues.length&&t.issues.push(...Wn(n,e.issues)),t.value[n]=e.value}const Hd=w("$ZodArray",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],u=t.element._zod.run({value:d,issues:[]},r);u instanceof Promise?i.push(u.then(h=>Qi(h,n,a))):Qi(u,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function ao(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Wn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ea(e){var r,o,i,a;const t=Object.keys(e.shape);for(const d of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[d])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=au(e.shape);return j(v({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function ta(e,t,n,r,o,i){const a=[],d=o.keySet,u=o.catchall._zod,h=u.def.type,p=u.optout==="optional";for(const m in t){if(d.has(m))continue;if(h==="never"){a.push(m);continue}const g=u.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(k=>ao(k,n,m,t,p))):ao(g,n,m,t,p)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Fd=w("$ZodObject",(e,t)=>{be.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u=v({},d);return Object.defineProperty(t,"shape",{value:u}),u}})}const r=no(()=>ea(t));se(e._zod,"propValues",()=>{var h;const d=t.shape,u={};for(const p in d){const m=d[p]._zod;if(m.values){(h=u[p])!=null||(u[p]=new Set);for(const g of m.values)u[p].add(g)}}return u});const o=br,i=t.catchall;let a;e._zod.parse=(d,u)=>{a!=null||(a=r.value);const h=d.value;if(!o(h))return d.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),d;d.value={};const p=[],m=a.shape;for(const g of a.keys){const k=m[g],y=k._zod.optout==="optional",A=k._zod.run({value:h[g],issues:[]},u);A instanceof Promise?p.push(A.then(Z=>ao(Z,d,g,h,y))):ao(A,d,g,h,y)}return i?ta(p,h,d,u,r.value,e):p.length?Promise.all(p).then(()=>d):d}}),Bd=w("$ZodObjectJIT",(e,t)=>{Fd.init(e,t);const n=e._zod.parse,r=no(()=>ea(t)),o=g=>{var T;const k=new dd(["shape","payload","ctx"]),y=r.value,A=S=>{const C=Di(S);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let J=0;for(const S of y.keys)Z[S]=`key_${J++}`;k.write("const newResult = {};");for(const S of y.keys){const C=Z[S],M=Di(S),Y=g[S],xe=((T=Y==null?void 0:Y._zod)==null?void 0:T.optout)==="optional";k.write(`const ${C} = ${A(S)};`),xe?k.write(`
1322
+ `))}}const gd={major:4,minor:3,patch:5},me=w("$ZodType",(e,t)=>{var o,i,a;var n;e!=null||(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=gd;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const u of d._zod.onattach)u(e);if(r.length===0)(i=(n=e._zod).deferred)!=null||(n.deferred=[]),(a=e._zod.deferred)==null||a.push(()=>{e._zod.run=e._zod.parse});else{const d=(p,h,g)=>{let m=Bn(p),k;for(const y of h){if(y._zod.def.when){if(!y._zod.def.when(p))continue}else if(m)continue;const E=p.issues.length,Z=y._zod.check(p);if(Z instanceof Promise&&(g==null?void 0:g.async)===!1)throw new qn;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>L(null,null,function*(){yield Z,p.issues.length!==E&&(m||(m=Bn(p,E)))}));else{if(p.issues.length===E)continue;m||(m=Bn(p,E))}}return k?k.then(()=>p):p},u=(p,h,g)=>{if(Bn(p))return p.aborted=!0,p;const m=d(h,r,g);if(m instanceof Promise){if(g.async===!1)throw new qn;return m.then(k=>e._zod.parse(k,g))}return e._zod.parse(m,g)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const m=e._zod.parse({value:p.value,issues:[]},j(v({},h),{skipChecks:!0}));return m instanceof Promise?m.then(k=>u(k,p,h)):u(m,p,h)}const g=e._zod.parse(p,h);if(g instanceof Promise){if(h.async===!1)throw new qn;return g.then(m=>d(m,r,h))}return d(g,r,h)}}re(e,"~standard",()=>({validate:d=>{var u;try{const p=yu(e,d);return p.success?{value:p.data}:{issues:(u=p.error)==null?void 0:u.issues}}catch(p){return wu(e,d).then(h=>{var g;return h.success?{value:h.data}:{issues:(g=h.error)==null?void 0:g.issues}})}},vendor:"zod",version:1}))}),ks=w("$ZodString",(e,t)=>{var n,r,o;me.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:Xu(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),be=w("$ZodStringFormat",(e,t)=>{so.init(e,t),ks.init(e,t)}),md=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Mu),be.init(e,t)}),bd=w("$ZodUUID",(e,t)=>{var n,r;if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);(n=t.pattern)!=null||(t.pattern=Hi(i))}else(r=t.pattern)!=null||(t.pattern=Hi());be.init(e,t)}),kd=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Uu),be.init(e,t)}),_d=w("$ZodURL",(e,t)=>{be.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),vd=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Zu()),be.init(e,t)}),yd=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Nu),be.init(e,t)}),wd=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Lu),be.init(e,t)}),xd=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Iu),be.init(e,t)}),Sd=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=zu),be.init(e,t)}),Td=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=$u),be.init(e,t)}),Ed=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ou),be.init(e,t)}),Ad=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Vu(t)),be.init(e,t)}),Cd=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Ju),be.init(e,t)}),Pd=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yu(t)),be.init(e,t)}),Rd=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Du),be.init(e,t)}),Ld=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=qu),be.init(e,t),e._zod.bag.format="ipv4"}),Id=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Hu),be.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),zd=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Fu),be.init(e,t)}),$d=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Bu),be.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Xi(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const Od=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Gu),be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Xi(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Nd(e){if(!Fi.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Xi(n)}const Dd=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Fi),be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Nd(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Md=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Wu),be.init(e,t)});function Ud(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch(n){return!1}}const jd=w("$ZodJWT",(e,t)=>{be.init(e,t),e._zod.check=n=>{Ud(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ki=w("$ZodNumber",(e,t)=>{var n;me.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:Wi,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch(d){}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const a=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push(v({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),Zd=w("$ZodNumberFormat",(e,t)=>{rd.init(e,t),Ki.init(e,t)}),qd=w("$ZodBoolean",(e,t)=>{me.init(e,t),e._zod.pattern=Qu,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch(i){}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),Hd=w("$ZodAny",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Fd=w("$ZodUnknown",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),Bd=w("$ZodNever",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Qi(e,t,n){e.issues.length&&t.issues.push(...Gn(n,e.issues)),t.value[n]=e.value}const Gd=w("$ZodArray",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],u=t.element._zod.run({value:d,issues:[]},r);u instanceof Promise?i.push(u.then(p=>Qi(p,n,a))):Qi(u,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function io(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Gn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function ea(e){var r,o,i,a;const t=Object.keys(e.shape);for(const d of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[d])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const n=uu(e.shape);return j(v({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function ta(e,t,n,r,o,i){const a=[],d=o.keySet,u=o.catchall._zod,p=u.def.type,h=u.optout==="optional";for(const g in t){if(d.has(g))continue;if(p==="never"){a.push(g);continue}const m=u.run({value:t[g],issues:[]},r);m instanceof Promise?e.push(m.then(k=>io(k,n,g,t,h))):io(m,n,g,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Wd=w("$ZodObject",(e,t)=>{me.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const u=v({},d);return Object.defineProperty(t,"shape",{value:u}),u}})}const r=to(()=>ea(t));re(e._zod,"propValues",()=>{var p;const d=t.shape,u={};for(const h in d){const g=d[h]._zod;if(g.values){(p=u[h])!=null||(u[h]=new Set);for(const m of g.values)u[h].add(m)}}return u});const o=br,i=t.catchall;let a;e._zod.parse=(d,u)=>{a!=null||(a=r.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const h=[],g=a.shape;for(const m of a.keys){const k=g[m],y=k._zod.optout==="optional",E=k._zod.run({value:p[m],issues:[]},u);E instanceof Promise?h.push(E.then(Z=>io(Z,d,m,p,y))):io(E,d,m,p,y)}return i?ta(h,p,d,u,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),Jd=w("$ZodObjectJIT",(e,t)=>{Wd.init(e,t);const n=e._zod.parse,r=to(()=>ea(t)),o=m=>{var T;const k=new fd(["shape","payload","ctx"]),y=r.value,E=S=>{const C=Di(S);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let ee=0;for(const S of y.keys)Z[S]=`key_${ee++}`;k.write("const newResult = {};");for(const S of y.keys){const C=Z[S],M=Di(S),J=m[S],ge=((T=J==null?void 0:J._zod)==null?void 0:T.optout)==="optional";k.write(`const ${C} = ${E(S)};`),ge?k.write(`
1323
1323
  if (${C}.issues.length) {
1324
1324
  if (${M} in input) {
1325
1325
  payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
@@ -1353,63 +1353,63 @@ button.ap-sdk-list-item__link {
1353
1353
  newResult[${M}] = ${C}.value;
1354
1354
  }
1355
1355
 
1356
- `)}k.write("payload.value = newResult;"),k.write("return payload;");const O=k.compile();return(S,C)=>O(g,S,C)};let i;const a=br,d=!$i.jitless,h=d&&su.value,p=t.catchall;let m;e._zod.parse=(g,k)=>{m!=null||(m=r.value);const y=g.value;return a(y)?d&&h&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),g=i(g,k),p?ta([],y,g,k,m,e):g):n(g,k):(g.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),g)}});function na(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Gn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>rn(a,r,en())))}),t)}const ra=w("$ZodUnion",(e,t)=>{be.init(e,t),se(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),se(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),se(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),se(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>fs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const u of t.options){const h=u._zod.run({value:o.value,issues:[]},i);if(h instanceof Promise)d.push(h),a=!0;else{if(h.issues.length===0)return h;d.push(h)}}return a?Promise.all(d).then(u=>na(u,o,e,i)):na(d,o,e,i)}}),Gd=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ra.init(e,t);const n=e._zod.parse;se(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,u]of Object.entries(a)){o[d]||(o[d]=new Set);for(const h of u)o[d].add(h)}}return o});const r=no(()=>{var a;const o=t.options,i=new Map;for(const d of o){const u=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const h of u){if(i.has(h))throw new Error(`Duplicate discriminator value "${String(h)}"`);i.set(h,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!br(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Wd=w("$ZodIntersection",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,h])=>oa(n,u,h)):oa(n,i,a)}});function _s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Fn(e)&&Fn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=v(v({},e),t);for(const i of r){const a=_s(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=_s(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function oa(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(j(v({},o),{keys:i})),Gn(e))return e;const a=_s(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Jd=w("$ZodRecord",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Fn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const h of a)if(typeof h=="string"||typeof h=="number"||typeof h=="symbol"){d.add(typeof h=="number"?h.toString():h);const p=t.valueType._zod.run({value:o[h],issues:[]},r);p instanceof Promise?i.push(p.then(m=>{m.issues.length&&n.issues.push(...Wn(h,m.issues)),n.value[h]=m.value})):(p.issues.length&&n.issues.push(...Wn(h,p.issues)),n.value[h]=p.value)}let u;for(const h in o)d.has(h)||(u=u!=null?u:[],u.push(h));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&Wi.test(d)&&u.issues.length&&u.issues.some(m=>m.code==="invalid_type"&&m.expected==="number")){const m=t.keyType._zod.run({value:Number(d),issues:[]},r);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");m.issues.length===0&&(u=m)}if(u.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(m=>rn(m,r,en())),input:d,path:[d],inst:e});continue}const p=t.valueType._zod.run({value:o[d],issues:[]},r);p instanceof Promise?i.push(p.then(m=>{m.issues.length&&n.issues.push(...Wn(d,m.issues)),n.value[u.value]=m.value})):(p.issues.length&&n.issues.push(...Wn(d,p.issues)),n.value[u.value]=p.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Yd=w("$ZodEnum",(e,t)=>{be.init(e,t);const n=Oi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>iu.has(typeof o)).map(o=>typeof o=="string"?Bn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Vd=w("$ZodLiteral",(e,t)=>{if(be.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Bn(r):r?Bn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),Xd=w("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new Hn;return n.value=o,n}});function sa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ia=w("$ZodOptional",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),se(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>sa(i,n.value)):sa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Kd=w("$ZodExactOptional",(e,t)=>{ia.init(e,t),se(e._zod,"values",()=>t.innerType._zod.values),se(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),Qd=w("$ZodNullable",(e,t)=>{be.init(e,t),se(e._zod,"optin",()=>t.innerType._zod.optin),se(e._zod,"optout",()=>t.innerType._zod.optout),se(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)}|null)$`):void 0}),se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),ep=w("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>aa(i,t)):aa(o,t)}});function aa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const tp=w("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),np=w("$ZodNonOptional",(e,t)=>{be.init(e,t),se(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ca(i,e)):ca(o,e)}});function ca(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const rp=w("$ZodCatch",(e,t)=>{be.init(e,t),se(e._zod,"optin",()=>t.innerType._zod.optin),se(e._zod,"optout",()=>t.innerType._zod.optout),se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(j(v({},n),{error:{issues:i.issues.map(a=>rn(a,r,en()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(j(v({},n),{error:{issues:o.issues.map(i=>rn(i,r,en()))},input:n.value})),n.issues=[]),n)}}),op=w("$ZodPipe",(e,t)=>{be.init(e,t),se(e._zod,"values",()=>t.in._zod.values),se(e._zod,"optin",()=>t.in._zod.optin),se(e._zod,"optout",()=>t.out._zod.optout),se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>co(a,t.in,r)):co(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>co(i,t.out,r)):co(o,t.out,r)}});function co(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const sp=w("$ZodReadonly",(e,t)=>{be.init(e,t),se(e._zod,"propValues",()=>t.innerType._zod.propValues),se(e._zod,"values",()=>t.innerType._zod.values),se(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),se(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(la):la(o)}});function la(e){return e.value=Object.freeze(e.value),e}const ip=w("$ZodCustom",(e,t)=>{st.init(e,t),be.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ua(i,n,r,e));ua(o,n,r,e)}});function ua(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(kr(i))}}var da;class ap{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=v({},(r=this.get(n))!=null?r:{});delete o.id;const i=v(v({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function cp(){return new ap}(_l=(da=globalThis).__zod_globalRegistry)!=null||(da.__zod_globalRegistry=cp());const _r=globalThis.__zod_globalRegistry;function lp(e,t){return new e(v({type:"string"},D(t)))}function up(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},D(t)))}function pa(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},D(t)))}function dp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},D(t)))}function pp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},D(t)))}function hp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},D(t)))}function fp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},D(t)))}function gp(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},D(t)))}function mp(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},D(t)))}function bp(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},D(t)))}function kp(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},D(t)))}function _p(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},D(t)))}function vp(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},D(t)))}function yp(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},D(t)))}function wp(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},D(t)))}function xp(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},D(t)))}function Sp(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},D(t)))}function Tp(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},D(t)))}function Ep(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},D(t)))}function Ap(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},D(t)))}function Cp(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},D(t)))}function Pp(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},D(t)))}function Rp(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},D(t)))}function Lp(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},D(t)))}function Ip(e,t){return new e(v({type:"string",format:"date",check:"string_format"},D(t)))}function zp(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},D(t)))}function $p(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},D(t)))}function Op(e,t){return new e(v({type:"number",checks:[]},D(t)))}function Np(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},D(t)))}function Dp(e,t){return new e(v({type:"boolean"},D(t)))}function Mp(e){return new e({type:"any"})}function Up(e){return new e({type:"unknown"})}function jp(e,t){return new e(v({type:"never"},D(t)))}function ha(e,t){return new Yi(j(v({check:"less_than"},D(t)),{value:e,inclusive:!1}))}function vs(e,t){return new Yi(j(v({check:"less_than"},D(t)),{value:e,inclusive:!0}))}function fa(e,t){return new Vi(j(v({check:"greater_than"},D(t)),{value:e,inclusive:!1}))}function ys(e,t){return new Vi(j(v({check:"greater_than"},D(t)),{value:e,inclusive:!0}))}function ga(e,t){return new Qu(j(v({check:"multiple_of"},D(t)),{value:e}))}function ma(e,t){return new td(j(v({check:"max_length"},D(t)),{maximum:e}))}function lo(e,t){return new nd(j(v({check:"min_length"},D(t)),{minimum:e}))}function ba(e,t){return new rd(j(v({check:"length_equals"},D(t)),{length:e}))}function Zp(e,t){return new od(j(v({check:"string_format",format:"regex"},D(t)),{pattern:e}))}function qp(e){return new sd(v({check:"string_format",format:"lowercase"},D(e)))}function Hp(e){return new id(v({check:"string_format",format:"uppercase"},D(e)))}function Fp(e,t){return new ad(j(v({check:"string_format",format:"includes"},D(t)),{includes:e}))}function Bp(e,t){return new cd(j(v({check:"string_format",format:"starts_with"},D(t)),{prefix:e}))}function Gp(e,t){return new ld(j(v({check:"string_format",format:"ends_with"},D(t)),{suffix:e}))}function Jn(e){return new ud({check:"overwrite",tx:e})}function Wp(e){return Jn(t=>t.normalize(e))}function Jp(){return Jn(e=>e.trim())}function Yp(){return Jn(e=>e.toLowerCase())}function Vp(){return Jn(e=>e.toUpperCase())}function Xp(){return Jn(e=>ou(e))}function Kp(e,t,n){return new e(v({type:"array",element:t},D(n)))}function Qp(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},D(n)))}function eh(e){const t=th(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(kr(r,n.value,t._zod.def));else{const u=r;u.fatal&&(u.continue=!1),(o=u.code)!=null||(u.code="custom"),(i=u.input)!=null||(u.input=n.value),(a=u.inst)!=null||(u.inst=t),(d=u.continue)!=null||(u.continue=!t._zod.def.abort),n.issues.push(kr(u))}},e(n.value,n)));return t}function th(e,t){const n=new st(v({check:"custom"},D(t)));return n._zod.check=e,n}function ka(e){var n,r,o,i,a,d,u,h,p;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:_r,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(u=e==null?void 0:e.cycles)!=null?u:"ref",reused:(h=e==null?void 0:e.reused)!=null?h:"inline",external:(p=e==null?void 0:e.external)!=null?p:void 0}}function Ee(e,t,n={path:[],schemaPath:[]}){var p,m,g;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(m=(p=e._zod).toJSONSchema)==null?void 0:m.call(p);if(d)a.schema=d;else{const k=j(v({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const A=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,A,k)}const y=e._zod.parent;y&&(a.ref||(a.ref=y),Ee(y,t,k),t.seen.get(y).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&Je(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((g=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function _a(e,t){var a,d,u,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const p of e.seen.entries()){const m=(a=e.metadataRegistry.get(p[0]))==null?void 0:a.id;if(m){const g=r.get(m);if(g&&g!==p[0])throw new Error(`Duplicate schema id "${m}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(m,p[0])}}const o=p=>{var A,Z,J,O,T;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(A=e.external.registry.get(p[0]))==null?void 0:A.id,C=(Z=e.external.uri)!=null?Z:(Y=>Y);if(S)return{ref:C(S)};const M=(O=(J=p[1].defId)!=null?J:p[1].schema.id)!=null?O:`schema${e.counter++}`;return p[1].defId=M,{defId:M,ref:`${C("__shared")}#/${m}/${M}`}}if(p[1]===n)return{ref:"#"};const k=`#/${m}/`,y=(T=p[1].schema.id)!=null?T:`__schema${e.counter++}`;return{defId:y,ref:k+y}},i=p=>{if(p[1].schema.$ref)return;const m=p[1],{ref:g,defId:k}=o(p);m.def=v({},m.schema),k&&(m.defId=k);const y=m.schema;for(const A in y)delete y[A];y.$ref=g};if(e.cycles==="throw")for(const p of e.seen.entries()){const m=p[1];if(m.cycle)throw new Error(`Cycle detected: #/${(d=m.cycle)==null?void 0:d.join("/")}/<root>
1356
+ `)}k.write("payload.value = newResult;"),k.write("return payload;");const N=k.compile();return(S,C)=>N(m,S,C)};let i;const a=br,d=!$i.jitless,p=d&&cu.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const y=m.value;return a(y)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?ta([],y,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function na(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!Bn(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>on(a,r,tn())))}),t)}const ra=w("$ZodUnion",(e,t)=>{me.init(e,t),re(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),re(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),re(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),re(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>fs(i.source)).join("|")})$`)}});const n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(n)return r(o,i);let a=!1;const d=[];for(const u of t.options){const p=u._zod.run({value:o.value,issues:[]},i);if(p instanceof Promise)d.push(p),a=!0;else{if(p.issues.length===0)return p;d.push(p)}}return a?Promise.all(d).then(u=>na(u,o,e,i)):na(d,o,e,i)}}),Yd=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ra.init(e,t);const n=e._zod.parse;re(e._zod,"propValues",()=>{const o={};for(const i of t.options){const a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[d,u]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of u)o[d].add(p)}}return o});const r=to(()=>{var a;const o=t.options,i=new Map;for(const d of o){const u=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of u){if(i.has(p))throw new Error(`Duplicate discriminator value "${String(p)}"`);i.set(p,d)}}return i});e._zod.parse=(o,i)=>{const a=o.value;if(!br(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const d=r.value.get(a==null?void 0:a[t.discriminator]);return d?d._zod.run(o,i):t.unionFallback?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Vd=w("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([u,p])=>oa(n,u,p)):oa(n,i,a)}});function _s(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Hn(e)&&Hn(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=v(v({},e),t);for(const i of r){const a=_s(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=_s(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function oa(e,t,n){const r=new Map;let o;for(const d of t.issues)if(d.code==="unrecognized_keys"){o!=null||(o=d);for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const u of d.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(d);const i=[...r].filter(([,d])=>d.l&&d.r).map(([d])=>d);if(i.length&&o&&e.issues.push(j(v({},o),{keys:i})),Bn(e))return e;const a=_s(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Xd=w("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Hn(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Gn(p,h.issues)),n.value[p]=h.value)}let u;for(const p in o)d.has(p)||(u=u!=null?u:[],u.push(p));u&&u.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:u})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let u=t.keyType._zod.run({value:d,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&Wi.test(d)&&u.issues.length&&u.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(u=g)}if(u.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(g=>on(g,r,tn())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Gn(d,g.issues)),n.value[u.value]=g.value})):(h.issues.length&&n.issues.push(...Gn(d,h.issues)),n.value[u.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Kd=w("$ZodEnum",(e,t)=>{me.init(e,t);const n=Oi(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>lu.has(typeof o)).map(o=>typeof o=="string"?Fn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Qd=w("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?Fn(r):r?Fn(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),ep=w("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n));if(o instanceof Promise)throw new qn;return n.value=o,n}});function sa(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const ia=w("$ZodOptional",(e,t)=>{me.init(e,t),e._zod.optin="optional",e._zod.optout="optional",re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),re(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>sa(i,n.value)):sa(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),tp=w("$ZodExactOptional",(e,t)=>{ia.init(e,t),re(e._zod,"values",()=>t.innerType._zod.values),re(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),np=w("$ZodNullable",(e,t)=>{me.init(e,t),re(e._zod,"optin",()=>t.innerType._zod.optin),re(e._zod,"optout",()=>t.innerType._zod.optout),re(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${fs(n.source)}|null)$`):void 0}),re(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),rp=w("$ZodDefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>aa(i,t)):aa(o,t)}});function aa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const op=w("$ZodPrefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),sp=w("$ZodNonOptional",(e,t)=>{me.init(e,t),re(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>ca(i,e)):ca(o,e)}});function ca(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const ip=w("$ZodCatch",(e,t)=>{me.init(e,t),re(e._zod,"optin",()=>t.innerType._zod.optin),re(e._zod,"optout",()=>t.innerType._zod.optout),re(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue(j(v({},n),{error:{issues:i.issues.map(a=>on(a,r,tn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(j(v({},n),{error:{issues:o.issues.map(i=>on(i,r,tn()))},input:n.value})),n.issues=[]),n)}}),ap=w("$ZodPipe",(e,t)=>{me.init(e,t),re(e._zod,"values",()=>t.in._zod.values),re(e._zod,"optin",()=>t.in._zod.optin),re(e._zod,"optout",()=>t.out._zod.optout),re(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>ao(a,t.in,r)):ao(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>ao(i,t.out,r)):ao(o,t.out,r)}});function ao(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const cp=w("$ZodReadonly",(e,t)=>{me.init(e,t),re(e._zod,"propValues",()=>t.innerType._zod.propValues),re(e._zod,"values",()=>t.innerType._zod.values),re(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),re(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(la):la(o)}});function la(e){return e.value=Object.freeze(e.value),e}const lp=w("$ZodCustom",(e,t)=>{rt.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>ua(i,n,r,e));ua(o,n,r,e)}});function ua(e,t,n,r){var o;if(!e){const i={code:"custom",input:n,inst:r,path:[...(o=r._zod.def.path)!=null?o:[]],continue:!r._zod.def.abort};r._zod.def.params&&(i.params=r._zod.def.params),t.issues.push(kr(i))}}var da;class up{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){var r;const n=t._zod.parent;if(n){const o=v({},(r=this.get(n))!=null?r:{});delete o.id;const i=v(v({},o),this._map.get(t));return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function dp(){return new up}(wl=(da=globalThis).__zod_globalRegistry)!=null||(da.__zod_globalRegistry=dp());const _r=globalThis.__zod_globalRegistry;function pp(e,t){return new e(v({type:"string"},D(t)))}function hp(e,t){return new e(v({type:"string",format:"email",check:"string_format",abort:!1},D(t)))}function pa(e,t){return new e(v({type:"string",format:"guid",check:"string_format",abort:!1},D(t)))}function fp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1},D(t)))}function gp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},D(t)))}function mp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},D(t)))}function bp(e,t){return new e(v({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},D(t)))}function kp(e,t){return new e(v({type:"string",format:"url",check:"string_format",abort:!1},D(t)))}function _p(e,t){return new e(v({type:"string",format:"emoji",check:"string_format",abort:!1},D(t)))}function vp(e,t){return new e(v({type:"string",format:"nanoid",check:"string_format",abort:!1},D(t)))}function yp(e,t){return new e(v({type:"string",format:"cuid",check:"string_format",abort:!1},D(t)))}function wp(e,t){return new e(v({type:"string",format:"cuid2",check:"string_format",abort:!1},D(t)))}function xp(e,t){return new e(v({type:"string",format:"ulid",check:"string_format",abort:!1},D(t)))}function Sp(e,t){return new e(v({type:"string",format:"xid",check:"string_format",abort:!1},D(t)))}function Tp(e,t){return new e(v({type:"string",format:"ksuid",check:"string_format",abort:!1},D(t)))}function Ep(e,t){return new e(v({type:"string",format:"ipv4",check:"string_format",abort:!1},D(t)))}function Ap(e,t){return new e(v({type:"string",format:"ipv6",check:"string_format",abort:!1},D(t)))}function Cp(e,t){return new e(v({type:"string",format:"cidrv4",check:"string_format",abort:!1},D(t)))}function Pp(e,t){return new e(v({type:"string",format:"cidrv6",check:"string_format",abort:!1},D(t)))}function Rp(e,t){return new e(v({type:"string",format:"base64",check:"string_format",abort:!1},D(t)))}function Lp(e,t){return new e(v({type:"string",format:"base64url",check:"string_format",abort:!1},D(t)))}function Ip(e,t){return new e(v({type:"string",format:"e164",check:"string_format",abort:!1},D(t)))}function zp(e,t){return new e(v({type:"string",format:"jwt",check:"string_format",abort:!1},D(t)))}function $p(e,t){return new e(v({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},D(t)))}function Op(e,t){return new e(v({type:"string",format:"date",check:"string_format"},D(t)))}function Np(e,t){return new e(v({type:"string",format:"time",check:"string_format",precision:null},D(t)))}function Dp(e,t){return new e(v({type:"string",format:"duration",check:"string_format"},D(t)))}function Mp(e,t){return new e(v({type:"number",checks:[]},D(t)))}function Up(e,t){return new e(v({type:"number",check:"number_format",abort:!1,format:"safeint"},D(t)))}function jp(e,t){return new e(v({type:"boolean"},D(t)))}function Zp(e){return new e({type:"any"})}function qp(e){return new e({type:"unknown"})}function Hp(e,t){return new e(v({type:"never"},D(t)))}function ha(e,t){return new Yi(j(v({check:"less_than"},D(t)),{value:e,inclusive:!1}))}function vs(e,t){return new Yi(j(v({check:"less_than"},D(t)),{value:e,inclusive:!0}))}function fa(e,t){return new Vi(j(v({check:"greater_than"},D(t)),{value:e,inclusive:!1}))}function ys(e,t){return new Vi(j(v({check:"greater_than"},D(t)),{value:e,inclusive:!0}))}function ga(e,t){return new nd(j(v({check:"multiple_of"},D(t)),{value:e}))}function ma(e,t){return new od(j(v({check:"max_length"},D(t)),{maximum:e}))}function co(e,t){return new sd(j(v({check:"min_length"},D(t)),{minimum:e}))}function ba(e,t){return new id(j(v({check:"length_equals"},D(t)),{length:e}))}function Fp(e,t){return new ad(j(v({check:"string_format",format:"regex"},D(t)),{pattern:e}))}function Bp(e){return new cd(v({check:"string_format",format:"lowercase"},D(e)))}function Gp(e){return new ld(v({check:"string_format",format:"uppercase"},D(e)))}function Wp(e,t){return new ud(j(v({check:"string_format",format:"includes"},D(t)),{includes:e}))}function Jp(e,t){return new dd(j(v({check:"string_format",format:"starts_with"},D(t)),{prefix:e}))}function Yp(e,t){return new pd(j(v({check:"string_format",format:"ends_with"},D(t)),{suffix:e}))}function Wn(e){return new hd({check:"overwrite",tx:e})}function Vp(e){return Wn(t=>t.normalize(e))}function Xp(){return Wn(e=>e.trim())}function Kp(){return Wn(e=>e.toLowerCase())}function Qp(){return Wn(e=>e.toUpperCase())}function eh(){return Wn(e=>au(e))}function th(e,t,n){return new e(v({type:"array",element:t},D(n)))}function nh(e,t,n){return new e(v({type:"custom",check:"custom",fn:t},D(n)))}function rh(e){const t=oh(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(kr(r,n.value,t._zod.def));else{const u=r;u.fatal&&(u.continue=!1),(o=u.code)!=null||(u.code="custom"),(i=u.input)!=null||(u.input=n.value),(a=u.inst)!=null||(u.inst=t),(d=u.continue)!=null||(u.continue=!t._zod.def.abort),n.issues.push(kr(u))}},e(n.value,n)));return t}function oh(e,t){const n=new rt(v({check:"custom"},D(t)));return n._zod.check=e,n}function ka(e){var n,r,o,i,a,d,u,p,h;let t=(n=e==null?void 0:e.target)!=null?n:"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:(r=e.processors)!=null?r:{},metadataRegistry:(o=e==null?void 0:e.metadata)!=null?o:_r,target:t,unrepresentable:(i=e==null?void 0:e.unrepresentable)!=null?i:"throw",override:(a=e==null?void 0:e.override)!=null?a:(()=>{}),io:(d=e==null?void 0:e.io)!=null?d:"output",counter:0,seen:new Map,cycles:(u=e==null?void 0:e.cycles)!=null?u:"ref",reused:(p=e==null?void 0:e.reused)!=null?p:"inline",external:(h=e==null?void 0:e.external)!=null?h:void 0}}function Ae(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=j(v({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const E=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,E,k)}const y=e._zod.parent;y&&(a.ref||(a.ref=y),Ae(y,t,k),t.seen.get(y).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&We(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function _a(e,t){var a,d,u,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const h of e.seen.entries()){const g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var E,Z,ee,N,T;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(E=e.external.registry.get(h[0]))==null?void 0:E.id,C=(Z=e.external.uri)!=null?Z:(J=>J);if(S)return{ref:C(S)};const M=(N=(ee=h[1].defId)!=null?ee:h[1].schema.id)!=null?N:`schema${e.counter++}`;return h[1].defId=M,{defId:M,ref:`${C("__shared")}#/${g}/${M}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,y=(T=h[1].schema.id)!=null?T:`__schema${e.counter++}`;return{defId:y,ref:k+y}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=v({},g.schema),k&&(g.defId=k);const y=g.schema;for(const E in y)delete y[E];y.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1357
1357
 
1358
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const p of e.seen.entries()){const m=p[1];if(t===p[0]){i(p);continue}if(e.external){const k=(u=e.external.registry.get(p[0]))==null?void 0:u.id;if(t!==p[0]&&k){i(p);continue}}if((h=e.metadataRegistry.get(p[0]))==null?void 0:h.id){i(p);continue}if(m.cycle){i(p);continue}if(m.count>1&&e.reused==="ref"){i(p);continue}}}function va(e,t){var a,d,u,h,p;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{var J,O,T;const g=e.seen.get(m);if(g.ref===null)return;const k=(J=g.def)!=null?J:g.schema,y=v({},k),A=g.ref;if(g.ref=null,A){r(A);const S=e.seen.get(A),C=S.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(O=k.allOf)!=null?O:[],k.allOf.push(C)):Object.assign(k,C),Object.assign(k,y),m._zod.parent===A)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in y||delete k[Y];if(C.$ref)for(const Y in k)Y==="$ref"||Y==="allOf"||Y in S.def&&JSON.stringify(k[Y])===JSON.stringify(S.def[Y])&&delete k[Y]}const Z=m._zod.parent;if(Z&&Z!==A){r(Z);const S=e.seen.get(Z);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const C in k)C==="$ref"||C==="allOf"||C in S.def&&JSON.stringify(k[C])===JSON.stringify(S.def[C])&&delete k[C]}e.override({zodSchema:m,jsonSchema:k,path:(T=g.path)!=null?T:[]})};for(const m of[...e.seen.entries()].reverse())r(m[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const m=(d=e.external.registry.get(t))==null?void 0:d.id;if(!m)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(m)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(p=(h=e.external)==null?void 0:h.defs)!=null?p:{};for(const m of e.seen.entries()){const g=m[1];g.def&&g.defId&&(i[g.defId]=g.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const m=JSON.parse(JSON.stringify(o));return Object.defineProperty(m,"~standard",{value:j(v({},t["~standard"]),{jsonSchema:{input:uo(t,"input",e.processors),output:uo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),m}catch(m){throw new Error("Error converting schema to JSON.")}}function Je(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Je(r.element,n);if(r.type==="set")return Je(r.valueType,n);if(r.type==="lazy")return Je(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Je(r.innerType,n);if(r.type==="intersection")return Je(r.left,n)||Je(r.right,n);if(r.type==="record"||r.type==="map")return Je(r.keyType,n)||Je(r.valueType,n);if(r.type==="pipe")return Je(r.in,n)||Je(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Je(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Je(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Je(o,n))return!0;return!!(r.rest&&Je(r.rest,n))}return!1}const nh=(e,t={})=>n=>{const r=ka(j(v({},n),{processors:t}));return Ee(e,r),_a(r,e),va(r,e)},uo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ka(j(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ee(e,a),_a(a,e),va(a,e)},rh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},oh=(e,t,n,r)=>{var p;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:h}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(p=rh[d])!=null?p:d,o.format===""&&delete o.format,d==="time"&&delete o.format),h&&(o.contentEncoding=h),u&&u.size>0){const m=[...u];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(g=>j(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:g.source}))])}},sh=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:h,exclusiveMinimum:p}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=p,o.exclusiveMinimum=!0):o.exclusiveMinimum=p),typeof i=="number"&&(o.minimum=i,typeof p=="number"&&t.target!=="draft-04"&&(p>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=h,o.exclusiveMaximum=!0):o.exclusiveMaximum=h),typeof a=="number"&&(o.maximum=a,typeof h=="number"&&t.target!=="draft-04"&&(h<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},ih=(e,t,n,r)=>{n.type="boolean"},ah=(e,t,n,r)=>{n.not={}},ch=(e,t,n,r)=>{},lh=(e,t,n,r)=>{},uh=(e,t,n,r)=>{const o=e._zod.def,i=Oi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},dh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},ph=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},hh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},fh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ee(i.element,t,j(v({},r),{path:[...r.path,"items"]}))},gh=(e,t,n,r)=>{var h;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const p in a)o.properties[p]=Ee(a[p],t,j(v({},r),{path:[...r.path,"properties",p]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(p=>{const m=i.shape[p]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((h=i.catchall)==null?void 0:h._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ee(i.catchall,t,j(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},mh=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ee(d,t,j(v({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},bh=(e,t,n,r)=>{const o=e._zod.def,i=Ee(o.left,t,j(v({},r),{path:[...r.path,"allOf",0]})),a=Ee(o.right,t,j(v({},r),{path:[...r.path,"allOf",1]})),d=h=>"allOf"in h&&Object.keys(h).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},kh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const p=Ee(i.valueType,t,j(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const m of u)o.patternProperties[m.source]=p}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ee(i.keyType,t,j(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ee(i.valueType,t,j(v({},r),{path:[...r.path,"additionalProperties"]}));const h=a._zod.values;if(h){const p=[...h].filter(m=>typeof m=="string"||typeof m=="number");p.length>0&&(o.required=p)}},_h=(e,t,n,r)=>{const o=e._zod.def,i=Ee(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},vh=(e,t,n,r)=>{const o=e._zod.def;Ee(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},yh=(e,t,n,r)=>{const o=e._zod.def;Ee(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},wh=(e,t,n,r)=>{const o=e._zod.def;Ee(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},xh=(e,t,n,r)=>{const o=e._zod.def;Ee(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Sh=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ee(i,t,r);const a=t.seen.get(e);a.ref=i},Th=(e,t,n,r)=>{const o=e._zod.def;Ee(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ya=(e,t,n,r)=>{const o=e._zod.def;Ee(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Eh=w("ZodISODateTime",(e,t)=>{Sd.init(e,t),we.init(e,t)});function Ah(e){return Lp(Eh,e)}const Ch=w("ZodISODate",(e,t)=>{Td.init(e,t),we.init(e,t)});function Ph(e){return Ip(Ch,e)}const Rh=w("ZodISOTime",(e,t)=>{Ed.init(e,t),we.init(e,t)});function Lh(e){return zp(Rh,e)}const Ih=w("ZodISODuration",(e,t)=>{Ad.init(e,t),we.init(e,t)});function zh(e){return $p(Ih,e)}const lt=w("ZodError",(e,t)=>{Zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>bu(e,n)},flatten:{value:n=>mu(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ps,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),$h=ms(lt),Oh=bs(lt),Nh=oo(lt),Dh=so(lt),Mh=vu(lt),Uh=yu(lt),jh=wu(lt),Zh=xu(lt),qh=Su(lt),Hh=Tu(lt),Fh=Eu(lt),Bh=Au(lt),_e=w("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:uo(e,"input"),output:uo(e,"output")}}),e.toJSONSchema=nh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(tn(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>nn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>$h(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Nh(e,n,r),e.parseAsync=(n,r)=>I(null,null,function*(){return Oh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>I(null,null,function*(){return Dh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Mh(e,n,r),e.decode=(n,r)=>Uh(e,n,r),e.encodeAsync=(n,r)=>I(null,null,function*(){return jh(e,n,r)}),e.decodeAsync=(n,r)=>I(null,null,function*(){return Zh(e,n,r)}),e.safeEncode=(n,r)=>qh(e,n,r),e.safeDecode=(n,r)=>Hh(e,n,r),e.safeEncodeAsync=(n,r)=>I(null,null,function*(){return Fh(e,n,r)}),e.safeDecodeAsync=(n,r)=>I(null,null,function*(){return Bh(e,n,r)}),e.refine=(n,r)=>e.check(Zf(n,r)),e.superRefine=n=>e.check(qf(n)),e.overwrite=n=>e.check(Jn(n)),e.optional=()=>La(e),e.exactOptional=()=>Cf(e),e.nullable=()=>Ia(e),e.nullish=()=>La(Ia(e)),e.nonoptional=n=>$f(e,n),e.array=()=>_t(e),e.or=n=>_f([e,n]),e.and=n=>wf(e,n),e.transform=n=>$a(e,Ef(n)),e.default=n=>Lf(e,n),e.prefault=n=>zf(e,n),e.catch=n=>Nf(e,n),e.pipe=n=>$a(e,n),e.readonly=()=>Uf(e),e.describe=n=>{const r=e.clone();return _r.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=_r.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _r.get(e);const r=e.clone();return _r.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),wa=w("_ZodString",(e,t)=>{var r,o,i;ks.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(a,d,u)=>oh(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Zp(...a)),e.includes=(...a)=>e.check(Fp(...a)),e.startsWith=(...a)=>e.check(Bp(...a)),e.endsWith=(...a)=>e.check(Gp(...a)),e.min=(...a)=>e.check(lo(...a)),e.max=(...a)=>e.check(ma(...a)),e.length=(...a)=>e.check(ba(...a)),e.nonempty=(...a)=>e.check(lo(1,...a)),e.lowercase=a=>e.check(qp(a)),e.uppercase=a=>e.check(Hp(a)),e.trim=()=>e.check(Jp()),e.normalize=(...a)=>e.check(Wp(...a)),e.toLowerCase=()=>e.check(Yp()),e.toUpperCase=()=>e.check(Vp()),e.slugify=()=>e.check(Xp())}),Gh=w("ZodString",(e,t)=>{ks.init(e,t),wa.init(e,t),e.email=n=>e.check(up(Wh,n)),e.url=n=>e.check(gp(Jh,n)),e.jwt=n=>e.check(Rp(uf,n)),e.emoji=n=>e.check(mp(Yh,n)),e.guid=n=>e.check(pa(xa,n)),e.uuid=n=>e.check(dp(po,n)),e.uuidv4=n=>e.check(pp(po,n)),e.uuidv6=n=>e.check(hp(po,n)),e.uuidv7=n=>e.check(fp(po,n)),e.nanoid=n=>e.check(bp(Vh,n)),e.guid=n=>e.check(pa(xa,n)),e.cuid=n=>e.check(kp(Xh,n)),e.cuid2=n=>e.check(_p(Kh,n)),e.ulid=n=>e.check(vp(Qh,n)),e.base64=n=>e.check(Ap(af,n)),e.base64url=n=>e.check(Cp(cf,n)),e.xid=n=>e.check(yp(ef,n)),e.ksuid=n=>e.check(wp(tf,n)),e.ipv4=n=>e.check(xp(nf,n)),e.ipv6=n=>e.check(Sp(rf,n)),e.cidrv4=n=>e.check(Tp(of,n)),e.cidrv6=n=>e.check(Ep(sf,n)),e.e164=n=>e.check(Pp(lf,n)),e.datetime=n=>e.check(Ah(n)),e.date=n=>e.check(Ph(n)),e.time=n=>e.check(Lh(n)),e.duration=n=>e.check(zh(n))});function R(e){return lp(Gh,e)}const we=w("ZodStringFormat",(e,t)=>{ke.init(e,t),wa.init(e,t)}),Wh=w("ZodEmail",(e,t)=>{gd.init(e,t),we.init(e,t)}),xa=w("ZodGUID",(e,t)=>{hd.init(e,t),we.init(e,t)}),po=w("ZodUUID",(e,t)=>{fd.init(e,t),we.init(e,t)}),Jh=w("ZodURL",(e,t)=>{md.init(e,t),we.init(e,t)}),Yh=w("ZodEmoji",(e,t)=>{bd.init(e,t),we.init(e,t)}),Vh=w("ZodNanoID",(e,t)=>{kd.init(e,t),we.init(e,t)}),Xh=w("ZodCUID",(e,t)=>{_d.init(e,t),we.init(e,t)}),Kh=w("ZodCUID2",(e,t)=>{vd.init(e,t),we.init(e,t)}),Qh=w("ZodULID",(e,t)=>{yd.init(e,t),we.init(e,t)}),ef=w("ZodXID",(e,t)=>{wd.init(e,t),we.init(e,t)}),tf=w("ZodKSUID",(e,t)=>{xd.init(e,t),we.init(e,t)}),nf=w("ZodIPv4",(e,t)=>{Cd.init(e,t),we.init(e,t)}),rf=w("ZodIPv6",(e,t)=>{Pd.init(e,t),we.init(e,t)}),of=w("ZodCIDRv4",(e,t)=>{Rd.init(e,t),we.init(e,t)}),sf=w("ZodCIDRv6",(e,t)=>{Ld.init(e,t),we.init(e,t)}),af=w("ZodBase64",(e,t)=>{Id.init(e,t),we.init(e,t)}),cf=w("ZodBase64URL",(e,t)=>{$d.init(e,t),we.init(e,t)}),lf=w("ZodE164",(e,t)=>{Od.init(e,t),we.init(e,t)}),uf=w("ZodJWT",(e,t)=>{Dd.init(e,t),we.init(e,t)}),Sa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,h,p,m;Ki.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(g,k,y)=>sh(e,g,k),e.gt=(g,k)=>e.check(fa(g,k)),e.gte=(g,k)=>e.check(ys(g,k)),e.min=(g,k)=>e.check(ys(g,k)),e.lt=(g,k)=>e.check(ha(g,k)),e.lte=(g,k)=>e.check(vs(g,k)),e.max=(g,k)=>e.check(vs(g,k)),e.int=g=>e.check(Ta(g)),e.safe=g=>e.check(Ta(g)),e.positive=g=>e.check(fa(0,g)),e.nonnegative=g=>e.check(ys(0,g)),e.negative=g=>e.check(ha(0,g)),e.nonpositive=g=>e.check(vs(0,g)),e.multipleOf=(g,k)=>e.check(ga(g,k)),e.step=(g,k)=>e.check(ga(g,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((h=n.format)!=null?h:"").includes("int")||Number.isSafeInteger((p=n.multipleOf)!=null?p:.5),e.isFinite=!0,e.format=(m=n.format)!=null?m:null});function It(e){return Op(Sa,e)}const df=w("ZodNumberFormat",(e,t)=>{Md.init(e,t),Sa.init(e,t)});function Ta(e){return Np(df,e)}const pf=w("ZodBoolean",(e,t)=>{Ud.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ih(e,n,r)});function ve(e){return Dp(pf,e)}const hf=w("ZodAny",(e,t)=>{jd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ch()});function Ea(){return Mp(hf)}const ff=w("ZodUnknown",(e,t)=>{Zd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh()});function Aa(){return Up(ff)}const gf=w("ZodNever",(e,t)=>{qd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ah(e,n,r)});function mf(e){return jp(gf,e)}const bf=w("ZodArray",(e,t)=>{Hd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(lo(n,r)),e.nonempty=n=>e.check(lo(1,n)),e.max=(n,r)=>e.check(ma(n,r)),e.length=(n,r)=>e.check(ba(n,r)),e.unwrap=()=>e.element});function _t(e,t){return Kp(bf,e,t)}const kf=w("ZodObject",(e,t)=>{Bd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n,r,o),se(e,"shape",()=>t.shape),e.keyof=()=>ut(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(j(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.loose=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.strict=()=>e.clone(j(v({},e._zod.def),{catchall:mf()})),e.strip=()=>e.clone(j(v({},e._zod.def),{catchall:void 0})),e.extend=n=>du(e,n),e.safeExtend=n=>pu(e,n),e.merge=n=>hu(e,n),e.pick=n=>lu(e,n),e.omit=n=>uu(e,n),e.partial=(...n)=>fu(Ra,e,n[0]),e.required=(...n)=>gu(za,e,n[0])});function me(e,t){const n=v({type:"object",shape:e!=null?e:{}},D(t));return new kf(n)}const Ca=w("ZodUnion",(e,t)=>{ra.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(e,n,r,o),e.options=t.options});function _f(e,t){return new Ca(v({type:"union",options:e},D(t)))}const vf=w("ZodDiscriminatedUnion",(e,t)=>{Ca.init(e,t),Gd.init(e,t)});function Pa(e,t,n){return new vf(v({type:"union",options:t,discriminator:e},D(n)))}const yf=w("ZodIntersection",(e,t)=>{Wd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n,r,o)});function wf(e,t){return new yf({type:"intersection",left:e,right:t})}const xf=w("ZodRecord",(e,t)=>{Jd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function zt(e,t,n){return new xf(v({type:"record",keyType:e,valueType:t},D(n)))}const ws=w("ZodEnum",(e,t)=>{Yd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,o,i)=>uh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))}});function ut(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws(v({type:"enum",entries:n},D(t)))}const Sf=w("ZodLiteral",(e,t)=>{Vd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function dt(e,t){return new Sf(v({type:"literal",values:Array.isArray(e)?e:[e]},D(t)))}const Tf=w("ZodTransform",(e,t)=>{Xd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(kr(i,n.value,t));else{const h=i;h.fatal&&(h.continue=!1),(a=h.code)!=null||(h.code="custom"),(d=h.input)!=null||(h.input=n.value),(u=h.inst)!=null||(h.inst=e),n.issues.push(kr(h))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Ef(e){return new Tf({type:"transform",transform:e})}const Ra=w("ZodOptional",(e,t)=>{ia.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ra({type:"optional",innerType:e})}const Af=w("ZodExactOptional",(e,t)=>{Kd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Cf(e){return new Af({type:"optional",innerType:e})}const Pf=w("ZodNullable",(e,t)=>{Qd.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ia(e){return new Pf({type:"nullable",innerType:e})}const Rf=w("ZodDefault",(e,t)=>{ep.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Lf(e,t){return new Rf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const If=w("ZodPrefault",(e,t)=>{tp.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function zf(e,t){return new If({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const za=w("ZodNonOptional",(e,t)=>{np.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function $f(e,t){return new za(v({type:"nonoptional",innerType:e},D(t)))}const Of=w("ZodCatch",(e,t)=>{rp.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Nf(e,t){return new Of({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Df=w("ZodPipe",(e,t)=>{op.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.in=t.in,e.out=t.out});function $a(e,t){return new Df({type:"pipe",in:e,out:t})}const Mf=w("ZodReadonly",(e,t)=>{sp.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Uf(e){return new Mf({type:"readonly",innerType:e})}const jf=w("ZodCustom",(e,t)=>{ip.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph(e,n)});function Zf(e,t={}){return Qp(jf,e,t)}function qf(e){return eh(e)}const Hf=me({name:R().min(1).max(100).optional(),command:R().min(1).max(500),args:_t(R()).optional(),failOnError:ve().default(!0).optional(),timeout:It().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:R().optional(),env:zt(R(),R()).optional(),runOnBackground:ve().optional()});me({name:R(),command:R(),success:ve(),exitCode:It().optional(),stdout:R().optional(),stderr:R().optional(),error:R().optional(),duration:It(),failOnError:ve()});const kn=me({path:R(),extraCommands:_t(Hf).optional(),id:R().uuid().optional(),rotationKey:R().optional(),usageStatus:ut(["free","in_use"]).optional()}),Ff=Pa("operation",[kn.extend({operation:dt("create"),content:R().optional(),contentPath:R().optional(),encoding:ut(["utf-8","base64"]).optional()}),kn.extend({operation:dt("merge"),data:zt(R(),Ea()),mergeStrategy:ut(["deep","shallow"]).optional(),arrayMergeStrategy:ut(["concat","replace"]).optional()}),kn.extend({operation:dt("modify"),content:R().optional(),contentPath:R().optional(),createIfMissing:ve().optional()}),kn.extend({operation:dt("delete"),ignoreIfMissing:ve().optional()}),kn.extend({operation:dt("createDirectory"),contentPath:R().optional(),mode:It().optional(),ignoreIfExists:ve().optional()}),kn.extend({operation:dt("download"),url:R().url(),headers:zt(R(),R()).optional(),timeout:It().min(1e3).max(3e5).optional()}),kn.extend({operation:dt("gitClone"),gitUrl:R(),gitSecretKey:R().optional(),sourceBranch:R().optional(),targetBranch:R().optional()})]);var Te=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Te||{});const Bf=me({type:ut(["json","file","regex"]).describe("Extraction method"),source:R().describe("Source to extract from (file path or stdout/stderr)"),schema:me({}).passthrough().optional().describe("JSON schema for validation"),pattern:R().optional().describe("Regex pattern for extraction")}),Gf=me({type:ut(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ea().describe("Hook-specific configuration")});me({command:R().optional().describe("Legacy — unused in SDK mode"),args:_t(R()).optional().describe("Legacy — unused in SDK mode"),env:zt(R(),R()).optional().describe("Environment variables"),workingDirectory:R().optional().describe("Working directory for command execution"),fileOperations:_t(Ff).optional().describe("File operations to perform during setup"),gitUrl:R().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:R().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:R().optional().describe("Commit message for git operations"),resultExtraction:Bf.optional().describe("Schema for extracting result data"),postExecutionHooks:_t(Gf).optional().describe("Hooks to run after task completion"),executionMode:ut(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Pa("executionMode",[me({executionMode:dt("claudeAgentSdk"),promptText:R(),sdkOptions:me({model:R(),permissionMode:ut(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:_t(R()),allowDangerouslySkipPermissions:ve(),persistSession:ve(),streamSdkEvents:ve().optional(),allowedTools:_t(R()).optional(),settings:me({enabledPlugins:zt(R(),ve())}),env:zt(R(),R()).optional()}),resume:me({sessionId:R().optional(),continue:ve()}).optional()}),me({executionMode:dt("opencodeSdk"),promptText:R(),sdkOptions:me({provider:R(),model:R(),allowedTools:_t(R()).optional(),env:zt(R(),R()).optional()}),resume:me({sessionId:R().optional(),continue:ve()}).optional()}),me({executionMode:dt("openaiAgentSdk"),promptText:R(),sdkOptions:me({model:R(),env:zt(R(),R()).optional()}),resume:me({sessionId:R().optional(),continue:ve()}).optional()}),me({executionMode:dt("codexSdk"),promptText:R(),sdkOptions:me({model:R().optional(),sandboxMode:ut(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ut(["never","on-request","on-failure","untrusted"]).optional(),env:zt(R(),R()).optional()}),resume:me({sessionId:R().optional(),continue:ve()}).optional()}),me({executionMode:dt("cursorSdk"),promptText:R(),sdkOptions:me({model:R(),env:zt(R(),R()).optional()}),resume:me({sessionId:R().optional(),continue:ve()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ve().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:R().optional().describe("Final approved plan content"),planApproved:ve().optional().describe("Plan approval status"),planApprovedAt:R().optional().describe("ISO timestamp of approval"),planRejected:ve().optional().describe("Plan rejection flag"),planRejectionFeedback:R().optional().describe("User rejection feedback"),rejectedPlanContent:R().optional().describe("Previously rejected plan content"),planCompletedAt:R().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:R().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:R().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:R().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:_t(me({feedback:R(),rejectedAt:R()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:It().optional(),notificationChannelPlanMessageSentAt:R().optional(),notificationChannelCompletedMessageId:It().optional(),notificationChannelFailedMessageId:It().optional(),streamSdkEvents:ve().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:R().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ve().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:_t(me({id:R(),selectedText:R(),startOffset:It(),endOffset:It(),commentText:R(),createdAt:R()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ve().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ve().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:ut(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:ve().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Oa="browser_capture",Wf="browser_automate";function Na(e){return I(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const Jf=3e4;function ho(r){return I(this,arguments,function*(e,t={},n=Jf){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,j(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ze(e,t,n,r){return I(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield ho(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Na(a)})}function Da(e,t){return I(this,null,function*(){return Ze(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const Yf=["projectId","note","ctx"];function Vf(e){const t=Yf.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function xs(e,t){return I(this,null,function*(){var h,p,m,g,k,y;Vf(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,type:u=Oa}=t;return Ze(e,"POST","/tasks",j(v(v(v(v(v(v(v(v(v(v(v(v({type:u,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(h=i==null?void 0:i.selectedPluginIds)!=null&&h.length?{selectedPluginIds:i.selectedPluginIds}:{}),(p=i==null?void 0:i.selectedSkillIds)!=null&&p.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(g=i==null?void 0:i.selectedMcpServerIds)!=null&&g.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(k=i==null?void 0:i.selectedSlashCommandIds)!=null&&k.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(y=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&y.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:{type:u,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps}}))})}function Ma(e,t){return I(this,null,function*(){return xs(e,j(v({},t),{type:Wf}))})}function Ua(e,t,n,r){return I(this,null,function*(){var o;return Ze(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function Xf(e,t){return I(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ze(e,"GET",`/claude-templates${n}`)})}function ja(e,t){return I(this,null,function*(){return Ze(e,"GET",`/tasks/${t}`)})}function Kf(e,t){return I(this,null,function*(){return Ze(e,"GET",`/planning-sessions/${t}`)})}function Za(e){return I(this,null,function*(){return Ze(e,"GET","/projects")})}function qa(e,t,n){return I(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield ho(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Na(i)})}function Qf(e,t){return I(this,null,function*(){return Ze(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function eg(e,t,n,r,o){return I(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function tg(e,t){return I(this,null,function*(){return Ze(e,"GET",`/tasks/${t}/chunks`)})}function ng(e,t,n){return I(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function rg(e,t){return I(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/cancel`)})}function og(e,t){return I(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/approve-result`)})}function sg(e,t,n){return I(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function fo(e,t){return I(this,null,function*(){return Ze(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ha(e,t,n,r){return I(this,null,function*(){return Ze(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function ig(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ss={exports:{}};/*!
1358
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(u=e.external.registry.get(h[0]))==null?void 0:u.id;if(t!==h[0]&&k){i(h);continue}}if((p=e.metadataRegistry.get(h[0]))==null?void 0:p.id){i(h);continue}if(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function va(e,t){var a,d,u,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=g=>{var ee,N,T;const m=e.seen.get(g);if(m.ref===null)return;const k=(ee=m.def)!=null?ee:m.schema,y=v({},k),E=m.ref;if(m.ref=null,E){r(E);const S=e.seen.get(E),C=S.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(N=k.allOf)!=null?N:[],k.allOf.push(C)):Object.assign(k,C),Object.assign(k,y),g._zod.parent===E)for(const J in k)J==="$ref"||J==="allOf"||J in y||delete k[J];if(C.$ref)for(const J in k)J==="$ref"||J==="allOf"||J in S.def&&JSON.stringify(k[J])===JSON.stringify(S.def[J])&&delete k[J]}const Z=g._zod.parent;if(Z&&Z!==E){r(Z);const S=e.seen.get(Z);if(S!=null&&S.schema.$ref&&(k.$ref=S.schema.$ref,S.def))for(const C in k)C==="$ref"||C==="allOf"||C in S.def&&JSON.stringify(k[C])===JSON.stringify(S.def[C])&&delete k[C]}e.override({zodSchema:g,jsonSchema:k,path:(T=m.path)!=null?T:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(u=n.def)!=null?u:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:j(v({},t["~standard"]),{jsonSchema:{input:lo(t,"input",e.processors),output:lo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function We(e,t){const n=t!=null?t:{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return We(r.element,n);if(r.type==="set")return We(r.valueType,n);if(r.type==="lazy")return We(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return We(r.innerType,n);if(r.type==="intersection")return We(r.left,n)||We(r.right,n);if(r.type==="record"||r.type==="map")return We(r.keyType,n)||We(r.valueType,n);if(r.type==="pipe")return We(r.in,n)||We(r.out,n);if(r.type==="object"){for(const o in r.shape)if(We(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(We(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(We(o,n))return!0;return!!(r.rest&&We(r.rest,n))}return!1}const sh=(e,t={})=>n=>{const r=ka(j(v({},n),{processors:t}));return Ae(e,r),_a(r,e),va(r,e)},lo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=ka(j(v({},o!=null?o:{}),{target:i,io:t,processors:n}));return Ae(e,a),_a(a,e),va(a,e)},ih={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ah=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:u,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=ih[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),u&&u.size>0){const g=[...u];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>j(v({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},ch=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:u,exclusiveMaximum:p,exclusiveMinimum:h}=e._zod.bag;typeof d=="string"&&d.includes("int")?o.type="integer":o.type="number",typeof h=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=h,o.exclusiveMinimum=!0):o.exclusiveMinimum=h),typeof i=="number"&&(o.minimum=i,typeof h=="number"&&t.target!=="draft-04"&&(h>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof a=="number"&&(o.maximum=a,typeof p=="number"&&t.target!=="draft-04"&&(p<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof u=="number"&&(o.multipleOf=u)},lh=(e,t,n,r)=>{n.type="boolean"},uh=(e,t,n,r)=>{n.not={}},dh=(e,t,n,r)=>{},ph=(e,t,n,r)=>{},hh=(e,t,n,r)=>{const o=e._zod.def,i=Oi(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},fh=(e,t,n,r)=>{const o=e._zod.def,i=[];for(const a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){const a=i[0];n.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[a]:n.const=a}else i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),i.every(a=>typeof a=="boolean")&&(n.type="boolean"),i.every(a=>a===null)&&(n.type="null"),n.enum=i},gh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},mh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},bh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:d}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof d=="number"&&(o.maxItems=d),o.type="array",o.items=Ae(i.element,t,j(v({},r),{path:[...r.path,"items"]}))},kh=(e,t,n,r)=>{var p;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const h in a)o.properties[h]=Ae(a[h],t,j(v({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),u=new Set([...d].filter(h=>{const g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.optout===void 0}));u.size>0&&(o.required=Array.from(u)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Ae(i.catchall,t,j(v({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},_h=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,u)=>Ae(d,t,j(v({},r),{path:[...r.path,i?"oneOf":"anyOf",u]})));i?n.oneOf=a:n.anyOf=a},vh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.left,t,j(v({},r),{path:[...r.path,"allOf",0]})),a=Ae(o.right,t,j(v({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,u=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=u},yh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,u=d==null?void 0:d.patterns;if(i.mode==="loose"&&u&&u.size>0){const h=Ae(i.valueType,t,j(v({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of u)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ae(i.keyType,t,j(v({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Ae(i.valueType,t,j(v({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},wh=(e,t,n,r)=>{const o=e._zod.def,i=Ae(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},xh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Sh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Th=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Eh=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch(d){throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},Ah=(e,t,n,r)=>{const o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ae(i,t,r);const a=t.seen.get(e);a.ref=i},Ch=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ya=(e,t,n,r)=>{const o=e._zod.def;Ae(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ph=w("ZodISODateTime",(e,t)=>{Ad.init(e,t),ye.init(e,t)});function Rh(e){return $p(Ph,e)}const Lh=w("ZodISODate",(e,t)=>{Cd.init(e,t),ye.init(e,t)});function Ih(e){return Op(Lh,e)}const zh=w("ZodISOTime",(e,t)=>{Pd.init(e,t),ye.init(e,t)});function $h(e){return Np(zh,e)}const Oh=w("ZodISODuration",(e,t)=>{Rd.init(e,t),ye.init(e,t)});function Nh(e){return Dp(Oh,e)}const ut=w("ZodError",(e,t)=>{Zi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>vu(e,n)},flatten:{value:n=>_u(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,ps,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,ps,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Dh=ms(ut),Mh=bs(ut),Uh=ro(ut),jh=oo(ut),Zh=xu(ut),qh=Su(ut),Hh=Tu(ut),Fh=Eu(ut),Bh=Au(ut),Gh=Cu(ut),Wh=Pu(ut),Jh=Ru(ut),ke=w("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:lo(e,"input"),output:lo(e,"output")}}),e.toJSONSchema=sh(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(nn(t,{checks:[...(r=t.checks)!=null?r:[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},e.with=e.check,e.clone=(n,r)=>rn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>Dh(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Uh(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return Mh(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return jh(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>Zh(e,n,r),e.decode=(n,r)=>qh(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return Hh(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return Fh(e,n,r)}),e.safeEncode=(n,r)=>Bh(e,n,r),e.safeDecode=(n,r)=>Gh(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return Wh(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return Jh(e,n,r)}),e.refine=(n,r)=>e.check(Ff(n,r)),e.superRefine=n=>e.check(Bf(n)),e.overwrite=n=>e.check(Wn(n)),e.optional=()=>La(e),e.exactOptional=()=>Lf(e),e.nullable=()=>Ia(e),e.nullish=()=>La(Ia(e)),e.nonoptional=n=>Df(e,n),e.array=()=>kt(e),e.or=n=>wf([e,n]),e.and=n=>Tf(e,n),e.transform=n=>$a(e,Pf(n)),e.default=n=>$f(e,n),e.prefault=n=>Nf(e,n),e.catch=n=>Uf(e,n),e.pipe=n=>$a(e,n),e.readonly=()=>qf(e),e.describe=n=>{const r=e.clone();return _r.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=_r.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return _r.get(e);const r=e.clone();return _r.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),wa=w("_ZodString",(e,t)=>{var r,o,i;ks.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,u)=>ah(e,a,d);const n=e._zod.bag;e.format=(r=n.format)!=null?r:null,e.minLength=(o=n.minimum)!=null?o:null,e.maxLength=(i=n.maximum)!=null?i:null,e.regex=(...a)=>e.check(Fp(...a)),e.includes=(...a)=>e.check(Wp(...a)),e.startsWith=(...a)=>e.check(Jp(...a)),e.endsWith=(...a)=>e.check(Yp(...a)),e.min=(...a)=>e.check(co(...a)),e.max=(...a)=>e.check(ma(...a)),e.length=(...a)=>e.check(ba(...a)),e.nonempty=(...a)=>e.check(co(1,...a)),e.lowercase=a=>e.check(Bp(a)),e.uppercase=a=>e.check(Gp(a)),e.trim=()=>e.check(Xp()),e.normalize=(...a)=>e.check(Vp(...a)),e.toLowerCase=()=>e.check(Kp()),e.toUpperCase=()=>e.check(Qp()),e.slugify=()=>e.check(eh())}),Yh=w("ZodString",(e,t)=>{ks.init(e,t),wa.init(e,t),e.email=n=>e.check(hp(Vh,n)),e.url=n=>e.check(kp(Xh,n)),e.jwt=n=>e.check(zp(hf,n)),e.emoji=n=>e.check(_p(Kh,n)),e.guid=n=>e.check(pa(xa,n)),e.uuid=n=>e.check(fp(uo,n)),e.uuidv4=n=>e.check(gp(uo,n)),e.uuidv6=n=>e.check(mp(uo,n)),e.uuidv7=n=>e.check(bp(uo,n)),e.nanoid=n=>e.check(vp(Qh,n)),e.guid=n=>e.check(pa(xa,n)),e.cuid=n=>e.check(yp(ef,n)),e.cuid2=n=>e.check(wp(tf,n)),e.ulid=n=>e.check(xp(nf,n)),e.base64=n=>e.check(Rp(uf,n)),e.base64url=n=>e.check(Lp(df,n)),e.xid=n=>e.check(Sp(rf,n)),e.ksuid=n=>e.check(Tp(of,n)),e.ipv4=n=>e.check(Ep(sf,n)),e.ipv6=n=>e.check(Ap(af,n)),e.cidrv4=n=>e.check(Cp(cf,n)),e.cidrv6=n=>e.check(Pp(lf,n)),e.e164=n=>e.check(Ip(pf,n)),e.datetime=n=>e.check(Rh(n)),e.date=n=>e.check(Ih(n)),e.time=n=>e.check($h(n)),e.duration=n=>e.check(Nh(n))});function R(e){return pp(Yh,e)}const ye=w("ZodStringFormat",(e,t)=>{be.init(e,t),wa.init(e,t)}),Vh=w("ZodEmail",(e,t)=>{kd.init(e,t),ye.init(e,t)}),xa=w("ZodGUID",(e,t)=>{md.init(e,t),ye.init(e,t)}),uo=w("ZodUUID",(e,t)=>{bd.init(e,t),ye.init(e,t)}),Xh=w("ZodURL",(e,t)=>{_d.init(e,t),ye.init(e,t)}),Kh=w("ZodEmoji",(e,t)=>{vd.init(e,t),ye.init(e,t)}),Qh=w("ZodNanoID",(e,t)=>{yd.init(e,t),ye.init(e,t)}),ef=w("ZodCUID",(e,t)=>{wd.init(e,t),ye.init(e,t)}),tf=w("ZodCUID2",(e,t)=>{xd.init(e,t),ye.init(e,t)}),nf=w("ZodULID",(e,t)=>{Sd.init(e,t),ye.init(e,t)}),rf=w("ZodXID",(e,t)=>{Td.init(e,t),ye.init(e,t)}),of=w("ZodKSUID",(e,t)=>{Ed.init(e,t),ye.init(e,t)}),sf=w("ZodIPv4",(e,t)=>{Ld.init(e,t),ye.init(e,t)}),af=w("ZodIPv6",(e,t)=>{Id.init(e,t),ye.init(e,t)}),cf=w("ZodCIDRv4",(e,t)=>{zd.init(e,t),ye.init(e,t)}),lf=w("ZodCIDRv6",(e,t)=>{$d.init(e,t),ye.init(e,t)}),uf=w("ZodBase64",(e,t)=>{Od.init(e,t),ye.init(e,t)}),df=w("ZodBase64URL",(e,t)=>{Dd.init(e,t),ye.init(e,t)}),pf=w("ZodE164",(e,t)=>{Md.init(e,t),ye.init(e,t)}),hf=w("ZodJWT",(e,t)=>{jd.init(e,t),ye.init(e,t)}),Sa=w("ZodNumber",(e,t)=>{var r,o,i,a,d,u,p,h,g;Ki.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,y)=>ch(e,m,k),e.gt=(m,k)=>e.check(fa(m,k)),e.gte=(m,k)=>e.check(ys(m,k)),e.min=(m,k)=>e.check(ys(m,k)),e.lt=(m,k)=>e.check(ha(m,k)),e.lte=(m,k)=>e.check(vs(m,k)),e.max=(m,k)=>e.check(vs(m,k)),e.int=m=>e.check(Ta(m)),e.safe=m=>e.check(Ta(m)),e.positive=m=>e.check(fa(0,m)),e.nonnegative=m=>e.check(ys(0,m)),e.negative=m=>e.check(ha(0,m)),e.nonpositive=m=>e.check(vs(0,m)),e.multipleOf=(m,k)=>e.check(ga(m,k)),e.step=(m,k)=>e.check(ga(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(u=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?u:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(g=n.format)!=null?g:null});function Lt(e){return Mp(Sa,e)}const ff=w("ZodNumberFormat",(e,t)=>{Zd.init(e,t),Sa.init(e,t)});function Ta(e){return Up(ff,e)}const gf=w("ZodBoolean",(e,t)=>{qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lh(e,n,r)});function _e(e){return jp(gf,e)}const mf=w("ZodAny",(e,t)=>{Hd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>dh()});function Ea(){return Zp(mf)}const bf=w("ZodUnknown",(e,t)=>{Fd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ph()});function Aa(){return qp(bf)}const kf=w("ZodNever",(e,t)=>{Bd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uh(e,n,r)});function _f(e){return Hp(kf,e)}const vf=w("ZodArray",(e,t)=>{Gd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bh(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(co(n,r)),e.nonempty=n=>e.check(co(1,n)),e.max=(n,r)=>e.check(ma(n,r)),e.length=(n,r)=>e.check(ba(n,r)),e.unwrap=()=>e.element});function kt(e,t){return th(vf,e,t)}const yf=w("ZodObject",(e,t)=>{Jd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kh(e,n,r,o),re(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(j(v({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.loose=()=>e.clone(j(v({},e._zod.def),{catchall:Aa()})),e.strict=()=>e.clone(j(v({},e._zod.def),{catchall:_f()})),e.strip=()=>e.clone(j(v({},e._zod.def),{catchall:void 0})),e.extend=n=>fu(e,n),e.safeExtend=n=>gu(e,n),e.merge=n=>mu(e,n),e.pick=n=>pu(e,n),e.omit=n=>hu(e,n),e.partial=(...n)=>bu(Ra,e,n[0]),e.required=(...n)=>ku(za,e,n[0])});function fe(e,t){const n=v({type:"object",shape:e!=null?e:{}},D(t));return new yf(n)}const Ca=w("ZodUnion",(e,t)=>{ra.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_h(e,n,r,o),e.options=t.options});function wf(e,t){return new Ca(v({type:"union",options:e},D(t)))}const xf=w("ZodDiscriminatedUnion",(e,t)=>{Ca.init(e,t),Yd.init(e,t)});function Pa(e,t,n){return new xf(v({type:"union",options:t,discriminator:e},D(n)))}const Sf=w("ZodIntersection",(e,t)=>{Vd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vh(e,n,r,o)});function Tf(e,t){return new Sf({type:"intersection",left:e,right:t})}const Ef=w("ZodRecord",(e,t)=>{Xd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function It(e,t,n){return new Ef(v({type:"record",keyType:e,valueType:t},D(n)))}const ws=w("ZodEnum",(e,t)=>{Kd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>hh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))},e.exclude=(r,o)=>{const i=v({},t.entries);for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new ws(j(v(j(v({},t),{checks:[]}),D(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ws(v({type:"enum",entries:n},D(t)))}const Af=w("ZodLiteral",(e,t)=>{Qd.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fh(e,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pt(e,t){return new Af(v({type:"literal",values:Array.isArray(e)?e:[e]},D(t)))}const Cf=w("ZodTransform",(e,t)=>{ep.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new zi(e.constructor.name);n.addIssue=i=>{var a,d,u;if(typeof i=="string")n.issues.push(kr(i,n.value,t));else{const p=i;p.fatal&&(p.continue=!1),(a=p.code)!=null||(p.code="custom"),(d=p.input)!=null||(p.input=n.value),(u=p.inst)!=null||(p.inst=e),n.issues.push(kr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pf(e){return new Cf({type:"transform",transform:e})}const Ra=w("ZodOptional",(e,t)=>{ia.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function La(e){return new Ra({type:"optional",innerType:e})}const Rf=w("ZodExactOptional",(e,t)=>{tp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ya(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Lf(e){return new Rf({type:"optional",innerType:e})}const If=w("ZodNullable",(e,t)=>{np.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ia(e){return new If({type:"nullable",innerType:e})}const zf=w("ZodDefault",(e,t)=>{rp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $f(e,t){return new zf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const Of=w("ZodPrefault",(e,t)=>{op.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Th(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Nf(e,t){return new Of({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ui(t)}})}const za=w("ZodNonOptional",(e,t)=>{sp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Df(e,t){return new za(v({type:"nonoptional",innerType:e},D(t)))}const Mf=w("ZodCatch",(e,t)=>{ip.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Uf(e,t){return new Mf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const jf=w("ZodPipe",(e,t)=>{ap.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ah(e,n,r,o),e.in=t.in,e.out=t.out});function $a(e,t){return new jf({type:"pipe",in:e,out:t})}const Zf=w("ZodReadonly",(e,t)=>{cp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ch(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qf(e){return new Zf({type:"readonly",innerType:e})}const Hf=w("ZodCustom",(e,t)=>{lp.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gh(e,n)});function Ff(e,t={}){return nh(Hf,e,t)}function Bf(e){return rh(e)}const Gf=fe({name:R().min(1).max(100).optional(),command:R().min(1).max(500),args:kt(R()).optional(),failOnError:_e().default(!0).optional(),timeout:Lt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:R().optional(),env:It(R(),R()).optional(),runOnBackground:_e().optional()});fe({name:R(),command:R(),success:_e(),exitCode:Lt().optional(),stdout:R().optional(),stderr:R().optional(),error:R().optional(),duration:Lt(),failOnError:_e()});const kn=fe({path:R(),extraCommands:kt(Gf).optional(),id:R().uuid().optional(),rotationKey:R().optional(),usageStatus:dt(["free","in_use"]).optional()}),Wf=Pa("operation",[kn.extend({operation:pt("create"),content:R().optional(),contentPath:R().optional(),encoding:dt(["utf-8","base64"]).optional()}),kn.extend({operation:pt("merge"),data:It(R(),Ea()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),kn.extend({operation:pt("modify"),content:R().optional(),contentPath:R().optional(),createIfMissing:_e().optional()}),kn.extend({operation:pt("delete"),ignoreIfMissing:_e().optional()}),kn.extend({operation:pt("createDirectory"),contentPath:R().optional(),mode:Lt().optional(),ignoreIfExists:_e().optional()}),kn.extend({operation:pt("download"),url:R().url(),headers:It(R(),R()).optional(),timeout:Lt().min(1e3).max(3e5).optional()}),kn.extend({operation:pt("gitClone"),gitUrl:R(),gitSecretKey:R().optional(),sourceBranch:R().optional(),targetBranch:R().optional()})]);var Te=(e=>(e.PENDING="pending",e.ASSIGNED="assigned",e.IN_PROGRESS="in_progress",e.WAITING_FOR_INPUT="waiting_for_input",e.WAITING_FOR_PLAN_APPROVAL="waiting_for_plan_approval",e.PLAN_APPROVED="plan_approved",e.PLAN_REJECTED="plan_rejected",e.COMPLETED="completed",e.FAILED="failed",e.CANCELLED="cancelled",e.RESULT_REJECTED="result_rejected",e))(Te||{});const Jf=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:R().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:R().optional().describe("Regex pattern for extraction")}),Yf=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ea().describe("Hook-specific configuration")});fe({command:R().optional().describe("Legacy — unused in SDK mode"),args:kt(R()).optional().describe("Legacy — unused in SDK mode"),env:It(R(),R()).optional().describe("Environment variables"),workingDirectory:R().optional().describe("Working directory for command execution"),fileOperations:kt(Wf).optional().describe("File operations to perform during setup"),gitUrl:R().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:R().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:R().optional().describe("Commit message for git operations"),resultExtraction:Jf.optional().describe("Schema for extracting result data"),postExecutionHooks:kt(Yf).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Pa("executionMode",[fe({executionMode:pt("claudeAgentSdk"),promptText:R(),sdkOptions:fe({model:R(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:kt(R()),allowDangerouslySkipPermissions:_e(),persistSession:_e(),streamSdkEvents:_e().optional(),allowedTools:kt(R()).optional(),settings:fe({enabledPlugins:It(R(),_e())}),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:_e()}).optional()}),fe({executionMode:pt("opencodeSdk"),promptText:R(),sdkOptions:fe({provider:R(),model:R(),allowedTools:kt(R()).optional(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:_e()}).optional()}),fe({executionMode:pt("openaiAgentSdk"),promptText:R(),sdkOptions:fe({model:R(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:_e()}).optional()}),fe({executionMode:pt("codexSdk"),promptText:R(),sdkOptions:fe({model:R().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:_e()}).optional()}),fe({executionMode:pt("cursorSdk"),promptText:R(),sdkOptions:fe({model:R(),env:It(R(),R()).optional()}),resume:fe({sessionId:R().optional(),continue:_e()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:_e().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:R().optional().describe("Final approved plan content"),planApproved:_e().optional().describe("Plan approval status"),planApprovedAt:R().optional().describe("ISO timestamp of approval"),planRejected:_e().optional().describe("Plan rejection flag"),planRejectionFeedback:R().optional().describe("User rejection feedback"),rejectedPlanContent:R().optional().describe("Previously rejected plan content"),planCompletedAt:R().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:R().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:R().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:R().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:kt(fe({feedback:R(),rejectedAt:R()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:Lt().optional(),notificationChannelPlanMessageSentAt:R().optional(),notificationChannelCompletedMessageId:Lt().optional(),notificationChannelFailedMessageId:Lt().optional(),streamSdkEvents:_e().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:R().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:_e().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:kt(fe({id:R(),selectedText:R(),startOffset:Lt(),endOffset:Lt(),commentText:R(),createdAt:R()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:_e().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:_e().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:dt(["all","ignoreExistingMcpServers"]).optional().describe("MCP server strategy for this run; 'ignoreExistingMcpServers' overrides the existing .mcp.json with only the template's configured servers plus the agent-platform server"),enableBrowserTools:_e().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")}),Te.PENDING+"",Te.CANCELLED,Te.ASSIGNED+"",Te.CANCELLED,Te.IN_PROGRESS+"",Te.CANCELLED,Te.FAILED,Te.WAITING_FOR_INPUT+"",Te.CANCELLED,Te.WAITING_FOR_PLAN_APPROVAL+"",Te.CANCELLED,Te.PLAN_APPROVED+"",Te.CANCELLED,Te.PLAN_REJECTED+"",Te.CANCELLED,Te.COMPLETED+"",Te.RESULT_REJECTED+"",Te.CANCELLED,Te.FAILED+"",Te.CANCELLED+"";const Oa="browser_capture",Vf="browser_automate";function Na(e){let t=(e||"").trim().toLowerCase();const n=t.indexOf("@");return n>=0&&(t=t.slice(n+1)),t=t.split("/")[0].split(":")[0],t.startsWith("www.")&&(t=t.slice(4)),t}function Xf(e,t){const n=Na(e),r=(t||"").trim().toLowerCase();if(!n||!r)return!1;if(r.startsWith("*.")){const o=r.slice(2);return n===o||n.endsWith("."+o)}return n===Na(r)}function Da(e,t){var i;let n;try{const a=new URL(e);if(a.protocol!=="http:"&&a.protocol!=="https:")return null;n=a.hostname}catch(a){return null}let r=null,o=-1;for(const a of t)for(const d of(i=a.domains)!=null?i:[])Xf(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Ma(e){return L(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`}));throw new Error(t.message||t.error||`HTTP ${e.status}`)}return e.json()})}const Kf=3e4;function po(r){return L(this,arguments,function*(e,t={},n=Kf){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,j(v({},t),{signal:o.signal}))}catch(a){throw a instanceof DOMException&&a.name==="AbortError"?new Error(`Request timed out after ${Math.round(n/1e3)}s. Please check your connection and try again.`):a}finally{clearTimeout(i)}})}function Ue(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield po(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Ma(a)})}function Ua(e,t){return L(this,null,function*(){return Ue(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const Qf=["projectId","note","ctx"];function eg(e){const t=Qf.filter(n=>e[n]===void 0||e[n]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`)}function xs(e,t){return L(this,null,function*(){var p,h,g,m,k,y;eg(t);const{projectId:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,type:u=Oa}=t;return Ue(e,"POST","/tasks",j(v(v(v(v(v(v(v(v(v(v(v(v({type:u,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r,projectId:n,autoAssign:!0},i!=null&&i.claudeTemplateId?{claudeTemplateId:i.claudeTemplateId}:{}),(i==null?void 0:i.quickMode)!==void 0?{quickMode:i.quickMode}:{}),(i==null?void 0:i.modelOverride)!=null?{modelOverride:i.modelOverride}:{}),(i==null?void 0:i.claudeProfileId)!=null?{claudeProfileId:i.claudeProfileId}:{}),(i==null?void 0:i.effort)!=null?{effort:i.effort}:{}),(i==null?void 0:i.executionMode)!=null?{executionMode:i.executionMode}:{}),(p=i==null?void 0:i.selectedPluginIds)!=null&&p.length?{selectedPluginIds:i.selectedPluginIds}:{}),(h=i==null?void 0:i.selectedSkillIds)!=null&&h.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(m=i==null?void 0:i.selectedMcpServerIds)!=null&&m.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(k=i==null?void 0:i.selectedSlashCommandIds)!=null&&k.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(y=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&y.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:{type:u,note:r,source:"web-sdk",pageUrl:o.pageUrl,pageTitle:o.pageTitle,elementText:o.elementText,cssSelector:o.cssSelector,elementOuterHtml:o.elementOuterHtml,ancestry:o.ancestry,elementRole:o.elementRole,elementAriaLabel:o.elementAriaLabel,enclosingSection:o.enclosingSection,description:o.description,canonicalUrl:o.canonicalUrl,lang:o.lang,ogTitle:o.ogTitle,ogDescription:o.ogDescription,ogType:o.ogType,ogSiteName:o.ogSiteName,viewportWidth:o.viewportWidth,viewportHeight:o.viewportHeight,scrollX:o.scrollX,scrollY:o.scrollY,selectionText:o.selectionText,capturedAt:o.capturedAt,interactionSteps:o.interactionSteps}}))})}function ja(e,t){return L(this,null,function*(){return xs(e,j(v({},t),{type:Vf}))})}function Za(e,t,n,r){return L(this,null,function*(){var o;return Ue(e,"POST","/planning-sessions",v({projectId:t,instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1},r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function tg(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Ue(e,"GET",`/claude-templates${n}`)})}function qa(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}`)})}function ng(e,t){return L(this,null,function*(){return Ue(e,"GET",`/planning-sessions/${t}`)})}function Ha(e){return L(this,null,function*(){return Ue(e,"GET","/projects")})}function rg(e){return L(this,null,function*(){return(yield Ue(e,"GET","/tenants/current")).membership})}function og(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Fa(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield po(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Ma(i)})}function sg(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function ig(e,t,n,r,o){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function ag(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/chunks`)})}function cg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function lg(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/cancel`)})}function ug(e,t){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/approve-result`)})}function dg(e,t,n){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function ho(e,t){return L(this,null,function*(){return Ue(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Ba(e,t,n,r){return L(this,null,function*(){return Ue(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function pg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ss={exports:{}};/*!
1359
1359
  * Pusher JavaScript Library v8.5.0
1360
1360
  * https://pusher.com/
1361
1361
  *
1362
1362
  * Copyright 2020, Pusher
1363
1363
  * Released under the MIT licence.
1364
- */var Fa;function ag(){return Fa||(Fa=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var u=this&&this.__extends||(function(){var O=function(T,S){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,M){C.__proto__=M}||function(C,M){for(var Y in M)M.hasOwnProperty(Y)&&(C[Y]=M[Y])},O(T,S)};return function(T,S){O(T,S);function C(){this.constructor=T}T.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}})();Object.defineProperty(d,"__esModule",{value:!0});var h=256,p=(function(){function O(T){T===void 0&&(T="="),this._paddingCharacter=T}return O.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},O.prototype.encode=function(T){for(var S="",C=0;C<T.length-2;C+=3){var M=T[C]<<16|T[C+1]<<8|T[C+2];S+=this._encodeByte(M>>>18&63),S+=this._encodeByte(M>>>12&63),S+=this._encodeByte(M>>>6&63),S+=this._encodeByte(M>>>0&63)}var Y=T.length-C;if(Y>0){var M=T[C]<<16|(Y===2?T[C+1]<<8:0);S+=this._encodeByte(M>>>18&63),S+=this._encodeByte(M>>>12&63),Y===2?S+=this._encodeByte(M>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},O.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},O.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},O.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(T),C=T.length-S,M=new Uint8Array(this.maxDecodedLength(C)),Y=0,xe=0,Le=0,tt=0,re=0,Ie=0,He=0;xe<C-4;xe+=4)tt=this._decodeChar(T.charCodeAt(xe+0)),re=this._decodeChar(T.charCodeAt(xe+1)),Ie=this._decodeChar(T.charCodeAt(xe+2)),He=this._decodeChar(T.charCodeAt(xe+3)),M[Y++]=tt<<2|re>>>4,M[Y++]=re<<4|Ie>>>2,M[Y++]=Ie<<6|He,Le|=tt&h,Le|=re&h,Le|=Ie&h,Le|=He&h;if(xe<C-1&&(tt=this._decodeChar(T.charCodeAt(xe)),re=this._decodeChar(T.charCodeAt(xe+1)),M[Y++]=tt<<2|re>>>4,Le|=tt&h,Le|=re&h),xe<C-2&&(Ie=this._decodeChar(T.charCodeAt(xe+2)),M[Y++]=re<<4|Ie>>>2,Le|=Ie&h),xe<C-3&&(He=this._decodeChar(T.charCodeAt(xe+3)),M[Y++]=Ie<<6|He,Le|=He&h),Le!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},O.prototype._encodeByte=function(T){var S=T;return S+=65,S+=25-T>>>8&6,S+=51-T>>>8&-75,S+=61-T>>>8&-15,S+=62-T>>>8&3,String.fromCharCode(S)},O.prototype._decodeChar=function(T){var S=h;return S+=(42-T&T-44)>>>8&-h+T-43+62,S+=(46-T&T-48)>>>8&-h+T-47+63,S+=(47-T&T-58)>>>8&-h+T-48+52,S+=(64-T&T-91)>>>8&-h+T-65+0,S+=(96-T&T-123)>>>8&-h+T-97+26,S},O.prototype._getPaddingLength=function(T){var S=0;if(this._paddingCharacter){for(var C=T.length-1;C>=0&&T[C]===this._paddingCharacter;C--)S++;if(T.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},O})();d.Coder=p;var m=new p;function g(O){return m.encode(O)}d.encode=g;function k(O){return m.decode(O)}d.decode=k;var y=(function(O){u(T,O);function T(){return O!==null&&O.apply(this,arguments)||this}return T.prototype._encodeByte=function(S){var C=S;return C+=65,C+=25-S>>>8&6,C+=51-S>>>8&-75,C+=61-S>>>8&-13,C+=62-S>>>8&49,String.fromCharCode(C)},T.prototype._decodeChar=function(S){var C=h;return C+=(44-S&S-46)>>>8&-h+S-45+62,C+=(94-S&S-96)>>>8&-h+S-95+63,C+=(47-S&S-58)>>>8&-h+S-48+52,C+=(64-S&S-91)>>>8&-h+S-65+0,C+=(96-S&S-123)>>>8&-h+S-97+26,C},T})(p);d.URLSafeCoder=y;var A=new y;function Z(O){return A.encode(O)}d.encodeURLSafe=Z;function J(O){return A.decode(O)}d.decodeURLSafe=J,d.encodedLength=function(O){return m.encodedLength(O)},d.maxDecodedLength=function(O){return m.maxDecodedLength(O)},d.decodedLength=function(O){return m.decodedLength(O)}},978(a,d){var u="utf8: invalid source encoding";function h(p){for(var m=[],g=0;g<p.length;g++){var k=p[g];if(k&128){var y=void 0;if(k<224){if(g>=p.length)throw new Error(u);var A=p[++g];if((A&192)!==128)throw new Error(u);k=(k&31)<<6|A&63,y=128}else if(k<240){if(g>=p.length-1)throw new Error(u);var A=p[++g],Z=p[++g];if((A&192)!==128||(Z&192)!==128)throw new Error(u);k=(k&15)<<12|(A&63)<<6|Z&63,y=2048}else if(k<248){if(g>=p.length-2)throw new Error(u);var A=p[++g],Z=p[++g],J=p[++g];if((A&192)!==128||(Z&192)!==128||(J&192)!==128)throw new Error(u);k=(k&15)<<18|(A&63)<<12|(Z&63)<<6|J&63,y=65536}else throw new Error(u);if(k<y||k>=55296&&k<=57343)throw new Error(u);if(k>=65536){if(k>1114111)throw new Error(u);k-=65536,m.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}m.push(String.fromCharCode(k))}return m.join("")}d.D4=h},721(a,d,u){a.exports=u(207).default},207(a,d,u){u.d(d,{default:()=>os});class h{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",x=!1,P=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=P,{number:c,id:f,name:b,callback:P}}remove(s){delete this[s.number]}}var p=new h("_pusher_script_","Pusher.ScriptReceivers"),m={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const g=m;class k{constructor(s){this.options=s,this.receivers=s.receivers||p,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var x=W.createScriptRequest(b.getPath(s,c)),P=b.receivers.create(function(N){if(b.receivers.remove(P),b.loading[s]){var G=b.loading[s];delete b.loading[s];for(var ne=function(Ce){Ce||x.cleanup()},ie=0;ie<G.length;ie++)G[ie](N,ne)}});x.send(P)}}getRoot(s){var c,f=W.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new h("_pusher_dependencies","Pusher.DependenciesReceivers"),A=new k({cdn_http:g.cdn_http,cdn_https:g.cdn_https,version:g.VERSION,suffix:g.dependency_suffix,receivers:y});const Z={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},O={buildLogSuffix:function(l){const s="See:",c=Z.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class S extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class C extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Y extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class xe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Le extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class tt extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class re extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ie extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Tt=function(l,s,c,f,b){const x=W.createXHR();x.open("POST",c.endpoint,!0),x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var P in c.headers)x.setRequestHeader(P,c.headers[P]);if(c.headersProvider!=null){let N=c.headersProvider();for(var P in N)x.setRequestHeader(P,N[P])}return x.onreadystatechange=function(){if(x.readyState===4)if(x.status===200){let N,G=!1;try{N=JSON.parse(x.responseText),G=!0}catch(ne){b(new Ie(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${x.responseText}`),null)}G&&b(null,N)}else{let N="";switch(f){case T.UserAuthentication:N=O.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:N=`Clients must be authorized to join private or presence channels. ${O.buildLogSuffix("authorizationEndpoint")}`;break}b(new Ie(x.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${x.status} from ${c.endpoint}. ${N}`),null)}},x.send(s),x};function dn(l){return K(B(l))}var ct=String.fromCharCode,Jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ln=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?ct(192|s>>>6)+ct(128|s&63):ct(224|s>>>12&15)+ct(128|s>>>6&63)+ct(128|s&63)},B=function(l){return l.replace(/[^\x00-\x7F]/g,Ln)},oe=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[Jt.charAt(c>>>18),Jt.charAt(c>>>12&63),s>=2?"=":Jt.charAt(c>>>6&63),s>=1?"=":Jt.charAt(c&63)];return f.join("")},K=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,oe)};class Fe{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const pe=Fe;function gt(l){window.clearTimeout(l)}function he(l){window.clearInterval(l)}class Be extends pe{constructor(s,c){super(setTimeout,gt,s,function(f){return c(),null})}}class pn extends pe{constructor(s,c){super(setInterval,he,s,function(f){return c(),f})}}var Et={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new Be(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const ee=Et;function te(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?l[b]=te(l[b]||{},f[b]):l[b]=f[b]}return l}function nt(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(ot(arguments[s]));return l.join(" : ")}function rt(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,b=l.length;f<b;f++)if(l[f]===s)return f;return-1}function Oe(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function Ue(l){var s=[];return Oe(l,function(c,f){s.push(f)}),s}function Ge(l){var s=[];return Oe(l,function(c){s.push(c)}),s}function mt(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function At(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function hn(l,s){var c={};return Oe(l,function(f,b){c[b]=s(f)}),c}function In(l,s){s=s||function(b){return!!b};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function zn(l,s){var c={};return Oe(l,function(f,b){(s&&s(f,b,l,c)||f)&&(c[b]=f)}),c}function Fo(l){var s=[];return Oe(l,function(c,f){s.push([f,c])}),s}function Nr(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function ai(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function Dr(l){return hn(l,function(s){return typeof s=="object"&&(s=ot(s)),encodeURIComponent(dn(s.toString()))})}function $n(l){var s=zn(l,function(f){return f!==void 0}),c=At(Fo(Dr(s)),ee.method("join","=")).join("&");return c}function fn(l){var s=[],c=[];return(function f(b,x){var P,N,G;switch(typeof b){case"object":if(!b)return null;for(P=0;P<s.length;P+=1)if(s[P]===b)return{$ref:c[P]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(G=[],P=0;P<b.length;P+=1)G[P]=f(b[P],x+"["+P+"]");else{G={};for(N in b)Object.prototype.hasOwnProperty.call(b,N)&&(G[N]=f(b[N],x+"["+JSON.stringify(N)+"]"))}return G;case"number":case"string":case"boolean":return b}})(l,"$")}function ot(l){try{return JSON.stringify(l)}catch(s){return JSON.stringify(fn(l))}}class Mr{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=nt.apply(this,arguments);os.log?os.log(f):os.logToConsole&&s.bind(this)(f)}}const fe=new Mr;var Bo=function(l,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&fe.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var P=l.getDocument(),N=P.createElement("script");l.auth_callbacks[x]=function(ie){b(null,ie)};var G="Pusher.auth_callbacks['"+x+"']";N.src=c.endpoint+"?callback="+encodeURIComponent(G)+"&"+s;var ne=P.getElementsByTagName("head")[0]||P.documentElement;ne.insertBefore(N,ne.firstChild)};const Ur=Bo;class Go{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class lr{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=$n(this.data),f=this.url+"/"+s.number+"?"+c;this.request=W.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var ur=function(l,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(l.host||l.options.host)+l.options.path,P=W.createJSONPRequest(x,c),N=W.ScriptReceivers.create(function(G,ne){p.remove(N),P.cleanup(),ne&&ne.host&&(l.host=ne.host),f&&f(G,ne)});P.send(N)}},Ct={name:"jsonp",getAgent:ur};const gn=Ct;function On(l,s,c){var f=l+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function Nn(l,s){var c="/app/"+l,f="?protocol="+g.PROTOCOL+"&client=js&version="+g.VERSION+(s?"&"+s:"");return c+f}var ci={getInitial:function(l,s){var c=(s.httpPath||"")+Nn(l,"flash=false");return On("ws",s,c)}},dr={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+Nn(l);return On("http",s,c)}},pr={getInitial:function(l,s){return On("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return Nn(l)}};class li{constructor(){this._callbacks={}}get(s){return this._callbacks[Yt(s)]}add(s,c,f){var b=Yt(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[Yt(s)]:Ue(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){mt(s,function(b){this._callbacks[b]=In(this._callbacks[b]||[],function(x){return c&&c!==x.fn||f&&f!==x.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){mt(s,function(c){delete this._callbacks[c]},this)}}function Yt(l){return"_"+l}class Pt{constructor(s){this.callbacks=new li,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=In(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var x=this.callbacks.get(s),P=[];if(f?P.push(c,f):c&&P.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,P);else this.failThrough&&this.failThrough(s,c);return this}}class ui extends Pt{constructor(s,c,f,b,x){super(),this.initialize=W.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=x,this.state="new",this.timeline=x.timeline,this.activityTimeout=x.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return ee.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),fe.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(ee.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return te({cid:this.id},s)}}class ge{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new ui(this.hooks,s,c,f,b)}}var mn=new ge({urls:ci,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!W.getWebSocketAPI()},isSupported:function(){return!!W.getWebSocketAPI()},getSocket:function(l){return W.createWebSocket(l)}}),Wo={urls:dr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},jr=te({getSocket:function(l){return W.HTTPFactory.createStreamingSocket(l)}},Wo),hr=te({getSocket:function(l){return W.HTTPFactory.createPollingSocket(l)}},Wo),Zr={isSupported:function(){return W.isXHRSupported()}},Jo=new ge(te({},jr,Zr)),di=new ge(te({},hr,Zr)),bt={ws:mn,xhr_streaming:Jo,xhr_polling:di};const kt=bt;var Yo=new ge({file:"sockjs",urls:pr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:A.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),qr={isSupported:function(l){var s=W.isXDRSupported(l.useTLS);return s}},Hr=new ge(te({},jr,qr)),Vo=new ge(te({},hr,qr));kt.xdr_streaming=Hr,kt.xdr_polling=Vo,kt.sockjs=Yo;const Rt=kt;class Xo extends Pt{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Ko=new Xo;class Qo{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=te({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),P=null,N=function(){x.unbind("open",N),x.bind("closed",G),P=ee.now()},G=ne=>{if(x.unbind("closed",G),ne.code===1002||ne.code===1003)this.manager.reportDeath();else if(!ne.wasClean&&P){var ie=ee.now()-P;ie<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(ie/2,this.minPingDelay))}};return x.bind("open",N),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const Fr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=Fr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Vt=Fr;class U extends Pt{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),fe.debug("Event sent",b),this.send(Vt.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=Vt.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(fe.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{Oe(s,(f,b)=>{this.transport.unbind(b,f)})};Oe(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=Vt.getCloseAction(s),f=Vt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=Vt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new U(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Vt.getCloseAction(s)||"backoff",f=Vt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(te({transport:this.transport,action:s},c))}}class E{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(W.TimelineTransport.getAgent(this,s),c)}}class L extends Pt{constructor(s,c){super(function(f,b){fe.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new S("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=O.buildLogSuffix("triggeringClientEvents");fe.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,fe.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Ie?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class ue extends L{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Ne{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){Oe(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Se=function(l,s,c,f){function b(x){return x instanceof c?x:new c(function(P){P(x)})}return new(c||(c=Promise))(function(x,P){function N(ie){try{ne(f.next(ie))}catch(Ce){P(Ce)}}function G(ie){try{ne(f.throw(ie))}catch(Ce){P(Ce)}}function ne(ie){ie.done?x(ie.value):b(ie.value).then(N,G)}ne((f=f.apply(l,s||[])).next())})};class We extends ue{constructor(s,c){super(s,c),this.members=new Ne}authorize(s,c){super.authorize(s,(f,b)=>Se(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let P=O.buildLogSuffix("authorizationEndpoint");fe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${P}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var x=this.members.removeMember(f);x&&this.emit("pusher:member_removed",x);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Lt=u(978),jt=u(594);class Br extends ue{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let x=b.shared_secret;if(!x){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,jt.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Le("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){fe.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){fe.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,jt.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){fe.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,jt.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){fe.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let x=this.nacl.secretbox.open(f,b,this.key);if(x===null){fe.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(P,N)=>{if(P){fe.error(`Failed to make a request to the authEndpoint: ${N}. Unable to fetch new key, so dropping encrypted event`);return}if(x=this.nacl.secretbox.open(f,b,this.key),x===null){fe.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(x))});return}this.emit(s,this.getDataToEmit(x))}getDataToEmit(s){let c=(0,Lt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class ze extends Pt{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=W.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new Be(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Be(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Be(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Be(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return te({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return te({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),fe.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class es{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=ts(s,c)),this.channels[s]}all(){return Ge(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Oe(this.channels,function(s){s.disconnect()})}}function ts(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return Xt.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=O.buildLogSuffix("encryptedChannelSupport");throw new Le(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Xt.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return Xt.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new C('Cannot create a channel with name "'+l+'".');return Xt.createChannel(l,s)}}var Yb={createChannels(){return new es},createConnectionManager(l,s){return new ze(l,s)},createChannel(l,s){return new L(l,s)},createPrivateChannel(l,s){return new ue(l,s)},createPresenceChannel(l,s){return new We(l,s)},createEncryptedChannel(l,s,c){return new Br(l,s,c)},createTimelineSender(l,s){return new E(l,s)},createHandshake(l,s){return new _(l,s)},createAssistantToTheTransportManager(l,s,c){return new Qo(l,s,c)}};const Xt=Yb;class vl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Xt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Dn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Nr(this.strategies,ee.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,P=null,N=(G,ne)=>{ne?c(null,ne):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),P=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},N)):c(!0))};return P=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},N),{abort:function(){P.abort()},forceMinPriority:function(G){s=G,P&&P.forceMinPriority(G)}}}tryStrategy(s,c,f,b){var x=null,P=null;return f.timeout>0&&(x=new Be(f.timeout,function(){P.abort(),b(!0)})),P=s.connect(c,function(N,G){N&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(N,G))}),{abort:function(){x&&x.ensureAborted(),P.abort()},forceMinPriority:function(N){P.forceMinPriority(N)}}}}class pi{constructor(s){this.strategies=s}isSupported(){return Nr(this.strategies,ee.method("isSupported"))}connect(s,c){return Vb(this.strategies,s,function(f,b){return function(x,P){if(b[f].error=x,x){Xb(b)&&c(!0);return}mt(b,function(N){N.forceMinPriority(P.transport.priority)}),c(null,P)}})}}function Vb(l,s,c){var f=At(l,function(b,x,P,N){return b.connect(s,c(x,N))});return{abort:function(){mt(f,Kb)},forceMinPriority:function(b){mt(f,function(x){x.forceMinPriority(b)})}}}function Xb(l){return ai(l,function(s){return!!s.error})}function Kb(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class Qb{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=ek(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,P=[this.strategy];if(b&&b.timestamp+this.ttl>=ee.now()){var N=this.transports[b.transport];N&&(["ws","wss"].includes(b.transport)||x>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),P.push(new Dn([N],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var G=ee.now(),ne=P.pop().connect(s,function ie(Ce,ss){Ce?(yl(f),P.length>0?(G=ee.now(),ne=P.pop().connect(s,ie)):c(Ce)):(tk(f,ss.transport.name,ee.now()-G,x),c(null,ss))});return{abort:function(){ne.abort()},forceMinPriority:function(ie){s=ie,ne&&ne.forceMinPriority(ie)}}}}function hi(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function ek(l){var s=W.getLocalStorage();if(s)try{var c=s[hi(l)];if(c)return JSON.parse(c)}catch(f){yl(l)}return null}function tk(l,s,c,f){var b=W.getLocalStorage();if(b)try{b[hi(l)]=ot({timestamp:ee.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function yl(l){var s=W.getLocalStorage();if(s)try{delete s[hi(l)]}catch(c){}}class ns{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,x=new Be(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(P){s=P,b&&b.forceMinPriority(P)}}}}class Gr{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class nk{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,x){x&&f.abort(),c(b,x)});return f}}function Wr(l){return function(){return l.isSupported()}}var rk=function(l,s,c){var f={};function b($l,e_,t_,n_,r_){var Ol=c(l,$l,e_,t_,n_,r_);return f[$l]=Ol,Ol}var x=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),P=Object.assign({},x,{useTLS:!0}),N=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),G={loop:!0,timeout:15e3,timeoutLimit:6e4},ne=new vl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),ie=new vl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Ce=b("ws","ws",3,x,ne),ss=b("wss","ws",3,P,ne),Yk=b("sockjs","sockjs",1,N),Cl=b("xhr_streaming","xhr_streaming",1,N,ie),Vk=b("xdr_streaming","xdr_streaming",1,N,ie),Pl=b("xhr_polling","xhr_polling",1,N),Xk=b("xdr_polling","xdr_polling",1,N),Rl=new Dn([Ce],G),Kk=new Dn([ss],G),Qk=new Dn([Yk],G),Ll=new Dn([new Gr(Wr(Cl),Cl,Vk)],G),Il=new Dn([new Gr(Wr(Pl),Pl,Xk)],G),zl=new Dn([new Gr(Wr(Ll),new pi([Ll,new ns(Il,{delay:4e3})]),Il)],G),mi=new Gr(Wr(zl),zl,Qk),bi;return s.useTLS?bi=new pi([Rl,new ns(mi,{delay:2e3})]):bi=new pi([Rl,new ns(Kk,{delay:2e3}),new ns(mi,{delay:5e3})]),new Qb(new nk(new Gr(Wr(Ce),bi,mi)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const ok=rk;function sk(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),A.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var ik={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new M),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const ak=ik,ck=256*1024;class lk extends Pt{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},W.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(W.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1365
- `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>ck}}var fi;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(fi||(fi={}));const Mn=fi;var uk=1;class dk{constructor(s,c){this.hooks=s,this.session=xl(1e3)+"/"+gk(8),this.location=pk(c),this.readyState=Mn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===Mn.OPEN)try{return W.createSocketRequest("POST",wl(hk(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=Mn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Mn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===Mn.CONNECTING?(s&&s.hostname&&(this.location.base=fk(this.location.base,s.hostname)),this.readyState=Mn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Mn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=W.createSocketRequest("POST",wl(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){ee.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function pk(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function hk(l,s){return l.base+"/"+s+"/xhr_send"}function wl(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+uk++}function fk(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function xl(l){return W.randomInt(l)}function gk(l){for(var s=[],c=0;c<l;c++)s.push(xl(32).toString(32));return s.join("")}const mk=dk;var bk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const kk=bk;var _k={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const vk=_k;var yk={getRequest:function(l){var s=W.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const wk=yk;var xk={createStreamingSocket(l){return this.createSocket(kk,l)},createPollingSocket(l){return this.createSocket(vk,l)},createSocket(l,s){return new mk(l,s)},createXHR(l,s){return this.createRequest(wk,l,s)},createRequest(l,s,c){return new lk(l,s,c)}};const Sl=xk;Sl.createXDR=function(l,s){return this.createRequest(ak,l,s)};var Sk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:p,DependenciesReceivers:y,getDefaultStrategy:ok,Transports:Rt,transportConnectionInitializer:sk,HTTPFactory:Sl,TimelineTransport:gn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():A.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Tt,jsonp:Ur}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new lr(l,s)},createScriptRequest(l){return new Go(l)},getLocalStorage(){try{return window.localStorage}catch(l){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Ko},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const W=Sk;var gi;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(gi||(gi={}));const rs=gi;class Tk{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(te({},c,{timestamp:ee.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(rs.ERROR,s)}info(s){this.log(rs.INFO,s)}debug(s){this.log(rs.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=te({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,x)=>{b||this.sent++,c&&c(b,x)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class Ek{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return Tl(new Y,c)}else return Tl(new re,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,P=function(){b.unbind("initialized",P),b.connect()},N=function(){x=Xt.createHandshake(b,function(Ce){f=!0,ie(),c(null,Ce)})},G=function(Ce){ie(),c(Ce)},ne=function(){ie();var Ce;Ce=ot(b),c(new xe(Ce))},ie=function(){b.unbind("initialized",P),b.unbind("open",N),b.unbind("error",G),b.unbind("closed",ne)};return b.bind("initialized",P),b.bind("open",N),b.bind("error",G),b.bind("closed",ne),b.initialize(),{abort:()=>{f||(ie(),x?x.close():b.close())},forceMinPriority:Ce=>{f||this.priority<Ce&&(x?x.close():b.close())}}}}function Tl(l,s){return ee.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:Ak}=W;var Ck=function(l,s,c,f,b,x){var P=Ak[c];if(!P)throw new tt(c);var N=(!l.enabledTransports||rt(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||rt(l.disabledTransports,s)===-1),G;return N?(b=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},b),G=new Ek(s,f,x?x.getAssistant(P):P,b)):G=Pk,G},Pk={isSupported:function(){return!1},connect:function(l,s){var c=ee.defer(function(){s(new re)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function Rk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&fe.warn("The disableStats option is deprecated in favor of enableStats")}const Lk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Ik=l=>{if(typeof W.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Lk(s,l);W.getAuthorizers()[l.transport](W,f,l,T.UserAuthentication,c)}},zk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},$k=l=>{if(typeof W.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=zk(s,l);W.getAuthorizers()[l.transport](W,f,l,T.ChannelAuthorization,c)}},Ok=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const P=l.channel(b.channelName);c(P,f).authorize(b.socketId,x)}};function El(l,s){let c={activityTimeout:l.activityTimeout||g.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||g.httpPath,httpPort:l.httpPort||g.httpPort,httpsPort:l.httpsPort||g.httpsPort,pongTimeout:l.pongTimeout||g.pongTimeout,statsHost:l.statsHost||g.stats_host,unavailableTimeout:l.unavailableTimeout||g.unavailableTimeout,wsPath:l.wsPath||g.wsPath,wsPort:l.wsPort||g.wsPort,wssPort:l.wssPort||g.wssPort,enableStats:jk(l),httpHost:Nk(l),useTLS:Uk(l),wsHost:Dk(l),userAuthenticator:Zk(l),channelAuthorizer:Hk(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Nk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:g.httpHost}function Dk(l){return l.wsHost?l.wsHost:Mk(l.cluster)}function Mk(l){return`ws-${l}.pusher.com`}function Uk(l){return W.getProtocol()==="https:"?!0:l.forceTLS!==!1}function jk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Al=l=>"customHandler"in l&&l.customHandler!=null;function Zk(l){const s=Object.assign(Object.assign({},g.userAuthentication),l.userAuthentication);return Al(s)?s.customHandler:Ik(s)}function qk(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},g.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||g.authTransport,endpoint:l.authEndpoint||g.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:Ok(s,c,l.authorizer)};return c}function Hk(l,s){const c=qk(l,s);return Al(c)?c.customHandler:$k(c)}class Fk extends Pt{constructor(s){super(function(c,f){fe.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function Bk(){let l,s;return{promise:new Promise((f,b)=>{l=f,s=b}),resolve:l,reject:s}}const Gk=Bk;class Wk extends Pt{constructor(s){super(function(c,f){fe.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){fe.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Fk(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){fe.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){fe.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new L(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=Gk();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class je{static ready(){je.isReady=!0;for(var s=0,c=je.instances.length;s<c;s++)je.instances[s].connect()}static getClientFeatures(){return Ue(zn({ws:W.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){Jk(s),Rk(c),this.key=s,this.options=c,this.config=El(this.options,this),this.channels=Xt.createChannels(),this.global_emitter=new Pt,this.sessionID=W.randomInt(1e9),this.timeline=new Tk(this.key,this.sessionID,{cluster:this.config.cluster,features:je.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:rs.INFO,version:g.VERSION}),this.config.enableStats&&(this.timelineSender=Xt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+W.TimelineTransport.name}));var f=b=>W.getDefaultStrategy(this.config,b,Ck);this.connection=Xt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",b=>{var x=b.event,P=x.indexOf("pusher_internal:")===0;if(b.channel){var N=this.channel(b.channel);N&&N.handleEvent(b)}P||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{fe.warn(b)}),je.instances.push(this),this.timeline.info({instances:je.instances.length}),this.user=new Wk(this),je.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=El(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new pn(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}je.instances=[],je.isReady=!1,je.logToConsole=!1,je.Runtime=W,je.ScriptReceivers=W.ScriptReceivers,je.DependenciesReceivers=W.DependenciesReceivers,je.auth_callbacks=W.auth_callbacks;const os=je;function Jk(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}W.setup(je)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var u=r[a]={exports:{}};return n[a].call(u.exports,u,u.exports,o),u.exports}o.d=(a,d)=>{for(var u in d)o.o(d,u)&&!o.o(a,u)&&Object.defineProperty(a,u,{enumerable:!0,get:d[u]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Ss)),Ss.exports}var cg=ag();const lg=ig(cg);let vt=null,Yn=null;function ug(e){return I(this,null,function*(){return Yn||(Yn=I(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield ho(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();vt=new lg(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{ho(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),Yn.catch(()=>{Yn=null}),Yn)})}function dg(e){if(!e||!vt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return vt.connection.bind("state_change",n),()=>vt==null?void 0:vt.connection.unbind("state_change",n)}function pg(e,t,n){return I(this,null,function*(){if(yield ug(e),!vt)return()=>{};const r=vt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(to.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(to.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(to.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(to.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=dg(n.onReconnect);return()=>{r.unbind_all(),vt==null||vt.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ts="ap-sdk-active-automation";function hg(){try{const e=sessionStorage.getItem(Ts);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function Ba(e){try{sessionStorage.setItem(Ts,JSON.stringify(e))}catch(t){}}function Ga(){try{sessionStorage.removeItem(Ts)}catch(e){}}function fg(e){return I(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield gg(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()})}function gg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Es="shared",Wa="ap-sdk-panel-size:",Ja=280,Ya=200;function mg(e){try{const t=sessionStorage.getItem(Wa+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch(t){return null}}function bg(e,t){try{sessionStorage.setItem(Wa+e,JSON.stringify(t))}catch(n){}}function go(e,t,n){return Math.min(Math.max(e,t),n)}function Va(){return window.innerWidth-32}function Xa(){return window.innerHeight-64}function As(e,t){const n=mg(t);n&&(e.style.width=`${go(n.width,Ja,Va())}px`,e.style.height=`${go(n.height,Ya,Xa())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,u=0,h=0,p=0;const m=k=>{o&&(h=go(d+(k.clientX-i),Ja,Va()),p=go(u+(k.clientY-a),Ya,Xa()),e.style.width=`${h}px`,e.style.height=`${p}px`)},g=()=>{o&&(o=!1,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",g),bg(t,{width:h,height:p}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const y=e.getBoundingClientRect();d=y.width,u=y.height,h=d,p=u,document.addEventListener("pointermove",m),document.addEventListener("pointerup",g)})}function Cs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _n=Cs();function Ka(e){_n=e}var vn={exec:()=>null};function Vn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function X(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(qe.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var kg=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),qe={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,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ 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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Vn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Vn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Vn(e=>new RegExp(`^ {0,${e}}>`))},_g=/^(?:[ \t]*(?:\n|$))+/,vg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yg=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,wg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ps=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Qa=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ec=X(Qa).replace(/bull/g,Ps).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}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),xg=X(Qa).replace(/bull/g,Ps).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}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Rs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Sg=/^[^\n]+/,Ls=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Tg=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ls).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Eg=X(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ps).getRegex(),mo="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",Is=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ag=X("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\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",Is).replace("tag",mo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),tc=e=>X(Rs).replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",mo).getRegex(),Cg=tc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Pg=tc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Rg=X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Pg).getRegex(),zs={blockquote:Rg,code:vg,def:Tg,fences:yg,heading:wg,hr:vr,html:Ag,lheading:ec,list:Eg,newline:_g,paragraph:Cg,table:vn,text:Sg},nc=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",mo).getRegex(),Lg=j(v({},zs),{lheading:xg,table:nc,paragraph:X(Rs).replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",nc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",mo).getRegex()}),Ig=j(v({},zs),{html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Is).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:vn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(Rs).replace("hr",vr).replace("heading",` *#{1,6} *[^
1366
- ]`).replace("lheading",ec).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),zg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,$g=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rc=/^( {2,}|\\)\n(?!\s*$)/,Og=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ht=/[\p{P}\p{S}]/u,Xn=/[\s\p{P}\p{S}]/u,yr=/[^\s\p{P}\p{S}]/u,Ng=X(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xn).getRegex(),Dg=/[\p{Pi}\p{Ps}"']/u,oc=/(?!~)[\p{P}\p{S}]/u,Mg=/(?!~)[\s\p{P}\p{S}]/u,Ug=/(?:[^\s\p{P}\p{S}]|~)/u,jg=X(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",kg?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),sc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Zg=X(sc,"u").replace(/punct/g,Ht).getRegex(),qg=X(sc,"u").replace(/punct/g,oc).getRegex(),Hg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Fg=X(Hg,"u").replace(/openQuote/g,Dg).replace(/punct/g,Ht).getRegex(),ic="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Bg=X(ic,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Ht).getRegex(),Gg=X(ic,"gu").replace(/notPunctSpace/g,Ug).replace(/punctSpace/g,Mg).replace(/punct/g,oc).getRegex(),Wg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Jg=X(Wg,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Ht).getRegex(),Yg=X("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Ht).getRegex(),Vg="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Xg=X(Vg,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Ht).getRegex(),Kg=X(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ht).getRegex(),Qg="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",em=X(Qg,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Xn).replace(/punct/g,Ht).getRegex(),tm=X(/\\(punct)/,"gu").replace(/punct/g,Ht).getRegex(),nm=X(/^<(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(),rm=X(Is).replace("(?:-->|$)","-->").getRegex(),om=X("^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",rm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),bo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,sm=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",bo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ac=X(/^!?\[(label)\]\[(ref)\]/).replace("label",bo).replace("ref",Ls).getRegex(),cc=X(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ls).getRegex(),im=X("reflink|nolink(?!\\()","g").replace("reflink",ac).replace("nolink",cc).getRegex(),lc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,$s={_backpedal:vn,anyPunctuation:tm,autolink:nm,blockSkip:jg,br:rc,code:$g,del:vn,delLDelim:vn,delRDelim:vn,emStrongLDelim:Zg,emStrongRDelimAst:Bg,emStrongRDelimUnd:Yg,escape:zg,link:sm,nolink:cc,punctuation:Ng,reflink:ac,reflinkSearch:im,tag:om,text:Og,url:vn},am=j(v({},$s),{emStrongLDelim:Fg,emStrongRDelimAst:Jg,emStrongRDelimUnd:Xg,link:X(/^!?\[(label)\]\((.*?)\)/).replace("label",bo).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",bo).getRegex()}),Os=j(v({},$s),{emStrongRDelimAst:Gg,emStrongLDelim:qg,delLDelim:Kg,delRDelim:em,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",lc).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:X(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",lc).getRegex()}),cm=j(v({},Os),{br:X(rc).replace("{2,}","*").getRegex(),text:X(Os.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),ko={normal:zs,gfm:Lg,pedantic:Ig},wr={normal:$s,gfm:Os,breaks:cm,pedantic:am},lm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},uc=e=>lm[e];function $t(e,t){if(t){if(qe.escapeTest.test(e))return e.replace(qe.escapeReplace,uc)}else if(qe.escapeTestNoEncode.test(e))return e.replace(qe.escapeReplaceNoEncode,uc);return e}function dc(e){try{e=encodeURI(e).replace(qe.percentDecode,"%")}catch(t){return null}return e}function pc(e,t){var i;let n=e.replace(qe.findPipe,(a,d,u)=>{let h=!1,p=d;for(;--p>=0&&u[p]==="\\";)h=!h;return h?"|":" |"}),r=n.split(qe.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(qe.slashPipe,"|");return r}function on(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function hc(e){let t=e.split(`
1367
- `),n=t.length-1;for(;n>=0&&qe.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1368
- `)}function um(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function dm(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function fc(e,t,n,r,o){let i=t.href,a=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,u}function pm(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1364
+ */var Ga;function hg(){return Ga||(Ga=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var u=this&&this.__extends||(function(){var N=function(T,S){return N=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,M){C.__proto__=M}||function(C,M){for(var J in M)M.hasOwnProperty(J)&&(C[J]=M[J])},N(T,S)};return function(T,S){N(T,S);function C(){this.constructor=T}T.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function N(T){T===void 0&&(T="="),this._paddingCharacter=T}return N.prototype.encodedLength=function(T){return this._paddingCharacter?(T+2)/3*4|0:(T*8+5)/6|0},N.prototype.encode=function(T){for(var S="",C=0;C<T.length-2;C+=3){var M=T[C]<<16|T[C+1]<<8|T[C+2];S+=this._encodeByte(M>>>18&63),S+=this._encodeByte(M>>>12&63),S+=this._encodeByte(M>>>6&63),S+=this._encodeByte(M>>>0&63)}var J=T.length-C;if(J>0){var M=T[C]<<16|(J===2?T[C+1]<<8:0);S+=this._encodeByte(M>>>18&63),S+=this._encodeByte(M>>>12&63),J===2?S+=this._encodeByte(M>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},N.prototype.maxDecodedLength=function(T){return this._paddingCharacter?T/4*3|0:(T*6+7)/8|0},N.prototype.decodedLength=function(T){return this.maxDecodedLength(T.length-this._getPaddingLength(T))},N.prototype.decode=function(T){if(T.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(T),C=T.length-S,M=new Uint8Array(this.maxDecodedLength(C)),J=0,ge=0,Ze=0,it=0,te=0,Ee=0,et=0;ge<C-4;ge+=4)it=this._decodeChar(T.charCodeAt(ge+0)),te=this._decodeChar(T.charCodeAt(ge+1)),Ee=this._decodeChar(T.charCodeAt(ge+2)),et=this._decodeChar(T.charCodeAt(ge+3)),M[J++]=it<<2|te>>>4,M[J++]=te<<4|Ee>>>2,M[J++]=Ee<<6|et,Ze|=it&p,Ze|=te&p,Ze|=Ee&p,Ze|=et&p;if(ge<C-1&&(it=this._decodeChar(T.charCodeAt(ge)),te=this._decodeChar(T.charCodeAt(ge+1)),M[J++]=it<<2|te>>>4,Ze|=it&p,Ze|=te&p),ge<C-2&&(Ee=this._decodeChar(T.charCodeAt(ge+2)),M[J++]=te<<4|Ee>>>2,Ze|=Ee&p),ge<C-3&&(et=this._decodeChar(T.charCodeAt(ge+3)),M[J++]=Ee<<6|et,Ze|=et&p),Ze!==0)throw new Error("Base64Coder: incorrect characters for decoding");return M},N.prototype._encodeByte=function(T){var S=T;return S+=65,S+=25-T>>>8&6,S+=51-T>>>8&-75,S+=61-T>>>8&-15,S+=62-T>>>8&3,String.fromCharCode(S)},N.prototype._decodeChar=function(T){var S=p;return S+=(42-T&T-44)>>>8&-p+T-43+62,S+=(46-T&T-48)>>>8&-p+T-47+63,S+=(47-T&T-58)>>>8&-p+T-48+52,S+=(64-T&T-91)>>>8&-p+T-65+0,S+=(96-T&T-123)>>>8&-p+T-97+26,S},N.prototype._getPaddingLength=function(T){var S=0;if(this._paddingCharacter){for(var C=T.length-1;C>=0&&T[C]===this._paddingCharacter;C--)S++;if(T.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},N})();d.Coder=h;var g=new h;function m(N){return g.encode(N)}d.encode=m;function k(N){return g.decode(N)}d.decode=k;var y=(function(N){u(T,N);function T(){return N!==null&&N.apply(this,arguments)||this}return T.prototype._encodeByte=function(S){var C=S;return C+=65,C+=25-S>>>8&6,C+=51-S>>>8&-75,C+=61-S>>>8&-13,C+=62-S>>>8&49,String.fromCharCode(C)},T.prototype._decodeChar=function(S){var C=p;return C+=(44-S&S-46)>>>8&-p+S-45+62,C+=(94-S&S-96)>>>8&-p+S-95+63,C+=(47-S&S-58)>>>8&-p+S-48+52,C+=(64-S&S-91)>>>8&-p+S-65+0,C+=(96-S&S-123)>>>8&-p+S-97+26,C},T})(h);d.URLSafeCoder=y;var E=new y;function Z(N){return E.encode(N)}d.encodeURLSafe=Z;function ee(N){return E.decode(N)}d.decodeURLSafe=ee,d.encodedLength=function(N){return g.encodedLength(N)},d.maxDecodedLength=function(N){return g.maxDecodedLength(N)},d.decodedLength=function(N){return g.decodedLength(N)}},978(a,d){var u="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var y=void 0;if(k<224){if(m>=h.length)throw new Error(u);var E=h[++m];if((E&192)!==128)throw new Error(u);k=(k&31)<<6|E&63,y=128}else if(k<240){if(m>=h.length-1)throw new Error(u);var E=h[++m],Z=h[++m];if((E&192)!==128||(Z&192)!==128)throw new Error(u);k=(k&15)<<12|(E&63)<<6|Z&63,y=2048}else if(k<248){if(m>=h.length-2)throw new Error(u);var E=h[++m],Z=h[++m],ee=h[++m];if((E&192)!==128||(Z&192)!==128||(ee&192)!==128)throw new Error(u);k=(k&15)<<18|(E&63)<<12|(Z&63)<<6|ee&63,y=65536}else throw new Error(u);if(k<y||k>=55296&&k<=57343)throw new Error(u);if(k>=65536){if(k>1114111)throw new Error(u);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,u){a.exports=u(207).default},207(a,d,u){u.d(d,{default:()=>os});class p{constructor(s,c){this.lastId=0,this.prefix=s,this.name=c}create(s){this.lastId++;var c=this.lastId,f=this.prefix+c,b=this.name+"["+c+"]",x=!1,P=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=P,{number:c,id:f,name:b,callback:P}}remove(s){delete this[s.number]}}var h=new p("_pusher_script_","Pusher.ScriptReceivers"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var x=G.createScriptRequest(b.getPath(s,c)),P=b.receivers.create(function(O){if(b.receivers.remove(P),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var ne=function(Le){Le||x.cleanup()},se=0;se<B.length;se++)B[se](O,ne)}});x.send(P)}}getRoot(s){var c,f=G.getDocument().location.protocol;return s&&s.useTLS||f==="https:"?c=this.options.cdn_https:c=this.options.cdn_http,c.replace(/\/*$/,"")+"/"+this.options.version}getPath(s,c){return this.getRoot(c)+"/"+s+this.options.suffix+".js"}}var y=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),E=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:y});const Z={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/channels/server_api/authenticating_users"},authorizationEndpoint:{path:"/docs/channels/server_api/authorizing-users/"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"},encryptedChannelSupport:{fullUrl:"https://github.com/pusher/pusher-js/tree/cc491015371a4bde5743d1c87a0fbac0feb53195#encrypted-channel-support"}}},N={buildLogSuffix:function(l){const s="See:",c=Z.urls[l];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var T;(function(l){l.UserAuthentication="user-authentication",l.ChannelAuthorization="channel-authorization"})(T||(T={}));class S extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class C extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class M extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class J extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ge extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ze extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class it extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class te extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ee extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const pn=function(l,s,c,f,b){const x=G.createXHR();x.open("POST",c.endpoint,!0),x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var P in c.headers)x.setRequestHeader(P,c.headers[P]);if(c.headersProvider!=null){let O=c.headersProvider();for(var P in O)x.setRequestHeader(P,O[P])}return x.onreadystatechange=function(){if(x.readyState===4)if(x.status===200){let O,B=!1;try{O=JSON.parse(x.responseText),B=!0}catch(ne){b(new Ee(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${x.responseText}`),null)}B&&b(null,O)}else{let O="";switch(f){case T.UserAuthentication:O=N.buildLogSuffix("authenticationEndpoint");break;case T.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${N.buildLogSuffix("authorizationEndpoint")}`;break}b(new Ee(x.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${x.status} from ${c.endpoint}. ${O}`),null)}},x.send(s),x};function hn(l){return we(cr(l))}var at=String.fromCharCode,St="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tt=function(l){var s=l.charCodeAt(0);return s<128?l:s<2048?at(192|s>>>6)+at(128|s&63):at(224|s>>>12&15)+at(128|s>>>6&63)+at(128|s&63)},cr=function(l){return l.replace(/[^\x00-\x7F]/g,Tt)},Rn=function(l){var s=[0,2,1][l.length%3],c=l.charCodeAt(0)<<16|(l.length>1?l.charCodeAt(1):0)<<8|(l.length>2?l.charCodeAt(2):0),f=[St.charAt(c>>>18),St.charAt(c>>>12&63),s>=2?"=":St.charAt(c>>>6&63),s>=1?"=":St.charAt(c&63)];return f.join("")},we=window.btoa||function(l){return l.replace(/[\s\S]{1,3}/g,Rn)};class W{constructor(s,c,f,b){this.clear=c,this.timer=s(()=>{this.timer&&(this.timer=b(this.timer))},f)}isRunning(){return this.timer!==null}ensureAborted(){this.timer&&(this.clear(this.timer),this.timer=null)}}const F=W;function Pe(l){window.clearTimeout(l)}function Q(l){window.clearInterval(l)}class Re extends F{constructor(s,c){super(setTimeout,Pe,s,function(f){return c(),null})}}class ct extends F{constructor(s,c){super(setInterval,Q,s,function(f){return c(),f})}}var Et={now(){return Date.now?Date.now():new Date().valueOf()},defer(l){return new Re(0,l)},method(l,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[l].apply(f,c.concat(arguments))}}};const xe=Et;function oe(l,...s){for(var c=0;c<s.length;c++){var f=s[c];for(var b in f)f[b]&&f[b].constructor&&f[b].constructor===Object?l[b]=oe(l[b]||{},f[b]):l[b]=f[b]}return l}function tt(){for(var l=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?l.push(arguments[s]):l.push(nt(arguments[s]));return l.join(" : ")}function Fe(l,s){var c=Array.prototype.indexOf;if(l===null)return-1;if(c&&l.indexOf===c)return l.indexOf(s);for(var f=0,b=l.length;f<b;f++)if(l[f]===s)return f;return-1}function de(l,s){for(var c in l)Object.prototype.hasOwnProperty.call(l,c)&&s(l[c],c,l)}function Jt(l){var s=[];return de(l,function(c,f){s.push(f)}),s}function $e(l){var s=[];return de(l,function(c){s.push(c)}),s}function Be(l,s,c){for(var f=0;f<l.length;f++)s.call(c||window,l[f],f,l)}function Yt(l,s){for(var c=[],f=0;f<l.length;f++)c.push(s(l[f],f,l,c));return c}function lt(l,s){var c={};return de(l,function(f,b){c[b]=s(f)}),c}function Ln(l,s){s=s||function(b){return!!b};for(var c=[],f=0;f<l.length;f++)s(l[f],f,l,c)&&c.push(l[f]);return c}function In(l,s){var c={};return de(l,function(f,b){(s&&s(f,b,l,c)||f)&&(c[b]=f)}),c}function Fo(l){var s=[];return de(l,function(c,f){s.push([f,c])}),s}function Or(l,s){for(var c=0;c<l.length;c++)if(s(l[c],c,l))return!0;return!1}function ai(l,s){for(var c=0;c<l.length;c++)if(!s(l[c],c,l))return!1;return!0}function Nr(l){return lt(l,function(s){return typeof s=="object"&&(s=nt(s)),encodeURIComponent(hn(s.toString()))})}function zn(l){var s=In(l,function(f){return f!==void 0}),c=Yt(Fo(Nr(s)),xe.method("join","=")).join("&");return c}function fn(l){var s=[],c=[];return(function f(b,x){var P,O,B;switch(typeof b){case"object":if(!b)return null;for(P=0;P<s.length;P+=1)if(s[P]===b)return{$ref:c[P]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],P=0;P<b.length;P+=1)B[P]=f(b[P],x+"["+P+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],x+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(l,"$")}function nt(l){try{return JSON.stringify(l)}catch(s){return JSON.stringify(fn(l))}}class Dr{constructor(){this.globalLog=s=>{window.console&&window.console.log&&window.console.log(s)}}debug(...s){this.log(this.globalLog,s)}warn(...s){this.log(this.globalLogWarn,s)}error(...s){this.log(this.globalLogError,s)}globalLogWarn(s){window.console&&window.console.warn?window.console.warn(s):this.globalLog(s)}globalLogError(s){window.console&&window.console.error?window.console.error(s):this.globalLogWarn(s)}log(s,...c){var f=tt.apply(this,arguments);os.log?os.log(f):os.logToConsole&&s.bind(this)(f)}}const pe=new Dr;var Bo=function(l,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&pe.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var x=l.nextAuthCallbackID.toString();l.nextAuthCallbackID++;var P=l.getDocument(),O=P.createElement("script");l.auth_callbacks[x]=function(se){b(null,se)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ne=P.getElementsByTagName("head")[0]||P.documentElement;ne.insertBefore(O,ne.firstChild)};const Mr=Bo;class Go{constructor(s){this.src=s}send(s){var c=this,f="Error loading "+c.src;c.script=document.createElement("script"),c.script.id=s.id,c.script.src=c.src,c.script.type="text/javascript",c.script.charset="UTF-8",c.script.addEventListener?(c.script.onerror=function(){s.callback(f)},c.script.onload=function(){s.callback(null)}):c.script.onreadystatechange=function(){(c.script.readyState==="loaded"||c.script.readyState==="complete")&&s.callback(null)},c.script.async===void 0&&document.attachEvent&&/opera/i.test(navigator.userAgent)?(c.errorScript=document.createElement("script"),c.errorScript.id=s.id+"_error",c.errorScript.text=s.name+"('"+f+"');",c.script.async=c.errorScript.async=!1):c.script.async=!0;var b=document.getElementsByTagName("head")[0];b.insertBefore(c.script,b.firstChild),c.errorScript&&b.insertBefore(c.errorScript,c.script.nextSibling)}cleanup(){this.script&&(this.script.onload=this.script.onerror=null,this.script.onreadystatechange=null),this.script&&this.script.parentNode&&this.script.parentNode.removeChild(this.script),this.errorScript&&this.errorScript.parentNode&&this.errorScript.parentNode.removeChild(this.errorScript),this.script=null,this.errorScript=null}}class lr{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=zn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var ur=function(l,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(l.host||l.options.host)+l.options.path,P=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,ne){h.remove(O),P.cleanup(),ne&&ne.host&&(l.host=ne.host),f&&f(B,ne)});P.send(O)}},At={name:"jsonp",getAgent:ur};const gn=At;function $n(l,s,c){var f=l+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function On(l,s){var c="/app/"+l,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ci={getInitial:function(l,s){var c=(s.httpPath||"")+On(l,"flash=false");return $n("ws",s,c)}},dr={getInitial:function(l,s){var c=(s.httpPath||"/pusher")+On(l);return $n("http",s,c)}},pr={getInitial:function(l,s){return $n("http",s,s.httpPath||"/pusher")},getPath:function(l,s){return On(l)}};class li{constructor(){this._callbacks={}}get(s){return this._callbacks[Vt(s)]}add(s,c,f){var b=Vt(s);this._callbacks[b]=this._callbacks[b]||[],this._callbacks[b].push({fn:c,context:f})}remove(s,c,f){if(!s&&!c&&!f){this._callbacks={};return}var b=s?[Vt(s)]:Jt(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Be(s,function(b){this._callbacks[b]=Ln(this._callbacks[b]||[],function(x){return c&&c!==x.fn||f&&f!==x.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){Be(s,function(c){delete this._callbacks[c]},this)}}function Vt(l){return"_"+l}class Ct{constructor(s){this.callbacks=new li,this.global_callbacks=[],this.failThrough=s}bind(s,c,f){return this.callbacks.add(s,c,f),this}bind_global(s){return this.global_callbacks.push(s),this}unbind(s,c,f){return this.callbacks.remove(s,c,f),this}unbind_global(s){return s?(this.global_callbacks=Ln(this.global_callbacks||[],c=>c!==s),this):(this.global_callbacks=[],this)}unbind_all(){return this.unbind(),this.unbind_global(),this}emit(s,c,f){for(var b=0;b<this.global_callbacks.length;b++)this.global_callbacks[b](s,c);var x=this.callbacks.get(s),P=[];if(f?P.push(c,f):c&&P.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,P);else this.failThrough&&this.failThrough(s,c);return this}}class ui extends Ct{constructor(s,c,f,b,x){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=x,this.state="new",this.timeline=x.timeline,this.activityTimeout=x.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return xe.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),pe.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(xe.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return oe({cid:this.id},s)}}class he{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new ui(this.hooks,s,c,f,b)}}var mn=new he({urls:ci,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(l){return G.createWebSocket(l)}}),Wo={urls:dr,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},Ur=oe({getSocket:function(l){return G.HTTPFactory.createStreamingSocket(l)}},Wo),hr=oe({getSocket:function(l){return G.HTTPFactory.createPollingSocket(l)}},Wo),jr={isSupported:function(){return G.isXHRSupported()}},Jo=new he(oe({},Ur,jr)),di=new he(oe({},hr,jr)),mt={ws:mn,xhr_streaming:Jo,xhr_polling:di};const bt=mt;var Yo=new he({file:"sockjs",urls:pr,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(l,s){return new window.SockJS(l,null,{js_path:E.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(l,s){l.send(JSON.stringify({path:s}))}}),Zr={isSupported:function(l){var s=G.isXDRSupported(l.useTLS);return s}},qr=new he(oe({},Ur,Zr)),Vo=new he(oe({},hr,Zr));bt.xdr_streaming=qr,bt.xdr_polling=Vo,bt.sockjs=Yo;const Pt=bt;class Xo extends Ct{constructor(){super();var s=this;window.addEventListener!==void 0&&(window.addEventListener("online",function(){s.emit("online")},!1),window.addEventListener("offline",function(){s.emit("offline")},!1))}isOnline(){return window.navigator.onLine===void 0?!0:window.navigator.onLine}}var Ko=new Xo;class Qo{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=oe({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),P=null,O=function(){x.unbind("open",O),x.bind("closed",B),P=xe.now()},B=ne=>{if(x.unbind("closed",B),ne.code===1002||ne.code===1003)this.manager.reportDeath();else if(!ne.wasClean&&P){var se=xe.now()-P;se<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(se/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const Hr={decodeMessage:function(l){try{var s=JSON.parse(l.data),c=s.data;if(typeof c=="string")try{c=JSON.parse(s.data)}catch(b){}var f={event:s.event,channel:s.channel,data:c};return s.user_id&&(f.user_id=s.user_id),f}catch(b){throw{type:"MessageParseError",error:b,data:l.data}}},encodeMessage:function(l){return JSON.stringify(l)},processHandshake:function(l){var s=Hr.decodeMessage(l);if(s.event==="pusher:connection_established"){if(!s.data.activity_timeout)throw"No activity timeout specified in handshake";return{action:"connected",id:s.data.socket_id,activityTimeout:s.data.activity_timeout*1e3}}else{if(s.event==="pusher:error")return{action:this.getCloseAction(s.data),error:this.getCloseError(s.data)};throw"Invalid handshake"}},getCloseAction:function(l){return l.code<4e3?l.code>=1002&&l.code<=1004?"backoff":null:l.code===4e3?"tls_only":l.code<4100?"refused":l.code<4200?"backoff":l.code<4300?"retry":"refused"},getCloseError:function(l){return l.code!==1e3&&l.code!==1001?{type:"PusherError",data:{code:l.code,message:l.reason||l.message}}:null}},Xt=Hr;class U extends Ct{constructor(s,c){super(),this.id=s,this.transport=c,this.activityTimeout=c.activityTimeout,this.bindListeners()}handlesActivityChecks(){return this.transport.handlesActivityChecks()}send(s){return this.transport.send(s)}send_event(s,c,f){var b={event:s,data:c};return f&&(b.channel=f),pe.debug("Event sent",b),this.send(Xt.encodeMessage(b))}ping(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})}close(){this.transport.close()}bindListeners(){var s={message:f=>{var b;try{b=Xt.decodeMessage(f)}catch(x){this.emit("error",{type:"MessageParseError",error:x,data:f.data})}if(b!==void 0){switch(pe.debug("Event recd",b),b.event){case"pusher:error":this.emit("error",{type:"PusherError",data:b.data});break;case"pusher:ping":this.emit("ping");break;case"pusher:pong":this.emit("pong");break}this.emit("message",b)}},activity:()=>{this.emit("activity")},error:f=>{this.emit("error",f)},closed:f=>{c(),f&&f.code&&this.handleCloseEvent(f),this.transport=null,this.emit("closed")}},c=()=>{de(s,(f,b)=>{this.transport.unbind(b,f)})};de(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=Xt.getCloseAction(s),f=Xt.getCloseError(s);f&&this.emit("error",f),c&&this.emit(c,{action:c,error:f})}}class _{constructor(s,c){this.transport=s,this.callback=c,this.bindListeners()}close(){this.unbindListeners(),this.transport.close()}bindListeners(){this.onMessage=s=>{this.unbindListeners();var c;try{c=Xt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new U(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Xt.getCloseAction(s)||"backoff",f=Xt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(oe({transport:this.transport,action:s},c))}}class A{constructor(s,c){this.timeline=s,this.options=c||{}}send(s,c){this.timeline.isEmpty()||this.timeline.send(G.TimelineTransport.getAgent(this,s),c)}}class I extends Ct{constructor(s,c){super(function(f,b){pe.debug("No callbacks on "+s+" for "+f)}),this.name=s,this.pusher=c,this.subscribed=!1,this.subscriptionPending=!1,this.subscriptionCancelled=!1}authorize(s,c){return c(null,{auth:""})}trigger(s,c){if(s.indexOf("client-")!==0)throw new S("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=N.buildLogSuffix("triggeringClientEvents");pe.warn(`Client event triggered before channel 'subscription_succeeded' event . ${f}`)}return this.pusher.send_event(s,c,this.name)}disconnect(){this.subscribed=!1,this.subscriptionPending=!1}handleEvent(s){var c=s.event,f=s.data;if(c==="pusher_internal:subscription_succeeded")this.handleSubscriptionSucceededEvent(s);else if(c==="pusher_internal:subscription_count")this.handleSubscriptionCountEvent(s);else if(c.indexOf("pusher_internal:")!==0){var b={};this.emit(c,f,b)}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",s.data)}handleSubscriptionCountEvent(s){s.data.subscription_count&&(this.subscriptionCount=s.data.subscription_count),this.emit("pusher:subscription_count",s.data)}subscribe(){this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(s,c)=>{s?(this.subscriptionPending=!1,pe.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof Ee?{status:s.status}:{}))):this.pusher.send_event("pusher:subscribe",{auth:c.auth,channel_data:c.channel_data,channel:this.name})}))}unsubscribe(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})}cancelSubscription(){this.subscriptionCancelled=!0}reinstateSubscription(){this.subscriptionCancelled=!1}}class le extends I{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class De{constructor(){this.reset()}get(s){return Object.prototype.hasOwnProperty.call(this.members,s)?{id:s,info:this.members[s]}:null}each(s){de(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Se=function(l,s,c,f){function b(x){return x instanceof c?x:new c(function(P){P(x)})}return new(c||(c=Promise))(function(x,P){function O(se){try{ne(f.next(se))}catch(Le){P(Le)}}function B(se){try{ne(f.throw(se))}catch(Le){P(Le)}}function ne(se){se.done?x(se.value):b(se.value).then(O,B)}ne((f=f.apply(l,s||[])).next())})};class Ge extends le{constructor(s,c){super(s,c),this.members=new De}authorize(s,c){super.authorize(s,(f,b)=>Se(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var x=JSON.parse(b.channel_data);this.members.setMyID(x.user_id)}else if(yield this.pusher.user.signinDonePromise,this.pusher.user.user_data!=null)this.members.setMyID(this.pusher.user.user_data.id);else{let P=N.buildLogSuffix("authorizationEndpoint");pe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${P}, or the user should be signed in.`),c("Invalid auth response");return}c(f,b)}))}handleEvent(s){var c=s.event;if(c.indexOf("pusher_internal:")===0)this.handleInternalEvent(s);else{var f=s.data,b={};s.user_id&&(b.user_id=s.user_id),this.emit(c,f,b)}}handleInternalEvent(s){var c=s.event,f=s.data;switch(c){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(s);break;case"pusher_internal:subscription_count":this.handleSubscriptionCountEvent(s);break;case"pusher_internal:member_added":var b=this.members.addMember(f);this.emit("pusher:member_added",b);break;case"pusher_internal:member_removed":var x=this.members.removeMember(f);x&&this.emit("pusher:member_removed",x);break}}handleSubscriptionSucceededEvent(s){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(s.data),this.emit("pusher:subscription_succeeded",this.members))}disconnect(){this.members.reset(),super.disconnect()}}var Rt=u(978),Ut=u(594);class Fr extends le{constructor(s,c,f){super(s,c),this.key=null,this.nacl=f}authorize(s,c){super.authorize(s,(f,b)=>{if(f){c(f,b);return}let x=b.shared_secret;if(!x){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Ut.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Ze("Client events are not currently supported for encrypted channels")}handleEvent(s){var c=s.event,f=s.data;if(c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0){super.handleEvent(s);return}this.handleEncryptedEvent(c,f)}handleEncryptedEvent(s,c){if(!this.key){pe.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){pe.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Ut.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){pe.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Ut.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){pe.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let x=this.nacl.secretbox.open(f,b,this.key);if(x===null){pe.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),this.authorize(this.pusher.connection.socket_id,(P,O)=>{if(P){pe.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(x=this.nacl.secretbox.open(f,b,this.key),x===null){pe.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(x))});return}this.emit(s,this.getDataToEmit(x))}getDataToEmit(s){let c=(0,Rt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class Oe extends Ct{constructor(s,c){super(),this.state="initialized",this.connection=null,this.key=s,this.options=c,this.timeline=this.options.timeline,this.usingTLS=this.options.useTLS,this.errorCallbacks=this.buildErrorCallbacks(),this.connectionCallbacks=this.buildConnectionCallbacks(this.errorCallbacks),this.handshakeCallbacks=this.buildHandshakeCallbacks(this.errorCallbacks);var f=G.getNetwork();f.bind("online",()=>{this.timeline.info({netinfo:"online"}),(this.state==="connecting"||this.state==="unavailable")&&this.retryIn(0)}),f.bind("offline",()=>{this.timeline.info({netinfo:"offline"}),this.connection&&this.sendActivityCheck()}),this.updateStrategy()}switchCluster(s){this.key=s,this.updateStrategy(),this.retryIn(0)}connect(){if(!(this.connection||this.runner)){if(!this.strategy.isSupported()){this.updateState("failed");return}this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()}}send(s){return this.connection?this.connection.send(s):!1}send_event(s,c,f){return this.connection?this.connection.send_event(s,c,f):!1}disconnect(){this.disconnectInternally(),this.updateState("disconnected")}isUsingTLS(){return this.usingTLS}startConnecting(){var s=(c,f)=>{c?this.runner=this.strategy.connect(0,s):f.action==="error"?(this.emit("error",{type:"HandshakeError",error:f.error}),this.timeline.error({handshakeError:f.error})):(this.abortConnecting(),this.handshakeCallbacks[f.action](f))};this.runner=this.strategy.connect(0,s)}abortConnecting(){this.runner&&(this.runner.abort(),this.runner=null)}disconnectInternally(){if(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection){var s=this.abandonConnection();s.close()}}updateStrategy(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})}retryIn(s){this.timeline.info({action:"retry",delay:s}),s>0&&this.emit("connecting_in",Math.round(s/1e3)),this.retryTimer=new Re(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Re(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Re(this.options.pongTimeout,()=>{this.timeline.error({pong_timed_out:this.options.pongTimeout}),this.retryIn(0)})}resetActivityCheck(){this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new Re(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return oe({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return oe({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),pe.debug("State changed",f+" -> "+b),this.timeline.info({state:s,params:c}),this.emit("state_change",{previous:f,current:s}),this.emit(s,c)}}shouldRetry(){return this.state==="connecting"||this.state==="connected"}}class es{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=ts(s,c)),this.channels[s]}all(){return $e(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){de(this.channels,function(s){s.disconnect()})}}function ts(l,s){if(l.indexOf("private-encrypted-")===0){if(s.config.nacl)return Kt.createEncryptedChannel(l,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=N.buildLogSuffix("encryptedChannelSupport");throw new Ze(`${c}. ${f}`)}else{if(l.indexOf("private-")===0)return Kt.createPrivateChannel(l,s);if(l.indexOf("presence-")===0)return Kt.createPresenceChannel(l,s);if(l.indexOf("#")===0)throw new C('Cannot create a channel with name "'+l+'".');return Kt.createChannel(l,s)}}var nk={createChannels(){return new es},createConnectionManager(l,s){return new Oe(l,s)},createChannel(l,s){return new I(l,s)},createPrivateChannel(l,s){return new le(l,s)},createPresenceChannel(l,s){return new Ge(l,s)},createEncryptedChannel(l,s,c){return new Fr(l,s,c)},createTimelineSender(l,s){return new A(l,s)},createHandshake(l,s){return new _(l,s)},createAssistantToTheTransportManager(l,s,c){return new Qo(l,s,c)}};const Kt=nk;class xl{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Kt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Nn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Or(this.strategies,xe.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,P=null,O=(B,ne)=>{ne?c(null,ne):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),P=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O)):c(!0))};return P=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O),{abort:function(){P.abort()},forceMinPriority:function(B){s=B,P&&P.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var x=null,P=null;return f.timeout>0&&(x=new Re(f.timeout,function(){P.abort(),b(!0)})),P=s.connect(c,function(O,B){O&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(O,B))}),{abort:function(){x&&x.ensureAborted(),P.abort()},forceMinPriority:function(O){P.forceMinPriority(O)}}}}class pi{constructor(s){this.strategies=s}isSupported(){return Or(this.strategies,xe.method("isSupported"))}connect(s,c){return rk(this.strategies,s,function(f,b){return function(x,P){if(b[f].error=x,x){ok(b)&&c(!0);return}Be(b,function(O){O.forceMinPriority(P.transport.priority)}),c(null,P)}})}}function rk(l,s,c){var f=Yt(l,function(b,x,P,O){return b.connect(s,c(x,O))});return{abort:function(){Be(f,sk)},forceMinPriority:function(b){Be(f,function(x){x.forceMinPriority(b)})}}}function ok(l){return ai(l,function(s){return!!s.error})}function sk(l){!l.error&&!l.aborted&&(l.abort(),l.aborted=!0)}class ik{constructor(s,c,f){this.strategy=s,this.transports=c,this.ttl=f.ttl||18e5,this.usingTLS=f.useTLS,this.timeline=f.timeline}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.usingTLS,b=ak(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,P=[this.strategy];if(b&&b.timestamp+this.ttl>=xe.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||x>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),P.push(new Nn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=xe.now(),ne=P.pop().connect(s,function se(Le,ss){Le?(Sl(f),P.length>0?(B=xe.now(),ne=P.pop().connect(s,se)):c(Le)):(ck(f,ss.transport.name,xe.now()-B,x),c(null,ss))});return{abort:function(){ne.abort()},forceMinPriority:function(se){s=se,ne&&ne.forceMinPriority(se)}}}}function hi(l){return"pusherTransport"+(l?"TLS":"NonTLS")}function ak(l){var s=G.getLocalStorage();if(s)try{var c=s[hi(l)];if(c)return JSON.parse(c)}catch(f){Sl(l)}return null}function ck(l,s,c,f){var b=G.getLocalStorage();if(b)try{b[hi(l)]=nt({timestamp:xe.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function Sl(l){var s=G.getLocalStorage();if(s)try{delete s[hi(l)]}catch(c){}}class ns{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,x=new Re(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(P){s=P,b&&b.forceMinPriority(P)}}}}class Br{constructor(s,c,f){this.test=s,this.trueBranch=c,this.falseBranch=f}isSupported(){var s=this.test()?this.trueBranch:this.falseBranch;return s.isSupported()}connect(s,c){var f=this.test()?this.trueBranch:this.falseBranch;return f.connect(s,c)}}class lk{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,x){x&&f.abort(),c(b,x)});return f}}function Gr(l){return function(){return l.isSupported()}}var uk=function(l,s,c){var f={};function b(Dl,a_,c_,l_,u_){var Ml=c(l,Dl,a_,c_,l_,u_);return f[Dl]=Ml,Ml}var x=Object.assign({},s,{hostNonTLS:l.wsHost+":"+l.wsPort,hostTLS:l.wsHost+":"+l.wssPort,httpPath:l.wsPath}),P=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:l.httpHost+":"+l.httpPort,hostTLS:l.httpHost+":"+l.httpsPort,httpPath:l.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},ne=new xl({minPingDelay:1e4,maxPingDelay:l.activityTimeout}),se=new xl({lives:2,minPingDelay:1e4,maxPingDelay:l.activityTimeout}),Le=b("ws","ws",3,x,ne),ss=b("wss","ws",3,P,ne),n_=b("sockjs","sockjs",1,O),Ll=b("xhr_streaming","xhr_streaming",1,O,se),r_=b("xdr_streaming","xdr_streaming",1,O,se),Il=b("xhr_polling","xhr_polling",1,O),o_=b("xdr_polling","xdr_polling",1,O),zl=new Nn([Le],B),s_=new Nn([ss],B),i_=new Nn([n_],B),$l=new Nn([new Br(Gr(Ll),Ll,r_)],B),Ol=new Nn([new Br(Gr(Il),Il,o_)],B),Nl=new Nn([new Br(Gr($l),new pi([$l,new ns(Ol,{delay:4e3})]),Ol)],B),mi=new Br(Gr(Nl),Nl,i_),bi;return s.useTLS?bi=new pi([zl,new ns(mi,{delay:2e3})]):bi=new pi([zl,new ns(s_,{delay:2e3}),new ns(mi,{delay:5e3})]),new ik(new lk(new Br(Gr(Le),bi,mi)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const dk=uk;function pk(){var l=this;l.timeline.info(l.buildTimelineMessage({transport:l.name+(l.options.useTLS?"s":"")})),l.hooks.isInitialized()?l.changeState("initialized"):l.hooks.file?(l.changeState("initializing"),E.load(l.hooks.file,{useTLS:l.options.useTLS},function(s,c){l.hooks.isInitialized()?(l.changeState("initialized"),c(!0)):(s&&l.onError(s),l.onClose(),c(!1))})):l.onClose()}var hk={getRequest:function(l){var s=new window.XDomainRequest;return s.ontimeout=function(){l.emit("error",new M),l.close()},s.onerror=function(c){l.emit("error",c),l.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&l.onChunk(200,s.responseText),l.emit("finished",200),l.close()},s},abortRequest:function(l){l.ontimeout=l.onerror=l.onprogress=l.onload=null,l.abort()}};const fk=hk,gk=256*1024;class mk extends Ct{constructor(s,c,f){super(),this.hooks=s,this.method=c,this.url=f}start(s){this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=()=>{this.close()},G.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(s)}close(){this.unloader&&(G.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)}onChunk(s,c){for(;;){var f=this.advanceBuffer(c);if(f)this.emit("chunk",{status:s,data:f});else break}this.isBufferTooLong(c)&&this.emit("buffer_too_long")}advanceBuffer(s){var c=s.slice(this.position),f=c.indexOf(`
1365
+ `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>gk}}var fi;(function(l){l[l.CONNECTING=0]="CONNECTING",l[l.OPEN=1]="OPEN",l[l.CLOSED=3]="CLOSED"})(fi||(fi={}));const Dn=fi;var bk=1;class kk{constructor(s,c){this.hooks=s,this.session=El(1e3)+"/"+wk(8),this.location=_k(c),this.readyState=Dn.CONNECTING,this.openStream()}send(s){return this.sendRaw(JSON.stringify([s]))}ping(){this.hooks.sendHeartbeat(this)}close(s,c){this.onClose(s,c,!0)}sendRaw(s){if(this.readyState===Dn.OPEN)try{return G.createSocketRequest("POST",Tl(vk(this.location,this.session))).start(s),!0}catch(c){return!1}else return!1}reconnect(){this.closeStream(),this.openStream()}onClose(s,c,f){this.closeStream(),this.readyState=Dn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Dn.OPEN&&this.onActivity();var c,f=s.data.slice(0,1);switch(f){case"o":c=JSON.parse(s.data.slice(1)||"{}"),this.onOpen(c);break;case"a":c=JSON.parse(s.data.slice(1)||"[]");for(var b=0;b<c.length;b++)this.onEvent(c[b]);break;case"m":c=JSON.parse(s.data.slice(1)||"null"),this.onEvent(c);break;case"h":this.hooks.onHeartbeat(this);break;case"c":c=JSON.parse(s.data.slice(1)||"[]"),this.onClose(c[0],c[1],!0);break}}}onOpen(s){this.readyState===Dn.CONNECTING?(s&&s.hostname&&(this.location.base=yk(this.location.base,s.hostname)),this.readyState=Dn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Dn.OPEN&&this.onmessage&&this.onmessage({data:s})}onActivity(){this.onactivity&&this.onactivity()}onError(s){this.onerror&&this.onerror(s)}openStream(){this.stream=G.createSocketRequest("POST",Tl(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){xe.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function _k(l){var s=/([^\?]*)\/*(\??.*)/.exec(l);return{base:s[1],queryString:s[2]}}function vk(l,s){return l.base+"/"+s+"/xhr_send"}function Tl(l){var s=l.indexOf("?")===-1?"?":"&";return l+s+"t="+ +new Date+"&n="+bk++}function yk(l,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(l);return c[1]+s+c[3]}function El(l){return G.randomInt(l)}function wk(l){for(var s=[],c=0;c<l;c++)s.push(El(32).toString(32));return s.join("")}const xk=kk;var Sk={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr_streaming"+l.queryString},onHeartbeat:function(l){l.sendRaw("[]")},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Tk=Sk;var Ek={getReceiveURL:function(l,s){return l.base+"/"+s+"/xhr"+l.queryString},onHeartbeat:function(){},sendHeartbeat:function(l){l.sendRaw("[]")},onFinished:function(l,s){s===200?l.reconnect():l.onClose(1006,"Connection interrupted ("+s+")",!1)}};const Ak=Ek;var Ck={getRequest:function(l){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&l.onChunk(c.status,c.responseText),l.emit("finished",c.status),l.close();break}},c},abortRequest:function(l){l.onreadystatechange=null,l.abort()}};const Pk=Ck;var Rk={createStreamingSocket(l){return this.createSocket(Tk,l)},createPollingSocket(l){return this.createSocket(Ak,l)},createSocket(l,s){return new xk(l,s)},createXHR(l,s){return this.createRequest(Pk,l,s)},createRequest(l,s,c){return new mk(l,s,c)}};const Al=Rk;Al.createXDR=function(l,s){return this.createRequest(fk,l,s)};var Lk={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:y,getDefaultStrategy:dk,Transports:Pt,transportConnectionInitializer:pk,HTTPFactory:Al,TimelineTransport:gn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(l){window.Pusher=l;var s=()=>{this.onDocumentBody(l.ready)};window.JSON?s():E.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:pn,jsonp:Mr}},onDocumentBody(l){document.body?l():setTimeout(()=>{this.onDocumentBody(l)},0)},createJSONPRequest(l,s){return new lr(l,s)},createScriptRequest(l){return new Go(l)},getLocalStorage(){try{return window.localStorage}catch(l){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var l=this.getXHRAPI();return new l},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Ko},createWebSocket(l){var s=this.getWebSocketAPI();return new s(l)},createSocketRequest(l,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(l,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(l,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var l=this.getXHRAPI();return!!l&&new l().withCredentials!==void 0},isXDRSupported(l){var s=l?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(l){window.addEventListener!==void 0?window.addEventListener("unload",l,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",l)},removeUnloadListener(l){window.addEventListener!==void 0?window.removeEventListener("unload",l,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",l)},randomInt(l){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*l)}};const G=Lk;var gi;(function(l){l[l.ERROR=3]="ERROR",l[l.INFO=6]="INFO",l[l.DEBUG=7]="DEBUG"})(gi||(gi={}));const rs=gi;class Ik{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(oe({},c,{timestamp:xe.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(rs.ERROR,s)}info(s){this.log(rs.INFO,s)}debug(s){this.log(rs.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=oe({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,x)=>{b||this.sent++,c&&c(b,x)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class zk{constructor(s,c,f,b){this.name=s,this.priority=c,this.transport=f,this.options=b||{}}isSupported(){return this.transport.isSupported({useTLS:this.options.useTLS})}connect(s,c){if(this.isSupported()){if(this.priority<s)return Cl(new J,c)}else return Cl(new te,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,P=function(){b.unbind("initialized",P),b.connect()},O=function(){x=Kt.createHandshake(b,function(Le){f=!0,se(),c(null,Le)})},B=function(Le){se(),c(Le)},ne=function(){se();var Le;Le=nt(b),c(new ge(Le))},se=function(){b.unbind("initialized",P),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ne)};return b.bind("initialized",P),b.bind("open",O),b.bind("error",B),b.bind("closed",ne),b.initialize(),{abort:()=>{f||(se(),x?x.close():b.close())},forceMinPriority:Le=>{f||this.priority<Le&&(x?x.close():b.close())}}}}function Cl(l,s){return xe.defer(function(){s(l)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:$k}=G;var Ok=function(l,s,c,f,b,x){var P=$k[c];if(!P)throw new it(c);var O=(!l.enabledTransports||Fe(l.enabledTransports,s)!==-1)&&(!l.disabledTransports||Fe(l.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:l.ignoreNullOrigin},b),B=new zk(s,f,x?x.getAssistant(P):P,b)):B=Nk,B},Nk={isSupported:function(){return!1},connect:function(l,s){var c=xe.defer(function(){s(new te)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function Dk(l){if(l==null)throw"You must pass an options object";if(l.cluster==null)throw"Options object must provide a cluster";"disableStats"in l&&pe.warn("The disableStats option is deprecated in favor of enableStats")}const Mk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Uk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=Mk(s,l);G.getAuthorizers()[l.transport](G,f,l,T.UserAuthentication,c)}},jk=(l,s)=>{var c="socket_id="+encodeURIComponent(l.socketId);c+="&channel_name="+encodeURIComponent(l.channelName);for(var f in s.params)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(s.params[f]);if(s.paramsProvider!=null){let b=s.paramsProvider();for(var f in b)c+="&"+encodeURIComponent(f)+"="+encodeURIComponent(b[f])}return c},Zk=l=>{if(typeof G.getAuthorizers()[l.transport]=="undefined")throw`'${l.transport}' is not a recognized auth transport`;return(s,c)=>{const f=jk(s,l);G.getAuthorizers()[l.transport](G,f,l,T.ChannelAuthorization,c)}},qk=(l,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const P=l.channel(b.channelName);c(P,f).authorize(b.socketId,x)}};function Pl(l,s){let c={activityTimeout:l.activityTimeout||m.activityTimeout,cluster:l.cluster,httpPath:l.httpPath||m.httpPath,httpPort:l.httpPort||m.httpPort,httpsPort:l.httpsPort||m.httpsPort,pongTimeout:l.pongTimeout||m.pongTimeout,statsHost:l.statsHost||m.stats_host,unavailableTimeout:l.unavailableTimeout||m.unavailableTimeout,wsPath:l.wsPath||m.wsPath,wsPort:l.wsPort||m.wsPort,wssPort:l.wssPort||m.wssPort,enableStats:Wk(l),httpHost:Hk(l),useTLS:Gk(l),wsHost:Fk(l),userAuthenticator:Jk(l),channelAuthorizer:Vk(l,s)};return"disabledTransports"in l&&(c.disabledTransports=l.disabledTransports),"enabledTransports"in l&&(c.enabledTransports=l.enabledTransports),"ignoreNullOrigin"in l&&(c.ignoreNullOrigin=l.ignoreNullOrigin),"timelineParams"in l&&(c.timelineParams=l.timelineParams),"nacl"in l&&(c.nacl=l.nacl),c}function Hk(l){return l.httpHost?l.httpHost:l.cluster?`sockjs-${l.cluster}.pusher.com`:m.httpHost}function Fk(l){return l.wsHost?l.wsHost:Bk(l.cluster)}function Bk(l){return`ws-${l}.pusher.com`}function Gk(l){return G.getProtocol()==="https:"?!0:l.forceTLS!==!1}function Wk(l){return"enableStats"in l?l.enableStats:"disableStats"in l?!l.disableStats:!1}const Rl=l=>"customHandler"in l&&l.customHandler!=null;function Jk(l){const s=Object.assign(Object.assign({},m.userAuthentication),l.userAuthentication);return Rl(s)?s.customHandler:Uk(s)}function Yk(l,s){let c;if("channelAuthorization"in l)c=Object.assign(Object.assign({},m.channelAuthorization),l.channelAuthorization);else if(c={transport:l.authTransport||m.authTransport,endpoint:l.authEndpoint||m.authEndpoint},"auth"in l&&("params"in l.auth&&(c.params=l.auth.params),"headers"in l.auth&&(c.headers=l.auth.headers)),"authorizer"in l)return{customHandler:qk(s,c,l.authorizer)};return c}function Vk(l,s){const c=Yk(l,s);return Rl(c)?c.customHandler:Zk(c)}class Xk extends Ct{constructor(s){super(function(c,f){pe.debug(`No callbacks on watchlist events for ${c}`)}),this.pusher=s,this.bindWatchlistInternalEvent()}handleEvent(s){s.data.events.forEach(c=>{this.emit(c.name,c)})}bindWatchlistInternalEvent(){this.pusher.connection.bind("message",s=>{var c=s.event;c==="pusher_internal:watchlist_events"&&this.handleEvent(s)})}}function Kk(){let l,s;return{promise:new Promise((f,b)=>{l=f,s=b}),resolve:l,reject:s}}const Qk=Kk;class e_ extends Ct{constructor(s){super(function(c,f){pe.debug("No callbacks on user for "+c)}),this.signin_requested=!1,this.user_data=null,this.serverToUserChannel=null,this.signinDonePromise=null,this._signinDoneResolve=null,this._onAuthorize=(c,f)=>{if(c){pe.warn(`Error during signin: ${c}`),this._cleanup();return}this.pusher.send_event("pusher:signin",{auth:f.auth,user_data:f.user_data})},this.pusher=s,this.pusher.connection.bind("state_change",({previous:c,current:f})=>{c!=="connected"&&f==="connected"&&this._signin(),c==="connected"&&f!=="connected"&&(this._cleanup(),this._newSigninPromiseIfNeeded())}),this.watchlist=new Xk(s),this.pusher.connection.bind("message",c=>{var f=c.event;f==="pusher:signin_success"&&this._onSigninSuccess(c.data),this.serverToUserChannel&&this.serverToUserChannel.name===c.channel&&this.serverToUserChannel.handleEvent(c)})}signin(){this.signin_requested||(this.signin_requested=!0,this._signin())}_signin(){this.signin_requested&&(this._newSigninPromiseIfNeeded(),this.pusher.connection.state==="connected"&&this.pusher.config.userAuthenticator({socketId:this.pusher.connection.socket_id},this._onAuthorize))}_onSigninSuccess(s){try{this.user_data=JSON.parse(s.user_data)}catch(c){pe.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){pe.error(`user_data doesn't contain an id. user_data: ${this.user_data}`),this._cleanup();return}this._signinDoneResolve(),this._subscribeChannels()}_subscribeChannels(){const s=c=>{c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.pusher.connection.state==="connected"&&c.subscribe()};this.serverToUserChannel=new I(`#server-to-user-${this.user_data.id}`,this.pusher),this.serverToUserChannel.bind_global((c,f)=>{c.indexOf("pusher_internal:")===0||c.indexOf("pusher:")===0||this.emit(c,f)}),s(this.serverToUserChannel)}_cleanup(){this.user_data=null,this.serverToUserChannel&&(this.serverToUserChannel.unbind_all(),this.serverToUserChannel.disconnect(),this.serverToUserChannel=null),this.signin_requested&&this._signinDoneResolve()}_newSigninPromiseIfNeeded(){if(!this.signin_requested||this.signinDonePromise&&!this.signinDonePromise.done)return;const{promise:s,resolve:c}=Qk();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class qe{static ready(){qe.isReady=!0;for(var s=0,c=qe.instances.length;s<c;s++)qe.instances[s].connect()}static getClientFeatures(){return Jt(In({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){t_(s),Dk(c),this.key=s,this.options=c,this.config=Pl(this.options,this),this.channels=Kt.createChannels(),this.global_emitter=new Ct,this.sessionID=G.randomInt(1e9),this.timeline=new Ik(this.key,this.sessionID,{cluster:this.config.cluster,features:qe.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:rs.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Kt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,Ok);this.connection=Kt.createConnectionManager(this.key,{getStrategy:f,timeline:this.timeline,activityTimeout:this.config.activityTimeout,pongTimeout:this.config.pongTimeout,unavailableTimeout:this.config.unavailableTimeout,useTLS:!!this.config.useTLS}),this.connection.bind("connected",()=>{this.subscribeAll(),this.timelineSender&&this.timelineSender.send(this.connection.isUsingTLS())}),this.connection.bind("message",b=>{var x=b.event,P=x.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}P||this.global_emitter.emit(b.event,b.data)}),this.connection.bind("connecting",()=>{this.channels.disconnect()}),this.connection.bind("disconnected",()=>{this.channels.disconnect()}),this.connection.bind("error",b=>{pe.warn(b)}),qe.instances.push(this),this.timeline.info({instances:qe.instances.length}),this.user=new e_(this),qe.isReady&&this.connect()}switchCluster(s){const{appKey:c,cluster:f}=s;this.key=c,this.options=Object.assign(Object.assign({},this.options),{cluster:f}),this.config=Pl(this.options,this),this.connection.switchCluster(this.key)}channel(s){return this.channels.find(s)}allChannels(){return this.channels.all()}connect(){if(this.connection.connect(),this.timelineSender&&!this.timelineSenderTimer){var s=this.connection.isUsingTLS(),c=this.timelineSender;this.timelineSenderTimer=new ct(6e4,function(){c.send(s)})}}disconnect(){this.connection.disconnect(),this.timelineSenderTimer&&(this.timelineSenderTimer.ensureAborted(),this.timelineSenderTimer=null)}bind(s,c,f){return this.global_emitter.bind(s,c,f),this}unbind(s,c,f){return this.global_emitter.unbind(s,c,f),this}bind_global(s){return this.global_emitter.bind_global(s),this}unbind_global(s){return this.global_emitter.unbind_global(s),this}unbind_all(s){return this.global_emitter.unbind_all(),this}subscribeAll(){var s;for(s in this.channels.channels)this.channels.channels.hasOwnProperty(s)&&this.subscribe(s)}subscribe(s){var c=this.channels.add(s,this);return c.subscriptionPending&&c.subscriptionCancelled?c.reinstateSubscription():!c.subscriptionPending&&this.connection.state==="connected"&&c.subscribe(),c}unsubscribe(s){var c=this.channels.find(s);c&&c.subscriptionPending?c.cancelSubscription():(c=this.channels.remove(s),c&&c.subscribed&&c.unsubscribe())}send_event(s,c,f){return this.connection.send_event(s,c,f)}shouldUseTLS(){return this.config.useTLS}signin(){this.user.signin()}}qe.instances=[],qe.isReady=!1,qe.logToConsole=!1,qe.Runtime=G,qe.ScriptReceivers=G.ScriptReceivers,qe.DependenciesReceivers=G.DependenciesReceivers,qe.auth_callbacks=G.auth_callbacks;const os=qe;function t_(l){if(l==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(qe)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var u=r[a]={exports:{}};return n[a].call(u.exports,u,u.exports,o),u.exports}o.d=(a,d)=>{for(var u in d)o.o(d,u)&&!o.o(a,u)&&Object.defineProperty(a,u,{enumerable:!0,get:d[u]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(Ss)),Ss.exports}var fg=hg();const gg=pg(fg);let _t=null,Jn=null;function mg(e){return L(this,null,function*(){return Jn||(Jn=L(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield po(`${t}/api/settings`,{headers:{Authorization:`Bearer ${e.token}`}});if(!n.ok)throw new Error(`Failed to fetch settings: HTTP ${n.status}`);const r=yield n.json();_t=new gg(r.pusher.key,{cluster:r.pusher.cluster||"local",forceTLS:!0,wsHost:r.pusher.wsHost||void 0,wsPort:r.pusher.wssPort,wssPort:r.pusher.wssPort,enabledTransports:r.pusher.wsHost?["ws"]:void 0,channelAuthorization:{customHandler:({socketId:o,channelName:i},a)=>{po(`${t}/api/pusher/auth`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:JSON.stringify({socket_id:o,channel_name:i})}).then(d=>d.json()).then(d=>a(null,d)).catch(d=>a(d instanceof Error?d:new Error(String(d)),null))}}})}),Jn.catch(()=>{Jn=null}),Jn)})}function bg(e){if(!e||!_t)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return _t.connection.bind("state_change",n),()=>_t==null?void 0:_t.connection.unbind("state_change",n)}function kg(e,t,n){return L(this,null,function*(){if(yield mg(e),!_t)return()=>{};const r=_t.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(eo.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(eo.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(eo.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(eo.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=bg(n.onReconnect);return()=>{r.unbind_all(),_t==null||_t.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ts="ap-sdk-active-automation";function _g(){try{const e=sessionStorage.getItem(Ts);if(!e)return null;const t=JSON.parse(e);return t!=null&&t.taskId&&(t!=null&&t.backendUrl)&&(t!=null&&t.title)?t:null}catch(e){return null}}function Wa(e){try{sessionStorage.setItem(Ts,JSON.stringify(e))}catch(t){}}function Ja(){try{sessionStorage.removeItem(Ts)}catch(e){}}function vg(e){return L(this,null,function*(){var i;try{(i=e.focus)==null||i.call(e)}catch(a){}e.scrollIntoView({block:"center",inline:"center",behavior:"instant"});let t=e.getBoundingClientRect();t.width===0&&t.height===0&&(yield yg(),t=e.getBoundingClientRect());const n=t.left+t.width/2,r=t.top+t.height/2,o={bubbles:!0,cancelable:!0,clientX:n,clientY:r};typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerdown",o)),e.dispatchEvent(new MouseEvent("mousedown",o)),typeof PointerEvent=="function"&&e.dispatchEvent(new PointerEvent("pointerup",o)),e.dispatchEvent(new MouseEvent("mouseup",o)),e.click()})}function yg(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Es="shared",Ya="ap-sdk-panel-size:",Va=280,Xa=200;function wg(e){try{const t=sessionStorage.getItem(Ya+e);if(!t)return null;const n=JSON.parse(t);return typeof(n==null?void 0:n.width)=="number"&&typeof(n==null?void 0:n.height)=="number"?n:null}catch(t){return null}}function xg(e,t){try{sessionStorage.setItem(Ya+e,JSON.stringify(t))}catch(n){}}function fo(e,t,n){return Math.min(Math.max(e,t),n)}function Ka(){return window.innerWidth-32}function Qa(){return window.innerHeight-64}function As(e,t){const n=wg(t);n&&(e.style.width=`${fo(n.width,Va,Ka())}px`,e.style.height=`${fo(n.height,Xa,Qa())}px`);const r=document.createElement("div");r.className="ap-sdk-resize-handle",r.setAttribute("data-ap-sdk","1"),e.appendChild(r);let o=!1,i=0,a=0,d=0,u=0,p=0,h=0;const g=k=>{o&&(p=fo(d+(k.clientX-i),Va,Ka()),h=fo(u+(k.clientY-a),Xa,Qa()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),xg(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const y=e.getBoundingClientRect();d=y.width,u=y.height,p=d,h=u,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function Cs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var _n=Cs();function ec(e){_n=e}var vn={exec:()=>null};function Yn(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),o=t[r];return o||(o=e(r),t[r]=o),o}}function X(e,t=""){let n=typeof e=="string"?e:e.source,r={replace:(o,i)=>{let a=typeof i=="string"?i:i.source;return a=a.replace(He.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Sg=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),He={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,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ 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,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Yn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Yn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Yn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Yn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Yn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Yn(e=>new RegExp(`^ {0,${e}}>`))},Tg=/^(?:[ \t]*(?:\n|$))+/,Eg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ag=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Cg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ps=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,tc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nc=X(tc).replace(/bull/g,Ps).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}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Pg=X(tc).replace(/bull/g,Ps).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}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Rs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Rg=/^[^\n]+/,Ls=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Lg=X(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ls).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ig=X(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ps).getRegex(),go="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",Is=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,zg=X("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\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",Is).replace("tag",go).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),rc=e=>X(Rs).replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",go).getRegex(),$g=rc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Og=rc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Ng=X(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Og).getRegex(),zs={blockquote:Ng,code:Eg,def:Lg,fences:Ag,heading:Cg,hr:vr,html:zg,lheading:nc,list:Ig,newline:Tg,paragraph:$g,table:vn,text:Rg},oc=X("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",go).getRegex(),Dg=j(v({},zs),{lheading:Pg,table:oc,paragraph:X(Rs).replace("hr",vr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",oc).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",go).getRegex()}),Mg=j(v({},zs),{html:X(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Is).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:vn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:X(Rs).replace("hr",vr).replace("heading",` *#{1,6} *[^
1366
+ ]`).replace("lheading",nc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),Ug=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,jg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,sc=/^( {2,}|\\)\n(?!\s*$)/,Zg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,qt=/[\p{P}\p{S}]/u,Vn=/[\s\p{P}\p{S}]/u,yr=/[^\s\p{P}\p{S}]/u,qg=X(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Vn).getRegex(),Hg=/[\p{Pi}\p{Ps}"']/u,ic=/(?!~)[\p{P}\p{S}]/u,Fg=/(?!~)[\s\p{P}\p{S}]/u,Bg=/(?:[^\s\p{P}\p{S}]|~)/u,Gg=X(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",Sg?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),ac=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Wg=X(ac,"u").replace(/punct/g,qt).getRegex(),Jg=X(ac,"u").replace(/punct/g,ic).getRegex(),Yg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Vg=X(Yg,"u").replace(/openQuote/g,Hg).replace(/punct/g,qt).getRegex(),cc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Xg=X(cc,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Vn).replace(/punct/g,qt).getRegex(),Kg=X(cc,"gu").replace(/notPunctSpace/g,Bg).replace(/punctSpace/g,Fg).replace(/punct/g,ic).getRegex(),Qg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",em=X(Qg,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Vn).replace(/punct/g,qt).getRegex(),tm=X("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Vn).replace(/punct/g,qt).getRegex(),nm="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",rm=X(nm,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Vn).replace(/punct/g,qt).getRegex(),om=X(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,qt).getRegex(),sm="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",im=X(sm,"gu").replace(/notPunctSpace/g,yr).replace(/punctSpace/g,Vn).replace(/punct/g,qt).getRegex(),am=X(/\\(punct)/,"gu").replace(/punct/g,qt).getRegex(),cm=X(/^<(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(),lm=X(Is).replace("(?:-->|$)","-->").getRegex(),um=X("^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",lm).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),mo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,dm=X(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",mo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),lc=X(/^!?\[(label)\]\[(ref)\]/).replace("label",mo).replace("ref",Ls).getRegex(),uc=X(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ls).getRegex(),pm=X("reflink|nolink(?!\\()","g").replace("reflink",lc).replace("nolink",uc).getRegex(),dc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,$s={_backpedal:vn,anyPunctuation:am,autolink:cm,blockSkip:Gg,br:sc,code:jg,del:vn,delLDelim:vn,delRDelim:vn,emStrongLDelim:Wg,emStrongRDelimAst:Xg,emStrongRDelimUnd:tm,escape:Ug,link:dm,nolink:uc,punctuation:qg,reflink:lc,reflinkSearch:pm,tag:um,text:Zg,url:vn},hm=j(v({},$s),{emStrongLDelim:Vg,emStrongRDelimAst:em,emStrongRDelimUnd:rm,link:X(/^!?\[(label)\]\((.*?)\)/).replace("label",mo).getRegex(),reflink:X(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",mo).getRegex()}),Os=j(v({},$s),{emStrongRDelimAst:Kg,emStrongLDelim:Jg,delLDelim:om,delRDelim:im,url:X(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",dc).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:X(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",dc).getRegex()}),fm=j(v({},Os),{br:X(sc).replace("{2,}","*").getRegex(),text:X(Os.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),bo={normal:zs,gfm:Dg,pedantic:Mg},wr={normal:$s,gfm:Os,breaks:fm,pedantic:hm},gm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},pc=e=>gm[e];function zt(e,t){if(t){if(He.escapeTest.test(e))return e.replace(He.escapeReplace,pc)}else if(He.escapeTestNoEncode.test(e))return e.replace(He.escapeReplaceNoEncode,pc);return e}function hc(e){try{e=encodeURI(e).replace(He.percentDecode,"%")}catch(t){return null}return e}function fc(e,t){var i;let n=e.replace(He.findPipe,(a,d,u)=>{let p=!1,h=d;for(;--h>=0&&u[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(He.splitPipe),o=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;o<r.length;o++)r[o]=r[o].trim().replace(He.slashPipe,"|");return r}function sn(e,t,n){let r=e.length;if(r===0)return"";let o=0;for(;o<r&&e.charAt(r-o-1)===t;)o++;return e.slice(0,r-o)}function gc(e){let t=e.split(`
1367
+ `),n=t.length-1;for(;n>=0&&He.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1368
+ `)}function mm(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]==="\\")r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function bm(e,t=0){let n=t,r="";for(let o of e)if(o===" "){let i=4-n%4;r+=" ".repeat(i),n+=i}else r+=o,n++;return r}function mc(e,t,n,r,o){let i=t.href,a=t.title||null,d=e[1].replace(o.other.outputLinkReplace,"$1");r.state.inLink=!0;let u={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,u}function km(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1369
1369
  `).map(i=>{let a=i.match(n.other.beginningSpace);if(a===null)return i;let[d]=a;return d.length>=o.length?i.slice(o.length):i}).join(`
1370
- `)}var _o=class{constructor(e){de(this,"options");de(this,"rules");de(this,"lexer");this.options=e||_n}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 n=this.options.pedantic?t[0]:hc(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=pm(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=on(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:on(t[0],`
1371
- `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:on(t[0],`
1372
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=on(t[0],`
1370
+ `)}var ko=class{constructor(e){ue(this,"options");ue(this,"rules");ue(this,"lexer");this.options=e||_n}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 n=this.options.pedantic?t[0]:gc(t[0]),r=n.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let n=t[0],r=km(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){let r=sn(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:sn(t[0],`
1371
+ `),depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:sn(t[0],`
1372
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=sn(t[0],`
1373
1373
  `).split(`
1374
- `),r="",o="",i=[];for(;n.length>0;){let a=!1,d=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))d.push(n[u]),a=!0;else if(!a)d.push(n[u]);else break;n=n.slice(u);let h=d.join(`
1375
- `),p=h.replace(this.rules.other.blockquoteSetextReplace,`
1374
+ `),r="",o="",i=[];for(;n.length>0;){let a=!1,d=[],u;for(u=0;u<n.length;u++)if(this.rules.other.blockquoteStart.test(n[u]))d.push(n[u]),a=!0;else if(!a)d.push(n[u]);else break;n=n.slice(u);let p=d.join(`
1375
+ `),h=p.replace(this.rules.other.blockquoteSetextReplace,`
1376
1376
  $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
1377
- ${h}`:h,o=o?`${o}
1378
- ${p}`:p;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(p,i,!0),this.lexer.state.top=m,n.length===0)break;let g=i.at(-1);if((g==null?void 0:g.type)==="code")break;if((g==null?void 0:g.type)==="blockquote"){let k=g,y=n.join(`
1379
- `),A=k.raw+`
1380
- `+y.replace(this.rules.other.blockquoteSetextReplace2,""),Z=this.blockquote(A);i[i.length-1]=Z,r=`${r}
1381
- ${y}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((g==null?void 0:g.type)==="list"){let k=g,y=k.raw+`
1377
+ ${p}`:p,o=o?`${o}
1378
+ ${h}`:h;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,i,!0),this.lexer.state.top=g,n.length===0)break;let m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){let k=m,y=n.join(`
1379
+ `),E=k.raw+`
1380
+ `+y.replace(this.rules.other.blockquoteSetextReplace2,""),Z=this.blockquote(E);i[i.length-1]=Z,r=`${r}
1381
+ ${y}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((m==null?void 0:m.type)==="list"){let k=m,y=k.raw+`
1382
1382
  `+n.join(`
1383
- `),A=this.list(y);i[i.length-1]=A,r=r.substring(0,r.length-g.raw.length)+A.raw,o=o.substring(0,o.length-k.raw.length)+A.raw,n=y.substring(i.at(-1).raw.length).split(`
1384
- `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={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 i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let u=!1,h="",p="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;h=t[0],e=e.substring(h.length);let m=dm(t[2].split(`
1385
- `,1)[0],t[1].length),g=e.split(`
1386
- `,1)[0],k=!m.trim(),y=0;if(this.options.pedantic?(y=2,p=m.trimStart()):k?y=t[1].length+1:(y=m.search(this.rules.other.nonSpaceChar),y=y>4?1:y,p=m.slice(y),y+=t[1].length),k&&this.rules.other.blankLine.test(g)&&(h+=g+`
1387
- `,e=e.substring(g.length+1),u=!0),!u){let A=this.rules.other.nextBulletRegex(y),Z=this.rules.other.hrRegex(y),J=this.rules.other.fencesBeginRegex(y),O=this.rules.other.headingBeginRegex(y),T=this.rules.other.htmlBeginRegex(y),S=this.rules.other.blockquoteBeginRegex(y);for(;e;){let C=e.split(`
1388
- `,1)[0],M;if(g=C,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),M=g):M=g.replace(this.rules.other.tabCharGlobal," "),J.test(g)||O.test(g)||T.test(g)||S.test(g)||A.test(g)||Z.test(g))break;if(M.search(this.rules.other.nonSpaceChar)>=y||!g.trim())p+=`
1389
- `+M.slice(y);else{if(k||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||J.test(m)||O.test(m)||Z.test(m))break;p+=`
1390
- `+g}k=!g.trim(),h+=C+`
1391
- `,e=e.substring(C.length+1),m=M.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(a=!0)),o.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(p),loose:!1,text:p,tokens:[]}),o.raw+=h}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]);let h=u.tokens[0];if(u.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let m=this.lexer.inlineQueue.length-1;m>=0;m--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[m].src)){this.lexer.inlineQueue[m].src=this.lexer.inlineQueue[m].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(u.raw);if(p){let m={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};u.checked=m.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=m.raw+u.tokens[0].raw,u.tokens[0].text=m.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(m)):u.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):u.tokens.unshift(m)}}else u.task&&(u.task=!1);if(!o.loose){let p=u.tokens.filter(g=>g.type==="space"),m=p.length>0&&p.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=m}}if(o.loose)for(let u of o.items){u.loose=!0;for(let h of u.tokens)h.type==="text"&&(h.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=hc(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:on(t[0],`
1392
- `),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=pc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1393
- `):[],i={type:"table",raw:on(t[0],`
1394
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let d of r)this.rules.other.tableAlignRight.test(d)?i.align.push("right"):this.rules.other.tableAlignCenter.test(d)?i.align.push("center"):this.rules.other.tableAlignLeft.test(d)?i.align.push("left"):i.align.push(null);for(let d=0;d<n.length;d++)i.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:i.align[d]});for(let d of o)i.rows.push(pc(d,i.header.length).map((u,h)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:i.align[h]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:on(t[0],`
1383
+ `),E=this.list(y);i[i.length-1]=E,r=r.substring(0,r.length-m.raw.length)+E.raw,o=o.substring(0,o.length-k.raw.length)+E.raw,n=y.substring(i.at(-1).raw.length).split(`
1384
+ `);continue}}return{type:"blockquote",raw:r,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,o={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 i=this.rules.other.listItemRegex(n),a=!1;for(;e;){let u=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let g=bm(t[2].split(`
1385
+ `,1)[0],t[1].length),m=e.split(`
1386
+ `,1)[0],k=!g.trim(),y=0;if(this.options.pedantic?(y=2,h=g.trimStart()):k?y=t[1].length+1:(y=g.search(this.rules.other.nonSpaceChar),y=y>4?1:y,h=g.slice(y),y+=t[1].length),k&&this.rules.other.blankLine.test(m)&&(p+=m+`
1387
+ `,e=e.substring(m.length+1),u=!0),!u){let E=this.rules.other.nextBulletRegex(y),Z=this.rules.other.hrRegex(y),ee=this.rules.other.fencesBeginRegex(y),N=this.rules.other.headingBeginRegex(y),T=this.rules.other.htmlBeginRegex(y),S=this.rules.other.blockquoteBeginRegex(y);for(;e;){let C=e.split(`
1388
+ `,1)[0],M;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),M=m):M=m.replace(this.rules.other.tabCharGlobal," "),ee.test(m)||N.test(m)||T.test(m)||S.test(m)||E.test(m)||Z.test(m))break;if(M.search(this.rules.other.nonSpaceChar)>=y||!m.trim())h+=`
1389
+ `+M.slice(y);else{if(k||g.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||ee.test(g)||N.test(g)||Z.test(g))break;h+=`
1390
+ `+m}k=!m.trim(),p+=C+`
1391
+ `,e=e.substring(C.length+1),g=M.slice(y)}}o.loose||(a?o.loose=!0:this.rules.other.doubleBlankLine.test(p)&&(a=!0)),o.items.push({type:"list_item",raw:p,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]}),o.raw+=p}let d=o.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let u of o.items){this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]);let p=u.tokens[0];if(u.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){u.text=u.text.replace(this.rules.other.listReplaceTask,""),p.raw=p.raw.replace(this.rules.other.listReplaceTask,""),p.text=p.text.replace(this.rules.other.listReplaceTask,"");for(let g=this.lexer.inlineQueue.length-1;g>=0;g--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[g].src)){this.lexer.inlineQueue[g].src=this.lexer.inlineQueue[g].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(u.raw);if(h){let g={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};u.checked=g.checked,o.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=g.raw+u.tokens[0].raw,u.tokens[0].text=g.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(g)):u.tokens.unshift({type:"paragraph",raw:g.raw,text:g.raw,tokens:[g]}):u.tokens.unshift(g)}}else u.task&&(u.task=!1);if(!o.loose){let h=u.tokens.filter(m=>m.type==="space"),g=h.length>0&&h.some(m=>this.rules.other.anyLine.test(m.raw));o.loose=g}}if(o.loose)for(let u of o.items){u.loose=!0;for(let p of u.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=gc(t[0]);return{type:"html",block:!0,raw:n,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:n}}}def(e){let t=this.rules.block.def.exec(e);if(t){let n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:sn(t[0],`
1392
+ `),href:r,title:o}}}table(e){var a;let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=fc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
1393
+ `):[],i={type:"table",raw:sn(t[0],`
1394
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let d of r)this.rules.other.tableAlignRight.test(d)?i.align.push("right"):this.rules.other.tableAlignCenter.test(d)?i.align.push("center"):this.rules.other.tableAlignLeft.test(d)?i.align.push("left"):i.align.push(null);for(let d=0;d<n.length;d++)i.header.push({text:n[d],tokens:this.lexer.inline(n[d]),header:!0,align:i.align[d]});for(let d of o)i.rows.push(fc(d,i.header.length).map((u,p)=>({text:u,tokens:this.lexer.inline(u),header:!1,align:i.align[p]})));return i}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let n=t[1].trim();return{type:"heading",raw:sn(t[0],`
1395
1395
  `),depth:t[2].charAt(0)==="="?1:2,text:n,tokens:this.lexer.inline(n)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let n=t[1].charAt(t[1].length-1)===`
1396
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}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 n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=on(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=um(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),fc(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.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 r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return fc(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=0,h=r[0][0],p=n===h,m=h==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+o);(r=m.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){u+=a;continue}if(p)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+u);let g=[...r[0]][0].length,k=e.slice(0,o+r.index+g+a);if(Math.min(o,a)%2){let A=k.slice(1,-1);return{type:"em",raw:k,text:A,tokens:this.lexer.inlineTokens(A)}}let y=k.slice(2,-2);return{type:"strong",raw:k,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=this.rules.inline.delRDelim;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(r=u.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){d+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d);let h=[...r[0]][0].length,p=e.slice(0,o+r.index+h+a),m=p.slice(o,-o);return{type:"del",raw:p,text:m,tokens:this.lexer.inlineTokens(m)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},yt=class _i{constructor(t){de(this,"tokens");de(this,"options");de(this,"state");de(this,"inlineQueue");de(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||_n,this.options.tokenizer=this.options.tokenizer||new _o,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 n={other:qe,block:ko.normal,inline:wr.normal};this.options.pedantic?(n.block=ko.pedantic,n.inline=wr.pedantic):this.options.gfm&&(n.block=ko.gfm,this.options.breaks?n.inline=wr.breaks:n.inline=wr.gfm),this.tokenizer.rules=n}static get rules(){return{block:ko,inline:wr}}static lex(t,n){return new _i(n).lex(t)}static lexInline(t,n){return new _i(n).inlineTokens(t)}lex(t){t=t.replace(qe.carriageReturn,`
1397
- `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,d;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(qe.tabCharGlobal," ").replace(qe.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let u;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(p=>(u=p.call({lexer:this},t,n))?(t=t.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.space(t)){t=t.substring(u.raw.length);let p=n.at(-1);u.raw.length===1&&p!==void 0?p.raw+=`
1398
- `:n.push(u);continue}if(u=this.tokenizer.code(t)){t=t.substring(u.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
1396
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}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 n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let i=sn(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=mm(t[2],"()");if(i===-2)return;if(i>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],o="";if(this.options.pedantic){let i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),mc(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.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 r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[r.toLowerCase()];if(!o){let i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return mc(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=0,p=r[0][0],h=n===p,g=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(r=g.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){u+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+u);let m=[...r[0]][0].length,k=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let E=k.slice(1,-1);return{type:"em",raw:k,text:E,tokens:this.lexer.inlineTokens(E)}}let y=k.slice(2,-2);return{type:"strong",raw:k,text:y,tokens:this.lexer.inlineTokens(y)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,n=""){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let o=[...r[0]].length-1,i,a,d=o,u=this.rules.inline.delRDelim;for(u.lastIndex=0,t=t.slice(-1*e.length+o);(r=u.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==o))continue;if(r[3]||r[4]){d+=a;continue}if(d-=a,d>0)continue;a=Math.min(a,a+d);let p=[...r[0]][0].length,h=e.slice(0,o+r.index+p+a),g=h.slice(o,-o);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},vt=class _i{constructor(t){ue(this,"tokens");ue(this,"options");ue(this,"state");ue(this,"inlineQueue");ue(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||_n,this.options.tokenizer=this.options.tokenizer||new ko,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 n={other:He,block:bo.normal,inline:wr.normal};this.options.pedantic?(n.block=bo.pedantic,n.inline=wr.pedantic):this.options.gfm&&(n.block=bo.gfm,this.options.breaks?n.inline=wr.breaks:n.inline=wr.gfm),this.tokenizer.rules=n}static get rules(){return{block:bo,inline:wr}}static lex(t,n){return new _i(n).lex(t)}static lexInline(t,n){return new _i(n).inlineTokens(t)}lex(t){t=t.replace(He.carriageReturn,`
1397
+ `),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){let r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],r=!1){var i,a,d;this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(He.tabCharGlobal," ").replace(He.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let u;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(u=h.call({lexer:this},t,n))?(t=t.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.space(t)){t=t.substring(u.raw.length);let h=n.at(-1);u.raw.length===1&&h!==void 0?h.raw+=`
1398
+ `:n.push(u);continue}if(u=this.tokenizer.code(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1399
1399
  `)?"":`
1400
- `)+u.raw,p.text+=`
1401
- `+u.text,this.inlineQueue.at(-1).src=p.text):n.push(u);continue}if(u=this.tokenizer.fences(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.heading(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.hr(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.blockquote(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.list(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.html(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.def(t)){t=t.substring(u.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
1400
+ `)+u.raw,h.text+=`
1401
+ `+u.text,this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(u=this.tokenizer.fences(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.heading(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.hr(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.blockquote(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.list(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.html(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.def(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1402
1402
  `)?"":`
1403
- `)+u.raw,p.text+=`
1404
- `+u.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[u.tag]||(this.tokens.links[u.tag]={href:u.href,title:u.title},n.push(u));continue}if(u=this.tokenizer.table(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.lheading(t)){t=t.substring(u.raw.length),n.push(u);continue}let h=t;if((d=this.options.extensions)!=null&&d.startBlock){let p=1/0,m=t.slice(1),g;this.options.extensions.startBlock.forEach(k=>{g=k.call({lexer:this},m),typeof g=="number"&&g>=0&&(p=Math.min(p,g))}),p<1/0&&p>=0&&(h=t.substring(0,p+1))}if(this.state.top&&(u=this.tokenizer.paragraph(h))){let p=n.at(-1);r&&(p==null?void 0:p.type)==="paragraph"?(p.raw+=(p.raw.endsWith(`
1403
+ `)+u.raw,h.text+=`
1404
+ `+u.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[u.tag]||(this.tokens.links[u.tag]={href:u.href,title:u.title},n.push(u));continue}if(u=this.tokenizer.table(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.lheading(t)){t=t.substring(u.raw.length),n.push(u);continue}let p=t;if((d=this.options.extensions)!=null&&d.startBlock){let h=1/0,g=t.slice(1),m;this.options.extensions.startBlock.forEach(k=>{m=k.call({lexer:this},g),typeof m=="number"&&m>=0&&(h=Math.min(h,m))}),h<1/0&&h>=0&&(p=t.substring(0,h+1))}if(this.state.top&&(u=this.tokenizer.paragraph(p))){let h=n.at(-1);r&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
1405
1405
  `)?"":`
1406
- `)+u.raw,p.text+=`
1407
- `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(u),r=h.length!==t.length,t=t.substring(u.raw.length);continue}if(u=this.tokenizer.text(t)){t=t.substring(u.raw.length);let p=n.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
1406
+ `)+u.raw,h.text+=`
1407
+ `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u),r=p.length!==t.length,t=t.substring(u.raw.length);continue}if(u=this.tokenizer.text(t)){t=t.substring(u.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1408
1408
  `)?"":`
1409
- `)+u.raw,p.text+=`
1410
- `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(u);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,u,h,p,m,g;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let k=Object.keys(this.tokens.links);k.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,y=>k.includes(y.slice(y.lastIndexOf("[")+1,-1))?"["+"a".repeat(y.length-2)+"]":y))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,y,A)=>{let Z=A?A.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(h=(u=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:u.call({lexer:this},r))!=null?h:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((m=(p=this.options.extensions)==null?void 0:p.inline)!=null&&m.some(A=>(k=A.call({lexer:this},t,n))?(t=t.substring(k.raw.length),n.push(k),!0):!1))continue;if(k=this.tokenizer.escape(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.tag(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.link(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(k.raw.length);let A=n.at(-1);k.type==="text"&&(A==null?void 0:A.type)==="text"?(A.raw+=k.raw,A.text+=k.text):n.push(k);continue}if(k=this.tokenizer.emStrong(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.codespan(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.br(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.del(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.autolink(t)){t=t.substring(k.raw.length),n.push(k);continue}if(!this.state.inLink&&(k=this.tokenizer.url(t))){t=t.substring(k.raw.length),n.push(k);continue}let y=t;if((g=this.options.extensions)!=null&&g.startInline){let A=1/0,Z=t.slice(1),J;this.options.extensions.startInline.forEach(O=>{J=O.call({lexer:this},Z),typeof J=="number"&&J>=0&&(A=Math.min(A,J))}),A<1/0&&A>=0&&(y=t.substring(0,A+1))}if(k=this.tokenizer.inlineText(y)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let A=n.at(-1);(A==null?void 0:A.type)==="text"?(A.raw+=k.raw,A.text+=k.text):n.push(k);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},vo=class{constructor(e){de(this,"options");de(this,"parser");this.options=e||_n}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(qe.notSpaceStart))==null?void 0:i[0],o=e.replace(qe.endingNewline,"")+`
1411
- `;return r?'<pre><code class="language-'+$t(r)+'">'+(n?o:$t(o,!0))+`</code></pre>
1412
- `:"<pre><code>"+(n?o:$t(o,!0))+`</code></pre>
1409
+ `)+u.raw,h.text+=`
1410
+ `+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(u);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var d,u,p,h,g,m;this.tokenizer.lexer=this;let r=t;if(this.tokens.links){let k=Object.keys(this.tokens.links);k.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,y=>k.includes(y.slice(y.lastIndexOf("[")+1,-1))?"["+"a".repeat(y.length-2)+"]":y))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,y,E)=>{let Z=E?E.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(p=(u=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:u.call({lexer:this},r))!=null?p:r;let o=!1,i="",a=1/0;for(;t;){if(t.length<a)a=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}o||(i=""),o=!1;let k;if((g=(h=this.options.extensions)==null?void 0:h.inline)!=null&&g.some(E=>(k=E.call({lexer:this},t,n))?(t=t.substring(k.raw.length),n.push(k),!0):!1))continue;if(k=this.tokenizer.escape(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.tag(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.link(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(k.raw.length);let E=n.at(-1);k.type==="text"&&(E==null?void 0:E.type)==="text"?(E.raw+=k.raw,E.text+=k.text):n.push(k);continue}if(k=this.tokenizer.emStrong(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.codespan(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.br(t)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.del(t,r,i)){t=t.substring(k.raw.length),n.push(k);continue}if(k=this.tokenizer.autolink(t)){t=t.substring(k.raw.length),n.push(k);continue}if(!this.state.inLink&&(k=this.tokenizer.url(t))){t=t.substring(k.raw.length),n.push(k);continue}let y=t;if((m=this.options.extensions)!=null&&m.startInline){let E=1/0,Z=t.slice(1),ee;this.options.extensions.startInline.forEach(N=>{ee=N.call({lexer:this},Z),typeof ee=="number"&&ee>=0&&(E=Math.min(E,ee))}),E<1/0&&E>=0&&(y=t.substring(0,E+1))}if(k=this.tokenizer.inlineText(y)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let E=n.at(-1);(E==null?void 0:E.type)==="text"?(E.raw+=k.raw,E.text+=k.text):n.push(k);continue}if(t){this.infiniteLoopError(t.charCodeAt(0));break}}return n}infiniteLoopError(t){let n="Infinite loop on byte: "+t;if(this.options.silent)console.error(n);else throw new Error(n)}},_o=class{constructor(e){ue(this,"options");ue(this,"parser");this.options=e||_n}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(He.notSpaceStart))==null?void 0:i[0],o=e.replace(He.endingNewline,"")+`
1411
+ `;return r?'<pre><code class="language-'+zt(r)+'">'+(n?o:zt(o,!0))+`</code></pre>
1412
+ `:"<pre><code>"+(n?o:zt(o,!0))+`</code></pre>
1413
1413
  `}blockquote({tokens:e}){return`<blockquote>
1414
1414
  ${this.parser.parse(e)}</blockquote>
1415
1415
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -1425,9 +1425,9 @@ ${this.parser.parse(e)}</blockquote>
1425
1425
  `}tablerow({text:e}){return`<tr>
1426
1426
  ${e}</tr>
1427
1427
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
1428
- `}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>${$t(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),o=dc(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+$t(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=dc(e);if(o===null)return $t(n);e=o;let i=`<img src="${e}" alt="${$t(n)}"`;return t&&(i+=` title="${$t(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:$t(e.text)}},Ns=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""}checkbox({raw:e}){return e}},wt=class vi{constructor(t){de(this,"options");de(this,"renderer");de(this,"textRenderer");this.options=t||_n,this.options.renderer=this.options.renderer||new vo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ns}static parse(t,n){return new vi(n).parse(t)}static parseInline(t,n){return new vi(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let u=a,h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(u.type)){n+=h||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let u='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let h=this.options.extensions.renderers[d.type].call({parser:this},d);if(h!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=h||"";continue}}let u=d;switch(u.type){case"escape":{r+=n.text(u);break}case"html":{r+=n.html(u);break}case"link":{r+=n.link(u);break}case"image":{r+=n.image(u);break}case"checkbox":{r+=n.checkbox(u);break}case"strong":{r+=n.strong(u);break}case"em":{r+=n.em(u);break}case"codespan":{r+=n.codespan(u);break}case"br":{r+=n.br(u);break}case"del":{r+=n.del(u);break}case"text":{r+=n.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}},xr=(Ho=class{constructor(e){de(this,"options");de(this,"block");this.options=e||_n}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?yt.lex:yt.lexInline}provideParser(e=this.block){return e?wt.parse:wt.parseInline}},de(Ho,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),de(Ho,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ho),hm=class{constructor(...e){de(this,"defaults",Cs());de(this,"options",this.setOptions);de(this,"parse",this.parseMarkdown(!0));de(this,"parseInline",this.parseMarkdown(!1));de(this,"Parser",wt);de(this,"Renderer",vo);de(this,"TextRenderer",Ns);de(this,"Lexer",yt);de(this,"Tokenizer",_o);de(this,"Hooks",xr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let u of d)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let u=a[d].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=v({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new vo(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,d=n.renderer[a],u=o[a];o[a]=(...h)=>{let p=d.apply(o,h);return p===!1&&(p=u.apply(o,h)),p||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new _o(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],u=o[a];o[a]=(...h)=>{let p=d.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new xr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],u=o[a];xr.passThroughHooks.has(i)?o[a]=h=>{if(this.defaults.async&&xr.passThroughHooksRespectAsync.has(i))return I(this,null,function*(){let m=yield d.call(o,h);return u.call(o,m)});let p=d.call(o,h);return u.call(o,p)}:o[a]=(...h)=>{if(this.defaults.async)return I(this,null,function*(){let m=yield d.apply(o,h);return m===!1&&(m=yield u.apply(o,h)),m});let p=d.apply(o,h);return p===!1&&(p=u.apply(o,h)),p}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=v(v({},this.defaults),r)}),this}setOptions(e){return this.defaults=v(v({},this.defaults),e),this}lexer(e,t){return yt.lex(e,t!=null?t:this.defaults)}parser(e,t){return wt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=v({},n),o=v(v({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new 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"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return I(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?yt.lex:yt.lexInline)(a,o),u=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(u,o.walkTokens)));let h=yield(o.hooks?yield o.hooks.provideParser(e):e?wt.parse:wt.parseInline)(u,o);return o.hooks?yield o.hooks.postprocess(h):h}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?yt.lex:yt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?wt.parse:wt.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1429
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+$t(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},yn=new hm;function ce(e,t){return yn.parse(e,t)}ce.options=ce.setOptions=function(e){return yn.setOptions(e),ce.defaults=yn.defaults,Ka(ce.defaults),ce},ce.getDefaults=Cs,ce.defaults=_n;function fm(...e){return yn.use(...e),ce.defaults=yn.defaults,Ka(ce.defaults),ce}ce.use=fm,ce.walkTokens=function(e,t){return yn.walkTokens(e,t)},ce.parseInline=yn.parseInline,ce.Parser=wt,ce.parser=wt.parse,ce.Renderer=vo,ce.TextRenderer=Ns,ce.Lexer=yt,ce.lexer=yt.lex,ce.Tokenizer=_o,ce.Hooks=xr,ce.parse=ce,ce.options,ce.setOptions,ce.walkTokens,ce.parseInline,wt.parse,yt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:gc,setPrototypeOf:mc,isFrozen:gm,getPrototypeOf:mm,getOwnPropertyDescriptor:bm}=Object;let{freeze:Ye,seal:pt,create:Ds}=Object,{apply:Ms,construct:Us}=typeof Reflect!="undefined"&&Reflect;Ye||(Ye=function(t){return t}),pt||(pt=function(t){return t}),Ms||(Ms=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Us||(Us=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const yo=Xe(Array.prototype.forEach),km=Xe(Array.prototype.lastIndexOf),bc=Xe(Array.prototype.pop),Sr=Xe(Array.prototype.push),_m=Xe(Array.prototype.splice),wo=Xe(String.prototype.toLowerCase),js=Xe(String.prototype.toString),Zs=Xe(String.prototype.match),Tr=Xe(String.prototype.replace),vm=Xe(String.prototype.indexOf),ym=Xe(String.prototype.trim),xt=Xe(Object.prototype.hasOwnProperty),Ve=Xe(RegExp.prototype.test),Er=wm(TypeError);function Xe(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ms(e,t,r)}}function wm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Us(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wo;mc&&mc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(gm(t)||(t[r]=i),o=i)}e[o]=!0}return e}function xm(e){for(let t=0;t<e.length;t++)xt(e,t)||(e[t]=null);return e}function Ot(e){const t=Ds(null);for(const[n,r]of gc(e))xt(e,n)&&(Array.isArray(r)?t[n]=xm(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Ot(r):t[n]=r);return t}function Ar(e,t){for(;e!==null;){const r=bm(e,t);if(r){if(r.get)return Xe(r.get);if(typeof r.value=="function")return Xe(r.value)}e=mm(e)}function n(){return null}return n}const kc=Ye(["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"]),qs=Ye(["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"]),Hs=Ye(["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"]),Sm=Ye(["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"]),Fs=Ye(["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"]),Tm=Ye(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_c=Ye(["#text"]),vc=Ye(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","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","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Bs=Ye(["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","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","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-rendering","textlength","type","u1","u2","unicode","values","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"]),yc=Ye(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","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"]),xo=Ye(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Em=pt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Am=pt(/<%[\w\W]*|[\w\W]*%>/gm),Cm=pt(/\$\{[\w\W]*/gm),Pm=pt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Rm=pt(/^aria-[\-\w]+$/),wc=pt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Lm=pt(/^(?:\w+script|data):/i),Im=pt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xc=pt(/^html$/i),zm=pt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Sc=Object.freeze({__proto__:null,ARIA_ATTR:Rm,ATTR_WHITESPACE:Im,CUSTOM_ELEMENT:zm,DATA_ATTR:Pm,DOCTYPE_NAME:xc,ERB_EXPR:Am,IS_ALLOWED_URI:wc,IS_SCRIPT_OR_DATA:Lm,MUSTACHE_EXPR:Em,TMPLIT_EXPR:Cm});const Cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},$m=function(){return typeof window=="undefined"?null:window},Om=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Tc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ec(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:$m();const t=U=>Ec(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Cr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:u,NodeFilter:h,NamedNodeMap:p=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:k}=e,y=u.prototype,A=Ar(y,"cloneNode"),Z=Ar(y,"remove"),J=Ar(y,"nextSibling"),O=Ar(y,"childNodes"),T=Ar(y,"parentNode");if(typeof a=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let S,C="";const{implementation:M,createNodeIterator:Y,createDocumentFragment:xe,getElementsByTagName:Le}=n,{importNode:tt}=r;let re=Tc();t.isSupported=typeof gc=="function"&&typeof T=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ie,ERB_EXPR:He,TMPLIT_EXPR:Tt,DATA_ATTR:dn,ARIA_ATTR:ct,IS_SCRIPT_OR_DATA:Jt,ATTR_WHITESPACE:Ln,CUSTOM_ELEMENT:B}=Sc;let{IS_ALLOWED_URI:oe}=Sc,K=null;const Fe=V({},[...kc,...qs,...Hs,...Fs,..._c]);let pe=null;const gt=V({},[...vc,...Bs,...yc,...xo]);let he=Object.seal(Ds(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}})),Be=null,pn=null;const Et=Object.seal(Ds(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ee=!0,te=!0,nt=!1,rt=!0,Oe=!1,Ue=!0,Ge=!1,mt=!1,At=!1,hn=!1,In=!1,zn=!1,Fo=!0,Nr=!1;const ai="user-content-";let Dr=!0,$n=!1,fn={},ot=null;const Mr=V({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let fe=null;const Bo=V({},["audio","video","img","source","image","track"]);let Ur=null;const Go=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",Ct="http://www.w3.org/1999/xhtml";let gn=Ct,On=!1,Nn=null;const ci=V({},[lr,ur,Ct],js);let dr=V({},["mi","mo","mn","ms","mtext"]),pr=V({},["annotation-xml"]);const li=V({},["title","style","font","a","script"]);let Yt=null;const Pt=["application/xhtml+xml","text/html"],ui="text/html";let ge=null,mn=null;const Wo=n.createElement("form"),jr=function(_){return _ instanceof RegExp||_ instanceof Function},hr=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mn&&mn===_)){if((!_||typeof _!="object")&&(_={}),_=Ot(_),Yt=Pt.indexOf(_.PARSER_MEDIA_TYPE)===-1?ui:_.PARSER_MEDIA_TYPE,ge=Yt==="application/xhtml+xml"?js:wo,K=xt(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,ge):Fe,pe=xt(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,ge):gt,Nn=xt(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,js):ci,Ur=xt(_,"ADD_URI_SAFE_ATTR")?V(Ot(Go),_.ADD_URI_SAFE_ATTR,ge):Go,fe=xt(_,"ADD_DATA_URI_TAGS")?V(Ot(Bo),_.ADD_DATA_URI_TAGS,ge):Bo,ot=xt(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,ge):Mr,Be=xt(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,ge):Ot({}),pn=xt(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,ge):Ot({}),fn=xt(_,"USE_PROFILES")?_.USE_PROFILES:!1,ee=_.ALLOW_ARIA_ATTR!==!1,te=_.ALLOW_DATA_ATTR!==!1,nt=_.ALLOW_UNKNOWN_PROTOCOLS||!1,rt=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Oe=_.SAFE_FOR_TEMPLATES||!1,Ue=_.SAFE_FOR_XML!==!1,Ge=_.WHOLE_DOCUMENT||!1,hn=_.RETURN_DOM||!1,In=_.RETURN_DOM_FRAGMENT||!1,zn=_.RETURN_TRUSTED_TYPE||!1,At=_.FORCE_BODY||!1,Fo=_.SANITIZE_DOM!==!1,Nr=_.SANITIZE_NAMED_PROPS||!1,Dr=_.KEEP_CONTENT!==!1,$n=_.IN_PLACE||!1,oe=_.ALLOWED_URI_REGEXP||wc,gn=_.NAMESPACE||Ct,dr=_.MATHML_TEXT_INTEGRATION_POINTS||dr,pr=_.HTML_INTEGRATION_POINTS||pr,he=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&jr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(he.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&jr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(he.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(he.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Oe&&(te=!1),In&&(hn=!0),fn&&(K=V({},_c),pe=[],fn.html===!0&&(V(K,kc),V(pe,vc)),fn.svg===!0&&(V(K,qs),V(pe,Bs),V(pe,xo)),fn.svgFilters===!0&&(V(K,Hs),V(pe,Bs),V(pe,xo)),fn.mathMl===!0&&(V(K,Fs),V(pe,yc),V(pe,xo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Et.tagCheck=_.ADD_TAGS:(K===Fe&&(K=Ot(K)),V(K,_.ADD_TAGS,ge))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Et.attributeCheck=_.ADD_ATTR:(pe===gt&&(pe=Ot(pe)),V(pe,_.ADD_ATTR,ge))),_.ADD_URI_SAFE_ATTR&&V(Ur,_.ADD_URI_SAFE_ATTR,ge),_.FORBID_CONTENTS&&(ot===Mr&&(ot=Ot(ot)),V(ot,_.FORBID_CONTENTS,ge)),_.ADD_FORBID_CONTENTS&&(ot===Mr&&(ot=Ot(ot)),V(ot,_.ADD_FORBID_CONTENTS,ge)),Dr&&(K["#text"]=!0),Ge&&V(K,["html","head","body"]),K.table&&(V(K,["tbody"]),delete Be.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=Om(k,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));Ye&&Ye(_),mn=_}},Zr=V({},[...qs,...Hs,...Sm]),Jo=V({},[...Fs,...Tm]),di=function(_){let E=T(_);(!E||!E.tagName)&&(E={namespaceURI:gn,tagName:"template"});const L=wo(_.tagName),ue=wo(E.tagName);return Nn[_.namespaceURI]?_.namespaceURI===ur?E.namespaceURI===Ct?L==="svg":E.namespaceURI===lr?L==="svg"&&(ue==="annotation-xml"||dr[ue]):!!Zr[L]:_.namespaceURI===lr?E.namespaceURI===Ct?L==="math":E.namespaceURI===ur?L==="math"&&pr[ue]:!!Jo[L]:_.namespaceURI===Ct?E.namespaceURI===ur&&!pr[ue]||E.namespaceURI===lr&&!dr[ue]?!1:!Jo[L]&&(li[L]||!Zr[L]):!!(Yt==="application/xhtml+xml"&&Nn[_.namespaceURI]):!1},bt=function(_){Sr(t.removed,{element:_});try{T(_).removeChild(_)}catch(E){Z(_)}},kt=function(_,E){try{Sr(t.removed,{attribute:E.getAttributeNode(_),from:E})}catch(L){Sr(t.removed,{attribute:null,from:E})}if(E.removeAttribute(_),_==="is")if(hn||In)try{bt(E)}catch(L){}else try{E.setAttribute(_,"")}catch(L){}},Yo=function(_){let E=null,L=null;if(At)_="<remove></remove>"+_;else{const Se=Zs(_,/^[\r\n\t ]+/);L=Se&&Se[0]}Yt==="application/xhtml+xml"&&gn===Ct&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const ue=S?S.createHTML(_):_;if(gn===Ct)try{E=new g().parseFromString(ue,Yt)}catch(Se){}if(!E||!E.documentElement){E=M.createDocument(gn,"template",null);try{E.documentElement.innerHTML=On?C:ue}catch(Se){}}const Ne=E.body||E.documentElement;return _&&L&&Ne.insertBefore(n.createTextNode(L),Ne.childNodes[0]||null),gn===Ct?Le.call(E,Ge?"html":"body")[0]:Ge?E.documentElement:Ne},qr=function(_){return Y.call(_.ownerDocument||_,_,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Hr=function(_){return _ instanceof m&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof p)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Vo=function(_){return typeof d=="function"&&_ instanceof d};function Rt(U,_,E){yo(U,L=>{L.call(t,_,E,mn)})}const Xo=function(_){let E=null;if(Rt(re.beforeSanitizeElements,_,null),Hr(_))return bt(_),!0;const L=ge(_.nodeName);if(Rt(re.uponSanitizeElement,_,{tagName:L,allowedTags:K}),Ue&&_.hasChildNodes()&&!Vo(_.firstElementChild)&&Ve(/<[/\w!]/g,_.innerHTML)&&Ve(/<[/\w!]/g,_.textContent)||_.nodeType===Cr.progressingInstruction||Ue&&_.nodeType===Cr.comment&&Ve(/<[/\w]/g,_.data))return bt(_),!0;if(!(Et.tagCheck instanceof Function&&Et.tagCheck(L))&&(!K[L]||Be[L])){if(!Be[L]&&Qo(L)&&(he.tagNameCheck instanceof RegExp&&Ve(he.tagNameCheck,L)||he.tagNameCheck instanceof Function&&he.tagNameCheck(L)))return!1;if(Dr&&!ot[L]){const ue=T(_)||_.parentNode,Ne=O(_)||_.childNodes;if(Ne&&ue){const Se=Ne.length;for(let We=Se-1;We>=0;--We){const Lt=A(Ne[We],!0);Lt.__removalCount=(_.__removalCount||0)+1,ue.insertBefore(Lt,J(_))}}}return bt(_),!0}return _ instanceof u&&!di(_)||(L==="noscript"||L==="noembed"||L==="noframes")&&Ve(/<\/no(script|embed|frames)/i,_.innerHTML)?(bt(_),!0):(Oe&&_.nodeType===Cr.text&&(E=_.textContent,yo([Ie,He,Tt],ue=>{E=Tr(E,ue," ")}),_.textContent!==E&&(Sr(t.removed,{element:_.cloneNode()}),_.textContent=E)),Rt(re.afterSanitizeElements,_,null),!1)},Ko=function(_,E,L){if(Fo&&(E==="id"||E==="name")&&(L in n||L in Wo))return!1;if(!(te&&!pn[E]&&Ve(dn,E))){if(!(ee&&Ve(ct,E))){if(!(Et.attributeCheck instanceof Function&&Et.attributeCheck(E,_))){if(!pe[E]||pn[E]){if(!(Qo(_)&&(he.tagNameCheck instanceof RegExp&&Ve(he.tagNameCheck,_)||he.tagNameCheck instanceof Function&&he.tagNameCheck(_))&&(he.attributeNameCheck instanceof RegExp&&Ve(he.attributeNameCheck,E)||he.attributeNameCheck instanceof Function&&he.attributeNameCheck(E,_))||E==="is"&&he.allowCustomizedBuiltInElements&&(he.tagNameCheck instanceof RegExp&&Ve(he.tagNameCheck,L)||he.tagNameCheck instanceof Function&&he.tagNameCheck(L))))return!1}else if(!Ur[E]){if(!Ve(oe,Tr(L,Ln,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&_!=="script"&&vm(L,"data:")===0&&fe[_])){if(!(nt&&!Ve(Jt,Tr(L,Ln,"")))){if(L)return!1}}}}}}}return!0},Qo=function(_){return _!=="annotation-xml"&&Zs(_,B)},Fr=function(_){Rt(re.beforeSanitizeAttributes,_,null);const{attributes:E}=_;if(!E||Hr(_))return;const L={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:pe,forceKeepAttr:void 0};let ue=E.length;for(;ue--;){const Ne=E[ue],{name:Se,namespaceURI:We,value:Lt}=Ne,jt=ge(Se),Br=Lt;let ze=Se==="value"?Br:ym(Br);if(L.attrName=jt,L.attrValue=ze,L.keepAttr=!0,L.forceKeepAttr=void 0,Rt(re.uponSanitizeAttribute,_,L),ze=L.attrValue,Nr&&(jt==="id"||jt==="name")&&(kt(Se,_),ze=ai+ze),Ue&&Ve(/((--!?|])>)|<\/(style|title|textarea)/i,ze)){kt(Se,_);continue}if(jt==="attributename"&&Zs(ze,"href")){kt(Se,_);continue}if(L.forceKeepAttr)continue;if(!L.keepAttr){kt(Se,_);continue}if(!rt&&Ve(/\/>/i,ze)){kt(Se,_);continue}Oe&&yo([Ie,He,Tt],ts=>{ze=Tr(ze,ts," ")});const es=ge(_.nodeName);if(!Ko(es,jt,ze)){kt(Se,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!We)switch(k.getAttributeType(es,jt)){case"TrustedHTML":{ze=S.createHTML(ze);break}case"TrustedScriptURL":{ze=S.createScriptURL(ze);break}}if(ze!==Br)try{We?_.setAttributeNS(We,Se,ze):_.setAttribute(Se,ze),Hr(_)?bt(_):bc(t.removed)}catch(ts){kt(Se,_)}}Rt(re.afterSanitizeAttributes,_,null)},Vt=function U(_){let E=null;const L=qr(_);for(Rt(re.beforeSanitizeShadowDOM,_,null);E=L.nextNode();)Rt(re.uponSanitizeShadowNode,E,null),Xo(E),Fr(E),E.content instanceof i&&U(E.content);Rt(re.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(U){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,L=null,ue=null,Ne=null;if(On=!U,On&&(U="<!-->"),typeof U!="string"&&!Vo(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return U;if(mt||hr(_),t.removed=[],typeof U=="string"&&($n=!1),$n){if(U.nodeName){const Lt=ge(U.nodeName);if(!K[Lt]||Be[Lt])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof d)E=Yo("<!---->"),L=E.ownerDocument.importNode(U,!0),L.nodeType===Cr.element&&L.nodeName==="BODY"||L.nodeName==="HTML"?E=L:E.appendChild(L);else{if(!hn&&!Oe&&!Ge&&U.indexOf("<")===-1)return S&&zn?S.createHTML(U):U;if(E=Yo(U),!E)return hn?null:zn?C:""}E&&At&&bt(E.firstChild);const Se=qr($n?U:E);for(;ue=Se.nextNode();)Xo(ue),Fr(ue),ue.content instanceof i&&Vt(ue.content);if($n)return U;if(hn){if(In)for(Ne=xe.call(E.ownerDocument);E.firstChild;)Ne.appendChild(E.firstChild);else Ne=E;return(pe.shadowroot||pe.shadowrootmode)&&(Ne=tt.call(r,Ne,!0)),Ne}let We=Ge?E.outerHTML:E.innerHTML;return Ge&&K["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&Ve(xc,E.ownerDocument.doctype.name)&&(We="<!DOCTYPE "+E.ownerDocument.doctype.name+`>
1430
- `+We),Oe&&yo([Ie,He,Tt],Lt=>{We=Tr(We,Lt," ")}),S&&zn?S.createHTML(We):We},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hr(U),mt=!0},t.clearConfig=function(){mn=null,mt=!1},t.isValidAttribute=function(U,_,E){mn||hr({});const L=ge(U),ue=ge(_);return Ko(L,ue,E)},t.addHook=function(U,_){typeof _=="function"&&Sr(re[U],_)},t.removeHook=function(U,_){if(_!==void 0){const E=km(re[U],_);return E===-1?void 0:_m(re[U],E,1)[0]}return bc(re[U])},t.removeHooks=function(U){re[U]=[]},t.removeAllHooks=function(){re=Tc()},t}var Nm=Ec();function Ac(e){const t=ce.parse(e,{gfm:!0,breaks:!0,async:!1});return Nm.sanitize(t)}const Cc=1e3,Pc=32,Rc=15e3,Dm=new Set(["completed","failed","cancelled"]),Mm=4e3;let z=null,Nt=null,Me=null,Gs=null,So=null,Ws=!1,To=null,Pr=null,q={kind:"connecting"},Kn=[],Qn=null,ye=null,er=null,Ft=null,Rr=-1,Ke=null,Bt=!1,Gt=null,wn=new Set;function Js(){Eo(),Ga(),Nt&&clearInterval(Nt),Nt=null,Gt==null||Gt(),Gt=null,Me==null||Me.destroy(),Me=null,z&&qt(z),z==null||z.remove(),z=null,Gs=null,q={kind:"connecting"},Kn=[],Qn=null,ye=null,er=null,Ft=null,So=null,Rr=-1,Ke=null,Bt=!1,wn=new Set}function Ys(e,t,n,r,o){z&&Js(),Gs=o!=null?o:null,q={kind:"connecting"},Kn=[],Qn=null,Rr=-1,Ke=null,Bt=!1,wn=new Set,ye=e,er=n,Ft=t,So=r,Ba({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
1428
+ `}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>${zt(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),o=hc(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+zt(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let o=hc(e);if(o===null)return zt(n);e=o;let i=`<img src="${e}" alt="${zt(n)}"`;return t&&(i+=` title="${zt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:zt(e.text)}},Ns=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""}checkbox({raw:e}){return e}},yt=class vi{constructor(t){ue(this,"options");ue(this,"renderer");ue(this,"textRenderer");this.options=t||_n,this.options.renderer=this.options.renderer||new _o,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ns}static parse(t,n){return new vi(n).parse(t)}static parseInline(t,n){return new vi(n).parseInline(t)}parse(t){var r,o;this.renderer.parser=this;let n="";for(let i=0;i<t.length;i++){let a=t[i];if((o=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&o[a.type]){let u=a,p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(u.type)){n+=p||"";continue}}let d=a;switch(d.type){case"space":{n+=this.renderer.space(d);break}case"hr":{n+=this.renderer.hr(d);break}case"heading":{n+=this.renderer.heading(d);break}case"code":{n+=this.renderer.code(d);break}case"table":{n+=this.renderer.table(d);break}case"blockquote":{n+=this.renderer.blockquote(d);break}case"list":{n+=this.renderer.list(d);break}case"checkbox":{n+=this.renderer.checkbox(d);break}case"html":{n+=this.renderer.html(d);break}case"def":{n+=this.renderer.def(d);break}case"paragraph":{n+=this.renderer.paragraph(d);break}case"text":{n+=this.renderer.text(d);break}default:{let u='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(u),"";throw new Error(u)}}}return n}parseInline(t,n=this.renderer){var o,i;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let d=t[a];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[d.type]){let p=this.options.extensions.renderers[d.type].call({parser:this},d);if(p!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(d.type)){r+=p||"";continue}}let u=d;switch(u.type){case"escape":{r+=n.text(u);break}case"html":{r+=n.html(u);break}case"link":{r+=n.link(u);break}case"image":{r+=n.image(u);break}case"checkbox":{r+=n.checkbox(u);break}case"strong":{r+=n.strong(u);break}case"em":{r+=n.em(u);break}case"codespan":{r+=n.codespan(u);break}case"br":{r+=n.br(u);break}case"del":{r+=n.del(u);break}case"text":{r+=n.text(u);break}default:{let p='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},xr=(Ho=class{constructor(e){ue(this,"options");ue(this,"block");this.options=e||_n}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?vt.lex:vt.lexInline}provideParser(e=this.block){return e?yt.parse:yt.parseInline}},ue(Ho,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ue(Ho,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Ho),_m=class{constructor(...e){ue(this,"defaults",Cs());ue(this,"options",this.setOptions);ue(this,"parse",this.parseMarkdown(!0));ue(this,"parseInline",this.parseMarkdown(!1));ue(this,"Parser",yt);ue(this,"Renderer",_o);ue(this,"TextRenderer",Ns);ue(this,"Lexer",vt);ue(this,"Tokenizer",ko);ue(this,"Hooks",xr);this.use(...e)}walkTokens(e,t){var r,o;let n=[];for(let i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{let a=i;for(let d of a.header)n=n.concat(this.walkTokens(d.tokens,t));for(let d of a.rows)for(let u of d)n=n.concat(this.walkTokens(u.tokens,t));break}case"list":{let a=i;n=n.concat(this.walkTokens(a.items,t));break}default:{let a=i;(o=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&o[a.type]?this.defaults.extensions.childTokens[a.type].forEach(d=>{let u=a[d].flat(1/0);n=n.concat(this.walkTokens(u,t))}):a.tokens&&(n=n.concat(this.walkTokens(a.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{let r=v({},n);if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){let i=t.renderers[o.name];i?t.renderers[o.name]=function(...a){let d=o.renderer.apply(this,a);return d===!1&&(d=i.apply(this,a)),d}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),r.extensions=t),n.renderer){let o=this.defaults.renderer||new _o(this.defaults);for(let i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let a=i,d=n.renderer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new ko(this.defaults);for(let i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let a=i,d=n.tokenizer[a],u=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new xr;for(let i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let a=i,d=n.hooks[a],u=o[a];xr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&xr.passThroughHooksRespectAsync.has(i))return L(this,null,function*(){let g=yield d.call(o,p);return u.call(o,g)});let h=d.call(o,p);return u.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return L(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield u.apply(o,p)),g});let h=d.apply(o,p);return h===!1&&(h=u.apply(o,p)),h}}r.hooks=o}if(n.walkTokens){let o=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(a){let d=[];return d.push(i.call(this,a)),o&&(d=d.concat(o.call(this,a))),d}}this.defaults=v(v({},this.defaults),r)}),this}setOptions(e){return this.defaults=v(v({},this.defaults),e),this}lexer(e,t){return vt.lex(e,t!=null?t:this.defaults)}parser(e,t){return yt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=v({},n),o=v(v({},this.defaults),r),i=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&r.async===!1)return i(new 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"||t===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(o.hooks&&(o.hooks.options=o,o.hooks.block=e),o.async)return L(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?vt.lex:vt.lexInline)(a,o),u=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(u,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?yt.parse:yt.parseInline)(u,o);return o.hooks?yield o.hooks.postprocess(p):p}).catch(i);try{o.hooks&&(t=o.hooks.preprocess(t));let a=(o.hooks?o.hooks.provideLexer(e):e?vt.lex:vt.lexInline)(t,o);o.hooks&&(a=o.hooks.processAllTokens(a)),o.walkTokens&&this.walkTokens(a,o.walkTokens);let d=(o.hooks?o.hooks.provideParser(e):e?yt.parse:yt.parseInline)(a,o);return o.hooks&&(d=o.hooks.postprocess(d)),d}catch(a){return i(a)}}}onError(e,t){return n=>{if(n.message+=`
1429
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+zt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},yn=new _m;function ae(e,t){return yn.parse(e,t)}ae.options=ae.setOptions=function(e){return yn.setOptions(e),ae.defaults=yn.defaults,ec(ae.defaults),ae},ae.getDefaults=Cs,ae.defaults=_n;function vm(...e){return yn.use(...e),ae.defaults=yn.defaults,ec(ae.defaults),ae}ae.use=vm,ae.walkTokens=function(e,t){return yn.walkTokens(e,t)},ae.parseInline=yn.parseInline,ae.Parser=yt,ae.parser=yt.parse,ae.Renderer=_o,ae.TextRenderer=Ns,ae.Lexer=vt,ae.lexer=vt.lex,ae.Tokenizer=ko,ae.Hooks=xr,ae.parse=ae,ae.options,ae.setOptions,ae.walkTokens,ae.parseInline,yt.parse,vt.lex;/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:bc,setPrototypeOf:kc,isFrozen:ym,getPrototypeOf:wm,getOwnPropertyDescriptor:xm}=Object;let{freeze:Je,seal:ht,create:Ds}=Object,{apply:Ms,construct:Us}=typeof Reflect!="undefined"&&Reflect;Je||(Je=function(t){return t}),ht||(ht=function(t){return t}),Ms||(Ms=function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];return t.apply(n,o)}),Us||(Us=function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return new t(...r)});const vo=Ve(Array.prototype.forEach),Sm=Ve(Array.prototype.lastIndexOf),_c=Ve(Array.prototype.pop),Sr=Ve(Array.prototype.push),Tm=Ve(Array.prototype.splice),yo=Ve(String.prototype.toLowerCase),js=Ve(String.prototype.toString),Zs=Ve(String.prototype.match),Tr=Ve(String.prototype.replace),Em=Ve(String.prototype.indexOf),Am=Ve(String.prototype.trim),wt=Ve(Object.prototype.hasOwnProperty),Ye=Ve(RegExp.prototype.test),Er=Cm(TypeError);function Ve(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return Ms(e,t,r)}}function Cm(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Us(e,n)}}function Y(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;kc&&kc(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(ym(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Pm(e){for(let t=0;t<e.length;t++)wt(e,t)||(e[t]=null);return e}function $t(e){const t=Ds(null);for(const[n,r]of bc(e))wt(e,n)&&(Array.isArray(r)?t[n]=Pm(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=$t(r):t[n]=r);return t}function Ar(e,t){for(;e!==null;){const r=xm(e,t);if(r){if(r.get)return Ve(r.get);if(typeof r.value=="function")return Ve(r.value)}e=wm(e)}function n(){return null}return n}const vc=Je(["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"]),qs=Je(["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"]),Hs=Je(["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"]),Rm=Je(["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"]),Fs=Je(["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"]),Lm=Je(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),yc=Je(["#text"]),wc=Je(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","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","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Bs=Je(["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","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","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-rendering","textlength","type","u1","u2","unicode","values","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"]),xc=Je(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","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"]),wo=Je(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Im=ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm),zm=ht(/<%[\w\W]*|[\w\W]*%>/gm),$m=ht(/\$\{[\w\W]*/gm),Om=ht(/^data-[\-\w.\u00B7-\uFFFF]+$/),Nm=ht(/^aria-[\-\w]+$/),Sc=ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Dm=ht(/^(?:\w+script|data):/i),Mm=ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Tc=ht(/^html$/i),Um=ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ec=Object.freeze({__proto__:null,ARIA_ATTR:Nm,ATTR_WHITESPACE:Mm,CUSTOM_ELEMENT:Um,DATA_ATTR:Om,DOCTYPE_NAME:Tc,ERB_EXPR:zm,IS_ALLOWED_URI:Sc,IS_SCRIPT_OR_DATA:Dm,MUSTACHE_EXPR:Im,TMPLIT_EXPR:$m});const Cr={element:1,text:3,progressingInstruction:7,comment:8,document:9},jm=function(){return typeof window=="undefined"?null:window},Zm=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const i="dompurify"+(r?"#"+r:"");try{return t.createPolicy(i,{createHTML(a){return a},createScriptURL(a){return a}})}catch(a){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Ac=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jm();const t=U=>Cc(U);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Cr.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:i,HTMLTemplateElement:a,Node:d,Element:u,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:g,DOMParser:m,trustedTypes:k}=e,y=u.prototype,E=Ar(y,"cloneNode"),Z=Ar(y,"remove"),ee=Ar(y,"nextSibling"),N=Ar(y,"childNodes"),T=Ar(y,"parentNode");if(typeof a=="function"){const U=n.createElement("template");U.content&&U.content.ownerDocument&&(n=U.content.ownerDocument)}let S,C="";const{implementation:M,createNodeIterator:J,createDocumentFragment:ge,getElementsByTagName:Ze}=n,{importNode:it}=r;let te=Ac();t.isSupported=typeof bc=="function"&&typeof T=="function"&&M&&M.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ee,ERB_EXPR:et,TMPLIT_EXPR:pn,DATA_ATTR:hn,ARIA_ATTR:at,IS_SCRIPT_OR_DATA:St,ATTR_WHITESPACE:Tt,CUSTOM_ELEMENT:cr}=Ec;let{IS_ALLOWED_URI:Rn}=Ec,we=null;const W=Y({},[...vc,...qs,...Hs,...Fs,...yc]);let F=null;const Pe=Y({},[...wc,...Bs,...xc,...wo]);let Q=Object.seal(Ds(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}})),Re=null,ct=null;const Et=Object.seal(Ds(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xe=!0,oe=!0,tt=!1,Fe=!0,de=!1,Jt=!0,$e=!1,Be=!1,Yt=!1,lt=!1,Ln=!1,In=!1,Fo=!0,Or=!1;const ai="user-content-";let Nr=!0,zn=!1,fn={},nt=null;const Dr=Y({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let pe=null;const Bo=Y({},["audio","video","img","source","image","track"]);let Mr=null;const Go=Y({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),lr="http://www.w3.org/1998/Math/MathML",ur="http://www.w3.org/2000/svg",At="http://www.w3.org/1999/xhtml";let gn=At,$n=!1,On=null;const ci=Y({},[lr,ur,At],js);let dr=Y({},["mi","mo","mn","ms","mtext"]),pr=Y({},["annotation-xml"]);const li=Y({},["title","style","font","a","script"]);let Vt=null;const Ct=["application/xhtml+xml","text/html"],ui="text/html";let he=null,mn=null;const Wo=n.createElement("form"),Ur=function(_){return _ instanceof RegExp||_ instanceof Function},hr=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(mn&&mn===_)){if((!_||typeof _!="object")&&(_={}),_=$t(_),Vt=Ct.indexOf(_.PARSER_MEDIA_TYPE)===-1?ui:_.PARSER_MEDIA_TYPE,he=Vt==="application/xhtml+xml"?js:yo,we=wt(_,"ALLOWED_TAGS")?Y({},_.ALLOWED_TAGS,he):W,F=wt(_,"ALLOWED_ATTR")?Y({},_.ALLOWED_ATTR,he):Pe,On=wt(_,"ALLOWED_NAMESPACES")?Y({},_.ALLOWED_NAMESPACES,js):ci,Mr=wt(_,"ADD_URI_SAFE_ATTR")?Y($t(Go),_.ADD_URI_SAFE_ATTR,he):Go,pe=wt(_,"ADD_DATA_URI_TAGS")?Y($t(Bo),_.ADD_DATA_URI_TAGS,he):Bo,nt=wt(_,"FORBID_CONTENTS")?Y({},_.FORBID_CONTENTS,he):Dr,Re=wt(_,"FORBID_TAGS")?Y({},_.FORBID_TAGS,he):$t({}),ct=wt(_,"FORBID_ATTR")?Y({},_.FORBID_ATTR,he):$t({}),fn=wt(_,"USE_PROFILES")?_.USE_PROFILES:!1,xe=_.ALLOW_ARIA_ATTR!==!1,oe=_.ALLOW_DATA_ATTR!==!1,tt=_.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=_.SAFE_FOR_TEMPLATES||!1,Jt=_.SAFE_FOR_XML!==!1,$e=_.WHOLE_DOCUMENT||!1,lt=_.RETURN_DOM||!1,Ln=_.RETURN_DOM_FRAGMENT||!1,In=_.RETURN_TRUSTED_TYPE||!1,Yt=_.FORCE_BODY||!1,Fo=_.SANITIZE_DOM!==!1,Or=_.SANITIZE_NAMED_PROPS||!1,Nr=_.KEEP_CONTENT!==!1,zn=_.IN_PLACE||!1,Rn=_.ALLOWED_URI_REGEXP||Sc,gn=_.NAMESPACE||At,dr=_.MATHML_TEXT_INTEGRATION_POINTS||dr,pr=_.HTML_INTEGRATION_POINTS||pr,Q=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&Ur(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&Ur(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de&&(oe=!1),Ln&&(lt=!0),fn&&(we=Y({},yc),F=[],fn.html===!0&&(Y(we,vc),Y(F,wc)),fn.svg===!0&&(Y(we,qs),Y(F,Bs),Y(F,wo)),fn.svgFilters===!0&&(Y(we,Hs),Y(F,Bs),Y(F,wo)),fn.mathMl===!0&&(Y(we,Fs),Y(F,xc),Y(F,wo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?Et.tagCheck=_.ADD_TAGS:(we===W&&(we=$t(we)),Y(we,_.ADD_TAGS,he))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?Et.attributeCheck=_.ADD_ATTR:(F===Pe&&(F=$t(F)),Y(F,_.ADD_ATTR,he))),_.ADD_URI_SAFE_ATTR&&Y(Mr,_.ADD_URI_SAFE_ATTR,he),_.FORBID_CONTENTS&&(nt===Dr&&(nt=$t(nt)),Y(nt,_.FORBID_CONTENTS,he)),_.ADD_FORBID_CONTENTS&&(nt===Dr&&(nt=$t(nt)),Y(nt,_.ADD_FORBID_CONTENTS,he)),Nr&&(we["#text"]=!0),$e&&Y(we,["html","head","body"]),we.table&&(Y(we,["tbody"]),delete Re.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=Zm(k,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));Je&&Je(_),mn=_}},jr=Y({},[...qs,...Hs,...Rm]),Jo=Y({},[...Fs,...Lm]),di=function(_){let A=T(_);(!A||!A.tagName)&&(A={namespaceURI:gn,tagName:"template"});const I=yo(_.tagName),le=yo(A.tagName);return On[_.namespaceURI]?_.namespaceURI===ur?A.namespaceURI===At?I==="svg":A.namespaceURI===lr?I==="svg"&&(le==="annotation-xml"||dr[le]):!!jr[I]:_.namespaceURI===lr?A.namespaceURI===At?I==="math":A.namespaceURI===ur?I==="math"&&pr[le]:!!Jo[I]:_.namespaceURI===At?A.namespaceURI===ur&&!pr[le]||A.namespaceURI===lr&&!dr[le]?!1:!Jo[I]&&(li[I]||!jr[I]):!!(Vt==="application/xhtml+xml"&&On[_.namespaceURI]):!1},mt=function(_){Sr(t.removed,{element:_});try{T(_).removeChild(_)}catch(A){Z(_)}},bt=function(_,A){try{Sr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Sr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(lt||Ln)try{mt(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Yo=function(_){let A=null,I=null;if(Yt)_="<remove></remove>"+_;else{const Se=Zs(_,/^[\r\n\t ]+/);I=Se&&Se[0]}Vt==="application/xhtml+xml"&&gn===At&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const le=S?S.createHTML(_):_;if(gn===At)try{A=new m().parseFromString(le,Vt)}catch(Se){}if(!A||!A.documentElement){A=M.createDocument(gn,"template",null);try{A.documentElement.innerHTML=$n?C:le}catch(Se){}}const De=A.body||A.documentElement;return _&&I&&De.insertBefore(n.createTextNode(I),De.childNodes[0]||null),gn===At?Ze.call(A,$e?"html":"body")[0]:$e?A.documentElement:De},Zr=function(_){return J.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},qr=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Vo=function(_){return typeof d=="function"&&_ instanceof d};function Pt(U,_,A){vo(U,I=>{I.call(t,_,A,mn)})}const Xo=function(_){let A=null;if(Pt(te.beforeSanitizeElements,_,null),qr(_))return mt(_),!0;const I=he(_.nodeName);if(Pt(te.uponSanitizeElement,_,{tagName:I,allowedTags:we}),Jt&&_.hasChildNodes()&&!Vo(_.firstElementChild)&&Ye(/<[/\w!]/g,_.innerHTML)&&Ye(/<[/\w!]/g,_.textContent)||_.nodeType===Cr.progressingInstruction||Jt&&_.nodeType===Cr.comment&&Ye(/<[/\w]/g,_.data))return mt(_),!0;if(!(Et.tagCheck instanceof Function&&Et.tagCheck(I))&&(!we[I]||Re[I])){if(!Re[I]&&Qo(I)&&(Q.tagNameCheck instanceof RegExp&&Ye(Q.tagNameCheck,I)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(I)))return!1;if(Nr&&!nt[I]){const le=T(_)||_.parentNode,De=N(_)||_.childNodes;if(De&&le){const Se=De.length;for(let Ge=Se-1;Ge>=0;--Ge){const Rt=E(De[Ge],!0);Rt.__removalCount=(_.__removalCount||0)+1,le.insertBefore(Rt,ee(_))}}}return mt(_),!0}return _ instanceof u&&!di(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Ye(/<\/no(script|embed|frames)/i,_.innerHTML)?(mt(_),!0):(de&&_.nodeType===Cr.text&&(A=_.textContent,vo([Ee,et,pn],le=>{A=Tr(A,le," ")}),_.textContent!==A&&(Sr(t.removed,{element:_.cloneNode()}),_.textContent=A)),Pt(te.afterSanitizeElements,_,null),!1)},Ko=function(_,A,I){if(Fo&&(A==="id"||A==="name")&&(I in n||I in Wo))return!1;if(!(oe&&!ct[A]&&Ye(hn,A))){if(!(xe&&Ye(at,A))){if(!(Et.attributeCheck instanceof Function&&Et.attributeCheck(A,_))){if(!F[A]||ct[A]){if(!(Qo(_)&&(Q.tagNameCheck instanceof RegExp&&Ye(Q.tagNameCheck,_)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(_))&&(Q.attributeNameCheck instanceof RegExp&&Ye(Q.attributeNameCheck,A)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(A,_))||A==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&Ye(Q.tagNameCheck,I)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(I))))return!1}else if(!Mr[A]){if(!Ye(Rn,Tr(I,Tt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Em(I,"data:")===0&&pe[_])){if(!(tt&&!Ye(St,Tr(I,Tt,"")))){if(I)return!1}}}}}}}return!0},Qo=function(_){return _!=="annotation-xml"&&Zs(_,cr)},Hr=function(_){Pt(te.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||qr(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0};let le=A.length;for(;le--;){const De=A[le],{name:Se,namespaceURI:Ge,value:Rt}=De,Ut=he(Se),Fr=Rt;let Oe=Se==="value"?Fr:Am(Fr);if(I.attrName=Ut,I.attrValue=Oe,I.keepAttr=!0,I.forceKeepAttr=void 0,Pt(te.uponSanitizeAttribute,_,I),Oe=I.attrValue,Or&&(Ut==="id"||Ut==="name")&&(bt(Se,_),Oe=ai+Oe),Jt&&Ye(/((--!?|])>)|<\/(style|title|textarea)/i,Oe)){bt(Se,_);continue}if(Ut==="attributename"&&Zs(Oe,"href")){bt(Se,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){bt(Se,_);continue}if(!Fe&&Ye(/\/>/i,Oe)){bt(Se,_);continue}de&&vo([Ee,et,pn],ts=>{Oe=Tr(Oe,ts," ")});const es=he(_.nodeName);if(!Ko(es,Ut,Oe)){bt(Se,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Ge)switch(k.getAttributeType(es,Ut)){case"TrustedHTML":{Oe=S.createHTML(Oe);break}case"TrustedScriptURL":{Oe=S.createScriptURL(Oe);break}}if(Oe!==Fr)try{Ge?_.setAttributeNS(Ge,Se,Oe):_.setAttribute(Se,Oe),qr(_)?mt(_):_c(t.removed)}catch(ts){bt(Se,_)}}Pt(te.afterSanitizeAttributes,_,null)},Xt=function U(_){let A=null;const I=Zr(_);for(Pt(te.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)Pt(te.uponSanitizeShadowNode,A,null),Xo(A),Hr(A),A.content instanceof i&&U(A.content);Pt(te.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(U){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,le=null,De=null;if($n=!U,$n&&(U="<!-->"),typeof U!="string"&&!Vo(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return U;if(Be||hr(_),t.removed=[],typeof U=="string"&&(zn=!1),zn){if(U.nodeName){const Rt=he(U.nodeName);if(!we[Rt]||Re[Rt])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof d)A=Yo("<!---->"),I=A.ownerDocument.importNode(U,!0),I.nodeType===Cr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!lt&&!de&&!$e&&U.indexOf("<")===-1)return S&&In?S.createHTML(U):U;if(A=Yo(U),!A)return lt?null:In?C:""}A&&Yt&&mt(A.firstChild);const Se=Zr(zn?U:A);for(;le=Se.nextNode();)Xo(le),Hr(le),le.content instanceof i&&Xt(le.content);if(zn)return U;if(lt){if(Ln)for(De=ge.call(A.ownerDocument);A.firstChild;)De.appendChild(A.firstChild);else De=A;return(F.shadowroot||F.shadowrootmode)&&(De=it.call(r,De,!0)),De}let Ge=$e?A.outerHTML:A.innerHTML;return $e&&we["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ye(Tc,A.ownerDocument.doctype.name)&&(Ge="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1430
+ `+Ge),de&&vo([Ee,et,pn],Rt=>{Ge=Tr(Ge,Rt," ")}),S&&In?S.createHTML(Ge):Ge},t.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};hr(U),Be=!0},t.clearConfig=function(){mn=null,Be=!1},t.isValidAttribute=function(U,_,A){mn||hr({});const I=he(U),le=he(_);return Ko(I,le,A)},t.addHook=function(U,_){typeof _=="function"&&Sr(te[U],_)},t.removeHook=function(U,_){if(_!==void 0){const A=Sm(te[U],_);return A===-1?void 0:Tm(te[U],A,1)[0]}return _c(te[U])},t.removeHooks=function(U){te[U]=[]},t.removeAllHooks=function(){te=Ac()},t}var qm=Cc();function Pc(e){const t=ae.parse(e,{gfm:!0,breaks:!0,async:!1});return qm.sanitize(t)}const Rc=1e3,Lc=32,Ic=15e3,Hm=new Set(["completed","failed","cancelled"]),Fm=4e3;let z=null,Ot=null,je=null,Gs=null,xo=null,Ws=!1,So=null,Pr=null,H={kind:"connecting"},Xn=[],Kn=null,ve=null,Qn=null,Ht=null,Rr=-1,Xe=null,Ft=!1,Bt=null,wn=new Set;function Js(){To(),Ja(),Ot&&clearInterval(Ot),Ot=null,Bt==null||Bt(),Bt=null,je==null||je.destroy(),je=null,z&&Zt(z),z==null||z.remove(),z=null,Gs=null,H={kind:"connecting"},Xn=[],Kn=null,ve=null,Qn=null,Ht=null,xo=null,Rr=-1,Xe=null,Ft=!1,wn=new Set}function Ys(e,t,n,r,o){z&&Js(),Gs=o!=null?o:null,H={kind:"connecting"},Xn=[],Kn=null,Rr=-1,Xe=null,Ft=!1,wn=new Set,ve=e,Qn=n,Ht=t,xo=r,Wa({taskId:e,backendUrl:n,title:r}),z=document.createElement("div"),z.className="ap-sdk-panel",z.setAttribute("data-ap-sdk","1"),z.setAttribute("role","dialog"),z.setAttribute("aria-modal","true"),z.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;z.innerHTML=`
1431
1431
  <div class="ap-sdk-panel__header">
1432
1432
  <span class="ap-sdk-panel__title">
1433
1433
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1440,7 +1440,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1440
1440
  <div class="ap-sdk-runner__meta">
1441
1441
  <div class="ap-sdk-runner__meta-row">
1442
1442
  <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
1443
- <span class="ap-sdk-runner__title" title="${Vm(r)}">${Xs(i)}</span>
1443
+ <span class="ap-sdk-runner__title" title="${nb(r)}">${Xs(i)}</span>
1444
1444
  </div>
1445
1445
  <div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
1446
1446
  <span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
@@ -1466,15 +1466,15 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1466
1466
  </div>
1467
1467
  <div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
1468
1468
  <div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
1469
- `,z.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),z.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(z),Me=cs(),Zt(z),As(z,Es),z.querySelector("[data-ap-close]").addEventListener("click",()=>{Js(),o==null||o()}),z.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Zm(t,e)}),z.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!Ws){Ws=!0,d.textContent="Confirm",To=setTimeout(Eo,Mm),Pr=u=>{u.target!==d&&Eo()},document.addEventListener("click",Pr,!0);return}Eo(),Um(t,e)}),Vs(),Lc(e,t)}function Lc(e,t){const n=d=>I(null,null,function*(){if(ye!==e||!z||q.kind!=="idle"&&q.kind!=="connecting"||wn.has(d.commandId))return;wn.add(d.commandId);const u={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};xn({kind:"executing",command:u,actionsRun:q.kind==="idle"?q.actionsRun:0}),yield zc(u,t,e)}),r=d=>{if(!(ye!==e||!z)&&Dm.has(d)){if(q.kind==="executing")xn({kind:"finishing",status:d,actionsRun:q.actionsRun});else if(q.kind==="connecting"||q.kind==="idle"){const u=q.kind==="idle"?q.actionsRun:0;xn({kind:"finished",status:d,actionsRun:u})}}},o=d=>{ye!==e||!z||(d.outputChunk&&$c([d.outputChunk]),r(d.status))},i=()=>I(null,null,function*(){var d;if(!(ye!==e||!z))try{const u=yield fo(t,e);ye===e&&z&&(Ke=(d=u[0])!=null?d:null,Sn())}catch(u){}}),a=()=>I(null,null,function*(){var d;try{const[u,h,p,m]=yield Promise.all([ja(t,e),tg(t,e),fo(t,e),Qf(t,e)]);if(ye!==e||!z)return;$c(h),Ke=(d=p[0])!=null?d:null,Sn(),r(u.status),m&&m.status==="pending"&&(q.kind==="idle"||q.kind==="connecting")&&!wn.has(m.id)?(wn.add(m.id),xn({kind:"executing",command:m,actionsRun:q.kind==="idle"?q.actionsRun:0}),yield zc(m,t,e)):q.kind==="connecting"&&xn({kind:"idle",actionsRun:0})}catch(u){}});a(),pg(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(ye!==e||q.kind==="finished"){d();return}Gt=d})}function xn(e){q=e,q.kind==="idle"&&Qn===null&&(Qn=Date.now(),Ao(),Nt=setInterval(Ao,Cc)),q.kind==="finished"&&(Nt&&(clearInterval(Nt),Nt=null),Gt==null||Gt(),Gt=null,Me==null||Me.hide(),Ga()),Vs()}function Eo(){Ws=!1,To&&(clearTimeout(To),To=null),Pr&&(document.removeEventListener("click",Pr,!0),Pr=null);const e=z==null?void 0:z.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function Um(e,t){return I(this,null,function*(){if(ye!==t||!z)return;const n=z.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield rg(e,t)}catch(r){n&&(n.disabled=!1)}})}function Ic(){if(!ye||!Ft||!er||!So)return;const e=ye,t=Ft;Ba({taskId:e,backendUrl:er,title:So}),Nt&&clearInterval(Nt),Ao(),Nt=setInterval(Ao,Cc);const n=q.kind==="finished"?q.actionsRun:0;wn=new Set,q={kind:"idle",actionsRun:n},Vs(),Lc(e,t)}function Vs(){if(!z)return;const e=z.querySelector("[data-ap-runner-status]"),t=z.querySelector("[data-ap-runner-counter]"),n=z.querySelector("[data-ap-runner-log]"),r=z.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in q?q.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,q.kind==="finished"?(e.textContent=q.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${q.status.replace(/_/g,"-")}`,r.style.display="none",Jm(q.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(Kn.length===0&&(q.kind==="connecting"||q.kind==="idle")){if(!i){const p=document.createElement("div");p.className="ap-sdk-runner__placeholder",p.setAttribute("data-ap-runner-placeholder","1"),p.textContent="Waiting for the agent's first action…",n.appendChild(p)}}else i==null||i.remove();Sn();const a=z.querySelector("[data-ap-runner-chat-input]"),d=z.querySelector("[data-ap-runner-chat-send]");if(a&&d){const p=q.kind==="finished"&&q.status==="failed";a.disabled=p,d.disabled=p||Bt,p&&(a.placeholder="This task failed — start a new automation to continue.")}const u=z.querySelector("[data-ap-runner-cancel]");u&&(u.style.display=q.kind==="finished"?"none":"");const h=z.querySelector("[data-ap-runner-summary]");h&&q.kind!=="finished"&&(h.style.display="none",h.innerHTML="")}function Sn(){var o;if(!z)return;const e=z.querySelector("[data-ap-runner-question]"),t=z.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Ke){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Ke.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1469
+ `,z.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),z.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(z),je=cs(),jt(z),As(z,Es),z.querySelector("[data-ap-close]").addEventListener("click",()=>{Js(),o==null||o()}),z.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),Wm(t,e)}),z.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!Ws){Ws=!0,d.textContent="Confirm",So=setTimeout(To,Fm),Pr=u=>{u.target!==d&&To()},document.addEventListener("click",Pr,!0);return}To(),Bm(t,e)}),Vs(),zc(e,t)}function zc(e,t){const n=d=>L(null,null,function*(){if(ve!==e||!z||H.kind!=="idle"&&H.kind!=="connecting"||wn.has(d.commandId))return;wn.add(d.commandId);const u={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};xn({kind:"executing",command:u,actionsRun:H.kind==="idle"?H.actionsRun:0}),yield Oc(u,t,e)}),r=d=>{if(!(ve!==e||!z)&&Hm.has(d)){if(H.kind==="executing")xn({kind:"finishing",status:d,actionsRun:H.actionsRun});else if(H.kind==="connecting"||H.kind==="idle"){const u=H.kind==="idle"?H.actionsRun:0;xn({kind:"finished",status:d,actionsRun:u})}}},o=d=>{ve!==e||!z||(d.outputChunk&&Nc([d.outputChunk]),r(d.status))},i=()=>L(null,null,function*(){var d;if(!(ve!==e||!z))try{const u=yield ho(t,e);ve===e&&z&&(Xe=(d=u[0])!=null?d:null,Sn())}catch(u){}}),a=()=>L(null,null,function*(){var d;try{const[u,p,h,g]=yield Promise.all([qa(t,e),ag(t,e),ho(t,e),sg(t,e)]);if(ve!==e||!z)return;Nc(p),Xe=(d=h[0])!=null?d:null,Sn(),r(u.status),g&&g.status==="pending"&&(H.kind==="idle"||H.kind==="connecting")&&!wn.has(g.id)?(wn.add(g.id),xn({kind:"executing",command:g,actionsRun:H.kind==="idle"?H.actionsRun:0}),yield Oc(g,t,e)):H.kind==="connecting"&&xn({kind:"idle",actionsRun:0})}catch(u){}});a(),kg(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(ve!==e||H.kind==="finished"){d();return}Bt=d})}function xn(e){H=e,H.kind==="idle"&&Kn===null&&(Kn=Date.now(),Eo(),Ot=setInterval(Eo,Rc)),H.kind==="finished"&&(Ot&&(clearInterval(Ot),Ot=null),Bt==null||Bt(),Bt=null,je==null||je.hide(),Ja()),Vs()}function To(){Ws=!1,So&&(clearTimeout(So),So=null),Pr&&(document.removeEventListener("click",Pr,!0),Pr=null);const e=z==null?void 0:z.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function Bm(e,t){return L(this,null,function*(){if(ve!==t||!z)return;const n=z.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield lg(e,t)}catch(r){n&&(n.disabled=!1)}})}function $c(){if(!ve||!Ht||!Qn||!xo)return;const e=ve,t=Ht;Wa({taskId:e,backendUrl:Qn,title:xo}),Ot&&clearInterval(Ot),Eo(),Ot=setInterval(Eo,Rc);const n=H.kind==="finished"?H.actionsRun:0;wn=new Set,H={kind:"idle",actionsRun:n},Vs(),zc(e,t)}function Vs(){if(!z)return;const e=z.querySelector("[data-ap-runner-status]"),t=z.querySelector("[data-ap-runner-counter]"),n=z.querySelector("[data-ap-runner-log]"),r=z.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in H?H.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,H.kind==="finished"?(e.textContent=H.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${H.status.replace(/_/g,"-")}`,r.style.display="none",eb(H.status)):(e.textContent="running",e.className="ap-sdk-status-badge ap-sdk-status-badge--in-progress",r.style.display="block");const i=n.querySelector("[data-ap-runner-placeholder]");if(Xn.length===0&&(H.kind==="connecting"||H.kind==="idle")){if(!i){const h=document.createElement("div");h.className="ap-sdk-runner__placeholder",h.setAttribute("data-ap-runner-placeholder","1"),h.textContent="Waiting for the agent's first action…",n.appendChild(h)}}else i==null||i.remove();Sn();const a=z.querySelector("[data-ap-runner-chat-input]"),d=z.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=H.kind==="finished"&&H.status==="failed";a.disabled=h,d.disabled=h||Ft,h&&(a.placeholder="This task failed — start a new automation to continue.")}const u=z.querySelector("[data-ap-runner-cancel]");u&&(u.style.display=H.kind==="finished"?"none":"");const p=z.querySelector("[data-ap-runner-summary]");p&&H.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function Sn(){var o;if(!z)return;const e=z.querySelector("[data-ap-runner-question]"),t=z.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Xe){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Xe.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1470
1470
  <div class="ap-sdk-runner__question-label">${Xs((n==null?void 0:n.header)||"The agent has a question")}</div>
1471
- <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Ac((n==null?void 0:n.question)||Ke.question)}</div>
1471
+ <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Pc((n==null?void 0:n.question)||Xe.question)}</div>
1472
1472
  ${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
1473
- `,r.length>0){const i=e.querySelector("[data-ap-runner-question-options]");for(const a of r){const d=document.createElement("button");d.type="button",d.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",d.textContent=a.label,d.addEventListener("click",()=>void jm(a.label)),i.appendChild(d)}}}function jm(e){return I(this,null,function*(){var r;if(!z||!Ke||!ye||Bt)return;const t=ye,n=Ft;if(n){Bt=!0;try{const o={selectedOption:e};yield Ha(n,t,Ke.id,o),Ke=null,Sn();const i=yield fo(n,t);ye===t&&z&&(Ke=(r=i[0])!=null?r:null,Sn())}catch(o){const i=z.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Bt=!1}}})}function Ao(){if(!z||Qn===null)return;const e=z.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-Qn)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function zc(e,t,n){return I(this,null,function*(){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);Me==null||Me.update(a),o=Hm(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(Me==null||Me.update(a),e.action==="click")yield fg(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");Fm(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(ye===n&&z&&Bm(r,e,o),yield qm(t,n,e.id,r,o),ye!==n||!z)return;Me==null||Me.hide();const i=(q.kind==="executing"||q.kind==="finishing"?q.actionsRun:0)+1;q.kind==="finishing"?xn({kind:"finished",status:q.status,actionsRun:i}):q.kind==="executing"&&xn({kind:"idle",actionsRun:i})})}function Zm(e,t){return I(this,null,function*(){var a;if(!z||Bt||q.kind==="finished"&&q.status==="failed")return;const n=z.querySelector("[data-ap-runner-chat-input]"),r=z.querySelector("[data-ap-runner-chat-error]"),o=z.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Bt=!0,o.disabled=!0,r.style.display="none";try{if(Ke){yield Ha(e,t,Ke.id,i),Ke=null,Sn();try{const d=yield fo(e,t);ye===t&&z&&(Ke=(a=d[0])!=null?a:null,Sn())}catch(d){}}else yield ng(e,t,i),q.kind==="finished"&&Ic();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Bt=!1,o.disabled=!1}}})}function qm(e,t,n,r,o){return I(this,null,function*(){try{yield eg(e,t,n,r,o)}catch(i){}})}function Hm(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Ri(t);let n=t.outerHTML,r=!1;return n.length>Rc&&(n=n.slice(0,Rc),r=!0),`URL: ${location.href}
1473
+ `,r.length>0){const i=e.querySelector("[data-ap-runner-question-options]");for(const a of r){const d=document.createElement("button");d.type="button",d.className="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__question-option",d.textContent=a.label,d.addEventListener("click",()=>void Gm(a.label)),i.appendChild(d)}}}function Gm(e){return L(this,null,function*(){var r;if(!z||!Xe||!ve||Ft)return;const t=ve,n=Ht;if(n){Ft=!0;try{const o={selectedOption:e};yield Ba(n,t,Xe.id,o),Xe=null,Sn();const i=yield ho(n,t);ve===t&&z&&(Xe=(r=i[0])!=null?r:null,Sn())}catch(o){const i=z.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Ft=!1}}})}function Eo(){if(!z||Kn===null)return;const e=z.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-Kn)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function Oc(e,t,n){return L(this,null,function*(){let r="done",o;try{if(e.action==="getContext"){const a=e.selector?document.querySelector(e.selector):document.body;if(!a)throw new Error(`element not found (${e.selector})`);je==null||je.update(a),o=Ym(a)}else{if(!e.selector)throw new Error(`${e.action} command is missing a selector`);const a=document.querySelector(e.selector);if(!a)throw new Error(`element not found (${e.selector})`);if(je==null||je.update(a),e.action==="click")yield vg(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");Vm(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(ve===n&&z&&Xm(r,e,o),yield Jm(t,n,e.id,r,o),ve!==n||!z)return;je==null||je.hide();const i=(H.kind==="executing"||H.kind==="finishing"?H.actionsRun:0)+1;H.kind==="finishing"?xn({kind:"finished",status:H.status,actionsRun:i}):H.kind==="executing"&&xn({kind:"idle",actionsRun:i})})}function Wm(e,t){return L(this,null,function*(){var a;if(!z||Ft||H.kind==="finished"&&H.status==="failed")return;const n=z.querySelector("[data-ap-runner-chat-input]"),r=z.querySelector("[data-ap-runner-chat-error]"),o=z.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Ft=!0,o.disabled=!0,r.style.display="none";try{if(Xe){yield Ba(e,t,Xe.id,i),Xe=null,Sn();try{const d=yield ho(e,t);ve===t&&z&&(Xe=(a=d[0])!=null?a:null,Sn())}catch(d){}}else yield cg(e,t,i),H.kind==="finished"&&$c();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Ft=!1,o.disabled=!1}}})}function Jm(e,t,n,r,o){return L(this,null,function*(){try{yield ig(e,t,n,r,o)}catch(i){}})}function Ym(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Ri(t);let n=t.outerHTML,r=!1;return n.length>Ic&&(n=n.slice(0,Ic),r=!0),`URL: ${location.href}
1474
1474
  Title: ${document.title}
1475
1475
 
1476
1476
  ${n}${r?`
1477
- … (truncated)`:""}`}function Fm(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function Bm(e,t,n){var m,g;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(m=n==null?void 0:n.length)!=null?m:0} chars)`:n,d=a?` — ${a}`:"";if(Kn.push({status:e,text:`${r} ${i}${d}`}),!z)return;const u=z.querySelector("[data-ap-runner-log]");if(!u)return;(g=u.querySelector("[data-ap-runner-placeholder]"))==null||g.remove();const h=u.scrollHeight-u.scrollTop-u.clientHeight<=Pc,p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=Kn[Kn.length-1].text,u.appendChild(p),h&&(u.scrollTop=u.scrollHeight)}function Gm(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function Wm(e){const t=Gm(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function $c(e){var r;const t=e.filter(o=>o.sequence>Rr).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Rr=Math.max(Rr,...t.map(o=>o.sequence)),!z))return;const n=z.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=Wm(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=Pc,d=document.createElement("div");d.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(d.classList.add("ap-sdk-markdown"),d.innerHTML=Ac(i)):d.textContent=i,n.appendChild(d),a&&(n.scrollTop=n.scrollHeight)}}function Jm(e){if(!z||!ye||!er)return;const t=z.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${er.replace(/\/+$/,"")}/tasks/${ye}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
1477
+ … (truncated)`:""}`}function Vm(e,t){var i;const r=e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,o=(i=Object.getOwnPropertyDescriptor(r,"value"))==null?void 0:i.set;if(!o)throw new Error("target element does not accept text input");o.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function Xm(e,t,n){var g,m;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(g=n==null?void 0:n.length)!=null?g:0} chars)`:n,d=a?` — ${a}`:"";if(Xn.push({status:e,text:`${r} ${i}${d}`}),!z)return;const u=z.querySelector("[data-ap-runner-log]");if(!u)return;(m=u.querySelector("[data-ap-runner-placeholder]"))==null||m.remove();const p=u.scrollHeight-u.scrollTop-u.clientHeight<=Lc,h=document.createElement("div");h.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,h.textContent=Xn[Xn.length-1].text,u.appendChild(h),p&&(u.scrollTop=u.scrollHeight)}function Km(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function Qm(e){const t=Km(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function Nc(e){var r;const t=e.filter(o=>o.sequence>Rr).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Rr=Math.max(Rr,...t.map(o=>o.sequence)),!z))return;const n=z.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=Qm(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=Lc,d=document.createElement("div");d.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(d.classList.add("ap-sdk-markdown"),d.innerHTML=Pc(i)):d.textContent=i,n.appendChild(d),a&&(n.scrollTop=n.scrollHeight)}}function eb(e){if(!z||!ve||!Qn)return;const t=z.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${Qn.replace(/\/+$/,"")}/tasks/${ve}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed";t.style.display="block",t.innerHTML=`
1478
1478
  <div class="ap-sdk-success-card">
1479
1479
  <p class="ap-sdk-success-headline">${Xs(r)}</p>
1480
1480
  ${o?`
@@ -1494,7 +1494,7 @@ ${n}${r?`
1494
1494
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-runner-close>Close</button>
1495
1495
  </div>
1496
1496
  </div>
1497
- `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=Gs;Js(),i==null||i()}),o&&Ym(t)}function Ym(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),d=e.querySelector(".ap-sdk-runner__approval-actions"),u=p=>{a.textContent=p,a.style.display="block"};t.addEventListener("click",()=>I(null,null,function*(){if(!ye||!Ft)return;const p=ye,m=Ft;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield og(m,p),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(g){t.disabled=!1,n.disabled=!1,u(g instanceof Error?g.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const h=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",h),i.addEventListener("click",()=>I(null,null,function*(){if(!ye||!Ft)return;const p=ye,m=Ft,g=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield sg(m,p,g),g?Ic():(d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(k){i.disabled=!1,t.disabled=!1,h(),u(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function Vm(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Xm(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1497
+ `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const i=Gs;Js(),i==null||i()}),o&&tb(t)}function tb(e){const t=e.querySelector("[data-ap-runner-approve]"),n=e.querySelector("[data-ap-runner-reject]"),r=e.querySelector("[data-ap-runner-reject-form]"),o=e.querySelector("[data-ap-runner-reject-feedback]"),i=e.querySelector("[data-ap-runner-reject-submit]"),a=e.querySelector("[data-ap-runner-approval-error]"),d=e.querySelector(".ap-sdk-runner__approval-actions"),u=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>L(null,null,function*(){if(!ve||!Ht)return;const h=ve,g=Ht;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield ug(g,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,u(m instanceof Error?m.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>L(null,null,function*(){if(!ve||!Ht)return;const h=ve,g=Ht,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield dg(g,h,m),m?$c():(d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--rejected">Rejected</span>',r.style.display="none")}catch(k){i.disabled=!1,t.disabled=!1,p(),u(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function nb(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Xs(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function rb(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1498
1498
  <details class="ap-sdk-advanced__details">
1499
1499
  <summary class="ap-sdk-advanced__summary">Advanced options</summary>
1500
1500
  <div class="ap-sdk-advanced__body">
@@ -1513,12 +1513,12 @@ ${n}${r?`
1513
1513
  </div>
1514
1514
  </div>
1515
1515
  </details>
1516
- `,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let u=[];if(r){const h={backendUrl:t.backendUrl,token:t.token};Xf(h,n!=null?n:void 0).then(p=>{var g,k;if(u=p,p.length===0){i.style.display="none";return}const m=(g=p.find(y=>y.isDefault&&y.scope==="project"))!=null?g:p.find(y=>y.isDefault&&y.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+p.map(y=>`<option value="${Km(y.id)}">${Qm(y.name)}${y.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=m==null?void 0:m.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const h=document.createElement("span");h.className="ap-sdk-advanced__hint",h.textContent="Connect credentials to enable template selection",i.appendChild(h)}return{getOptions(){var m,g,k,y,A,Z,J,O;const h=a.value||null,p=h?(g=(m=u.find(T=>T.id===h))==null?void 0:m.templateData)!=null?g:{}:{};return v(v(v(v(v(v(v(v(v(v({claudeTemplateId:h,quickMode:d.checked},p.modelOverride!=null?{modelOverride:p.modelOverride}:{}),p.claudeProfileId!=null?{claudeProfileId:p.claudeProfileId}:{}),p.effort!=null?{effort:p.effort}:{}),p.executionMode!=null?{executionMode:p.executionMode}:{}),(k=p.selectedPluginIds)!=null&&k.length?{selectedPluginIds:p.selectedPluginIds}:{}),(y=p.selectedSkillIds)!=null&&y.length?{selectedSkillIds:p.selectedSkillIds}:{}),(A=p.selectedPluginSkillIds)!=null&&A.length?{selectedPluginSkillIds:p.selectedPluginSkillIds}:{}),(Z=p.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:p.selectedMcpServerIds}:{}),(J=p.selectedSlashCommandIds)!=null&&J.length?{selectedSlashCommandIds:p.selectedSlashCommandIds}:{}),(O=p.selectedRemoteContextProviderIds)!=null&&O.length?{selectedRemoteContextProviderIds:p.selectedRemoteContextProviderIds}:{})}}}function Km(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Qm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Ks="ap-sdk-captures",eb=50;function tr(){try{const e=localStorage.getItem(Ks);return e?JSON.parse(e):[]}catch(e){return[]}}function tb(e){const t=tr(),n=[e,...t].slice(0,eb);try{localStorage.setItem(Ks,JSON.stringify(n))}catch(r){}}function nb(){try{localStorage.removeItem(Ks)}catch(e){}}function Oc(e){var a,d,u,h,p;if(e.id){const m=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),g=(a=m==null?void 0:m.textContent)==null?void 0:a.trim();if(g)return g}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(r)return r;const o=(h=e.placeholder)==null?void 0:h.trim();if(o)return o;const i=(p=e.getAttribute("name"))==null?void 0:p.trim();return i||e.tagName.toLowerCase()}function rb(e,t){return`Click "${e}" ${t.toLowerCase()}`}function Nc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Dc(e,t){return`Scrolled to (${e}, ${t})`}function ob(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function Mc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1517
- `)}const sb=400,ib=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),ab=new Set(["Control","Meta","Alt","Shift"]);function cb(e){if(ab.has(e.key))return null;const t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),t.length>0?(t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join("+")):ib.has(e.key)?e.key:null}function lb(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?Oc(e):Xr(e)||e.tagName.toLowerCase()}let nr=[],Qe=null,Co=null,it=null,Dt=null,Mt=null;function Uc(){Co&&(Co.textContent=`● Recording — ${nr.length} step${nr.length===1?"":"s"}`)}function Qs(){Mt&&(clearTimeout(Mt),Mt=null),Dt&&(nr.push(Dt),Dt=null,Uc())}function ei(e){Qs(),nr.push(e),Uc()}function ub(e){var t,n,r;return e instanceof HTMLSelectElement&&(r=(n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())!=null?r:e.value}function db(e,t){it&&it(),nr=[],Dt=null,Qe=document.createElement("div"),Qe.className="ap-sdk-recorder-bar",Qe.setAttribute("data-ap-sdk","1"),Qe.innerHTML=`
1516
+ `,e.appendChild(o);const i=o.querySelector("[data-ap-adv-template-field]"),a=o.querySelector("[data-ap-template]"),d=o.querySelector("[data-ap-quickmode]");let u=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};tg(p,n!=null?n:void 0).then(h=>{var m,k;if(u=h,h.length===0){i.style.display="none";return}const g=(m=h.find(y=>y.isDefault&&y.scope==="project"))!=null?m:h.find(y=>y.isDefault&&y.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(y=>`<option value="${ob(y.id)}">${sb(y.name)}${y.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=g==null?void 0:g.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var g,m,k,y,E,Z,ee,N;const p=a.value||null,h=p?(m=(g=u.find(T=>T.id===p))==null?void 0:g.templateData)!=null?m:{}:{};return v(v(v(v(v(v(v(v(v(v({claudeTemplateId:p,quickMode:d.checked},h.modelOverride!=null?{modelOverride:h.modelOverride}:{}),h.claudeProfileId!=null?{claudeProfileId:h.claudeProfileId}:{}),h.effort!=null?{effort:h.effort}:{}),h.executionMode!=null?{executionMode:h.executionMode}:{}),(k=h.selectedPluginIds)!=null&&k.length?{selectedPluginIds:h.selectedPluginIds}:{}),(y=h.selectedSkillIds)!=null&&y.length?{selectedSkillIds:h.selectedSkillIds}:{}),(E=h.selectedPluginSkillIds)!=null&&E.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(ee=h.selectedSlashCommandIds)!=null&&ee.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(N=h.selectedRemoteContextProviderIds)!=null&&N.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function ob(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sb(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const Ks="ap-sdk-captures",ib=50;function er(){try{const e=localStorage.getItem(Ks);return e?JSON.parse(e):[]}catch(e){return[]}}function ab(e){const t=er(),n=[e,...t].slice(0,ib);try{localStorage.setItem(Ks,JSON.stringify(n))}catch(r){}}function cb(){try{localStorage.removeItem(Ks)}catch(e){}}function Dc(e){var a,d,u,p,h;if(e.id){const g=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=g==null?void 0:g.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(u=e.getAttribute("aria-label"))==null?void 0:u.trim();if(r)return r;const o=(p=e.placeholder)==null?void 0:p.trim();if(o)return o;const i=(h=e.getAttribute("name"))==null?void 0:h.trim();return i||e.tagName.toLowerCase()}function lb(e,t){return`Click "${e}" ${t.toLowerCase()}`}function Mc(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Uc(e,t){return`Scrolled to (${e}, ${t})`}function ub(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function jc(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1517
+ `)}const db=400,pb=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),hb=new Set(["Control","Meta","Alt","Shift"]);function fb(e){if(hb.has(e.key))return null;const t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),t.length>0?(t.push(e.key.length===1?e.key.toUpperCase():e.key),t.join("+")):pb.has(e.key)?e.key:null}function gb(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?Dc(e):Vr(e)||e.tagName.toLowerCase()}let tr=[],Ke=null,Ao=null,ot=null,Nt=null,Dt=null;function Zc(){Ao&&(Ao.textContent=`● Recording — ${tr.length} step${tr.length===1?"":"s"}`)}function Qs(){Dt&&(clearTimeout(Dt),Dt=null),Nt&&(tr.push(Nt),Nt=null,Zc())}function ei(e){Qs(),tr.push(e),Zc()}function mb(e){var t,n,r;return e instanceof HTMLSelectElement&&(r=(n=(t=e.selectedOptions[0])==null?void 0:t.textContent)==null?void 0:n.trim())!=null?r:e.value}function bb(e,t){ot&&ot(),tr=[],Nt=null,Ke=document.createElement("div"),Ke.className="ap-sdk-recorder-bar",Ke.setAttribute("data-ap-sdk","1"),Ke.innerHTML=`
1518
1518
  <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1519
1519
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1520
1520
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1521
- `,document.body.appendChild(Qe),Zt(Qe),Co=Qe.querySelector("[data-ap-recorder-counter]");const n=()=>{Qs();const u=nr;it==null||it(),e(u)},r=()=>{it==null||it()};Qe.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Qe.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=u=>{if(mr(u.target))return;const h=u.target;ei({action:"click",cssSelector:Vr(h),elementText:Xr(h),description:rb(Xr(h),h.tagName),capturedAt:new Date().toISOString()})},i=u=>{if(mr(u.target))return;const h=u.target;if(!(h instanceof HTMLInputElement)&&!(h instanceof HTMLTextAreaElement)&&!(h instanceof HTMLSelectElement))return;const p=Oc(h),m=eu(h),g=m?"[redacted]":ub(h);ei(j(v({action:"inputText",cssSelector:Vr(h),elementText:p,value:g},m?{redacted:!0}:{}),{description:Nc(p,g,m),capturedAt:new Date().toISOString()}))},a=()=>{const u=Math.round(window.scrollX),h=Math.round(window.scrollY);Dt?(Dt.scrollX=u,Dt.scrollY=h,Dt.description=Dc(u,h)):Dt={action:"scroll",scrollX:u,scrollY:h,description:Dc(u,h),capturedAt:new Date().toISOString()},Mt&&clearTimeout(Mt),Mt=setTimeout(()=>{Mt=null,Qs()},sb)},d=u=>{if(u.key==="Escape"){r();return}if(mr(u.target))return;const h=cb(u);if(!h)return;const p=u.target instanceof Element?u.target:document.body,m=lb(p);ei({action:"keypress",cssSelector:Vr(p),elementText:m,key:h,description:ob(h,m),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),it=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Mt&&(clearTimeout(Mt),Mt=null),Dt=null,Qe&&qt(Qe),Qe==null||Qe.remove(),Qe=null,Co=null,it=null}}function pb(){it==null||it()}function Po(){return it!==null}const hb="data-ap-sdk",fb="ap-sdk-fab",jc="ap-sdk-fab--dragging",ti="ap-sdk-fab--open",Zc="ap-sdk-fab-pos",Ro="ap-sdk-fab--left-edge",gb='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',mb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg>',bb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="8"/></svg>',kb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Ut=null,sn=null,an=null,ht=null,rr=null,or=null,sr=null,Lo=null,Lr=null,ir=null,Io=null,zo=null,$o=null,qc=0,Hc=0,Fc=0,Bc=0,ar=!1,St=!1,Ir=null,Tn=null;function _b(){Ir=e=>{if(!$){Oo();return}if(!ar){if(Math.hypot(e.clientX-Fc,e.clientY-Bc)<5)return;ar=!0,St=!0,$.classList.add(jc)}vb(e.clientX-qc,e.clientY-Hc)},Tn=()=>{if(!$){Oo();return}ar?(ar=!1,$.classList.remove(jc),$.style.transition="",yb($.getBoundingClientRect())):$.style.transition="",Oo()},window.addEventListener("pointermove",Ir),window.addEventListener("pointerup",Tn),window.addEventListener("pointercancel",Tn)}function Oo(){Ir&&(window.removeEventListener("pointermove",Ir),Ir=null),Tn&&(window.removeEventListener("pointerup",Tn),window.removeEventListener("pointercancel",Tn),Tn=null)}function vb(e,t){if(!$)return;const n=$.offsetWidth||52,r=$.offsetHeight||52;$.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,$.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,$.style.bottom="auto",$.style.right="auto"}function yb(e){if(!$)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";$.style.top="auto",$.style.bottom=`${n}px`,r==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Ro)):($.style.left="auto",$.style.right="16px",$.classList.remove(Ro));try{localStorage.setItem(Zc,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function wb(){if($)try{const e=localStorage.getItem(Zc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));$.style.top="auto",$.style.bottom=`${r}px`,t.edge==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Ro)):($.style.left="auto",$.style.right="16px",$.classList.remove(Ro))}catch(e){}}function cr(){$==null||$.classList.remove(ti),ir&&(window.removeEventListener("pointerdown",ir,{capture:!0}),ir=null)}function xb(){$&&($.classList.add(ti),ir=e=>{!$||$.contains(e.target)||cr()},requestAnimationFrame(()=>{ir&&window.addEventListener("pointerdown",ir,{capture:!0})}))}function No(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Gc(e,t,n){var d;if(Io=e,zo=t,$o=n,$)return;$=document.createElement("div"),$.className=fb,$.setAttribute(hb,"1"),rr=document.createElement("div"),rr.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ht=document.createElement("button"),ht.className="ap-sdk-fab__list ap-sdk-fab__sub",ht.setAttribute("aria-label","My captures"),ht.setAttribute("title","View my captures"),ht.appendChild(No(kb));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ht.appendChild(o),rr.appendChild(r),rr.appendChild(ht),or=document.createElement("div"),or.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",sn=document.createElement("button"),sn.className="ap-sdk-fab__capture ap-sdk-fab__sub",sn.setAttribute("aria-label","Capture element"),sn.setAttribute("title","Capture element to Agent Platform"),sn.appendChild(No(mb)),or.appendChild(i),or.appendChild(sn),sr=document.createElement("div"),sr.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",an=document.createElement("button"),an.className="ap-sdk-fab__record ap-sdk-fab__sub",an.setAttribute("aria-label","Record interaction"),an.setAttribute("title","Record a sequence of interactions"),an.appendChild(No(bb)),sr.appendChild(a),sr.appendChild(an),Ut=document.createElement("button"),Ut.className="ap-sdk-fab__main",Ut.setAttribute("aria-label","Agent Platform"),Ut.setAttribute("title","Agent Platform"),Ut.appendChild(No(gb)),$.appendChild(rr),$.appendChild(or),$.appendChild(sr),$.appendChild(Ut),Ut.addEventListener("click",u=>{if(St){St=!1;return}u.preventDefault(),u.stopPropagation(),$!=null&&$.classList.contains(ti)?cr():xb()}),sn.addEventListener("click",u=>{if(St){St=!1;return}u.preventDefault(),u.stopPropagation(),cr(),!qn()&&!Po()&&Io&&Io()}),an.addEventListener("click",u=>{if(St){St=!1;return}u.preventDefault(),u.stopPropagation(),cr(),!qn()&&!Po()&&zo&&zo()}),ht.addEventListener("click",u=>{if(St){St=!1;return}u.preventDefault(),u.stopPropagation(),cr(),$o&&$o()}),Lr=u=>{if(!$||!($===u.target||$.contains(u.target)))return;const h=$.getBoundingClientRect();qc=u.clientX-h.left,Hc=u.clientY-h.top,Fc=u.clientX,Bc=u.clientY,ar=!1,St=!1,$.style.transition="none",u.stopPropagation(),_b()},window.addEventListener("pointerdown",Lr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),Zt($),wb(),Lo=setInterval(()=>{Ut&&Ut.classList.toggle("ap-sdk-fab__main--active",qn()||Po())},200)}function En(e){const t=ht==null?void 0:ht.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Wc(){ar=!1,St=!1,Oo(),cr(),Lo&&(clearInterval(Lo),Lo=null),Lr&&(window.removeEventListener("pointerdown",Lr,{capture:!0}),Lr=null),$&&qt($),$==null||$.remove(),$=null,Ut=null,sn=null,an=null,ht=null,rr=null,or=null,sr=null,Io=null,zo=null,$o=null}function Jc(e,t){return I(this,null,function*(){try{if(e.type==="planning"){const r=yield Kf(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield ja(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function Yc(e){return e.filter(t=>!t.approved).length}function Vc(e){return I(this,null,function*(){const t=tr();if(!e||t.length===0){En(t.length);return}const n=yield Promise.all(t.map(r=>Jc(r,e)));En(Yc(n))})}let F=null,et=null,Wt=null;function zr(){return F!==null}function $r(){F&&qt(F),F==null||F.remove(),F=null,Wt==null||Wt(),Wt=null,et==null||et.destroy(),et=null}function Xc(e,t,n,r,o,i,a,d,u,h){var Ln;F&&$r();const p={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},m=!n.backendUrl||!n.token;F=document.createElement("div"),F.className="ap-sdk-panel",F.setAttribute("data-ap-sdk","1"),F.setAttribute("role","dialog"),F.setAttribute("aria-modal","true"),F.setAttribute("aria-label","Capture to Agent Platform"),F.innerHTML=`
1521
+ `,document.body.appendChild(Ke),jt(Ke),Ao=Ke.querySelector("[data-ap-recorder-counter]");const n=()=>{Qs();const u=tr;ot==null||ot(),e(u)},r=()=>{ot==null||ot()};Ke.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Ke.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=u=>{if(mr(u.target))return;const p=u.target;ei({action:"click",cssSelector:Yr(p),elementText:Vr(p),description:lb(Vr(p),p.tagName),capturedAt:new Date().toISOString()})},i=u=>{if(mr(u.target))return;const p=u.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=Dc(p),g=ru(p),m=g?"[redacted]":mb(p);ei(j(v({action:"inputText",cssSelector:Yr(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:Mc(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const u=Math.round(window.scrollX),p=Math.round(window.scrollY);Nt?(Nt.scrollX=u,Nt.scrollY=p,Nt.description=Uc(u,p)):Nt={action:"scroll",scrollX:u,scrollY:p,description:Uc(u,p),capturedAt:new Date().toISOString()},Dt&&clearTimeout(Dt),Dt=setTimeout(()=>{Dt=null,Qs()},db)},d=u=>{if(u.key==="Escape"){r();return}if(mr(u.target))return;const p=fb(u);if(!p)return;const h=u.target instanceof Element?u.target:document.body,g=gb(h);ei({action:"keypress",cssSelector:Yr(h),elementText:g,key:p,description:ub(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),ot=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Dt&&(clearTimeout(Dt),Dt=null),Nt=null,Ke&&Zt(Ke),Ke==null||Ke.remove(),Ke=null,Ao=null,ot=null}}function kb(){ot==null||ot()}function Co(){return ot!==null}const _b="data-ap-sdk",vb="ap-sdk-fab",qc="ap-sdk-fab--dragging",ti="ap-sdk-fab--open",Hc="ap-sdk-fab-pos",Po="ap-sdk-fab--left-edge",yb='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',wb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m3 3 7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/><path d="m13 13 6 6"/></svg>',xb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="8"/></svg>',Sb='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Mt=null,an=null,cn=null,ft=null,nr=null,rr=null,or=null,Ro=null,Lr=null,sr=null,Lo=null,Io=null,zo=null,Fc=0,Bc=0,Gc=0,Wc=0,ir=!1,xt=!1,Ir=null,Tn=null;function Tb(){Ir=e=>{if(!$){$o();return}if(!ir){if(Math.hypot(e.clientX-Gc,e.clientY-Wc)<5)return;ir=!0,xt=!0,$.classList.add(qc)}Eb(e.clientX-Fc,e.clientY-Bc)},Tn=()=>{if(!$){$o();return}ir?(ir=!1,$.classList.remove(qc),$.style.transition="",Ab($.getBoundingClientRect())):$.style.transition="",$o()},window.addEventListener("pointermove",Ir),window.addEventListener("pointerup",Tn),window.addEventListener("pointercancel",Tn)}function $o(){Ir&&(window.removeEventListener("pointermove",Ir),Ir=null),Tn&&(window.removeEventListener("pointerup",Tn),window.removeEventListener("pointercancel",Tn),Tn=null)}function Eb(e,t){if(!$)return;const n=$.offsetWidth||52,r=$.offsetHeight||52;$.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,$.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,$.style.bottom="auto",$.style.right="auto"}function Ab(e){if(!$)return;const n=Math.max(16,Math.min(window.innerHeight-e.bottom,window.innerHeight-52-16)),r=e.left+e.width/2<window.innerWidth/2?"left":"right";$.style.top="auto",$.style.bottom=`${n}px`,r==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Po)):($.style.left="auto",$.style.right="16px",$.classList.remove(Po));try{localStorage.setItem(Hc,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Cb(){if($)try{const e=localStorage.getItem(Hc);if(!e)return;const t=JSON.parse(e);if(typeof t.bottom!="number"||t.edge!=="left"&&t.edge!=="right")return;const r=Math.max(16,Math.min(t.bottom,window.innerHeight-52-16));$.style.top="auto",$.style.bottom=`${r}px`,t.edge==="left"?($.style.right="auto",$.style.left="16px",$.classList.add(Po)):($.style.left="auto",$.style.right="16px",$.classList.remove(Po))}catch(e){}}function ar(){$==null||$.classList.remove(ti),sr&&(window.removeEventListener("pointerdown",sr,{capture:!0}),sr=null)}function Pb(){$&&($.classList.add(ti),sr=e=>{!$||$.contains(e.target)||ar()},requestAnimationFrame(()=>{sr&&window.addEventListener("pointerdown",sr,{capture:!0})}))}function Oo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function Jc(e,t,n){var d;if(Lo=e,Io=t,zo=n,$)return;$=document.createElement("div"),$.className=vb,$.setAttribute(_b,"1"),nr=document.createElement("div"),nr.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ft=document.createElement("button"),ft.className="ap-sdk-fab__list ap-sdk-fab__sub",ft.setAttribute("aria-label","My captures"),ft.setAttribute("title","View my captures"),ft.appendChild(Oo(Sb));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ft.appendChild(o),nr.appendChild(r),nr.appendChild(ft),rr=document.createElement("div"),rr.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",an=document.createElement("button"),an.className="ap-sdk-fab__capture ap-sdk-fab__sub",an.setAttribute("aria-label","Capture element"),an.setAttribute("title","Capture element to Agent Platform"),an.appendChild(Oo(wb)),rr.appendChild(i),rr.appendChild(an),or=document.createElement("div"),or.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",cn=document.createElement("button"),cn.className="ap-sdk-fab__record ap-sdk-fab__sub",cn.setAttribute("aria-label","Record interaction"),cn.setAttribute("title","Record a sequence of interactions"),cn.appendChild(Oo(xb)),or.appendChild(a),or.appendChild(cn),Mt=document.createElement("button"),Mt.className="ap-sdk-fab__main",Mt.setAttribute("aria-label","Agent Platform"),Mt.setAttribute("title","Agent Platform"),Mt.appendChild(Oo(yb)),$.appendChild(nr),$.appendChild(rr),$.appendChild(or),$.appendChild(Mt),Mt.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),$!=null&&$.classList.contains(ti)?ar():Pb()}),an.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),ar(),!Zn()&&!Co()&&Lo&&Lo()}),cn.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),ar(),!Zn()&&!Co()&&Io&&Io()}),ft.addEventListener("click",u=>{if(xt){xt=!1;return}u.preventDefault(),u.stopPropagation(),ar(),zo&&zo()}),Lr=u=>{if(!$||!($===u.target||$.contains(u.target)))return;const p=$.getBoundingClientRect();Fc=u.clientX-p.left,Bc=u.clientY-p.top,Gc=u.clientX,Wc=u.clientY,ir=!1,xt=!1,$.style.transition="none",u.stopPropagation(),Tb()},window.addEventListener("pointerdown",Lr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),jt($),Cb(),Ro=setInterval(()=>{Mt&&Mt.classList.toggle("ap-sdk-fab__main--active",Zn()||Co())},200)}function En(e){const t=ft==null?void 0:ft.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function Yc(){ir=!1,xt=!1,$o(),ar(),Ro&&(clearInterval(Ro),Ro=null),Lr&&(window.removeEventListener("pointerdown",Lr,{capture:!0}),Lr=null),$&&Zt($),$==null||$.remove(),$=null,Mt=null,an=null,cn=null,ft=null,nr=null,rr=null,or=null,Lo=null,Io=null,zo=null}function Vc(e,t){return L(this,null,function*(){try{if(e.type==="planning"){const r=yield ng(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield qa(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function Xc(e){return e.filter(t=>!t.approved).length}function Kc(e){return L(this,null,function*(){const t=er();if(!e||t.length===0){En(t.length);return}const n=yield Promise.all(t.map(r=>Vc(r,e)));En(Xc(n))})}let V=null,Qe=null,Gt=null;function zr(){return V!==null}function $r(){V&&Zt(V),V==null||V.remove(),V=null,Gt==null||Gt(),Gt=null,Qe==null||Qe.destroy(),Qe=null}function Qc(e,t,n,r,o,i,a,d,u,p,h=null){var we;V&&$r();const g={captureType:"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1},m=!n.backendUrl||!n.token,k=og(h,"planning-sessions:write");V=document.createElement("div"),V.className="ap-sdk-panel",V.setAttribute("data-ap-sdk","1"),V.setAttribute("role","dialog"),V.setAttribute("aria-modal","true"),V.setAttribute("aria-label","Capture to Agent Platform"),V.innerHTML=`
1522
1522
  <div class="ap-sdk-panel__header">
1523
1523
  <span class="ap-sdk-panel__title">
1524
1524
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1531,7 +1531,7 @@ ${n}${r?`
1531
1531
  </div>
1532
1532
  <div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
1533
1533
  <div class="ap-sdk-panel__context" data-ap-context>
1534
- ${Kc(e)}
1534
+ ${el(e)}
1535
1535
  </div>
1536
1536
  <div class="ap-sdk-panel__pick-actions" data-ap-pick-actions>
1537
1537
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
@@ -1544,19 +1544,9 @@ ${n}${r?`
1544
1544
  </div>
1545
1545
  ${m?`
1546
1546
  <div class="ap-sdk-credentials-section" data-ap-credentials>
1547
- <p class="ap-sdk-credentials-heading">Credentials required</p>
1548
- ${n.backendUrl?"":`
1549
- <div class="ap-sdk-panel__field">
1550
- <label class="ap-sdk-panel__label" for="ap-sdk-backend-url">Backend URL</label>
1551
- <input id="ap-sdk-backend-url" class="ap-sdk-panel__input" type="url"
1552
- placeholder="https://api.yourplatform.com" autocomplete="off" data-ap-backend-url />
1553
- </div>`}
1554
- ${n.token?"":`
1555
- <div class="ap-sdk-panel__field">
1556
- <label class="ap-sdk-panel__label" for="ap-sdk-token">API Token</label>
1557
- <input id="ap-sdk-token" class="ap-sdk-panel__input" type="password"
1558
- placeholder="Your personal API token" autocomplete="off" data-ap-token />
1559
- </div>`}
1547
+ <p class="ap-sdk-credentials-heading">Connect to Agent Platform to continue</p>
1548
+ <p class="ap-sdk-config-hint">You'll be asked to approve this connection on Agent Platform's own sign-in page.</p>
1549
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect-required type="button">Connect via Agent Platform</button>
1560
1550
  </div>`:""}
1561
1551
  <div class="ap-sdk-panel__body">
1562
1552
  <div class="ap-sdk-panel__field">
@@ -1571,7 +1561,7 @@ ${n}${r?`
1571
1561
  <div class="ap-sdk-panel__field">
1572
1562
  <div class="ap-sdk-panel__label">Type</div>
1573
1563
  <div class="ap-sdk-panel__toggle">
1574
- <button class="ap-sdk-panel__toggle-btn" data-ap-type="planning">Planning Session</button>
1564
+ ${k?'<button class="ap-sdk-panel__toggle-btn" data-ap-type="planning">Planning Session</button>':""}
1575
1565
  <button class="ap-sdk-panel__toggle-btn ap-sdk-active" data-ap-type="task">Task</button>
1576
1566
  <button class="ap-sdk-panel__toggle-btn" data-ap-type="automate">Automate</button>
1577
1567
  </div>
@@ -1582,41 +1572,41 @@ ${n}${r?`
1582
1572
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
1583
1573
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
1584
1574
  </div>
1585
- `,F.addEventListener("wheel",B=>{B.stopPropagation()},{passive:!0}),F.addEventListener("touchmove",B=>{B.stopPropagation()},{passive:!0});const g=F.querySelector(".ap-sdk-panel__body"),k=Xm(g,n,(Ln=r==null?void 0:r.id)!=null?Ln:null);document.body.appendChild(F),et=cs(),p.currentPickedEl&&et.update(p.currentPickedEl),Zt(F),As(F,Es);const y=F.querySelector("[data-ap-close]"),A=F.querySelector("[data-ap-cancel]"),Z=F.querySelector("[data-ap-submit]"),J=F.querySelector("[data-ap-note]"),O=F.querySelector("[data-ap-status]"),T=F.querySelectorAll("[data-ap-type]"),S=F.querySelector("[data-ap-pick-list]"),C=F.querySelector("[data-ap-context]"),M=F.querySelector("[data-ap-add-another]"),Y=F.querySelector("[data-ap-pick-actions]"),xe=F.querySelector("[data-ap-select-parent]"),Le=F.querySelector("[data-ap-reselect]"),tt=()=>{p.currentPickedEl&&(et==null||et.update(p.currentPickedEl))};window.addEventListener("scroll",tt,{capture:!0,passive:!0}),window.addEventListener("resize",tt),Wt=()=>{window.removeEventListener("scroll",tt,!0),window.removeEventListener("resize",tt)};const re=B=>{B?(C.innerHTML=Kc(B),J.disabled=!1,J.placeholder="Describe the task or planning session…",setTimeout(()=>J.focus(),50)):(C.innerHTML=`
1575
+ `,V.addEventListener("wheel",W=>{W.stopPropagation()},{passive:!0}),V.addEventListener("touchmove",W=>{W.stopPropagation()},{passive:!0});const y=V.querySelector(".ap-sdk-panel__body"),E=rb(y,n,(we=r==null?void 0:r.id)!=null?we:null);document.body.appendChild(V),Qe=cs(),g.currentPickedEl&&Qe.update(g.currentPickedEl),jt(V),As(V,Es);const Z=V.querySelector("[data-ap-close]"),ee=V.querySelector("[data-ap-cancel]"),N=V.querySelector("[data-ap-submit]"),T=V.querySelector("[data-ap-note]"),S=V.querySelector("[data-ap-status]"),C=V.querySelectorAll("[data-ap-type]"),M=V.querySelector("[data-ap-pick-list]"),J=V.querySelector("[data-ap-context]"),ge=V.querySelector("[data-ap-add-another]"),Ze=V.querySelector("[data-ap-pick-actions]"),it=V.querySelector("[data-ap-select-parent]"),te=V.querySelector("[data-ap-reselect]"),Ee=()=>{g.currentPickedEl&&(Qe==null||Qe.update(g.currentPickedEl))};window.addEventListener("scroll",Ee,{capture:!0,passive:!0}),window.addEventListener("resize",Ee),Gt=()=>{window.removeEventListener("scroll",Ee,!0),window.removeEventListener("resize",Ee)};const et=W=>{W?(J.innerHTML=el(W),T.disabled=!1,T.placeholder="Describe the task or planning session…",setTimeout(()=>T.focus(),50)):(J.innerHTML=`
1586
1576
  <div class="ap-sdk-panel__context-label">Next element</div>
1587
1577
  <div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
1588
- `,J.disabled=!0,J.placeholder="Pick an element to continue…")},Ie=()=>{if(p.completedPicks.length===0){S.style.display="none",S.innerHTML="";return}S.style.display="block",S.innerHTML=p.completedPicks.map((B,oe)=>{var K;return`
1589
- <div class="ap-sdk-pick-entry" data-pick-index="${oe}">
1578
+ `,T.disabled=!0,T.placeholder="Pick an element to continue…")},pn=()=>{if(g.completedPicks.length===0){M.style.display="none",M.innerHTML="";return}M.style.display="block",M.innerHTML=g.completedPicks.map((W,F)=>{var Pe;return`
1579
+ <div class="ap-sdk-pick-entry" data-pick-index="${F}">
1590
1580
  <div class="ap-sdk-pick-entry__header">
1591
- <span class="ap-sdk-pick-entry__number">${oe+1}</span>
1592
- <span class="ap-sdk-pick-entry__element" title="${at((K=B.ctx.elementText)!=null?K:"")}">${at(B.ctx.elementText||"(no text)")}</span>
1593
- <button class="ap-sdk-pick-entry__remove" data-ap-remove="${oe}" aria-label="Remove pick ${oe+1}">×</button>
1581
+ <span class="ap-sdk-pick-entry__number">${F+1}</span>
1582
+ <span class="ap-sdk-pick-entry__element" title="${st((Pe=W.ctx.elementText)!=null?Pe:"")}">${st(W.ctx.elementText||"(no text)")}</span>
1583
+ <button class="ap-sdk-pick-entry__remove" data-ap-remove="${F}" aria-label="Remove pick ${F+1}">×</button>
1594
1584
  </div>
1595
- <div class="ap-sdk-pick-entry__instruction">${at(B.instruction)}</div>
1585
+ <div class="ap-sdk-pick-entry__instruction">${st(W.instruction)}</div>
1596
1586
  </div>
1597
- `}).join(""),S.querySelectorAll("[data-ap-remove]").forEach(B=>{B.addEventListener("click",()=>{const oe=parseInt(B.dataset.apRemove,10);p.completedPicks.splice(oe,1),Ie()})})},He=()=>{if(!p.currentPickedEl){Y.style.display="none";return}Y.style.display="",xe.disabled=!p.currentPickedEl.parentElement||p.awaitingPick,Le&&(Le.disabled=p.awaitingPick)},Tt=()=>{M&&(M.disabled=!J.value.trim()||p.submitting||p.awaitingPick)},dn=(B,oe)=>{p.currentCtx=B,p.currentPickedEl=oe,re(B),et==null||et.update(oe),He()};He(),xe.addEventListener("click",()=>{var oe;const B=(oe=p.currentPickedEl)==null?void 0:oe.parentElement;B&&dn(Ii(B),B)}),Le&&u&&Le.addEventListener("click",()=>{if(p.awaitingPick)return;const B=p.currentCtx,oe=p.currentPickedEl;p.awaitingPick=!0,He(),Tt(),re(null),u((K,Fe)=>{p.awaitingPick=!1,dn(K,Fe),Tt()},()=>{p.awaitingPick=!1,oe&&dn(B,oe),Tt()})});const ct=()=>{$r(),h==null||h()};y.addEventListener("click",ct),A.addEventListener("click",ct),T.forEach(B=>{B.addEventListener("click",()=>{p.captureType=B.dataset.apType,T.forEach(oe=>oe.classList.toggle("ap-sdk-active",oe===B))})});const Jt=F.querySelector("[data-ap-reconfigure]");a?Jt.addEventListener("click",()=>{ct(),a()}):Jt.style.display="none",M&&d&&(J.addEventListener("input",Tt),M.addEventListener("click",()=>{const B=J.value.trim();!B||p.awaitingPick||(p.completedPicks.push({ctx:p.currentCtx,instruction:B}),Ie(),J.value="",p.awaitingPick=!0,M.disabled=!0,He(),re(null),d((oe,K)=>{p.awaitingPick=!1,dn(oe,K),Tt()}))})),Z.addEventListener("click",()=>I(null,null,function*(){var he,Be,pn,Et;if(p.submitting)return;let B=(he=n.backendUrl)!=null?he:"",oe=(Be=n.token)!=null?Be:"";if(m){const ee=F==null?void 0:F.querySelector("[data-ap-backend-url]"),te=F==null?void 0:F.querySelector("[data-ap-token]");if(ee&&(B=ee.value.trim()),te&&(oe=te.value.trim()),!B){Or(O,"error","Backend URL is required.");return}if(!oe){Or(O,"error","API Token is required.");return}}const K=J.value.trim();if(!K){Or(O,"error","Please enter an instruction.");return}p.submitting=!0,Qc(F,!0),Or(O,null,""),Z.textContent="Submitting…";const Fe={backendUrl:B,token:oe},pe=k.getOptions(),gt=[...p.completedPicks,{ctx:p.currentCtx,instruction:K}];try{let ee=r;ee||(ee=yield Da(Fe,o),i({backendUrl:B,token:oe}));let te,nt,rt;if(gt.length===1)if(p.captureType==="task")te=(yield xs(Fe,{projectId:ee.id,note:K,ctx:p.currentCtx,advancedOpts:pe})).id,nt="task",rt=K.slice(0,120)||p.currentCtx.pageTitle||"Browser capture";else if(p.captureType==="planning"){let Ue=Yl(K,j(v({},p.currentCtx),{ancestry:p.currentCtx.outerTree||p.currentCtx.ancestry}));(pn=p.currentCtx.innerTree)!=null&&pn.trim()&&(Ue+=`
1587
+ `}).join(""),M.querySelectorAll("[data-ap-remove]").forEach(W=>{W.addEventListener("click",()=>{const F=parseInt(W.dataset.apRemove,10);g.completedPicks.splice(F,1),pn()})})},hn=()=>{if(!g.currentPickedEl){Ze.style.display="none";return}Ze.style.display="",it.disabled=!g.currentPickedEl.parentElement||g.awaitingPick,te&&(te.disabled=g.awaitingPick)},at=()=>{ge&&(ge.disabled=!T.value.trim()||g.submitting||g.awaitingPick)},St=(W,F)=>{g.currentCtx=W,g.currentPickedEl=F,et(W),Qe==null||Qe.update(F),hn()};hn(),it.addEventListener("click",()=>{var F;const W=(F=g.currentPickedEl)==null?void 0:F.parentElement;W&&St(Ii(W),W)}),te&&u&&te.addEventListener("click",()=>{if(g.awaitingPick)return;const W=g.currentCtx,F=g.currentPickedEl;g.awaitingPick=!0,hn(),at(),et(null),u((Pe,Q)=>{g.awaitingPick=!1,St(Pe,Q),at()},()=>{g.awaitingPick=!1,F&&St(W,F),at()})});const Tt=()=>{$r(),p==null||p()};Z.addEventListener("click",Tt),ee.addEventListener("click",Tt);const cr=V.querySelector("[data-ap-connect-required]");cr&&a&&cr.addEventListener("click",()=>{Tt(),a()}),C.forEach(W=>{W.addEventListener("click",()=>{g.captureType=W.dataset.apType,C.forEach(F=>F.classList.toggle("ap-sdk-active",F===W))})});const Rn=V.querySelector("[data-ap-reconfigure]");a?Rn.addEventListener("click",()=>{Tt(),a()}):Rn.style.display="none",ge&&d&&(T.addEventListener("input",at),ge.addEventListener("click",()=>{const W=T.value.trim();!W||g.awaitingPick||(g.completedPicks.push({ctx:g.currentCtx,instruction:W}),pn(),T.value="",g.awaitingPick=!0,ge.disabled=!0,hn(),et(null),d((F,Pe)=>{g.awaitingPick=!1,St(F,Pe),at()}))})),N.addEventListener("click",()=>L(null,null,function*(){var Et,xe;if(g.submitting)return;if(m){No(S,"error","Connect to Agent Platform first.");return}const W=n.backendUrl,F=n.token,Pe=T.value.trim();if(!Pe){No(S,"error","Please enter an instruction.");return}g.submitting=!0,tl(V,!0),No(S,null,""),N.textContent="Submitting…";const Q={backendUrl:W,token:F},Re=E.getOptions(),ct=[...g.completedPicks,{ctx:g.currentCtx,instruction:Pe}];try{let oe=r;oe||(oe=yield Ua(Q,o),i({backendUrl:W,token:F}));let tt,Fe,de;if(ct.length===1)if(g.captureType==="task")tt=(yield xs(Q,{projectId:oe.id,note:Pe,ctx:g.currentCtx,advancedOpts:Re})).id,Fe="task",de=Pe.slice(0,120)||g.currentCtx.pageTitle||"Browser capture";else if(g.captureType==="planning"){let $e=Kl(Pe,j(v({},g.currentCtx),{ancestry:g.currentCtx.outerTree||g.currentCtx.ancestry}));(Et=g.currentCtx.innerTree)!=null&&Et.trim()&&($e+=`
1598
1588
 
1599
1589
  Element tree:
1600
- ${p.currentCtx.innerTree}`),(Et=p.currentCtx.interactionSteps)!=null&&Et.length&&(Ue+=`
1590
+ ${g.currentCtx.innerTree}`),(xe=g.currentCtx.interactionSteps)!=null&&xe.length&&($e+=`
1601
1591
 
1602
1592
  Recorded steps:
1603
- ${Mc(p.currentCtx.interactionSteps)}`),te=(yield Ua(Fe,ee.id,Ue,pe)).id,nt="planning",rt=K.slice(0,120)||p.currentCtx.pageTitle||"Planning session"}else te=(yield Ma(Fe,{projectId:ee.id,note:K,ctx:p.currentCtx,advancedOpts:pe})).id,nt="automate",rt=K.slice(0,120)||p.currentCtx.pageTitle||"Browser automation";else{const Ue=Tb(gt),Ge=gt[0].instruction.slice(0,120)||gt[0].ctx.pageTitle||"Multi-element capture",mt=gt.map(At=>At.instruction).filter(Boolean).join(`
1593
+ ${jc(g.currentCtx.interactionSteps)}`),tt=(yield Za(Q,oe.id,$e,Re)).id,Fe="planning",de=Pe.slice(0,120)||g.currentCtx.pageTitle||"Planning session"}else tt=(yield ja(Q,{projectId:oe.id,note:Pe,ctx:g.currentCtx,advancedOpts:Re})).id,Fe="automate",de=Pe.slice(0,120)||g.currentCtx.pageTitle||"Browser automation";else{const $e=Lb(ct),Be=ct[0].instruction.slice(0,120)||ct[0].ctx.pageTitle||"Multi-element capture",Yt=ct.map(lt=>lt.instruction).filter(Boolean).join(`
1604
1594
 
1605
- `);p.captureType==="task"?(te=(yield xs(Fe,{projectId:ee.id,note:Ue,ctx:gt[0].ctx,advancedOpts:pe,titleOverride:Ge,type:Oa,titleInstruction:mt})).id,nt="task",rt=Ge):p.captureType==="planning"?(te=(yield Ua(Fe,ee.id,Ue,pe)).id,nt="planning",rt=Ge):(te=(yield Ma(Fe,{projectId:ee.id,note:Ue,ctx:gt[0].ctx,advancedOpts:pe,titleOverride:Ge,titleInstruction:mt})).id,nt="automate",rt=Ge)}if(tb({id:te,type:nt,title:rt,backendUrl:B,createdAt:new Date().toISOString()}),Vc(Fe).catch(()=>{}),m&&i({backendUrl:B,token:oe}),nt==="automate"){ct(),Ys(te,Fe,B,rt,h);return}const Oe=nt==="task"?`${B.replace(/\/+$/,"")}/tasks/${te}`:`${B.replace(/\/+$/,"")}/planning/${te}`;Eb(O,nt,rt,Oe,ct),F.classList.add("ap-sdk-panel--success"),Wt==null||Wt(),Wt=null,et==null||et.hide(),p.submitting=!1}catch(ee){Or(O,"error",ee instanceof Error?ee.message:"An unexpected error occurred."),p.submitting=!1,Qc(F,!1),Z.textContent="Submit"}})),setTimeout(()=>J.focus(),50)}const Sb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Kc(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1595
+ `);g.captureType==="task"?(tt=(yield xs(Q,{projectId:oe.id,note:$e,ctx:ct[0].ctx,advancedOpts:Re,titleOverride:Be,type:Oa,titleInstruction:Yt})).id,Fe="task",de=Be):g.captureType==="planning"?(tt=(yield Za(Q,oe.id,$e,Re)).id,Fe="planning",de=Be):(tt=(yield ja(Q,{projectId:oe.id,note:$e,ctx:ct[0].ctx,advancedOpts:Re,titleOverride:Be,titleInstruction:Yt})).id,Fe="automate",de=Be)}if(ab({id:tt,type:Fe,title:de,backendUrl:W,createdAt:new Date().toISOString()}),Kc(Q).catch(()=>{}),Fe==="automate"){Tt(),Ys(tt,Q,W,de,p);return}const Jt=Fe==="task"?`${W.replace(/\/+$/,"")}/tasks/${tt}`:`${W.replace(/\/+$/,"")}/planning/${tt}`;Ib(S,Fe,de,Jt,Tt),V.classList.add("ap-sdk-panel--success"),Gt==null||Gt(),Gt=null,Qe==null||Qe.hide(),g.submitting=!1}catch(oe){No(S,"error",oe instanceof Error?oe.message:"An unexpected error occurred."),g.submitting=!1,tl(V,!1),N.textContent="Submit"}})),setTimeout(()=>T.focus(),50)}const Rb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function el(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1606
1596
  <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
1607
1597
  <div class="ap-sdk-panel__context-steps">
1608
1598
  ${e.interactionSteps.map(r=>`
1609
1599
  <div class="ap-sdk-panel__context-step">
1610
- <span class="ap-sdk-panel__context-step-icon">${Sb[r.action]}</span>
1611
- <span class="ap-sdk-panel__context-step-text">${at(r.description)}</span>
1600
+ <span class="ap-sdk-panel__context-step-icon">${Rb[r.action]}</span>
1601
+ <span class="ap-sdk-panel__context-step-text">${st(r.description)}</span>
1612
1602
  </div>
1613
1603
  `).join("")}
1614
1604
  </div>
1615
1605
  `:`
1616
1606
  <div class="ap-sdk-panel__context-label">Captured element</div>
1617
- <div class="ap-sdk-panel__context-text" title="${at((n=e.elementText)!=null?n:"")}">${at(e.elementText||"(no text)")}</div>
1618
- ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${at(e.cssSelector)}">${at(e.cssSelector)}</div>`:""}
1619
- `}function Tb(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",Mc(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
1607
+ <div class="ap-sdk-panel__context-text" title="${st((n=e.elementText)!=null?n:"")}">${st(e.elementText||"(no text)")}</div>
1608
+ ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${st(e.cssSelector)}">${st(e.cssSelector)}</div>`:""}
1609
+ `}function Lb(e){return e.map((t,n)=>{var o,i;const r=[`## Pick ${n+1}`,""];return(o=t.ctx.interactionSteps)!=null&&o.length?r.push("Recorded steps:",jc(t.ctx.interactionSteps)):(r.push(`Element: ${t.ctx.elementText||"(no text)"}`),t.ctx.cssSelector&&r.push(`Selector: ${t.ctx.cssSelector}`),t.ctx.ancestry&&r.push(`Ancestry: ${t.ctx.ancestry}`)),r.push(`Page: ${t.ctx.pageTitle} (${t.ctx.pageUrl})`),(i=t.ctx.innerTree)!=null&&i.trim()&&r.push(`
1620
1610
  Element tree:
1621
1611
  ${t.ctx.innerTree}`),r.push("",`Instruction:
1622
1612
  ${t.instruction}`),r.join(`
@@ -1624,23 +1614,23 @@ ${t.instruction}`),r.join(`
1624
1614
 
1625
1615
  ---
1626
1616
 
1627
- `)}function Or(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Eb(e,t,n,r,o){const i=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",d=t==="task"?"View task →":"View planning session →",u=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1617
+ `)}function No(e,t,n){if(!t){e.style.display="none",e.textContent="",e.innerHTML="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function Ib(e,t,n,r,o){const i=t==="task"?"Task":"Planning",a=t==="task"?"Task created successfully!":"Planning session created!",d=t==="task"?"View task →":"View planning session →",u=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1628
1618
  <div class="ap-sdk-success-card">
1629
1619
  <svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
1630
1620
  <circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
1631
1621
  <path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
1632
1622
  </svg>
1633
- <p class="ap-sdk-success-headline">${at(a)}</p>
1623
+ <p class="ap-sdk-success-headline">${st(a)}</p>
1634
1624
  <div class="ap-sdk-success-meta">
1635
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${at(i)}</span>
1636
- <span class="ap-sdk-success-title" title="${at(n)}">${at(u)}</span>
1625
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${st(i)}</span>
1626
+ <span class="ap-sdk-success-title" title="${st(n)}">${st(u)}</span>
1637
1627
  </div>
1638
1628
  <div class="ap-sdk-success-actions">
1639
- <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${at(d)}</button>
1629
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${st(d)}</button>
1640
1630
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1641
1631
  </div>
1642
1632
  </div>
1643
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Qc(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function at(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let le=null;function el(){return le!==null}function An(){le&&qt(le),le==null||le.remove(),le=null}function Ab(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Cb(e){if(le){An();return}le=document.createElement("div"),le.className="ap-sdk-panel",le.setAttribute("data-ap-sdk","1"),le.setAttribute("role","dialog"),le.setAttribute("aria-modal","true"),le.setAttribute("aria-label","My captures"),le.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),le.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),le.innerHTML=`
1633
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function tl(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function st(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ce=null;function nl(){return ce!==null}function An(){ce&&Zt(ce),ce==null||ce.remove(),ce=null}function zb(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function $b(e){if(ce){An();return}ce=document.createElement("div"),ce.className="ap-sdk-panel",ce.setAttribute("data-ap-sdk","1"),ce.setAttribute("role","dialog"),ce.setAttribute("aria-modal","true"),ce.setAttribute("aria-label","My captures"),ce.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ce.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ce.innerHTML=`
1644
1634
  <div class="ap-sdk-panel__header">
1645
1635
  <span class="ap-sdk-panel__title">
1646
1636
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1653,18 +1643,18 @@ ${t.instruction}`),r.join(`
1653
1643
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
1654
1644
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
1655
1645
  </div>
1656
- `,document.body.appendChild(le),Zt(le),As(le,Es),le.querySelector("[data-ap-close]").addEventListener("click",()=>{An()}),le.querySelector("[data-ap-close-list]").addEventListener("click",()=>{An()}),le.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{nb(),En(0),tl(e)}),tl(e)}function tl(e){if(!le)return;const t=le.querySelector("[data-ap-list-body]"),n=tr();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
1646
+ `,document.body.appendChild(ce),jt(ce),As(ce,Es),ce.querySelector("[data-ap-close]").addEventListener("click",()=>{An()}),ce.querySelector("[data-ap-close-list]").addEventListener("click",()=>{An()}),ce.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{cb(),En(0),rl(e)}),rl(e)}function rl(e){if(!ce)return;const t=ce.querySelector("[data-ap-list-body]"),n=er();if(n.length===0){t.innerHTML='<p class="ap-sdk-list-empty">No captures yet. Use the capture button to get started.</p>';return}if(t.innerHTML=n.map(r=>`
1657
1647
  <div class="ap-sdk-list-item">
1658
1648
  <div class="ap-sdk-list-item__row">
1659
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${Ab(r.type)}</span>
1660
- <span class="ap-sdk-list-item__title" title="${Do(r.title)}">${Lb(r.title)}</span>
1649
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${zb(r.type)}</span>
1650
+ <span class="ap-sdk-list-item__title" title="${Do(r.title)}">${Db(r.title)}</span>
1661
1651
  </div>
1662
1652
  <div class="ap-sdk-list-item__row">
1663
1653
  <span class="ap-sdk-status-badge" data-ap-status="${Do(r.id)}">${e?"…":"—"}</span>
1664
- ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${Do(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${Do(Rb(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1654
+ ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${Do(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${Do(Nb(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1665
1655
  </div>
1666
1656
  </div>
1667
- `).join(""),e){const r=e;Promise.all(n.map(o=>Pb(o,r))).then(o=>{En(Yc(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(An(),Ys(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Pb(e,t){return I(this,null,function*(){const n=yield Jc(e,t),r=le==null?void 0:le.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n})}function Rb(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function Do(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Lb(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let cn=null;function Ib(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function nl(e){if(cn){const d=cn;d.cleanup(),d.popup.closed||d.popup.close(),cn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=Ib(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((d,u)=>{let h=!1;function p(){window.removeEventListener("message",m),clearInterval(g),(cn==null?void 0:cn.popup)===a&&(cn=null)}function m(k){if(k.origin!==n)return;const y=k.data;!y||y.type!=="ap-sdk-oauth"||y.state!==r||!y.code||(h=!0,p(),d({code:y.code}))}window.addEventListener("message",m);const g=window.setInterval(()=>{a.closed&&(p(),h||u(new Error("Connection cancelled.")))},500);cn={popup:a,cleanup:p}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const ni="ap-sdk-config";function zb(){try{const e=sessionStorage.getItem(ni);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(rl(),null):t}catch(e){return null}}function $b(e){sessionStorage.setItem(ni,JSON.stringify(e)),Nb({backendUrl:e.backendUrl,projectCode:e.projectCode})}function rl(){sessionStorage.removeItem(ni)}const ol="ap-sdk-last-connection";function Ob(){try{const e=localStorage.getItem(ol);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch(e){return null}}function Nb(e){try{localStorage.setItem(ol,JSON.stringify(e))}catch(t){}}let Q=null;function Cn(){Q&&qt(Q),Q==null||Q.remove(),Q=null}function Db(e){Q&&Cn(),Q=document.createElement("div"),Q.className="ap-sdk-panel",Q.setAttribute("data-ap-sdk","1"),Q.setAttribute("role","dialog"),Q.setAttribute("aria-modal","true"),Q.setAttribute("aria-label","Connect to Agent Platform");const t=Ob();t?n(t):r(""),document.body.appendChild(Q),Zt(Q);function n(i){if(!Q)return;Q.innerHTML=`
1657
+ `).join(""),e){const r=e;Promise.all(n.map(o=>Ob(o,r))).then(o=>{En(Xc(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(An(),Ys(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Ob(e,t){return L(this,null,function*(){const n=yield Vc(e,t),r=ce==null?void 0:ce.querySelector(`[data-ap-status="${CSS.escape(e.id)}"]`);return r&&(r.textContent=n.status.replace(/_/g," "),r.className=`ap-sdk-status-badge ap-sdk-status-badge--${n.status.replace(/_/g,"-")}`),n})}function Nb(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function Do(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Db(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let ln=null;function Mb(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function ol(e){if(ln){const d=ln;d.cleanup(),d.popup.closed||d.popup.close(),ln=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=Mb(),o=window.location.origin,i=`${t}/oauth/authorize?origin=${encodeURIComponent(o)}&state=${encodeURIComponent(r)}`,a=window.open(i,"ap-sdk-oauth","width=480,height=640");return a?new Promise((d,u)=>{let p=!1;function h(){window.removeEventListener("message",g),clearInterval(m),(ln==null?void 0:ln.popup)===a&&(ln=null)}function g(k){if(k.origin!==n)return;const y=k.data;!y||y.type!=="ap-sdk-oauth"||y.state!==r||!y.code||(p=!0,h(),d({code:y.code}))}window.addEventListener("message",g);const m=window.setInterval(()=>{a.closed&&(h(),p||u(new Error("Connection cancelled.")))},500);ln={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const Ub="https://agent-platform.tung.engineering",ni="ap-sdk-config";function jb(){try{const e=sessionStorage.getItem(ni);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.token)||!(t!=null&&t.projectCode)||!(t!=null&&t.expiresAt)?null:new Date(t.expiresAt).getTime()<=Date.now()?(sl(),null):t}catch(e){return null}}function Zb(e){sessionStorage.setItem(ni,JSON.stringify(e)),Hb({backendUrl:e.backendUrl,projectCode:e.projectCode})}function sl(){sessionStorage.removeItem(ni)}const il="ap-sdk-last-connection";function qb(){try{const e=localStorage.getItem(il);if(!e)return null;const t=JSON.parse(e);return!(t!=null&&t.backendUrl)||!(t!=null&&t.projectCode)?null:t}catch(e){return null}}function Hb(e){try{localStorage.setItem(il,JSON.stringify(e))}catch(t){}}let K=null;function Wt(){K&&Zt(K),K==null||K.remove(),K=null}function Fb(e){K&&Wt(),K=document.createElement("div"),K.className="ap-sdk-panel",K.setAttribute("data-ap-sdk","1"),K.setAttribute("role","dialog"),K.setAttribute("aria-modal","true"),K.setAttribute("aria-label","Connect to Agent Platform");const t=qb();t?n(t):r(Ub),document.body.appendChild(K),jt(K);function n(i){if(!K)return;K.innerHTML=`
1668
1658
  <div class="ap-sdk-panel__header">
1669
1659
  <span class="ap-sdk-panel__title">
1670
1660
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1683,7 +1673,7 @@ ${t.instruction}`),r.join(`
1683
1673
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect>Reconnect</button>
1684
1674
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-use-different>Use a different connection</button>
1685
1675
  </div>
1686
- `;const a=Q.querySelector("[data-ap-cfg-status]"),d=Q.querySelector("[data-ap-reconnect]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{Cn()}),Q.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>I(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",ln(a,null,"");try{const{code:u}=yield nl(i.backendUrl),{token:h,expiresAt:p}=yield qa({backendUrl:i.backendUrl},u,window.location.origin),m={backendUrl:i.backendUrl,token:h},g=yield Za(m);if(g.length===0){ln(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=g.find(y=>y.key===i.projectCode);k?(Cn(),e({backendUrl:i.backendUrl,token:h,projectCode:k.key,expiresAt:p})):o(i.backendUrl,h,p,g)}catch(u){ln(a,"error",`Could not connect — ${u instanceof Error?u.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!Q)return;Q.innerHTML=`
1676
+ `;const a=K.querySelector("[data-ap-cfg-status]"),d=K.querySelector("[data-ap-reconnect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Wt()}),K.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>L(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",un(a,null,"");try{const{code:u}=yield ol(i.backendUrl),{token:p,expiresAt:h}=yield Fa({backendUrl:i.backendUrl},u,window.location.origin),g={backendUrl:i.backendUrl,token:p},m=yield Ha(g);if(m.length===0){un(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=m.find(Z=>Z.key===i.projectCode);if(k){Wt(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const y=Da(window.location.href,m),E=y?m.find(Z=>Z.id===y):void 0;E?(Wt(),e({backendUrl:i.backendUrl,token:p,projectCode:E.key,expiresAt:h})):o(i.backendUrl,p,h,m)}catch(u){un(a,"error",`Could not connect — ${u instanceof Error?u.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!K)return;K.innerHTML=`
1687
1677
  <div class="ap-sdk-panel__header">
1688
1678
  <span class="ap-sdk-panel__title">
1689
1679
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1696,7 +1686,7 @@ ${t.instruction}`),r.join(`
1696
1686
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
1697
1687
  <input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
1698
1688
  placeholder="https://your-platform.example.com"
1699
- value="${sl(i)}" autocomplete="off" data-ap-cfg-url />
1689
+ value="${al(i)}" autocomplete="off" data-ap-cfg-url />
1700
1690
  </div>
1701
1691
  <p class="ap-sdk-config-hint">
1702
1692
  You'll be asked to approve this connection on Agent Platform's own sign-in page.
@@ -1707,7 +1697,7 @@ ${t.instruction}`),r.join(`
1707
1697
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect via Agent Platform</button>
1708
1698
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
1709
1699
  </div>
1710
- `;const a=Q.querySelector("[data-ap-cfg-url]"),d=Q.querySelector("[data-ap-cfg-status]"),u=Q.querySelector("[data-ap-connect]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{Cn()}),Q.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Cn()}),u.addEventListener("click",()=>I(null,null,function*(){const h=a.value.trim();if(!h){ln(d,"error","Backend URL is required.");return}u.disabled=!0,u.textContent="Connecting…",ln(d,null,"");try{const{code:p}=yield nl(h),{token:m,expiresAt:g}=yield qa({backendUrl:h},p,window.location.origin),y=yield Za({backendUrl:h,token:m});if(y.length===0){ln(d,"error","No projects found — check your account permissions."),u.disabled=!1,u.textContent="Connect via Agent Platform";return}o(h,m,g,y)}catch(p){ln(d,"error",`Could not connect — ${p instanceof Error?p.message:"please try again"}`),u.disabled=!1,u.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,u){if(!Q)return;const h=u.map(g=>`<option value="${sl(g.key)}"${g.key===(t==null?void 0:t.projectCode)?" selected":""}>${ri(g.name)} (${ri(g.key)})</option>`).join("");Q.innerHTML=`
1700
+ `;const a=K.querySelector("[data-ap-cfg-url]"),d=K.querySelector("[data-ap-cfg-status]"),u=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Wt()}),K.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Wt()}),u.addEventListener("click",()=>L(null,null,function*(){const p=a.value.trim();if(!p){un(d,"error","Backend URL is required.");return}u.disabled=!0,u.textContent="Connecting…",un(d,null,"");try{const{code:h}=yield ol(p),{token:g,expiresAt:m}=yield Fa({backendUrl:p},h,window.location.origin),y=yield Ha({backendUrl:p,token:g});if(y.length===0){un(d,"error","No projects found — check your account permissions."),u.disabled=!1,u.textContent="Connect via Agent Platform";return}const E=Da(window.location.href,y),Z=E?y.find(ee=>ee.id===E):void 0;if(Z){Wt(),e({backendUrl:p,token:g,projectCode:Z.key,expiresAt:m});return}o(p,g,m,y)}catch(h){un(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),u.disabled=!1,u.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,u){if(!K)return;const p=u.map(m=>`<option value="${al(m.key)}"${m.key===(t==null?void 0:t.projectCode)?" selected":""}>${ri(m.name)} (${ri(m.key)})</option>`).join("");K.innerHTML=`
1711
1701
  <div class="ap-sdk-panel__header">
1712
1702
  <span class="ap-sdk-panel__title">
1713
1703
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1720,7 +1710,7 @@ ${t.instruction}`),r.join(`
1720
1710
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-project">Project</label>
1721
1711
  <select id="ap-sdk-cfg-project" class="ap-sdk-panel__input" data-ap-cfg-project>
1722
1712
  <option value="">Select a project…</option>
1723
- ${h}
1713
+ ${p}
1724
1714
  </select>
1725
1715
  </div>
1726
1716
  </div>
@@ -1729,7 +1719,7 @@ ${t.instruction}`),r.join(`
1729
1719
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1730
1720
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1731
1721
  </div>
1732
- `;const p=Q.querySelector("[data-ap-cfg-project]"),m=Q.querySelector("[data-ap-cfg-status]");Q.querySelector("[data-ap-close]").addEventListener("click",()=>{Cn()}),Q.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),Q.querySelector("[data-ap-save]").addEventListener("click",()=>{const g=p.value;if(!g){ln(m,"error","Please select a project.");return}Cn(),e({backendUrl:i,token:a,projectCode:g,expiresAt:d})})}}function ln(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function sl(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ri(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let ft=null,Mo=!1;function Mb(){ft==null||ft.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),ft&&ft.observe(document.body,{childList:!0}),Mo=!1}function il(){ft||(ft=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Mo||(Mo=!0,queueMicrotask(Mb))}),ft.observe(document.body,{childList:!0}))}function Ub(){ft==null||ft.disconnect(),ft=null,Mo=!1}const jb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Ae=null,un=[];function Uo(){Ae&&qt(Ae),Ae==null||Ae.remove(),Ae=null,un=[]}function Zb(e,t,n){Ae&&Uo(),un=[...e],Ae=document.createElement("div"),Ae.className="ap-sdk-panel ap-sdk-record-review",Ae.setAttribute("data-ap-sdk","1"),Ae.setAttribute("role","dialog"),Ae.setAttribute("aria-modal","true"),Ae.setAttribute("aria-label","Review recorded steps"),Ae.innerHTML=`
1722
+ `;const h=K.querySelector("[data-ap-cfg-project]"),g=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Wt()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){un(g,"error","Please select a project.");return}Wt(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function un(e,t,n){if(!t){e.style.display="none",e.textContent="";return}e.style.display="block",e.className=`ap-sdk-panel__status ap-sdk-panel__status--${t}`,e.textContent=n}function al(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ri(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let gt=null,Mo=!1;function Bb(){gt==null||gt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),gt&&gt.observe(document.body,{childList:!0}),Mo=!1}function cl(){gt||(gt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Mo||(Mo=!0,queueMicrotask(Bb))}),gt.observe(document.body,{childList:!0}))}function Gb(){gt==null||gt.disconnect(),gt=null,Mo=!1}const Wb={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Ce=null,dn=[];function Uo(){Ce&&Zt(Ce),Ce==null||Ce.remove(),Ce=null,dn=[]}function Jb(e,t,n){Ce&&Uo(),dn=[...e],Ce=document.createElement("div"),Ce.className="ap-sdk-panel ap-sdk-record-review",Ce.setAttribute("data-ap-sdk","1"),Ce.setAttribute("role","dialog"),Ce.setAttribute("aria-modal","true"),Ce.setAttribute("aria-label","Review recorded steps"),Ce.innerHTML=`
1733
1723
  <div class="ap-sdk-panel__header">
1734
1724
  <span class="ap-sdk-panel__title">
1735
1725
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1744,11 +1734,11 @@ ${t.instruction}`),r.join(`
1744
1734
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
1745
1735
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
1746
1736
  </div>
1747
- `,document.body.appendChild(Ae),Zt(Ae);const r=Ae.querySelector("[data-ap-review-list]"),o=Ae.querySelector("[data-ap-review-continue]"),i=()=>{if(un.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=un.map((d,u)=>{var h;return`
1737
+ `,document.body.appendChild(Ce),jt(Ce);const r=Ce.querySelector("[data-ap-review-list]"),o=Ce.querySelector("[data-ap-review-continue]"),i=()=>{if(dn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=dn.map((d,u)=>{var p;return`
1748
1738
  <div class="ap-sdk-record-step" data-step-index="${u}">
1749
- <span class="ap-sdk-record-step__icon">${jb[d.action]}</span>
1750
- ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${qb((h=d.value)!=null?h:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${al(d.description)}</span>`}
1739
+ <span class="ap-sdk-record-step__icon">${Wb[d.action]}</span>
1740
+ ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${Yb((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${ll(d.description)}</span>`}
1751
1741
  <button class="ap-sdk-record-step__remove" data-ap-step-remove="${u}" aria-label="Remove step ${u+1}">✕</button>
1752
1742
  </div>
1753
- `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const u=parseInt(d.dataset.apStepRemove,10);un.splice(u,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const u=d.closest("[data-step-index]"),h=parseInt(u.dataset.stepIndex,10);d.addEventListener("input",()=>{var m;const p=un[h];p.value=d.value,p.description=Nc((m=p.elementText)!=null?m:"",d.value,!1)})})};i();const a=()=>{Uo()};Ae.querySelector("[data-ap-review-close]").addEventListener("click",a),Ae.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(un.length===0)return;const d=un,u=j(v({},Ei()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Uo(),t(u)})}function al(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function qb(e){return al(e)}let H=null,jo=null,Zo=null,qo=null;function oi(e,t,n){jo=e,Zo=t,qo=n,Gc(e,t,n)}const cl="#agent-platform-web-sdk",ll="ap-sdk-fab-unlocked";let Pn=null;function ul(){try{if(localStorage.getItem(ll)==="1")return!0}catch(e){}return window.location.hash===cl}function dl(){try{localStorage.setItem(ll,"1")}catch(e){}}function pl(e){return I(this,null,function*(){var t,n,r,o;if(fr(),!(H&&H.projectCode===e.projectCode&&H.backendUrl===((t=e.backendUrl)!=null?t:null)&&H.token===((n=e.token)!=null?n:null))){if(H={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1},oi(()=>hl(),()=>Fb(),()=>ii()),En(tr().length),H.backendUrl&&H.token){const i=H.backendUrl,a=H.token;yield kl(),Vc({backendUrl:i,token:a}).catch(()=>{});const d=hg();d&&Ys(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}il()}})}function si(e,t){return I(this,null,function*(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");H.backendUrl=e,H.token=t,H.project=null,yield kl()})}function hl(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");qn()||(fr(),us((e,t)=>I(null,null,function*(){el()&&An(),Xc(e,t,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>I(null,null,function*(){yield si(n.backendUrl,n.token)}),Rn,n=>{us((r,o)=>{zr()&&n(r,o)},()=>{fl()})},(n,r)=>{us((o,i)=>{zr()&&n(o,i)},()=>{zr()&&r()})},()=>{qn()&&ds()})}),()=>{}))}function Hb(){ds()}function Fb(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");Po()||(fr(),db(e=>{Zb(e,t=>{Xc(t,null,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>I(null,null,function*(){yield si(n.backendUrl,n.token)}),Rn,void 0,void 0,()=>{})})}))}function fl(){zr()&&$r()}function Bb(){return qn()}function gl(){Ub(),Pn&&(window.removeEventListener("hashchange",Pn),Pn=null),ds(),pb(),Uo(),$r(),An(),Wc(),jo=null,Zo=null,qo=null,H=null}function ml(){if(typeof window=="undefined"||typeof document=="undefined")return;fr();const e=zb(),t=()=>{e?bl(e).catch(console.error):(oi(()=>Rn(),()=>Rn(),()=>ii()),En(tr().length),il())};if(ul()){dl(),t();return}Pn=()=>{window.location.hash===cl&&(dl(),window.removeEventListener("hashchange",Pn),Pn=null,t())},window.addEventListener("hashchange",Pn)}function Gb(){jo&&Zo&&qo&&Gc(jo,Zo,qo)}function Wb(){Wc()}function Rn(){Db(e=>{$b(e),bl(e).catch(console.error)})}function Jb(){rl(),gl(),fr(),ul()&&(oi(()=>Rn(),()=>Rn(),()=>ii()),En(tr().length))}function bl(e){return I(this,null,function*(){yield pl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function ii(){if(el()){An();return}zr()&&$r();const e=H!=null&&H.backendUrl&&(H!=null&&H.token)?{backendUrl:H.backendUrl,token:H.token}:null;Cb(e)}function kl(){return I(this,null,function*(){if(!(!H||!H.backendUrl||!H.token||H.project||H.resolvingProject)){H.resolvingProject=!0;try{H.project=yield Da({backendUrl:H.backendUrl,token:H.token},H.projectCode)}catch(e){}finally{H&&(H.resolvingProject=!1)}}})}return ml(),ae.activateElementPicker=hl,ae.autoInit=ml,ae.clearConfig=Jb,ae.closePanelIfOpen=fl,ae.configure=Rn,ae.deactivateElementPicker=Hb,ae.destroy=gl,ae.hideFab=Wb,ae.init=pl,ae.isPickerRunning=Bb,ae.showFab=Gb,ae.updateCredentials=si,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"}),ae})({});
1743
+ `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const u=parseInt(d.dataset.apStepRemove,10);dn.splice(u,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const u=d.closest("[data-step-index]"),p=parseInt(u.dataset.stepIndex,10);d.addEventListener("input",()=>{var g;const h=dn[p];h.value=d.value,h.description=Mc((g=h.elementText)!=null?g:"",d.value,!1)})})};i();const a=()=>{Uo()};Ce.querySelector("[data-ap-review-close]").addEventListener("click",a),Ce.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(dn.length===0)return;const d=dn,u=j(v({},Ei()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Uo(),t(u)})}function ll(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Yb(e){return ll(e)}let q=null,jo=null,Zo=null,qo=null;function oi(e,t,n){jo=e,Zo=t,qo=n,Jc(e,t,n)}const ul="#agent-platform-web-sdk",dl="ap-sdk-fab-unlocked";let Cn=null;function pl(){try{if(localStorage.getItem(dl)==="1")return!0}catch(e){}return window.location.hash===ul}function hl(){try{localStorage.setItem(dl,"1")}catch(e){}}function fl(e){return L(this,null,function*(){var t,n,r,o;if(fr(),!(q&&q.projectCode===e.projectCode&&q.backendUrl===((t=e.backendUrl)!=null?t:null)&&q.token===((n=e.token)!=null?n:null))){if(q={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1,permissions:null},oi(()=>gl(),()=>Xb(),()=>ii()),En(er().length),q.backendUrl&&q.token){const i=q.backendUrl,a=q.token;yield yl(),Kc({backendUrl:i,token:a}).catch(()=>{}),vl({backendUrl:i,token:a}).catch(()=>{});const d=_g();d&&Ys(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}cl()}})}function si(e,t){return L(this,null,function*(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");q.backendUrl=e,q.token=t,q.project=null,q.permissions=null,yield yl(),vl({backendUrl:e,token:t}).catch(()=>{})})}function gl(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");Zn()||(fr(),us((e,t)=>L(null,null,function*(){nl()&&An(),Qc(e,t,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,n=>L(null,null,function*(){yield si(n.backendUrl,n.token)}),Pn,n=>{us((r,o)=>{zr()&&n(r,o)},()=>{ml()})},(n,r)=>{us((o,i)=>{zr()&&n(o,i)},()=>{zr()&&r()})},()=>{Zn()&&ds()},q.permissions)}),()=>{}))}function Vb(){ds()}function Xb(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");Co()||(fr(),bb(e=>{Jb(e,t=>{Qc(t,null,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,n=>L(null,null,function*(){yield si(n.backendUrl,n.token)}),Pn,void 0,void 0,()=>{},q.permissions)})}))}function ml(){zr()&&$r()}function Kb(){return Zn()}function bl(){Gb(),Cn&&(window.removeEventListener("hashchange",Cn),Cn=null),ds(),kb(),Uo(),$r(),An(),Yc(),jo=null,Zo=null,qo=null,q=null}function kl(){if(typeof window=="undefined"||typeof document=="undefined")return;fr();const e=jb(),t=()=>{e?_l(e).catch(console.error):(oi(()=>Pn(),()=>Pn(),()=>ii()),En(er().length),cl())};if(pl()){hl(),t();return}Cn=()=>{window.location.hash===ul&&(hl(),window.removeEventListener("hashchange",Cn),Cn=null,t())},window.addEventListener("hashchange",Cn)}function Qb(){jo&&Zo&&qo&&Jc(jo,Zo,qo)}function ek(){Yc()}function Pn(){Fb(e=>{Zb(e),_l(e).catch(console.error)})}function tk(){sl(),bl(),fr(),pl()&&(oi(()=>Pn(),()=>Pn(),()=>ii()),En(er().length))}function _l(e){return L(this,null,function*(){yield fl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function ii(){if(nl()){An();return}zr()&&$r();const e=q!=null&&q.backendUrl&&(q!=null&&q.token)?{backendUrl:q.backendUrl,token:q.token}:null;$b(e)}function vl(e){return L(this,null,function*(){const t=yield rg(e);q&&(q.permissions=t.permissions)})}function yl(){return L(this,null,function*(){if(!(!q||!q.backendUrl||!q.token||q.project||q.resolvingProject)){q.resolvingProject=!0;try{q.project=yield Ua({backendUrl:q.backendUrl,token:q.token},q.projectCode)}catch(e){}finally{q&&(q.resolvingProject=!1)}}})}return kl(),ie.activateElementPicker=gl,ie.autoInit=kl,ie.clearConfig=tk,ie.closePanelIfOpen=ml,ie.configure=Pn,ie.deactivateElementPicker=Vb,ie.destroy=bl,ie.hideFab=ek,ie.init=fl,ie.isPickerRunning=Kb,ie.showFab=Qb,ie.updateCredentials=si,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"}),ie})({});
1754
1744
  //# sourceMappingURL=web-sdk.min.js.map