@tung-engineering/agent-platform-web-sdk 0.0.79 → 0.0.81

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.
package/dist/web-sdk.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Uu=Object.defineProperty,Zu=Object.defineProperties;var qu=Object.getOwnPropertyDescriptors;var Li=Object.getOwnPropertySymbols;var Hu=Object.prototype.hasOwnProperty,Fu=Object.prototype.propertyIsEnumerable;var zi=Math.pow,ds=(e,t,n)=>t in e?Uu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))Hu.call(t,n)&&ds(e,n,t[n]);if(Li)for(var n of Li(t))Fu.call(t,n)&&ds(e,n,t[n]);return e},D=(e,t)=>Zu(e,qu(t));var se=(e,t,n)=>ds(e,typeof t!="symbol"?t+"":t,n);var L=(e,t,n)=>new Promise((r,o)=>{var i=l=>{try{d(n.next(l))}catch(p){o(p)}},a=l=>{try{d(n.throw(l))}catch(p){o(p)}},d=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,a);d((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Bu=`
1
+ "use strict";var qu=Object.defineProperty,Hu=Object.defineProperties;var Fu=Object.getOwnPropertyDescriptors;var Ii=Object.getOwnPropertySymbols;var Bu=Object.prototype.hasOwnProperty,Gu=Object.prototype.propertyIsEnumerable;var $i=Math.pow,hs=(e,t,n)=>t in e?qu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))Bu.call(t,n)&&hs(e,n,t[n]);if(Ii)for(var n of Ii(t))Gu.call(t,n)&&hs(e,n,t[n]);return e},D=(e,t)=>Hu(e,Fu(t));var se=(e,t,n)=>hs(e,typeof t!="symbol"?t+"":t,n);var z=(e,t,n)=>new Promise((r,o)=>{var i=l=>{try{d(n.next(l))}catch(p){o(p)}},a=l=>{try{d(n.throw(l))}catch(p){o(p)}},d=l=>l.done?r(l.value):Promise.resolve(l.value).then(i,a);d((n=n.apply(e,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Wu=`
2
2
  :where([data-ap-sdk][popover]) {
3
3
  position: fixed;
4
4
  margin: 0;
@@ -9,7 +9,7 @@
9
9
  overflow: visible;
10
10
  inset: auto;
11
11
  }
12
- `,Gu=`
12
+ `,Ju=`
13
13
  @keyframes ap-sdk-panel-in {
14
14
  from { opacity: 0; transform: translateY(-50%) translateX(16px) scale(0.98); }
15
15
  to { opacity: 1; transform: translateY(-50%) translateX(0) scale(1); }
@@ -303,7 +303,7 @@
303
303
  color: #991b1b;
304
304
  border: 1px solid #fca5a5;
305
305
  }
306
- `,Wu=`
306
+ `,Vu=`
307
307
  .ap-sdk-highlight {
308
308
  position: fixed;
309
309
  pointer-events: none;
@@ -314,7 +314,7 @@
314
314
  z-index: 2147483645;
315
315
  transition: top 60ms ease, left 60ms ease, width 60ms ease, height 60ms ease;
316
316
  }
317
- `,Ju=`
317
+ `,Yu=`
318
318
  .ap-sdk-picker-cursor {
319
319
  position: fixed;
320
320
  bottom: 16px;
@@ -388,7 +388,7 @@
388
388
  background: rgba(255, 255, 255, 0.12);
389
389
  opacity: 1;
390
390
  }
391
- `,Vu=`
391
+ `,Xu=`
392
392
  .ap-sdk-recorder-bar {
393
393
  position: fixed;
394
394
  bottom: 16px;
@@ -442,7 +442,7 @@
442
442
  .ap-sdk-recorder-bar__btn--stop:hover {
443
443
  background: oklch(95% 0.035 50);
444
444
  }
445
- `,Yu=`
445
+ `,Ku=`
446
446
  .ap-sdk-panel__context {
447
447
  padding: 10px 16px;
448
448
  background: #f9fafb;
@@ -672,7 +672,7 @@
672
672
  font-style: italic;
673
673
  white-space: normal;
674
674
  }
675
- `,Xu=`
675
+ `,Qu=`
676
676
  .ap-sdk-fab {
677
677
  position: fixed;
678
678
  bottom: 20px;
@@ -802,7 +802,7 @@
802
802
  line-height: 1;
803
803
  pointer-events: none;
804
804
  }
805
- `,Ku=`
805
+ `,ed=`
806
806
  .ap-sdk-advanced {
807
807
  border-top: 1px solid #f3f4f6;
808
808
  padding-top: 8px;
@@ -858,7 +858,7 @@
858
858
  color: #9ca3af;
859
859
  margin-top: 2px;
860
860
  }
861
- `,Qu=`
861
+ `,td=`
862
862
  .ap-sdk-list-body {
863
863
  padding: 8px 0;
864
864
  max-height: 320px;
@@ -983,7 +983,7 @@ button.ap-sdk-list-item__link {
983
983
  .ap-sdk-status-link:hover {
984
984
  color: oklch(47% 0.13 40);
985
985
  }
986
- `,ed=`
986
+ `,nd=`
987
987
  .ap-sdk-record-review__list {
988
988
  max-height: 320px;
989
989
  overflow-y: auto;
@@ -1044,7 +1044,7 @@ button.ap-sdk-list-item__link {
1044
1044
  color: #ef4444;
1045
1045
  background: #fee2e2;
1046
1046
  }
1047
- `,td=`
1047
+ `,rd=`
1048
1048
  @keyframes ap-sdk-card-in {
1049
1049
  from { opacity: 0; transform: scale(0.97); }
1050
1050
  to { opacity: 1; transform: scale(1); }
@@ -1123,7 +1123,7 @@ button.ap-sdk-list-item__link {
1123
1123
  flex: 1;
1124
1124
  white-space: nowrap;
1125
1125
  }
1126
- `,nd=`
1126
+ `,od=`
1127
1127
  .ap-sdk-runner__approval {
1128
1128
  margin-top: 14px;
1129
1129
  display: flex;
@@ -1259,6 +1259,41 @@ button.ap-sdk-list-item__link {
1259
1259
  white-space: nowrap;
1260
1260
  }
1261
1261
 
1262
+ .ap-sdk-runner__log-toolbar {
1263
+ display: flex;
1264
+ justify-content: flex-end;
1265
+ gap: 6px;
1266
+ padding: 6px 16px 0;
1267
+ }
1268
+
1269
+ .ap-sdk-runner__scroll-toggle,
1270
+ .ap-sdk-runner__scroll-jump {
1271
+ font-family: inherit;
1272
+ font-size: 10.5px;
1273
+ font-weight: 600;
1274
+ line-height: 1.4;
1275
+ padding: 2px 8px;
1276
+ border-radius: 999px;
1277
+ border: 1px solid #e5e7eb;
1278
+ background: #fff;
1279
+ color: #6b7280;
1280
+ cursor: pointer;
1281
+ }
1282
+
1283
+ .ap-sdk-runner__scroll-toggle:hover,
1284
+ .ap-sdk-runner__scroll-jump:hover {
1285
+ color: #374151;
1286
+ }
1287
+
1288
+ /* Signals "currently sticking to the bottom" — same accent used for
1289
+ successful log-entry status text below, so it reads as an active/on state
1290
+ rather than a plain neutral button. */
1291
+ .ap-sdk-runner__scroll-toggle--active {
1292
+ background: oklch(96% 0.03 42);
1293
+ border-color: oklch(80% 0.08 42);
1294
+ color: oklch(38% 0.13 40);
1295
+ }
1296
+
1262
1297
  .ap-sdk-runner__log {
1263
1298
  padding: 10px 16px;
1264
1299
  max-height: 240px;
@@ -1410,7 +1445,7 @@ button.ap-sdk-list-item__link {
1410
1445
  font-style: italic;
1411
1446
  padding: 4px 0;
1412
1447
  }
1413
- `,rd=`
1448
+ `,sd=`
1414
1449
  .ap-sdk-resize-handle {
1415
1450
  position: absolute;
1416
1451
  bottom: 2px;
@@ -1432,12 +1467,12 @@ button.ap-sdk-list-item__link {
1432
1467
  border-right: 2px solid #d1d5db;
1433
1468
  border-bottom: 2px solid #d1d5db;
1434
1469
  }
1435
- `,od=[Bu,Gu,Wu,Ju,Vu,Yu,Xu,Ku,Qu,ed,td,nd,rd].join(`
1436
- `);let Ii=!1;function Zr(){if(Ii)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=od,document.head.appendChild(e),Ii=!0}function _o(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 Lo(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 sd=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function vo(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 l=e.getAttribute(d);if(!l)return;i.add(d);const p=l.length>80?l.slice(0,80)+"…":l;o.push(`[${d}="${p}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of sd)a(d);return`${t}${n}${r}${o.join("")}`}function id(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 ad(e,t=5,n=10){function r(o,i){const a=vo(o),d=" ".repeat(i),l=Array.from(o.children).slice(0,n);if(i>=t||l.length===0){const p=id(o);return p?`${d}${a} "${p}"`:`${d}${a}`}return[`${d}${a}`,...l.map(p=>r(p,i+1))].join(`
1437
- `)}return r(e,0)}const cd='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"]',ld={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function so(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function ud(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(cd);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function dd(e,t=80){var a,d,l;const n=ld[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 so(p,t)}const r=ud(e);if(r)return so(r,t);const o=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(o)return so(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var m,g,k;return(k=(g=(m=document.getElementById(h))==null?void 0:m.textContent)==null?void 0:g.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return so(p,t)}return""}function pd(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":dd(o),a=i&&!r.has(i)?`${vo(o)} ["${i}"]`:vo(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||vo(e)}function qa(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function xr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Ha(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>xr('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(()=>xr('meta[property="og:title"]')),ogDescription:e(()=>xr('meta[property="og:description"]')),ogType:e(()=>xr('meta[property="og:type"]')),ogSiteName:e(()=>xr('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?qa(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function hd(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 fd(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}: ${qa(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function gd(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(`
1438
- `)}const nr=new Set;let Yn=null,zo=!1,Es=!1;function md(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function bd(){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(!(nr.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&md(r))return!0}return!1}function Fa(){const e=bd(),t=e&&!Es;Es=e;for(const n of nr){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 $i(e){if(!(e instanceof Node))return!1;for(const t of nr)if(t===e||t.contains(e))return!0;return!1}function Xn(e){($i(e.target)||"relatedTarget"in e&&$i(e.relatedTarget))&&e.stopPropagation()}function kd(){zo||(window.addEventListener("focusin",Xn,!0),window.addEventListener("focusout",Xn,!0),window.addEventListener("pointerdown",Xn,!0),zo=!0),!Yn&&(Yn=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")&&Fa()}),Yn.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"),nr.add(e),kd(),Fa())}function Vt(e){if(nr.delete(e),nr.size===0&&(Yn&&(Yn.disconnect(),Yn=null),zo&&(window.removeEventListener("focusin",Xn,!0),window.removeEventListener("focusout",Xn,!0),window.removeEventListener("pointerdown",Xn,!0),zo=!1),Es=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function Us(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:()=>{Vt(t),t.remove()}}}const Ba=/^cc-|current-password|new-password/i,_d=/token|secret|password|apikey|auth/i,ps="[redacted]";function vd(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Ba.test(t)}function Ga(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ps);const r=n.getAttribute("autocomplete");r&&Ba.test(r)&&n.setAttribute("value",ps);for(const o of Array.from(n.attributes))_d.test(o.name)&&n.setAttribute(o.name,ps)}}const yd="🎯 Click any element to capture";let un=null,Oe=null,Ue=null;function zr(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 wd(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function Oi(e){un==null||un.update(e)}function Wa(e){const t=Ha(),n=hd(e),r=fd(e);let o;try{const i=e.cloneNode(!0);Ga(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return y(y({pageUrl:window.location.href,pageTitle:document.title,elementText:Lo(e),cssSelector:_o(e),innerTree:ad(e),outerTree:pd(e),elementOuterHtml:o,ancestry:n},r),t)}function hs(e,t){Ue&&Ue();const n=wd();un=Us(),Oe=document.createElement("div"),Oe.className="ap-sdk-picker-cursor",Oe.setAttribute("data-ap-sdk","1"),Oe.textContent=n?"Tap any element to preview":yd,document.body.appendChild(Oe),Jt(Oe);let r=null,o=null;const i=h=>{Ue==null||Ue(),e(Wa(h),h)},a=h=>{if(o=h,Oi(h),!Oe)return;Oe.classList.add("ap-sdk-picker-cursor--confirm"),Oe.innerHTML="";const m=document.createElement("span");m.className="ap-sdk-picker-cursor__label",m.textContent=`<${h.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",T=>{T.preventDefault(),T.stopPropagation(),Ue==null||Ue(),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",T=>{T.preventDefault(),T.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const v=document.createElement("button");v.type="button",v.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",v.textContent="✓ Select",v.setAttribute("data-ap-sdk","1"),v.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),o&&i(o)}),Oe.appendChild(m),Oe.appendChild(g),Oe.appendChild(k),Oe.appendChild(v)},d=h=>{zr(h.target)||(r=h.target,Oi(r))},l=h=>{var g;if(zr(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const m=(g=h.target)!=null?g:r;if(m){if(n){a(m);return}i(m)}},p=h=>{h.key==="Escape"&&(Ue==null||Ue(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",l,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Ue=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",l,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Oe&&Vt(Oe),Oe==null||Oe.remove(),un==null||un.destroy(),un=null,Oe=null,o=null,Ue=null}}function Zs(){Ue==null||Ue()}function Kn(){return Ue!==null}const io={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(l,p){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,p);const h=a.prototype,m=Object.keys(h);for(let g=0;g<m.length;g++){const k=m[g];k in l||(l[k]=h[k].bind(l))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var m;var p;const h=n!=null&&n.Parent?new i:this;r(h,l),(m=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var p,h;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(h=(p=l==null?void 0:l._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 Ja extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Va={};function dn(e){return Va}function Ya(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 As(e,t){return typeof t=="bigint"?t.toString():t}function Vo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function qs(e){return e==null}function Hs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function xd(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 l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(o=Number.parseInt(l[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/zi(10,i)}const Ni=Symbol("evaluating");function ne(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 $n(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function hn(...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 Sd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Xa="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Mr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Td=Vo(()=>{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 rr(e){if(Mr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Mr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Ka(e){return rr(e)?y({},e):Array.isArray(e)?[...e]:e}const Ed=new Set(["string","number","symbol"]);function or(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function fn(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 U(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"?D(y({},t),{error:()=>t.error}):t}function Ad(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Cd={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 Pd(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=hn(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 $n(this,"shape",a),a},checks:[]});return fn(e,i)}function Rd(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=hn(e._zod.def,{get shape(){const a=y({},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 $n(this,"shape",a),a},checks:[]});return fn(e,i)}function Ld(e,t){if(!rr(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=hn(e._zod.def,{get shape(){const i=y(y({},e._zod.def.shape),t);return $n(this,"shape",i),i}});return fn(e,o)}function zd(e,t){if(!rr(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=hn(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t);return $n(this,"shape",r),r}});return fn(e,n)}function Id(e,t){const n=hn(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t._zod.def.shape);return $n(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return fn(e,n)}function $d(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=hn(t._zod.def,{get shape(){const d=t._zod.def.shape,l=y({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(l[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)l[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return $n(this,"shape",l),l},checks:[]});return fn(t,a)}function Od(e,t,n){const r=hn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=y({},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 $n(this,"shape",i),i}});return fn(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 ao(e){return typeof e=="string"?e:e==null?void 0:e.message}function pn(e,t,n){var o,i,a,d,l,p,h,m,g,k,v;const r=D(y({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const T=(v=(k=(m=(p=ao((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:ao((l=t==null?void 0:t.error)==null?void 0:l.call(t,e)))!=null?m:ao((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:ao((g=n.localeError)==null?void 0:g.call(n,e)))!=null?v:"Invalid input";r.message=T}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Fs(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function jr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:y({},t)}const Qa=(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,As,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ec=w("$ZodError",Qa),tc=w("$ZodError",Qa,{Parent:Error});function Nd(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 Dd(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 l=i.path[d];d===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return r(e),n}const Bs=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 l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>pn(p,i,dn())));throw Xa(l,o==null?void 0:o.callee),l}return a.value},Gs=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 l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>pn(p,i,dn())));throw Xa(l,o==null?void 0:o.callee),l}return a.value}),Yo=e=>(t,n,r)=>{const o=r?D(y({},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:ec)(i.issues.map(a=>pn(a,o,dn())))}:{success:!0,data:i.value}},Md=Yo(tc),Xo=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=>pn(a,o,dn())))}:{success:!0,data:i.value}}),jd=Xo(tc),Ud=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Bs(e)(t,n,o)},Zd=e=>(t,n,r)=>Bs(e)(t,n,r),qd=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Gs(e)(t,n,o)}),Hd=e=>(t,n,r)=>L(null,null,function*(){return Gs(e)(t,n,r)}),Fd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Yo(e)(t,n,o)},Bd=e=>(t,n,r)=>Yo(e)(t,n,r),Gd=e=>(t,n,r)=>L(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xo(e)(t,n,o)}),Wd=e=>(t,n,r)=>L(null,null,function*(){return Xo(e)(t,n,r)}),Jd=/^[cC][^\s-]{8,}$/,Vd=/^[0-9a-z]+$/,Yd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Xd=/^[0-9a-vA-V]{20}$/,Kd=/^[A-Za-z0-9]{27}$/,Qd=/^[a-zA-Z0-9_-]{21}$/,ep=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,tp=/^([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})$/,Mi=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)$/,np=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,rp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function op(){return new RegExp(rp,"u")}const sp=/^(?:(?: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])$/,ip=/^(([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}|:))$/,ap=/^((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])$/,cp=/^(([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])$/,lp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nc=/^[A-Za-z0-9_-]*$/,up=/^\+[1-9]\d{6,14}$/,rc="(?:(?:\\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])))",dp=new RegExp(`^${rc}$`);function oc(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 pp(e){return new RegExp(`^${oc(e)}$`)}function hp(e){const t=oc({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(`^${rc}T(?:${r})$`)}const fp=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}$`)},gp=/^-?\d+$/,sc=/^-?\d+(?:\.\d+)?$/,mp=/^(?:true|false)$/i,bp=/^[^A-Z]*$/,kp=/^[^a-z]*$/,nt=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=[])}),ic={number:"number",bigint:"bigint",object:"date"},ac=w("$ZodCheckLessThan",(e,t)=>{nt.init(e,t);const n=ic[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})}}),cc=w("$ZodCheckGreaterThan",(e,t)=>{nt.init(e,t);const n=ic[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})}}),_p=w("$ZodCheckMultipleOf",(e,t)=>{nt.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):xd(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})}}),vp=w("$ZodCheckNumberFormat",(e,t)=>{var a;nt.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]=Cd[t.format];e._zod.onattach.push(d=>{const l=d._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=gp)}),e._zod.check=d=>{const l=d.value;if(n){if(!Number.isInteger(l)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?d.issues.push({input:l,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:l,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}}l<o&&d.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&d.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),yp=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!qs(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=Fs(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),wp=w("$ZodCheckMinLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!qs(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=Fs(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),xp=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!qs(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=Fs(i),l=a>t.length;o.issues.push(D(y({origin:d},l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),Ko=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;nt.init(e,t),e._zod.onattach.push(a=>{var l;const d=a._zod.bag;d.format=t.format,t.pattern&&((l=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(D(y({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=()=>{})}),Sp=w("$ZodCheckRegex",(e,t)=>{Ko.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})}}),Tp=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bp),Ko.init(e,t)}),Ep=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=kp),Ko.init(e,t)}),Ap=w("$ZodCheckIncludes",(e,t)=>{nt.init(e,t);const n=or(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})}}),Cp=w("$ZodCheckStartsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`^${or(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})}}),Pp=w("$ZodCheckEndsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`.*${or(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})}}),Rp=w("$ZodCheckOverwrite",(e,t)=>{nt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Lp{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(`
1470
+ `,id=[Wu,Ju,Vu,Yu,Xu,Ku,Qu,ed,td,nd,rd,od,sd].join(`
1471
+ `);let Oi=!1;function qr(){if(Oi)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=id,document.head.appendChild(e),Oi=!0}function vo(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 Io(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 ad=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function yo(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 l=e.getAttribute(d);if(!l)return;i.add(d);const p=l.length>80?l.slice(0,80)+"…":l;o.push(`[${d}="${p}"]`)};for(const d of Array.from(e.attributes))d.name.startsWith("aria-")&&a(d.name);for(const d of ad)a(d);return`${t}${n}${r}${o.join("")}`}function cd(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 ld(e,t=5,n=10){function r(o,i){const a=yo(o),d=" ".repeat(i),l=Array.from(o.children).slice(0,n);if(i>=t||l.length===0){const p=cd(o);return p?`${d}${a} "${p}"`:`${d}${a}`}return[`${d}${a}`,...l.map(p=>r(p,i+1))].join(`
1472
+ `)}return r(e,0)}const ud='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"]',dd={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function io(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function pd(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(ud);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function hd(e,t=80){var a,d,l;const n=dd[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 io(p,t)}const r=pd(e);if(r)return io(r,t);const o=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(o)return io(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var m,g,k;return(k=(g=(m=document.getElementById(h))==null?void 0:m.textContent)==null?void 0:g.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return io(p,t)}return""}function fd(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":hd(o),a=i&&!r.has(i)?`${yo(o)} ["${i}"]`:yo(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||yo(e)}function Ba(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function Sr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Ga(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>Sr('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(()=>Sr('meta[property="og:title"]')),ogDescription:e(()=>Sr('meta[property="og:description"]')),ogType:e(()=>Sr('meta[property="og:type"]')),ogSiteName:e(()=>Sr('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?Ba(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function gd(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 md(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}: ${Ba(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function bd(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(`
1473
+ `)}const rr=new Set;let Xn=null,$o=!1,Cs=!1;function kd(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function _d(){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(!(rr.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&kd(r))return!0}return!1}function Wa(){const e=_d(),t=e&&!Cs;Cs=e;for(const n of rr){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 Ni(e){if(!(e instanceof Node))return!1;for(const t of rr)if(t===e||t.contains(e))return!0;return!1}function Kn(e){(Ni(e.target)||"relatedTarget"in e&&Ni(e.relatedTarget))&&e.stopPropagation()}function vd(){$o||(window.addEventListener("focusin",Kn,!0),window.addEventListener("focusout",Kn,!0),window.addEventListener("pointerdown",Kn,!0),$o=!0),!Xn&&(Xn=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")&&Wa()}),Xn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Vt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),rr.add(e),vd(),Wa())}function Yt(e){if(rr.delete(e),rr.size===0&&(Xn&&(Xn.disconnect(),Xn=null),$o&&(window.removeEventListener("focusin",Kn,!0),window.removeEventListener("focusout",Kn,!0),window.removeEventListener("pointerdown",Kn,!0),$o=!1),Cs=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function qs(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),Vt(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:()=>{Yt(t),t.remove()}}}const Ja=/^cc-|current-password|new-password/i,yd=/token|secret|password|apikey|auth/i,fs="[redacted]";function wd(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Ja.test(t)}function Va(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",fs);const r=n.getAttribute("autocomplete");r&&Ja.test(r)&&n.setAttribute("value",fs);for(const o of Array.from(n.attributes))yd.test(o.name)&&n.setAttribute(o.name,fs)}}const xd="🎯 Click any element to capture";let dn=null,Oe=null,Ue=null;function Ir(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 Sd(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function Di(e){dn==null||dn.update(e)}function Ya(e){const t=Ga(),n=gd(e),r=md(e);let o;try{const i=e.cloneNode(!0);Va(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return y(y({pageUrl:window.location.href,pageTitle:document.title,elementText:Io(e),cssSelector:vo(e),innerTree:ld(e),outerTree:fd(e),elementOuterHtml:o,ancestry:n},r),t)}function gs(e,t){Ue&&Ue();const n=Sd();dn=qs(),Oe=document.createElement("div"),Oe.className="ap-sdk-picker-cursor",Oe.setAttribute("data-ap-sdk","1"),Oe.textContent=n?"Tap any element to preview":xd,document.body.appendChild(Oe),Vt(Oe);let r=null,o=null;const i=h=>{Ue==null||Ue(),e(Ya(h),h)},a=h=>{if(o=h,Di(h),!Oe)return;Oe.classList.add("ap-sdk-picker-cursor--confirm"),Oe.innerHTML="";const m=document.createElement("span");m.className="ap-sdk-picker-cursor__label",m.textContent=`<${h.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",T=>{T.preventDefault(),T.stopPropagation(),Ue==null||Ue(),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",T=>{T.preventDefault(),T.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const v=document.createElement("button");v.type="button",v.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",v.textContent="✓ Select",v.setAttribute("data-ap-sdk","1"),v.addEventListener("click",T=>{T.preventDefault(),T.stopPropagation(),o&&i(o)}),Oe.appendChild(m),Oe.appendChild(g),Oe.appendChild(k),Oe.appendChild(v)},d=h=>{Ir(h.target)||(r=h.target,Di(r))},l=h=>{var g;if(Ir(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const m=(g=h.target)!=null?g:r;if(m){if(n){a(m);return}i(m)}},p=h=>{h.key==="Escape"&&(Ue==null||Ue(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",l,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),Ue=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",l,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),Oe&&Yt(Oe),Oe==null||Oe.remove(),dn==null||dn.destroy(),dn=null,Oe=null,o=null,Ue=null}}function Hs(){Ue==null||Ue()}function Qn(){return Ue!==null}const ao={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(l,p){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:p,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,p);const h=a.prototype,m=Object.keys(h);for(let g=0;g<m.length;g++){const k=m[g];k in l||(l[k]=h[k].bind(l))}}const o=(d=n==null?void 0:n.Parent)!=null?d:Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(l){var m;var p;const h=n!=null&&n.Parent?new i:this;r(h,l),(m=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const g of h._zod.deferred)g();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>{var p,h;return n!=null&&n.Parent&&l instanceof n.Parent?!0:(h=(p=l==null?void 0:l._zod)==null?void 0:p.traits)==null?void 0:h.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class er extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Xa extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Ka={};function pn(e){return Ka}function Qa(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 Xo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Fs(e){return e==null}function Bs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Td(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 l=r.match(/\d?e-(\d?)/);l!=null&&l[1]&&(o=Number.parseInt(l[1]))}const i=n>o?n:o,a=Number.parseInt(e.toFixed(i).replace(".","")),d=Number.parseInt(t.toFixed(i).replace(".",""));return a%d/$i(10,i)}const Mi=Symbol("evaluating");function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Mi)return r===void 0&&(r=Mi,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function On(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fn(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function ji(e){return JSON.stringify(e)}function Ed(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ec="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function jr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ad=Xo(()=>{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 or(e){if(jr(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(jr(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function tc(e){return or(e)?y({},e):Array.isArray(e)?[...e]:e}const Cd=new Set(["string","number","symbol"]);function sr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gn(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 U(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"?D(y({},t),{error:()=>t.error}):t}function Pd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Rd={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 Ld(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=fn(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 On(this,"shape",a),a},checks:[]});return gn(e,i)}function zd(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=fn(e._zod.def,{get shape(){const a=y({},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 On(this,"shape",a),a},checks:[]});return gn(e,i)}function Id(e,t){if(!or(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=fn(e._zod.def,{get shape(){const i=y(y({},e._zod.def.shape),t);return On(this,"shape",i),i}});return gn(e,o)}function $d(e,t){if(!or(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=fn(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t);return On(this,"shape",r),r}});return gn(e,n)}function Od(e,t){const n=fn(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t._zod.def.shape);return On(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return gn(e,n)}function Nd(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=fn(t._zod.def,{get shape(){const d=t._zod.def.shape,l=y({},d);if(n)for(const p in n){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(l[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)l[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return On(this,"shape",l),l},checks:[]});return gn(t,a)}function Dd(e,t,n){const r=fn(t._zod.def,{get shape(){const o=t._zod.def.shape,i=y({},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 On(this,"shape",i),i}});return gn(t,r)}function Wn(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 Jn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function co(e){return typeof e=="string"?e:e==null?void 0:e.message}function hn(e,t,n){var o,i,a,d,l,p,h,m,g,k,v;const r=D(y({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const T=(v=(k=(m=(p=co((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:co((l=t==null?void 0:t.error)==null?void 0:l.call(t,e)))!=null?m:co((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:co((g=n.localeError)==null?void 0:g.call(n,e)))!=null?v:"Invalid input";r.message=T}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 Ur(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:y({},t)}const nc=(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})},rc=w("$ZodError",nc),oc=w("$ZodError",nc,{Parent:Error});function Md(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 jd(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 l=i.path[d];d===i.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(i))):a[l]=a[l]||{_errors:[]},a=a[l],d++}}};return r(e),n}const Ws=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 er;if(a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>hn(p,i,pn())));throw ec(l,o==null?void 0:o.callee),l}return a.value},Js=e=>(t,n,r,o)=>z(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 l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>hn(p,i,pn())));throw ec(l,o==null?void 0:o.callee),l}return a.value}),Ko=e=>(t,n,r)=>{const o=r?D(y({},r),{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new er;return i.issues.length?{success:!1,error:new(e!=null?e:rc)(i.issues.map(a=>hn(a,o,pn())))}:{success:!0,data:i.value}},Ud=Ko(oc),Qo=e=>(t,n,r)=>z(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=>hn(a,o,pn())))}:{success:!0,data:i.value}}),Zd=Qo(oc),qd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ws(e)(t,n,o)},Hd=e=>(t,n,r)=>Ws(e)(t,n,r),Fd=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Js(e)(t,n,o)}),Bd=e=>(t,n,r)=>z(null,null,function*(){return Js(e)(t,n,r)}),Gd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ko(e)(t,n,o)},Wd=e=>(t,n,r)=>Ko(e)(t,n,r),Jd=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qo(e)(t,n,o)}),Vd=e=>(t,n,r)=>z(null,null,function*(){return Qo(e)(t,n,r)}),Yd=/^[cC][^\s-]{8,}$/,Xd=/^[0-9a-z]+$/,Kd=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Qd=/^[0-9a-vA-V]{20}$/,ep=/^[A-Za-z0-9]{27}$/,tp=/^[a-zA-Z0-9_-]{21}$/,np=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,rp=/^([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})$/,Ui=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)$/,op=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,sp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ip(){return new RegExp(sp,"u")}const ap=/^(?:(?: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])$/,cp=/^(([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}|:))$/,lp=/^((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])$/,up=/^(([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])$/,dp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,sc=/^[A-Za-z0-9_-]*$/,pp=/^\+[1-9]\d{6,14}$/,ic="(?:(?:\\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])))",hp=new RegExp(`^${ic}$`);function ac(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 fp(e){return new RegExp(`^${ac(e)}$`)}function gp(e){const t=ac({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(`^${ic}T(?:${r})$`)}const mp=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}$`)},bp=/^-?\d+$/,cc=/^-?\d+(?:\.\d+)?$/,kp=/^(?:true|false)$/i,_p=/^[^A-Z]*$/,vp=/^[^a-z]*$/,nt=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=[])}),lc={number:"number",bigint:"bigint",object:"date"},uc=w("$ZodCheckLessThan",(e,t)=>{nt.init(e,t);const n=lc[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})}}),dc=w("$ZodCheckGreaterThan",(e,t)=>{nt.init(e,t);const n=lc[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})}}),yp=w("$ZodCheckMultipleOf",(e,t)=>{nt.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):Td(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})}}),wp=w("$ZodCheckNumberFormat",(e,t)=>{var a;nt.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]=Rd[t.format];e._zod.onattach.push(d=>{const l=d._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=bp)}),e._zod.check=d=>{const l=d.value;if(n){if(!Number.isInteger(l)){d.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?d.issues.push({input:l,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:l,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}}l<o&&d.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&d.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),xp=w("$ZodCheckMaxLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Fs(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})}}),Sp=w("$ZodCheckMinLength",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Fs(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})}}),Tp=w("$ZodCheckLengthEquals",(e,t)=>{var r;var n;nt.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Fs(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),l=a>t.length;o.issues.push(D(y({origin:d},l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length}),{inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort}))}}),es=w("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;nt.init(e,t),e._zod.onattach.push(a=>{var l;const d=a._zod.bag;d.format=t.format,t.pattern&&((l=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(D(y({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=()=>{})}),Ep=w("$ZodCheckRegex",(e,t)=>{es.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})}}),Ap=w("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=_p),es.init(e,t)}),Cp=w("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=vp),es.init(e,t)}),Pp=w("$ZodCheckIncludes",(e,t)=>{nt.init(e,t);const n=sr(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})}}),Rp=w("$ZodCheckStartsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`^${sr(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})}}),Lp=w("$ZodCheckEndsWith",(e,t)=>{var r;nt.init(e,t);const n=new RegExp(`.*${sr(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})}}),zp=w("$ZodCheckOverwrite",(e,t)=>{nt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Ip{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(`
1439
1474
  `).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(`
1440
- `))}}const zp={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=zp;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const l of d._zod.onattach)l(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,m)=>{let g=Gn(p),k;for(const v of h){if(v._zod.def.when){if(!v._zod.def.when(p))continue}else if(g)continue;const T=p.issues.length,Z=v._zod.check(p);if(Z instanceof Promise&&(m==null?void 0:m.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!==T&&(g||(g=Gn(p,T)))}));else{if(p.issues.length===T)continue;g||(g=Gn(p,T))}}return k?k.then(()=>p):p},l=(p,h,m)=>{if(Gn(p))return p.aborted=!0,p;const g=d(h,r,m);if(g instanceof Promise){if(m.async===!1)throw new Qn;return g.then(k=>e._zod.parse(k,m))}return e._zod.parse(g,m)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const g=e._zod.parse({value:p.value,issues:[]},D(y({},h),{skipChecks:!0}));return g instanceof Promise?g.then(k=>l(k,p,h)):l(g,p,h)}const m=e._zod.parse(p,h);if(m instanceof Promise){if(h.async===!1)throw new Qn;return m.then(g=>d(g,r,h))}return d(m,r,h)}}ne(e,"~standard",()=>({validate:d=>{var l;try{const p=Md(e,d);return p.success?{value:p.data}:{issues:(l=p.error)==null?void 0:l.issues}}catch(p){return jd(e,d).then(h=>{var m;return h.success?{value:h.data}:{issues:(m=h.error)==null?void 0:m.issues}})}},vendor:"zod",version:1}))}),Ws=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:fp(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)=>{Ko.init(e,t),Ws.init(e,t)}),Ip=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tp),ke.init(e,t)}),$p=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=Mi(i))}else(r=t.pattern)!=null||(t.pattern=Mi());ke.init(e,t)}),Op=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=np),ke.init(e,t)}),Np=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})}}}),Dp=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=op()),ke.init(e,t)}),Mp=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Qd),ke.init(e,t)}),jp=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Jd),ke.init(e,t)}),Up=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Vd),ke.init(e,t)}),Zp=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yd),ke.init(e,t)}),qp=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Xd),ke.init(e,t)}),Hp=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Kd),ke.init(e,t)}),Fp=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hp(t)),ke.init(e,t)}),Bp=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=dp),ke.init(e,t)}),Gp=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pp(t)),ke.init(e,t)}),Wp=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ep),ke.init(e,t)}),Jp=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sp),ke.init(e,t),e._zod.bag.format="ipv4"}),Vp=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ip),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})}}}),Yp=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ap),ke.init(e,t)}),Xp=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cp),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 lc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const Kp=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=lp),ke.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{lc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Qp(e){if(!nc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return lc(n)}const eh=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=nc),ke.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Qp(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),th=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=up),ke.init(e,t)});function nh(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 rh=w("$ZodJWT",(e,t)=>{ke.init(e,t),e._zod.check=n=>{nh(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),uc=w("$ZodNumber",(e,t)=>{var n;be.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:sc,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(y({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),oh=w("$ZodNumberFormat",(e,t)=>{vp.init(e,t),uc.init(e,t)}),sh=w("$ZodBoolean",(e,t)=>{be.init(e,t),e._zod.pattern=mp,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}}),ih=w("$ZodAny",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),ah=w("$ZodUnknown",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),ch=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 ji(e,t,n){e.issues.length&&t.issues.push(...Wn(n,e.issues)),t.value[n]=e.value}const lh=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],l=t.element._zod.run({value:d,issues:[]},r);l instanceof Promise?i.push(l.then(p=>ji(p,n,a))):ji(l,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(...Wn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function dc(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=Ad(e.shape);return D(y({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function pc(e,t,n,r,o,i){const a=[],d=o.keySet,l=o.catchall._zod,p=l.def.type,h=l.optout==="optional";for(const m in t){if(d.has(m))continue;if(p==="never"){a.push(m);continue}const g=l.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(k=>Io(k,n,m,t,h))):Io(g,n,m,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 uh=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 l=y({},d);return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Vo(()=>dc(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,l={};for(const h in d){const m=d[h]._zod;if(m.values){(p=l[h])!=null||(l[h]=new Set);for(const g of m.values)l[h].add(g)}}return l});const o=Mr,i=t.catchall;let a;e._zod.parse=(d,l)=>{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=[],m=a.shape;for(const g of a.keys){const k=m[g],v=k._zod.optout==="optional",T=k._zod.run({value:p[g],issues:[]},l);T instanceof Promise?h.push(T.then(Z=>Io(Z,d,g,p,v))):Io(T,d,g,p,v)}return i?pc(h,p,d,l,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),dh=w("$ZodObjectJIT",(e,t)=>{uh.init(e,t);const n=e._zod.parse,r=Vo(()=>dc(t)),o=g=>{var E;const k=new Lp(["shape","payload","ctx"]),v=r.value,T=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 Q=0;for(const S of v.keys)Z[S]=`key_${Q++}`;k.write("const newResult = {};");for(const S of v.keys){const C=Z[S],q=Di(S),J=g[S],we=((E=J==null?void 0:J._zod)==null?void 0:E.optout)==="optional";k.write(`const ${C} = ${T(S)};`),we?k.write(`
1475
+ `))}}const $p={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=$p;const r=[...(o=e._zod.def.checks)!=null?o:[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const d of r)for(const l of d._zod.onattach)l(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,m)=>{let g=Wn(p),k;for(const v of h){if(v._zod.def.when){if(!v._zod.def.when(p))continue}else if(g)continue;const T=p.issues.length,Z=v._zod.check(p);if(Z instanceof Promise&&(m==null?void 0:m.async)===!1)throw new er;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>z(null,null,function*(){yield Z,p.issues.length!==T&&(g||(g=Wn(p,T)))}));else{if(p.issues.length===T)continue;g||(g=Wn(p,T))}}return k?k.then(()=>p):p},l=(p,h,m)=>{if(Wn(p))return p.aborted=!0,p;const g=d(h,r,m);if(g instanceof Promise){if(m.async===!1)throw new er;return g.then(k=>e._zod.parse(k,m))}return e._zod.parse(g,m)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const g=e._zod.parse({value:p.value,issues:[]},D(y({},h),{skipChecks:!0}));return g instanceof Promise?g.then(k=>l(k,p,h)):l(g,p,h)}const m=e._zod.parse(p,h);if(m instanceof Promise){if(h.async===!1)throw new er;return m.then(g=>d(g,r,h))}return d(m,r,h)}}ne(e,"~standard",()=>({validate:d=>{var l;try{const p=Ud(e,d);return p.success?{value:p.data}:{issues:(l=p.error)==null?void 0:l.issues}}catch(p){return Zd(e,d).then(h=>{var m;return h.success?{value:h.data}:{issues:(m=h.error)==null?void 0:m.issues}})}},vendor:"zod",version:1}))}),Vs=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:mp(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)=>{es.init(e,t),Vs.init(e,t)}),Op=w("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=rp),ke.init(e,t)}),Np=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=Ui(i))}else(r=t.pattern)!=null||(t.pattern=Ui());ke.init(e,t)}),Dp=w("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=op),ke.init(e,t)}),Mp=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})}}}),jp=w("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ip()),ke.init(e,t)}),Up=w("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tp),ke.init(e,t)}),Zp=w("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Yd),ke.init(e,t)}),qp=w("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Xd),ke.init(e,t)}),Hp=w("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Kd),ke.init(e,t)}),Fp=w("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Qd),ke.init(e,t)}),Bp=w("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ep),ke.init(e,t)}),Gp=w("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=gp(t)),ke.init(e,t)}),Wp=w("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hp),ke.init(e,t)}),Jp=w("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=fp(t)),ke.init(e,t)}),Vp=w("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=np),ke.init(e,t)}),Yp=w("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ap),ke.init(e,t),e._zod.bag.format="ipv4"}),Xp=w("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cp),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})}}}),Kp=w("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=lp),ke.init(e,t)}),Qp=w("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=up),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 pc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const eh=w("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=dp),ke.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{pc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function th(e){if(!sc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return pc(n)}const nh=w("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sc),ke.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{th(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),rh=w("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pp),ke.init(e,t)});function oh(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 sh=w("$ZodJWT",(e,t)=>{ke.init(e,t),e._zod.check=n=>{oh(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),hc=w("$ZodNumber",(e,t)=>{var n;be.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:cc,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(y({expected:"number",code:"invalid_type",input:i,inst:e},a?{received:a}:{})),r}}),ih=w("$ZodNumberFormat",(e,t)=>{wp.init(e,t),hc.init(e,t)}),ah=w("$ZodBoolean",(e,t)=>{be.init(e,t),e._zod.pattern=kp,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}}),ch=w("$ZodAny",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),lh=w("$ZodUnknown",(e,t)=>{be.init(e,t),e._zod.parse=n=>n}),uh=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 Zi(e,t,n){e.issues.length&&t.issues.push(...Jn(n,e.issues)),t.value[n]=e.value}const dh=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],l=t.element._zod.run({value:d,issues:[]},r);l instanceof Promise?i.push(l.then(p=>Zi(p,n,a))):Zi(l,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function Oo(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Jn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function fc(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=Pd(e.shape);return D(y({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function gc(e,t,n,r,o,i){const a=[],d=o.keySet,l=o.catchall._zod,p=l.def.type,h=l.optout==="optional";for(const m in t){if(d.has(m))continue;if(p==="never"){a.push(m);continue}const g=l.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(k=>Oo(k,n,m,t,h))):Oo(g,n,m,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 ph=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 l=y({},d);return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Xo(()=>fc(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,l={};for(const h in d){const m=d[h]._zod;if(m.values){(p=l[h])!=null||(l[h]=new Set);for(const g of m.values)l[h].add(g)}}return l});const o=jr,i=t.catchall;let a;e._zod.parse=(d,l)=>{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=[],m=a.shape;for(const g of a.keys){const k=m[g],v=k._zod.optout==="optional",T=k._zod.run({value:p[g],issues:[]},l);T instanceof Promise?h.push(T.then(Z=>Oo(Z,d,g,p,v))):Oo(T,d,g,p,v)}return i?gc(h,p,d,l,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),hh=w("$ZodObjectJIT",(e,t)=>{ph.init(e,t);const n=e._zod.parse,r=Xo(()=>fc(t)),o=g=>{var E;const k=new Ip(["shape","payload","ctx"]),v=r.value,T=S=>{const C=ji(S);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let Q=0;for(const S of v.keys)Z[S]=`key_${Q++}`;k.write("const newResult = {};");for(const S of v.keys){const C=Z[S],q=ji(S),J=g[S],we=((E=J==null?void 0:J._zod)==null?void 0:E.optout)==="optional";k.write(`const ${C} = ${T(S)};`),we?k.write(`
1441
1476
  if (${C}.issues.length) {
1442
1477
  if (${q} in input) {
1443
1478
  payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
@@ -1471,23 +1506,23 @@ button.ap-sdk-list-item__link {
1471
1506
  newResult[${q}] = ${C}.value;
1472
1507
  }
1473
1508
 
1474
- `)}k.write("payload.value = newResult;"),k.write("return payload;");const M=k.compile();return(S,C)=>M(g,S,C)};let i;const a=Mr,d=!Va.jitless,p=d&&Td.value,h=t.catchall;let m;e._zod.parse=(g,k)=>{m!=null||(m=r.value);const v=g.value;return a(v)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),g=i(g,k),h?pc([],v,g,k,m,e):g):n(g,k):(g.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),g)}});function Ui(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=>pn(a,r,dn())))}),t)}const hc=w("$ZodUnion",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(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=>Hs(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 l of t.options){const p=l._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(l=>Ui(l,o,e,i)):Ui(d,o,e,i)}}),ph=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,hc.init(e,t);const n=e._zod.parse;ne(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,l]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of l)o[d].add(p)}}return o});const r=Vo(()=>{var a;const o=t.options,i=new Map;for(const d of o){const l=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of l){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(!Mr(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)}}),hh=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(([l,p])=>Zi(n,l,p)):Zi(n,i,a)}});function Cs(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(rr(e)&&rr(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=y(y({},e),t);for(const i of r){const a=Cs(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=Cs(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 Zi(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 l of d.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).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(D(y({},o),{keys:i})),Gn(e))return e;const a=Cs(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 fh=w("$ZodRecord",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!rr(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(m=>{m.issues.length&&n.issues.push(...Wn(p,m.issues)),n.value[p]=m.value})):(h.issues.length&&n.issues.push(...Wn(p,h.issues)),n.value[p]=h.value)}let l;for(const p in o)d.has(p)||(l=l!=null?l:[],l.push(p));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let l=t.keyType._zod.run({value:d,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&sc.test(d)&&l.issues.length&&l.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&&(l=m)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>pn(m,r,dn())),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(m=>{m.issues.length&&n.issues.push(...Wn(d,m.issues)),n.value[l.value]=m.value})):(h.issues.length&&n.issues.push(...Wn(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),gh=w("$ZodEnum",(e,t)=>{be.init(e,t);const n=Ya(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ed.has(typeof o)).map(o=>typeof o=="string"?or(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}}),mh=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"?or(r):r?or(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}}),bh=w("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ja(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 qi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const fc=w("$ZodOptional",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Hs(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=>qi(i,n.value)):qi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),kh=w("$ZodExactOptional",(e,t)=>{fc.init(e,t),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),_h=w("$ZodNullable",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Hs(n.source)}|null)$`):void 0}),ne(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)}),vh=w("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ne(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=>Hi(i,t)):Hi(o,t)}});function Hi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const yh=w("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ne(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))}),wh=w("$ZodNonOptional",(e,t)=>{be.init(e,t),ne(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=>Fi(i,e)):Fi(o,e)}});function Fi(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 xh=w("$ZodCatch",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(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(D(y({},n),{error:{issues:i.issues.map(a=>pn(a,r,dn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:o.issues.map(i=>pn(i,r,dn()))},input:n.value})),n.issues=[]),n)}}),Sh=w("$ZodPipe",(e,t)=>{be.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(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 Th=w("$ZodReadonly",(e,t)=>{be.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ne(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(Bi):Bi(o)}});function Bi(e){return e.value=Object.freeze(e.value),e}const Eh=w("$ZodCustom",(e,t)=>{nt.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=>Gi(i,n,r,e));Gi(o,n,r,e)}});function Gi(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(jr(i))}}var Wi;class Ah{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=y({},(r=this.get(n))!=null?r:{});delete o.id;const i=y(y({},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 Ch(){return new Ah}var Za;(Za=(Wi=globalThis).__zod_globalRegistry)!=null||(Wi.__zod_globalRegistry=Ch());const Rr=globalThis.__zod_globalRegistry;function Ph(e,t){return new e(y({type:"string"},U(t)))}function Rh(e,t){return new e(y({type:"string",format:"email",check:"string_format",abort:!1},U(t)))}function Ji(e,t){return new e(y({type:"string",format:"guid",check:"string_format",abort:!1},U(t)))}function Lh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1},U(t)))}function zh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},U(t)))}function Ih(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},U(t)))}function $h(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},U(t)))}function Oh(e,t){return new e(y({type:"string",format:"url",check:"string_format",abort:!1},U(t)))}function Nh(e,t){return new e(y({type:"string",format:"emoji",check:"string_format",abort:!1},U(t)))}function Dh(e,t){return new e(y({type:"string",format:"nanoid",check:"string_format",abort:!1},U(t)))}function Mh(e,t){return new e(y({type:"string",format:"cuid",check:"string_format",abort:!1},U(t)))}function jh(e,t){return new e(y({type:"string",format:"cuid2",check:"string_format",abort:!1},U(t)))}function Uh(e,t){return new e(y({type:"string",format:"ulid",check:"string_format",abort:!1},U(t)))}function Zh(e,t){return new e(y({type:"string",format:"xid",check:"string_format",abort:!1},U(t)))}function qh(e,t){return new e(y({type:"string",format:"ksuid",check:"string_format",abort:!1},U(t)))}function Hh(e,t){return new e(y({type:"string",format:"ipv4",check:"string_format",abort:!1},U(t)))}function Fh(e,t){return new e(y({type:"string",format:"ipv6",check:"string_format",abort:!1},U(t)))}function Bh(e,t){return new e(y({type:"string",format:"cidrv4",check:"string_format",abort:!1},U(t)))}function Gh(e,t){return new e(y({type:"string",format:"cidrv6",check:"string_format",abort:!1},U(t)))}function Wh(e,t){return new e(y({type:"string",format:"base64",check:"string_format",abort:!1},U(t)))}function Jh(e,t){return new e(y({type:"string",format:"base64url",check:"string_format",abort:!1},U(t)))}function Vh(e,t){return new e(y({type:"string",format:"e164",check:"string_format",abort:!1},U(t)))}function Yh(e,t){return new e(y({type:"string",format:"jwt",check:"string_format",abort:!1},U(t)))}function Xh(e,t){return new e(y({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},U(t)))}function Kh(e,t){return new e(y({type:"string",format:"date",check:"string_format"},U(t)))}function Qh(e,t){return new e(y({type:"string",format:"time",check:"string_format",precision:null},U(t)))}function ef(e,t){return new e(y({type:"string",format:"duration",check:"string_format"},U(t)))}function tf(e,t){return new e(y({type:"number",checks:[]},U(t)))}function nf(e,t){return new e(y({type:"number",check:"number_format",abort:!1,format:"safeint"},U(t)))}function rf(e,t){return new e(y({type:"boolean"},U(t)))}function of(e){return new e({type:"any"})}function sf(e){return new e({type:"unknown"})}function af(e,t){return new e(y({type:"never"},U(t)))}function Vi(e,t){return new ac(D(y({check:"less_than"},U(t)),{value:e,inclusive:!1}))}function fs(e,t){return new ac(D(y({check:"less_than"},U(t)),{value:e,inclusive:!0}))}function Yi(e,t){return new cc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!1}))}function gs(e,t){return new cc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!0}))}function Xi(e,t){return new _p(D(y({check:"multiple_of"},U(t)),{value:e}))}function gc(e,t){return new yp(D(y({check:"max_length"},U(t)),{maximum:e}))}function $o(e,t){return new wp(D(y({check:"min_length"},U(t)),{minimum:e}))}function mc(e,t){return new xp(D(y({check:"length_equals"},U(t)),{length:e}))}function cf(e,t){return new Sp(D(y({check:"string_format",format:"regex"},U(t)),{pattern:e}))}function lf(e){return new Tp(y({check:"string_format",format:"lowercase"},U(e)))}function uf(e){return new Ep(y({check:"string_format",format:"uppercase"},U(e)))}function df(e,t){return new Ap(D(y({check:"string_format",format:"includes"},U(t)),{includes:e}))}function pf(e,t){return new Cp(D(y({check:"string_format",format:"starts_with"},U(t)),{prefix:e}))}function hf(e,t){return new Pp(D(y({check:"string_format",format:"ends_with"},U(t)),{suffix:e}))}function cr(e){return new Rp({check:"overwrite",tx:e})}function ff(e){return cr(t=>t.normalize(e))}function gf(){return cr(e=>e.trim())}function mf(){return cr(e=>e.toLowerCase())}function bf(){return cr(e=>e.toUpperCase())}function kf(){return cr(e=>Sd(e))}function _f(e,t,n){return new e(y({type:"array",element:t},U(n)))}function vf(e,t,n){return new e(y({type:"custom",check:"custom",fn:t},U(n)))}function yf(e){const t=wf(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(jr(r,n.value,t._zod.def));else{const l=r;l.fatal&&(l.continue=!1),(o=l.code)!=null||(l.code="custom"),(i=l.input)!=null||(l.input=n.value),(a=l.inst)!=null||(l.inst=t),(d=l.continue)!=null||(l.continue=!t._zod.def.abort),n.issues.push(jr(l))}},e(n.value,n)));return t}function wf(e,t){const n=new nt(y({check:"custom"},U(t)));return n._zod.check=e,n}function bc(e){var n,r,o,i,a,d,l,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:Rr,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:(l=e==null?void 0:e.cycles)!=null?l:"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 Re(e,t,n={path:[],schemaPath:[]}){var h,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=(h=e._zod).toJSONSchema)==null?void 0:m.call(h);if(d)a.schema=d;else{const k=D(y({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const T=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,T,k)}const v=e._zod.parent;v&&(a.ref||(a.ref=v),Re(v,t,k),t.seen.get(v).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),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 kc(e,t){var a,d,l,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 m=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(m){const g=r.get(m);if(g&&g!==h[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,h[0])}}const o=h=>{var T,Z,Q,M,E;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(T=e.external.registry.get(h[0]))==null?void 0:T.id,C=(Z=e.external.uri)!=null?Z:(J=>J);if(S)return{ref:C(S)};const q=(M=(Q=h[1].defId)!=null?Q:h[1].schema.id)!=null?M:`schema${e.counter++}`;return h[1].defId=q,{defId:q,ref:`${C("__shared")}#/${m}/${q}`}}if(h[1]===n)return{ref:"#"};const k=`#/${m}/`,v=(E=h[1].schema.id)!=null?E:`__schema${e.counter++}`;return{defId:v,ref:k+v}},i=h=>{if(h[1].schema.$ref)return;const m=h[1],{ref:g,defId:k}=o(h);m.def=y({},m.schema),k&&(m.defId=k);const v=m.schema;for(const T in v)delete v[T];v.$ref=g};if(e.cycles==="throw")for(const h of e.seen.entries()){const m=h[1];if(m.cycle)throw new Error(`Cycle detected: #/${(d=m.cycle)==null?void 0:d.join("/")}/<root>
1509
+ `)}k.write("payload.value = newResult;"),k.write("return payload;");const M=k.compile();return(S,C)=>M(g,S,C)};let i;const a=jr,d=!Ka.jitless,p=d&&Ad.value,h=t.catchall;let m;e._zod.parse=(g,k)=>{m!=null||(m=r.value);const v=g.value;return a(v)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),g=i(g,k),h?gc([],v,g,k,m,e):g):n(g,k):(g.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),g)}});function qi(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=>!Wn(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=>hn(a,r,pn())))}),t)}const mc=w("$ZodUnion",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ne(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ne(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ne(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=>Bs(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 l of t.options){const p=l._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(l=>qi(l,o,e,i)):qi(d,o,e,i)}}),fh=w("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,mc.init(e,t);const n=e._zod.parse;ne(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,l]of Object.entries(a)){o[d]||(o[d]=new Set);for(const p of l)o[d].add(p)}}return o});const r=Xo(()=>{var a;const o=t.options,i=new Map;for(const d of o){const l=(a=d._zod.propValues)==null?void 0:a[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(d)}"`);for(const p of l){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(!jr(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)}}),gh=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(([l,p])=>Hi(n,l,p)):Hi(n,i,a)}});function Rs(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(or(e)&&or(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o=y(y({},e),t);for(const i of r){const a=Rs(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=Rs(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 Hi(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 l of d.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(d);for(const d of n.issues)if(d.code==="unrecognized_keys")for(const l of d.keys)r.has(l)||r.set(l,{}),r.get(l).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(D(y({},o),{keys:i})),Wn(e))return e;const a=Rs(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 mh=w("$ZodRecord",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!or(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(m=>{m.issues.length&&n.issues.push(...Jn(p,m.issues)),n.value[p]=m.value})):(h.issues.length&&n.issues.push(...Jn(p,h.issues)),n.value[p]=h.value)}let l;for(const p in o)d.has(p)||(l=l!=null?l:[],l.push(p));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const d of Reflect.ownKeys(o)){if(d==="__proto__")continue;let l=t.keyType._zod.run({value:d,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof d=="string"&&cc.test(d)&&l.issues.length&&l.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&&(l=m)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(m=>hn(m,r,pn())),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(m=>{m.issues.length&&n.issues.push(...Jn(d,m.issues)),n.value[l.value]=m.value})):(h.issues.length&&n.issues.push(...Jn(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),bh=w("$ZodEnum",(e,t)=>{be.init(e,t);const n=Qa(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Cd.has(typeof o)).map(o=>typeof o=="string"?sr(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}}),kh=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"?sr(r):r?sr(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}}),_h=w("$ZodTransform",(e,t)=>{be.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Xa(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 er;return n.value=o,n}});function Fi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const bc=w("$ZodOptional",(e,t)=>{be.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ne(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Bs(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=>Fi(i,n.value)):Fi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),vh=w("$ZodExactOptional",(e,t)=>{bc.init(e,t),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),yh=w("$ZodNullable",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Bs(n.source)}|null)$`):void 0}),ne(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)}),wh=w("$ZodDefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ne(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=>Bi(i,t)):Bi(o,t)}});function Bi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const xh=w("$ZodPrefault",(e,t)=>{be.init(e,t),e._zod.optin="optional",ne(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))}),Sh=w("$ZodNonOptional",(e,t)=>{be.init(e,t),ne(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=>Gi(i,e)):Gi(o,e)}});function Gi(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 Th=w("$ZodCatch",(e,t)=>{be.init(e,t),ne(e._zod,"optin",()=>t.innerType._zod.optin),ne(e._zod,"optout",()=>t.innerType._zod.optout),ne(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(D(y({},n),{error:{issues:i.issues.map(a=>hn(a,r,pn()))},input:n.value})),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue(D(y({},n),{error:{issues:o.issues.map(i=>hn(i,r,pn()))},input:n.value})),n.issues=[]),n)}}),Eh=w("$ZodPipe",(e,t)=>{be.init(e,t),ne(e._zod,"values",()=>t.in._zod.values),ne(e._zod,"optin",()=>t.in._zod.optin),ne(e._zod,"optout",()=>t.out._zod.optout),ne(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=>lo(a,t.in,r)):lo(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>lo(i,t.out,r)):lo(o,t.out,r)}});function lo(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Ah=w("$ZodReadonly",(e,t)=>{be.init(e,t),ne(e._zod,"propValues",()=>t.innerType._zod.propValues),ne(e._zod,"values",()=>t.innerType._zod.values),ne(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),ne(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(Wi):Wi(o)}});function Wi(e){return e.value=Object.freeze(e.value),e}const Ch=w("$ZodCustom",(e,t)=>{nt.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=>Ji(i,n,r,e));Ji(o,n,r,e)}});function Ji(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(Ur(i))}}var Vi;class Ph{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=y({},(r=this.get(n))!=null?r:{});delete o.id;const i=y(y({},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 Rh(){return new Ph}var Fa;(Fa=(Vi=globalThis).__zod_globalRegistry)!=null||(Vi.__zod_globalRegistry=Rh());const Lr=globalThis.__zod_globalRegistry;function Lh(e,t){return new e(y({type:"string"},U(t)))}function zh(e,t){return new e(y({type:"string",format:"email",check:"string_format",abort:!1},U(t)))}function Yi(e,t){return new e(y({type:"string",format:"guid",check:"string_format",abort:!1},U(t)))}function Ih(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1},U(t)))}function $h(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},U(t)))}function Oh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},U(t)))}function Nh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},U(t)))}function Dh(e,t){return new e(y({type:"string",format:"url",check:"string_format",abort:!1},U(t)))}function Mh(e,t){return new e(y({type:"string",format:"emoji",check:"string_format",abort:!1},U(t)))}function jh(e,t){return new e(y({type:"string",format:"nanoid",check:"string_format",abort:!1},U(t)))}function Uh(e,t){return new e(y({type:"string",format:"cuid",check:"string_format",abort:!1},U(t)))}function Zh(e,t){return new e(y({type:"string",format:"cuid2",check:"string_format",abort:!1},U(t)))}function qh(e,t){return new e(y({type:"string",format:"ulid",check:"string_format",abort:!1},U(t)))}function Hh(e,t){return new e(y({type:"string",format:"xid",check:"string_format",abort:!1},U(t)))}function Fh(e,t){return new e(y({type:"string",format:"ksuid",check:"string_format",abort:!1},U(t)))}function Bh(e,t){return new e(y({type:"string",format:"ipv4",check:"string_format",abort:!1},U(t)))}function Gh(e,t){return new e(y({type:"string",format:"ipv6",check:"string_format",abort:!1},U(t)))}function Wh(e,t){return new e(y({type:"string",format:"cidrv4",check:"string_format",abort:!1},U(t)))}function Jh(e,t){return new e(y({type:"string",format:"cidrv6",check:"string_format",abort:!1},U(t)))}function Vh(e,t){return new e(y({type:"string",format:"base64",check:"string_format",abort:!1},U(t)))}function Yh(e,t){return new e(y({type:"string",format:"base64url",check:"string_format",abort:!1},U(t)))}function Xh(e,t){return new e(y({type:"string",format:"e164",check:"string_format",abort:!1},U(t)))}function Kh(e,t){return new e(y({type:"string",format:"jwt",check:"string_format",abort:!1},U(t)))}function Qh(e,t){return new e(y({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},U(t)))}function ef(e,t){return new e(y({type:"string",format:"date",check:"string_format"},U(t)))}function tf(e,t){return new e(y({type:"string",format:"time",check:"string_format",precision:null},U(t)))}function nf(e,t){return new e(y({type:"string",format:"duration",check:"string_format"},U(t)))}function rf(e,t){return new e(y({type:"number",checks:[]},U(t)))}function of(e,t){return new e(y({type:"number",check:"number_format",abort:!1,format:"safeint"},U(t)))}function sf(e,t){return new e(y({type:"boolean"},U(t)))}function af(e){return new e({type:"any"})}function cf(e){return new e({type:"unknown"})}function lf(e,t){return new e(y({type:"never"},U(t)))}function Xi(e,t){return new uc(D(y({check:"less_than"},U(t)),{value:e,inclusive:!1}))}function ms(e,t){return new uc(D(y({check:"less_than"},U(t)),{value:e,inclusive:!0}))}function Ki(e,t){return new dc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!1}))}function bs(e,t){return new dc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!0}))}function Qi(e,t){return new yp(D(y({check:"multiple_of"},U(t)),{value:e}))}function kc(e,t){return new xp(D(y({check:"max_length"},U(t)),{maximum:e}))}function No(e,t){return new Sp(D(y({check:"min_length"},U(t)),{minimum:e}))}function _c(e,t){return new Tp(D(y({check:"length_equals"},U(t)),{length:e}))}function uf(e,t){return new Ep(D(y({check:"string_format",format:"regex"},U(t)),{pattern:e}))}function df(e){return new Ap(y({check:"string_format",format:"lowercase"},U(e)))}function pf(e){return new Cp(y({check:"string_format",format:"uppercase"},U(e)))}function hf(e,t){return new Pp(D(y({check:"string_format",format:"includes"},U(t)),{includes:e}))}function ff(e,t){return new Rp(D(y({check:"string_format",format:"starts_with"},U(t)),{prefix:e}))}function gf(e,t){return new Lp(D(y({check:"string_format",format:"ends_with"},U(t)),{suffix:e}))}function lr(e){return new zp({check:"overwrite",tx:e})}function mf(e){return lr(t=>t.normalize(e))}function bf(){return lr(e=>e.trim())}function kf(){return lr(e=>e.toLowerCase())}function _f(){return lr(e=>e.toUpperCase())}function vf(){return lr(e=>Ed(e))}function yf(e,t,n){return new e(y({type:"array",element:t},U(n)))}function wf(e,t,n){return new e(y({type:"custom",check:"custom",fn:t},U(n)))}function xf(e){const t=Sf(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(Ur(r,n.value,t._zod.def));else{const l=r;l.fatal&&(l.continue=!1),(o=l.code)!=null||(l.code="custom"),(i=l.input)!=null||(l.input=n.value),(a=l.inst)!=null||(l.inst=t),(d=l.continue)!=null||(l.continue=!t._zod.def.abort),n.issues.push(Ur(l))}},e(n.value,n)));return t}function Sf(e,t){const n=new nt(y({check:"custom"},U(t)));return n._zod.check=e,n}function vc(e){var n,r,o,i,a,d,l,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:Lr,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:(l=e==null?void 0:e.cycles)!=null?l:"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 Re(e,t,n={path:[],schemaPath:[]}){var h,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=(h=e._zod).toJSONSchema)==null?void 0:m.call(h);if(d)a.schema=d;else{const k=D(y({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const T=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,T,k)}const v=e._zod.parent;v&&(a.ref||(a.ref=v),Re(v,t,k),t.seen.get(v).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),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 yc(e,t){var a,d,l,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 m=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(m){const g=r.get(m);if(g&&g!==h[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,h[0])}}const o=h=>{var T,Z,Q,M,E;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const S=(T=e.external.registry.get(h[0]))==null?void 0:T.id,C=(Z=e.external.uri)!=null?Z:(J=>J);if(S)return{ref:C(S)};const q=(M=(Q=h[1].defId)!=null?Q:h[1].schema.id)!=null?M:`schema${e.counter++}`;return h[1].defId=q,{defId:q,ref:`${C("__shared")}#/${m}/${q}`}}if(h[1]===n)return{ref:"#"};const k=`#/${m}/`,v=(E=h[1].schema.id)!=null?E:`__schema${e.counter++}`;return{defId:v,ref:k+v}},i=h=>{if(h[1].schema.$ref)return;const m=h[1],{ref:g,defId:k}=o(h);m.def=y({},m.schema),k&&(m.defId=k);const v=m.schema;for(const T in v)delete v[T];v.$ref=g};if(e.cycles==="throw")for(const h of e.seen.entries()){const m=h[1];if(m.cycle)throw new Error(`Cycle detected: #/${(d=m.cycle)==null?void 0:d.join("/")}/<root>
1475
1510
 
1476
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const m=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(l=e.external.registry.get(h[0]))==null?void 0:l.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(m.cycle){i(h);continue}if(m.count>1&&e.reused==="ref"){i(h);continue}}}function _c(e,t){var a,d,l,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{var Q,M,E;const g=e.seen.get(m);if(g.ref===null)return;const k=(Q=g.def)!=null?Q:g.schema,v=y({},k),T=g.ref;if(g.ref=null,T){r(T);const S=e.seen.get(T),C=S.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(M=k.allOf)!=null?M:[],k.allOf.push(C)):Object.assign(k,C),Object.assign(k,v),m._zod.parent===T)for(const J in k)J==="$ref"||J==="allOf"||J in v||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=m._zod.parent;if(Z&&Z!==T){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:(E=g.path)!=null?E:[]})};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,(l=n.def)!=null?l:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};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:D(y({},t["~standard"]),{jsonSchema:{input:Oo(t,"input",e.processors),output:Oo(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 xf=(e,t={})=>n=>{const r=bc(D(y({},n),{processors:t}));return Re(e,r),kc(r,e),_c(r,e)},Oo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=bc(D(y({},o!=null?o:{}),{target:i,io:t,processors:n}));return Re(e,a),kc(a,e),_c(a,e)},Sf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Tf=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:l,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=Sf[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const m=[...l];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(g=>D(y({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:g.source}))])}},Ef=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:l,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 l=="number"&&(o.multipleOf=l)},Af=(e,t,n,r)=>{n.type="boolean"},Cf=(e,t,n,r)=>{n.not={}},Pf=(e,t,n,r)=>{},Rf=(e,t,n,r)=>{},Lf=(e,t,n,r)=>{const o=e._zod.def,i=Ya(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},zf=(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},If=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},$f=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Of=(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=Re(i.element,t,D(y({},r),{path:[...r.path,"items"]}))},Nf=(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]=Re(a[h],t,D(y({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),l=new Set([...d].filter(h=>{const m=i.shape[h]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Re(i.catchall,t,D(y({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Df=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Re(d,t,D(y({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Mf=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.left,t,D(y({},r),{path:[...r.path,"allOf",0]})),a=Re(o.right,t,D(y({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,l=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=l},jf=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,l=d==null?void 0:d.patterns;if(i.mode==="loose"&&l&&l.size>0){const h=Re(i.valueType,t,D(y({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const m of l)o.patternProperties[m.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Re(i.keyType,t,D(y({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Re(i.valueType,t,D(y({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(m=>typeof m=="string"||typeof m=="number");h.length>0&&(o.required=h)}},Uf=(e,t,n,r)=>{const o=e._zod.def,i=Re(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"}]},Zf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},qf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Hf=(e,t,n,r)=>{const o=e._zod.def;Re(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)))},Ff=(e,t,n,r)=>{const o=e._zod.def;Re(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},Bf=(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;Re(i,t,r);const a=t.seen.get(e);a.ref=i},Gf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},vc=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Wf=w("ZodISODateTime",(e,t)=>{Fp.init(e,t),ye.init(e,t)});function Jf(e){return Xh(Wf,e)}const Vf=w("ZodISODate",(e,t)=>{Bp.init(e,t),ye.init(e,t)});function Yf(e){return Kh(Vf,e)}const Xf=w("ZodISOTime",(e,t)=>{Gp.init(e,t),ye.init(e,t)});function Kf(e){return Qh(Xf,e)}const Qf=w("ZodISODuration",(e,t)=>{Wp.init(e,t),ye.init(e,t)});function eg(e){return ef(Qf,e)}const tg=(e,t)=>{ec.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Dd(e,n)},flatten:{value:n=>Nd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,As,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,As,2)}},isEmpty:{get(){return e.issues.length===0}}})},ht=w("ZodError",tg,{Parent:Error}),ng=Bs(ht),rg=Gs(ht),og=Yo(ht),sg=Xo(ht),ig=Ud(ht),ag=Zd(ht),cg=qd(ht),lg=Hd(ht),ug=Fd(ht),dg=Bd(ht),pg=Gd(ht),hg=Wd(ht),_e=w("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Oo(e,"input"),output:Oo(e,"output")}}),e.toJSONSchema=xf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(hn(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)=>fn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>ng(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>og(e,n,r),e.parseAsync=(n,r)=>L(null,null,function*(){return rg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>L(null,null,function*(){return sg(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>ig(e,n,r),e.decode=(n,r)=>ag(e,n,r),e.encodeAsync=(n,r)=>L(null,null,function*(){return cg(e,n,r)}),e.decodeAsync=(n,r)=>L(null,null,function*(){return lg(e,n,r)}),e.safeEncode=(n,r)=>ug(e,n,r),e.safeDecode=(n,r)=>dg(e,n,r),e.safeEncodeAsync=(n,r)=>L(null,null,function*(){return pg(e,n,r)}),e.safeDecodeAsync=(n,r)=>L(null,null,function*(){return hg(e,n,r)}),e.refine=(n,r)=>e.check(cm(n,r)),e.superRefine=n=>e.check(lm(n)),e.overwrite=n=>e.check(cr(n)),e.optional=()=>ta(e),e.exactOptional=()=>Vg(e),e.nullable=()=>na(e),e.nullish=()=>ta(na(e)),e.nonoptional=n=>tm(e,n),e.array=()=>ot(e),e.or=n=>Ug([e,n]),e.and=n=>Hg(e,n),e.transform=n=>ra(e,Wg(n)),e.default=n=>Kg(e,n),e.prefault=n=>em(e,n),e.catch=n=>rm(e,n),e.pipe=n=>ra(e,n),e.readonly=()=>im(e),e.describe=n=>{const r=e.clone();return Rr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Rr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Rr.get(e);const r=e.clone();return Rr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),yc=w("_ZodString",(e,t)=>{var r,o,i;Ws.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Tf(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(cf(...a)),e.includes=(...a)=>e.check(df(...a)),e.startsWith=(...a)=>e.check(pf(...a)),e.endsWith=(...a)=>e.check(hf(...a)),e.min=(...a)=>e.check($o(...a)),e.max=(...a)=>e.check(gc(...a)),e.length=(...a)=>e.check(mc(...a)),e.nonempty=(...a)=>e.check($o(1,...a)),e.lowercase=a=>e.check(lf(a)),e.uppercase=a=>e.check(uf(a)),e.trim=()=>e.check(gf()),e.normalize=(...a)=>e.check(ff(...a)),e.toLowerCase=()=>e.check(mf()),e.toUpperCase=()=>e.check(bf()),e.slugify=()=>e.check(kf())}),fg=w("ZodString",(e,t)=>{Ws.init(e,t),yc.init(e,t),e.email=n=>e.check(Rh(gg,n)),e.url=n=>e.check(Oh(mg,n)),e.jwt=n=>e.check(Yh(Lg,n)),e.emoji=n=>e.check(Nh(bg,n)),e.guid=n=>e.check(Ji(Ki,n)),e.uuid=n=>e.check(Lh(lo,n)),e.uuidv4=n=>e.check(zh(lo,n)),e.uuidv6=n=>e.check(Ih(lo,n)),e.uuidv7=n=>e.check($h(lo,n)),e.nanoid=n=>e.check(Dh(kg,n)),e.guid=n=>e.check(Ji(Ki,n)),e.cuid=n=>e.check(Mh(_g,n)),e.cuid2=n=>e.check(jh(vg,n)),e.ulid=n=>e.check(Uh(yg,n)),e.base64=n=>e.check(Wh(Cg,n)),e.base64url=n=>e.check(Jh(Pg,n)),e.xid=n=>e.check(Zh(wg,n)),e.ksuid=n=>e.check(qh(xg,n)),e.ipv4=n=>e.check(Hh(Sg,n)),e.ipv6=n=>e.check(Fh(Tg,n)),e.cidrv4=n=>e.check(Bh(Eg,n)),e.cidrv6=n=>e.check(Gh(Ag,n)),e.e164=n=>e.check(Vh(Rg,n)),e.datetime=n=>e.check(Jf(n)),e.date=n=>e.check(Yf(n)),e.time=n=>e.check(Kf(n)),e.duration=n=>e.check(eg(n))});function P(e){return Ph(fg,e)}const ye=w("ZodStringFormat",(e,t)=>{ke.init(e,t),yc.init(e,t)}),gg=w("ZodEmail",(e,t)=>{Op.init(e,t),ye.init(e,t)}),Ki=w("ZodGUID",(e,t)=>{Ip.init(e,t),ye.init(e,t)}),lo=w("ZodUUID",(e,t)=>{$p.init(e,t),ye.init(e,t)}),mg=w("ZodURL",(e,t)=>{Np.init(e,t),ye.init(e,t)}),bg=w("ZodEmoji",(e,t)=>{Dp.init(e,t),ye.init(e,t)}),kg=w("ZodNanoID",(e,t)=>{Mp.init(e,t),ye.init(e,t)}),_g=w("ZodCUID",(e,t)=>{jp.init(e,t),ye.init(e,t)}),vg=w("ZodCUID2",(e,t)=>{Up.init(e,t),ye.init(e,t)}),yg=w("ZodULID",(e,t)=>{Zp.init(e,t),ye.init(e,t)}),wg=w("ZodXID",(e,t)=>{qp.init(e,t),ye.init(e,t)}),xg=w("ZodKSUID",(e,t)=>{Hp.init(e,t),ye.init(e,t)}),Sg=w("ZodIPv4",(e,t)=>{Jp.init(e,t),ye.init(e,t)}),Tg=w("ZodIPv6",(e,t)=>{Vp.init(e,t),ye.init(e,t)}),Eg=w("ZodCIDRv4",(e,t)=>{Yp.init(e,t),ye.init(e,t)}),Ag=w("ZodCIDRv6",(e,t)=>{Xp.init(e,t),ye.init(e,t)}),Cg=w("ZodBase64",(e,t)=>{Kp.init(e,t),ye.init(e,t)}),Pg=w("ZodBase64URL",(e,t)=>{eh.init(e,t),ye.init(e,t)}),Rg=w("ZodE164",(e,t)=>{th.init(e,t),ye.init(e,t)}),Lg=w("ZodJWT",(e,t)=>{rh.init(e,t),ye.init(e,t)}),wc=w("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,m;uc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(g,k,v)=>Ef(e,g,k),e.gt=(g,k)=>e.check(Yi(g,k)),e.gte=(g,k)=>e.check(gs(g,k)),e.min=(g,k)=>e.check(gs(g,k)),e.lt=(g,k)=>e.check(Vi(g,k)),e.lte=(g,k)=>e.check(fs(g,k)),e.max=(g,k)=>e.check(fs(g,k)),e.int=g=>e.check(Qi(g)),e.safe=g=>e.check(Qi(g)),e.positive=g=>e.check(Yi(0,g)),e.nonnegative=g=>e.check(gs(0,g)),e.negative=g=>e.check(Vi(0,g)),e.nonpositive=g=>e.check(fs(0,g)),e.multipleOf=(g,k)=>e.check(Xi(g,k)),e.step=(g,k)=>e.check(Xi(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=(l=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?l:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(m=n.format)!=null?m:null});function It(e){return tf(wc,e)}const zg=w("ZodNumberFormat",(e,t)=>{oh.init(e,t),wc.init(e,t)});function Qi(e){return nf(zg,e)}const Ig=w("ZodBoolean",(e,t)=>{sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Af(e,n,r)});function ge(e){return rf(Ig,e)}const $g=w("ZodAny",(e,t)=>{ih.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf()});function xc(){return of($g)}const Og=w("ZodUnknown",(e,t)=>{ah.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf()});function ea(){return sf(Og)}const Ng=w("ZodNever",(e,t)=>{ch.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cf(e,n,r)});function Dg(e){return af(Ng,e)}const Mg=w("ZodArray",(e,t)=>{lh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check($o(n,r)),e.nonempty=n=>e.check($o(1,n)),e.max=(n,r)=>e.check(gc(n,r)),e.length=(n,r)=>e.check(mc(n,r)),e.unwrap=()=>e.element});function ot(e,t){return _f(Mg,e,t)}const jg=w("ZodObject",(e,t)=>{dh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>ut(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(D(y({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(D(y({},e._zod.def),{catchall:ea()})),e.loose=()=>e.clone(D(y({},e._zod.def),{catchall:ea()})),e.strict=()=>e.clone(D(y({},e._zod.def),{catchall:Dg()})),e.strip=()=>e.clone(D(y({},e._zod.def),{catchall:void 0})),e.extend=n=>Ld(e,n),e.safeExtend=n=>zd(e,n),e.merge=n=>Id(e,n),e.pick=n=>Pd(e,n),e.omit=n=>Rd(e,n),e.partial=(...n)=>$d(Ec,e,n[0]),e.required=(...n)=>Od(Ac,e,n[0])});function fe(e,t){const n=y({type:"object",shape:e!=null?e:{}},U(t));return new jg(n)}const Sc=w("ZodUnion",(e,t)=>{hc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r,o),e.options=t.options});function Ug(e,t){return new Sc(y({type:"union",options:e},U(t)))}const Zg=w("ZodDiscriminatedUnion",(e,t)=>{Sc.init(e,t),ph.init(e,t)});function Tc(e,t,n){return new Zg(y({type:"union",options:t,discriminator:e},U(n)))}const qg=w("ZodIntersection",(e,t)=>{hh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r,o)});function Hg(e,t){return new qg({type:"intersection",left:e,right:t})}const Fg=w("ZodRecord",(e,t)=>{fh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Rt(e,t,n){return new Fg(y({type:"record",keyType:e,valueType:t},U(n)))}const Ps=w("ZodEnum",(e,t)=>{gh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Lf(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 Ps(D(y(D(y({},t),{checks:[]}),U(o)),{entries:i}))},e.exclude=(r,o)=>{const i=y({},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 Ps(D(y(D(y({},t),{checks:[]}),U(o)),{entries:i}))}});function ut(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ps(y({type:"enum",entries:n},U(t)))}const Bg=w("ZodLiteral",(e,t)=>{mh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(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 lt(e,t){return new Bg(y({type:"literal",values:Array.isArray(e)?e:[e]},U(t)))}const Gg=w("ZodTransform",(e,t)=>{bh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Ja(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(jr(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),(l=p.inst)!=null||(p.inst=e),n.issues.push(jr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Wg(e){return new Gg({type:"transform",transform:e})}const Ec=w("ZodOptional",(e,t)=>{fc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ta(e){return new Ec({type:"optional",innerType:e})}const Jg=w("ZodExactOptional",(e,t)=>{kh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vg(e){return new Jg({type:"optional",innerType:e})}const Yg=w("ZodNullable",(e,t)=>{_h.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function na(e){return new Yg({type:"nullable",innerType:e})}const Xg=w("ZodDefault",(e,t)=>{vh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Kg(e,t){return new Xg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ka(t)}})}const Qg=w("ZodPrefault",(e,t)=>{yh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function em(e,t){return new Qg({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ka(t)}})}const Ac=w("ZodNonOptional",(e,t)=>{wh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tm(e,t){return new Ac(y({type:"nonoptional",innerType:e},U(t)))}const nm=w("ZodCatch",(e,t)=>{xh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function rm(e,t){return new nm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const om=w("ZodPipe",(e,t)=>{Sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.in=t.in,e.out=t.out});function ra(e,t){return new om({type:"pipe",in:e,out:t})}const sm=w("ZodReadonly",(e,t)=>{Th.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function im(e){return new sm({type:"readonly",innerType:e})}const am=w("ZodCustom",(e,t)=>{Eh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(e,n)});function cm(e,t={}){return vf(am,e,t)}function lm(e){return yf(e)}const um=fe({name:P().min(1).max(100).optional(),command:P().min(1).max(500),args:ot(P()).optional(),failOnError:ge().default(!0).optional(),timeout:It().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:P().optional(),env:Rt(P(),P()).optional(),runOnBackground:ge().optional(),agentTags:ot(P()).optional()});fe({name:P(),command:P(),success:ge(),exitCode:It().optional(),stdout:P().optional(),stderr:P().optional(),error:P().optional(),duration:It(),failOnError:ge()});const xn=fe({path:P(),extraCommands:ot(um).optional(),id:P().uuid().optional(),rotationKey:P().optional(),usageStatus:ut(["free","in_use"]).optional(),agentTags:ot(P()).optional()}),dm=Tc("operation",[xn.extend({operation:lt("create"),content:P().optional(),contentPath:P().optional(),encoding:ut(["utf-8","base64"]).optional()}),xn.extend({operation:lt("merge"),data:Rt(P(),xc()),mergeStrategy:ut(["deep","shallow"]).optional(),arrayMergeStrategy:ut(["concat","replace"]).optional()}),xn.extend({operation:lt("modify"),content:P().optional(),contentPath:P().optional(),createIfMissing:ge().optional()}),xn.extend({operation:lt("delete"),ignoreIfMissing:ge().optional()}),xn.extend({operation:lt("createDirectory"),contentPath:P().optional(),mode:It().optional(),ignoreIfExists:ge().optional()}),xn.extend({operation:lt("download"),url:P().url(),headers:Rt(P(),P()).optional(),timeout:It().min(1e3).max(3e5).optional()}),xn.extend({operation:lt("gitClone"),gitUrl:P(),gitSecretKey:P().optional(),sourceBranch:P().optional(),targetBranch:P().optional(),originalBranch:P().optional(),defaultBranch:P().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 pm=fe({type:ut(["json","file","regex"]).describe("Extraction method"),source:P().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:P().optional().describe("Regex pattern for extraction")}),hm=fe({type:ut(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:xc().describe("Hook-specific configuration")});fe({command:P().optional().describe("Legacy — unused in SDK mode"),args:ot(P()).optional().describe("Legacy — unused in SDK mode"),env:Rt(P(),P()).optional().describe("Environment variables"),workingDirectory:P().optional().describe("Working directory for command execution"),fileOperations:ot(dm).optional().describe("File operations to perform during setup"),gitUrl:P().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:P().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:P().optional().describe("Commit message for git operations"),resultExtraction:pm.optional().describe("Schema for extracting result data"),postExecutionHooks:ot(hm).optional().describe("Hooks to run after task completion"),executionMode:ut(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Tc("executionMode",[fe({executionMode:lt("claudeAgentSdk"),promptText:P(),sdkOptions:fe({model:P(),permissionMode:ut(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ot(P()),allowDangerouslySkipPermissions:ge(),persistSession:ge(),streamSdkEvents:ge().optional(),allowedTools:ot(P()).optional(),settings:fe({enabledPlugins:Rt(P(),ge())}),env:Rt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:lt("opencodeSdk"),promptText:P(),sdkOptions:fe({provider:P(),model:P(),allowedTools:ot(P()).optional(),env:Rt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:lt("openaiAgentSdk"),promptText:P(),sdkOptions:fe({model:P(),env:Rt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:lt("codexSdk"),promptText:P(),sdkOptions:fe({model:P().optional(),sandboxMode:ut(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:ut(["never","on-request","on-failure","untrusted"]).optional(),env:Rt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:lt("cursorSdk"),promptText:P(),sdkOptions:fe({model:P(),env:Rt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ge().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:P().optional().describe("Final approved plan content"),planApproved:ge().optional().describe("Plan approval status"),planApprovedAt:P().optional().describe("ISO timestamp of approval"),planRejected:ge().optional().describe("Plan rejection flag"),planRejectionFeedback:P().optional().describe("User rejection feedback"),rejectedPlanContent:P().optional().describe("Previously rejected plan content"),planCompletedAt:P().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:P().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:P().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:P().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:ot(fe({feedback:P(),rejectedAt:P()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:It().optional(),notificationChannelPlanMessageSentAt:P().optional(),notificationChannelCompletedMessageId:It().optional(),notificationChannelFailedMessageId:It().optional(),streamSdkEvents:ge().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:P().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ge().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ot(fe({id:P(),selectedText:P(),startOffset:It(),endOffset:It(),commentText:P(),createdAt:P()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ge().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ge().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:ge().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 Cc="browser_capture",fm="browser_automate";function oa(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 gm(e,t){const n=oa(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===oa(r)}function sa(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:[])gm(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function Pc(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 mm=3e4;function No(r){return L(this,arguments,function*(e,t={},n=mm){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,D(y({},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 qe(e,t,n,r){return L(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield No(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Pc(a)})}function bm(e,t){return L(this,null,function*(){return qe(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const km=["project","note","ctx"];function _m(e){var n,r;const t=km.filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`);if(!((n=e.project)!=null&&n.id)&&!((r=e.project)!=null&&r.key))throw new Error("createTask: project must have an id or key")}function Rs(e,t){return L(this,null,function*(){var h,m,g,k,v,T;_m(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:l,type:p=Cc}=t;return qe(e,"POST","/tasks",D(y(y(y(y(y(y(y(y(y(y(y(y(D(y({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r},n.id?{projectId:n.id}:{projectKey:n.key}),{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}:{}),(m=i==null?void 0:i.selectedSkillIds)!=null&&m.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(v=i==null?void 0:i.selectedSlashCommandIds)!=null&&v.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(T=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&T.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:y({type:p,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},l!==void 0?{allowSubmit:l}:{})}))})}function ia(e,t){return L(this,null,function*(){return Rs(e,D(y({},t),{type:fm}))})}function aa(e,t,n,r){return L(this,null,function*(){var o;return qe(e,"POST","/planning-sessions",y(D(y({},t.id?{projectId:t.id}:{projectKey:t.key}),{instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1}),r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function vm(e,t){return L(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return qe(e,"GET",`/claude-templates${n}`)})}function Rc(e,t){return L(this,null,function*(){return qe(e,"GET",`/tasks/${t}`)})}function ym(e,t){return L(this,null,function*(){return qe(e,"GET",`/planning-sessions/${t}`)})}function ca(e){return L(this,null,function*(){return qe(e,"GET","/projects")})}function wm(e){return L(this,null,function*(){return(yield qe(e,"GET","/tenants/current")).membership})}function la(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function ua(e,t,n){return L(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield No(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Pc(i)})}function xm(e,t){return L(this,null,function*(){return qe(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Sm(e,t,n,r,o){return L(this,null,function*(){return qe(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function Tm(e,t){return L(this,null,function*(){return qe(e,"GET",`/tasks/${t}/chunks`)})}function Em(e,t,n){return L(this,null,function*(){return qe(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function Am(e,t){return L(this,null,function*(){return qe(e,"POST",`/tasks/${t}/cancel`)})}function Cm(e,t){return L(this,null,function*(){return qe(e,"POST",`/tasks/${t}/approve-result`)})}function Pm(e,t,n){return L(this,null,function*(){return qe(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Do(e,t){return L(this,null,function*(){return qe(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Lc(e,t,n,r){return L(this,null,function*(){return qe(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Rm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ms={exports:{}};/*!
1511
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const m=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(l=e.external.registry.get(h[0]))==null?void 0:l.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(m.cycle){i(h);continue}if(m.count>1&&e.reused==="ref"){i(h);continue}}}function wc(e,t){var a,d,l,p,h;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=m=>{var Q,M,E;const g=e.seen.get(m);if(g.ref===null)return;const k=(Q=g.def)!=null?Q:g.schema,v=y({},k),T=g.ref;if(g.ref=null,T){r(T);const S=e.seen.get(T),C=S.schema;if(C.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(k.allOf=(M=k.allOf)!=null?M:[],k.allOf.push(C)):Object.assign(k,C),Object.assign(k,v),m._zod.parent===T)for(const J in k)J==="$ref"||J==="allOf"||J in v||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=m._zod.parent;if(Z&&Z!==T){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:(E=g.path)!=null?E:[]})};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,(l=n.def)!=null?l:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};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:D(y({},t["~standard"]),{jsonSchema:{input:Do(t,"input",e.processors),output:Do(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 Tf=(e,t={})=>n=>{const r=vc(D(y({},n),{processors:t}));return Re(e,r),yc(r,e),wc(r,e)},Do=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=vc(D(y({},o!=null?o:{}),{target:i,io:t,processors:n}));return Re(e,a),yc(a,e),wc(a,e)},Ef={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Af=(e,t,n,r)=>{var h;const o=n;o.type="string";const{minimum:i,maximum:a,format:d,patterns:l,contentEncoding:p}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),d&&(o.format=(h=Ef[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const m=[...l];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(g=>D(y({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:g.source}))])}},Cf=(e,t,n,r)=>{const o=n,{minimum:i,maximum:a,format:d,multipleOf:l,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 l=="number"&&(o.multipleOf=l)},Pf=(e,t,n,r)=>{n.type="boolean"},Rf=(e,t,n,r)=>{n.not={}},Lf=(e,t,n,r)=>{},zf=(e,t,n,r)=>{},If=(e,t,n,r)=>{const o=e._zod.def,i=Qa(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},$f=(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},Of=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Nf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Df=(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=Re(i.element,t,D(y({},r),{path:[...r.path,"items"]}))},Mf=(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]=Re(a[h],t,D(y({},r),{path:[...r.path,"properties",h]}));const d=new Set(Object.keys(a)),l=new Set([...d].filter(h=>{const m=i.shape[h]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((p=i.catchall)==null?void 0:p._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=Re(i.catchall,t,D(y({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},jf=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Re(d,t,D(y({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Uf=(e,t,n,r)=>{const o=e._zod.def,i=Re(o.left,t,D(y({},r),{path:[...r.path,"allOf",0]})),a=Re(o.right,t,D(y({},r),{path:[...r.path,"allOf",1]})),d=p=>"allOf"in p&&Object.keys(p).length===1,l=[...d(i)?i.allOf:[i],...d(a)?a.allOf:[a]];n.allOf=l},Zf=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,d=a._zod.bag,l=d==null?void 0:d.patterns;if(i.mode==="loose"&&l&&l.size>0){const h=Re(i.valueType,t,D(y({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const m of l)o.patternProperties[m.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Re(i.keyType,t,D(y({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Re(i.valueType,t,D(y({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(m=>typeof m=="string"||typeof m=="number");h.length>0&&(o.required=h)}},qf=(e,t,n,r)=>{const o=e._zod.def,i=Re(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"}]},Hf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Ff=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Bf=(e,t,n,r)=>{const o=e._zod.def;Re(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)))},Gf=(e,t,n,r)=>{const o=e._zod.def;Re(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},Wf=(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;Re(i,t,r);const a=t.seen.get(e);a.ref=i},Jf=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},xc=(e,t,n,r)=>{const o=e._zod.def;Re(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Vf=w("ZodISODateTime",(e,t)=>{Gp.init(e,t),ye.init(e,t)});function Yf(e){return Qh(Vf,e)}const Xf=w("ZodISODate",(e,t)=>{Wp.init(e,t),ye.init(e,t)});function Kf(e){return ef(Xf,e)}const Qf=w("ZodISOTime",(e,t)=>{Jp.init(e,t),ye.init(e,t)});function eg(e){return tf(Qf,e)}const tg=w("ZodISODuration",(e,t)=>{Vp.init(e,t),ye.init(e,t)});function ng(e){return nf(tg,e)}const rg=(e,t)=>{rc.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>jd(e,n)},flatten:{value:n=>Md(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}}})},ft=w("ZodError",rg,{Parent:Error}),og=Ws(ft),sg=Js(ft),ig=Ko(ft),ag=Qo(ft),cg=qd(ft),lg=Hd(ft),ug=Fd(ft),dg=Bd(ft),pg=Gd(ft),hg=Wd(ft),fg=Jd(ft),gg=Vd(ft),_e=w("ZodType",(e,t)=>(be.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Do(e,"input"),output:Do(e,"output")}}),e.toJSONSchema=Tf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(fn(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)=>gn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>og(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>ig(e,n,r),e.parseAsync=(n,r)=>z(null,null,function*(){return sg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>z(null,null,function*(){return ag(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>cg(e,n,r),e.decode=(n,r)=>lg(e,n,r),e.encodeAsync=(n,r)=>z(null,null,function*(){return ug(e,n,r)}),e.decodeAsync=(n,r)=>z(null,null,function*(){return dg(e,n,r)}),e.safeEncode=(n,r)=>pg(e,n,r),e.safeDecode=(n,r)=>hg(e,n,r),e.safeEncodeAsync=(n,r)=>z(null,null,function*(){return fg(e,n,r)}),e.safeDecodeAsync=(n,r)=>z(null,null,function*(){return gg(e,n,r)}),e.refine=(n,r)=>e.check(um(n,r)),e.superRefine=n=>e.check(dm(n)),e.overwrite=n=>e.check(lr(n)),e.optional=()=>ra(e),e.exactOptional=()=>Xg(e),e.nullable=()=>oa(e),e.nullish=()=>ra(oa(e)),e.nonoptional=n=>rm(e,n),e.array=()=>ot(e),e.or=n=>qg([e,n]),e.and=n=>Bg(e,n),e.transform=n=>sa(e,Vg(n)),e.default=n=>em(e,n),e.prefault=n=>nm(e,n),e.catch=n=>sm(e,n),e.pipe=n=>sa(e,n),e.readonly=()=>cm(e),e.describe=n=>{const r=e.clone();return Lr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Lr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Lr.get(e);const r=e.clone();return Lr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Sc=w("_ZodString",(e,t)=>{var r,o,i;Vs.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Af(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(uf(...a)),e.includes=(...a)=>e.check(hf(...a)),e.startsWith=(...a)=>e.check(ff(...a)),e.endsWith=(...a)=>e.check(gf(...a)),e.min=(...a)=>e.check(No(...a)),e.max=(...a)=>e.check(kc(...a)),e.length=(...a)=>e.check(_c(...a)),e.nonempty=(...a)=>e.check(No(1,...a)),e.lowercase=a=>e.check(df(a)),e.uppercase=a=>e.check(pf(a)),e.trim=()=>e.check(bf()),e.normalize=(...a)=>e.check(mf(...a)),e.toLowerCase=()=>e.check(kf()),e.toUpperCase=()=>e.check(_f()),e.slugify=()=>e.check(vf())}),mg=w("ZodString",(e,t)=>{Vs.init(e,t),Sc.init(e,t),e.email=n=>e.check(zh(bg,n)),e.url=n=>e.check(Dh(kg,n)),e.jwt=n=>e.check(Kh(Ig,n)),e.emoji=n=>e.check(Mh(_g,n)),e.guid=n=>e.check(Yi(ea,n)),e.uuid=n=>e.check(Ih(uo,n)),e.uuidv4=n=>e.check($h(uo,n)),e.uuidv6=n=>e.check(Oh(uo,n)),e.uuidv7=n=>e.check(Nh(uo,n)),e.nanoid=n=>e.check(jh(vg,n)),e.guid=n=>e.check(Yi(ea,n)),e.cuid=n=>e.check(Uh(yg,n)),e.cuid2=n=>e.check(Zh(wg,n)),e.ulid=n=>e.check(qh(xg,n)),e.base64=n=>e.check(Vh(Rg,n)),e.base64url=n=>e.check(Yh(Lg,n)),e.xid=n=>e.check(Hh(Sg,n)),e.ksuid=n=>e.check(Fh(Tg,n)),e.ipv4=n=>e.check(Bh(Eg,n)),e.ipv6=n=>e.check(Gh(Ag,n)),e.cidrv4=n=>e.check(Wh(Cg,n)),e.cidrv6=n=>e.check(Jh(Pg,n)),e.e164=n=>e.check(Xh(zg,n)),e.datetime=n=>e.check(Yf(n)),e.date=n=>e.check(Kf(n)),e.time=n=>e.check(eg(n)),e.duration=n=>e.check(ng(n))});function P(e){return Lh(mg,e)}const ye=w("ZodStringFormat",(e,t)=>{ke.init(e,t),Sc.init(e,t)}),bg=w("ZodEmail",(e,t)=>{Dp.init(e,t),ye.init(e,t)}),ea=w("ZodGUID",(e,t)=>{Op.init(e,t),ye.init(e,t)}),uo=w("ZodUUID",(e,t)=>{Np.init(e,t),ye.init(e,t)}),kg=w("ZodURL",(e,t)=>{Mp.init(e,t),ye.init(e,t)}),_g=w("ZodEmoji",(e,t)=>{jp.init(e,t),ye.init(e,t)}),vg=w("ZodNanoID",(e,t)=>{Up.init(e,t),ye.init(e,t)}),yg=w("ZodCUID",(e,t)=>{Zp.init(e,t),ye.init(e,t)}),wg=w("ZodCUID2",(e,t)=>{qp.init(e,t),ye.init(e,t)}),xg=w("ZodULID",(e,t)=>{Hp.init(e,t),ye.init(e,t)}),Sg=w("ZodXID",(e,t)=>{Fp.init(e,t),ye.init(e,t)}),Tg=w("ZodKSUID",(e,t)=>{Bp.init(e,t),ye.init(e,t)}),Eg=w("ZodIPv4",(e,t)=>{Yp.init(e,t),ye.init(e,t)}),Ag=w("ZodIPv6",(e,t)=>{Xp.init(e,t),ye.init(e,t)}),Cg=w("ZodCIDRv4",(e,t)=>{Kp.init(e,t),ye.init(e,t)}),Pg=w("ZodCIDRv6",(e,t)=>{Qp.init(e,t),ye.init(e,t)}),Rg=w("ZodBase64",(e,t)=>{eh.init(e,t),ye.init(e,t)}),Lg=w("ZodBase64URL",(e,t)=>{nh.init(e,t),ye.init(e,t)}),zg=w("ZodE164",(e,t)=>{rh.init(e,t),ye.init(e,t)}),Ig=w("ZodJWT",(e,t)=>{sh.init(e,t),ye.init(e,t)}),Tc=w("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,m;hc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(g,k,v)=>Cf(e,g,k),e.gt=(g,k)=>e.check(Ki(g,k)),e.gte=(g,k)=>e.check(bs(g,k)),e.min=(g,k)=>e.check(bs(g,k)),e.lt=(g,k)=>e.check(Xi(g,k)),e.lte=(g,k)=>e.check(ms(g,k)),e.max=(g,k)=>e.check(ms(g,k)),e.int=g=>e.check(ta(g)),e.safe=g=>e.check(ta(g)),e.positive=g=>e.check(Ki(0,g)),e.nonnegative=g=>e.check(bs(0,g)),e.negative=g=>e.check(Xi(0,g)),e.nonpositive=g=>e.check(ms(0,g)),e.multipleOf=(g,k)=>e.check(Qi(g,k)),e.step=(g,k)=>e.check(Qi(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=(l=Math.min((a=n.maximum)!=null?a:Number.POSITIVE_INFINITY,(d=n.exclusiveMaximum)!=null?d:Number.POSITIVE_INFINITY))!=null?l:null,e.isInt=((p=n.format)!=null?p:"").includes("int")||Number.isSafeInteger((h=n.multipleOf)!=null?h:.5),e.isFinite=!0,e.format=(m=n.format)!=null?m:null});function $t(e){return rf(Tc,e)}const $g=w("ZodNumberFormat",(e,t)=>{ih.init(e,t),Tc.init(e,t)});function ta(e){return of($g,e)}const Og=w("ZodBoolean",(e,t)=>{ah.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pf(e,n,r)});function ge(e){return sf(Og,e)}const Ng=w("ZodAny",(e,t)=>{ch.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lf()});function Ec(){return af(Ng)}const Dg=w("ZodUnknown",(e,t)=>{lh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf()});function na(){return cf(Dg)}const Mg=w("ZodNever",(e,t)=>{uh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rf(e,n,r)});function jg(e){return lf(Mg,e)}const Ug=w("ZodArray",(e,t)=>{dh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(No(n,r)),e.nonempty=n=>e.check(No(1,n)),e.max=(n,r)=>e.check(kc(n,r)),e.length=(n,r)=>e.check(_c(n,r)),e.unwrap=()=>e.element});function ot(e,t){return yf(Ug,e,t)}const Zg=w("ZodObject",(e,t)=>{hh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>dt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone(D(y({},e._zod.def),{catchall:n})),e.passthrough=()=>e.clone(D(y({},e._zod.def),{catchall:na()})),e.loose=()=>e.clone(D(y({},e._zod.def),{catchall:na()})),e.strict=()=>e.clone(D(y({},e._zod.def),{catchall:jg()})),e.strip=()=>e.clone(D(y({},e._zod.def),{catchall:void 0})),e.extend=n=>Id(e,n),e.safeExtend=n=>$d(e,n),e.merge=n=>Od(e,n),e.pick=n=>Ld(e,n),e.omit=n=>zd(e,n),e.partial=(...n)=>Nd(Pc,e,n[0]),e.required=(...n)=>Dd(Rc,e,n[0])});function fe(e,t){const n=y({type:"object",shape:e!=null?e:{}},U(t));return new Zg(n)}const Ac=w("ZodUnion",(e,t)=>{mc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n,r,o),e.options=t.options});function qg(e,t){return new Ac(y({type:"union",options:e},U(t)))}const Hg=w("ZodDiscriminatedUnion",(e,t)=>{Ac.init(e,t),fh.init(e,t)});function Cc(e,t,n){return new Hg(y({type:"union",options:t,discriminator:e},U(n)))}const Fg=w("ZodIntersection",(e,t)=>{gh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o)});function Bg(e,t){return new Fg({type:"intersection",left:e,right:t})}const Gg=w("ZodRecord",(e,t)=>{mh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Lt(e,t,n){return new Gg(y({type:"record",keyType:e,valueType:t},U(n)))}const Ls=w("ZodEnum",(e,t)=>{bh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(r,o,i)=>If(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 Ls(D(y(D(y({},t),{checks:[]}),U(o)),{entries:i}))},e.exclude=(r,o)=>{const i=y({},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 Ls(D(y(D(y({},t),{checks:[]}),U(o)),{entries:i}))}});function dt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ls(y({type:"enum",entries:n},U(t)))}const Wg=w("ZodLiteral",(e,t)=>{kh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(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 ut(e,t){return new Wg(y({type:"literal",values:Array.isArray(e)?e:[e]},U(t)))}const Jg=w("ZodTransform",(e,t)=>{_h.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Xa(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Ur(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),(l=p.inst)!=null||(p.inst=e),n.issues.push(Ur(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Vg(e){return new Jg({type:"transform",transform:e})}const Pc=w("ZodOptional",(e,t)=>{bc.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ra(e){return new Pc({type:"optional",innerType:e})}const Yg=w("ZodExactOptional",(e,t)=>{vh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Xg(e){return new Yg({type:"optional",innerType:e})}const Kg=w("ZodNullable",(e,t)=>{yh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function oa(e){return new Kg({type:"nullable",innerType:e})}const Qg=w("ZodDefault",(e,t)=>{wh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function em(e,t){return new Qg({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():tc(t)}})}const tm=w("ZodPrefault",(e,t)=>{xh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nm(e,t){return new tm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():tc(t)}})}const Rc=w("ZodNonOptional",(e,t)=>{Sh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function rm(e,t){return new Rc(y({type:"nonoptional",innerType:e},U(t)))}const om=w("ZodCatch",(e,t)=>{Th.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sm(e,t){return new om({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const im=w("ZodPipe",(e,t)=>{Eh.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wf(e,n,r,o),e.in=t.in,e.out=t.out});function sa(e,t){return new im({type:"pipe",in:e,out:t})}const am=w("ZodReadonly",(e,t)=>{Ah.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function cm(e){return new am({type:"readonly",innerType:e})}const lm=w("ZodCustom",(e,t)=>{Ch.init(e,t),_e.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of(e,n)});function um(e,t={}){return wf(lm,e,t)}function dm(e){return xf(e)}const pm=fe({name:P().min(1).max(100).optional(),command:P().min(1).max(500),args:ot(P()).optional(),failOnError:ge().default(!0).optional(),timeout:$t().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:P().optional(),env:Lt(P(),P()).optional(),runOnBackground:ge().optional(),agentTags:ot(P()).optional()});fe({name:P(),command:P(),success:ge(),exitCode:$t().optional(),stdout:P().optional(),stderr:P().optional(),error:P().optional(),duration:$t(),failOnError:ge()});const Sn=fe({path:P(),extraCommands:ot(pm).optional(),id:P().uuid().optional(),rotationKey:P().optional(),usageStatus:dt(["free","in_use"]).optional(),agentTags:ot(P()).optional()}),hm=Cc("operation",[Sn.extend({operation:ut("create"),content:P().optional(),contentPath:P().optional(),encoding:dt(["utf-8","base64"]).optional()}),Sn.extend({operation:ut("merge"),data:Lt(P(),Ec()),mergeStrategy:dt(["deep","shallow"]).optional(),arrayMergeStrategy:dt(["concat","replace"]).optional()}),Sn.extend({operation:ut("modify"),content:P().optional(),contentPath:P().optional(),createIfMissing:ge().optional()}),Sn.extend({operation:ut("delete"),ignoreIfMissing:ge().optional()}),Sn.extend({operation:ut("createDirectory"),contentPath:P().optional(),mode:$t().optional(),ignoreIfExists:ge().optional()}),Sn.extend({operation:ut("download"),url:P().url(),headers:Lt(P(),P()).optional(),timeout:$t().min(1e3).max(3e5).optional()}),Sn.extend({operation:ut("gitClone"),gitUrl:P(),gitSecretKey:P().optional(),sourceBranch:P().optional(),targetBranch:P().optional(),originalBranch:P().optional(),defaultBranch:P().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 fm=fe({type:dt(["json","file","regex"]).describe("Extraction method"),source:P().describe("Source to extract from (file path or stdout/stderr)"),schema:fe({}).passthrough().optional().describe("JSON schema for validation"),pattern:P().optional().describe("Regex pattern for extraction")}),gm=fe({type:dt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Ec().describe("Hook-specific configuration")});fe({command:P().optional().describe("Legacy — unused in SDK mode"),args:ot(P()).optional().describe("Legacy — unused in SDK mode"),env:Lt(P(),P()).optional().describe("Environment variables"),workingDirectory:P().optional().describe("Working directory for command execution"),fileOperations:ot(hm).optional().describe("File operations to perform during setup"),gitUrl:P().optional().describe("Git repository URL (populated from project)"),gitPrivateKey:P().optional().describe("Git SSH private key (populated from project)"),gitCommitMessage:P().optional().describe("Commit message for git operations"),resultExtraction:fm.optional().describe("Schema for extracting result data"),postExecutionHooks:ot(gm).optional().describe("Hooks to run after task completion"),executionMode:dt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Cc("executionMode",[fe({executionMode:ut("claudeAgentSdk"),promptText:P(),sdkOptions:fe({model:P(),permissionMode:dt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ot(P()),allowDangerouslySkipPermissions:ge(),persistSession:ge(),streamSdkEvents:ge().optional(),allowedTools:ot(P()).optional(),settings:fe({enabledPlugins:Lt(P(),ge())}),env:Lt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:ut("opencodeSdk"),promptText:P(),sdkOptions:fe({provider:P(),model:P(),allowedTools:ot(P()).optional(),env:Lt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:ut("openaiAgentSdk"),promptText:P(),sdkOptions:fe({model:P(),env:Lt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:ut("codexSdk"),promptText:P(),sdkOptions:fe({model:P().optional(),sandboxMode:dt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:dt(["never","on-request","on-failure","untrusted"]).optional(),env:Lt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()}),fe({executionMode:ut("cursorSdk"),promptText:P(),sdkOptions:fe({model:P(),env:Lt(P(),P()).optional()}),resume:fe({sessionId:P().optional(),continue:ge()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:ge().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:P().optional().describe("Final approved plan content"),planApproved:ge().optional().describe("Plan approval status"),planApprovedAt:P().optional().describe("ISO timestamp of approval"),planRejected:ge().optional().describe("Plan rejection flag"),planRejectionFeedback:P().optional().describe("User rejection feedback"),rejectedPlanContent:P().optional().describe("Previously rejected plan content"),planCompletedAt:P().optional().describe("ISO timestamp when plan was generated"),planRejectedAt:P().optional().describe("ISO timestamp when plan was rejected"),resultRejectionFeedback:P().optional().describe("User feedback when rejecting the result (most recent)"),resultRejectedAt:P().optional().describe("ISO timestamp when result was rejected (most recent)"),resultRejectionHistory:ot(fe({feedback:P(),rejectedAt:P()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:$t().optional(),notificationChannelPlanMessageSentAt:P().optional(),notificationChannelCompletedMessageId:$t().optional(),notificationChannelFailedMessageId:$t().optional(),streamSdkEvents:ge().optional().describe("Stream SDK messages (thinking, tool calls, etc.) as sdk_event chunks"),originalTaskSummary:P().optional().describe("Summary from the original task run (passed to retry for historical context)"),planWasApproved:ge().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ot(fe({id:P(),selectedText:P(),startOffset:$t(),endOffset:$t(),commentText:P(),createdAt:P()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:ge().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:ge().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:ge().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 Lc="browser_capture",mm="browser_automate";function ia(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 bm(e,t){const n=ia(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===ia(r)}function aa(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:[])bm(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}function zc(e){return z(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 km=3e4;function Mo(r){return z(this,arguments,function*(e,t={},n=km){const o=new AbortController,i=setTimeout(()=>o.abort(),n);try{return yield fetch(e,D(y({},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 qe(e,t,n,r){return z(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield Mo(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return zc(a)})}function _m(e,t){return z(this,null,function*(){return qe(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const vm=["project","note","ctx"];function ym(e){var n,r;const t=vm.filter(o=>e[o]===void 0||e[o]===null);if(t.length>0)throw new Error(`createTask: missing required field(s): ${t.join(", ")}`);if(!((n=e.project)!=null&&n.id)&&!((r=e.project)!=null&&r.key))throw new Error("createTask: project must have an id or key")}function zs(e,t){return z(this,null,function*(){var h,m,g,k,v,T;ym(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:l,type:p=Lc}=t;return qe(e,"POST","/tasks",D(y(y(y(y(y(y(y(y(y(y(y(y(D(y({type:p,title:a||r.slice(0,120)||o.pageTitle||"Browser capture",titleInstruction:d!=null?d:r},n.id?{projectId:n.id}:{projectKey:n.key}),{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}:{}),(m=i==null?void 0:i.selectedSkillIds)!=null&&m.length?{selectedSkillIds:i.selectedSkillIds}:{}),(g=i==null?void 0:i.selectedPluginSkillIds)!=null&&g.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(v=i==null?void 0:i.selectedSlashCommandIds)!=null&&v.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(T=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&T.length?{selectedRemoteContextProviderIds:i.selectedRemoteContextProviderIds}:{}),{metadata:y({type:p,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},l!==void 0?{allowSubmit:l}:{})}))})}function ca(e,t){return z(this,null,function*(){return zs(e,D(y({},t),{type:mm}))})}function la(e,t,n,r){return z(this,null,function*(){var o;return qe(e,"POST","/planning-sessions",y(D(y({},t.id?{projectId:t.id}:{projectKey:t.key}),{instruction:n,quickMode:(o=r==null?void 0:r.quickMode)!=null?o:!1}),r!=null&&r.claudeTemplateId?{claudeTemplateId:r.claudeTemplateId}:{}))})}function wm(e,t){return z(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return qe(e,"GET",`/claude-templates${n}`)})}function Ic(e,t){return z(this,null,function*(){return qe(e,"GET",`/tasks/${t}`)})}function xm(e,t){return z(this,null,function*(){return qe(e,"GET",`/planning-sessions/${t}`)})}function ua(e){return z(this,null,function*(){return qe(e,"GET","/projects")})}function Sm(e){return z(this,null,function*(){return(yield qe(e,"GET","/tenants/current")).membership})}function da(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function pa(e,t,n){return z(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield Mo(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return zc(i)})}function Tm(e,t){return z(this,null,function*(){return qe(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Em(e,t,n,r,o){return z(this,null,function*(){return qe(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function Am(e,t){return z(this,null,function*(){return qe(e,"GET",`/tasks/${t}/chunks`)})}function Cm(e,t,n){return z(this,null,function*(){return qe(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function Pm(e,t){return z(this,null,function*(){return qe(e,"POST",`/tasks/${t}/cancel`)})}function Rm(e,t){return z(this,null,function*(){return qe(e,"POST",`/tasks/${t}/approve-result`)})}function Lm(e,t,n){return z(this,null,function*(){return qe(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function jo(e,t){return z(this,null,function*(){return qe(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function $c(e,t,n,r){return z(this,null,function*(){return qe(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function zm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ks={exports:{}};/*!
1477
1512
  * Pusher JavaScript Library v8.5.0
1478
1513
  * https://pusher.com/
1479
1514
  *
1480
1515
  * Copyright 2020, Pusher
1481
1516
  * Released under the MIT licence.
1482
- */var da;function Lm(){return da||(da=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var l=this&&this.__extends||(function(){var M=function(E,S){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,q){C.__proto__=q}||function(C,q){for(var J in q)q.hasOwnProperty(J)&&(C[J]=q[J])},M(E,S)};return function(E,S){M(E,S);function C(){this.constructor=E}E.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function M(E){E===void 0&&(E="="),this._paddingCharacter=E}return M.prototype.encodedLength=function(E){return this._paddingCharacter?(E+2)/3*4|0:(E*8+5)/6|0},M.prototype.encode=function(E){for(var S="",C=0;C<E.length-2;C+=3){var q=E[C]<<16|E[C+1]<<8|E[C+2];S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),S+=this._encodeByte(q>>>6&63),S+=this._encodeByte(q>>>0&63)}var J=E.length-C;if(J>0){var q=E[C]<<16|(J===2?E[C+1]<<8:0);S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),J===2?S+=this._encodeByte(q>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},M.prototype.maxDecodedLength=function(E){return this._paddingCharacter?E/4*3|0:(E*6+7)/8|0},M.prototype.decodedLength=function(E){return this.maxDecodedLength(E.length-this._getPaddingLength(E))},M.prototype.decode=function(E){if(E.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(E),C=E.length-S,q=new Uint8Array(this.maxDecodedLength(C)),J=0,we=0,Ee=0,rt=0,ee=0,Le=0,Qe=0;we<C-4;we+=4)rt=this._decodeChar(E.charCodeAt(we+0)),ee=this._decodeChar(E.charCodeAt(we+1)),Le=this._decodeChar(E.charCodeAt(we+2)),Qe=this._decodeChar(E.charCodeAt(we+3)),q[J++]=rt<<2|ee>>>4,q[J++]=ee<<4|Le>>>2,q[J++]=Le<<6|Qe,Ee|=rt&p,Ee|=ee&p,Ee|=Le&p,Ee|=Qe&p;if(we<C-1&&(rt=this._decodeChar(E.charCodeAt(we)),ee=this._decodeChar(E.charCodeAt(we+1)),q[J++]=rt<<2|ee>>>4,Ee|=rt&p,Ee|=ee&p),we<C-2&&(Le=this._decodeChar(E.charCodeAt(we+2)),q[J++]=ee<<4|Le>>>2,Ee|=Le&p),we<C-3&&(Qe=this._decodeChar(E.charCodeAt(we+3)),q[J++]=Le<<6|Qe,Ee|=Qe&p),Ee!==0)throw new Error("Base64Coder: incorrect characters for decoding");return q},M.prototype._encodeByte=function(E){var S=E;return S+=65,S+=25-E>>>8&6,S+=51-E>>>8&-75,S+=61-E>>>8&-15,S+=62-E>>>8&3,String.fromCharCode(S)},M.prototype._decodeChar=function(E){var S=p;return S+=(42-E&E-44)>>>8&-p+E-43+62,S+=(46-E&E-48)>>>8&-p+E-47+63,S+=(47-E&E-58)>>>8&-p+E-48+52,S+=(64-E&E-91)>>>8&-p+E-65+0,S+=(96-E&E-123)>>>8&-p+E-97+26,S},M.prototype._getPaddingLength=function(E){var S=0;if(this._paddingCharacter){for(var C=E.length-1;C>=0&&E[C]===this._paddingCharacter;C--)S++;if(E.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},M})();d.Coder=h;var m=new h;function g(M){return m.encode(M)}d.encode=g;function k(M){return m.decode(M)}d.decode=k;var v=(function(M){l(E,M);function E(){return M!==null&&M.apply(this,arguments)||this}return E.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)},E.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},E})(h);d.URLSafeCoder=v;var T=new v;function Z(M){return T.encode(M)}d.encodeURLSafe=Z;function Q(M){return T.decode(M)}d.decodeURLSafe=Q,d.encodedLength=function(M){return m.encodedLength(M)},d.maxDecodedLength=function(M){return m.maxDecodedLength(M)},d.decodedLength=function(M){return m.decodedLength(M)}},978(a,d){var l="utf8: invalid source encoding";function p(h){for(var m=[],g=0;g<h.length;g++){var k=h[g];if(k&128){var v=void 0;if(k<224){if(g>=h.length)throw new Error(l);var T=h[++g];if((T&192)!==128)throw new Error(l);k=(k&31)<<6|T&63,v=128}else if(k<240){if(g>=h.length-1)throw new Error(l);var T=h[++g],Z=h[++g];if((T&192)!==128||(Z&192)!==128)throw new Error(l);k=(k&15)<<12|(T&63)<<6|Z&63,v=2048}else if(k<248){if(g>=h.length-2)throw new Error(l);var T=h[++g],Z=h[++g],Q=h[++g];if((T&192)!==128||(Z&192)!==128||(Q&192)!==128)throw new Error(l);k=(k&15)<<18|(T&63)<<12|(Z&63)<<6|Q&63,v=65536}else throw new Error(l);if(k<v||k>=55296&&k<=57343)throw new Error(l);if(k>=65536){if(k>1114111)throw new Error(l);k-=65536,m.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}m.push(String.fromCharCode(k))}return m.join("")}d.D4=p},721(a,d,l){a.exports=l(207).default},207(a,d,l){l.d(d,{default:()=>ro});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,R=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_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||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)),R=b.receivers.create(function(O){if(b.receivers.remove(R),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var te=function(Ce){Ce||x.cleanup()},re=0;re<B.length;re++)B[re](O,te)}});x.send(R)}}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 v=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),T=new k({cdn_http:g.cdn_http,cdn_https:g.cdn_https,version:g.VERSION,suffix:g.dependency_suffix,receivers:v});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"}}},M={buildLogSuffix:function(u){const s="See:",c=Z.urls[u];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var E;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(E||(E={}));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 q 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 we extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class rt extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Le extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const St=function(u,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 R in c.headers)x.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)x.setRequestHeader(R,O[R])}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(te){b(new Le(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 E.UserAuthentication:O=M.buildLogSuffix("authenticationEndpoint");break;case E.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${M.buildLogSuffix("authorizationEndpoint")}`;break}b(new Le(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 Xt(u){return ce(Dt(u))}var ft=String.fromCharCode,Ot="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nt=function(u){var s=u.charCodeAt(0);return s<128?u:s<2048?ft(192|s>>>6)+ft(128|s&63):ft(224|s>>>12&15)+ft(128|s>>>6&63)+ft(128|s&63)},Dt=function(u){return u.replace(/[^\x00-\x7F]/g,Nt)},Mt=function(u){var s=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),f=[Ot.charAt(c>>>18),Ot.charAt(c>>>12&63),s>=2?"=":Ot.charAt(c>>>6&63),s>=1?"=":Ot.charAt(c&63)];return f.join("")},ce=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,Mt)};class gn{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 ve=gn;function mn(u){window.clearTimeout(u)}function N(u){window.clearInterval(u)}class X extends ve{constructor(s,c){super(setTimeout,mn,s,function(f){return c(),null})}}class Se extends ve{constructor(s,c){super(setInterval,N,s,function(f){return c(),f})}}var ze={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new X(0,u)},method(u,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[u].apply(f,c.concat(arguments))}}};const le=ze;function ue(u,...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?u[b]=ue(u[b]||{},f[b]):u[b]=f[b]}return u}function bn(){for(var u=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?u.push(arguments[s]):u.push(Be(arguments[s]));return u.join(" : ")}function Kt(u,s){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(s);for(var f=0,b=u.length;f<b;f++)if(u[f]===s)return f;return-1}function de(u,s){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s(u[c],c,u)}function Ne(u){var s=[];return de(u,function(c,f){s.push(f)}),s}function Ae(u){var s=[];return de(u,function(c){s.push(c)}),s}function Ie(u,s,c){for(var f=0;f<u.length;f++)s.call(c||window,u[f],f,u)}function Qt(u,s){for(var c=[],f=0;f<u.length;f++)c.push(s(u[f],f,u,c));return c}function De(u,s){var c={};return de(u,function(f,b){c[b]=s(f)}),c}function et(u,s){s=s||function(b){return!!b};for(var c=[],f=0;f<u.length;f++)s(u[f],f,u,c)&&c.push(u[f]);return c}function Tt(u,s){var c={};return de(u,function(f,b){(s&&s(f,b,u,c)||f)&&(c[b]=f)}),c}function jt(u){var s=[];return de(u,function(c,f){s.push([f,c])}),s}function dr(u,s){for(var c=0;c<u.length;c++)if(s(u[c],c,u))return!0;return!1}function es(u,s){for(var c=0;c<u.length;c++)if(!s(u[c],c,u))return!1;return!0}function pr(u){return De(u,function(s){return typeof s=="object"&&(s=Be(s)),encodeURIComponent(Xt(s.toString()))})}function kn(u){var s=Tt(u,function(f){return f!==void 0}),c=Qt(jt(pr(s)),le.method("join","=")).join("&");return c}function en(u){var s=[],c=[];return(function f(b,x){var R,O,B;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],x+"["+R+"]");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}})(u,"$")}function Be(u){try{return JSON.stringify(u)}catch(s){return JSON.stringify(en(u))}}class hr{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=bn.apply(this,arguments);ro.log?ro.log(f):ro.logToConsole&&s.bind(this)(f)}}const pe=new hr;var Fr=function(u,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=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var R=u.getDocument(),O=R.createElement("script");u.auth_callbacks[x]=function(re){b(null,re)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var te=R.getElementsByTagName("head")[0]||R.documentElement;te.insertBefore(O,te.firstChild)};const fr=Fr;class Br{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 Nn{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=kn(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var Dn=function(u,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(u.host||u.options.host)+u.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,te){h.remove(O),R.cleanup(),te&&te.host&&(u.host=te.host),f&&f(B,te)});R.send(O)}},gt={name:"jsonp",getAgent:Dn};const tn=gt;function _n(u,s,c){var f=u+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function vn(u,s){var c="/app/"+u,f="?protocol="+g.PROTOCOL+"&client=js&version="+g.VERSION+(s?"&"+s:"");return c+f}var ts={getInitial:function(u,s){var c=(s.httpPath||"")+vn(u,"flash=false");return _n("ws",s,c)}},Mn={getInitial:function(u,s){var c=(s.httpPath||"/pusher")+vn(u);return _n("http",s,c)}},jn={getInitial:function(u,s){return _n("http",s,s.httpPath||"/pusher")},getPath:function(u,s){return vn(u)}};class ns{constructor(){this._callbacks={}}get(s){return this._callbacks[Ut(s)]}add(s,c,f){var b=Ut(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?[Ut(s)]:Ne(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Ie(s,function(b){this._callbacks[b]=et(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){Ie(s,function(c){delete this._callbacks[c]},this)}}function Ut(u){return"_"+u}class mt{constructor(s){this.callbacks=new ns,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=et(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),R=[];if(f?R.push(c,f):c&&R.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class rs extends mt{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 le.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"?(le.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 ue({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 rs(this.hooks,s,c,f,b)}}var nn=new he({urls:ts,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(u){return G.createWebSocket(u)}}),Gr={urls:Mn,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},gr=ue({getSocket:function(u){return G.HTTPFactory.createStreamingSocket(u)}},Gr),Un=ue({getSocket:function(u){return G.HTTPFactory.createPollingSocket(u)}},Gr),mr={isSupported:function(){return G.isXHRSupported()}},Wr=new he(ue({},gr,mr)),os=new he(ue({},Un,mr)),it={ws:nn,xhr_streaming:Wr,xhr_polling:os};const at=it;var Jr=new he({file:"sockjs",urls:jn,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,s){return new window.SockJS(u,null,{js_path:T.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(u,s){u.send(JSON.stringify({path:s}))}}),br={isSupported:function(u){var s=G.isXDRSupported(u.useTLS);return s}},kr=new he(ue({},gr,br)),Vr=new he(ue({},Un,br));at.xdr_streaming=kr,at.xdr_polling=Vr,at.sockjs=Jr;const bt=at;class Yr extends mt{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 Xr=new Yr;class Kr{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=ue({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),R=null,O=function(){x.unbind("open",O),x.bind("closed",B),R=le.now()},B=te=>{if(x.unbind("closed",B),te.code===1002||te.code===1003)this.manager.reportDeath();else if(!te.wasClean&&R){var re=le.now()-R;re<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(re/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const _r={decodeMessage:function(u){try{var s=JSON.parse(u.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:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var s=_r.decodeMessage(u);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(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}},Zt=_r;class j extends mt{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(Zt.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=Zt.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=Zt.getCloseAction(s),f=Zt.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=Zt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new j(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=Zt.getCloseAction(s)||"backoff",f=Zt.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(ue({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 z extends mt{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=M.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 Le?{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 oe extends z{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Me{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 xe=function(u,s,c,f){function b(x){return x instanceof c?x:new c(function(R){R(x)})}return new(c||(c=Promise))(function(x,R){function O(re){try{te(f.next(re))}catch(Ce){R(Ce)}}function B(re){try{te(f.throw(re))}catch(Ce){R(Ce)}}function te(re){re.done?x(re.value):b(re.value).then(O,B)}te((f=f.apply(u,s||[])).next())})};class He extends oe{constructor(s,c){super(s,c),this.members=new Me}authorize(s,c){super.authorize(s,(f,b)=>xe(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 R=M.buildLogSuffix("authorizationEndpoint");pe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, 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 kt=l(978),Et=l(594);class vr extends oe{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,Et.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Ee("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,Et.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,Et.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,(R,O)=>{if(R){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,kt.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class $e extends mt{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 X(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new X(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new X(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 X(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return ue({},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 ue({},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 Qr{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=eo(s,c)),this.channels[s]}all(){return Ae(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 eo(u,s){if(u.indexOf("private-encrypted-")===0){if(s.config.nacl)return qt.createEncryptedChannel(u,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=M.buildLogSuffix("encryptedChannelSupport");throw new Ee(`${c}. ${f}`)}else{if(u.indexOf("private-")===0)return qt.createPrivateChannel(u,s);if(u.indexOf("presence-")===0)return qt.createPresenceChannel(u,s);if(u.indexOf("#")===0)throw new C('Cannot create a channel with name "'+u+'".');return qt.createChannel(u,s)}}var Ll={createChannels(){return new Qr},createConnectionManager(u,s){return new $e(u,s)},createChannel(u,s){return new z(u,s)},createPrivateChannel(u,s){return new oe(u,s)},createPresenceChannel(u,s){return new He(u,s)},createEncryptedChannel(u,s,c){return new vr(u,s,c)},createTimelineSender(u,s){return new A(u,s)},createHandshake(u,s){return new _(u,s)},createAssistantToTheTransportManager(u,s,c){return new Kr(u,s,c)}};const qt=Ll;class gi{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return qt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class yn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return dr(this.strategies,le.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,te)=>{te?c(null,te):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var x=null,R=null;return f.timeout>0&&(x=new X(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(O,B))}),{abort:function(){x&&x.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class ss{constructor(s){this.strategies=s}isSupported(){return dr(this.strategies,le.method("isSupported"))}connect(s,c){return zl(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){Il(b)&&c(!0);return}Ie(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function zl(u,s,c){var f=Qt(u,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){Ie(f,$l)},forceMinPriority:function(b){Ie(f,function(x){x.forceMinPriority(b)})}}}function Il(u){return es(u,function(s){return!!s.error})}function $l(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class Ol{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=Nl(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=le.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}),R.push(new yn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=le.now(),te=R.pop().connect(s,function re(Ce,oo){Ce?(mi(f),R.length>0?(B=le.now(),te=R.pop().connect(s,re)):c(Ce)):(Dl(f,oo.transport.name,le.now()-B,x),c(null,oo))});return{abort:function(){te.abort()},forceMinPriority:function(re){s=re,te&&te.forceMinPriority(re)}}}}function is(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function Nl(u){var s=G.getLocalStorage();if(s)try{var c=s[is(u)];if(c)return JSON.parse(c)}catch(f){mi(u)}return null}function Dl(u,s,c,f){var b=G.getLocalStorage();if(b)try{b[is(u)]=Be({timestamp:le.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function mi(u){var s=G.getLocalStorage();if(s)try{delete s[is(u)]}catch(c){}}class to{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 X(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class yr{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 Ml{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(u){return function(){return u.isSupported()}}var jl=function(u,s,c){var f={};function b(Pi,Nu,Du,Mu,ju){var Ri=c(u,Pi,Nu,Du,Mu,ju);return f[Pi]=Ri,Ri}var x=Object.assign({},s,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},te=new gi({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),re=new gi({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Ce=b("ws","ws",3,x,te),oo=b("wss","ws",3,R,te),Lu=b("sockjs","sockjs",1,O),xi=b("xhr_streaming","xhr_streaming",1,O,re),zu=b("xdr_streaming","xdr_streaming",1,O,re),Si=b("xhr_polling","xhr_polling",1,O),Iu=b("xdr_polling","xdr_polling",1,O),Ti=new yn([Ce],B),$u=new yn([oo],B),Ou=new yn([Lu],B),Ei=new yn([new yr(wr(xi),xi,zu)],B),Ai=new yn([new yr(wr(Si),Si,Iu)],B),Ci=new yn([new yr(wr(Ei),new ss([Ei,new to(Ai,{delay:4e3})]),Ai)],B),ls=new yr(wr(Ci),Ci,Ou),us;return s.useTLS?us=new ss([Ti,new to(ls,{delay:2e3})]):us=new ss([Ti,new to($u,{delay:2e3}),new to(ls,{delay:5e3})]),new Ol(new Ml(new yr(wr(Ce),us,ls)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const Ul=jl;function Zl(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),T.load(u.hooks.file,{useTLS:u.options.useTLS},function(s,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(s&&u.onError(s),u.onClose(),c(!1))})):u.onClose()}var ql={getRequest:function(u){var s=new window.XDomainRequest;return s.ontimeout=function(){u.emit("error",new q),u.close()},s.onerror=function(c){u.emit("error",c),u.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText),u.emit("finished",200),u.close()},s},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}};const Hl=ql,Fl=256*1024;class Bl extends mt{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(`
1483
- `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>Fl}}var as;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(as||(as={}));const wn=as;var Gl=1;class Wl{constructor(s,c){this.hooks=s,this.session=ki(1e3)+"/"+Xl(8),this.location=Jl(c),this.readyState=wn.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===wn.OPEN)try{return G.createSocketRequest("POST",bi(Vl(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=wn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===wn.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===wn.CONNECTING?(s&&s.hostname&&(this.location.base=Yl(this.location.base,s.hostname)),this.readyState=wn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===wn.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",bi(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){le.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 Jl(u){var s=/([^\?]*)\/*(\??.*)/.exec(u);return{base:s[1],queryString:s[2]}}function Vl(u,s){return u.base+"/"+s+"/xhr_send"}function bi(u){var s=u.indexOf("?")===-1?"?":"&";return u+s+"t="+ +new Date+"&n="+Gl++}function Yl(u,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+s+c[3]}function ki(u){return G.randomInt(u)}function Xl(u){for(var s=[],c=0;c<u;c++)s.push(ki(32).toString(32));return s.join("")}const Kl=Wl;var Ql={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const eu=Ql;var tu={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){s===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const nu=tu;var ru={getRequest:function(u){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}};const ou=ru;var su={createStreamingSocket(u){return this.createSocket(eu,u)},createPollingSocket(u){return this.createSocket(nu,u)},createSocket(u,s){return new Kl(u,s)},createXHR(u,s){return this.createRequest(ou,u,s)},createRequest(u,s,c){return new Bl(u,s,c)}};const _i=su;_i.createXDR=function(u,s){return this.createRequest(Hl,u,s)};var iu={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:v,getDefaultStrategy:Ul,Transports:bt,transportConnectionInitializer:Zl,HTTPFactory:_i,TimelineTransport:tn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var s=()=>{this.onDocumentBody(u.ready)};window.JSON?s():T.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:St,jsonp:fr}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,s){return new Nn(u,s)},createScriptRequest(u){return new Br(u)},getLocalStorage(){try{return window.localStorage}catch(u){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Xr},createWebSocket(u){var s=this.getWebSocketAPI();return new s(u)},createSocketRequest(u,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var s=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}};const G=iu;var cs;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(cs||(cs={}));const no=cs;class au{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(ue({},c,{timestamp:le.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(no.ERROR,s)}info(s){this.log(no.INFO,s)}debug(s){this.log(no.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=ue({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 cu{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 vi(new J,c)}else return vi(new ee,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=qt.createHandshake(b,function(Ce){f=!0,re(),c(null,Ce)})},B=function(Ce){re(),c(Ce)},te=function(){re();var Ce;Ce=Be(b),c(new we(Ce))},re=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",te)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",te),b.initialize(),{abort:()=>{f||(re(),x?x.close():b.close())},forceMinPriority:Ce=>{f||this.priority<Ce&&(x?x.close():b.close())}}}}function vi(u,s){return le.defer(function(){s(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:lu}=G;var uu=function(u,s,c,f,b,x){var R=lu[c];if(!R)throw new rt(c);var O=(!u.enabledTransports||Kt(u.enabledTransports,s)!==-1)&&(!u.disabledTransports||Kt(u.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},b),B=new cu(s,f,x?x.getAssistant(R):R,b)):B=du,B},du={isSupported:function(){return!1},connect:function(u,s){var c=le.defer(function(){s(new ee)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function pu(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&pe.warn("The disableStats option is deprecated in favor of enableStats")}const hu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.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},fu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=hu(s,u);G.getAuthorizers()[u.transport](G,f,u,E.UserAuthentication,c)}},gu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.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},mu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=gu(s,u);G.getAuthorizers()[u.transport](G,f,u,E.ChannelAuthorization,c)}},bu=(u,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=u.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function yi(u,s){let c={activityTimeout:u.activityTimeout||g.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||g.httpPath,httpPort:u.httpPort||g.httpPort,httpsPort:u.httpsPort||g.httpsPort,pongTimeout:u.pongTimeout||g.pongTimeout,statsHost:u.statsHost||g.stats_host,unavailableTimeout:u.unavailableTimeout||g.unavailableTimeout,wsPath:u.wsPath||g.wsPath,wsPort:u.wsPort||g.wsPort,wssPort:u.wssPort||g.wssPort,enableStats:wu(u),httpHost:ku(u),useTLS:yu(u),wsHost:_u(u),userAuthenticator:xu(u),channelAuthorizer:Tu(u,s)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function ku(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:g.httpHost}function _u(u){return u.wsHost?u.wsHost:vu(u.cluster)}function vu(u){return`ws-${u}.pusher.com`}function yu(u){return G.getProtocol()==="https:"?!0:u.forceTLS!==!1}function wu(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}const wi=u=>"customHandler"in u&&u.customHandler!=null;function xu(u){const s=Object.assign(Object.assign({},g.userAuthentication),u.userAuthentication);return wi(s)?s.customHandler:fu(s)}function Su(u,s){let c;if("channelAuthorization"in u)c=Object.assign(Object.assign({},g.channelAuthorization),u.channelAuthorization);else if(c={transport:u.authTransport||g.authTransport,endpoint:u.authEndpoint||g.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u)return{customHandler:bu(s,c,u.authorizer)};return c}function Tu(u,s){const c=Su(u,s);return wi(c)?c.customHandler:mu(c)}class Eu extends mt{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 Au(){let u,s;return{promise:new Promise((f,b)=>{u=f,s=b}),resolve:u,reject:s}}const Cu=Au;class Pu extends mt{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 Eu(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 z(`#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}=Cu();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 Ne(Tt({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){Ru(s),pu(c),this.key=s,this.options=c,this.config=yi(this.options,this),this.channels=qt.createChannels(),this.global_emitter=new mt,this.sessionID=G.randomInt(1e9),this.timeline=new au(this.key,this.sessionID,{cluster:this.config.cluster,features:je.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:no.INFO,version:g.VERSION}),this.config.enableStats&&(this.timelineSender=qt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,uu);this.connection=qt.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,R=x.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}R||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)}),je.instances.push(this),this.timeline.info({instances:je.instances.length}),this.user=new Pu(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=yi(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 Se(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=G,je.ScriptReceivers=G.ScriptReceivers,je.DependenciesReceivers=G.DependenciesReceivers,je.auth_callbacks=G.auth_callbacks;const ro=je;function Ru(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(je)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var l=r[a]={exports:{}};return n[a].call(l.exports,l,l.exports,o),l.exports}o.d=(a,d)=>{for(var l in d)o.o(d,l)&&!o.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:d[l]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(ms)),ms.exports}var zm=Lm();const Im=Rm(zm);let xt=null,Zn=null;function $m(e){return L(this,null,function*(){return Zn||(Zn=L(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield No(`${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();xt=new Im(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)=>{No(`${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))}}})}),Zn.catch(()=>{Zn=null}),Zn)})}function Om(e){if(!e||!xt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return xt.connection.bind("state_change",n),()=>xt==null?void 0:xt.connection.unbind("state_change",n)}function Nm(e,t,n){return L(this,null,function*(){if(yield $m(e),!xt)return()=>{};const r=xt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(io.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(io.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(io.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(io.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Om(n.onReconnect);return()=>{r.unbind_all(),xt==null||xt.unsubscribe(`private-task-${t}`),o==null||o()}})}const Js="ap-sdk-active-automation";function Dm(){try{const e=sessionStorage.getItem(Js);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 zc(e){try{sessionStorage.setItem(Js,JSON.stringify(e))}catch(t){}}function Ic(){try{sessionStorage.removeItem(Js)}catch(e){}}function Mm(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 jm(),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 jm(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Vs="shared",$c="ap-sdk-panel-size:",pa=280,ha=200;function Um(e){try{const t=sessionStorage.getItem($c+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 Zm(e,t){try{sessionStorage.setItem($c+e,JSON.stringify(t))}catch(n){}}function uo(e,t,n){return Math.min(Math.max(e,t),n)}function fa(){return window.innerWidth-32}function ga(){return window.innerHeight-64}function Ys(e,t){const n=Um(t);n&&(e.style.width=`${uo(n.width,pa,fa())}px`,e.style.height=`${uo(n.height,ha,ga())}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,l=0,p=0,h=0;const m=k=>{o&&(p=uo(d+(k.clientX-i),pa,fa()),h=uo(l+(k.clientY-a),ha,ga()),e.style.width=`${p}px`,e.style.height=`${h}px`)},g=()=>{o&&(o=!1,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",g),Zm(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const v=e.getBoundingClientRect();d=v.width,l=v.height,p=d,h=l,document.addEventListener("pointermove",m),document.addEventListener("pointerup",g)})}function Xs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var On=Xs();function Oc(e){On=e}var Sn={exec:()=>null};function qn(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 Y(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(Fe.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var qm=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Fe={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:qn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:qn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:qn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:qn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:qn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:qn(e=>new RegExp(`^ {0,${e}}>`))},Hm=/^(?:[ \t]*(?:\n|$))+/,Fm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Bm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Gm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ks=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Nc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Dc=Y(Nc).replace(/bull/g,Ks).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(),Wm=Y(Nc).replace(/bull/g,Ks).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(),Qs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Jm=/^[^\n]+/,ei=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Vm=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ei).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ym=Y(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Ks).getRegex(),Qo="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",ti=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Xm=Y("^ {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",ti).replace("tag",Qo).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mc=e=>Y(Qs).replace("hr",qr).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",Qo).getRegex(),Km=Mc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Qm=Mc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),eb=Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Qm).getRegex(),ni={blockquote:eb,code:Fm,def:Vm,fences:Bm,heading:Gm,hr:qr,html:Xm,lheading:Dc,list:Ym,newline:Hm,paragraph:Km,table:Sn,text:Jm},ma=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qr).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",Qo).getRegex(),tb=D(y({},ni),{lheading:Wm,table:ma,paragraph:Y(Qs).replace("hr",qr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ma).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",Qo).getRegex()}),nb=D(y({},ni),{html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ti).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:Sn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(Qs).replace("hr",qr).replace("heading",` *#{1,6} *[^
1484
- ]`).replace("lheading",Dc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),rb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ob=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,jc=/^( {2,}|\\)\n(?!\s*$)/,sb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Yt=/[\p{P}\p{S}]/u,lr=/[\s\p{P}\p{S}]/u,Hr=/[^\s\p{P}\p{S}]/u,ib=Y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,lr).getRegex(),ab=/[\p{Pi}\p{Ps}"']/u,Uc=/(?!~)[\p{P}\p{S}]/u,cb=/(?!~)[\s\p{P}\p{S}]/u,lb=/(?:[^\s\p{P}\p{S}]|~)/u,ub=Y(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",qm?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Zc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,db=Y(Zc,"u").replace(/punct/g,Yt).getRegex(),pb=Y(Zc,"u").replace(/punct/g,Uc).getRegex(),hb=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,fb=Y(hb,"u").replace(/openQuote/g,ab).replace(/punct/g,Yt).getRegex(),qc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gb=Y(qc,"gu").replace(/notPunctSpace/g,Hr).replace(/punctSpace/g,lr).replace(/punct/g,Yt).getRegex(),mb=Y(qc,"gu").replace(/notPunctSpace/g,lb).replace(/punctSpace/g,cb).replace(/punct/g,Uc).getRegex(),bb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",kb=Y(bb,"gu").replace(/notPunctSpace/g,Hr).replace(/punctSpace/g,lr).replace(/punct/g,Yt).getRegex(),_b=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Hr).replace(/punctSpace/g,lr).replace(/punct/g,Yt).getRegex(),vb="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",yb=Y(vb,"gu").replace(/notPunctSpace/g,Hr).replace(/punctSpace/g,lr).replace(/punct/g,Yt).getRegex(),wb=Y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Yt).getRegex(),xb="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Sb=Y(xb,"gu").replace(/notPunctSpace/g,Hr).replace(/punctSpace/g,lr).replace(/punct/g,Yt).getRegex(),Tb=Y(/\\(punct)/,"gu").replace(/punct/g,Yt).getRegex(),Eb=Y(/^<(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(),Ab=Y(ti).replace("(?:-->|$)","-->").getRegex(),Cb=Y("^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",Ab).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Mo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Pb=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Mo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Hc=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",Mo).replace("ref",ei).getRegex(),Fc=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",ei).getRegex(),Rb=Y("reflink|nolink(?!\\()","g").replace("reflink",Hc).replace("nolink",Fc).getRegex(),ba=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ri={_backpedal:Sn,anyPunctuation:Tb,autolink:Eb,blockSkip:ub,br:jc,code:ob,del:Sn,delLDelim:Sn,delRDelim:Sn,emStrongLDelim:db,emStrongRDelimAst:gb,emStrongRDelimUnd:_b,escape:rb,link:Pb,nolink:Fc,punctuation:ib,reflink:Hc,reflinkSearch:Rb,tag:Cb,text:sb,url:Sn},Lb=D(y({},ri),{emStrongLDelim:fb,emStrongRDelimAst:kb,emStrongRDelimUnd:yb,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",Mo).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Mo).getRegex()}),Ls=D(y({},ri),{emStrongRDelimAst:mb,emStrongLDelim:pb,delLDelim:wb,delRDelim:Sb,url:Y(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ba).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:Y(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ba).getRegex()}),zb=D(y({},Ls),{br:Y(jc).replace("{2,}","*").getRegex(),text:Y(Ls.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),po={normal:ni,gfm:tb,pedantic:nb},Sr={normal:ri,gfm:Ls,breaks:zb,pedantic:Lb},Ib={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},ka=e=>Ib[e];function At(e,t){if(t){if(Fe.escapeTest.test(e))return e.replace(Fe.escapeReplace,ka)}else if(Fe.escapeTestNoEncode.test(e))return e.replace(Fe.escapeReplaceNoEncode,ka);return e}function _a(e){try{e=encodeURI(e).replace(Fe.percentDecode,"%")}catch(t){return null}return e}function va(e,t){var i;let n=e.replace(Fe.findPipe,(a,d,l)=>{let p=!1,h=d;for(;--h>=0&&l[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Fe.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(Fe.slashPipe,"|");return r}function rn(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 ya(e){let t=e.split(`
1517
+ */var ha;function Im(){return ha||(ha=1,(function(e,t){(function(r,o){e.exports=o()})(self,()=>(()=>{var n={594(a,d){var l=this&&this.__extends||(function(){var M=function(E,S){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,q){C.__proto__=q}||function(C,q){for(var J in q)q.hasOwnProperty(J)&&(C[J]=q[J])},M(E,S)};return function(E,S){M(E,S);function C(){this.constructor=E}E.prototype=S===null?Object.create(S):(C.prototype=S.prototype,new C)}})();Object.defineProperty(d,"__esModule",{value:!0});var p=256,h=(function(){function M(E){E===void 0&&(E="="),this._paddingCharacter=E}return M.prototype.encodedLength=function(E){return this._paddingCharacter?(E+2)/3*4|0:(E*8+5)/6|0},M.prototype.encode=function(E){for(var S="",C=0;C<E.length-2;C+=3){var q=E[C]<<16|E[C+1]<<8|E[C+2];S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),S+=this._encodeByte(q>>>6&63),S+=this._encodeByte(q>>>0&63)}var J=E.length-C;if(J>0){var q=E[C]<<16|(J===2?E[C+1]<<8:0);S+=this._encodeByte(q>>>18&63),S+=this._encodeByte(q>>>12&63),J===2?S+=this._encodeByte(q>>>6&63):S+=this._paddingCharacter||"",S+=this._paddingCharacter||""}return S},M.prototype.maxDecodedLength=function(E){return this._paddingCharacter?E/4*3|0:(E*6+7)/8|0},M.prototype.decodedLength=function(E){return this.maxDecodedLength(E.length-this._getPaddingLength(E))},M.prototype.decode=function(E){if(E.length===0)return new Uint8Array(0);for(var S=this._getPaddingLength(E),C=E.length-S,q=new Uint8Array(this.maxDecodedLength(C)),J=0,we=0,Ee=0,rt=0,ee=0,Le=0,Qe=0;we<C-4;we+=4)rt=this._decodeChar(E.charCodeAt(we+0)),ee=this._decodeChar(E.charCodeAt(we+1)),Le=this._decodeChar(E.charCodeAt(we+2)),Qe=this._decodeChar(E.charCodeAt(we+3)),q[J++]=rt<<2|ee>>>4,q[J++]=ee<<4|Le>>>2,q[J++]=Le<<6|Qe,Ee|=rt&p,Ee|=ee&p,Ee|=Le&p,Ee|=Qe&p;if(we<C-1&&(rt=this._decodeChar(E.charCodeAt(we)),ee=this._decodeChar(E.charCodeAt(we+1)),q[J++]=rt<<2|ee>>>4,Ee|=rt&p,Ee|=ee&p),we<C-2&&(Le=this._decodeChar(E.charCodeAt(we+2)),q[J++]=ee<<4|Le>>>2,Ee|=Le&p),we<C-3&&(Qe=this._decodeChar(E.charCodeAt(we+3)),q[J++]=Le<<6|Qe,Ee|=Qe&p),Ee!==0)throw new Error("Base64Coder: incorrect characters for decoding");return q},M.prototype._encodeByte=function(E){var S=E;return S+=65,S+=25-E>>>8&6,S+=51-E>>>8&-75,S+=61-E>>>8&-15,S+=62-E>>>8&3,String.fromCharCode(S)},M.prototype._decodeChar=function(E){var S=p;return S+=(42-E&E-44)>>>8&-p+E-43+62,S+=(46-E&E-48)>>>8&-p+E-47+63,S+=(47-E&E-58)>>>8&-p+E-48+52,S+=(64-E&E-91)>>>8&-p+E-65+0,S+=(96-E&E-123)>>>8&-p+E-97+26,S},M.prototype._getPaddingLength=function(E){var S=0;if(this._paddingCharacter){for(var C=E.length-1;C>=0&&E[C]===this._paddingCharacter;C--)S++;if(E.length<4||S>2)throw new Error("Base64Coder: incorrect padding")}return S},M})();d.Coder=h;var m=new h;function g(M){return m.encode(M)}d.encode=g;function k(M){return m.decode(M)}d.decode=k;var v=(function(M){l(E,M);function E(){return M!==null&&M.apply(this,arguments)||this}return E.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)},E.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},E})(h);d.URLSafeCoder=v;var T=new v;function Z(M){return T.encode(M)}d.encodeURLSafe=Z;function Q(M){return T.decode(M)}d.decodeURLSafe=Q,d.encodedLength=function(M){return m.encodedLength(M)},d.maxDecodedLength=function(M){return m.maxDecodedLength(M)},d.decodedLength=function(M){return m.decodedLength(M)}},978(a,d){var l="utf8: invalid source encoding";function p(h){for(var m=[],g=0;g<h.length;g++){var k=h[g];if(k&128){var v=void 0;if(k<224){if(g>=h.length)throw new Error(l);var T=h[++g];if((T&192)!==128)throw new Error(l);k=(k&31)<<6|T&63,v=128}else if(k<240){if(g>=h.length-1)throw new Error(l);var T=h[++g],Z=h[++g];if((T&192)!==128||(Z&192)!==128)throw new Error(l);k=(k&15)<<12|(T&63)<<6|Z&63,v=2048}else if(k<248){if(g>=h.length-2)throw new Error(l);var T=h[++g],Z=h[++g],Q=h[++g];if((T&192)!==128||(Z&192)!==128||(Q&192)!==128)throw new Error(l);k=(k&15)<<18|(T&63)<<12|(Z&63)<<6|Q&63,v=65536}else throw new Error(l);if(k<v||k>=55296&&k<=57343)throw new Error(l);if(k>=65536){if(k>1114111)throw new Error(l);k-=65536,m.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}m.push(String.fromCharCode(k))}return m.join("")}d.D4=p},721(a,d,l){a.exports=l(207).default},207(a,d,l){l.d(d,{default:()=>oo});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,R=function(){x||(s.apply(null,arguments),x=!0)};return this[c]=R,{number:c,id:f,name:b,callback:R}}remove(s){delete this[s.number]}}var h=new p("_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||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)),R=b.receivers.create(function(O){if(b.receivers.remove(R),b.loading[s]){var B=b.loading[s];delete b.loading[s];for(var te=function(Ce){Ce||x.cleanup()},re=0;re<B.length;re++)B[re](O,te)}});x.send(R)}}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 v=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),T=new k({cdn_http:g.cdn_http,cdn_https:g.cdn_https,version:g.VERSION,suffix:g.dependency_suffix,receivers:v});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"}}},M={buildLogSuffix:function(u){const s="See:",c=Z.urls[u];if(!c)return"";let f;return c.fullUrl?f=c.fullUrl:c.path&&(f=Z.baseUrl+c.path),f?`${s} ${f}`:""}};var E;(function(u){u.UserAuthentication="user-authentication",u.ChannelAuthorization="channel-authorization"})(E||(E={}));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 q 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 we extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class rt extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class ee extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Le extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const Tt=function(u,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 R in c.headers)x.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)x.setRequestHeader(R,O[R])}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(te){b(new Le(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 E.UserAuthentication:O=M.buildLogSuffix("authenticationEndpoint");break;case E.ChannelAuthorization:O=`Clients must be authorized to join private or presence channels. ${M.buildLogSuffix("authorizationEndpoint")}`;break}b(new Le(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 Kt(u){return ce(Mt(u))}var gt=String.fromCharCode,Nt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Dt=function(u){var s=u.charCodeAt(0);return s<128?u:s<2048?gt(192|s>>>6)+gt(128|s&63):gt(224|s>>>12&15)+gt(128|s>>>6&63)+gt(128|s&63)},Mt=function(u){return u.replace(/[^\x00-\x7F]/g,Dt)},jt=function(u){var s=[0,2,1][u.length%3],c=u.charCodeAt(0)<<16|(u.length>1?u.charCodeAt(1):0)<<8|(u.length>2?u.charCodeAt(2):0),f=[Nt.charAt(c>>>18),Nt.charAt(c>>>12&63),s>=2?"=":Nt.charAt(c>>>6&63),s>=1?"=":Nt.charAt(c&63)];return f.join("")},ce=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,jt)};class mn{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 ve=mn;function bn(u){window.clearTimeout(u)}function N(u){window.clearInterval(u)}class X extends ve{constructor(s,c){super(setTimeout,bn,s,function(f){return c(),null})}}class Se extends ve{constructor(s,c){super(setInterval,N,s,function(f){return c(),f})}}var ze={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new X(0,u)},method(u,...s){var c=Array.prototype.slice.call(arguments,1);return function(f){return f[u].apply(f,c.concat(arguments))}}};const le=ze;function ue(u,...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?u[b]=ue(u[b]||{},f[b]):u[b]=f[b]}return u}function kn(){for(var u=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?u.push(arguments[s]):u.push(Be(arguments[s]));return u.join(" : ")}function Qt(u,s){var c=Array.prototype.indexOf;if(u===null)return-1;if(c&&u.indexOf===c)return u.indexOf(s);for(var f=0,b=u.length;f<b;f++)if(u[f]===s)return f;return-1}function de(u,s){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s(u[c],c,u)}function Ne(u){var s=[];return de(u,function(c,f){s.push(f)}),s}function Ae(u){var s=[];return de(u,function(c){s.push(c)}),s}function Ie(u,s,c){for(var f=0;f<u.length;f++)s.call(c||window,u[f],f,u)}function en(u,s){for(var c=[],f=0;f<u.length;f++)c.push(s(u[f],f,u,c));return c}function De(u,s){var c={};return de(u,function(f,b){c[b]=s(f)}),c}function et(u,s){s=s||function(b){return!!b};for(var c=[],f=0;f<u.length;f++)s(u[f],f,u,c)&&c.push(u[f]);return c}function Et(u,s){var c={};return de(u,function(f,b){(s&&s(f,b,u,c)||f)&&(c[b]=f)}),c}function Ut(u){var s=[];return de(u,function(c,f){s.push([f,c])}),s}function pr(u,s){for(var c=0;c<u.length;c++)if(s(u[c],c,u))return!0;return!1}function ns(u,s){for(var c=0;c<u.length;c++)if(!s(u[c],c,u))return!1;return!0}function hr(u){return De(u,function(s){return typeof s=="object"&&(s=Be(s)),encodeURIComponent(Kt(s.toString()))})}function _n(u){var s=Et(u,function(f){return f!==void 0}),c=en(Ut(hr(s)),le.method("join","=")).join("&");return c}function tn(u){var s=[],c=[];return(function f(b,x){var R,O,B;switch(typeof b){case"object":if(!b)return null;for(R=0;R<s.length;R+=1)if(s[R]===b)return{$ref:c[R]};if(s.push(b),c.push(x),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],x+"["+R+"]");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}})(u,"$")}function Be(u){try{return JSON.stringify(u)}catch(s){return JSON.stringify(tn(u))}}class fr{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=kn.apply(this,arguments);oo.log?oo.log(f):oo.logToConsole&&s.bind(this)(f)}}const pe=new fr;var Br=function(u,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=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var R=u.getDocument(),O=R.createElement("script");u.auth_callbacks[x]=function(re){b(null,re)};var B="Pusher.auth_callbacks['"+x+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var te=R.getElementsByTagName("head")[0]||R.documentElement;te.insertBefore(O,te.firstChild)};const gr=Br;class Gr{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 Dn{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=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var Mn=function(u,s){return function(c,f){var b="http"+(s?"s":"")+"://",x=b+(u.host||u.options.host)+u.options.path,R=G.createJSONPRequest(x,c),O=G.ScriptReceivers.create(function(B,te){h.remove(O),R.cleanup(),te&&te.host&&(u.host=te.host),f&&f(B,te)});R.send(O)}},mt={name:"jsonp",getAgent:Mn};const nn=mt;function vn(u,s,c){var f=u+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function yn(u,s){var c="/app/"+u,f="?protocol="+g.PROTOCOL+"&client=js&version="+g.VERSION+(s?"&"+s:"");return c+f}var rs={getInitial:function(u,s){var c=(s.httpPath||"")+yn(u,"flash=false");return vn("ws",s,c)}},jn={getInitial:function(u,s){var c=(s.httpPath||"/pusher")+yn(u);return vn("http",s,c)}},Un={getInitial:function(u,s){return vn("http",s,s.httpPath||"/pusher")},getPath:function(u,s){return yn(u)}};class os{constructor(){this._callbacks={}}get(s){return this._callbacks[Zt(s)]}add(s,c,f){var b=Zt(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?[Zt(s)]:Ne(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){Ie(s,function(b){this._callbacks[b]=et(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){Ie(s,function(c){delete this._callbacks[c]},this)}}function Zt(u){return"_"+u}class bt{constructor(s){this.callbacks=new os,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=et(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),R=[];if(f?R.push(c,f):c&&R.push(c),x&&x.length>0)for(var b=0;b<x.length;b++)x[b].fn.apply(x[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class ss extends bt{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 le.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"?(le.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 ue({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 ss(this.hooks,s,c,f,b)}}var rn=new he({urls:rs,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(u){return G.createWebSocket(u)}}),Wr={urls:jn,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},mr=ue({getSocket:function(u){return G.HTTPFactory.createStreamingSocket(u)}},Wr),Zn=ue({getSocket:function(u){return G.HTTPFactory.createPollingSocket(u)}},Wr),br={isSupported:function(){return G.isXHRSupported()}},Jr=new he(ue({},mr,br)),is=new he(ue({},Zn,br)),at={ws:rn,xhr_streaming:Jr,xhr_polling:is};const ct=at;var Vr=new he({file:"sockjs",urls:Un,handlesActivityChecks:!0,supportsPing:!1,isSupported:function(){return!0},isInitialized:function(){return window.SockJS!==void 0},getSocket:function(u,s){return new window.SockJS(u,null,{js_path:T.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(u,s){u.send(JSON.stringify({path:s}))}}),kr={isSupported:function(u){var s=G.isXDRSupported(u.useTLS);return s}},_r=new he(ue({},mr,kr)),Yr=new he(ue({},Zn,kr));ct.xdr_streaming=_r,ct.xdr_polling=Yr,ct.sockjs=Vr;const kt=ct;class Xr extends bt{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 Kr=new Xr;class Qr{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=ue({},b,{activityTimeout:this.pingDelay});var x=this.transport.createConnection(s,c,f,b),R=null,O=function(){x.unbind("open",O),x.bind("closed",B),R=le.now()},B=te=>{if(x.unbind("closed",B),te.code===1002||te.code===1003)this.manager.reportDeath();else if(!te.wasClean&&R){var re=le.now()-R;re<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(re/2,this.minPingDelay))}};return x.bind("open",O),x}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const vr={decodeMessage:function(u){try{var s=JSON.parse(u.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:u.data}}},encodeMessage:function(u){return JSON.stringify(u)},processHandshake:function(u){var s=vr.decodeMessage(u);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(u){return u.code<4e3?u.code>=1002&&u.code<=1004?"backoff":null:u.code===4e3?"tls_only":u.code<4100?"refused":u.code<4200?"backoff":u.code<4300?"retry":"refused"},getCloseError:function(u){return u.code!==1e3&&u.code!==1001?{type:"PusherError",data:{code:u.code,message:u.reason||u.message}}:null}},qt=vr;class j extends bt{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(qt.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=qt.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=qt.getCloseAction(s),f=qt.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=qt.processHandshake(s)}catch(f){this.finish("error",{error:f}),this.transport.close();return}c.action==="connected"?this.finish("connected",{connection:new j(c.id,this.transport),activityTimeout:c.activityTimeout}):(this.finish(c.action,{error:c.error}),this.transport.close())},this.onClosed=s=>{this.unbindListeners();var c=qt.getCloseAction(s)||"backoff",f=qt.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(ue({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 bt{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=M.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 Le?{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 oe extends I{authorize(s,c){return this.pusher.config.channelAuthorizer({channelName:this.name,socketId:s},c)}}class Me{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 xe=function(u,s,c,f){function b(x){return x instanceof c?x:new c(function(R){R(x)})}return new(c||(c=Promise))(function(x,R){function O(re){try{te(f.next(re))}catch(Ce){R(Ce)}}function B(re){try{te(f.throw(re))}catch(Ce){R(Ce)}}function te(re){re.done?x(re.value):b(re.value).then(O,B)}te((f=f.apply(u,s||[])).next())})};class He extends oe{constructor(s,c){super(s,c),this.members=new Me}authorize(s,c){super.authorize(s,(f,b)=>xe(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 R=M.buildLogSuffix("authorizationEndpoint");pe.error(`Invalid auth response for channel '${this.name}', expected 'channel_data' field. ${R}, 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 _t=l(978),At=l(594);class yr extends oe{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,At.decode)(x),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Ee("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,At.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,At.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,(R,O)=>{if(R){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,_t.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class $e extends bt{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 X(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new X(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new X(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 X(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return ue({},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 ue({},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 eo{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=to(s,c)),this.channels[s]}all(){return Ae(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 to(u,s){if(u.indexOf("private-encrypted-")===0){if(s.config.nacl)return Ht.createEncryptedChannel(u,s,s.config.nacl);let c="Tried to subscribe to a private-encrypted- channel but no nacl implementation available",f=M.buildLogSuffix("encryptedChannelSupport");throw new Ee(`${c}. ${f}`)}else{if(u.indexOf("private-")===0)return Ht.createPrivateChannel(u,s);if(u.indexOf("presence-")===0)return Ht.createPresenceChannel(u,s);if(u.indexOf("#")===0)throw new C('Cannot create a channel with name "'+u+'".');return Ht.createChannel(u,s)}}var Il={createChannels(){return new eo},createConnectionManager(u,s){return new $e(u,s)},createChannel(u,s){return new I(u,s)},createPrivateChannel(u,s){return new oe(u,s)},createPresenceChannel(u,s){return new He(u,s)},createEncryptedChannel(u,s,c){return new yr(u,s,c)},createTimelineSender(u,s){return new A(u,s)},createHandshake(u,s){return new _(u,s)},createAssistantToTheTransportManager(u,s,c){return new Qr(u,s,c)}};const Ht=Il;class bi{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Ht.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class wn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return pr(this.strategies,le.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,x=this.timeout,R=null,O=(B,te)=>{te?c(null,te):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(x&&(x=x*2,this.timeoutLimit&&(x=Math.min(x,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:x,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var x=null,R=null;return f.timeout>0&&(x=new X(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&x&&x.isRunning()&&!f.failFast||(x&&x.ensureAborted(),b(O,B))}),{abort:function(){x&&x.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class as{constructor(s){this.strategies=s}isSupported(){return pr(this.strategies,le.method("isSupported"))}connect(s,c){return $l(this.strategies,s,function(f,b){return function(x,R){if(b[f].error=x,x){Ol(b)&&c(!0);return}Ie(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function $l(u,s,c){var f=en(u,function(b,x,R,O){return b.connect(s,c(x,O))});return{abort:function(){Ie(f,Nl)},forceMinPriority:function(b){Ie(f,function(x){x.forceMinPriority(b)})}}}function Ol(u){return ns(u,function(s){return!!s.error})}function Nl(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class Dl{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=Ml(f),x=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=le.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}),R.push(new wn([O],{timeout:b.latency*2+1e3,failFast:!0}))):x++)}var B=le.now(),te=R.pop().connect(s,function re(Ce,so){Ce?(ki(f),R.length>0?(B=le.now(),te=R.pop().connect(s,re)):c(Ce)):(jl(f,so.transport.name,le.now()-B,x),c(null,so))});return{abort:function(){te.abort()},forceMinPriority:function(re){s=re,te&&te.forceMinPriority(re)}}}}function cs(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function Ml(u){var s=G.getLocalStorage();if(s)try{var c=s[cs(u)];if(c)return JSON.parse(c)}catch(f){ki(u)}return null}function jl(u,s,c,f){var b=G.getLocalStorage();if(b)try{b[cs(u)]=Be({timestamp:le.now(),transport:s,latency:c,cacheSkipCount:f})}catch(x){}}function ki(u){var s=G.getLocalStorage();if(s)try{delete s[cs(u)]}catch(c){}}class no{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 X(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){x.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class wr{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 Ul{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 xr(u){return function(){return u.isSupported()}}var Zl=function(u,s,c){var f={};function b(Li,Mu,ju,Uu,Zu){var zi=c(u,Li,Mu,ju,Uu,Zu);return f[Li]=zi,zi}var x=Object.assign({},s,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),R=Object.assign({},x,{useTLS:!0}),O=Object.assign({},s,{hostNonTLS:u.httpHost+":"+u.httpPort,hostTLS:u.httpHost+":"+u.httpsPort,httpPath:u.httpPath}),B={loop:!0,timeout:15e3,timeoutLimit:6e4},te=new bi({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),re=new bi({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Ce=b("ws","ws",3,x,te),so=b("wss","ws",3,R,te),Iu=b("sockjs","sockjs",1,O),Ti=b("xhr_streaming","xhr_streaming",1,O,re),$u=b("xdr_streaming","xdr_streaming",1,O,re),Ei=b("xhr_polling","xhr_polling",1,O),Ou=b("xdr_polling","xdr_polling",1,O),Ai=new wn([Ce],B),Nu=new wn([so],B),Du=new wn([Iu],B),Ci=new wn([new wr(xr(Ti),Ti,$u)],B),Pi=new wn([new wr(xr(Ei),Ei,Ou)],B),Ri=new wn([new wr(xr(Ci),new as([Ci,new no(Pi,{delay:4e3})]),Pi)],B),ds=new wr(xr(Ri),Ri,Du),ps;return s.useTLS?ps=new as([Ai,new no(ds,{delay:2e3})]):ps=new as([Ai,new no(Nu,{delay:2e3}),new no(ds,{delay:5e3})]),new Dl(new Ul(new wr(xr(Ce),ps,ds)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const ql=Zl;function Hl(){var u=this;u.timeline.info(u.buildTimelineMessage({transport:u.name+(u.options.useTLS?"s":"")})),u.hooks.isInitialized()?u.changeState("initialized"):u.hooks.file?(u.changeState("initializing"),T.load(u.hooks.file,{useTLS:u.options.useTLS},function(s,c){u.hooks.isInitialized()?(u.changeState("initialized"),c(!0)):(s&&u.onError(s),u.onClose(),c(!1))})):u.onClose()}var Fl={getRequest:function(u){var s=new window.XDomainRequest;return s.ontimeout=function(){u.emit("error",new q),u.close()},s.onerror=function(c){u.emit("error",c),u.close()},s.onprogress=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText)},s.onload=function(){s.responseText&&s.responseText.length>0&&u.onChunk(200,s.responseText),u.emit("finished",200),u.close()},s},abortRequest:function(u){u.ontimeout=u.onerror=u.onprogress=u.onload=null,u.abort()}};const Bl=Fl,Gl=256*1024;class Wl extends bt{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(`
1518
+ `);return f!==-1?(this.position+=f+1,c.slice(0,f)):null}isBufferTooLong(s){return this.position===s.length&&s.length>Gl}}var ls;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(ls||(ls={}));const xn=ls;var Jl=1;class Vl{constructor(s,c){this.hooks=s,this.session=vi(1e3)+"/"+Ql(8),this.location=Yl(c),this.readyState=xn.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===xn.OPEN)try{return G.createSocketRequest("POST",_i(Xl(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=xn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===xn.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===xn.CONNECTING?(s&&s.hostname&&(this.location.base=Kl(this.location.base,s.hostname)),this.readyState=xn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===xn.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",_i(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){le.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 Yl(u){var s=/([^\?]*)\/*(\??.*)/.exec(u);return{base:s[1],queryString:s[2]}}function Xl(u,s){return u.base+"/"+s+"/xhr_send"}function _i(u){var s=u.indexOf("?")===-1?"?":"&";return u+s+"t="+ +new Date+"&n="+Jl++}function Kl(u,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+s+c[3]}function vi(u){return G.randomInt(u)}function Ql(u){for(var s=[],c=0;c<u;c++)s.push(vi(32).toString(32));return s.join("")}const eu=Vl;var tu={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr_streaming"+u.queryString},onHeartbeat:function(u){u.sendRaw("[]")},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const nu=tu;var ru={getReceiveURL:function(u,s){return u.base+"/"+s+"/xhr"+u.queryString},onHeartbeat:function(){},sendHeartbeat:function(u){u.sendRaw("[]")},onFinished:function(u,s){s===200?u.reconnect():u.onClose(1006,"Connection interrupted ("+s+")",!1)}};const ou=ru;var su={getRequest:function(u){var s=G.getXHRAPI(),c=new s;return c.onreadystatechange=c.onprogress=function(){switch(c.readyState){case 3:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText);break;case 4:c.responseText&&c.responseText.length>0&&u.onChunk(c.status,c.responseText),u.emit("finished",c.status),u.close();break}},c},abortRequest:function(u){u.onreadystatechange=null,u.abort()}};const iu=su;var au={createStreamingSocket(u){return this.createSocket(nu,u)},createPollingSocket(u){return this.createSocket(ou,u)},createSocket(u,s){return new eu(u,s)},createXHR(u,s){return this.createRequest(iu,u,s)},createRequest(u,s,c){return new Wl(u,s,c)}};const yi=au;yi.createXDR=function(u,s){return this.createRequest(Bl,u,s)};var cu={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:v,getDefaultStrategy:ql,Transports:kt,transportConnectionInitializer:Hl,HTTPFactory:yi,TimelineTransport:nn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var s=()=>{this.onDocumentBody(u.ready)};window.JSON?s():T.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:Tt,jsonp:gr}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,s){return new Dn(u,s)},createScriptRequest(u){return new Gr(u)},getLocalStorage(){try{return window.localStorage}catch(u){return}},createXHR(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest(){var u=this.getXHRAPI();return new u},createMicrosoftXHR(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork(){return Kr},createWebSocket(u){var s=this.getWebSocketAPI();return new s(u)},createSocketRequest(u,s){if(this.isXHRSupported())return this.HTTPFactory.createXHR(u,s);if(this.isXDRSupported(s.indexOf("https:")===0))return this.HTTPFactory.createXDR(u,s);throw"Cross-origin HTTP requests are not supported"},isXHRSupported(){var u=this.getXHRAPI();return!!u&&new u().withCredentials!==void 0},isXDRSupported(u){var s=u?"https:":"http:",c=this.getProtocol();return!!window.XDomainRequest&&c===s},addUnloadListener(u){window.addEventListener!==void 0?window.addEventListener("unload",u,!1):window.attachEvent!==void 0&&window.attachEvent("onunload",u)},removeUnloadListener(u){window.addEventListener!==void 0?window.removeEventListener("unload",u,!1):window.detachEvent!==void 0&&window.detachEvent("onunload",u)},randomInt(u){return Math.floor(function(){return(window.crypto||window.msCrypto).getRandomValues(new Uint32Array(1))[0]/Math.pow(2,32)}()*u)}};const G=cu;var us;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(us||(us={}));const ro=us;class lu{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(ue({},c,{timestamp:le.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(ro.ERROR,s)}info(s){this.log(ro.INFO,s)}debug(s){this.log(ro.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=ue({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 uu{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 wi(new J,c)}else return wi(new ee,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),x=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){x=Ht.createHandshake(b,function(Ce){f=!0,re(),c(null,Ce)})},B=function(Ce){re(),c(Ce)},te=function(){re();var Ce;Ce=Be(b),c(new we(Ce))},re=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",te)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",te),b.initialize(),{abort:()=>{f||(re(),x?x.close():b.close())},forceMinPriority:Ce=>{f||this.priority<Ce&&(x?x.close():b.close())}}}}function wi(u,s){return le.defer(function(){s(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:du}=G;var pu=function(u,s,c,f,b,x){var R=du[c];if(!R)throw new rt(c);var O=(!u.enabledTransports||Qt(u.enabledTransports,s)!==-1)&&(!u.disabledTransports||Qt(u.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},b),B=new uu(s,f,x?x.getAssistant(R):R,b)):B=hu,B},hu={isSupported:function(){return!1},connect:function(u,s){var c=le.defer(function(){s(new ee)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function fu(u){if(u==null)throw"You must pass an options object";if(u.cluster==null)throw"Options object must provide a cluster";"disableStats"in u&&pe.warn("The disableStats option is deprecated in favor of enableStats")}const gu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.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},mu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=gu(s,u);G.getAuthorizers()[u.transport](G,f,u,E.UserAuthentication,c)}},bu=(u,s)=>{var c="socket_id="+encodeURIComponent(u.socketId);c+="&channel_name="+encodeURIComponent(u.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},ku=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=bu(s,u);G.getAuthorizers()[u.transport](G,f,u,E.ChannelAuthorization,c)}},_u=(u,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,x)=>{const R=u.channel(b.channelName);c(R,f).authorize(b.socketId,x)}};function xi(u,s){let c={activityTimeout:u.activityTimeout||g.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||g.httpPath,httpPort:u.httpPort||g.httpPort,httpsPort:u.httpsPort||g.httpsPort,pongTimeout:u.pongTimeout||g.pongTimeout,statsHost:u.statsHost||g.stats_host,unavailableTimeout:u.unavailableTimeout||g.unavailableTimeout,wsPath:u.wsPath||g.wsPath,wsPort:u.wsPort||g.wsPort,wssPort:u.wssPort||g.wssPort,enableStats:Su(u),httpHost:vu(u),useTLS:xu(u),wsHost:yu(u),userAuthenticator:Tu(u),channelAuthorizer:Au(u,s)};return"disabledTransports"in u&&(c.disabledTransports=u.disabledTransports),"enabledTransports"in u&&(c.enabledTransports=u.enabledTransports),"ignoreNullOrigin"in u&&(c.ignoreNullOrigin=u.ignoreNullOrigin),"timelineParams"in u&&(c.timelineParams=u.timelineParams),"nacl"in u&&(c.nacl=u.nacl),c}function vu(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:g.httpHost}function yu(u){return u.wsHost?u.wsHost:wu(u.cluster)}function wu(u){return`ws-${u}.pusher.com`}function xu(u){return G.getProtocol()==="https:"?!0:u.forceTLS!==!1}function Su(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}const Si=u=>"customHandler"in u&&u.customHandler!=null;function Tu(u){const s=Object.assign(Object.assign({},g.userAuthentication),u.userAuthentication);return Si(s)?s.customHandler:mu(s)}function Eu(u,s){let c;if("channelAuthorization"in u)c=Object.assign(Object.assign({},g.channelAuthorization),u.channelAuthorization);else if(c={transport:u.authTransport||g.authTransport,endpoint:u.authEndpoint||g.authEndpoint},"auth"in u&&("params"in u.auth&&(c.params=u.auth.params),"headers"in u.auth&&(c.headers=u.auth.headers)),"authorizer"in u)return{customHandler:_u(s,c,u.authorizer)};return c}function Au(u,s){const c=Eu(u,s);return Si(c)?c.customHandler:ku(c)}class Cu extends bt{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 Pu(){let u,s;return{promise:new Promise((f,b)=>{u=f,s=b}),resolve:u,reject:s}}const Ru=Pu;class Lu extends bt{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 Cu(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}=Ru();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 Ne(Et({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){zu(s),fu(c),this.key=s,this.options=c,this.config=xi(this.options,this),this.channels=Ht.createChannels(),this.global_emitter=new bt,this.sessionID=G.randomInt(1e9),this.timeline=new lu(this.key,this.sessionID,{cluster:this.config.cluster,features:je.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:ro.INFO,version:g.VERSION}),this.config.enableStats&&(this.timelineSender=Ht.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,pu);this.connection=Ht.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,R=x.indexOf("pusher_internal:")===0;if(b.channel){var O=this.channel(b.channel);O&&O.handleEvent(b)}R||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)}),je.instances.push(this),this.timeline.info({instances:je.instances.length}),this.user=new Lu(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=xi(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 Se(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=G,je.ScriptReceivers=G.ScriptReceivers,je.DependenciesReceivers=G.DependenciesReceivers,je.auth_callbacks=G.auth_callbacks;const oo=je;function zu(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(je)}},r={};function o(a){var d=r[a];if(d!==void 0)return d.exports;var l=r[a]={exports:{}};return n[a].call(l.exports,l,l.exports,o),l.exports}o.d=(a,d)=>{for(var l in d)o.o(d,l)&&!o.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:d[l]})},o.o=(a,d)=>Object.prototype.hasOwnProperty.call(a,d);var i=o(721);return i})())})(ks)),ks.exports}var $m=Im();const Om=zm($m);let St=null,qn=null;function Nm(e){return z(this,null,function*(){return qn||(qn=z(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield Mo(`${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();St=new Om(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)=>{Mo(`${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))}}})}),qn.catch(()=>{qn=null}),qn)})}function Dm(e){if(!e||!St)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return St.connection.bind("state_change",n),()=>St==null?void 0:St.connection.unbind("state_change",n)}function Mm(e,t,n){return z(this,null,function*(){if(yield Nm(e),!St)return()=>{};const r=St.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(ao.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(ao.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(ao.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(ao.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Dm(n.onReconnect);return()=>{r.unbind_all(),St==null||St.unsubscribe(`private-task-${t}`),o==null||o()}})}const Ys="ap-sdk-active-automation";function jm(){try{const e=sessionStorage.getItem(Ys);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 Oc(e){try{sessionStorage.setItem(Ys,JSON.stringify(e))}catch(t){}}function Nc(){try{sessionStorage.removeItem(Ys)}catch(e){}}function Um(e){return z(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 Zm(),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 Zm(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const Xs="shared",Dc="ap-sdk-panel-size:",fa=280,ga=200;function qm(e){try{const t=sessionStorage.getItem(Dc+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 Hm(e,t){try{sessionStorage.setItem(Dc+e,JSON.stringify(t))}catch(n){}}function po(e,t,n){return Math.min(Math.max(e,t),n)}function ma(){return window.innerWidth-32}function ba(){return window.innerHeight-64}function Ks(e,t){const n=qm(t);n&&(e.style.width=`${po(n.width,fa,ma())}px`,e.style.height=`${po(n.height,ga,ba())}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,l=0,p=0,h=0;const m=k=>{o&&(p=po(d+(k.clientX-i),fa,ma()),h=po(l+(k.clientY-a),ga,ba()),e.style.width=`${p}px`,e.style.height=`${h}px`)},g=()=>{o&&(o=!1,document.removeEventListener("pointermove",m),document.removeEventListener("pointerup",g),Hm(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const v=e.getBoundingClientRect();d=v.width,l=v.height,p=d,h=l,document.addEventListener("pointermove",m),document.addEventListener("pointerup",g)})}function Qs(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Nn=Qs();function Mc(e){Nn=e}var Tn={exec:()=>null};function Hn(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 Y(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(Fe.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Fm=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Fe={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:Hn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Hn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Hn(e=>new RegExp(`^ {0,${e}}>`))},Bm=/^(?:[ \t]*(?:\n|$))+/,Gm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Wm=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,ei=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,jc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Uc=Y(jc).replace(/bull/g,ei).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(),Vm=Y(jc).replace(/bull/g,ei).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(),ti=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ym=/^[^\n]+/,ni=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Xm=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ni).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Km=Y(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,ei).getRegex(),ts="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",ri=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Qm=Y("^ {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",ri).replace("tag",ts).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Zc=e=>Y(ti).replace("hr",Hr).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",ts).getRegex(),eb=Zc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),tb=Zc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),nb=Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",tb).getRegex(),oi={blockquote:nb,code:Gm,def:Xm,fences:Wm,heading:Jm,hr:Hr,html:Qm,lheading:Uc,list:Km,newline:Bm,paragraph:eb,table:Tn,text:Ym},ka=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Hr).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",ts).getRegex(),rb=D(y({},oi),{lheading:Vm,table:ka,paragraph:Y(ti).replace("hr",Hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ka).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",ts).getRegex()}),ob=D(y({},oi),{html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ri).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:Tn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(ti).replace("hr",Hr).replace("heading",` *#{1,6} *[^
1519
+ ]`).replace("lheading",Uc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),sb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ib=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,qc=/^( {2,}|\\)\n(?!\s*$)/,ab=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Xt=/[\p{P}\p{S}]/u,ur=/[\s\p{P}\p{S}]/u,Fr=/[^\s\p{P}\p{S}]/u,cb=Y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ur).getRegex(),lb=/[\p{Pi}\p{Ps}"']/u,Hc=/(?!~)[\p{P}\p{S}]/u,ub=/(?!~)[\s\p{P}\p{S}]/u,db=/(?:[^\s\p{P}\p{S}]|~)/u,pb=Y(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",Fm?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Fc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,hb=Y(Fc,"u").replace(/punct/g,Xt).getRegex(),fb=Y(Fc,"u").replace(/punct/g,Hc).getRegex(),gb=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,mb=Y(gb,"u").replace(/openQuote/g,lb).replace(/punct/g,Xt).getRegex(),Bc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",bb=Y(Bc,"gu").replace(/notPunctSpace/g,Fr).replace(/punctSpace/g,ur).replace(/punct/g,Xt).getRegex(),kb=Y(Bc,"gu").replace(/notPunctSpace/g,db).replace(/punctSpace/g,ub).replace(/punct/g,Hc).getRegex(),_b="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",vb=Y(_b,"gu").replace(/notPunctSpace/g,Fr).replace(/punctSpace/g,ur).replace(/punct/g,Xt).getRegex(),yb=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Fr).replace(/punctSpace/g,ur).replace(/punct/g,Xt).getRegex(),wb="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",xb=Y(wb,"gu").replace(/notPunctSpace/g,Fr).replace(/punctSpace/g,ur).replace(/punct/g,Xt).getRegex(),Sb=Y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Xt).getRegex(),Tb="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Eb=Y(Tb,"gu").replace(/notPunctSpace/g,Fr).replace(/punctSpace/g,ur).replace(/punct/g,Xt).getRegex(),Ab=Y(/\\(punct)/,"gu").replace(/punct/g,Xt).getRegex(),Cb=Y(/^<(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(),Pb=Y(ri).replace("(?:-->|$)","-->").getRegex(),Rb=Y("^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",Pb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Uo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Lb=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Uo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Gc=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",Uo).replace("ref",ni).getRegex(),Wc=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",ni).getRegex(),zb=Y("reflink|nolink(?!\\()","g").replace("reflink",Gc).replace("nolink",Wc).getRegex(),_a=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,si={_backpedal:Tn,anyPunctuation:Ab,autolink:Cb,blockSkip:pb,br:qc,code:ib,del:Tn,delLDelim:Tn,delRDelim:Tn,emStrongLDelim:hb,emStrongRDelimAst:bb,emStrongRDelimUnd:yb,escape:sb,link:Lb,nolink:Wc,punctuation:cb,reflink:Gc,reflinkSearch:zb,tag:Rb,text:ab,url:Tn},Ib=D(y({},si),{emStrongLDelim:mb,emStrongRDelimAst:vb,emStrongRDelimUnd:xb,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",Uo).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Uo).getRegex()}),Is=D(y({},si),{emStrongRDelimAst:kb,emStrongLDelim:fb,delLDelim:Sb,delRDelim:Eb,url:Y(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",_a).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:Y(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",_a).getRegex()}),$b=D(y({},Is),{br:Y(qc).replace("{2,}","*").getRegex(),text:Y(Is.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),ho={normal:oi,gfm:rb,pedantic:ob},Tr={normal:si,gfm:Is,breaks:$b,pedantic:Ib},Ob={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},va=e=>Ob[e];function Ct(e,t){if(t){if(Fe.escapeTest.test(e))return e.replace(Fe.escapeReplace,va)}else if(Fe.escapeTestNoEncode.test(e))return e.replace(Fe.escapeReplaceNoEncode,va);return e}function ya(e){try{e=encodeURI(e).replace(Fe.percentDecode,"%")}catch(t){return null}return e}function wa(e,t){var i;let n=e.replace(Fe.findPipe,(a,d,l)=>{let p=!1,h=d;for(;--h>=0&&l[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Fe.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(Fe.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 xa(e){let t=e.split(`
1485
1520
  `),n=t.length-1;for(;n>=0&&Fe.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1486
- `)}function $b(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 Ob(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 wa(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 l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,l}function Nb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1521
+ `)}function Nb(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 Db(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 Sa(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 l={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:a,text:d,tokens:r.inlineTokens(d)};return r.state.inLink=!1,l}function Mb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1487
1522
  `).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(`
1488
- `)}var jo=class{constructor(e){se(this,"options");se(this,"rules");se(this,"lexer");this.options=e||On}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]:ya(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=Nb(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=rn(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:rn(t[0],`
1489
- `),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:rn(t[0],`
1490
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=rn(t[0],`
1523
+ `)}var Zo=class{constructor(e){se(this,"options");se(this,"rules");se(this,"lexer");this.options=e||Nn}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]:xa(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=Mb(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],`
1524
+ `),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],`
1525
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=on(t[0],`
1491
1526
  `).split(`
1492
1527
  `),r="",o="",i=[];for(;n.length>0;){let a=!1,d=[],l;for(l=0;l<n.length;l++)if(this.rules.other.blockquoteStart.test(n[l]))d.push(n[l]),a=!0;else if(!a)d.push(n[l]);else break;n=n.slice(l);let p=d.join(`
1493
1528
  `),h=p.replace(this.rules.other.blockquoteSetextReplace,`
@@ -1499,19 +1534,19 @@ ${h}`:h;let m=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
1499
1534
  ${v}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((g==null?void 0:g.type)==="list"){let k=g,v=k.raw+`
1500
1535
  `+n.join(`
1501
1536
  `),T=this.list(v);i[i.length-1]=T,r=r.substring(0,r.length-g.raw.length)+T.raw,o=o.substring(0,o.length-k.raw.length)+T.raw,n=v.substring(i.at(-1).raw.length).split(`
1502
- `);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 l=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let m=Ob(t[2].split(`
1537
+ `);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 l=!1,p="",h="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;p=t[0],e=e.substring(p.length);let m=Db(t[2].split(`
1503
1538
  `,1)[0],t[1].length),g=e.split(`
1504
1539
  `,1)[0],k=!m.trim(),v=0;if(this.options.pedantic?(v=2,h=m.trimStart()):k?v=t[1].length+1:(v=m.search(this.rules.other.nonSpaceChar),v=v>4?1:v,h=m.slice(v),v+=t[1].length),k&&this.rules.other.blankLine.test(g)&&(p+=g+`
1505
1540
  `,e=e.substring(g.length+1),l=!0),!l){let T=this.rules.other.nextBulletRegex(v),Z=this.rules.other.hrRegex(v),Q=this.rules.other.fencesBeginRegex(v),M=this.rules.other.headingBeginRegex(v),E=this.rules.other.htmlBeginRegex(v),S=this.rules.other.blockquoteBeginRegex(v);for(;e;){let C=e.split(`
1506
1541
  `,1)[0],q;if(g=C,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),q=g):q=g.replace(this.rules.other.tabCharGlobal," "),Q.test(g)||M.test(g)||E.test(g)||S.test(g)||T.test(g)||Z.test(g))break;if(q.search(this.rules.other.nonSpaceChar)>=v||!g.trim())h+=`
1507
1542
  `+q.slice(v);else{if(k||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||Q.test(m)||M.test(m)||Z.test(m))break;h+=`
1508
1543
  `+g}k=!g.trim(),p+=C+`
1509
- `,e=e.substring(C.length+1),m=q.slice(v)}}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 l of o.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let p=l.tokens[0];if(l.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){l.text=l.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 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 h=this.rules.other.listTaskCheckbox.exec(l.raw);if(h){let m={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=m.checked,o.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=m.raw+l.tokens[0].raw,l.tokens[0].text=m.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(m)):l.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):l.tokens.unshift(m)}}else l.task&&(l.task=!1);if(!o.loose){let h=l.tokens.filter(g=>g.type==="space"),m=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=m}}if(o.loose)for(let l of o.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=ya(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:rn(t[0],`
1510
- `),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=va(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(`
1511
- `):[],i={type:"table",raw:rn(t[0],`
1512
- `),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(va(d,i.header.length).map((l,p)=>({text:l,tokens:this.lexer.inline(l),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:rn(t[0],`
1544
+ `,e=e.substring(C.length+1),m=q.slice(v)}}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 l of o.items){this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]);let p=l.tokens[0];if(l.task&&((p==null?void 0:p.type)==="text"||(p==null?void 0:p.type)==="paragraph")){l.text=l.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 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 h=this.rules.other.listTaskCheckbox.exec(l.raw);if(h){let m={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};l.checked=m.checked,o.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=m.raw+l.tokens[0].raw,l.tokens[0].text=m.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(m)):l.tokens.unshift({type:"paragraph",raw:m.raw,text:m.raw,tokens:[m]}):l.tokens.unshift(m)}}else l.task&&(l.task=!1);if(!o.loose){let h=l.tokens.filter(g=>g.type==="space"),m=h.length>0&&h.some(g=>this.rules.other.anyLine.test(g.raw));o.loose=m}}if(o.loose)for(let l of o.items){l.loose=!0;for(let p of l.tokens)p.type==="text"&&(p.type="paragraph")}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let n=xa(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],`
1545
+ `),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=wa(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(`
1546
+ `):[],i={type:"table",raw:on(t[0],`
1547
+ `),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(wa(d,i.header.length).map((l,p)=>({text:l,tokens:this.lexer.inline(l),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:on(t[0],`
1513
1548
  `),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)===`
1514
- `?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=rn(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=$b(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)),wa(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 wa(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,l=0,p=r[0][0],h=n===p,m=p==="*"?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)){l+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+l);let g=[...r[0]][0].length,k=e.slice(0,o+r.index+g+a);if(Math.min(o,a)%2){let T=k.slice(1,-1);return{type:"em",raw:k,text:T,tokens:this.lexer.inlineTokens(T)}}let v=k.slice(2,-2);return{type:"strong",raw:k,text:v,tokens:this.lexer.inlineTokens(v)}}}}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,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+o);(r=l.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),m=h.slice(o,-o);return{type:"del",raw:h,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 zs{constructor(t){se(this,"tokens");se(this,"options");se(this,"state");se(this,"inlineQueue");se(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||On,this.options.tokenizer=this.options.tokenizer||new jo,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:Fe,block:po.normal,inline:Sr.normal};this.options.pedantic?(n.block=po.pedantic,n.inline=Sr.pedantic):this.options.gfm&&(n.block=po.gfm,this.options.breaks?n.inline=Sr.breaks:n.inline=Sr.gfm),this.tokenizer.rules=n}static get rules(){return{block:po,inline:Sr}}static lex(t,n){return new zs(n).lex(t)}static lexInline(t,n){return new zs(n).inlineTokens(t)}lex(t){t=t.replace(Fe.carriageReturn,`
1549
+ `?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=Nb(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)),Sa(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 Sa(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,l=0,p=r[0][0],h=n===p,m=p==="*"?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)){l+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+l);let g=[...r[0]][0].length,k=e.slice(0,o+r.index+g+a);if(Math.min(o,a)%2){let T=k.slice(1,-1);return{type:"em",raw:k,text:T,tokens:this.lexer.inlineTokens(T)}}let v=k.slice(2,-2);return{type:"strong",raw:k,text:v,tokens:this.lexer.inlineTokens(v)}}}}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,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+o);(r=l.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),m=h.slice(o,-o);return{type:"del",raw:h,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}}}},wt=class $s{constructor(t){se(this,"tokens");se(this,"options");se(this,"state");se(this,"inlineQueue");se(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Nn,this.options.tokenizer=this.options.tokenizer||new Zo,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:Fe,block:ho.normal,inline:Tr.normal};this.options.pedantic?(n.block=ho.pedantic,n.inline=Tr.pedantic):this.options.gfm&&(n.block=ho.gfm,this.options.breaks?n.inline=Tr.breaks:n.inline=Tr.gfm),this.tokenizer.rules=n}static get rules(){return{block:ho,inline:Tr}}static lex(t,n){return new $s(n).lex(t)}static lexInline(t,n){return new $s(n).inlineTokens(t)}lex(t){t=t.replace(Fe.carriageReturn,`
1515
1550
  `),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(Fe.tabCharGlobal," ").replace(Fe.spaceLine,""));let o=1/0;for(;t;){if(t.length<o)o=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let l;if((a=(i=this.options.extensions)==null?void 0:i.block)!=null&&a.some(h=>(l=h.call({lexer:this},t,n))?(t=t.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(t)){t=t.substring(l.raw.length);let h=n.at(-1);l.raw.length===1&&h!==void 0?h.raw+=`
1516
1551
  `:n.push(l);continue}if(l=this.tokenizer.code(t)){t=t.substring(l.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(`
1517
1552
  `)?"":`
@@ -1525,9 +1560,9 @@ ${v}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((g==null?void
1525
1560
  `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l),r=p.length!==t.length,t=t.substring(l.raw.length);continue}if(l=this.tokenizer.text(t)){t=t.substring(l.raw.length);let h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
1526
1561
  `)?"":`
1527
1562
  `)+l.raw,h.text+=`
1528
- `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l);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,l,p,h,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,v=>k.includes(v.slice(v.lastIndexOf("[")+1,-1))?"["+"a".repeat(v.length-2)+"]":v))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,v,T)=>{let Z=T?T.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(p=(l=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:l.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((m=(h=this.options.extensions)==null?void 0:h.inline)!=null&&m.some(T=>(k=T.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 T=n.at(-1);k.type==="text"&&(T==null?void 0:T.type)==="text"?(T.raw+=k.raw,T.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 v=t;if((g=this.options.extensions)!=null&&g.startInline){let T=1/0,Z=t.slice(1),Q;this.options.extensions.startInline.forEach(M=>{Q=M.call({lexer:this},Z),typeof Q=="number"&&Q>=0&&(T=Math.min(T,Q))}),T<1/0&&T>=0&&(v=t.substring(0,T+1))}if(k=this.tokenizer.inlineText(v)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let T=n.at(-1);(T==null?void 0:T.type)==="text"?(T.raw+=k.raw,T.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)}},Uo=class{constructor(e){se(this,"options");se(this,"parser");this.options=e||On}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Fe.notSpaceStart))==null?void 0:i[0],o=e.replace(Fe.endingNewline,"")+`
1529
- `;return r?'<pre><code class="language-'+At(r)+'">'+(n?o:At(o,!0))+`</code></pre>
1530
- `:"<pre><code>"+(n?o:At(o,!0))+`</code></pre>
1563
+ `+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):n.push(l);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,l,p,h,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,v=>k.includes(v.slice(v.lastIndexOf("[")+1,-1))?"["+"a".repeat(v.length-2)+"]":v))}r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++"),r=r.replace(this.tokenizer.rules.inline.blockSkip,(k,v,T)=>{let Z=T?T.length:0;return k.slice(0,Z)+"["+"a".repeat(k.length-Z-2)+"]"}),r=(p=(l=(d=this.options.hooks)==null?void 0:d.emStrongMask)==null?void 0:l.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((m=(h=this.options.extensions)==null?void 0:h.inline)!=null&&m.some(T=>(k=T.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 T=n.at(-1);k.type==="text"&&(T==null?void 0:T.type)==="text"?(T.raw+=k.raw,T.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 v=t;if((g=this.options.extensions)!=null&&g.startInline){let T=1/0,Z=t.slice(1),Q;this.options.extensions.startInline.forEach(M=>{Q=M.call({lexer:this},Z),typeof Q=="number"&&Q>=0&&(T=Math.min(T,Q))}),T<1/0&&T>=0&&(v=t.substring(0,T+1))}if(k=this.tokenizer.inlineText(v)){t=t.substring(k.raw.length),k.raw.slice(-1)!=="_"&&(i=k.raw.slice(-1)),o=!0;let T=n.at(-1);(T==null?void 0:T.type)==="text"?(T.raw+=k.raw,T.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)}},qo=class{constructor(e){se(this,"options");se(this,"parser");this.options=e||Nn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;let r=(i=(t||"").match(Fe.notSpaceStart))==null?void 0:i[0],o=e.replace(Fe.endingNewline,"")+`
1564
+ `;return r?'<pre><code class="language-'+Ct(r)+'">'+(n?o:Ct(o,!0))+`</code></pre>
1565
+ `:"<pre><code>"+(n?o:Ct(o,!0))+`</code></pre>
1531
1566
  `}blockquote({tokens:e}){return`<blockquote>
1532
1567
  ${this.parser.parse(e)}</blockquote>
1533
1568
  `}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -1543,9 +1578,9 @@ ${this.parser.parse(e)}</blockquote>
1543
1578
  `}tablerow({text:e}){return`<tr>
1544
1579
  ${e}</tr>
1545
1580
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
1546
- `}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>${At(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=_a(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+At(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=_a(e);if(o===null)return At(n);e=o;let i=`<img src="${e}" alt="${At(n)}"`;return t&&(i+=` title="${At(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:At(e.text)}},oi=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 Is{constructor(t){se(this,"options");se(this,"renderer");se(this,"textRenderer");this.options=t||On,this.options.renderer=this.options.renderer||new Uo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new oi}static parse(t,n){return new Is(n).parse(t)}static parseInline(t,n){return new Is(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 l=a,p=this.options.extensions.renderers[l.type].call({parser:this},l);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.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 l='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}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 l=d;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let p='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},ko,Lr=(ko=class{constructor(e){se(this,"options");se(this,"block");this.options=e||On}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}},se(ko,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),se(ko,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),ko),Db=class{constructor(...e){se(this,"defaults",Xs());se(this,"options",this.setOptions);se(this,"parse",this.parseMarkdown(!0));se(this,"parseInline",this.parseMarkdown(!1));se(this,"Parser",wt);se(this,"Renderer",Uo);se(this,"TextRenderer",oi);se(this,"Lexer",yt);se(this,"Tokenizer",jo);se(this,"Hooks",Lr);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 l of d)n=n.concat(this.walkTokens(l.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 l=a[d].flat(1/0);n=n.concat(this.walkTokens(l,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=y({},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 Uo(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],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new jo(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],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new Lr;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],l=o[a];Lr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Lr.passThroughHooksRespectAsync.has(i))return L(this,null,function*(){let m=yield d.call(o,p);return l.call(o,m)});let h=d.call(o,p);return l.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return L(this,null,function*(){let m=yield d.apply(o,p);return m===!1&&(m=yield l.apply(o,p)),m});let h=d.apply(o,p);return h===!1&&(h=l.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=y(y({},this.defaults),r)}),this}setOptions(e){return this.defaults=y(y({},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=y({},n),o=y(y({},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?yt.lex:yt.lexInline)(a,o),l=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(l,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?wt.parse:wt.parseInline)(l,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?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+=`
1547
- Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+At(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Rn=new Db;function ae(e,t){return Rn.parse(e,t)}ae.options=ae.setOptions=function(e){return Rn.setOptions(e),ae.defaults=Rn.defaults,Oc(ae.defaults),ae};ae.getDefaults=Xs;ae.defaults=On;function Mb(...e){return Rn.use(...e),ae.defaults=Rn.defaults,Oc(ae.defaults),ae}ae.use=Mb;ae.walkTokens=function(e,t){return Rn.walkTokens(e,t)};ae.parseInline=Rn.parseInline;ae.Parser=wt;ae.parser=wt.parse;ae.Renderer=Uo;ae.TextRenderer=oi;ae.Lexer=yt;ae.lexer=yt.lex;ae.Tokenizer=jo;ae.Hooks=Lr;ae.parse=ae;ae.options;ae.setOptions;ae.walkTokens;ae.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:Bc,setPrototypeOf:xa,isFrozen:jb,getPrototypeOf:Ub,getOwnPropertyDescriptor:Zb}=Object;let{freeze:Xe,seal:pt,create:$s}=Object,{apply:Os,construct:Ns}=typeof Reflect!="undefined"&&Reflect;Xe||(Xe=function(t){return t});pt||(pt=function(t){return t});Os||(Os=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)});Ns||(Ns=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 ho=Ke(Array.prototype.forEach),qb=Ke(Array.prototype.lastIndexOf),Sa=Ke(Array.prototype.pop),Tr=Ke(Array.prototype.push),Hb=Ke(Array.prototype.splice),yo=Ke(String.prototype.toLowerCase),bs=Ke(String.prototype.toString),ks=Ke(String.prototype.match),Er=Ke(String.prototype.replace),Fb=Ke(String.prototype.indexOf),Bb=Ke(String.prototype.trim),_t=Ke(Object.prototype.hasOwnProperty),Ge=Ke(RegExp.prototype.test),Ar=Gb(TypeError);function Ke(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 Os(e,t,r)}}function Gb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ns(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:yo;xa&&xa(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(jb(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Wb(e){for(let t=0;t<e.length;t++)_t(e,t)||(e[t]=null);return e}function Ct(e){const t=$s(null);for(const[n,r]of Bc(e))_t(e,n)&&(Array.isArray(r)?t[n]=Wb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Ct(r):t[n]=r);return t}function Cr(e,t){for(;e!==null;){const r=Zb(e,t);if(r){if(r.get)return Ke(r.get);if(typeof r.value=="function")return Ke(r.value)}e=Ub(e)}function n(){return null}return n}const Ta=Xe(["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"]),_s=Xe(["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"]),vs=Xe(["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"]),Jb=Xe(["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"]),ys=Xe(["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"]),Vb=Xe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ea=Xe(["#text"]),Aa=Xe(["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"]),ws=Xe(["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"]),Ca=Xe(["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"]),fo=Xe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Yb=pt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Xb=pt(/<%[\w\W]*|[\w\W]*%>/gm),Kb=pt(/\$\{[\w\W]*/gm),Qb=pt(/^data-[\-\w.\u00B7-\uFFFF]+$/),ek=pt(/^aria-[\-\w]+$/),Gc=pt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),tk=pt(/^(?:\w+script|data):/i),nk=pt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wc=pt(/^html$/i),rk=pt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Pa=Object.freeze({__proto__:null,ARIA_ATTR:ek,ATTR_WHITESPACE:nk,CUSTOM_ELEMENT:rk,DATA_ATTR:Qb,DOCTYPE_NAME:Wc,ERB_EXPR:Xb,IS_ALLOWED_URI:Gc,IS_SCRIPT_OR_DATA:tk,MUSTACHE_EXPR:Yb,TMPLIT_EXPR:Kb});const Pr={element:1,text:3,progressingInstruction:7,comment:8,document:9},ok=function(){return typeof window=="undefined"?null:window},sk=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}},Ra=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Jc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ok();const t=j=>Jc(j);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Pr.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:l,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:k}=e,v=l.prototype,T=Cr(v,"cloneNode"),Z=Cr(v,"remove"),Q=Cr(v,"nextSibling"),M=Cr(v,"childNodes"),E=Cr(v,"parentNode");if(typeof a=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let S,C="";const{implementation:q,createNodeIterator:J,createDocumentFragment:we,getElementsByTagName:Ee}=n,{importNode:rt}=r;let ee=Ra();t.isSupported=typeof Bc=="function"&&typeof E=="function"&&q&&q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Le,ERB_EXPR:Qe,TMPLIT_EXPR:St,DATA_ATTR:Xt,ARIA_ATTR:ft,IS_SCRIPT_OR_DATA:Ot,ATTR_WHITESPACE:Nt,CUSTOM_ELEMENT:Dt}=Pa;let{IS_ALLOWED_URI:Mt}=Pa,ce=null;const gn=V({},[...Ta,..._s,...vs,...ys,...Ea]);let ve=null;const mn=V({},[...Aa,...ws,...Ca,...fo]);let N=Object.seal($s(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}})),X=null,Se=null;const ze=Object.seal($s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,ue=!0,bn=!1,Kt=!0,de=!1,Ne=!0,Ae=!1,Ie=!1,Qt=!1,De=!1,et=!1,Tt=!1,jt=!0,dr=!1;const es="user-content-";let pr=!0,kn=!1,en={},Be=null;const hr=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 pe=null;const Fr=V({},["audio","video","img","source","image","track"]);let fr=null;const Br=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Nn="http://www.w3.org/1998/Math/MathML",Dn="http://www.w3.org/2000/svg",gt="http://www.w3.org/1999/xhtml";let tn=gt,_n=!1,vn=null;const ts=V({},[Nn,Dn,gt],bs);let Mn=V({},["mi","mo","mn","ms","mtext"]),jn=V({},["annotation-xml"]);const ns=V({},["title","style","font","a","script"]);let Ut=null;const mt=["application/xhtml+xml","text/html"],rs="text/html";let he=null,nn=null;const Gr=n.createElement("form"),gr=function(_){return _ instanceof RegExp||_ instanceof Function},Un=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(nn&&nn===_)){if((!_||typeof _!="object")&&(_={}),_=Ct(_),Ut=mt.indexOf(_.PARSER_MEDIA_TYPE)===-1?rs:_.PARSER_MEDIA_TYPE,he=Ut==="application/xhtml+xml"?bs:yo,ce=_t(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,he):gn,ve=_t(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,he):mn,vn=_t(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,bs):ts,fr=_t(_,"ADD_URI_SAFE_ATTR")?V(Ct(Br),_.ADD_URI_SAFE_ATTR,he):Br,pe=_t(_,"ADD_DATA_URI_TAGS")?V(Ct(Fr),_.ADD_DATA_URI_TAGS,he):Fr,Be=_t(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,he):hr,X=_t(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,he):Ct({}),Se=_t(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,he):Ct({}),en=_t(_,"USE_PROFILES")?_.USE_PROFILES:!1,le=_.ALLOW_ARIA_ATTR!==!1,ue=_.ALLOW_DATA_ATTR!==!1,bn=_.ALLOW_UNKNOWN_PROTOCOLS||!1,Kt=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=_.SAFE_FOR_TEMPLATES||!1,Ne=_.SAFE_FOR_XML!==!1,Ae=_.WHOLE_DOCUMENT||!1,De=_.RETURN_DOM||!1,et=_.RETURN_DOM_FRAGMENT||!1,Tt=_.RETURN_TRUSTED_TYPE||!1,Qt=_.FORCE_BODY||!1,jt=_.SANITIZE_DOM!==!1,dr=_.SANITIZE_NAMED_PROPS||!1,pr=_.KEEP_CONTENT!==!1,kn=_.IN_PLACE||!1,Mt=_.ALLOWED_URI_REGEXP||Gc,tn=_.NAMESPACE||gt,Mn=_.MATHML_TEXT_INTEGRATION_POINTS||Mn,jn=_.HTML_INTEGRATION_POINTS||jn,N=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&gr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(N.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&gr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(N.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(N.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de&&(ue=!1),et&&(De=!0),en&&(ce=V({},Ea),ve=[],en.html===!0&&(V(ce,Ta),V(ve,Aa)),en.svg===!0&&(V(ce,_s),V(ve,ws),V(ve,fo)),en.svgFilters===!0&&(V(ce,vs),V(ve,ws),V(ve,fo)),en.mathMl===!0&&(V(ce,ys),V(ve,Ca),V(ve,fo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?ze.tagCheck=_.ADD_TAGS:(ce===gn&&(ce=Ct(ce)),V(ce,_.ADD_TAGS,he))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?ze.attributeCheck=_.ADD_ATTR:(ve===mn&&(ve=Ct(ve)),V(ve,_.ADD_ATTR,he))),_.ADD_URI_SAFE_ATTR&&V(fr,_.ADD_URI_SAFE_ATTR,he),_.FORBID_CONTENTS&&(Be===hr&&(Be=Ct(Be)),V(Be,_.FORBID_CONTENTS,he)),_.ADD_FORBID_CONTENTS&&(Be===hr&&(Be=Ct(Be)),V(Be,_.ADD_FORBID_CONTENTS,he)),pr&&(ce["#text"]=!0),Ae&&V(ce,["html","head","body"]),ce.table&&(V(ce,["tbody"]),delete X.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Ar('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=sk(k,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));Xe&&Xe(_),nn=_}},mr=V({},[..._s,...vs,...Jb]),Wr=V({},[...ys,...Vb]),os=function(_){let A=E(_);(!A||!A.tagName)&&(A={namespaceURI:tn,tagName:"template"});const z=yo(_.tagName),oe=yo(A.tagName);return vn[_.namespaceURI]?_.namespaceURI===Dn?A.namespaceURI===gt?z==="svg":A.namespaceURI===Nn?z==="svg"&&(oe==="annotation-xml"||Mn[oe]):!!mr[z]:_.namespaceURI===Nn?A.namespaceURI===gt?z==="math":A.namespaceURI===Dn?z==="math"&&jn[oe]:!!Wr[z]:_.namespaceURI===gt?A.namespaceURI===Dn&&!jn[oe]||A.namespaceURI===Nn&&!Mn[oe]?!1:!Wr[z]&&(ns[z]||!mr[z]):!!(Ut==="application/xhtml+xml"&&vn[_.namespaceURI]):!1},it=function(_){Tr(t.removed,{element:_});try{E(_).removeChild(_)}catch(A){Z(_)}},at=function(_,A){try{Tr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(z){Tr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(De||et)try{it(A)}catch(z){}else try{A.setAttribute(_,"")}catch(z){}},Jr=function(_){let A=null,z=null;if(Qt)_="<remove></remove>"+_;else{const xe=ks(_,/^[\r\n\t ]+/);z=xe&&xe[0]}Ut==="application/xhtml+xml"&&tn===gt&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const oe=S?S.createHTML(_):_;if(tn===gt)try{A=new g().parseFromString(oe,Ut)}catch(xe){}if(!A||!A.documentElement){A=q.createDocument(tn,"template",null);try{A.documentElement.innerHTML=_n?C:oe}catch(xe){}}const Me=A.body||A.documentElement;return _&&z&&Me.insertBefore(n.createTextNode(z),Me.childNodes[0]||null),tn===gt?Ee.call(A,Ae?"html":"body")[0]:Ae?A.documentElement:Me},br=function(_){return J.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},kr=function(_){return _ instanceof m&&(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")},Vr=function(_){return typeof d=="function"&&_ instanceof d};function bt(j,_,A){ho(j,z=>{z.call(t,_,A,nn)})}const Yr=function(_){let A=null;if(bt(ee.beforeSanitizeElements,_,null),kr(_))return it(_),!0;const z=he(_.nodeName);if(bt(ee.uponSanitizeElement,_,{tagName:z,allowedTags:ce}),Ne&&_.hasChildNodes()&&!Vr(_.firstElementChild)&&Ge(/<[/\w!]/g,_.innerHTML)&&Ge(/<[/\w!]/g,_.textContent)||_.nodeType===Pr.progressingInstruction||Ne&&_.nodeType===Pr.comment&&Ge(/<[/\w]/g,_.data))return it(_),!0;if(!(ze.tagCheck instanceof Function&&ze.tagCheck(z))&&(!ce[z]||X[z])){if(!X[z]&&Kr(z)&&(N.tagNameCheck instanceof RegExp&&Ge(N.tagNameCheck,z)||N.tagNameCheck instanceof Function&&N.tagNameCheck(z)))return!1;if(pr&&!Be[z]){const oe=E(_)||_.parentNode,Me=M(_)||_.childNodes;if(Me&&oe){const xe=Me.length;for(let He=xe-1;He>=0;--He){const kt=T(Me[He],!0);kt.__removalCount=(_.__removalCount||0)+1,oe.insertBefore(kt,Q(_))}}}return it(_),!0}return _ instanceof l&&!os(_)||(z==="noscript"||z==="noembed"||z==="noframes")&&Ge(/<\/no(script|embed|frames)/i,_.innerHTML)?(it(_),!0):(de&&_.nodeType===Pr.text&&(A=_.textContent,ho([Le,Qe,St],oe=>{A=Er(A,oe," ")}),_.textContent!==A&&(Tr(t.removed,{element:_.cloneNode()}),_.textContent=A)),bt(ee.afterSanitizeElements,_,null),!1)},Xr=function(_,A,z){if(jt&&(A==="id"||A==="name")&&(z in n||z in Gr))return!1;if(!(ue&&!Se[A]&&Ge(Xt,A))){if(!(le&&Ge(ft,A))){if(!(ze.attributeCheck instanceof Function&&ze.attributeCheck(A,_))){if(!ve[A]||Se[A]){if(!(Kr(_)&&(N.tagNameCheck instanceof RegExp&&Ge(N.tagNameCheck,_)||N.tagNameCheck instanceof Function&&N.tagNameCheck(_))&&(N.attributeNameCheck instanceof RegExp&&Ge(N.attributeNameCheck,A)||N.attributeNameCheck instanceof Function&&N.attributeNameCheck(A,_))||A==="is"&&N.allowCustomizedBuiltInElements&&(N.tagNameCheck instanceof RegExp&&Ge(N.tagNameCheck,z)||N.tagNameCheck instanceof Function&&N.tagNameCheck(z))))return!1}else if(!fr[A]){if(!Ge(Mt,Er(z,Nt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Fb(z,"data:")===0&&pe[_])){if(!(bn&&!Ge(Ot,Er(z,Nt,"")))){if(z)return!1}}}}}}}return!0},Kr=function(_){return _!=="annotation-xml"&&ks(_,Dt)},_r=function(_){bt(ee.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||kr(_))return;const z={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ve,forceKeepAttr:void 0};let oe=A.length;for(;oe--;){const Me=A[oe],{name:xe,namespaceURI:He,value:kt}=Me,Et=he(xe),vr=kt;let $e=xe==="value"?vr:Bb(vr);if(z.attrName=Et,z.attrValue=$e,z.keepAttr=!0,z.forceKeepAttr=void 0,bt(ee.uponSanitizeAttribute,_,z),$e=z.attrValue,dr&&(Et==="id"||Et==="name")&&(at(xe,_),$e=es+$e),Ne&&Ge(/((--!?|])>)|<\/(style|title|textarea)/i,$e)){at(xe,_);continue}if(Et==="attributename"&&ks($e,"href")){at(xe,_);continue}if(z.forceKeepAttr)continue;if(!z.keepAttr){at(xe,_);continue}if(!Kt&&Ge(/\/>/i,$e)){at(xe,_);continue}de&&ho([Le,Qe,St],eo=>{$e=Er($e,eo," ")});const Qr=he(_.nodeName);if(!Xr(Qr,Et,$e)){at(xe,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!He)switch(k.getAttributeType(Qr,Et)){case"TrustedHTML":{$e=S.createHTML($e);break}case"TrustedScriptURL":{$e=S.createScriptURL($e);break}}if($e!==vr)try{He?_.setAttributeNS(He,xe,$e):_.setAttribute(xe,$e),kr(_)?it(_):Sa(t.removed)}catch(eo){at(xe,_)}}bt(ee.afterSanitizeAttributes,_,null)},Zt=function j(_){let A=null;const z=br(_);for(bt(ee.beforeSanitizeShadowDOM,_,null);A=z.nextNode();)bt(ee.uponSanitizeShadowNode,A,null),Yr(A),_r(A),A.content instanceof i&&j(A.content);bt(ee.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(j){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,z=null,oe=null,Me=null;if(_n=!j,_n&&(j="<!-->"),typeof j!="string"&&!Vr(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Ar("dirty is not a string, aborting")}else throw Ar("toString is not a function");if(!t.isSupported)return j;if(Ie||Un(_),t.removed=[],typeof j=="string"&&(kn=!1),kn){if(j.nodeName){const kt=he(j.nodeName);if(!ce[kt]||X[kt])throw Ar("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof d)A=Jr("<!---->"),z=A.ownerDocument.importNode(j,!0),z.nodeType===Pr.element&&z.nodeName==="BODY"||z.nodeName==="HTML"?A=z:A.appendChild(z);else{if(!De&&!de&&!Ae&&j.indexOf("<")===-1)return S&&Tt?S.createHTML(j):j;if(A=Jr(j),!A)return De?null:Tt?C:""}A&&Qt&&it(A.firstChild);const xe=br(kn?j:A);for(;oe=xe.nextNode();)Yr(oe),_r(oe),oe.content instanceof i&&Zt(oe.content);if(kn)return j;if(De){if(et)for(Me=we.call(A.ownerDocument);A.firstChild;)Me.appendChild(A.firstChild);else Me=A;return(ve.shadowroot||ve.shadowrootmode)&&(Me=rt.call(r,Me,!0)),Me}let He=Ae?A.outerHTML:A.innerHTML;return Ae&&ce["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ge(Wc,A.ownerDocument.doctype.name)&&(He="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1548
- `+He),de&&ho([Le,Qe,St],kt=>{He=Er(He,kt," ")}),S&&Tt?S.createHTML(He):He},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Un(j),Ie=!0},t.clearConfig=function(){nn=null,Ie=!1},t.isValidAttribute=function(j,_,A){nn||Un({});const z=he(j),oe=he(_);return Xr(z,oe,A)},t.addHook=function(j,_){typeof _=="function"&&Tr(ee[j],_)},t.removeHook=function(j,_){if(_!==void 0){const A=qb(ee[j],_);return A===-1?void 0:Hb(ee[j],A,1)[0]}return Sa(ee[j])},t.removeHooks=function(j){ee[j]=[]},t.removeAllHooks=function(){ee=Ra()},t}var ik=Jc();function Vc(e){const t=ae.parse(e,{gfm:!0,breaks:!0,async:!1});return ik.sanitize(t)}const Yc=1e3,Xc=32,La=15e3,ak=new Set(["completed","failed","cancelled"]),ck=4e3;let $=null,$t=null,Ze=null,si=null,Zo=null,Ds=!1,wo=null,Ir=null,F={kind:"connecting"},er=[],sr=null,me=null,ir=null,Bt=null,$r=-1,Ye=null,Wt=!1,Gt=null,En=new Set;function Ms(){xo(),Ic(),$t&&clearInterval($t),$t=null,Gt==null||Gt(),Gt=null,Ze==null||Ze.destroy(),Ze=null,$&&Vt($),$==null||$.remove(),$=null,si=null,F={kind:"connecting"},er=[],sr=null,me=null,ir=null,Bt=null,Zo=null,$r=-1,Ye=null,Wt=!1,En=new Set}function ii(e,t,n,r,o){$&&Ms(),si=o!=null?o:null,F={kind:"connecting"},er=[],sr=null,$r=-1,Ye=null,Wt=!1,En=new Set,me=e,ir=n,Bt=t,Zo=r,zc({taskId:e,backendUrl:n,title:r}),$=document.createElement("div"),$.className="ap-sdk-panel",$.setAttribute("data-ap-sdk","1"),$.setAttribute("role","dialog"),$.setAttribute("aria-modal","true"),$.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;$.innerHTML=`
1581
+ `}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>${Ct(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=ya(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Ct(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=ya(e);if(o===null)return Ct(n);e=o;let i=`<img src="${e}" alt="${Ct(n)}"`;return t&&(i+=` title="${Ct(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ct(e.text)}},ii=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}},xt=class Os{constructor(t){se(this,"options");se(this,"renderer");se(this,"textRenderer");this.options=t||Nn,this.options.renderer=this.options.renderer||new qo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ii}static parse(t,n){return new Os(n).parse(t)}static parseInline(t,n){return new Os(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 l=a,p=this.options.extensions.renderers[l.type].call({parser:this},l);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(l.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 l='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}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 l=d;switch(l.type){case"escape":{r+=n.text(l);break}case"html":{r+=n.html(l);break}case"link":{r+=n.link(l);break}case"image":{r+=n.image(l);break}case"checkbox":{r+=n.checkbox(l);break}case"strong":{r+=n.strong(l);break}case"em":{r+=n.em(l);break}case"codespan":{r+=n.codespan(l);break}case"br":{r+=n.br(l);break}case"del":{r+=n.del(l);break}case"text":{r+=n.text(l);break}default:{let p='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return r}},_o,zr=(_o=class{constructor(e){se(this,"options");se(this,"block");this.options=e||Nn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?wt.lex:wt.lexInline}provideParser(e=this.block){return e?xt.parse:xt.parseInline}},se(_o,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),se(_o,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),_o),jb=class{constructor(...e){se(this,"defaults",Qs());se(this,"options",this.setOptions);se(this,"parse",this.parseMarkdown(!0));se(this,"parseInline",this.parseMarkdown(!1));se(this,"Parser",xt);se(this,"Renderer",qo);se(this,"TextRenderer",ii);se(this,"Lexer",wt);se(this,"Tokenizer",Zo);se(this,"Hooks",zr);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 l of d)n=n.concat(this.walkTokens(l.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 l=a[d].flat(1/0);n=n.concat(this.walkTokens(l,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=y({},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 qo(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],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h||""}}r.renderer=o}if(n.tokenizer){let o=this.defaults.tokenizer||new Zo(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],l=o[a];o[a]=(...p)=>{let h=d.apply(o,p);return h===!1&&(h=l.apply(o,p)),h}}r.tokenizer=o}if(n.hooks){let o=this.defaults.hooks||new zr;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],l=o[a];zr.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&zr.passThroughHooksRespectAsync.has(i))return z(this,null,function*(){let m=yield d.call(o,p);return l.call(o,m)});let h=d.call(o,p);return l.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return z(this,null,function*(){let m=yield d.apply(o,p);return m===!1&&(m=yield l.apply(o,p)),m});let h=d.apply(o,p);return h===!1&&(h=l.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=y(y({},this.defaults),r)}),this}setOptions(e){return this.defaults=y(y({},this.defaults),e),this}lexer(e,t){return wt.lex(e,t!=null?t:this.defaults)}parser(e,t){return xt.parse(e,t!=null?t:this.defaults)}parseMarkdown(e){return(t,n)=>{let r=y({},n),o=y(y({},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 z(this,null,function*(){let a=o.hooks?yield o.hooks.preprocess(t):t,d=yield(o.hooks?yield o.hooks.provideLexer(e):e?wt.lex:wt.lexInline)(a,o),l=o.hooks?yield o.hooks.processAllTokens(d):d;o.walkTokens&&(yield Promise.all(this.walkTokens(l,o.walkTokens)));let p=yield(o.hooks?yield o.hooks.provideParser(e):e?xt.parse:xt.parseInline)(l,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?wt.lex:wt.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?xt.parse:xt.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+=`
1582
+ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error occurred:</p><pre>"+Ct(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},Ln=new jb;function ae(e,t){return Ln.parse(e,t)}ae.options=ae.setOptions=function(e){return Ln.setOptions(e),ae.defaults=Ln.defaults,Mc(ae.defaults),ae};ae.getDefaults=Qs;ae.defaults=Nn;function Ub(...e){return Ln.use(...e),ae.defaults=Ln.defaults,Mc(ae.defaults),ae}ae.use=Ub;ae.walkTokens=function(e,t){return Ln.walkTokens(e,t)};ae.parseInline=Ln.parseInline;ae.Parser=xt;ae.parser=xt.parse;ae.Renderer=qo;ae.TextRenderer=ii;ae.Lexer=wt;ae.lexer=wt.lex;ae.Tokenizer=Zo;ae.Hooks=zr;ae.parse=ae;ae.options;ae.setOptions;ae.walkTokens;ae.parseInline;xt.parse;wt.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:Jc,setPrototypeOf:Ta,isFrozen:Zb,getPrototypeOf:qb,getOwnPropertyDescriptor:Hb}=Object;let{freeze:Xe,seal:ht,create:Ns}=Object,{apply:Ds,construct:Ms}=typeof Reflect!="undefined"&&Reflect;Xe||(Xe=function(t){return t});ht||(ht=function(t){return t});Ds||(Ds=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)});Ms||(Ms=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 fo=Ke(Array.prototype.forEach),Fb=Ke(Array.prototype.lastIndexOf),Ea=Ke(Array.prototype.pop),Er=Ke(Array.prototype.push),Bb=Ke(Array.prototype.splice),wo=Ke(String.prototype.toLowerCase),_s=Ke(String.prototype.toString),vs=Ke(String.prototype.match),Ar=Ke(String.prototype.replace),Gb=Ke(String.prototype.indexOf),Wb=Ke(String.prototype.trim),vt=Ke(Object.prototype.hasOwnProperty),Ge=Ke(RegExp.prototype.test),Cr=Jb(TypeError);function Ke(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 Ds(e,t,r)}}function Jb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Ms(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wo;Ta&&Ta(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Zb(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Vb(e){for(let t=0;t<e.length;t++)vt(e,t)||(e[t]=null);return e}function Pt(e){const t=Ns(null);for(const[n,r]of Jc(e))vt(e,n)&&(Array.isArray(r)?t[n]=Vb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Pt(r):t[n]=r);return t}function Pr(e,t){for(;e!==null;){const r=Hb(e,t);if(r){if(r.get)return Ke(r.get);if(typeof r.value=="function")return Ke(r.value)}e=qb(e)}function n(){return null}return n}const Aa=Xe(["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"]),ys=Xe(["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"]),ws=Xe(["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"]),Yb=Xe(["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"]),xs=Xe(["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"]),Xb=Xe(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ca=Xe(["#text"]),Pa=Xe(["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"]),Ss=Xe(["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"]),Ra=Xe(["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"]),go=Xe(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Kb=ht(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Qb=ht(/<%[\w\W]*|[\w\W]*%>/gm),ek=ht(/\$\{[\w\W]*/gm),tk=ht(/^data-[\-\w.\u00B7-\uFFFF]+$/),nk=ht(/^aria-[\-\w]+$/),Vc=ht(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),rk=ht(/^(?:\w+script|data):/i),ok=ht(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Yc=ht(/^html$/i),sk=ht(/^[a-z][.\w]*(-[.\w]+)+$/i);var La=Object.freeze({__proto__:null,ARIA_ATTR:nk,ATTR_WHITESPACE:ok,CUSTOM_ELEMENT:sk,DATA_ATTR:tk,DOCTYPE_NAME:Yc,ERB_EXPR:Qb,IS_ALLOWED_URI:Vc,IS_SCRIPT_OR_DATA:rk,MUSTACHE_EXPR:Kb,TMPLIT_EXPR:ek});const Rr={element:1,text:3,progressingInstruction:7,comment:8,document:9},ik=function(){return typeof window=="undefined"?null:window},ak=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}},za=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Xc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ik();const t=j=>Xc(j);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Rr.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:l,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:m,DOMParser:g,trustedTypes:k}=e,v=l.prototype,T=Pr(v,"cloneNode"),Z=Pr(v,"remove"),Q=Pr(v,"nextSibling"),M=Pr(v,"childNodes"),E=Pr(v,"parentNode");if(typeof a=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let S,C="";const{implementation:q,createNodeIterator:J,createDocumentFragment:we,getElementsByTagName:Ee}=n,{importNode:rt}=r;let ee=za();t.isSupported=typeof Jc=="function"&&typeof E=="function"&&q&&q.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Le,ERB_EXPR:Qe,TMPLIT_EXPR:Tt,DATA_ATTR:Kt,ARIA_ATTR:gt,IS_SCRIPT_OR_DATA:Nt,ATTR_WHITESPACE:Dt,CUSTOM_ELEMENT:Mt}=La;let{IS_ALLOWED_URI:jt}=La,ce=null;const mn=V({},[...Aa,...ys,...ws,...xs,...Ca]);let ve=null;const bn=V({},[...Pa,...Ss,...Ra,...go]);let N=Object.seal(Ns(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}})),X=null,Se=null;const ze=Object.seal(Ns(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let le=!0,ue=!0,kn=!1,Qt=!0,de=!1,Ne=!0,Ae=!1,Ie=!1,en=!1,De=!1,et=!1,Et=!1,Ut=!0,pr=!1;const ns="user-content-";let hr=!0,_n=!1,tn={},Be=null;const fr=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 pe=null;const Br=V({},["audio","video","img","source","image","track"]);let gr=null;const Gr=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dn="http://www.w3.org/1998/Math/MathML",Mn="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let nn=mt,vn=!1,yn=null;const rs=V({},[Dn,Mn,mt],_s);let jn=V({},["mi","mo","mn","ms","mtext"]),Un=V({},["annotation-xml"]);const os=V({},["title","style","font","a","script"]);let Zt=null;const bt=["application/xhtml+xml","text/html"],ss="text/html";let he=null,rn=null;const Wr=n.createElement("form"),mr=function(_){return _ instanceof RegExp||_ instanceof Function},Zn=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(rn&&rn===_)){if((!_||typeof _!="object")&&(_={}),_=Pt(_),Zt=bt.indexOf(_.PARSER_MEDIA_TYPE)===-1?ss:_.PARSER_MEDIA_TYPE,he=Zt==="application/xhtml+xml"?_s:wo,ce=vt(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,he):mn,ve=vt(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,he):bn,yn=vt(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,_s):rs,gr=vt(_,"ADD_URI_SAFE_ATTR")?V(Pt(Gr),_.ADD_URI_SAFE_ATTR,he):Gr,pe=vt(_,"ADD_DATA_URI_TAGS")?V(Pt(Br),_.ADD_DATA_URI_TAGS,he):Br,Be=vt(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,he):fr,X=vt(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,he):Pt({}),Se=vt(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,he):Pt({}),tn=vt(_,"USE_PROFILES")?_.USE_PROFILES:!1,le=_.ALLOW_ARIA_ATTR!==!1,ue=_.ALLOW_DATA_ATTR!==!1,kn=_.ALLOW_UNKNOWN_PROTOCOLS||!1,Qt=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=_.SAFE_FOR_TEMPLATES||!1,Ne=_.SAFE_FOR_XML!==!1,Ae=_.WHOLE_DOCUMENT||!1,De=_.RETURN_DOM||!1,et=_.RETURN_DOM_FRAGMENT||!1,Et=_.RETURN_TRUSTED_TYPE||!1,en=_.FORCE_BODY||!1,Ut=_.SANITIZE_DOM!==!1,pr=_.SANITIZE_NAMED_PROPS||!1,hr=_.KEEP_CONTENT!==!1,_n=_.IN_PLACE||!1,jt=_.ALLOWED_URI_REGEXP||Vc,nn=_.NAMESPACE||mt,jn=_.MATHML_TEXT_INTEGRATION_POINTS||jn,Un=_.HTML_INTEGRATION_POINTS||Un,N=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&mr(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(N.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&mr(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(N.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(N.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de&&(ue=!1),et&&(De=!0),tn&&(ce=V({},Ca),ve=[],tn.html===!0&&(V(ce,Aa),V(ve,Pa)),tn.svg===!0&&(V(ce,ys),V(ve,Ss),V(ve,go)),tn.svgFilters===!0&&(V(ce,ws),V(ve,Ss),V(ve,go)),tn.mathMl===!0&&(V(ce,xs),V(ve,Ra),V(ve,go))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?ze.tagCheck=_.ADD_TAGS:(ce===mn&&(ce=Pt(ce)),V(ce,_.ADD_TAGS,he))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?ze.attributeCheck=_.ADD_ATTR:(ve===bn&&(ve=Pt(ve)),V(ve,_.ADD_ATTR,he))),_.ADD_URI_SAFE_ATTR&&V(gr,_.ADD_URI_SAFE_ATTR,he),_.FORBID_CONTENTS&&(Be===fr&&(Be=Pt(Be)),V(Be,_.FORBID_CONTENTS,he)),_.ADD_FORBID_CONTENTS&&(Be===fr&&(Be=Pt(Be)),V(Be,_.ADD_FORBID_CONTENTS,he)),hr&&(ce["#text"]=!0),Ae&&V(ce,["html","head","body"]),ce.table&&(V(ce,["tbody"]),delete X.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Cr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');S=_.TRUSTED_TYPES_POLICY,C=S.createHTML("")}else S===void 0&&(S=ak(k,o)),S!==null&&typeof C=="string"&&(C=S.createHTML(""));Xe&&Xe(_),rn=_}},br=V({},[...ys,...ws,...Yb]),Jr=V({},[...xs,...Xb]),is=function(_){let A=E(_);(!A||!A.tagName)&&(A={namespaceURI:nn,tagName:"template"});const I=wo(_.tagName),oe=wo(A.tagName);return yn[_.namespaceURI]?_.namespaceURI===Mn?A.namespaceURI===mt?I==="svg":A.namespaceURI===Dn?I==="svg"&&(oe==="annotation-xml"||jn[oe]):!!br[I]:_.namespaceURI===Dn?A.namespaceURI===mt?I==="math":A.namespaceURI===Mn?I==="math"&&Un[oe]:!!Jr[I]:_.namespaceURI===mt?A.namespaceURI===Mn&&!Un[oe]||A.namespaceURI===Dn&&!jn[oe]?!1:!Jr[I]&&(os[I]||!br[I]):!!(Zt==="application/xhtml+xml"&&yn[_.namespaceURI]):!1},at=function(_){Er(t.removed,{element:_});try{E(_).removeChild(_)}catch(A){Z(_)}},ct=function(_,A){try{Er(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Er(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(De||et)try{at(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Vr=function(_){let A=null,I=null;if(en)_="<remove></remove>"+_;else{const xe=vs(_,/^[\r\n\t ]+/);I=xe&&xe[0]}Zt==="application/xhtml+xml"&&nn===mt&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const oe=S?S.createHTML(_):_;if(nn===mt)try{A=new g().parseFromString(oe,Zt)}catch(xe){}if(!A||!A.documentElement){A=q.createDocument(nn,"template",null);try{A.documentElement.innerHTML=vn?C:oe}catch(xe){}}const Me=A.body||A.documentElement;return _&&I&&Me.insertBefore(n.createTextNode(I),Me.childNodes[0]||null),nn===mt?Ee.call(A,Ae?"html":"body")[0]:Ae?A.documentElement:Me},kr=function(_){return J.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},_r=function(_){return _ instanceof m&&(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")},Yr=function(_){return typeof d=="function"&&_ instanceof d};function kt(j,_,A){fo(j,I=>{I.call(t,_,A,rn)})}const Xr=function(_){let A=null;if(kt(ee.beforeSanitizeElements,_,null),_r(_))return at(_),!0;const I=he(_.nodeName);if(kt(ee.uponSanitizeElement,_,{tagName:I,allowedTags:ce}),Ne&&_.hasChildNodes()&&!Yr(_.firstElementChild)&&Ge(/<[/\w!]/g,_.innerHTML)&&Ge(/<[/\w!]/g,_.textContent)||_.nodeType===Rr.progressingInstruction||Ne&&_.nodeType===Rr.comment&&Ge(/<[/\w]/g,_.data))return at(_),!0;if(!(ze.tagCheck instanceof Function&&ze.tagCheck(I))&&(!ce[I]||X[I])){if(!X[I]&&Qr(I)&&(N.tagNameCheck instanceof RegExp&&Ge(N.tagNameCheck,I)||N.tagNameCheck instanceof Function&&N.tagNameCheck(I)))return!1;if(hr&&!Be[I]){const oe=E(_)||_.parentNode,Me=M(_)||_.childNodes;if(Me&&oe){const xe=Me.length;for(let He=xe-1;He>=0;--He){const _t=T(Me[He],!0);_t.__removalCount=(_.__removalCount||0)+1,oe.insertBefore(_t,Q(_))}}}return at(_),!0}return _ instanceof l&&!is(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Ge(/<\/no(script|embed|frames)/i,_.innerHTML)?(at(_),!0):(de&&_.nodeType===Rr.text&&(A=_.textContent,fo([Le,Qe,Tt],oe=>{A=Ar(A,oe," ")}),_.textContent!==A&&(Er(t.removed,{element:_.cloneNode()}),_.textContent=A)),kt(ee.afterSanitizeElements,_,null),!1)},Kr=function(_,A,I){if(Ut&&(A==="id"||A==="name")&&(I in n||I in Wr))return!1;if(!(ue&&!Se[A]&&Ge(Kt,A))){if(!(le&&Ge(gt,A))){if(!(ze.attributeCheck instanceof Function&&ze.attributeCheck(A,_))){if(!ve[A]||Se[A]){if(!(Qr(_)&&(N.tagNameCheck instanceof RegExp&&Ge(N.tagNameCheck,_)||N.tagNameCheck instanceof Function&&N.tagNameCheck(_))&&(N.attributeNameCheck instanceof RegExp&&Ge(N.attributeNameCheck,A)||N.attributeNameCheck instanceof Function&&N.attributeNameCheck(A,_))||A==="is"&&N.allowCustomizedBuiltInElements&&(N.tagNameCheck instanceof RegExp&&Ge(N.tagNameCheck,I)||N.tagNameCheck instanceof Function&&N.tagNameCheck(I))))return!1}else if(!gr[A]){if(!Ge(jt,Ar(I,Dt,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Gb(I,"data:")===0&&pe[_])){if(!(kn&&!Ge(Nt,Ar(I,Dt,"")))){if(I)return!1}}}}}}}return!0},Qr=function(_){return _!=="annotation-xml"&&vs(_,Mt)},vr=function(_){kt(ee.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||_r(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ve,forceKeepAttr:void 0};let oe=A.length;for(;oe--;){const Me=A[oe],{name:xe,namespaceURI:He,value:_t}=Me,At=he(xe),yr=_t;let $e=xe==="value"?yr:Wb(yr);if(I.attrName=At,I.attrValue=$e,I.keepAttr=!0,I.forceKeepAttr=void 0,kt(ee.uponSanitizeAttribute,_,I),$e=I.attrValue,pr&&(At==="id"||At==="name")&&(ct(xe,_),$e=ns+$e),Ne&&Ge(/((--!?|])>)|<\/(style|title|textarea)/i,$e)){ct(xe,_);continue}if(At==="attributename"&&vs($e,"href")){ct(xe,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){ct(xe,_);continue}if(!Qt&&Ge(/\/>/i,$e)){ct(xe,_);continue}de&&fo([Le,Qe,Tt],to=>{$e=Ar($e,to," ")});const eo=he(_.nodeName);if(!Kr(eo,At,$e)){ct(xe,_);continue}if(S&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!He)switch(k.getAttributeType(eo,At)){case"TrustedHTML":{$e=S.createHTML($e);break}case"TrustedScriptURL":{$e=S.createScriptURL($e);break}}if($e!==yr)try{He?_.setAttributeNS(He,xe,$e):_.setAttribute(xe,$e),_r(_)?at(_):Ea(t.removed)}catch(to){ct(xe,_)}}kt(ee.afterSanitizeAttributes,_,null)},qt=function j(_){let A=null;const I=kr(_);for(kt(ee.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)kt(ee.uponSanitizeShadowNode,A,null),Xr(A),vr(A),A.content instanceof i&&j(A.content);kt(ee.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(j){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,oe=null,Me=null;if(vn=!j,vn&&(j="<!-->"),typeof j!="string"&&!Yr(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Cr("dirty is not a string, aborting")}else throw Cr("toString is not a function");if(!t.isSupported)return j;if(Ie||Zn(_),t.removed=[],typeof j=="string"&&(_n=!1),_n){if(j.nodeName){const _t=he(j.nodeName);if(!ce[_t]||X[_t])throw Cr("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof d)A=Vr("<!---->"),I=A.ownerDocument.importNode(j,!0),I.nodeType===Rr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!De&&!de&&!Ae&&j.indexOf("<")===-1)return S&&Et?S.createHTML(j):j;if(A=Vr(j),!A)return De?null:Et?C:""}A&&en&&at(A.firstChild);const xe=kr(_n?j:A);for(;oe=xe.nextNode();)Xr(oe),vr(oe),oe.content instanceof i&&qt(oe.content);if(_n)return j;if(De){if(et)for(Me=we.call(A.ownerDocument);A.firstChild;)Me.appendChild(A.firstChild);else Me=A;return(ve.shadowroot||ve.shadowrootmode)&&(Me=rt.call(r,Me,!0)),Me}let He=Ae?A.outerHTML:A.innerHTML;return Ae&&ce["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Ge(Yc,A.ownerDocument.doctype.name)&&(He="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1583
+ `+He),de&&fo([Le,Qe,Tt],_t=>{He=Ar(He,_t," ")}),S&&Et?S.createHTML(He):He},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zn(j),Ie=!0},t.clearConfig=function(){rn=null,Ie=!1},t.isValidAttribute=function(j,_,A){rn||Zn({});const I=he(j),oe=he(_);return Kr(I,oe,A)},t.addHook=function(j,_){typeof _=="function"&&Er(ee[j],_)},t.removeHook=function(j,_){if(_!==void 0){const A=Fb(ee[j],_);return A===-1?void 0:Bb(ee[j],A,1)[0]}return Ea(ee[j])},t.removeHooks=function(j){ee[j]=[]},t.removeAllHooks=function(){ee=za()},t}var ck=Xc();function Kc(e){const t=ae.parse(e,{gfm:!0,breaks:!0,async:!1});return ck.sanitize(t)}const Qc=1e3,lk=32,Ia=15e3,uk=new Set(["completed","failed","cancelled"]),dk=4e3;let L=null,Ot=null,Ze=null,ai=null,Ho=null,js=!1,xo=null,$r=null,F={kind:"connecting"},tr=[],st=!0,ir=null,me=null,ar=null,Gt=null,Or=-1,Ye=null,Jt=!1,Wt=null,An=new Set;function Us(){To(),Nc(),Ot&&clearInterval(Ot),Ot=null,Wt==null||Wt(),Wt=null,Ze==null||Ze.destroy(),Ze=null,L&&Yt(L),L==null||L.remove(),L=null,ai=null,F={kind:"connecting"},tr=[],st=!0,ir=null,me=null,ar=null,Gt=null,Ho=null,Or=-1,Ye=null,Jt=!1,An=new Set}function ci(e,t,n,r,o){L&&Us(),ai=o!=null?o:null,F={kind:"connecting"},tr=[],st=!0,ir=null,Or=-1,Ye=null,Jt=!1,An=new Set,me=e,ar=n,Gt=t,Ho=r,Oc({taskId:e,backendUrl:n,title:r}),L=document.createElement("div"),L.className="ap-sdk-panel",L.setAttribute("data-ap-sdk","1"),L.setAttribute("role","dialog"),L.setAttribute("aria-modal","true"),L.setAttribute("aria-label","Automation in progress");const i=r.length>55?`${r.slice(0,52)}…`:r;L.innerHTML=`
1549
1584
  <div class="ap-sdk-panel__header">
1550
1585
  <span class="ap-sdk-panel__title">
1551
1586
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1558,7 +1593,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1558
1593
  <div class="ap-sdk-runner__meta">
1559
1594
  <div class="ap-sdk-runner__meta-row">
1560
1595
  <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
1561
- <span class="ap-sdk-runner__title" title="${vk(r)}">${ci(i)}</span>
1596
+ <span class="ap-sdk-runner__title" title="${xk(r)}">${ui(i)}</span>
1562
1597
  </div>
1563
1598
  <div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
1564
1599
  <span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
@@ -1567,6 +1602,10 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1567
1602
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-runner__cancel-btn" data-ap-runner-cancel type="button">Cancel task</button>
1568
1603
  </div>
1569
1604
  </div>
1605
+ <div class="ap-sdk-runner__log-toolbar">
1606
+ <button type="button" class="ap-sdk-runner__scroll-toggle" data-ap-runner-scroll-toggle>Auto ↓</button>
1607
+ <button type="button" class="ap-sdk-runner__scroll-jump" data-ap-runner-scroll-jump title="Jump to latest output">Jump to latest</button>
1608
+ </div>
1570
1609
  <div class="ap-sdk-runner__log" data-ap-runner-log></div>
1571
1610
  <div class="ap-sdk-runner__chat" data-ap-runner-chat>
1572
1611
  <div class="ap-sdk-runner__question" data-ap-runner-question style="display:none"></div>
@@ -1584,17 +1623,17 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1584
1623
  </div>
1585
1624
  <div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
1586
1625
  <div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
1587
- `,$.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),$.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild($),Ze=Us(),Jt($),Ys($,Vs),$.querySelector("[data-ap-close]").addEventListener("click",()=>{Ms(),o==null||o()}),$.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),dk(t,e)}),$.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!Ds){Ds=!0,d.textContent="Confirm",wo=setTimeout(xo,ck),Ir=l=>{l.target!==d&&xo()},document.addEventListener("click",Ir,!0);return}xo(),lk(t,e)}),ai(),Kc(e,t)}function Kc(e,t){const n=d=>L(null,null,function*(){if(me!==e||!$||F.kind!=="idle"&&F.kind!=="connecting"||En.has(d.commandId))return;En.add(d.commandId);const l={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};Tn({kind:"executing",command:l,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield za(l,t,e)}),r=d=>{if(!(me!==e||!$)&&ak.has(d)){if(F.kind==="executing")Tn({kind:"finishing",status:d,actionsRun:F.actionsRun});else if(F.kind==="connecting"||F.kind==="idle"){const l=F.kind==="idle"?F.actionsRun:0;Tn({kind:"finished",status:d,actionsRun:l})}}},o=d=>{me!==e||!$||(d.outputChunk&&Ia([d.outputChunk]),r(d.status))},i=()=>L(null,null,function*(){var d;if(!(me!==e||!$))try{const l=yield Do(t,e);me===e&&$&&(Ye=(d=l[0])!=null?d:null,Ln())}catch(l){}}),a=()=>L(null,null,function*(){var d;try{const[l,p,h,m]=yield Promise.all([Rc(t,e),Tm(t,e),Do(t,e),xm(t,e)]);if(me!==e||!$)return;Ia(p),Ye=(d=h[0])!=null?d:null,Ln(),r(l.status),m&&m.status==="pending"&&(F.kind==="idle"||F.kind==="connecting")&&!En.has(m.id)?(En.add(m.id),Tn({kind:"executing",command:m,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield za(m,t,e)):F.kind==="connecting"&&Tn({kind:"idle",actionsRun:0})}catch(l){}});a(),Nm(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(me!==e||F.kind==="finished"){d();return}Gt=d})}function Tn(e){F=e,F.kind==="idle"&&sr===null&&(sr=Date.now(),qo(),$t=setInterval(qo,Yc)),F.kind==="finished"&&($t&&(clearInterval($t),$t=null),Gt==null||Gt(),Gt=null,Ze==null||Ze.hide(),Ic()),ai()}function xo(){Ds=!1,wo&&(clearTimeout(wo),wo=null),Ir&&(document.removeEventListener("click",Ir,!0),Ir=null);const e=$==null?void 0:$.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function lk(e,t){return L(this,null,function*(){if(me!==t||!$)return;const n=$.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield Am(e,t)}catch(r){n&&(n.disabled=!1)}})}function Qc(){if(!me||!Bt||!ir||!Zo)return;const e=me,t=Bt;zc({taskId:e,backendUrl:ir,title:Zo}),$t&&clearInterval($t),qo(),$t=setInterval(qo,Yc);const n=F.kind==="finished"?F.actionsRun:0;En=new Set,F={kind:"idle",actionsRun:n},ai(),Kc(e,t)}function ai(){if(!$)return;const e=$.querySelector("[data-ap-runner-status]"),t=$.querySelector("[data-ap-runner-counter]"),n=$.querySelector("[data-ap-runner-log]"),r=$.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in F?F.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,F.kind==="finished"?(e.textContent=F.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${F.status.replace(/_/g,"-")}`,r.style.display="none",kk(F.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(er.length===0&&(F.kind==="connecting"||F.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();Ln();const a=$.querySelector("[data-ap-runner-chat-input]"),d=$.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=F.kind==="finished"&&F.status==="failed";a.disabled=h,d.disabled=h||Wt,h&&(a.placeholder="This task failed — start a new automation to continue.")}const l=$.querySelector("[data-ap-runner-cancel]");l&&(l.style.display=F.kind==="finished"?"none":"");const p=$.querySelector("[data-ap-runner-summary]");p&&F.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function Ln(){var o;if(!$)return;const e=$.querySelector("[data-ap-runner-question]"),t=$.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Ye){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Ye.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1588
- <div class="ap-sdk-runner__question-label">${ci((n==null?void 0:n.header)||"The agent has a question")}</div>
1589
- <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Vc((n==null?void 0:n.question)||Ye.question)}</div>
1626
+ `,L.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),L.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(L),Ze=qs(),Vt(L),Ks(L,Xs),L.querySelector("[data-ap-close]").addEventListener("click",()=>{Us(),o==null||o()}),L.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),fk(t,e)}),L.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!js){js=!0,d.textContent="Confirm",xo=setTimeout(To,dk),$r=l=>{l.target!==d&&To()},document.addEventListener("click",$r,!0);return}To(),pk(t,e)}),L.querySelector("[data-ap-runner-scroll-toggle]").addEventListener("click",()=>{st=!st,st&&$a(),So()}),L.querySelector("[data-ap-runner-scroll-jump]").addEventListener("click",()=>{st=!0,$a(),So()}),L.querySelector("[data-ap-runner-log]").addEventListener("scroll",()=>{if(!st||!L)return;const a=L.querySelector("[data-ap-runner-log]");a.scrollHeight-a.scrollTop-a.clientHeight>lk&&(st=!1,So())}),li(),el(e,t)}function $a(){const e=L==null?void 0:L.querySelector("[data-ap-runner-log]");e&&(e.scrollTop=e.scrollHeight)}function So(){if(!L)return;const e=L.querySelector("[data-ap-runner-scroll-toggle]");e&&(e.textContent=st?"Auto ↓":"Manual",e.title=st?"Disable auto-scroll":"Enable auto-scroll",e.classList.toggle("ap-sdk-runner__scroll-toggle--active",st))}function el(e,t){const n=d=>z(null,null,function*(){if(me!==e||!L||F.kind!=="idle"&&F.kind!=="connecting"||An.has(d.commandId))return;An.add(d.commandId);const l={id:d.commandId,taskId:d.taskId,action:d.action,selector:d.selector,value:d.value,description:d.description,status:"pending",createdAt:new Date().toISOString()};En({kind:"executing",command:l,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Oa(l,t,e)}),r=d=>{if(!(me!==e||!L)&&uk.has(d)){if(F.kind==="executing")En({kind:"finishing",status:d,actionsRun:F.actionsRun});else if(F.kind==="connecting"||F.kind==="idle"){const l=F.kind==="idle"?F.actionsRun:0;En({kind:"finished",status:d,actionsRun:l})}}},o=d=>{me!==e||!L||(d.outputChunk&&Na([d.outputChunk]),r(d.status))},i=()=>z(null,null,function*(){var d;if(!(me!==e||!L))try{const l=yield jo(t,e);me===e&&L&&(Ye=(d=l[0])!=null?d:null,zn())}catch(l){}}),a=()=>z(null,null,function*(){var d;try{const[l,p,h,m]=yield Promise.all([Ic(t,e),Am(t,e),jo(t,e),Tm(t,e)]);if(me!==e||!L)return;Na(p),Ye=(d=h[0])!=null?d:null,zn(),r(l.status),m&&m.status==="pending"&&(F.kind==="idle"||F.kind==="connecting")&&!An.has(m.id)?(An.add(m.id),En({kind:"executing",command:m,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield Oa(m,t,e)):F.kind==="connecting"&&En({kind:"idle",actionsRun:0})}catch(l){}});a(),Mm(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(me!==e||F.kind==="finished"){d();return}Wt=d})}function En(e){F=e,F.kind==="idle"&&ir===null&&(ir=Date.now(),Fo(),Ot=setInterval(Fo,Qc)),F.kind==="finished"&&(Ot&&(clearInterval(Ot),Ot=null),Wt==null||Wt(),Wt=null,Ze==null||Ze.hide(),Nc()),li()}function To(){js=!1,xo&&(clearTimeout(xo),xo=null),$r&&(document.removeEventListener("click",$r,!0),$r=null);const e=L==null?void 0:L.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function pk(e,t){return z(this,null,function*(){if(me!==t||!L)return;const n=L.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield Pm(e,t)}catch(r){n&&(n.disabled=!1)}})}function tl(){if(!me||!Gt||!ar||!Ho)return;const e=me,t=Gt;Oc({taskId:e,backendUrl:ar,title:Ho}),Ot&&clearInterval(Ot),Fo(),Ot=setInterval(Fo,Qc);const n=F.kind==="finished"?F.actionsRun:0;An=new Set,F={kind:"idle",actionsRun:n},li(),el(e,t)}function li(){if(!L)return;const e=L.querySelector("[data-ap-runner-status]"),t=L.querySelector("[data-ap-runner-counter]"),n=L.querySelector("[data-ap-runner-log]"),r=L.querySelector("[data-ap-runner-hint]");if(!e||!t||!n||!r)return;const o="actionsRun"in F?F.actionsRun:0;t.textContent=`${o} action${o===1?"":"s"}`,So(),F.kind==="finished"?(e.textContent=F.status.replace(/_/g," "),e.className=`ap-sdk-status-badge ap-sdk-status-badge--${F.status.replace(/_/g,"-")}`,r.style.display="none",yk(F.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(tr.length===0&&(F.kind==="connecting"||F.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();zn();const a=L.querySelector("[data-ap-runner-chat-input]"),d=L.querySelector("[data-ap-runner-chat-send]");if(a&&d){const h=F.kind==="finished"&&F.status==="failed";a.disabled=h,d.disabled=h||Jt,h&&(a.placeholder="This task failed — start a new automation to continue.")}const l=L.querySelector("[data-ap-runner-cancel]");l&&(l.style.display=F.kind==="finished"?"none":"");const p=L.querySelector("[data-ap-runner-summary]");p&&F.kind!=="finished"&&(p.style.display="none",p.innerHTML="")}function zn(){var o;if(!L)return;const e=L.querySelector("[data-ap-runner-question]"),t=L.querySelector("[data-ap-runner-chat-input]");if(!e||!t)return;if(!Ye){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=Ye.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1627
+ <div class="ap-sdk-runner__question-label">${ui((n==null?void 0:n.header)||"The agent has a question")}</div>
1628
+ <div class="ap-sdk-runner__question-text ap-sdk-markdown">${Kc((n==null?void 0:n.question)||Ye.question)}</div>
1590
1629
  ${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
1591
- `,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 uk(a.label)),i.appendChild(d)}}}function uk(e){return L(this,null,function*(){var r;if(!$||!Ye||!me||Wt)return;const t=me,n=Bt;if(n){Wt=!0;try{const o={selectedOption:e};yield Lc(n,t,Ye.id,o),Ye=null,Ln();const i=yield Do(n,t);me===t&&$&&(Ye=(r=i[0])!=null?r:null,Ln())}catch(o){const i=$.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Wt=!1}}})}function qo(){if(!$||sr===null)return;const e=$.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-sr)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function za(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})`);Ze==null||Ze.update(a),o=hk(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(Ze==null||Ze.update(a),e.action==="click")yield Mm(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");fk(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(me===n&&$&&gk(r,e,o),yield pk(t,n,e.id,r,o),me!==n||!$)return;Ze==null||Ze.hide();const i=(F.kind==="executing"||F.kind==="finishing"?F.actionsRun:0)+1;F.kind==="finishing"?Tn({kind:"finished",status:F.status,actionsRun:i}):F.kind==="executing"&&Tn({kind:"idle",actionsRun:i})})}function dk(e,t){return L(this,null,function*(){var a;if(!$||Wt||F.kind==="finished"&&F.status==="failed")return;const n=$.querySelector("[data-ap-runner-chat-input]"),r=$.querySelector("[data-ap-runner-chat-error]"),o=$.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Wt=!0,o.disabled=!0,r.style.display="none";try{if(Ye){yield Lc(e,t,Ye.id,i),Ye=null,Ln();try{const d=yield Do(e,t);me===t&&$&&(Ye=(a=d[0])!=null?a:null,Ln())}catch(d){}}else yield Em(e,t,i),F.kind==="finished"&&Qc();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Wt=!1,o.disabled=!1}}})}function pk(e,t,n,r,o){return L(this,null,function*(){try{yield Sm(e,t,n,r,o)}catch(i){}})}function hk(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Ga(t);let n=t.outerHTML,r=!1;return n.length>La&&(n=n.slice(0,La),r=!0),`URL: ${location.href}
1630
+ `,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 hk(a.label)),i.appendChild(d)}}}function hk(e){return z(this,null,function*(){var r;if(!L||!Ye||!me||Jt)return;const t=me,n=Gt;if(n){Jt=!0;try{const o={selectedOption:e};yield $c(n,t,Ye.id,o),Ye=null,zn();const i=yield jo(n,t);me===t&&L&&(Ye=(r=i[0])!=null?r:null,zn())}catch(o){const i=L.querySelector("[data-ap-runner-chat-error]");i&&(i.textContent="Failed to send your answer — try again.",i.style.display="block")}finally{Jt=!1}}})}function Fo(){if(!L||ir===null)return;const e=L.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-ir)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function Oa(e,t,n){return z(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})`);Ze==null||Ze.update(a),o=mk(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(Ze==null||Ze.update(a),e.action==="click")yield Um(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");bk(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(me===n&&L&&kk(r,e,o),yield gk(t,n,e.id,r,o),me!==n||!L)return;Ze==null||Ze.hide();const i=(F.kind==="executing"||F.kind==="finishing"?F.actionsRun:0)+1;F.kind==="finishing"?En({kind:"finished",status:F.status,actionsRun:i}):F.kind==="executing"&&En({kind:"idle",actionsRun:i})})}function fk(e,t){return z(this,null,function*(){var a;if(!L||Jt||F.kind==="finished"&&F.status==="failed")return;const n=L.querySelector("[data-ap-runner-chat-input]"),r=L.querySelector("[data-ap-runner-chat-error]"),o=L.querySelector("[data-ap-runner-chat-send]");if(!n||!r||!o)return;const i=n.value.trim();if(i){Jt=!0,o.disabled=!0,r.style.display="none";try{if(Ye){yield $c(e,t,Ye.id,i),Ye=null,zn();try{const d=yield jo(e,t);me===t&&L&&(Ye=(a=d[0])!=null?a:null,zn())}catch(d){}}else yield Cm(e,t,i),F.kind==="finished"&&tl();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Jt=!1,o.disabled=!1}}})}function gk(e,t,n,r,o){return z(this,null,function*(){try{yield Em(e,t,n,r,o)}catch(i){}})}function mk(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Va(t);let n=t.outerHTML,r=!1;return n.length>Ia&&(n=n.slice(0,Ia),r=!0),`URL: ${location.href}
1592
1631
  Title: ${document.title}
1593
1632
 
1594
1633
  ${n}${r?`
1595
- … (truncated)`:""}`}function fk(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 gk(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(er.push({status:e,text:`${r} ${i}${d}`}),!$)return;const l=$.querySelector("[data-ap-runner-log]");if(!l)return;(g=l.querySelector("[data-ap-runner-placeholder]"))==null||g.remove();const p=l.scrollHeight-l.scrollTop-l.clientHeight<=Xc,h=document.createElement("div");h.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,h.textContent=er[er.length-1].text,l.appendChild(h),p&&(l.scrollTop=l.scrollHeight)}function mk(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function bk(e){const t=mk(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function Ia(e){var r;const t=e.filter(o=>o.sequence>$r).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||($r=Math.max($r,...t.map(o=>o.sequence)),!$))return;const n=$.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=bk(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=n.scrollHeight-n.scrollTop-n.clientHeight<=Xc,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=Vc(i)):d.textContent=i,n.appendChild(d),a&&(n.scrollTop=n.scrollHeight)}}function kk(e){if(!$||!me||!ir)return;const t=$.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${ir.replace(/\/+$/,"")}/tasks/${me}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed",i=o?"ap-sdk-panel__btn--secondary":"ap-sdk-panel__btn--primary";t.style.display="block",t.innerHTML=`
1634
+ … (truncated)`:""}`}function bk(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 kk(e,t,n){var h,m;const r=e==="done"?"✓":"✗",o=t.selector?` \`${t.selector}\``:"",i=t.description||`${t.action}${o}`,a=e==="done"&&t.action==="getContext"?`read context (${(h=n==null?void 0:n.length)!=null?h:0} chars)`:n,d=a?` — ${a}`:"";if(tr.push({status:e,text:`${r} ${i}${d}`}),!L)return;const l=L.querySelector("[data-ap-runner-log]");if(!l)return;(m=l.querySelector("[data-ap-runner-placeholder]"))==null||m.remove();const p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=tr[tr.length-1].text,l.appendChild(p),st&&(l.scrollTop=l.scrollHeight)}function _k(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function vk(e){const t=_k(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function Na(e){var r;const t=e.filter(o=>o.sequence>Or).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Or=Math.max(Or,...t.map(o=>o.sequence)),!L))return;const n=L.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=vk(o);if(!i)continue;(r=n.querySelector("[data-ap-runner-placeholder]"))==null||r.remove();const a=document.createElement("div");a.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--output ap-sdk-runner__log-entry--${o.stream}`,o.stream==="sdk_event"?(a.classList.add("ap-sdk-markdown"),a.innerHTML=Kc(i)):a.textContent=i,n.appendChild(a),st&&(n.scrollTop=n.scrollHeight)}}function yk(e){if(!L||!me||!ar)return;const t=L.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${ar.replace(/\/+$/,"")}/tasks/${me}`,r=e==="completed"?"Automation complete!":"Automation ended",o=e==="completed",i=o?"ap-sdk-panel__btn--secondary":"ap-sdk-panel__btn--primary";t.style.display="block",t.innerHTML=`
1596
1635
  <div class="ap-sdk-success-card">
1597
- <p class="ap-sdk-success-headline">${ci(r)}</p>
1636
+ <p class="ap-sdk-success-headline">${ui(r)}</p>
1598
1637
  ${o?`
1599
1638
  <div class="ap-sdk-runner__approval" data-ap-runner-approval>
1600
1639
  <div class="ap-sdk-runner__approval-actions">
@@ -1614,7 +1653,7 @@ ${n}${r?`
1614
1653
  <button class="ap-sdk-runner__text-btn" data-ap-runner-close>Close</button>
1615
1654
  </div>
1616
1655
  </div>
1617
- `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const a=si;Ms(),a==null||a()}),o&&_k(t)}function _k(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"),l=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>L(null,null,function*(){if(!me||!Bt)return;const h=me,m=Bt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield Cm(m,h),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,l(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 p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>L(null,null,function*(){if(!me||!Bt)return;const h=me,m=Bt,g=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield Pm(m,h,g),g?Qc():(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(),l(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function vk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ci(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function yk(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1656
+ `,t.querySelector("[data-ap-runner-view]").addEventListener("click",()=>window.open(n,"_blank","noopener,noreferrer")),t.querySelector("[data-ap-runner-close]").addEventListener("click",()=>{const a=ai;Us(),a==null||a()}),o&&wk(t)}function wk(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"),l=h=>{a.textContent=h,a.style.display="block"};t.addEventListener("click",()=>z(null,null,function*(){if(!me||!Gt)return;const h=me,m=Gt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield Rm(m,h),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,l(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 p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>z(null,null,function*(){if(!me||!Gt)return;const h=me,m=Gt,g=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield Lm(m,h,g),g?tl():(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(),l(k instanceof Error?k.message:"Failed to reject — try again.")}}))}function xk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ui(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Sk(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1618
1657
  <details class="ap-sdk-advanced__details">
1619
1658
  <summary class="ap-sdk-advanced__summary">Advanced options</summary>
1620
1659
  <div class="ap-sdk-advanced__body">
@@ -1633,12 +1672,12 @@ ${n}${r?`
1633
1672
  </div>
1634
1673
  </div>
1635
1674
  </details>
1636
- `,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 l=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};vm(p,n!=null?n:void 0).then(h=>{var g,k;if(l=h,h.length===0){i.style.display="none";return}const m=(g=h.find(v=>v.isDefault&&v.scope==="project"))!=null?g:h.find(v=>v.isDefault&&v.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(v=>`<option value="${wk(v.id)}">${xk(v.name)}${v.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 p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var m,g,k,v,T,Z,Q,M;const p=a.value||null,h=p?(g=(m=l.find(E=>E.id===p))==null?void 0:m.templateData)!=null?g:{}:{};return y(y(y(y(y(y(y(y(y(y({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}:{}),(v=h.selectedSkillIds)!=null&&v.length?{selectedSkillIds:h.selectedSkillIds}:{}),(T=h.selectedPluginSkillIds)!=null&&T.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(Q=h.selectedSlashCommandIds)!=null&&Q.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(M=h.selectedRemoteContextProviderIds)!=null&&M.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function wk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const li="ap-sdk-captures",Sk=50;function ur(){try{const e=localStorage.getItem(li);return e?JSON.parse(e):[]}catch(e){return[]}}function Tk(e){const t=ur(),n=[e,...t].slice(0,Sk);try{localStorage.setItem(li,JSON.stringify(n))}catch(r){}}function Ek(){try{localStorage.removeItem(li)}catch(e){}}function el(e){var a,d,l,p,h;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=(l=e.getAttribute("aria-label"))==null?void 0:l.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 Ak(e,t){return`Click "${e}" ${t.toLowerCase()}`}function tl(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function $a(e,t){return`Scrolled to (${e}, ${t})`}function Ck(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function nl(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1637
- `)}const Pk=400,Rk=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Lk=new Set(["Control","Meta","Alt","Shift"]);function zk(e){if(Lk.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("+")):Rk.has(e.key)?e.key:null}function Ik(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?el(e):Lo(e)||e.tagName.toLowerCase()}let ar=[],We=null,Ho=null,tt=null,Lt=null,zt=null;function rl(){Ho&&(Ho.textContent=`● Recording — ${ar.length} step${ar.length===1?"":"s"}`)}function js(){zt&&(clearTimeout(zt),zt=null),Lt&&(ar.push(Lt),Lt=null,rl())}function xs(e){js(),ar.push(e),rl()}function $k(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 Ok(e,t){tt&&tt(),ar=[],Lt=null,We=document.createElement("div"),We.className="ap-sdk-recorder-bar",We.setAttribute("data-ap-sdk","1"),We.innerHTML=`
1675
+ `,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 l=[];if(r){const p={backendUrl:t.backendUrl,token:t.token};wm(p,n!=null?n:void 0).then(h=>{var g,k;if(l=h,h.length===0){i.style.display="none";return}const m=(g=h.find(v=>v.isDefault&&v.scope==="project"))!=null?g:h.find(v=>v.isDefault&&v.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(v=>`<option value="${Tk(v.id)}">${Ek(v.name)}${v.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 p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var m,g,k,v,T,Z,Q,M;const p=a.value||null,h=p?(g=(m=l.find(E=>E.id===p))==null?void 0:m.templateData)!=null?g:{}:{};return y(y(y(y(y(y(y(y(y(y({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}:{}),(v=h.selectedSkillIds)!=null&&v.length?{selectedSkillIds:h.selectedSkillIds}:{}),(T=h.selectedPluginSkillIds)!=null&&T.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(Q=h.selectedSlashCommandIds)!=null&&Q.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(M=h.selectedRemoteContextProviderIds)!=null&&M.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function Tk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ek(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const di="ap-sdk-captures",Ak=50;function dr(){try{const e=localStorage.getItem(di);return e?JSON.parse(e):[]}catch(e){return[]}}function Ck(e){const t=dr(),n=[e,...t].slice(0,Ak);try{localStorage.setItem(di,JSON.stringify(n))}catch(r){}}function Pk(){try{localStorage.removeItem(di)}catch(e){}}function nl(e){var a,d,l,p,h;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=(l=e.getAttribute("aria-label"))==null?void 0:l.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 Rk(e,t){return`Click "${e}" ${t.toLowerCase()}`}function rl(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Da(e,t){return`Scrolled to (${e}, ${t})`}function Lk(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function ol(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1676
+ `)}const zk=400,Ik=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),$k=new Set(["Control","Meta","Alt","Shift"]);function Ok(e){if($k.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("+")):Ik.has(e.key)?e.key:null}function Nk(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?nl(e):Io(e)||e.tagName.toLowerCase()}let cr=[],We=null,Bo=null,tt=null,zt=null,It=null;function sl(){Bo&&(Bo.textContent=`● Recording — ${cr.length} step${cr.length===1?"":"s"}`)}function Zs(){It&&(clearTimeout(It),It=null),zt&&(cr.push(zt),zt=null,sl())}function Ts(e){Zs(),cr.push(e),sl()}function Dk(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 Mk(e,t){tt&&tt(),cr=[],zt=null,We=document.createElement("div"),We.className="ap-sdk-recorder-bar",We.setAttribute("data-ap-sdk","1"),We.innerHTML=`
1638
1677
  <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1639
1678
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1640
1679
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1641
- `,document.body.appendChild(We),Jt(We),Ho=We.querySelector("[data-ap-recorder-counter]");const n=()=>{js();const l=ar;tt==null||tt(),e(l)},r=()=>{tt==null||tt()};We.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),We.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=l=>{if(zr(l.target))return;const p=l.target;xs({action:"click",cssSelector:_o(p),elementText:Lo(p),description:Ak(Lo(p),p.tagName),capturedAt:new Date().toISOString()})},i=l=>{if(zr(l.target))return;const p=l.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=el(p),m=vd(p),g=m?"[redacted]":$k(p);xs(D(y({action:"inputText",cssSelector:_o(p),elementText:h,value:g},m?{redacted:!0}:{}),{description:tl(h,g,m),capturedAt:new Date().toISOString()}))},a=()=>{const l=Math.round(window.scrollX),p=Math.round(window.scrollY);Lt?(Lt.scrollX=l,Lt.scrollY=p,Lt.description=$a(l,p)):Lt={action:"scroll",scrollX:l,scrollY:p,description:$a(l,p),capturedAt:new Date().toISOString()},zt&&clearTimeout(zt),zt=setTimeout(()=>{zt=null,js()},Pk)},d=l=>{if(l.key==="Escape"){r();return}if(zr(l.target))return;const p=zk(l);if(!p)return;const h=l.target instanceof Element?l.target:document.body,m=Ik(h);xs({action:"keypress",cssSelector:_o(h),elementText:m,key:p,description:Ck(p,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}),tt=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),zt&&(clearTimeout(zt),zt=null),Lt=null,We&&Vt(We),We==null||We.remove(),We=null,Ho=null,tt=null}}function Nk(){tt==null||tt()}function So(){return tt!==null}const Dk="data-ap-sdk",Mk="ap-sdk-fab",Oa="ap-sdk-fab--dragging",ui="ap-sdk-fab--open",ol="ap-sdk-fab-pos",Fo="ap-sdk-fab--left-edge",jk='<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>',Uk='<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>',Zk='<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>',qk='<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 I=null,Pt=null,an=null,cn=null,ct=null,Hn=null,Fn=null,Bn=null,To=null,Or=null,tr=null,Eo=null,Ao=null,Co=null,sl=0,il=0,al=0,cl=0,Jn=!1,vt=!1,Nr=null,An=null;function Hk(){Nr=e=>{if(!I){Po();return}if(!Jn){if(Math.hypot(e.clientX-al,e.clientY-cl)<5)return;Jn=!0,vt=!0,I.classList.add(Oa)}Fk(e.clientX-sl,e.clientY-il)},An=()=>{if(!I){Po();return}Jn?(Jn=!1,I.classList.remove(Oa),I.style.transition="",Bk(I.getBoundingClientRect())):I.style.transition="",Po()},window.addEventListener("pointermove",Nr),window.addEventListener("pointerup",An),window.addEventListener("pointercancel",An)}function Po(){Nr&&(window.removeEventListener("pointermove",Nr),Nr=null),An&&(window.removeEventListener("pointerup",An),window.removeEventListener("pointercancel",An),An=null)}function Fk(e,t){if(!I)return;const n=I.offsetWidth||52,r=I.offsetHeight||52;I.style.top=`${Math.max(0,Math.min(t,window.innerHeight-r))}px`,I.style.left=`${Math.max(0,Math.min(e,window.innerWidth-n))}px`,I.style.bottom="auto",I.style.right="auto"}function Bk(e){if(!I)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";I.style.top="auto",I.style.bottom=`${n}px`,r==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(Fo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(Fo));try{localStorage.setItem(ol,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Gk(){if(I)try{const e=localStorage.getItem(ol);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));I.style.top="auto",I.style.bottom=`${r}px`,t.edge==="left"?(I.style.right="auto",I.style.left="16px",I.classList.add(Fo)):(I.style.left="auto",I.style.right="16px",I.classList.remove(Fo))}catch(e){}}function Vn(){I==null||I.classList.remove(ui),tr&&(window.removeEventListener("pointerdown",tr,{capture:!0}),tr=null)}function Wk(){I&&(I.classList.add(ui),tr=e=>{!I||I.contains(e.target)||Vn()},requestAnimationFrame(()=>{tr&&window.addEventListener("pointerdown",tr,{capture:!0})}))}function go(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function ll(e,t,n){var d;if(Eo=e,Ao=t,Co=n,I)return;I=document.createElement("div"),I.className=Mk,I.setAttribute(Dk,"1"),Hn=document.createElement("div"),Hn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ct=document.createElement("button"),ct.className="ap-sdk-fab__list ap-sdk-fab__sub",ct.setAttribute("aria-label","My captures"),ct.setAttribute("title","View my captures"),ct.appendChild(go(qk));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ct.appendChild(o),Hn.appendChild(r),Hn.appendChild(ct),Fn=document.createElement("div"),Fn.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(go(Uk)),Fn.appendChild(i),Fn.appendChild(an),Bn=document.createElement("div"),Bn.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(go(Zk)),Bn.appendChild(a),Bn.appendChild(cn),Pt=document.createElement("button"),Pt.className="ap-sdk-fab__main",Pt.setAttribute("aria-label","Agent Platform"),Pt.setAttribute("title","Agent Platform"),Pt.appendChild(go(jk)),I.appendChild(Hn),I.appendChild(Fn),I.appendChild(Bn),I.appendChild(Pt),Pt.addEventListener("click",l=>{if(vt){vt=!1;return}l.preventDefault(),l.stopPropagation(),I!=null&&I.classList.contains(ui)?Vn():Wk()}),an.addEventListener("click",l=>{if(vt){vt=!1;return}l.preventDefault(),l.stopPropagation(),Vn(),!Kn()&&!So()&&Eo&&Eo()}),cn.addEventListener("click",l=>{if(vt){vt=!1;return}l.preventDefault(),l.stopPropagation(),Vn(),!Kn()&&!So()&&Ao&&Ao()}),ct.addEventListener("click",l=>{if(vt){vt=!1;return}l.preventDefault(),l.stopPropagation(),Vn(),Co&&Co()}),Or=l=>{if(!I||!(I===l.target||I.contains(l.target)))return;const p=I.getBoundingClientRect();sl=l.clientX-p.left,il=l.clientY-p.top,al=l.clientX,cl=l.clientY,Jn=!1,vt=!1,I.style.transition="none",l.stopPropagation(),Hk()},window.addEventListener("pointerdown",Or,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild(I),Jt(I),Gk(),To=setInterval(()=>{Pt&&Pt.classList.toggle("ap-sdk-fab__main--active",Kn()||So())},200)}function zn(e){const t=ct==null?void 0:ct.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function ul(){Jn=!1,vt=!1,Po(),Vn(),To&&(clearInterval(To),To=null),Or&&(window.removeEventListener("pointerdown",Or,{capture:!0}),Or=null),I&&Vt(I),I==null||I.remove(),I=null,Pt=null,an=null,cn=null,ct=null,Hn=null,Fn=null,Bn=null,Eo=null,Ao=null,Co=null}function dl(e,t){return L(this,null,function*(){try{if(e.type==="planning"){const r=yield ym(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Rc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function pl(e){return e.filter(t=>!t.approved).length}function hl(e){return L(this,null,function*(){const t=ur();if(!e||t.length===0){zn(t.length);return}const n=yield Promise.all(t.map(r=>dl(r,e)));zn(pl(n))})}let W=null,Ve=null,Ft=null;function Dr(){return W!==null}function Ur(){W&&Vt(W),W==null||W.remove(),W=null,Ft==null||Ft(),Ft=null,Ve==null||Ve.destroy(),Ve=null}function fl(e,t,n,r,o,i,a,d,l,p,h=null){var mn;W&&Ur();const m=!n.backendUrl||!n.token,g=la(h,"tasks:write"),k=la(h,"planning-sessions:write"),v={captureType:!g&&k?"planning":"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:!1};W=document.createElement("div"),W.className="ap-sdk-panel",W.setAttribute("data-ap-sdk","1"),W.setAttribute("role","dialog"),W.setAttribute("aria-modal","true"),W.setAttribute("aria-label","Capture to Agent Platform"),W.innerHTML=`
1680
+ `,document.body.appendChild(We),Vt(We),Bo=We.querySelector("[data-ap-recorder-counter]");const n=()=>{Zs();const l=cr;tt==null||tt(),e(l)},r=()=>{tt==null||tt()};We.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),We.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=l=>{if(Ir(l.target))return;const p=l.target;Ts({action:"click",cssSelector:vo(p),elementText:Io(p),description:Rk(Io(p),p.tagName),capturedAt:new Date().toISOString()})},i=l=>{if(Ir(l.target))return;const p=l.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=nl(p),m=wd(p),g=m?"[redacted]":Dk(p);Ts(D(y({action:"inputText",cssSelector:vo(p),elementText:h,value:g},m?{redacted:!0}:{}),{description:rl(h,g,m),capturedAt:new Date().toISOString()}))},a=()=>{const l=Math.round(window.scrollX),p=Math.round(window.scrollY);zt?(zt.scrollX=l,zt.scrollY=p,zt.description=Da(l,p)):zt={action:"scroll",scrollX:l,scrollY:p,description:Da(l,p),capturedAt:new Date().toISOString()},It&&clearTimeout(It),It=setTimeout(()=>{It=null,Zs()},zk)},d=l=>{if(l.key==="Escape"){r();return}if(Ir(l.target))return;const p=Ok(l);if(!p)return;const h=l.target instanceof Element?l.target:document.body,m=Nk(h);Ts({action:"keypress",cssSelector:vo(h),elementText:m,key:p,description:Lk(p,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}),tt=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),It&&(clearTimeout(It),It=null),zt=null,We&&Yt(We),We==null||We.remove(),We=null,Bo=null,tt=null}}function jk(){tt==null||tt()}function Eo(){return tt!==null}const Uk="data-ap-sdk",Zk="ap-sdk-fab",Ma="ap-sdk-fab--dragging",pi="ap-sdk-fab--open",il="ap-sdk-fab-pos",Go="ap-sdk-fab--left-edge",qk='<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>',Hk='<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>',Fk='<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>',Bk='<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,Rt=null,cn=null,ln=null,lt=null,Fn=null,Bn=null,Gn=null,Ao=null,Nr=null,nr=null,Co=null,Po=null,Ro=null,al=0,cl=0,ll=0,ul=0,Vn=!1,yt=!1,Dr=null,Cn=null;function Gk(){Dr=e=>{if(!$){Lo();return}if(!Vn){if(Math.hypot(e.clientX-ll,e.clientY-ul)<5)return;Vn=!0,yt=!0,$.classList.add(Ma)}Wk(e.clientX-al,e.clientY-cl)},Cn=()=>{if(!$){Lo();return}Vn?(Vn=!1,$.classList.remove(Ma),$.style.transition="",Jk($.getBoundingClientRect())):$.style.transition="",Lo()},window.addEventListener("pointermove",Dr),window.addEventListener("pointerup",Cn),window.addEventListener("pointercancel",Cn)}function Lo(){Dr&&(window.removeEventListener("pointermove",Dr),Dr=null),Cn&&(window.removeEventListener("pointerup",Cn),window.removeEventListener("pointercancel",Cn),Cn=null)}function Wk(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 Jk(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(Go)):($.style.left="auto",$.style.right="16px",$.classList.remove(Go));try{localStorage.setItem(il,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Vk(){if($)try{const e=localStorage.getItem(il);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(Go)):($.style.left="auto",$.style.right="16px",$.classList.remove(Go))}catch(e){}}function Yn(){$==null||$.classList.remove(pi),nr&&(window.removeEventListener("pointerdown",nr,{capture:!0}),nr=null)}function Yk(){$&&($.classList.add(pi),nr=e=>{!$||$.contains(e.target)||Yn()},requestAnimationFrame(()=>{nr&&window.addEventListener("pointerdown",nr,{capture:!0})}))}function mo(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function dl(e,t,n){var d;if(Co=e,Po=t,Ro=n,$)return;$=document.createElement("div"),$.className=Zk,$.setAttribute(Uk,"1"),Fn=document.createElement("div"),Fn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",lt=document.createElement("button"),lt.className="ap-sdk-fab__list ap-sdk-fab__sub",lt.setAttribute("aria-label","My captures"),lt.setAttribute("title","View my captures"),lt.appendChild(mo(Bk));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",lt.appendChild(o),Fn.appendChild(r),Fn.appendChild(lt),Bn=document.createElement("div"),Bn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",cn=document.createElement("button"),cn.className="ap-sdk-fab__capture ap-sdk-fab__sub",cn.setAttribute("aria-label","Capture element"),cn.setAttribute("title","Capture element to Agent Platform"),cn.appendChild(mo(Hk)),Bn.appendChild(i),Bn.appendChild(cn),Gn=document.createElement("div"),Gn.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",ln=document.createElement("button"),ln.className="ap-sdk-fab__record ap-sdk-fab__sub",ln.setAttribute("aria-label","Record interaction"),ln.setAttribute("title","Record a sequence of interactions"),ln.appendChild(mo(Fk)),Gn.appendChild(a),Gn.appendChild(ln),Rt=document.createElement("button"),Rt.className="ap-sdk-fab__main",Rt.setAttribute("aria-label","Agent Platform"),Rt.setAttribute("title","Agent Platform"),Rt.appendChild(mo(qk)),$.appendChild(Fn),$.appendChild(Bn),$.appendChild(Gn),$.appendChild(Rt),Rt.addEventListener("click",l=>{if(yt){yt=!1;return}l.preventDefault(),l.stopPropagation(),$!=null&&$.classList.contains(pi)?Yn():Yk()}),cn.addEventListener("click",l=>{if(yt){yt=!1;return}l.preventDefault(),l.stopPropagation(),Yn(),!Qn()&&!Eo()&&Co&&Co()}),ln.addEventListener("click",l=>{if(yt){yt=!1;return}l.preventDefault(),l.stopPropagation(),Yn(),!Qn()&&!Eo()&&Po&&Po()}),lt.addEventListener("click",l=>{if(yt){yt=!1;return}l.preventDefault(),l.stopPropagation(),Yn(),Ro&&Ro()}),Nr=l=>{if(!$||!($===l.target||$.contains(l.target)))return;const p=$.getBoundingClientRect();al=l.clientX-p.left,cl=l.clientY-p.top,ll=l.clientX,ul=l.clientY,Vn=!1,yt=!1,$.style.transition="none",l.stopPropagation(),Gk()},window.addEventListener("pointerdown",Nr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),Vt($),Vk(),Ao=setInterval(()=>{Rt&&Rt.classList.toggle("ap-sdk-fab__main--active",Qn()||Eo())},200)}function In(e){const t=lt==null?void 0:lt.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function pl(){Vn=!1,yt=!1,Lo(),Yn(),Ao&&(clearInterval(Ao),Ao=null),Nr&&(window.removeEventListener("pointerdown",Nr,{capture:!0}),Nr=null),$&&Yt($),$==null||$.remove(),$=null,Rt=null,cn=null,ln=null,lt=null,Fn=null,Bn=null,Gn=null,Co=null,Po=null,Ro=null}function hl(e,t){return z(this,null,function*(){try{if(e.type==="planning"){const r=yield xm(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Ic(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function fl(e){return e.filter(t=>!t.approved).length}function gl(e){return z(this,null,function*(){const t=dr();if(!e||t.length===0){In(t.length);return}const n=yield Promise.all(t.map(r=>hl(r,e)));In(fl(n))})}let W=null,Ve=null,Bt=null;function Mr(){return W!==null}function Zr(){W&&Yt(W),W==null||W.remove(),W=null,Bt==null||Bt(),Bt=null,Ve==null||Ve.destroy(),Ve=null}function ml(e,t,n,r,o,i,a,d,l,p,h=null){var bn;W&&Zr();const m=!n.backendUrl||!n.token,g=da(h,"tasks:write"),k=da(h,"planning-sessions:write"),v={captureType:!g&&k?"planning":"task",submitting:!1,completedPicks:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:!1};W=document.createElement("div"),W.className="ap-sdk-panel",W.setAttribute("data-ap-sdk","1"),W.setAttribute("role","dialog"),W.setAttribute("aria-modal","true"),W.setAttribute("aria-label","Capture to Agent Platform"),W.innerHTML=`
1642
1681
  <div class="ap-sdk-panel__header">
1643
1682
  <span class="ap-sdk-panel__title">
1644
1683
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1651,7 +1690,7 @@ ${n}${r?`
1651
1690
  </div>
1652
1691
  <div class="ap-sdk-pick-list" data-ap-pick-list style="display:none"></div>
1653
1692
  <div class="ap-sdk-panel__context" data-ap-context>
1654
- ${Na(e)}
1693
+ ${ja(e)}
1655
1694
  </div>
1656
1695
  <div class="ap-sdk-panel__pick-actions" data-ap-pick-actions>
1657
1696
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost ap-sdk-panel__btn--select-parent" data-ap-select-parent type="button">
@@ -1699,41 +1738,41 @@ ${n}${r?`
1699
1738
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
1700
1739
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
1701
1740
  </div>
1702
- `,W.addEventListener("wheel",N=>{N.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",N=>{N.stopPropagation()},{passive:!0});const T=W.querySelector(".ap-sdk-panel__body"),Z=yk(T,n,(mn=r==null?void 0:r.id)!=null?mn:null);document.body.appendChild(W),Ve=Us(),v.currentPickedEl&&Ve.update(v.currentPickedEl),Jt(W),Ys(W,Vs);const Q=W.querySelector("[data-ap-close]"),M=W.querySelector("[data-ap-cancel]"),E=W.querySelector("[data-ap-submit]"),S=W.querySelector("[data-ap-note]"),C=W.querySelector("[data-ap-status]"),q=W.querySelectorAll("[data-ap-type]"),J=W.querySelector("[data-ap-automate-options]"),we=W.querySelector("[data-ap-allow-submit]"),Ee=W.querySelector("[data-ap-pick-list]"),rt=W.querySelector("[data-ap-context]"),ee=W.querySelector("[data-ap-add-another]"),Le=W.querySelector("[data-ap-pick-actions]"),Qe=W.querySelector("[data-ap-select-parent]"),St=W.querySelector("[data-ap-reselect]"),Xt=()=>{v.currentPickedEl&&(Ve==null||Ve.update(v.currentPickedEl))};window.addEventListener("scroll",Xt,{capture:!0,passive:!0}),window.addEventListener("resize",Xt),Ft=()=>{window.removeEventListener("scroll",Xt,!0),window.removeEventListener("resize",Xt)};const ft=N=>{N?(rt.innerHTML=Na(N),S.disabled=!1,S.placeholder="Describe the task or planning session…",setTimeout(()=>S.focus(),50)):(rt.innerHTML=`
1741
+ `,W.addEventListener("wheel",N=>{N.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",N=>{N.stopPropagation()},{passive:!0});const T=W.querySelector(".ap-sdk-panel__body"),Z=Sk(T,n,(bn=r==null?void 0:r.id)!=null?bn:null);document.body.appendChild(W),Ve=qs(),v.currentPickedEl&&Ve.update(v.currentPickedEl),Vt(W),Ks(W,Xs);const Q=W.querySelector("[data-ap-close]"),M=W.querySelector("[data-ap-cancel]"),E=W.querySelector("[data-ap-submit]"),S=W.querySelector("[data-ap-note]"),C=W.querySelector("[data-ap-status]"),q=W.querySelectorAll("[data-ap-type]"),J=W.querySelector("[data-ap-automate-options]"),we=W.querySelector("[data-ap-allow-submit]"),Ee=W.querySelector("[data-ap-pick-list]"),rt=W.querySelector("[data-ap-context]"),ee=W.querySelector("[data-ap-add-another]"),Le=W.querySelector("[data-ap-pick-actions]"),Qe=W.querySelector("[data-ap-select-parent]"),Tt=W.querySelector("[data-ap-reselect]"),Kt=()=>{v.currentPickedEl&&(Ve==null||Ve.update(v.currentPickedEl))};window.addEventListener("scroll",Kt,{capture:!0,passive:!0}),window.addEventListener("resize",Kt),Bt=()=>{window.removeEventListener("scroll",Kt,!0),window.removeEventListener("resize",Kt)};const gt=N=>{N?(rt.innerHTML=ja(N),S.disabled=!1,S.placeholder="Describe the task or planning session…",setTimeout(()=>S.focus(),50)):(rt.innerHTML=`
1703
1742
  <div class="ap-sdk-panel__context-label">Next element</div>
1704
1743
  <div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
1705
- `,S.disabled=!0,S.placeholder="Pick an element to continue…")},Ot=()=>{if(v.completedPicks.length===0){Ee.style.display="none",Ee.innerHTML="";return}Ee.style.display="block",Ee.innerHTML=v.completedPicks.map((N,X)=>{var Se;return`
1744
+ `,S.disabled=!0,S.placeholder="Pick an element to continue…")},Nt=()=>{if(v.completedPicks.length===0){Ee.style.display="none",Ee.innerHTML="";return}Ee.style.display="block",Ee.innerHTML=v.completedPicks.map((N,X)=>{var Se;return`
1706
1745
  <div class="ap-sdk-pick-entry" data-pick-index="${X}">
1707
1746
  <div class="ap-sdk-pick-entry__header">
1708
1747
  <span class="ap-sdk-pick-entry__number">${X+1}</span>
1709
- <span class="ap-sdk-pick-entry__element" title="${st((Se=N.ctx.elementText)!=null?Se:"")}">${st(N.ctx.elementText||"(no text)")}</span>
1748
+ <span class="ap-sdk-pick-entry__element" title="${it((Se=N.ctx.elementText)!=null?Se:"")}">${it(N.ctx.elementText||"(no text)")}</span>
1710
1749
  <button class="ap-sdk-pick-entry__remove" data-ap-remove="${X}" aria-label="Remove pick ${X+1}">×</button>
1711
1750
  </div>
1712
- <div class="ap-sdk-pick-entry__instruction">${st(N.instruction)}</div>
1751
+ <div class="ap-sdk-pick-entry__instruction">${it(N.instruction)}</div>
1713
1752
  </div>
1714
- `}).join(""),Ee.querySelectorAll("[data-ap-remove]").forEach(N=>{N.addEventListener("click",()=>{const X=parseInt(N.dataset.apRemove,10);v.completedPicks.splice(X,1),Ot()})})},Nt=()=>{if(!v.currentPickedEl){Le.style.display="none";return}Le.style.display="",Qe.disabled=!v.currentPickedEl.parentElement||v.awaitingPick,St&&(St.disabled=v.awaitingPick)},Dt=()=>{ee&&(ee.disabled=!S.value.trim()||v.submitting||v.awaitingPick)},Mt=(N,X)=>{v.currentCtx=N,v.currentPickedEl=X,ft(N),Ve==null||Ve.update(X),Nt()};Nt(),Qe.addEventListener("click",()=>{var X;const N=(X=v.currentPickedEl)==null?void 0:X.parentElement;N&&Mt(Wa(N),N)}),St&&l&&St.addEventListener("click",()=>{if(v.awaitingPick)return;const N=v.currentCtx,X=v.currentPickedEl;v.awaitingPick=!0,Nt(),Dt(),ft(null),l((Se,ze)=>{v.awaitingPick=!1,Mt(Se,ze),Dt()},()=>{v.awaitingPick=!1,X&&Mt(N,X),Dt()})});const ce=()=>{Ur(),p==null||p()};Q.addEventListener("click",ce),M.addEventListener("click",ce);const gn=W.querySelector("[data-ap-connect-required]");gn&&a&&gn.addEventListener("click",()=>{ce(),a()}),q.forEach(N=>{N.addEventListener("click",()=>{v.captureType=N.dataset.apType,q.forEach(X=>X.classList.toggle("ap-sdk-active",X===N)),J.style.display=v.captureType==="automate"?"":"none"})}),we.addEventListener("change",()=>{v.allowSubmit=we.checked});const ve=W.querySelector("[data-ap-reconfigure]");a?ve.addEventListener("click",()=>{ce(),a()}):ve.style.display="none",ee&&d&&(S.addEventListener("input",Dt),ee.addEventListener("click",()=>{const N=S.value.trim();!N||v.awaitingPick||(v.completedPicks.push({ctx:v.currentCtx,instruction:N}),Ot(),S.value="",v.awaitingPick=!0,ee.disabled=!0,Nt(),ft(null),d((X,Se)=>{v.awaitingPick=!1,Mt(X,Se),Dt()}))})),E.addEventListener("click",()=>L(null,null,function*(){var bn,Kt;if(v.submitting)return;if(m){mo(C,"error","Connect to Agent Platform first.");return}const N=n.backendUrl,X=n.token,Se=S.value.trim();if(!Se){mo(C,"error","Please enter an instruction.");return}v.submitting=!0,Ss(W,!0),mo(C,null,""),E.textContent="Submitting…";const ze={backendUrl:N,token:X},le=Z.getOptions(),ue=[...v.completedPicks,{ctx:v.currentCtx,instruction:Se}];try{const de={id:r==null?void 0:r.id,key:o};let Ne,Ae,Ie;if(ue.length===1)if(v.captureType==="task")Ne=(yield Rs(ze,{project:de,note:Se,ctx:v.currentCtx,advancedOpts:le})).id,Ae="task",Ie=Se.slice(0,120)||v.currentCtx.pageTitle||"Browser capture";else if(v.captureType==="planning"){let De=gd(Se,D(y({},v.currentCtx),{ancestry:v.currentCtx.outerTree||v.currentCtx.ancestry}));(bn=v.currentCtx.innerTree)!=null&&bn.trim()&&(De+=`
1753
+ `}).join(""),Ee.querySelectorAll("[data-ap-remove]").forEach(N=>{N.addEventListener("click",()=>{const X=parseInt(N.dataset.apRemove,10);v.completedPicks.splice(X,1),Nt()})})},Dt=()=>{if(!v.currentPickedEl){Le.style.display="none";return}Le.style.display="",Qe.disabled=!v.currentPickedEl.parentElement||v.awaitingPick,Tt&&(Tt.disabled=v.awaitingPick)},Mt=()=>{ee&&(ee.disabled=!S.value.trim()||v.submitting||v.awaitingPick)},jt=(N,X)=>{v.currentCtx=N,v.currentPickedEl=X,gt(N),Ve==null||Ve.update(X),Dt()};Dt(),Qe.addEventListener("click",()=>{var X;const N=(X=v.currentPickedEl)==null?void 0:X.parentElement;N&&jt(Ya(N),N)}),Tt&&l&&Tt.addEventListener("click",()=>{if(v.awaitingPick)return;const N=v.currentCtx,X=v.currentPickedEl;v.awaitingPick=!0,Dt(),Mt(),gt(null),l((Se,ze)=>{v.awaitingPick=!1,jt(Se,ze),Mt()},()=>{v.awaitingPick=!1,X&&jt(N,X),Mt()})});const ce=()=>{Zr(),p==null||p()};Q.addEventListener("click",ce),M.addEventListener("click",ce);const mn=W.querySelector("[data-ap-connect-required]");mn&&a&&mn.addEventListener("click",()=>{ce(),a()}),q.forEach(N=>{N.addEventListener("click",()=>{v.captureType=N.dataset.apType,q.forEach(X=>X.classList.toggle("ap-sdk-active",X===N)),J.style.display=v.captureType==="automate"?"":"none"})}),we.addEventListener("change",()=>{v.allowSubmit=we.checked});const ve=W.querySelector("[data-ap-reconfigure]");a?ve.addEventListener("click",()=>{ce(),a()}):ve.style.display="none",ee&&d&&(S.addEventListener("input",Mt),ee.addEventListener("click",()=>{const N=S.value.trim();!N||v.awaitingPick||(v.completedPicks.push({ctx:v.currentCtx,instruction:N}),Nt(),S.value="",v.awaitingPick=!0,ee.disabled=!0,Dt(),gt(null),d((X,Se)=>{v.awaitingPick=!1,jt(X,Se),Mt()}))})),E.addEventListener("click",()=>z(null,null,function*(){var kn,Qt;if(v.submitting)return;if(m){bo(C,"error","Connect to Agent Platform first.");return}const N=n.backendUrl,X=n.token,Se=S.value.trim();if(!Se){bo(C,"error","Please enter an instruction.");return}v.submitting=!0,Es(W,!0),bo(C,null,""),E.textContent="Submitting…";const ze={backendUrl:N,token:X},le=Z.getOptions(),ue=[...v.completedPicks,{ctx:v.currentCtx,instruction:Se}];try{const de={id:r==null?void 0:r.id,key:o};let Ne,Ae,Ie;if(ue.length===1)if(v.captureType==="task")Ne=(yield zs(ze,{project:de,note:Se,ctx:v.currentCtx,advancedOpts:le})).id,Ae="task",Ie=Se.slice(0,120)||v.currentCtx.pageTitle||"Browser capture";else if(v.captureType==="planning"){let De=bd(Se,D(y({},v.currentCtx),{ancestry:v.currentCtx.outerTree||v.currentCtx.ancestry}));(kn=v.currentCtx.innerTree)!=null&&kn.trim()&&(De+=`
1715
1754
 
1716
1755
  Element tree:
1717
- ${v.currentCtx.innerTree}`),(Kt=v.currentCtx.interactionSteps)!=null&&Kt.length&&(De+=`
1756
+ ${v.currentCtx.innerTree}`),(Qt=v.currentCtx.interactionSteps)!=null&&Qt.length&&(De+=`
1718
1757
 
1719
1758
  Recorded steps:
1720
- ${nl(v.currentCtx.interactionSteps)}`),Ne=(yield aa(ze,de,De,le)).id,Ae="planning",Ie=Se.slice(0,120)||v.currentCtx.pageTitle||"Planning session"}else Ne=(yield ia(ze,{project:de,note:Se,ctx:v.currentCtx,advancedOpts:le,allowSubmit:v.allowSubmit})).id,Ae="automate",Ie=Se.slice(0,120)||v.currentCtx.pageTitle||"Browser automation";else{const De=Vk(ue),et=ue[0].instruction.slice(0,120)||ue[0].ctx.pageTitle||"Multi-element capture",Tt=ue.map(jt=>jt.instruction).filter(Boolean).join(`
1759
+ ${ol(v.currentCtx.interactionSteps)}`),Ne=(yield la(ze,de,De,le)).id,Ae="planning",Ie=Se.slice(0,120)||v.currentCtx.pageTitle||"Planning session"}else Ne=(yield ca(ze,{project:de,note:Se,ctx:v.currentCtx,advancedOpts:le,allowSubmit:v.allowSubmit})).id,Ae="automate",Ie=Se.slice(0,120)||v.currentCtx.pageTitle||"Browser automation";else{const De=Kk(ue),et=ue[0].instruction.slice(0,120)||ue[0].ctx.pageTitle||"Multi-element capture",Et=ue.map(Ut=>Ut.instruction).filter(Boolean).join(`
1721
1760
 
1722
- `);v.captureType==="task"?(Ne=(yield Rs(ze,{project:de,note:De,ctx:ue[0].ctx,advancedOpts:le,titleOverride:et,type:Cc,titleInstruction:Tt})).id,Ae="task",Ie=et):v.captureType==="planning"?(Ne=(yield aa(ze,de,De,le)).id,Ae="planning",Ie=et):(Ne=(yield ia(ze,{project:de,note:De,ctx:ue[0].ctx,advancedOpts:le,titleOverride:et,titleInstruction:Tt,allowSubmit:v.allowSubmit})).id,Ae="automate",Ie=et)}if(Tk({id:Ne,type:Ae,title:Ie,backendUrl:N,createdAt:new Date().toISOString()}),hl(ze).catch(()=>{}),Ae==="automate"){ce(),ii(Ne,ze,N,Ie,p);return}const Qt=Ae==="task"?`${N.replace(/\/+$/,"")}/tasks/${Ne}`:`${N.replace(/\/+$/,"")}/planning/${Ne}`;Yk(C,Ae,Ie,Qt,ce),W.classList.add("ap-sdk-panel--success"),Ft==null||Ft(),Ft=null,Ve==null||Ve.hide(),v.submitting=!1,Ss(W,!1)}catch(de){mo(C,"error",de instanceof Error?de.message:"An unexpected error occurred."),v.submitting=!1,Ss(W,!1),E.textContent="Submit"}})),setTimeout(()=>S.focus(),50)}const Jk={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Na(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1761
+ `);v.captureType==="task"?(Ne=(yield zs(ze,{project:de,note:De,ctx:ue[0].ctx,advancedOpts:le,titleOverride:et,type:Lc,titleInstruction:Et})).id,Ae="task",Ie=et):v.captureType==="planning"?(Ne=(yield la(ze,de,De,le)).id,Ae="planning",Ie=et):(Ne=(yield ca(ze,{project:de,note:De,ctx:ue[0].ctx,advancedOpts:le,titleOverride:et,titleInstruction:Et,allowSubmit:v.allowSubmit})).id,Ae="automate",Ie=et)}if(Ck({id:Ne,type:Ae,title:Ie,backendUrl:N,createdAt:new Date().toISOString()}),gl(ze).catch(()=>{}),Ae==="automate"){ce(),ci(Ne,ze,N,Ie,p);return}const en=Ae==="task"?`${N.replace(/\/+$/,"")}/tasks/${Ne}`:`${N.replace(/\/+$/,"")}/planning/${Ne}`;Qk(C,Ae,Ie,en,ce),W.classList.add("ap-sdk-panel--success"),Bt==null||Bt(),Bt=null,Ve==null||Ve.hide(),v.submitting=!1,Es(W,!1)}catch(de){bo(C,"error",de instanceof Error?de.message:"An unexpected error occurred."),v.submitting=!1,Es(W,!1),E.textContent="Submit"}})),setTimeout(()=>S.focus(),50)}const Xk={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function ja(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1723
1762
  <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
1724
1763
  <div class="ap-sdk-panel__context-steps">
1725
1764
  ${e.interactionSteps.map(r=>`
1726
1765
  <div class="ap-sdk-panel__context-step">
1727
- <span class="ap-sdk-panel__context-step-icon">${Jk[r.action]}</span>
1728
- <span class="ap-sdk-panel__context-step-text">${st(r.description)}</span>
1766
+ <span class="ap-sdk-panel__context-step-icon">${Xk[r.action]}</span>
1767
+ <span class="ap-sdk-panel__context-step-text">${it(r.description)}</span>
1729
1768
  </div>
1730
1769
  `).join("")}
1731
1770
  </div>
1732
1771
  `:`
1733
1772
  <div class="ap-sdk-panel__context-label">Captured element</div>
1734
- <div class="ap-sdk-panel__context-text" title="${st((n=e.elementText)!=null?n:"")}">${st(e.elementText||"(no text)")}</div>
1735
- ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${st(e.cssSelector)}">${st(e.cssSelector)}</div>`:""}
1736
- `}function Vk(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:",nl(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(`
1773
+ <div class="ap-sdk-panel__context-text" title="${it((n=e.elementText)!=null?n:"")}">${it(e.elementText||"(no text)")}</div>
1774
+ ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${it(e.cssSelector)}">${it(e.cssSelector)}</div>`:""}
1775
+ `}function Kk(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:",ol(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(`
1737
1776
  Element tree:
1738
1777
  ${t.ctx.innerTree}`),r.push("",`Instruction:
1739
1778
  ${t.instruction}`),r.join(`
@@ -1741,23 +1780,23 @@ ${t.instruction}`),r.join(`
1741
1780
 
1742
1781
  ---
1743
1782
 
1744
- `)}function mo(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 Yk(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 →",l=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1783
+ `)}function bo(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 Qk(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 →",l=n.length>55?`${n.slice(0,52)}…`:n;e.style.display="block",e.className="ap-sdk-panel__status",e.innerHTML=`
1745
1784
  <div class="ap-sdk-success-card">
1746
1785
  <svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
1747
1786
  <circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
1748
1787
  <path class="ap-sdk-success-check__tick" d="M14 24l7 7 13-14"/>
1749
1788
  </svg>
1750
- <p class="ap-sdk-success-headline">${st(a)}</p>
1789
+ <p class="ap-sdk-success-headline">${it(a)}</p>
1751
1790
  <div class="ap-sdk-success-meta">
1752
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${st(i)}</span>
1753
- <span class="ap-sdk-success-title" title="${st(n)}">${st(l)}</span>
1791
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${t}">${it(i)}</span>
1792
+ <span class="ap-sdk-success-title" title="${it(n)}">${it(l)}</span>
1754
1793
  </div>
1755
1794
  <div class="ap-sdk-success-actions">
1756
- <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${st(d)}</button>
1795
+ <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-success-view>${it(d)}</button>
1757
1796
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1758
1797
  </div>
1759
1798
  </div>
1760
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Ss(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 ie=null;function gl(){return ie!==null}function Pn(){ie&&Vt(ie),ie==null||ie.remove(),ie=null}function Xk(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function Kk(e){if(ie){Pn();return}ie=document.createElement("div"),ie.className="ap-sdk-panel",ie.setAttribute("data-ap-sdk","1"),ie.setAttribute("role","dialog"),ie.setAttribute("aria-modal","true"),ie.setAttribute("aria-label","My captures"),ie.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ie.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ie.innerHTML=`
1799
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Es(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function it(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ie=null;function bl(){return ie!==null}function Rn(){ie&&Yt(ie),ie==null||ie.remove(),ie=null}function e_(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function t_(e){if(ie){Rn();return}ie=document.createElement("div"),ie.className="ap-sdk-panel",ie.setAttribute("data-ap-sdk","1"),ie.setAttribute("role","dialog"),ie.setAttribute("aria-modal","true"),ie.setAttribute("aria-label","My captures"),ie.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ie.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ie.innerHTML=`
1761
1800
  <div class="ap-sdk-panel__header">
1762
1801
  <span class="ap-sdk-panel__title">
1763
1802
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1770,18 +1809,18 @@ ${t.instruction}`),r.join(`
1770
1809
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
1771
1810
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
1772
1811
  </div>
1773
- `,document.body.appendChild(ie),Jt(ie),Ys(ie,Vs),ie.querySelector("[data-ap-close]").addEventListener("click",()=>{Pn()}),ie.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Pn()}),ie.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Ek(),zn(0),Da(e)}),Da(e)}function Da(e){if(!ie)return;const t=ie.querySelector("[data-ap-list-body]"),n=ur();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=>`
1812
+ `,document.body.appendChild(ie),Vt(ie),Ks(ie,Xs),ie.querySelector("[data-ap-close]").addEventListener("click",()=>{Rn()}),ie.querySelector("[data-ap-close-list]").addEventListener("click",()=>{Rn()}),ie.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{Pk(),In(0),Ua(e)}),Ua(e)}function Ua(e){if(!ie)return;const t=ie.querySelector("[data-ap-list-body]"),n=dr();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=>`
1774
1813
  <div class="ap-sdk-list-item">
1775
1814
  <div class="ap-sdk-list-item__row">
1776
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${Xk(r.type)}</span>
1777
- <span class="ap-sdk-list-item__title" title="${bo(r.title)}">${t_(r.title)}</span>
1815
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${e_(r.type)}</span>
1816
+ <span class="ap-sdk-list-item__title" title="${ko(r.title)}">${o_(r.title)}</span>
1778
1817
  </div>
1779
1818
  <div class="ap-sdk-list-item__row">
1780
- <span class="ap-sdk-status-badge" data-ap-status="${bo(r.id)}">${e?"…":"—"}</span>
1781
- ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${bo(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${bo(e_(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1819
+ <span class="ap-sdk-status-badge" data-ap-status="${ko(r.id)}">${e?"…":"—"}</span>
1820
+ ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${ko(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${ko(r_(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1782
1821
  </div>
1783
1822
  </div>
1784
- `).join(""),e){const r=e;Promise.all(n.map(o=>Qk(o,r))).then(o=>{zn(pl(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(Pn(),ii(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function Qk(e,t){return L(this,null,function*(){const n=yield dl(e,t),r=ie==null?void 0:ie.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 e_(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function bo(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t_(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let on=null;function n_(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Ma(e){if(on){const d=on;d.cleanup(),d.popup.closed||d.popup.close(),on=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=n_(),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,l)=>{let p=!1;function h(){window.removeEventListener("message",m),clearInterval(g),(on==null?void 0:on.popup)===a&&(on=null)}function m(k){if(k.origin!==n)return;const v=k.data;!v||v.type!=="ap-sdk-oauth"||v.state!==r||!v.code||(p=!0,h(),d({code:v.code}))}window.addEventListener("message",m);const g=window.setInterval(()=>{a.closed&&(h(),p||l(new Error("Connection cancelled.")))},500);on={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const r_="https://agent-platform.tung.engineering",di="ap-sdk-config";function o_(){try{const e=sessionStorage.getItem(di);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()?(ml(),null):t}catch(e){return null}}function s_(e){sessionStorage.setItem(di,JSON.stringify(e)),a_({backendUrl:e.backendUrl,projectCode:e.projectCode})}function ml(){sessionStorage.removeItem(di)}const bl="ap-sdk-last-connection";function i_(){try{const e=localStorage.getItem(bl);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 a_(e){try{localStorage.setItem(bl,JSON.stringify(e))}catch(t){}}let K=null;function Ht(){K&&Vt(K),K==null||K.remove(),K=null}function c_(e){K&&Ht(),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=i_();t?n(t):r(r_),document.body.appendChild(K),Jt(K);function n(i){if(!K)return;K.innerHTML=`
1823
+ `).join(""),e){const r=e;Promise.all(n.map(o=>n_(o,r))).then(o=>{In(fl(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(Rn(),ci(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function n_(e,t){return z(this,null,function*(){const n=yield hl(e,t),r=ie==null?void 0:ie.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 r_(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function ko(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o_(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let sn=null;function s_(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Za(e){if(sn){const d=sn;d.cleanup(),d.popup.closed||d.popup.close(),sn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=s_(),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,l)=>{let p=!1;function h(){window.removeEventListener("message",m),clearInterval(g),(sn==null?void 0:sn.popup)===a&&(sn=null)}function m(k){if(k.origin!==n)return;const v=k.data;!v||v.type!=="ap-sdk-oauth"||v.state!==r||!v.code||(p=!0,h(),d({code:v.code}))}window.addEventListener("message",m);const g=window.setInterval(()=>{a.closed&&(h(),p||l(new Error("Connection cancelled.")))},500);sn={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const i_="https://agent-platform.tung.engineering",hi="ap-sdk-config";function a_(){try{const e=sessionStorage.getItem(hi);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()?(kl(),null):t}catch(e){return null}}function c_(e){sessionStorage.setItem(hi,JSON.stringify(e)),u_({backendUrl:e.backendUrl,projectCode:e.projectCode})}function kl(){sessionStorage.removeItem(hi)}const _l="ap-sdk-last-connection";function l_(){try{const e=localStorage.getItem(_l);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 u_(e){try{localStorage.setItem(_l,JSON.stringify(e))}catch(t){}}let K=null;function Ft(){K&&Yt(K),K==null||K.remove(),K=null}function d_(e){K&&Ft(),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=l_();t?n(t):r(i_),document.body.appendChild(K),Vt(K);function n(i){if(!K)return;K.innerHTML=`
1785
1824
  <div class="ap-sdk-panel__header">
1786
1825
  <span class="ap-sdk-panel__title">
1787
1826
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1791,7 +1830,7 @@ ${t.instruction}`),r.join(`
1791
1830
  </div>
1792
1831
  <div class="ap-sdk-panel__body">
1793
1832
  <p class="ap-sdk-config-hint">
1794
- Reconnect to <strong>${Ts(i.backendUrl)}</strong>. You'll be asked to
1833
+ Reconnect to <strong>${As(i.backendUrl)}</strong>. You'll be asked to
1795
1834
  approve this connection on Agent Platform's own sign-in page.
1796
1835
  </p>
1797
1836
  </div>
@@ -1800,7 +1839,7 @@ ${t.instruction}`),r.join(`
1800
1839
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect>Reconnect</button>
1801
1840
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-use-different>Use a different connection</button>
1802
1841
  </div>
1803
- `;const a=K.querySelector("[data-ap-cfg-status]"),d=K.querySelector("[data-ap-reconnect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ht()}),K.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>L(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",sn(a,null,"");try{const{code:l}=yield Ma(i.backendUrl),{token:p,expiresAt:h}=yield ua({backendUrl:i.backendUrl},l,window.location.origin),m={backendUrl:i.backendUrl,token:p},g=yield ca(m);if(g.length===0){sn(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=g.find(Z=>Z.key===i.projectCode);if(k){Ht(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const v=sa(window.location.href,g),T=v?g.find(Z=>Z.id===v):void 0;T?(Ht(),e({backendUrl:i.backendUrl,token:p,projectCode:T.key,expiresAt:h})):o(i.backendUrl,p,h,g)}catch(l){sn(a,"error",`Could not connect — ${l instanceof Error?l.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!K)return;K.innerHTML=`
1842
+ `;const a=K.querySelector("[data-ap-cfg-status]"),d=K.querySelector("[data-ap-reconnect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ft()}),K.querySelector("[data-ap-use-different]").addEventListener("click",()=>r(i.backendUrl)),d.addEventListener("click",()=>z(null,null,function*(){d.disabled=!0,d.textContent="Connecting…",an(a,null,"");try{const{code:l}=yield Za(i.backendUrl),{token:p,expiresAt:h}=yield pa({backendUrl:i.backendUrl},l,window.location.origin),m={backendUrl:i.backendUrl,token:p},g=yield ua(m);if(g.length===0){an(a,"error","No projects found — check your account permissions."),d.disabled=!1,d.textContent="Reconnect";return}const k=g.find(Z=>Z.key===i.projectCode);if(k){Ft(),e({backendUrl:i.backendUrl,token:p,projectCode:k.key,expiresAt:h});return}const v=aa(window.location.href,g),T=v?g.find(Z=>Z.id===v):void 0;T?(Ft(),e({backendUrl:i.backendUrl,token:p,projectCode:T.key,expiresAt:h})):o(i.backendUrl,p,h,g)}catch(l){an(a,"error",`Could not connect — ${l instanceof Error?l.message:"please try again"}`),d.disabled=!1,d.textContent="Reconnect"}}))}function r(i){if(!K)return;K.innerHTML=`
1804
1843
  <div class="ap-sdk-panel__header">
1805
1844
  <span class="ap-sdk-panel__title">
1806
1845
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1813,7 +1852,7 @@ ${t.instruction}`),r.join(`
1813
1852
  <label class="ap-sdk-panel__label" for="ap-sdk-cfg-url">Backend URL</label>
1814
1853
  <input id="ap-sdk-cfg-url" class="ap-sdk-panel__input" type="url"
1815
1854
  placeholder="https://your-platform.example.com"
1816
- value="${ja(i)}" autocomplete="off" data-ap-cfg-url />
1855
+ value="${qa(i)}" autocomplete="off" data-ap-cfg-url />
1817
1856
  </div>
1818
1857
  <p class="ap-sdk-config-hint">
1819
1858
  You'll be asked to approve this connection on Agent Platform's own sign-in page.
@@ -1824,7 +1863,7 @@ ${t.instruction}`),r.join(`
1824
1863
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-connect>Connect via Agent Platform</button>
1825
1864
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-cancel>Cancel</button>
1826
1865
  </div>
1827
- `;const a=K.querySelector("[data-ap-cfg-url]"),d=K.querySelector("[data-ap-cfg-status]"),l=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ht()}),K.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Ht()}),l.addEventListener("click",()=>L(null,null,function*(){const p=a.value.trim();if(!p){sn(d,"error","Backend URL is required.");return}l.disabled=!0,l.textContent="Connecting…",sn(d,null,"");try{const{code:h}=yield Ma(p),{token:m,expiresAt:g}=yield ua({backendUrl:p},h,window.location.origin),v=yield ca({backendUrl:p,token:m});if(v.length===0){sn(d,"error","No projects found — check your account permissions."),l.disabled=!1,l.textContent="Connect via Agent Platform";return}const T=sa(window.location.href,v),Z=T?v.find(Q=>Q.id===T):void 0;if(Z){Ht(),e({backendUrl:p,token:m,projectCode:Z.key,expiresAt:g});return}o(p,m,g,v)}catch(h){sn(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),l.disabled=!1,l.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,l){if(!K)return;const p=l.map(g=>`<option value="${ja(g.key)}"${g.key===(t==null?void 0:t.projectCode)?" selected":""}>${Ts(g.name)} (${Ts(g.key)})</option>`).join("");K.innerHTML=`
1866
+ `;const a=K.querySelector("[data-ap-cfg-url]"),d=K.querySelector("[data-ap-cfg-status]"),l=K.querySelector("[data-ap-connect]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ft()}),K.querySelector("[data-ap-cancel]").addEventListener("click",()=>{Ft()}),l.addEventListener("click",()=>z(null,null,function*(){const p=a.value.trim();if(!p){an(d,"error","Backend URL is required.");return}l.disabled=!0,l.textContent="Connecting…",an(d,null,"");try{const{code:h}=yield Za(p),{token:m,expiresAt:g}=yield pa({backendUrl:p},h,window.location.origin),v=yield ua({backendUrl:p,token:m});if(v.length===0){an(d,"error","No projects found — check your account permissions."),l.disabled=!1,l.textContent="Connect via Agent Platform";return}const T=aa(window.location.href,v),Z=T?v.find(Q=>Q.id===T):void 0;if(Z){Ft(),e({backendUrl:p,token:m,projectCode:Z.key,expiresAt:g});return}o(p,m,g,v)}catch(h){an(d,"error",`Could not connect — ${h instanceof Error?h.message:"please try again"}`),l.disabled=!1,l.textContent="Connect via Agent Platform"}})),setTimeout(()=>a.focus(),50)}function o(i,a,d,l){if(!K)return;const p=l.map(g=>`<option value="${qa(g.key)}"${g.key===(t==null?void 0:t.projectCode)?" selected":""}>${As(g.name)} (${As(g.key)})</option>`).join("");K.innerHTML=`
1828
1867
  <div class="ap-sdk-panel__header">
1829
1868
  <span class="ap-sdk-panel__title">
1830
1869
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1846,7 +1885,7 @@ ${t.instruction}`),r.join(`
1846
1885
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1847
1886
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1848
1887
  </div>
1849
- `;const h=K.querySelector("[data-ap-cfg-project]"),m=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ht()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const g=h.value;if(!g){sn(m,"error","Please select a project.");return}Ht(),e({backendUrl:i,token:a,projectCode:g,expiresAt:d})})}}function sn(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 ja(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ts(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let dt=null,Bo=!1;function l_(){dt==null||dt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),dt&&dt.observe(document.body,{childList:!0}),Bo=!1}function kl(){dt||(dt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Bo||(Bo=!0,queueMicrotask(l_))}),dt.observe(document.body,{childList:!0}))}function u_(){dt==null||dt.disconnect(),dt=null,Bo=!1}const d_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Pe=null,ln=[];function Ro(){Pe&&Vt(Pe),Pe==null||Pe.remove(),Pe=null,ln=[]}function p_(e,t,n){Pe&&Ro(),ln=[...e],Pe=document.createElement("div"),Pe.className="ap-sdk-panel ap-sdk-record-review",Pe.setAttribute("data-ap-sdk","1"),Pe.setAttribute("role","dialog"),Pe.setAttribute("aria-modal","true"),Pe.setAttribute("aria-label","Review recorded steps"),Pe.innerHTML=`
1888
+ `;const h=K.querySelector("[data-ap-cfg-project]"),m=K.querySelector("[data-ap-cfg-status]");K.querySelector("[data-ap-close]").addEventListener("click",()=>{Ft()}),K.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),K.querySelector("[data-ap-save]").addEventListener("click",()=>{const g=h.value;if(!g){an(m,"error","Please select a project.");return}Ft(),e({backendUrl:i,token:a,projectCode:g,expiresAt:d})})}}function an(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 qa(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function As(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let pt=null,Wo=!1;function p_(){pt==null||pt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),pt&&pt.observe(document.body,{childList:!0}),Wo=!1}function vl(){pt||(pt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Wo||(Wo=!0,queueMicrotask(p_))}),pt.observe(document.body,{childList:!0}))}function h_(){pt==null||pt.disconnect(),pt=null,Wo=!1}const f_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Pe=null,un=[];function zo(){Pe&&Yt(Pe),Pe==null||Pe.remove(),Pe=null,un=[]}function g_(e,t,n){Pe&&zo(),un=[...e],Pe=document.createElement("div"),Pe.className="ap-sdk-panel ap-sdk-record-review",Pe.setAttribute("data-ap-sdk","1"),Pe.setAttribute("role","dialog"),Pe.setAttribute("aria-modal","true"),Pe.setAttribute("aria-label","Review recorded steps"),Pe.innerHTML=`
1850
1889
  <div class="ap-sdk-panel__header">
1851
1890
  <span class="ap-sdk-panel__title">
1852
1891
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1861,11 +1900,11 @@ ${t.instruction}`),r.join(`
1861
1900
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-review-continue>Continue</button>
1862
1901
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-review-cancel>Cancel</button>
1863
1902
  </div>
1864
- `,document.body.appendChild(Pe),Jt(Pe);const r=Pe.querySelector("[data-ap-review-list]"),o=Pe.querySelector("[data-ap-review-continue]"),i=()=>{if(ln.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=ln.map((d,l)=>{var p;return`
1903
+ `,document.body.appendChild(Pe),Vt(Pe);const r=Pe.querySelector("[data-ap-review-list]"),o=Pe.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,l)=>{var p;return`
1865
1904
  <div class="ap-sdk-record-step" data-step-index="${l}">
1866
- <span class="ap-sdk-record-step__icon">${d_[d.action]}</span>
1867
- ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${h_((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${_l(d.description)}</span>`}
1905
+ <span class="ap-sdk-record-step__icon">${f_[d.action]}</span>
1906
+ ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${m_((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${yl(d.description)}</span>`}
1868
1907
  <button class="ap-sdk-record-step__remove" data-ap-step-remove="${l}" aria-label="Remove step ${l+1}">✕</button>
1869
1908
  </div>
1870
- `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const l=parseInt(d.dataset.apStepRemove,10);ln.splice(l,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const l=d.closest("[data-step-index]"),p=parseInt(l.dataset.stepIndex,10);d.addEventListener("input",()=>{var m;const h=ln[p];h.value=d.value,h.description=tl((m=h.elementText)!=null?m:"",d.value,!1)})})};i();const a=()=>{Ro()};Pe.querySelector("[data-ap-review-close]").addEventListener("click",a),Pe.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(ln.length===0)return;const d=ln,l=D(y({},Ha()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Ro(),t(l)})}function _l(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function h_(e){return _l(e)}let H=null,Go=null,Wo=null,Jo=null;function pi(e,t,n){Go=e,Wo=t,Jo=n,ll(e,t,n)}const vl="#agent-platform-web-sdk",yl="ap-sdk-fab-unlocked";let Cn=null;function wl(){try{if(localStorage.getItem(yl)==="1")return!0}catch(e){}return window.location.hash===vl}function Ua(){try{localStorage.setItem(yl,"1")}catch(e){}}function xl(e){return L(this,null,function*(){var t,n,r,o;if(Zr(),!(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,permissions:null},pi(()=>Sl(),()=>g_(),()=>fi()),zn(ur().length),H.backendUrl&&H.token){const i=H.backendUrl,a=H.token;yield Rl(),hl({backendUrl:i,token:a}).catch(()=>{}),Pl({backendUrl:i,token:a}).catch(()=>{});const d=Dm();d&&ii(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}kl()}})}function hi(e,t){return L(this,null,function*(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");H.backendUrl=e,H.token=t,H.project=null,H.permissions=null,yield Rl(),Pl({backendUrl:e,token:t}).catch(()=>{})})}function Sl(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");Kn()||(Zr(),hs((e,t)=>L(null,null,function*(){gl()&&Pn(),fl(e,t,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>L(null,null,function*(){yield hi(n.backendUrl,n.token)}),In,n=>{hs((r,o)=>{Dr()&&n(r,o)},()=>{Tl()})},(n,r)=>{hs((o,i)=>{Dr()&&n(o,i)},()=>{Dr()&&r()})},()=>{Kn()&&Zs()},H.permissions)}),()=>{}))}function f_(){Zs()}function g_(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");So()||(Zr(),Ok(e=>{p_(e,t=>{fl(t,null,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>L(null,null,function*(){yield hi(n.backendUrl,n.token)}),In,void 0,void 0,()=>{},H.permissions)})}))}function Tl(){Dr()&&Ur()}function m_(){return Kn()}function El(){u_(),Cn&&(window.removeEventListener("hashchange",Cn),Cn=null),Zs(),Nk(),Ro(),Ur(),Pn(),ul(),Go=null,Wo=null,Jo=null,H=null}function Al(){if(typeof window=="undefined"||typeof document=="undefined")return;Zr();const e=o_(),t=()=>{e?Cl(e).catch(console.error):(pi(()=>In(),()=>In(),()=>fi()),zn(ur().length),kl())};if(wl()){Ua(),t();return}Cn=()=>{window.location.hash===vl&&(Ua(),window.removeEventListener("hashchange",Cn),Cn=null,t())},window.addEventListener("hashchange",Cn)}function b_(){Go&&Wo&&Jo&&ll(Go,Wo,Jo)}function k_(){ul()}function In(){c_(e=>{s_(e),Cl(e).catch(console.error)})}function __(){ml(),El(),Zr(),wl()&&(pi(()=>In(),()=>In(),()=>fi()),zn(ur().length))}function Cl(e){return L(this,null,function*(){yield xl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function fi(){if(gl()){Pn();return}Dr()&&Ur();const e=H!=null&&H.backendUrl&&(H!=null&&H.token)?{backendUrl:H.backendUrl,token:H.token}:null;Kk(e)}function Pl(e){return L(this,null,function*(){const t=yield wm(e);H&&(H.permissions=t.permissions)})}function Rl(){return L(this,null,function*(){if(!(!H||!H.backendUrl||!H.token||H.project||H.resolvingProject)){H.resolvingProject=!0;try{H.project=yield bm({backendUrl:H.backendUrl,token:H.token},H.projectCode)}catch(e){}finally{H&&(H.resolvingProject=!1)}}})}Al();exports.activateElementPicker=Sl;exports.autoInit=Al;exports.clearConfig=__;exports.closePanelIfOpen=Tl;exports.configure=In;exports.deactivateElementPicker=f_;exports.destroy=El;exports.hideFab=k_;exports.init=xl;exports.isPickerRunning=m_;exports.showFab=b_;exports.updateCredentials=hi;
1909
+ `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const l=parseInt(d.dataset.apStepRemove,10);un.splice(l,1),i()})}),r.querySelectorAll("[data-ap-step-value]").forEach(d=>{const l=d.closest("[data-step-index]"),p=parseInt(l.dataset.stepIndex,10);d.addEventListener("input",()=>{var m;const h=un[p];h.value=d.value,h.description=rl((m=h.elementText)!=null?m:"",d.value,!1)})})};i();const a=()=>{zo()};Pe.querySelector("[data-ap-review-close]").addEventListener("click",a),Pe.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(un.length===0)return;const d=un,l=D(y({},Ga()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});zo(),t(l)})}function yl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function m_(e){return yl(e)}let H=null,Jo=null,Vo=null,Yo=null;function fi(e,t,n){Jo=e,Vo=t,Yo=n,dl(e,t,n)}const wl="#agent-platform-web-sdk",xl="ap-sdk-fab-unlocked";let Pn=null;function Sl(){try{if(localStorage.getItem(xl)==="1")return!0}catch(e){}return window.location.hash===wl}function Ha(){try{localStorage.setItem(xl,"1")}catch(e){}}function Tl(e){return z(this,null,function*(){var t,n,r,o;if(qr(),!(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,permissions:null},fi(()=>El(),()=>k_(),()=>mi()),In(dr().length),H.backendUrl&&H.token){const i=H.backendUrl,a=H.token;yield zl(),gl({backendUrl:i,token:a}).catch(()=>{}),Ll({backendUrl:i,token:a}).catch(()=>{});const d=jm();d&&ci(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}vl()}})}function gi(e,t){return z(this,null,function*(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");H.backendUrl=e,H.token=t,H.project=null,H.permissions=null,yield zl(),Ll({backendUrl:e,token:t}).catch(()=>{})})}function El(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");Qn()||(qr(),gs((e,t)=>z(null,null,function*(){bl()&&Rn(),ml(e,t,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>z(null,null,function*(){yield gi(n.backendUrl,n.token)}),$n,n=>{gs((r,o)=>{Mr()&&n(r,o)},()=>{Al()})},(n,r)=>{gs((o,i)=>{Mr()&&n(o,i)},()=>{Mr()&&r()})},()=>{Qn()&&Hs()},H.permissions)}),()=>{}))}function b_(){Hs()}function k_(){if(!H)throw new Error("AgentPlatformSDK: call init() first.");Eo()||(qr(),Mk(e=>{g_(e,t=>{ml(t,null,{backendUrl:H.backendUrl,token:H.token},H.project,H.projectCode,n=>z(null,null,function*(){yield gi(n.backendUrl,n.token)}),$n,void 0,void 0,()=>{},H.permissions)})}))}function Al(){Mr()&&Zr()}function __(){return Qn()}function Cl(){h_(),Pn&&(window.removeEventListener("hashchange",Pn),Pn=null),Hs(),jk(),zo(),Zr(),Rn(),pl(),Jo=null,Vo=null,Yo=null,H=null}function Pl(){if(typeof window=="undefined"||typeof document=="undefined")return;qr();const e=a_(),t=()=>{e?Rl(e).catch(console.error):(fi(()=>$n(),()=>$n(),()=>mi()),In(dr().length),vl())};if(Sl()){Ha(),t();return}Pn=()=>{window.location.hash===wl&&(Ha(),window.removeEventListener("hashchange",Pn),Pn=null,t())},window.addEventListener("hashchange",Pn)}function v_(){Jo&&Vo&&Yo&&dl(Jo,Vo,Yo)}function y_(){pl()}function $n(){d_(e=>{c_(e),Rl(e).catch(console.error)})}function w_(){kl(),Cl(),qr(),Sl()&&(fi(()=>$n(),()=>$n(),()=>mi()),In(dr().length))}function Rl(e){return z(this,null,function*(){yield Tl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function mi(){if(bl()){Rn();return}Mr()&&Zr();const e=H!=null&&H.backendUrl&&(H!=null&&H.token)?{backendUrl:H.backendUrl,token:H.token}:null;t_(e)}function Ll(e){return z(this,null,function*(){const t=yield Sm(e);H&&(H.permissions=t.permissions)})}function zl(){return z(this,null,function*(){if(!(!H||!H.backendUrl||!H.token||H.project||H.resolvingProject)){H.resolvingProject=!0;try{H.project=yield _m({backendUrl:H.backendUrl,token:H.token},H.projectCode)}catch(e){}finally{H&&(H.resolvingProject=!1)}}})}Pl();exports.activateElementPicker=El;exports.autoInit=Pl;exports.clearConfig=w_;exports.closePanelIfOpen=Al;exports.configure=$n;exports.deactivateElementPicker=b_;exports.destroy=Cl;exports.hideFab=y_;exports.init=Tl;exports.isPickerRunning=__;exports.showFab=v_;exports.updateCredentials=gi;
1871
1910
  //# sourceMappingURL=web-sdk.cjs.map