@tung-engineering/agent-platform-web-sdk 0.0.86 → 0.0.88

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 Bu=Object.defineProperty,Gu=Object.defineProperties;var Wu=Object.getOwnPropertyDescriptors;var Mi=Object.getOwnPropertySymbols;var Ju=Object.prototype.hasOwnProperty,Vu=Object.prototype.propertyIsEnumerable;var ji=Math.pow,gs=(e,t,n)=>t in e?Bu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))Ju.call(t,n)&&gs(e,n,t[n]);if(Mi)for(var n of Mi(t))Vu.call(t,n)&&gs(e,n,t[n]);return e},D=(e,t)=>Gu(e,Wu(t));var ie=(e,t,n)=>gs(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 Yu=`
1
+ "use strict";var Gu=Object.defineProperty,Wu=Object.defineProperties;var Ju=Object.getOwnPropertyDescriptors;var Mi=Object.getOwnPropertySymbols;var Vu=Object.prototype.hasOwnProperty,Yu=Object.prototype.propertyIsEnumerable;var ji=Math.pow,gs=(e,t,n)=>t in e?Gu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))Vu.call(t,n)&&gs(e,n,t[n]);if(Mi)for(var n of Mi(t))Yu.call(t,n)&&gs(e,n,t[n]);return e},D=(e,t)=>Wu(e,Ju(t));var ie=(e,t,n)=>gs(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 Xu=`
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
- `,Xu=`
12
+ `,Ku=`
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
- `,Ku=`
306
+ `,Qu=`
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
- `,Qu=`
317
+ `,ed=`
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
- `,ed=`
391
+ `,td=`
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
- `,td=`
445
+ `,nd=`
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
- `,nd=`
675
+ `,rd=`
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
- `,rd=`
805
+ `,od=`
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
- `,od=`
861
+ `,sd=`
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
- `,sd=`
986
+ `,id=`
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
- `,id=`
1047
+ `,ad=`
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
- `,ad=`
1126
+ `,cd=`
1127
1127
  .ap-sdk-runner__approval {
1128
1128
  margin-top: 14px;
1129
1129
  display: flex;
@@ -1445,7 +1445,7 @@ button.ap-sdk-list-item__link {
1445
1445
  font-style: italic;
1446
1446
  padding: 4px 0;
1447
1447
  }
1448
- `,cd=`
1448
+ `,ld=`
1449
1449
  .ap-sdk-resize-handle {
1450
1450
  position: absolute;
1451
1451
  bottom: 2px;
@@ -1467,12 +1467,12 @@ button.ap-sdk-list-item__link {
1467
1467
  border-right: 2px solid #d1d5db;
1468
1468
  border-bottom: 2px solid #d1d5db;
1469
1469
  }
1470
- `,ld=[Yu,Xu,Ku,Qu,ed,td,nd,rd,od,sd,id,ad,cd].join(`
1471
- `);let Ui=!1;function Fr(){if(Ui)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=ld,document.head.appendChild(e),Ui=!0}function yo(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 $o(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 ud=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function wo(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 ud)a(d);return`${t}${n}${r}${o.join("")}`}function dd(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 pd(e,t=5,n=10){function r(o,i){const a=wo(o),d=" ".repeat(i),l=Array.from(o.children).slice(0,n);if(i>=t||l.length===0){const p=dd(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 hd='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"]',fd={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function co(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function gd(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(hd);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function md(e,t=80){var a,d,l;const n=fd[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 co(p,t)}const r=gd(e);if(r)return co(r,t);const o=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(o)return co(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var g,m,k;return(k=(m=(g=document.getElementById(h))==null?void 0:g.textContent)==null?void 0:m.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return co(p,t)}return""}function bd(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":md(o),a=i&&!r.has(i)?`${wo(o)} ["${i}"]`:wo(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||wo(e)}function Ja(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function Tr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Va(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>Tr('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(()=>Tr('meta[property="og:title"]')),ogDescription:e(()=>Tr('meta[property="og:description"]')),ogType:e(()=>Tr('meta[property="og:type"]')),ogSiteName:e(()=>Tr('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?Ja(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function kd(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 _d(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}: ${Ja(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function vd(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 sr=new Set;let Qn=null,Oo=!1,Rs=!1;function yd(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function wd(){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(!(sr.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&yd(r))return!0}return!1}function Ya(){const e=wd(),t=e&&!Rs;Rs=e;for(const n of sr){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 Zi(e){if(!(e instanceof Node))return!1;for(const t of sr)if(t===e||t.contains(e))return!0;return!1}function er(e){(Zi(e.target)||"relatedTarget"in e&&Zi(e.relatedTarget))&&e.stopPropagation()}function xd(){Oo||(window.addEventListener("focusin",er,!0),window.addEventListener("focusout",er,!0),window.addEventListener("pointerdown",er,!0),Oo=!0),!Qn&&(Qn=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")&&Ya()}),Qn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Qt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),sr.add(e),xd(),Ya())}function en(e){if(sr.delete(e),sr.size===0&&(Qn&&(Qn.disconnect(),Qn=null),Oo&&(window.removeEventListener("focusin",er,!0),window.removeEventListener("focusout",er,!0),window.removeEventListener("pointerdown",er,!0),Oo=!1),Rs=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function Gs(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),Qt(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:()=>{en(t),t.remove()}}}const Xa=/^cc-|current-password|new-password/i,Sd=/token|secret|password|apikey|auth/i,ms="[redacted]";function Td(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Xa.test(t)}function Ka(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ms);const r=n.getAttribute("autocomplete");r&&Xa.test(r)&&n.setAttribute("value",ms);for(const o of Array.from(n.attributes))Sd.test(o.name)&&n.setAttribute(o.name,ms)}}const Ed="🎯 Click any element to capture";let mn=null,$e=null,qe=null;function $r(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 Cd(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function qi(e){mn==null||mn.update(e)}function Qa(e){const t=Va(),n=kd(e),r=_d(e);let o;try{const i=e.cloneNode(!0);Ka(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return y(y({pageUrl:window.location.href,pageTitle:document.title,elementText:$o(e),cssSelector:yo(e),innerTree:pd(e),outerTree:bd(e),elementOuterHtml:o,ancestry:n},r),t)}function bs(e,t){qe&&qe();const n=Cd();mn=Gs(),$e=document.createElement("div"),$e.className="ap-sdk-picker-cursor",$e.setAttribute("data-ap-sdk","1"),$e.textContent=n?"Tap any element to preview":Ed,document.body.appendChild($e),Qt($e);let r=null,o=null;const i=h=>{qe==null||qe(),e(Qa(h),h)},a=h=>{if(o=h,qi(h),!$e)return;$e.classList.add("ap-sdk-picker-cursor--confirm"),$e.innerHTML="";const g=document.createElement("span");g.className="ap-sdk-picker-cursor__label",g.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),qe==null||qe(),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",v=>{v.preventDefault(),v.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const w=document.createElement("button");w.type="button",w.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",w.textContent="✓ Select",w.setAttribute("data-ap-sdk","1"),w.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),o&&i(o)}),$e.appendChild(g),$e.appendChild(m),$e.appendChild(k),$e.appendChild(w)},d=h=>{$r(h.target)||(r=h.target,qi(r))},l=h=>{var m;if($r(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const g=(m=h.target)!=null?m:r;if(g){if(n){a(g);return}i(g)}},p=h=>{h.key==="Escape"&&(qe==null||qe(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",l,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),qe=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",l,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),$e&&en($e),$e==null||$e.remove(),mn==null||mn.destroy(),mn=null,$e=null,o=null,qe=null}}function Ws(){qe==null||qe()}function tr(){return qe!==null}const lo={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 x(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,g=Object.keys(h);for(let m=0;m<g.length;m++){const k=g[m];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 g;var p;const h=n!=null&&n.Parent?new i:this;r(h,l),(g=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value: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 nr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ec extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const tc={};function bn(e){return tc}function nc(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 Ls(e,t){return typeof t=="bigint"?t.toString():t}function Ko(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Js(e){return e==null}function Vs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Ad(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/ji(10,i)}const Hi=Symbol("evaluating");function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Hi)return r===void 0&&(r=Hi,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Nn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _n(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Fi(e){return JSON.stringify(e)}function Pd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const rc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Rd=Ko(()=>{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 ir(e){if(Ur(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ur(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function oc(e){return ir(e)?y({},e):Array.isArray(e)?[...e]:e}const Ld=new Set(["string","number","symbol"]);function ar(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vn(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 zd(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Id={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 $d(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=_n(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 Nn(this,"shape",a),a},checks:[]});return vn(e,i)}function Od(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=_n(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 Nn(this,"shape",a),a},checks:[]});return vn(e,i)}function Nd(e,t){if(!ir(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=_n(e._zod.def,{get shape(){const i=y(y({},e._zod.def.shape),t);return Nn(this,"shape",i),i}});return vn(e,o)}function Dd(e,t){if(!ir(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=_n(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t);return Nn(this,"shape",r),r}});return vn(e,n)}function Md(e,t){const n=_n(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t._zod.def.shape);return Nn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return vn(e,n)}function jd(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=_n(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 Nn(this,"shape",l),l},checks:[]});return vn(t,a)}function Ud(e,t,n){const r=_n(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 Nn(this,"shape",i),i}});return vn(t,r)}function Vn(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 Yn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function uo(e){return typeof e=="string"?e:e==null?void 0:e.message}function kn(e,t,n){var o,i,a,d,l,p,h,g,m,k,w;const r=D(y({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const v=(w=(k=(g=(p=uo((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:uo((l=t==null?void 0:t.error)==null?void 0:l.call(t,e)))!=null?g:uo((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:uo((m=n.localeError)==null?void 0:m.call(n,e)))!=null?w:"Invalid input";r.message=v}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Ys(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Zr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:y({},t)}const sc=(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,Ls,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ic=x("$ZodError",sc),ac=x("$ZodError",sc,{Parent:Error});function Zd(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 qd(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 Xs=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 nr;if(a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>kn(p,i,bn())));throw rc(l,o==null?void 0:o.callee),l}return a.value},Ks=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=>kn(p,i,bn())));throw rc(l,o==null?void 0:o.callee),l}return a.value}),Qo=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 nr;return i.issues.length?{success:!1,error:new(e!=null?e:ic)(i.issues.map(a=>kn(a,o,bn())))}:{success:!0,data:i.value}},Hd=Qo(ac),es=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=>kn(a,o,bn())))}:{success:!0,data:i.value}}),Fd=es(ac),Bd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xs(e)(t,n,o)},Gd=e=>(t,n,r)=>Xs(e)(t,n,r),Wd=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ks(e)(t,n,o)}),Jd=e=>(t,n,r)=>z(null,null,function*(){return Ks(e)(t,n,r)}),Vd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qo(e)(t,n,o)},Yd=e=>(t,n,r)=>Qo(e)(t,n,r),Xd=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return es(e)(t,n,o)}),Kd=e=>(t,n,r)=>z(null,null,function*(){return es(e)(t,n,r)}),Qd=/^[cC][^\s-]{8,}$/,ep=/^[0-9a-z]+$/,tp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,np=/^[0-9a-vA-V]{20}$/,rp=/^[A-Za-z0-9]{27}$/,op=/^[a-zA-Z0-9_-]{21}$/,sp=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ip=/^([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})$/,Bi=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)$/,ap=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lp(){return new RegExp(cp,"u")}const up=/^(?:(?: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])$/,dp=/^(([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}|:))$/,pp=/^((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])$/,hp=/^(([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])$/,fp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cc=/^[A-Za-z0-9_-]*$/,gp=/^\+[1-9]\d{6,14}$/,lc="(?:(?:\\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])))",mp=new RegExp(`^${lc}$`);function uc(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 bp(e){return new RegExp(`^${uc(e)}$`)}function kp(e){const t=uc({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(`^${lc}T(?:${r})$`)}const _p=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}$`)},vp=/^-?\d+$/,dc=/^-?\d+(?:\.\d+)?$/,yp=/^(?:true|false)$/i,wp=/^[^A-Z]*$/,xp=/^[^a-z]*$/,at=x("$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=[])}),pc={number:"number",bigint:"bigint",object:"date"},hc=x("$ZodCheckLessThan",(e,t)=>{at.init(e,t);const n=pc[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})}}),fc=x("$ZodCheckGreaterThan",(e,t)=>{at.init(e,t);const n=pc[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})}}),Sp=x("$ZodCheckMultipleOf",(e,t)=>{at.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):Ad(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})}}),Tp=x("$ZodCheckNumberFormat",(e,t)=>{var a;at.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]=Id[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=vp)}),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})}}),Ep=x("$ZodCheckMaxLength",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Js(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=Ys(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Cp=x("$ZodCheckMinLength",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Js(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=Ys(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ap=x("$ZodCheckLengthEquals",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Js(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=Ys(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}))}}),ts=x("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;at.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=()=>{})}),Pp=x("$ZodCheckRegex",(e,t)=>{ts.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})}}),Rp=x("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=wp),ts.init(e,t)}),Lp=x("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=xp),ts.init(e,t)}),zp=x("$ZodCheckIncludes",(e,t)=>{at.init(e,t);const n=ar(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})}}),Ip=x("$ZodCheckStartsWith",(e,t)=>{var r;at.init(e,t);const n=new RegExp(`^${ar(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})}}),$p=x("$ZodCheckEndsWith",(e,t)=>{var r;at.init(e,t);const n=new RegExp(`.*${ar(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})}}),Op=x("$ZodCheckOverwrite",(e,t)=>{at.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Np{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
+ `,ud=[Xu,Ku,Qu,ed,td,nd,rd,od,sd,id,ad,cd,ld].join(`
1471
+ `);let Ui=!1;function Fr(){if(Ui)return;const e=document.createElement("style");e.setAttribute("data-ap-sdk","1"),e.textContent=ud,document.head.appendChild(e),Ui=!0}function yo(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 $o(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 dd=["role","type","name","href","src","alt","title","for","placeholder","data-testid"];function wo(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 dd)a(d);return`${t}${n}${r}${o.join("")}`}function pd(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 hd(e,t=5,n=10){function r(o,i){const a=wo(o),d=" ".repeat(i),l=Array.from(o.children).slice(0,n);if(i>=t||l.length===0){const p=pd(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 fd='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"]',gd={fieldset:"legend",table:"caption",figure:"figcaption",details:"summary"};function co(e,t){const n=e.replace(/\s+/g," ").trim();return n.length>t?n.slice(0,t)+"…":n}function md(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(fd);)o=o.parentElement;if(o===e){const i=((n=r.textContent)!=null?n:"").trim();if(i)return i}}return""}function bd(e,t=80){var a,d,l;const n=gd[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 co(p,t)}const r=md(e);if(r)return co(r,t);const o=(l=e.getAttribute("aria-label"))==null?void 0:l.trim();if(o)return co(o,t);const i=e.getAttribute("aria-labelledby");if(i){const p=i.split(/\s+/).map(h=>{var g,m,k;return(k=(m=(g=document.getElementById(h))==null?void 0:g.textContent)==null?void 0:m.trim())!=null?k:""}).filter(Boolean).join(" ");if(p)return co(p,t)}return""}function kd(e,t=6){const n=[],r=new Set;let o=e;for(;o&&o!==document.body&&n.length<t;){const i=o===e?"":bd(o),a=i&&!r.has(i)?`${wo(o)} ["${i}"]`:wo(o);i&&r.add(i),n.unshift(a),o=o.parentElement}return n.join(" > ")||wo(e)}function Ja(e,t){return e.length>t?e.slice(0,t)+"… (truncated)":e}function Tr(e){var r;const t=document.querySelector(e);return((r=t==null?void 0:t.content)==null?void 0:r.trim())||void 0}function Va(){const e=t=>{try{return t()}catch(n){return}};return{description:e(()=>Tr('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(()=>Tr('meta[property="og:title"]')),ogDescription:e(()=>Tr('meta[property="og:description"]')),ogType:e(()=>Tr('meta[property="og:type"]')),ogSiteName:e(()=>Tr('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?Ja(t,1e3):void 0}),capturedAt:new Date().toISOString()}}function _d(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 vd(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}: ${Ja(a,120)}`:d}return{elementRole:t,elementAriaLabel:n,enclosingSection:r}}function yd(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 sr=new Set;let Qn=null,Oo=!1,Rs=!1;function wd(e){if(e.getAttribute("aria-modal")==="false")return!1;const t=getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}function xd(){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(!(sr.has(r)||r.hasAttribute("data-ap-sdk"))&&r.isConnected&&wd(r))return!0}return!1}function Ya(){const e=xd(),t=e&&!Rs;Rs=e;for(const n of sr){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 Zi(e){if(!(e instanceof Node))return!1;for(const t of sr)if(t===e||t.contains(e))return!0;return!1}function er(e){(Zi(e.target)||"relatedTarget"in e&&Zi(e.relatedTarget))&&e.stopPropagation()}function Sd(){Oo||(window.addEventListener("focusin",er,!0),window.addEventListener("focusout",er,!0),window.addEventListener("pointerdown",er,!0),Oo=!0),!Qn&&(Qn=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")&&Ya()}),Qn.observe(document.documentElement,{attributes:!0,attributeFilter:["open","inert","aria-hidden","role"],childList:!0,subtree:!0}))}function Qt(e){"showPopover"in e&&(e.setAttribute("popover","manual"),sr.add(e),Sd(),Ya())}function en(e){if(sr.delete(e),sr.size===0&&(Qn&&(Qn.disconnect(),Qn=null),Oo&&(window.removeEventListener("focusin",er,!0),window.removeEventListener("focusout",er,!0),window.removeEventListener("pointerdown",er,!0),Oo=!1),Rs=!1),"hidePopover"in e)try{e.hidePopover()}catch(t){}}function Gs(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),Qt(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:()=>{en(t),t.remove()}}}const Xa=/^cc-|current-password|new-password/i,Td=/token|secret|password|apikey|auth/i,ms="[redacted]";function Ed(e){if(e instanceof HTMLInputElement&&e.type==="password")return!0;const t=e.getAttribute("autocomplete");return!!t&&Xa.test(t)}function Ka(e){const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){n instanceof HTMLInputElement&&n.type==="password"&&n.setAttribute("value",ms);const r=n.getAttribute("autocomplete");r&&Xa.test(r)&&n.setAttribute("value",ms);for(const o of Array.from(n.attributes))Td.test(o.name)&&n.setAttribute(o.name,ms)}}const Cd="🎯 Click any element to capture";let mn=null,$e=null,qe=null;function $r(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 Ad(){var e,t;return((t=(e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)!=null?t:!1)||"ontouchstart"in window}function qi(e){mn==null||mn.update(e)}function Qa(e){const t=Va(),n=_d(e),r=vd(e);let o;try{const i=e.cloneNode(!0);Ka(i),o=i.outerHTML.slice(0,4e3)}catch(i){}return y(y({pageUrl:window.location.href,pageTitle:document.title,elementText:$o(e),cssSelector:yo(e),innerTree:hd(e),outerTree:kd(e),elementOuterHtml:o,ancestry:n},r),t)}function bs(e,t){qe&&qe();const n=Ad();mn=Gs(),$e=document.createElement("div"),$e.className="ap-sdk-picker-cursor",$e.setAttribute("data-ap-sdk","1"),$e.textContent=n?"Tap any element to preview":Cd,document.body.appendChild($e),Qt($e);let r=null,o=null;const i=h=>{qe==null||qe(),e(Qa(h),h)},a=h=>{if(o=h,qi(h),!$e)return;$e.classList.add("ap-sdk-picker-cursor--confirm"),$e.innerHTML="";const g=document.createElement("span");g.className="ap-sdk-picker-cursor__label",g.textContent=`<${h.tagName.toLowerCase()}>`;const m=document.createElement("button");m.type="button",m.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--cancel",m.textContent="✕ Cancel",m.setAttribute("data-ap-sdk","1"),m.setAttribute("aria-label","Cancel picking"),m.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),qe==null||qe(),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",v=>{v.preventDefault(),v.stopPropagation(),o!=null&&o.parentElement&&a(o.parentElement)});const w=document.createElement("button");w.type="button",w.className="ap-sdk-picker-cursor__btn ap-sdk-picker-cursor__btn--primary",w.textContent="✓ Select",w.setAttribute("data-ap-sdk","1"),w.addEventListener("click",v=>{v.preventDefault(),v.stopPropagation(),o&&i(o)}),$e.appendChild(g),$e.appendChild(m),$e.appendChild(k),$e.appendChild(w)},d=h=>{$r(h.target)||(r=h.target,qi(r))},l=h=>{var m;if($r(h.target))return;h.preventDefault(),h.stopImmediatePropagation();const g=(m=h.target)!=null?m:r;if(g){if(n){a(g);return}i(g)}},p=h=>{h.key==="Escape"&&(qe==null||qe(),t())};n||document.addEventListener("mouseover",d,{capture:!0}),document.addEventListener("click",l,{capture:!0}),document.addEventListener("keydown",p,{capture:!0}),qe=()=>{n||document.removeEventListener("mouseover",d,{capture:!0}),document.removeEventListener("click",l,{capture:!0}),document.removeEventListener("keydown",p,{capture:!0}),$e&&en($e),$e==null||$e.remove(),mn==null||mn.destroy(),mn=null,$e=null,o=null,qe=null}}function Ws(){qe==null||qe()}function tr(){return qe!==null}const lo={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 x(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,g=Object.keys(h);for(let m=0;m<g.length;m++){const k=g[m];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 g;var p;const h=n!=null&&n.Parent?new i:this;r(h,l),(g=(p=h._zod).deferred)!=null||(p.deferred=[]);for(const m of h._zod.deferred)m();return h}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value: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 nr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ec extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const tc={};function bn(e){return tc}function nc(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 Ls(e,t){return typeof t=="bigint"?t.toString():t}function Ko(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Js(e){return e==null}function Vs(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Pd(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/ji(10,i)}const Hi=Symbol("evaluating");function ne(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Hi)return r===void 0&&(r=Hi,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Nn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _n(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Fi(e){return JSON.stringify(e)}function Rd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const rc="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Ld=Ko(()=>{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 ir(e){if(Ur(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Ur(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function oc(e){return ir(e)?y({},e):Array.isArray(e)?[...e]:e}const zd=new Set(["string","number","symbol"]);function ar(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vn(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 Id(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const $d={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 Od(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=_n(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 Nn(this,"shape",a),a},checks:[]});return vn(e,i)}function Nd(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=_n(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 Nn(this,"shape",a),a},checks:[]});return vn(e,i)}function Dd(e,t){if(!ir(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=_n(e._zod.def,{get shape(){const i=y(y({},e._zod.def.shape),t);return Nn(this,"shape",i),i}});return vn(e,o)}function Md(e,t){if(!ir(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=_n(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t);return Nn(this,"shape",r),r}});return vn(e,n)}function jd(e,t){const n=_n(e._zod.def,{get shape(){const r=y(y({},e._zod.def.shape),t._zod.def.shape);return Nn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]});return vn(e,n)}function Ud(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=_n(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 Nn(this,"shape",l),l},checks:[]});return vn(t,a)}function Zd(e,t,n){const r=_n(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 Nn(this,"shape",i),i}});return vn(t,r)}function Vn(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 Yn(e,t){return t.map(n=>{var o;var r;return(o=(r=n).path)!=null||(r.path=[]),n.path.unshift(e),n})}function uo(e){return typeof e=="string"?e:e==null?void 0:e.message}function kn(e,t,n){var o,i,a,d,l,p,h,g,m,k,w;const r=D(y({},e),{path:(o=e.path)!=null?o:[]});if(!e.message){const v=(w=(k=(g=(p=uo((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:uo((l=t==null?void 0:t.error)==null?void 0:l.call(t,e)))!=null?g:uo((h=n.customError)==null?void 0:h.call(n,e)))!=null?k:uo((m=n.localeError)==null?void 0:m.call(n,e)))!=null?w:"Invalid input";r.message=v}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Ys(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Zr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:y({},t)}const sc=(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,Ls,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ic=x("$ZodError",sc),ac=x("$ZodError",sc,{Parent:Error});function qd(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 Hd(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 Xs=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 nr;if(a.issues.length){const l=new((d=o==null?void 0:o.Err)!=null?d:e)(a.issues.map(p=>kn(p,i,bn())));throw rc(l,o==null?void 0:o.callee),l}return a.value},Ks=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=>kn(p,i,bn())));throw rc(l,o==null?void 0:o.callee),l}return a.value}),Qo=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 nr;return i.issues.length?{success:!1,error:new(e!=null?e:ic)(i.issues.map(a=>kn(a,o,bn())))}:{success:!0,data:i.value}},Fd=Qo(ac),es=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=>kn(a,o,bn())))}:{success:!0,data:i.value}}),Bd=es(ac),Gd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Xs(e)(t,n,o)},Wd=e=>(t,n,r)=>Xs(e)(t,n,r),Jd=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Ks(e)(t,n,o)}),Vd=e=>(t,n,r)=>z(null,null,function*(){return Ks(e)(t,n,r)}),Yd=e=>(t,n,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Qo(e)(t,n,o)},Xd=e=>(t,n,r)=>Qo(e)(t,n,r),Kd=e=>(t,n,r)=>z(null,null,function*(){const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return es(e)(t,n,o)}),Qd=e=>(t,n,r)=>z(null,null,function*(){return es(e)(t,n,r)}),ep=/^[cC][^\s-]{8,}$/,tp=/^[0-9a-z]+$/,np=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rp=/^[0-9a-vA-V]{20}$/,op=/^[A-Za-z0-9]{27}$/,sp=/^[a-zA-Z0-9_-]{21}$/,ip=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ap=/^([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})$/,Bi=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)$/,cp=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,lp="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function up(){return new RegExp(lp,"u")}const dp=/^(?:(?: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])$/,pp=/^(([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}|:))$/,hp=/^((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])$/,fp=/^(([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])$/,gp=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cc=/^[A-Za-z0-9_-]*$/,mp=/^\+[1-9]\d{6,14}$/,lc="(?:(?:\\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])))",bp=new RegExp(`^${lc}$`);function uc(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 kp(e){return new RegExp(`^${uc(e)}$`)}function _p(e){const t=uc({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(`^${lc}T(?:${r})$`)}const vp=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}$`)},yp=/^-?\d+$/,dc=/^-?\d+(?:\.\d+)?$/,wp=/^(?:true|false)$/i,xp=/^[^A-Z]*$/,Sp=/^[^a-z]*$/,at=x("$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=[])}),pc={number:"number",bigint:"bigint",object:"date"},hc=x("$ZodCheckLessThan",(e,t)=>{at.init(e,t);const n=pc[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})}}),fc=x("$ZodCheckGreaterThan",(e,t)=>{at.init(e,t);const n=pc[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})}}),Tp=x("$ZodCheckMultipleOf",(e,t)=>{at.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):Pd(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})}}),Ep=x("$ZodCheckNumberFormat",(e,t)=>{var a;at.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]=$d[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=yp)}),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})}}),Cp=x("$ZodCheckMaxLength",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Js(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=Ys(i);o.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Ap=x("$ZodCheckMinLength",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Js(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=Ys(i);o.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Pp=x("$ZodCheckLengthEquals",(e,t)=>{var r;var n;at.init(e,t),(r=(n=e._zod.def).when)!=null||(n.when=o=>{const i=o.value;return!Js(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=Ys(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}))}}),ts=x("$ZodCheckStringFormat",(e,t)=>{var o,i;var n,r;at.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=()=>{})}),Rp=x("$ZodCheckRegex",(e,t)=>{ts.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})}}),Lp=x("$ZodCheckLowerCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=xp),ts.init(e,t)}),zp=x("$ZodCheckUpperCase",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Sp),ts.init(e,t)}),Ip=x("$ZodCheckIncludes",(e,t)=>{at.init(e,t);const n=ar(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})}}),$p=x("$ZodCheckStartsWith",(e,t)=>{var r;at.init(e,t);const n=new RegExp(`^${ar(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})}}),Op=x("$ZodCheckEndsWith",(e,t)=>{var r;at.init(e,t);const n=new RegExp(`.*${ar(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})}}),Np=x("$ZodCheckOverwrite",(e,t)=>{at.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class Dp{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(`
1474
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(`
1475
- `))}}const Dp={major:4,minor:3,patch:5},me=x("$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=Dp;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,g)=>{let m=Vn(p),k;for(const w of h){if(w._zod.def.when){if(!w._zod.def.when(p))continue}else if(m)continue;const v=p.issues.length,Z=w._zod.check(p);if(Z instanceof Promise&&(g==null?void 0:g.async)===!1)throw new nr;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>z(null,null,function*(){yield Z,p.issues.length!==v&&(m||(m=Vn(p,v)))}));else{if(p.issues.length===v)continue;m||(m=Vn(p,v))}}return k?k.then(()=>p):p},l=(p,h,g)=>{if(Vn(p))return p.aborted=!0,p;const m=d(h,r,g);if(m instanceof Promise){if(g.async===!1)throw new nr;return m.then(k=>e._zod.parse(k,g))}return e._zod.parse(m,g)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const m=e._zod.parse({value:p.value,issues:[]},D(y({},h),{skipChecks:!0}));return m instanceof Promise?m.then(k=>l(k,p,h)):l(m,p,h)}const g=e._zod.parse(p,h);if(g instanceof Promise){if(h.async===!1)throw new nr;return g.then(m=>d(m,r,h))}return d(g,r,h)}}ne(e,"~standard",()=>({validate:d=>{var l;try{const p=Hd(e,d);return p.success?{value:p.data}:{issues:(l=p.error)==null?void 0:l.issues}}catch(p){return Fd(e,d).then(h=>{var g;return h.success?{value:h.data}:{issues:(g=h.error)==null?void 0:g.issues}})}},vendor:"zod",version:1}))}),Qs=x("$ZodString",(e,t)=>{var n,r,o;me.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:_p(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),be=x("$ZodStringFormat",(e,t)=>{ts.init(e,t),Qs.init(e,t)}),Mp=x("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ip),be.init(e,t)}),jp=x("$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=Bi(i))}else(r=t.pattern)!=null||(t.pattern=Bi());be.init(e,t)}),Up=x("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ap),be.init(e,t)}),Zp=x("$ZodURL",(e,t)=>{be.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),qp=x("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=lp()),be.init(e,t)}),Hp=x("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=op),be.init(e,t)}),Fp=x("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=Qd),be.init(e,t)}),Bp=x("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ep),be.init(e,t)}),Gp=x("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tp),be.init(e,t)}),Wp=x("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=np),be.init(e,t)}),Jp=x("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=rp),be.init(e,t)}),Vp=x("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=kp(t)),be.init(e,t)}),Yp=x("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=mp),be.init(e,t)}),Xp=x("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bp(t)),be.init(e,t)}),Kp=x("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sp),be.init(e,t)}),Qp=x("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=up),be.init(e,t),e._zod.bag.format="ipv4"}),eh=x("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=dp),be.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),th=x("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pp),be.init(e,t)}),nh=x("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hp),be.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function gc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const rh=x("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=fp),be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{gc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function oh(e){if(!cc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return gc(n)}const sh=x("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cc),be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{oh(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ih=x("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=gp),be.init(e,t)});function ah(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 ch=x("$ZodJWT",(e,t)=>{be.init(e,t),e._zod.check=n=>{ah(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),mc=x("$ZodNumber",(e,t)=>{var n;me.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:dc,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}}),lh=x("$ZodNumberFormat",(e,t)=>{Tp.init(e,t),mc.init(e,t)}),uh=x("$ZodBoolean",(e,t)=>{me.init(e,t),e._zod.pattern=yp,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}}),dh=x("$ZodAny",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),ph=x("$ZodUnknown",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),hh=x("$ZodNever",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Gi(e,t,n){e.issues.length&&t.issues.push(...Yn(n,e.issues)),t.value[n]=e.value}const fh=x("$ZodArray",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],l=t.element._zod.run({value:d,issues:[]},r);l instanceof Promise?i.push(l.then(p=>Gi(p,n,a))):Gi(l,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function No(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Yn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function bc(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=zd(e.shape);return D(y({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function kc(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 g in t){if(d.has(g))continue;if(p==="never"){a.push(g);continue}const m=l.run({value:t[g],issues:[]},r);m instanceof Promise?e.push(m.then(k=>No(k,n,g,t,h))):No(m,n,g,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const gh=x("$ZodObject",(e,t)=>{me.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l=y({},d);return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Ko(()=>bc(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,l={};for(const h in d){const g=d[h]._zod;if(g.values){(p=l[h])!=null||(l[h]=new Set);for(const m of g.values)l[h].add(m)}}return l});const o=Ur,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=[],g=a.shape;for(const m of a.keys){const k=g[m],w=k._zod.optout==="optional",v=k._zod.run({value:p[m],issues:[]},l);v instanceof Promise?h.push(v.then(Z=>No(Z,d,m,p,w))):No(v,d,m,p,w)}return i?kc(h,p,d,l,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),mh=x("$ZodObjectJIT",(e,t)=>{gh.init(e,t);const n=e._zod.parse,r=Ko(()=>bc(t)),o=m=>{var E;const k=new Np(["shape","payload","ctx"]),w=r.value,v=T=>{const C=Fi(T);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let K=0;for(const T of w.keys)Z[T]=`key_${K++}`;k.write("const newResult = {};");for(const T of w.keys){const C=Z[T],N=Fi(T),J=m[T],ye=((E=J==null?void 0:J._zod)==null?void 0:E.optout)==="optional";k.write(`const ${C} = ${v(T)};`),ye?k.write(`
1475
+ `))}}const Mp={major:4,minor:3,patch:5},me=x("$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=Mp;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,g)=>{let m=Vn(p),k;for(const w of h){if(w._zod.def.when){if(!w._zod.def.when(p))continue}else if(m)continue;const v=p.issues.length,Z=w._zod.check(p);if(Z instanceof Promise&&(g==null?void 0:g.async)===!1)throw new nr;if(k||Z instanceof Promise)k=(k!=null?k:Promise.resolve()).then(()=>z(null,null,function*(){yield Z,p.issues.length!==v&&(m||(m=Vn(p,v)))}));else{if(p.issues.length===v)continue;m||(m=Vn(p,v))}}return k?k.then(()=>p):p},l=(p,h,g)=>{if(Vn(p))return p.aborted=!0,p;const m=d(h,r,g);if(m instanceof Promise){if(g.async===!1)throw new nr;return m.then(k=>e._zod.parse(k,g))}return e._zod.parse(m,g)};e._zod.run=(p,h)=>{if(h.skipChecks)return e._zod.parse(p,h);if(h.direction==="backward"){const m=e._zod.parse({value:p.value,issues:[]},D(y({},h),{skipChecks:!0}));return m instanceof Promise?m.then(k=>l(k,p,h)):l(m,p,h)}const g=e._zod.parse(p,h);if(g instanceof Promise){if(h.async===!1)throw new nr;return g.then(m=>d(m,r,h))}return d(g,r,h)}}ne(e,"~standard",()=>({validate:d=>{var l;try{const p=Fd(e,d);return p.success?{value:p.data}:{issues:(l=p.error)==null?void 0:l.issues}}catch(p){return Bd(e,d).then(h=>{var g;return h.success?{value:h.data}:{issues:(g=h.error)==null?void 0:g.issues}})}},vendor:"zod",version:1}))}),Qs=x("$ZodString",(e,t)=>{var n,r,o;me.init(e,t),e._zod.pattern=(o=[...(r=(n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)!=null?r:[]].pop())!=null?o:vp(e._zod.bag),e._zod.parse=(i,a)=>{if(t.coerce)try{i.value=String(i.value)}catch(d){}return typeof i.value=="string"||i.issues.push({expected:"string",code:"invalid_type",input:i.value,inst:e}),i}}),be=x("$ZodStringFormat",(e,t)=>{ts.init(e,t),Qs.init(e,t)}),jp=x("$ZodGUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ap),be.init(e,t)}),Up=x("$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=Bi(i))}else(r=t.pattern)!=null||(t.pattern=Bi());be.init(e,t)}),Zp=x("$ZodEmail",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cp),be.init(e,t)}),qp=x("$ZodURL",(e,t)=>{be.init(e,t),e._zod.check=n=>{try{const r=n.value.trim(),o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Hp=x("$ZodEmoji",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=up()),be.init(e,t)}),Fp=x("$ZodNanoID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=sp),be.init(e,t)}),Bp=x("$ZodCUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ep),be.init(e,t)}),Gp=x("$ZodCUID2",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=tp),be.init(e,t)}),Wp=x("$ZodULID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=np),be.init(e,t)}),Jp=x("$ZodXID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=rp),be.init(e,t)}),Vp=x("$ZodKSUID",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=op),be.init(e,t)}),Yp=x("$ZodISODateTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=_p(t)),be.init(e,t)}),Xp=x("$ZodISODate",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=bp),be.init(e,t)}),Kp=x("$ZodISOTime",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=kp(t)),be.init(e,t)}),Qp=x("$ZodISODuration",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=ip),be.init(e,t)}),eh=x("$ZodIPv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=dp),be.init(e,t),e._zod.bag.format="ipv4"}),th=x("$ZodIPv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=pp),be.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch(o){r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),nh=x("$ZodCIDRv4",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=hp),be.init(e,t)}),rh=x("$ZodCIDRv6",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=fp),be.init(e,t),e._zod.check=r=>{const o=r.value.split("/");try{if(o.length!==2)throw new Error;const[i,a]=o;if(!a)throw new Error;const d=Number(a);if(`${d}`!==a)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${i}]`)}catch(i){r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function gc(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch(t){return!1}}const oh=x("$ZodBase64",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=gp),be.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{gc(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function sh(e){if(!cc.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return gc(n)}const ih=x("$ZodBase64URL",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=cc),be.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{sh(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ah=x("$ZodE164",(e,t)=>{var n;(n=t.pattern)!=null||(t.pattern=mp),be.init(e,t)});function ch(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 lh=x("$ZodJWT",(e,t)=>{be.init(e,t),e._zod.check=n=>{ch(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),mc=x("$ZodNumber",(e,t)=>{var n;me.init(e,t),e._zod.pattern=(n=e._zod.bag.pattern)!=null?n:dc,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}}),uh=x("$ZodNumberFormat",(e,t)=>{Ep.init(e,t),mc.init(e,t)}),dh=x("$ZodBoolean",(e,t)=>{me.init(e,t),e._zod.pattern=wp,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}}),ph=x("$ZodAny",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),hh=x("$ZodUnknown",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),fh=x("$ZodNever",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Gi(e,t,n){e.issues.length&&t.issues.push(...Yn(n,e.issues)),t.value[n]=e.value}const gh=x("$ZodArray",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const d=o[a],l=t.element._zod.run({value:d,issues:[]},r);l instanceof Promise?i.push(l.then(p=>Gi(p,n,a))):Gi(l,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function No(e,t,n,r,o){if(e.issues.length){if(o&&!(n in r))return;t.issues.push(...Yn(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function bc(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=Id(e.shape);return D(y({},e),{keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)})}function kc(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 g in t){if(d.has(g))continue;if(p==="never"){a.push(g);continue}const m=l.run({value:t[g],issues:[]},r);m instanceof Promise?e.push(m.then(k=>No(k,n,g,t,h))):No(m,n,g,t,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const mh=x("$ZodObject",(e,t)=>{me.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l=y({},d);return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Ko(()=>bc(t));ne(e._zod,"propValues",()=>{var p;const d=t.shape,l={};for(const h in d){const g=d[h]._zod;if(g.values){(p=l[h])!=null||(l[h]=new Set);for(const m of g.values)l[h].add(m)}}return l});const o=Ur,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=[],g=a.shape;for(const m of a.keys){const k=g[m],w=k._zod.optout==="optional",v=k._zod.run({value:p[m],issues:[]},l);v instanceof Promise?h.push(v.then(Z=>No(Z,d,m,p,w))):No(v,d,m,p,w)}return i?kc(h,p,d,l,r.value,e):h.length?Promise.all(h).then(()=>d):d}}),bh=x("$ZodObjectJIT",(e,t)=>{mh.init(e,t);const n=e._zod.parse,r=Ko(()=>bc(t)),o=m=>{var E;const k=new Dp(["shape","payload","ctx"]),w=r.value,v=T=>{const C=Fi(T);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};k.write("const input = payload.value;");const Z=Object.create(null);let K=0;for(const T of w.keys)Z[T]=`key_${K++}`;k.write("const newResult = {};");for(const T of w.keys){const C=Z[T],N=Fi(T),J=m[T],ye=((E=J==null?void 0:J._zod)==null?void 0:E.optout)==="optional";k.write(`const ${C} = ${v(T)};`),ye?k.write(`
1476
1476
  if (${C}.issues.length) {
1477
1477
  if (${N} in input) {
1478
1478
  payload.issues = payload.issues.concat(${C}.issues.map(iss => ({
@@ -1506,21 +1506,21 @@ button.ap-sdk-list-item__link {
1506
1506
  newResult[${N}] = ${C}.value;
1507
1507
  }
1508
1508
 
1509
- `)}k.write("payload.value = newResult;"),k.write("return payload;");const M=k.compile();return(T,C)=>M(m,T,C)};let i;const a=Ur,d=!tc.jitless,p=d&&Rd.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const w=m.value;return a(w)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?kc([],w,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Wi(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=>!Vn(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=>kn(a,r,bn())))}),t)}const _c=x("$ZodUnion",(e,t)=>{me.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=>Vs(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=>Wi(l,o,e,i)):Wi(d,o,e,i)}}),bh=x("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,_c.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=Ko(()=>{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(!Ur(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)}}),kh=x("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,p])=>Ji(n,l,p)):Ji(n,i,a)}});function zs(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(ir(e)&&ir(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=zs(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=zs(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 Ji(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})),Vn(e))return e;const a=zs(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 _h=x("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!ir(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Yn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Yn(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"&&dc.test(d)&&l.issues.length&&l.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>kn(g,r,bn())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Yn(d,g.issues)),n.value[l.value]=g.value})):(h.issues.length&&n.issues.push(...Yn(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),vh=x("$ZodEnum",(e,t)=>{me.init(e,t);const n=nc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Ld.has(typeof o)).map(o=>typeof o=="string"?ar(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}}),yh=x("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ar(r):r?ar(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}}),wh=x("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ec(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 nr;return n.value=o,n}});function Vi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const vc=x("$ZodOptional",(e,t)=>{me.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(`^(${Vs(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=>Vi(i,n.value)):Vi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),xh=x("$ZodExactOptional",(e,t)=>{vc.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)}),Sh=x("$ZodNullable",(e,t)=>{me.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(`^(${Vs(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)}),Th=x("$ZodDefault",(e,t)=>{me.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=>Yi(i,t)):Yi(o,t)}});function Yi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Eh=x("$ZodPrefault",(e,t)=>{me.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))}),Ch=x("$ZodNonOptional",(e,t)=>{me.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=>Xi(i,e)):Xi(o,e)}});function Xi(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 Ah=x("$ZodCatch",(e,t)=>{me.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=>kn(a,r,bn()))},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=>kn(i,r,bn()))},input:n.value})),n.issues=[]),n)}}),Ph=x("$ZodPipe",(e,t)=>{me.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=>po(a,t.in,r)):po(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>po(i,t.out,r)):po(o,t.out,r)}});function po(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Rh=x("$ZodReadonly",(e,t)=>{me.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(Ki):Ki(o)}});function Ki(e){return e.value=Object.freeze(e.value),e}const Lh=x("$ZodCustom",(e,t)=>{at.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Qi(i,n,r,e));Qi(o,n,r,e)}});function Qi(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(Zr(i))}}var ea;class zh{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 Ih(){return new zh}var Wa;(Wa=(ea=globalThis).__zod_globalRegistry)!=null||(ea.__zod_globalRegistry=Ih());const zr=globalThis.__zod_globalRegistry;function $h(e,t){return new e(y({type:"string"},U(t)))}function Oh(e,t){return new e(y({type:"string",format:"email",check:"string_format",abort:!1},U(t)))}function ta(e,t){return new e(y({type:"string",format:"guid",check:"string_format",abort:!1},U(t)))}function Nh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1},U(t)))}function Dh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},U(t)))}function Mh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},U(t)))}function jh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},U(t)))}function Uh(e,t){return new e(y({type:"string",format:"url",check:"string_format",abort:!1},U(t)))}function Zh(e,t){return new e(y({type:"string",format:"emoji",check:"string_format",abort:!1},U(t)))}function qh(e,t){return new e(y({type:"string",format:"nanoid",check:"string_format",abort:!1},U(t)))}function Hh(e,t){return new e(y({type:"string",format:"cuid",check:"string_format",abort:!1},U(t)))}function Fh(e,t){return new e(y({type:"string",format:"cuid2",check:"string_format",abort:!1},U(t)))}function Bh(e,t){return new e(y({type:"string",format:"ulid",check:"string_format",abort:!1},U(t)))}function Gh(e,t){return new e(y({type:"string",format:"xid",check:"string_format",abort:!1},U(t)))}function Wh(e,t){return new e(y({type:"string",format:"ksuid",check:"string_format",abort:!1},U(t)))}function Jh(e,t){return new e(y({type:"string",format:"ipv4",check:"string_format",abort:!1},U(t)))}function Vh(e,t){return new e(y({type:"string",format:"ipv6",check:"string_format",abort:!1},U(t)))}function Yh(e,t){return new e(y({type:"string",format:"cidrv4",check:"string_format",abort:!1},U(t)))}function Xh(e,t){return new e(y({type:"string",format:"cidrv6",check:"string_format",abort:!1},U(t)))}function Kh(e,t){return new e(y({type:"string",format:"base64",check:"string_format",abort:!1},U(t)))}function Qh(e,t){return new e(y({type:"string",format:"base64url",check:"string_format",abort:!1},U(t)))}function ef(e,t){return new e(y({type:"string",format:"e164",check:"string_format",abort:!1},U(t)))}function tf(e,t){return new e(y({type:"string",format:"jwt",check:"string_format",abort:!1},U(t)))}function nf(e,t){return new e(y({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},U(t)))}function rf(e,t){return new e(y({type:"string",format:"date",check:"string_format"},U(t)))}function of(e,t){return new e(y({type:"string",format:"time",check:"string_format",precision:null},U(t)))}function sf(e,t){return new e(y({type:"string",format:"duration",check:"string_format"},U(t)))}function af(e,t){return new e(y({type:"number",checks:[]},U(t)))}function cf(e,t){return new e(y({type:"number",check:"number_format",abort:!1,format:"safeint"},U(t)))}function lf(e,t){return new e(y({type:"boolean"},U(t)))}function uf(e){return new e({type:"any"})}function df(e){return new e({type:"unknown"})}function pf(e,t){return new e(y({type:"never"},U(t)))}function na(e,t){return new hc(D(y({check:"less_than"},U(t)),{value:e,inclusive:!1}))}function ks(e,t){return new hc(D(y({check:"less_than"},U(t)),{value:e,inclusive:!0}))}function ra(e,t){return new fc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!1}))}function _s(e,t){return new fc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!0}))}function oa(e,t){return new Sp(D(y({check:"multiple_of"},U(t)),{value:e}))}function yc(e,t){return new Ep(D(y({check:"max_length"},U(t)),{maximum:e}))}function Do(e,t){return new Cp(D(y({check:"min_length"},U(t)),{minimum:e}))}function wc(e,t){return new Ap(D(y({check:"length_equals"},U(t)),{length:e}))}function hf(e,t){return new Pp(D(y({check:"string_format",format:"regex"},U(t)),{pattern:e}))}function ff(e){return new Rp(y({check:"string_format",format:"lowercase"},U(e)))}function gf(e){return new Lp(y({check:"string_format",format:"uppercase"},U(e)))}function mf(e,t){return new zp(D(y({check:"string_format",format:"includes"},U(t)),{includes:e}))}function bf(e,t){return new Ip(D(y({check:"string_format",format:"starts_with"},U(t)),{prefix:e}))}function kf(e,t){return new $p(D(y({check:"string_format",format:"ends_with"},U(t)),{suffix:e}))}function dr(e){return new Op({check:"overwrite",tx:e})}function _f(e){return dr(t=>t.normalize(e))}function vf(){return dr(e=>e.trim())}function yf(){return dr(e=>e.toLowerCase())}function wf(){return dr(e=>e.toUpperCase())}function xf(){return dr(e=>Pd(e))}function Sf(e,t,n){return new e(y({type:"array",element:t},U(n)))}function Tf(e,t,n){return new e(y({type:"custom",check:"custom",fn:t},U(n)))}function Ef(e){const t=Cf(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(Zr(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(Zr(l))}},e(n.value,n)));return t}function Cf(e,t){const n=new at(y({check:"custom"},U(t)));return n._zod.check=e,n}function xc(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:zr,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 Le(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=D(y({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const v=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,v,k)}const w=e._zod.parent;w&&(a.ref||(a.ref=w),Le(w,t,k),t.seen.get(w).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Qe(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Sc(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 g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var v,Z,K,M,E;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const T=(v=e.external.registry.get(h[0]))==null?void 0:v.id,C=(Z=e.external.uri)!=null?Z:(J=>J);if(T)return{ref:C(T)};const N=(M=(K=h[1].defId)!=null?K:h[1].schema.id)!=null?M:`schema${e.counter++}`;return h[1].defId=N,{defId:N,ref:`${C("__shared")}#/${g}/${N}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,w=(E=h[1].schema.id)!=null?E:`__schema${e.counter++}`;return{defId:w,ref:k+w}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=y({},g.schema),k&&(g.defId=k);const w=g.schema;for(const v in w)delete w[v];w.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1509
+ `)}k.write("payload.value = newResult;"),k.write("return payload;");const M=k.compile();return(T,C)=>M(m,T,C)};let i;const a=Ur,d=!tc.jitless,p=d&&Ld.value,h=t.catchall;let g;e._zod.parse=(m,k)=>{g!=null||(g=r.value);const w=m.value;return a(w)?d&&p&&(k==null?void 0:k.async)===!1&&k.jitless!==!0?(i||(i=o(t.shape)),m=i(m,k),h?kc([],w,m,k,g,e):m):n(m,k):(m.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),m)}});function Wi(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=>!Vn(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=>kn(a,r,bn())))}),t)}const _c=x("$ZodUnion",(e,t)=>{me.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=>Vs(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=>Wi(l,o,e,i)):Wi(d,o,e,i)}}),kh=x("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,_c.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=Ko(()=>{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(!Ur(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)}}),_h=x("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,p])=>Ji(n,l,p)):Ji(n,i,a)}});function zs(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(ir(e)&&ir(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=zs(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=zs(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 Ji(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})),Vn(e))return e;const a=zs(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 vh=x("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!ir(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const d=new Set;for(const p of a)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){d.add(typeof p=="number"?p.toString():p);const h=t.valueType._zod.run({value:o[p],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Yn(p,g.issues)),n.value[p]=g.value})):(h.issues.length&&n.issues.push(...Yn(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"&&dc.test(d)&&l.issues.length&&l.issues.some(g=>g.code==="invalid_type"&&g.expected==="number")){const g=t.keyType._zod.run({value:Number(d),issues:[]},r);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?n.value[d]=o[d]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>kn(g,r,bn())),input:d,path:[d],inst:e});continue}const h=t.valueType._zod.run({value:o[d],issues:[]},r);h instanceof Promise?i.push(h.then(g=>{g.issues.length&&n.issues.push(...Yn(d,g.issues)),n.value[l.value]=g.value})):(h.issues.length&&n.issues.push(...Yn(d,h.issues)),n.value[l.value]=h.value)}}return i.length?Promise.all(i).then(()=>n):n}}),yh=x("$ZodEnum",(e,t)=>{me.init(e,t);const n=nc(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>zd.has(typeof o)).map(o=>typeof o=="string"?ar(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}}),wh=x("$ZodLiteral",(e,t)=>{if(me.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ar(r):r?ar(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}}),xh=x("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ec(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 nr;return n.value=o,n}});function Vi(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const vc=x("$ZodOptional",(e,t)=>{me.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(`^(${Vs(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=>Vi(i,n.value)):Vi(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Sh=x("$ZodExactOptional",(e,t)=>{vc.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)}),Th=x("$ZodNullable",(e,t)=>{me.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(`^(${Vs(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)}),Eh=x("$ZodDefault",(e,t)=>{me.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=>Yi(i,t)):Yi(o,t)}});function Yi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Ch=x("$ZodPrefault",(e,t)=>{me.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))}),Ah=x("$ZodNonOptional",(e,t)=>{me.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=>Xi(i,e)):Xi(o,e)}});function Xi(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 Ph=x("$ZodCatch",(e,t)=>{me.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=>kn(a,r,bn()))},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=>kn(i,r,bn()))},input:n.value})),n.issues=[]),n)}}),Rh=x("$ZodPipe",(e,t)=>{me.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=>po(a,t.in,r)):po(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>po(i,t.out,r)):po(o,t.out,r)}});function po(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const Lh=x("$ZodReadonly",(e,t)=>{me.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(Ki):Ki(o)}});function Ki(e){return e.value=Object.freeze(e.value),e}const zh=x("$ZodCustom",(e,t)=>{at.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Qi(i,n,r,e));Qi(o,n,r,e)}});function Qi(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(Zr(i))}}var ea;class Ih{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 $h(){return new Ih}var Wa;(Wa=(ea=globalThis).__zod_globalRegistry)!=null||(ea.__zod_globalRegistry=$h());const zr=globalThis.__zod_globalRegistry;function Oh(e,t){return new e(y({type:"string"},U(t)))}function Nh(e,t){return new e(y({type:"string",format:"email",check:"string_format",abort:!1},U(t)))}function ta(e,t){return new e(y({type:"string",format:"guid",check:"string_format",abort:!1},U(t)))}function Dh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1},U(t)))}function Mh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4"},U(t)))}function jh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6"},U(t)))}function Uh(e,t){return new e(y({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7"},U(t)))}function Zh(e,t){return new e(y({type:"string",format:"url",check:"string_format",abort:!1},U(t)))}function qh(e,t){return new e(y({type:"string",format:"emoji",check:"string_format",abort:!1},U(t)))}function Hh(e,t){return new e(y({type:"string",format:"nanoid",check:"string_format",abort:!1},U(t)))}function Fh(e,t){return new e(y({type:"string",format:"cuid",check:"string_format",abort:!1},U(t)))}function Bh(e,t){return new e(y({type:"string",format:"cuid2",check:"string_format",abort:!1},U(t)))}function Gh(e,t){return new e(y({type:"string",format:"ulid",check:"string_format",abort:!1},U(t)))}function Wh(e,t){return new e(y({type:"string",format:"xid",check:"string_format",abort:!1},U(t)))}function Jh(e,t){return new e(y({type:"string",format:"ksuid",check:"string_format",abort:!1},U(t)))}function Vh(e,t){return new e(y({type:"string",format:"ipv4",check:"string_format",abort:!1},U(t)))}function Yh(e,t){return new e(y({type:"string",format:"ipv6",check:"string_format",abort:!1},U(t)))}function Xh(e,t){return new e(y({type:"string",format:"cidrv4",check:"string_format",abort:!1},U(t)))}function Kh(e,t){return new e(y({type:"string",format:"cidrv6",check:"string_format",abort:!1},U(t)))}function Qh(e,t){return new e(y({type:"string",format:"base64",check:"string_format",abort:!1},U(t)))}function ef(e,t){return new e(y({type:"string",format:"base64url",check:"string_format",abort:!1},U(t)))}function tf(e,t){return new e(y({type:"string",format:"e164",check:"string_format",abort:!1},U(t)))}function nf(e,t){return new e(y({type:"string",format:"jwt",check:"string_format",abort:!1},U(t)))}function rf(e,t){return new e(y({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null},U(t)))}function of(e,t){return new e(y({type:"string",format:"date",check:"string_format"},U(t)))}function sf(e,t){return new e(y({type:"string",format:"time",check:"string_format",precision:null},U(t)))}function af(e,t){return new e(y({type:"string",format:"duration",check:"string_format"},U(t)))}function cf(e,t){return new e(y({type:"number",checks:[]},U(t)))}function lf(e,t){return new e(y({type:"number",check:"number_format",abort:!1,format:"safeint"},U(t)))}function uf(e,t){return new e(y({type:"boolean"},U(t)))}function df(e){return new e({type:"any"})}function pf(e){return new e({type:"unknown"})}function hf(e,t){return new e(y({type:"never"},U(t)))}function na(e,t){return new hc(D(y({check:"less_than"},U(t)),{value:e,inclusive:!1}))}function ks(e,t){return new hc(D(y({check:"less_than"},U(t)),{value:e,inclusive:!0}))}function ra(e,t){return new fc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!1}))}function _s(e,t){return new fc(D(y({check:"greater_than"},U(t)),{value:e,inclusive:!0}))}function oa(e,t){return new Tp(D(y({check:"multiple_of"},U(t)),{value:e}))}function yc(e,t){return new Cp(D(y({check:"max_length"},U(t)),{maximum:e}))}function Do(e,t){return new Ap(D(y({check:"min_length"},U(t)),{minimum:e}))}function wc(e,t){return new Pp(D(y({check:"length_equals"},U(t)),{length:e}))}function ff(e,t){return new Rp(D(y({check:"string_format",format:"regex"},U(t)),{pattern:e}))}function gf(e){return new Lp(y({check:"string_format",format:"lowercase"},U(e)))}function mf(e){return new zp(y({check:"string_format",format:"uppercase"},U(e)))}function bf(e,t){return new Ip(D(y({check:"string_format",format:"includes"},U(t)),{includes:e}))}function kf(e,t){return new $p(D(y({check:"string_format",format:"starts_with"},U(t)),{prefix:e}))}function _f(e,t){return new Op(D(y({check:"string_format",format:"ends_with"},U(t)),{suffix:e}))}function dr(e){return new Np({check:"overwrite",tx:e})}function vf(e){return dr(t=>t.normalize(e))}function yf(){return dr(e=>e.trim())}function wf(){return dr(e=>e.toLowerCase())}function xf(){return dr(e=>e.toUpperCase())}function Sf(){return dr(e=>Rd(e))}function Tf(e,t,n){return new e(y({type:"array",element:t},U(n)))}function Ef(e,t,n){return new e(y({type:"custom",check:"custom",fn:t},U(n)))}function Cf(e){const t=Af(n=>(n.addIssue=r=>{var o,i,a,d;if(typeof r=="string")n.issues.push(Zr(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(Zr(l))}},e(n.value,n)));return t}function Af(e,t){const n=new at(y({check:"custom"},U(t)));return n._zod.check=e,n}function xc(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:zr,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 Le(e,t,n={path:[],schemaPath:[]}){var h,g,m;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const d=(g=(h=e._zod).toJSONSchema)==null?void 0:g.call(h);if(d)a.schema=d;else{const k=D(y({},n),{schemaPath:[...n.schemaPath,e],path:n.path});if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,k);else{const v=a.schema,Z=t.processors[o.type];if(!Z)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);Z(e,t,v,k)}const w=e._zod.parent;w&&(a.ref||(a.ref=w),Le(w,t,k),t.seen.get(w).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&Qe(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((m=(r=a.schema).default)!=null||(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Sc(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 g=(a=e.metadataRegistry.get(h[0]))==null?void 0:a.id;if(g){const m=r.get(g);if(m&&m!==h[0])throw new Error(`Duplicate schema id "${g}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(g,h[0])}}const o=h=>{var v,Z,K,M,E;const g=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const T=(v=e.external.registry.get(h[0]))==null?void 0:v.id,C=(Z=e.external.uri)!=null?Z:(J=>J);if(T)return{ref:C(T)};const N=(M=(K=h[1].defId)!=null?K:h[1].schema.id)!=null?M:`schema${e.counter++}`;return h[1].defId=N,{defId:N,ref:`${C("__shared")}#/${g}/${N}`}}if(h[1]===n)return{ref:"#"};const k=`#/${g}/`,w=(E=h[1].schema.id)!=null?E:`__schema${e.counter++}`;return{defId:w,ref:k+w}},i=h=>{if(h[1].schema.$ref)return;const g=h[1],{ref:m,defId:k}=o(h);g.def=y({},g.schema),k&&(g.defId=k);const w=g.schema;for(const v in w)delete w[v];w.$ref=m};if(e.cycles==="throw")for(const h of e.seen.entries()){const g=h[1];if(g.cycle)throw new Error(`Cycle detected: #/${(d=g.cycle)==null?void 0:d.join("/")}/<root>
1510
1510
 
1511
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(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(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function Tc(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=g=>{var K,M,E;const m=e.seen.get(g);if(m.ref===null)return;const k=(K=m.def)!=null?K:m.schema,w=y({},k),v=m.ref;if(m.ref=null,v){r(v);const T=e.seen.get(v),C=T.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,w),g._zod.parent===v)for(const J in k)J==="$ref"||J==="allOf"||J in w||delete k[J];if(C.$ref)for(const J in k)J==="$ref"||J==="allOf"||J in T.def&&JSON.stringify(k[J])===JSON.stringify(T.def[J])&&delete k[J]}const Z=g._zod.parent;if(Z&&Z!==v){r(Z);const T=e.seen.get(Z);if(T!=null&&T.schema.$ref&&(k.$ref=T.schema.$ref,T.def))for(const C in k)C==="$ref"||C==="allOf"||C in T.def&&JSON.stringify(k[C])===JSON.stringify(T.def[C])&&delete k[C]}e.override({zodSchema:g,jsonSchema:k,path:(E=m.path)!=null?E:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(l=n.def)!=null?l:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:D(y({},t["~standard"]),{jsonSchema:{input:Mo(t,"input",e.processors),output:Mo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Qe(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 Qe(r.element,n);if(r.type==="set")return Qe(r.valueType,n);if(r.type==="lazy")return Qe(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 Qe(r.innerType,n);if(r.type==="intersection")return Qe(r.left,n)||Qe(r.right,n);if(r.type==="record"||r.type==="map")return Qe(r.keyType,n)||Qe(r.valueType,n);if(r.type==="pipe")return Qe(r.in,n)||Qe(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Qe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Qe(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Qe(o,n))return!0;return!!(r.rest&&Qe(r.rest,n))}return!1}const Af=(e,t={})=>n=>{const r=xc(D(y({},n),{processors:t}));return Le(e,r),Sc(r,e),Tc(r,e)},Mo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=xc(D(y({},o!=null?o:{}),{target:i,io:t,processors:n}));return Le(e,a),Sc(a,e),Tc(a,e)},Pf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Rf=(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=Pf[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const g=[...l];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>D(y({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},Lf=(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)},zf=(e,t,n,r)=>{n.type="boolean"},If=(e,t,n,r)=>{n.not={}},$f=(e,t,n,r)=>{},Of=(e,t,n,r)=>{},Nf=(e,t,n,r)=>{const o=e._zod.def,i=nc(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Df=(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},Mf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},jf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Uf=(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=Le(i.element,t,D(y({},r),{path:[...r.path,"items"]}))},Zf=(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]=Le(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 g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.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=Le(i.catchall,t,D(y({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},qf=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Le(d,t,D(y({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Hf=(e,t,n,r)=>{const o=e._zod.def,i=Le(o.left,t,D(y({},r),{path:[...r.path,"allOf",0]})),a=Le(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},Ff=(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=Le(i.valueType,t,D(y({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of l)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Le(i.keyType,t,D(y({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Le(i.valueType,t,D(y({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},Bf=(e,t,n,r)=>{const o=e._zod.def,i=Le(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"}]},Gf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Wf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Jf=(e,t,n,r)=>{const o=e._zod.def;Le(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)))},Vf=(e,t,n,r)=>{const o=e._zod.def;Le(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},Yf=(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;Le(i,t,r);const a=t.seen.get(e);a.ref=i},Xf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Ec=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Kf=x("ZodISODateTime",(e,t)=>{Vp.init(e,t),ve.init(e,t)});function Qf(e){return nf(Kf,e)}const eg=x("ZodISODate",(e,t)=>{Yp.init(e,t),ve.init(e,t)});function tg(e){return rf(eg,e)}const ng=x("ZodISOTime",(e,t)=>{Xp.init(e,t),ve.init(e,t)});function rg(e){return of(ng,e)}const og=x("ZodISODuration",(e,t)=>{Kp.init(e,t),ve.init(e,t)});function sg(e){return sf(og,e)}const ig=(e,t)=>{ic.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>qd(e,n)},flatten:{value:n=>Zd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ls,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ls,2)}},isEmpty:{get(){return e.issues.length===0}}})},_t=x("ZodError",ig,{Parent:Error}),ag=Xs(_t),cg=Ks(_t),lg=Qo(_t),ug=es(_t),dg=Bd(_t),pg=Gd(_t),hg=Wd(_t),fg=Jd(_t),gg=Vd(_t),mg=Yd(_t),bg=Xd(_t),kg=Kd(_t),ke=x("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Mo(e,"input"),output:Mo(e,"output")}}),e.toJSONSchema=Af(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(_n(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)=>vn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>ag(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>lg(e,n,r),e.parseAsync=(n,r)=>z(null,null,function*(){return cg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>z(null,null,function*(){return ug(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>dg(e,n,r),e.decode=(n,r)=>pg(e,n,r),e.encodeAsync=(n,r)=>z(null,null,function*(){return hg(e,n,r)}),e.decodeAsync=(n,r)=>z(null,null,function*(){return fg(e,n,r)}),e.safeEncode=(n,r)=>gg(e,n,r),e.safeDecode=(n,r)=>mg(e,n,r),e.safeEncodeAsync=(n,r)=>z(null,null,function*(){return bg(e,n,r)}),e.safeDecodeAsync=(n,r)=>z(null,null,function*(){return kg(e,n,r)}),e.refine=(n,r)=>e.check(hm(n,r)),e.superRefine=n=>e.check(fm(n)),e.overwrite=n=>e.check(dr(n)),e.optional=()=>ca(e),e.exactOptional=()=>em(e),e.nullable=()=>la(e),e.nullish=()=>ca(la(e)),e.nonoptional=n=>im(e,n),e.array=()=>ct(e),e.or=n=>Bg([e,n]),e.and=n=>Jg(e,n),e.transform=n=>ua(e,Kg(n)),e.default=n=>rm(e,n),e.prefault=n=>sm(e,n),e.catch=n=>cm(e,n),e.pipe=n=>ua(e,n),e.readonly=()=>dm(e),e.describe=n=>{const r=e.clone();return zr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=zr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return zr.get(e);const r=e.clone();return zr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Cc=x("_ZodString",(e,t)=>{var r,o,i;Qs.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Rf(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(hf(...a)),e.includes=(...a)=>e.check(mf(...a)),e.startsWith=(...a)=>e.check(bf(...a)),e.endsWith=(...a)=>e.check(kf(...a)),e.min=(...a)=>e.check(Do(...a)),e.max=(...a)=>e.check(yc(...a)),e.length=(...a)=>e.check(wc(...a)),e.nonempty=(...a)=>e.check(Do(1,...a)),e.lowercase=a=>e.check(ff(a)),e.uppercase=a=>e.check(gf(a)),e.trim=()=>e.check(vf()),e.normalize=(...a)=>e.check(_f(...a)),e.toLowerCase=()=>e.check(yf()),e.toUpperCase=()=>e.check(wf()),e.slugify=()=>e.check(xf())}),_g=x("ZodString",(e,t)=>{Qs.init(e,t),Cc.init(e,t),e.email=n=>e.check(Oh(vg,n)),e.url=n=>e.check(Uh(yg,n)),e.jwt=n=>e.check(tf(Ng,n)),e.emoji=n=>e.check(Zh(wg,n)),e.guid=n=>e.check(ta(sa,n)),e.uuid=n=>e.check(Nh(ho,n)),e.uuidv4=n=>e.check(Dh(ho,n)),e.uuidv6=n=>e.check(Mh(ho,n)),e.uuidv7=n=>e.check(jh(ho,n)),e.nanoid=n=>e.check(qh(xg,n)),e.guid=n=>e.check(ta(sa,n)),e.cuid=n=>e.check(Hh(Sg,n)),e.cuid2=n=>e.check(Fh(Tg,n)),e.ulid=n=>e.check(Bh(Eg,n)),e.base64=n=>e.check(Kh(Ig,n)),e.base64url=n=>e.check(Qh($g,n)),e.xid=n=>e.check(Gh(Cg,n)),e.ksuid=n=>e.check(Wh(Ag,n)),e.ipv4=n=>e.check(Jh(Pg,n)),e.ipv6=n=>e.check(Vh(Rg,n)),e.cidrv4=n=>e.check(Yh(Lg,n)),e.cidrv6=n=>e.check(Xh(zg,n)),e.e164=n=>e.check(ef(Og,n)),e.datetime=n=>e.check(Qf(n)),e.date=n=>e.check(tg(n)),e.time=n=>e.check(rg(n)),e.duration=n=>e.check(sg(n))});function P(e){return $h(_g,e)}const ve=x("ZodStringFormat",(e,t)=>{be.init(e,t),Cc.init(e,t)}),vg=x("ZodEmail",(e,t)=>{Up.init(e,t),ve.init(e,t)}),sa=x("ZodGUID",(e,t)=>{Mp.init(e,t),ve.init(e,t)}),ho=x("ZodUUID",(e,t)=>{jp.init(e,t),ve.init(e,t)}),yg=x("ZodURL",(e,t)=>{Zp.init(e,t),ve.init(e,t)}),wg=x("ZodEmoji",(e,t)=>{qp.init(e,t),ve.init(e,t)}),xg=x("ZodNanoID",(e,t)=>{Hp.init(e,t),ve.init(e,t)}),Sg=x("ZodCUID",(e,t)=>{Fp.init(e,t),ve.init(e,t)}),Tg=x("ZodCUID2",(e,t)=>{Bp.init(e,t),ve.init(e,t)}),Eg=x("ZodULID",(e,t)=>{Gp.init(e,t),ve.init(e,t)}),Cg=x("ZodXID",(e,t)=>{Wp.init(e,t),ve.init(e,t)}),Ag=x("ZodKSUID",(e,t)=>{Jp.init(e,t),ve.init(e,t)}),Pg=x("ZodIPv4",(e,t)=>{Qp.init(e,t),ve.init(e,t)}),Rg=x("ZodIPv6",(e,t)=>{eh.init(e,t),ve.init(e,t)}),Lg=x("ZodCIDRv4",(e,t)=>{th.init(e,t),ve.init(e,t)}),zg=x("ZodCIDRv6",(e,t)=>{nh.init(e,t),ve.init(e,t)}),Ig=x("ZodBase64",(e,t)=>{rh.init(e,t),ve.init(e,t)}),$g=x("ZodBase64URL",(e,t)=>{sh.init(e,t),ve.init(e,t)}),Og=x("ZodE164",(e,t)=>{ih.init(e,t),ve.init(e,t)}),Ng=x("ZodJWT",(e,t)=>{ch.init(e,t),ve.init(e,t)}),Ac=x("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,g;mc.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,w)=>Lf(e,m,k),e.gt=(m,k)=>e.check(ra(m,k)),e.gte=(m,k)=>e.check(_s(m,k)),e.min=(m,k)=>e.check(_s(m,k)),e.lt=(m,k)=>e.check(na(m,k)),e.lte=(m,k)=>e.check(ks(m,k)),e.max=(m,k)=>e.check(ks(m,k)),e.int=m=>e.check(ia(m)),e.safe=m=>e.check(ia(m)),e.positive=m=>e.check(ra(0,m)),e.nonnegative=m=>e.check(_s(0,m)),e.negative=m=>e.check(na(0,m)),e.nonpositive=m=>e.check(ks(0,m)),e.multipleOf=(m,k)=>e.check(oa(m,k)),e.step=(m,k)=>e.check(oa(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(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=(g=n.format)!=null?g:null});function qt(e){return af(Ac,e)}const Dg=x("ZodNumberFormat",(e,t)=>{lh.init(e,t),Ac.init(e,t)});function ia(e){return cf(Dg,e)}const Mg=x("ZodBoolean",(e,t)=>{uh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zf(e,n,r)});function fe(e){return lf(Mg,e)}const jg=x("ZodAny",(e,t)=>{dh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f()});function Pc(){return uf(jg)}const Ug=x("ZodUnknown",(e,t)=>{ph.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of()});function aa(){return df(Ug)}const Zg=x("ZodNever",(e,t)=>{hh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(e,n,r)});function qg(e){return pf(Zg,e)}const Hg=x("ZodArray",(e,t)=>{fh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Do(n,r)),e.nonempty=n=>e.check(Do(1,n)),e.max=(n,r)=>e.check(yc(n,r)),e.length=(n,r)=>e.check(wc(n,r)),e.unwrap=()=>e.element});function ct(e,t){return Sf(Hg,e,t)}const Fg=x("ZodObject",(e,t)=>{mh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>mt(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:aa()})),e.loose=()=>e.clone(D(y({},e._zod.def),{catchall:aa()})),e.strict=()=>e.clone(D(y({},e._zod.def),{catchall:qg()})),e.strip=()=>e.clone(D(y({},e._zod.def),{catchall:void 0})),e.extend=n=>Nd(e,n),e.safeExtend=n=>Dd(e,n),e.merge=n=>Md(e,n),e.pick=n=>$d(e,n),e.omit=n=>Od(e,n),e.partial=(...n)=>jd(zc,e,n[0]),e.required=(...n)=>Ud(Ic,e,n[0])});function he(e,t){const n=y({type:"object",shape:e!=null?e:{}},U(t));return new Fg(n)}const Rc=x("ZodUnion",(e,t)=>{_c.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),e.options=t.options});function Bg(e,t){return new Rc(y({type:"union",options:e},U(t)))}const Gg=x("ZodDiscriminatedUnion",(e,t)=>{Rc.init(e,t),bh.init(e,t)});function Lc(e,t,n){return new Gg(y({type:"union",options:t,discriminator:e},U(n)))}const Wg=x("ZodIntersection",(e,t)=>{kh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o)});function Jg(e,t){return new Wg({type:"intersection",left:e,right:t})}const Vg=x("ZodRecord",(e,t)=>{_h.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function jt(e,t,n){return new Vg(y({type:"record",keyType:e,valueType:t},U(n)))}const Is=x("ZodEnum",(e,t)=>{vh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Nf(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 Is(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 Is(D(y(D(y({},t),{checks:[]}),U(o)),{entries:i}))}});function mt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Is(y({type:"enum",entries:n},U(t)))}const Yg=x("ZodLiteral",(e,t)=>{yh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Df(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 gt(e,t){return new Yg(y({type:"literal",values:Array.isArray(e)?e:[e]},U(t)))}const Xg=x("ZodTransform",(e,t)=>{wh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ec(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Zr(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(Zr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Kg(e){return new Xg({type:"transform",transform:e})}const zc=x("ZodOptional",(e,t)=>{vc.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ec(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ca(e){return new zc({type:"optional",innerType:e})}const Qg=x("ZodExactOptional",(e,t)=>{xh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ec(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function em(e){return new Qg({type:"optional",innerType:e})}const tm=x("ZodNullable",(e,t)=>{Sh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function la(e){return new tm({type:"nullable",innerType:e})}const nm=x("ZodDefault",(e,t)=>{Th.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rm(e,t){return new nm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():oc(t)}})}const om=x("ZodPrefault",(e,t)=>{Eh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function sm(e,t){return new om({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():oc(t)}})}const Ic=x("ZodNonOptional",(e,t)=>{Ch.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function im(e,t){return new Ic(y({type:"nonoptional",innerType:e},U(t)))}const am=x("ZodCatch",(e,t)=>{Ah.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cm(e,t){return new am({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const lm=x("ZodPipe",(e,t)=>{Ph.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yf(e,n,r,o),e.in=t.in,e.out=t.out});function ua(e,t){return new lm({type:"pipe",in:e,out:t})}const um=x("ZodReadonly",(e,t)=>{Rh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function dm(e){return new um({type:"readonly",innerType:e})}const pm=x("ZodCustom",(e,t)=>{Lh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(e,n)});function hm(e,t={}){return Tf(pm,e,t)}function fm(e){return Ef(e)}const gm=he({name:P().min(1).max(100).optional(),command:P().min(1).max(500),args:ct(P()).optional(),failOnError:fe().default(!0).optional(),timeout:qt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:P().optional(),env:jt(P(),P()).optional(),runOnBackground:fe().optional(),agentTags:ct(P()).optional()});he({name:P(),command:P(),success:fe(),exitCode:qt().optional(),stdout:P().optional(),stderr:P().optional(),error:P().optional(),duration:qt(),failOnError:fe()});const En=he({path:P(),extraCommands:ct(gm).optional(),id:P().uuid().optional(),rotationKey:P().optional(),usageStatus:mt(["free","in_use"]).optional(),agentTags:ct(P()).optional()}),mm=Lc("operation",[En.extend({operation:gt("create"),content:P().optional(),contentPath:P().optional(),encoding:mt(["utf-8","base64"]).optional()}),En.extend({operation:gt("merge"),data:jt(P(),Pc()),mergeStrategy:mt(["deep","shallow"]).optional(),arrayMergeStrategy:mt(["concat","replace"]).optional()}),En.extend({operation:gt("modify"),content:P().optional(),contentPath:P().optional(),createIfMissing:fe().optional()}),En.extend({operation:gt("delete"),ignoreIfMissing:fe().optional()}),En.extend({operation:gt("createDirectory"),contentPath:P().optional(),mode:qt().optional(),ignoreIfExists:fe().optional()}),En.extend({operation:gt("download"),url:P().url(),headers:jt(P(),P()).optional(),timeout:qt().min(1e3).max(3e5).optional()}),En.extend({operation:gt("gitClone"),gitUrl:P(),gitSecretKey:P().optional(),sourceBranch:P().optional(),targetBranch:P().optional(),originalBranch:P().optional(),defaultBranch:P().optional()})]);var Ee=(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))(Ee||{});const bm=he({type:mt(["json","file","regex"]).describe("Extraction method"),source:P().describe("Source to extract from (file path or stdout/stderr)"),schema:he({}).passthrough().optional().describe("JSON schema for validation"),pattern:P().optional().describe("Regex pattern for extraction")}),km=he({type:mt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Pc().describe("Hook-specific configuration")});he({command:P().optional().describe("Legacy — unused in SDK mode"),args:ct(P()).optional().describe("Legacy — unused in SDK mode"),env:jt(P(),P()).optional().describe("Environment variables"),workingDirectory:P().optional().describe("Working directory for command execution"),fileOperations:ct(mm).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:bm.optional().describe("Schema for extracting result data"),postExecutionHooks:ct(km).optional().describe("Hooks to run after task completion"),executionMode:mt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Lc("executionMode",[he({executionMode:gt("claudeAgentSdk"),promptText:P(),sdkOptions:he({model:P(),permissionMode:mt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ct(P()),allowDangerouslySkipPermissions:fe(),persistSession:fe(),streamSdkEvents:fe().optional(),allowedTools:ct(P()).optional(),settings:he({enabledPlugins:jt(P(),fe())}),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("opencodeSdk"),promptText:P(),sdkOptions:he({provider:P(),model:P(),allowedTools:ct(P()).optional(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("openaiAgentSdk"),promptText:P(),sdkOptions:he({model:P(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("codexSdk"),promptText:P(),sdkOptions:he({model:P().optional(),sandboxMode:mt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:mt(["never","on-request","on-failure","untrusted"]).optional(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("cursorSdk"),promptText:P(),sdkOptions:he({model:P(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:fe().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:P().optional().describe("Final approved plan content"),planApproved:fe().optional().describe("Plan approval status"),planApprovedAt:P().optional().describe("ISO timestamp of approval"),planRejected:fe().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:ct(he({feedback:P(),rejectedAt:P()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:qt().optional(),notificationChannelPlanMessageSentAt:P().optional(),notificationChannelCompletedMessageId:qt().optional(),notificationChannelFailedMessageId:qt().optional(),streamSdkEvents:fe().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:fe().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ct(he({id:P(),selectedText:P(),startOffset:qt(),endOffset:qt(),commentText:P(),createdAt:P()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:fe().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:fe().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:mt(["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:fe().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")});Ee.PENDING+"",Ee.CANCELLED,Ee.ASSIGNED+"",Ee.CANCELLED,Ee.IN_PROGRESS+"",Ee.CANCELLED,Ee.FAILED,Ee.WAITING_FOR_INPUT+"",Ee.CANCELLED,Ee.WAITING_FOR_PLAN_APPROVAL+"",Ee.CANCELLED,Ee.PLAN_APPROVED+"",Ee.CANCELLED,Ee.PLAN_REJECTED+"",Ee.CANCELLED,Ee.COMPLETED+"",Ee.RESULT_REJECTED+"",Ee.CANCELLED,Ee.FAILED+"",Ee.CANCELLED+"";const $c="browser_capture",_m="browser_automate";function da(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 vm(e,t){const n=da(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===da(r)}function pa(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:[])vm(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}class Oc extends Error{}function Nc(e){return z(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`})),n=t.message||t.error||`HTTP ${e.status}`;throw e.status===401?new Oc(n):new Error(n)}return e.json()})}const ym=3e4;function jo(r){return z(this,arguments,function*(e,t={},n=ym){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 Fe(e,t,n,r){return z(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield jo(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Nc(a)})}function wm(e,t){return z(this,null,function*(){return Fe(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const xm=["project","note","ctx"];function Sm(e){var n,r;const t=xm.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 $s(e,t){return z(this,null,function*(){var h,g,m,k,w,v;Sm(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:l,type:p=$c}=t;return Fe(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}:{}),(g=i==null?void 0:i.selectedSkillIds)!=null&&g.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(w=i==null?void 0:i.selectedSlashCommandIds)!=null&&w.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(v=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&v.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 ha(e,t){return z(this,null,function*(){return $s(e,D(y({},t),{type:_m}))})}function fa(e,t,n,r){return z(this,null,function*(){var o;return Fe(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 Tm(e,t){return z(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Fe(e,"GET",`/claude-templates${n}`)})}function Dc(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}`)})}function Em(e,t){return z(this,null,function*(){return Fe(e,"GET",`/planning-sessions/${t}`)})}function ga(e){return z(this,null,function*(){return Fe(e,"GET","/projects")})}function Cm(e){return z(this,null,function*(){return(yield Fe(e,"GET","/tenants/current")).membership})}function ma(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Os(e,t,n){return z(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield jo(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Nc(i)})}function Am(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Pm(e,t,n,r,o){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function Rm(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}/chunks`)})}function Lm(e,t,n){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function zm(e,t){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/cancel`)})}function Im(e,t){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/approve-result`)})}function $m(e,t,n){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Uo(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function Mc(e,t,n,r){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Om(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vs={exports:{}};/*!
1511
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const h of e.seen.entries()){const g=h[1];if(t===h[0]){i(h);continue}if(e.external){const k=(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(g.cycle){i(h);continue}if(g.count>1&&e.reused==="ref"){i(h);continue}}}function Tc(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=g=>{var K,M,E;const m=e.seen.get(g);if(m.ref===null)return;const k=(K=m.def)!=null?K:m.schema,w=y({},k),v=m.ref;if(m.ref=null,v){r(v);const T=e.seen.get(v),C=T.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,w),g._zod.parent===v)for(const J in k)J==="$ref"||J==="allOf"||J in w||delete k[J];if(C.$ref)for(const J in k)J==="$ref"||J==="allOf"||J in T.def&&JSON.stringify(k[J])===JSON.stringify(T.def[J])&&delete k[J]}const Z=g._zod.parent;if(Z&&Z!==v){r(Z);const T=e.seen.get(Z);if(T!=null&&T.schema.$ref&&(k.$ref=T.schema.$ref,T.def))for(const C in k)C==="$ref"||C==="allOf"||C in T.def&&JSON.stringify(k[C])===JSON.stringify(T.def[C])&&delete k[C]}e.override({zodSchema:g,jsonSchema:k,path:(E=m.path)!=null?E:[]})};for(const g of[...e.seen.entries()].reverse())r(g[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(a=e.external)!=null&&a.uri){const g=(d=e.external.registry.get(t))==null?void 0:d.id;if(!g)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(g)}Object.assign(o,(l=n.def)!=null?l:n.schema);const i=(h=(p=e.external)==null?void 0:p.defs)!=null?h:{};for(const g of e.seen.entries()){const m=g[1];m.def&&m.defId&&(i[m.defId]=m.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const g=JSON.parse(JSON.stringify(o));return Object.defineProperty(g,"~standard",{value:D(y({},t["~standard"]),{jsonSchema:{input:Mo(t,"input",e.processors),output:Mo(t,"output",e.processors)}}),enumerable:!1,writable:!1}),g}catch(g){throw new Error("Error converting schema to JSON.")}}function Qe(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 Qe(r.element,n);if(r.type==="set")return Qe(r.valueType,n);if(r.type==="lazy")return Qe(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 Qe(r.innerType,n);if(r.type==="intersection")return Qe(r.left,n)||Qe(r.right,n);if(r.type==="record"||r.type==="map")return Qe(r.keyType,n)||Qe(r.valueType,n);if(r.type==="pipe")return Qe(r.in,n)||Qe(r.out,n);if(r.type==="object"){for(const o in r.shape)if(Qe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(Qe(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(Qe(o,n))return!0;return!!(r.rest&&Qe(r.rest,n))}return!1}const Pf=(e,t={})=>n=>{const r=xc(D(y({},n),{processors:t}));return Le(e,r),Sc(r,e),Tc(r,e)},Mo=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r!=null?r:{},a=xc(D(y({},o!=null?o:{}),{target:i,io:t,processors:n}));return Le(e,a),Sc(a,e),Tc(a,e)},Rf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Lf=(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=Rf[d])!=null?h:d,o.format===""&&delete o.format,d==="time"&&delete o.format),p&&(o.contentEncoding=p),l&&l.size>0){const g=[...l];g.length===1?o.pattern=g[0].source:g.length>1&&(o.allOf=[...g.map(m=>D(y({},t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{}),{pattern:m.source}))])}},zf=(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)},If=(e,t,n,r)=>{n.type="boolean"},$f=(e,t,n,r)=>{n.not={}},Of=(e,t,n,r)=>{},Nf=(e,t,n,r)=>{},Df=(e,t,n,r)=>{const o=e._zod.def,i=nc(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Mf=(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},jf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Uf=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Zf=(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=Le(i.element,t,D(y({},r),{path:[...r.path,"items"]}))},qf=(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]=Le(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 g=i.shape[h]._zod;return t.io==="input"?g.optin===void 0:g.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=Le(i.catchall,t,D(y({},r),{path:[...r.path,"additionalProperties"]}))):t.io==="output"&&(o.additionalProperties=!1)},Hf=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((d,l)=>Le(d,t,D(y({},r),{path:[...r.path,i?"oneOf":"anyOf",l]})));i?n.oneOf=a:n.anyOf=a},Ff=(e,t,n,r)=>{const o=e._zod.def,i=Le(o.left,t,D(y({},r),{path:[...r.path,"allOf",0]})),a=Le(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},Bf=(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=Le(i.valueType,t,D(y({},r),{path:[...r.path,"patternProperties","*"]}));o.patternProperties={};for(const g of l)o.patternProperties[g.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Le(i.keyType,t,D(y({},r),{path:[...r.path,"propertyNames"]}))),o.additionalProperties=Le(i.valueType,t,D(y({},r),{path:[...r.path,"additionalProperties"]}));const p=a._zod.values;if(p){const h=[...p].filter(g=>typeof g=="string"||typeof g=="number");h.length>0&&(o.required=h)}},Gf=(e,t,n,r)=>{const o=e._zod.def,i=Le(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"}]},Wf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Jf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Vf=(e,t,n,r)=>{const o=e._zod.def;Le(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)))},Yf=(e,t,n,r)=>{const o=e._zod.def;Le(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},Xf=(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;Le(i,t,r);const a=t.seen.get(e);a.ref=i},Kf=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Ec=(e,t,n,r)=>{const o=e._zod.def;Le(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Qf=x("ZodISODateTime",(e,t)=>{Yp.init(e,t),ve.init(e,t)});function eg(e){return rf(Qf,e)}const tg=x("ZodISODate",(e,t)=>{Xp.init(e,t),ve.init(e,t)});function ng(e){return of(tg,e)}const rg=x("ZodISOTime",(e,t)=>{Kp.init(e,t),ve.init(e,t)});function og(e){return sf(rg,e)}const sg=x("ZodISODuration",(e,t)=>{Qp.init(e,t),ve.init(e,t)});function ig(e){return af(sg,e)}const ag=(e,t)=>{ic.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Hd(e,n)},flatten:{value:n=>qd(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ls,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ls,2)}},isEmpty:{get(){return e.issues.length===0}}})},_t=x("ZodError",ag,{Parent:Error}),cg=Xs(_t),lg=Ks(_t),ug=Qo(_t),dg=es(_t),pg=Gd(_t),hg=Wd(_t),fg=Jd(_t),gg=Vd(_t),mg=Yd(_t),bg=Xd(_t),kg=Kd(_t),_g=Qd(_t),ke=x("ZodType",(e,t)=>(me.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Mo(e,"input"),output:Mo(e,"output")}}),e.toJSONSchema=Pf(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>{var r;return e.clone(_n(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)=>vn(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>cg(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>ug(e,n,r),e.parseAsync=(n,r)=>z(null,null,function*(){return lg(e,n,r,{callee:e.parseAsync})}),e.safeParseAsync=(n,r)=>z(null,null,function*(){return dg(e,n,r)}),e.spa=e.safeParseAsync,e.encode=(n,r)=>pg(e,n,r),e.decode=(n,r)=>hg(e,n,r),e.encodeAsync=(n,r)=>z(null,null,function*(){return fg(e,n,r)}),e.decodeAsync=(n,r)=>z(null,null,function*(){return gg(e,n,r)}),e.safeEncode=(n,r)=>mg(e,n,r),e.safeDecode=(n,r)=>bg(e,n,r),e.safeEncodeAsync=(n,r)=>z(null,null,function*(){return kg(e,n,r)}),e.safeDecodeAsync=(n,r)=>z(null,null,function*(){return _g(e,n,r)}),e.refine=(n,r)=>e.check(fm(n,r)),e.superRefine=n=>e.check(gm(n)),e.overwrite=n=>e.check(dr(n)),e.optional=()=>ca(e),e.exactOptional=()=>tm(e),e.nullable=()=>la(e),e.nullish=()=>ca(la(e)),e.nonoptional=n=>am(e,n),e.array=()=>ct(e),e.or=n=>Gg([e,n]),e.and=n=>Vg(e,n),e.transform=n=>ua(e,Qg(n)),e.default=n=>om(e,n),e.prefault=n=>im(e,n),e.catch=n=>lm(e,n),e.pipe=n=>ua(e,n),e.readonly=()=>pm(e),e.describe=n=>{const r=e.clone();return zr.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=zr.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return zr.get(e);const r=e.clone();return zr.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Cc=x("_ZodString",(e,t)=>{var r,o,i;Qs.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(a,d,l)=>Lf(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(ff(...a)),e.includes=(...a)=>e.check(bf(...a)),e.startsWith=(...a)=>e.check(kf(...a)),e.endsWith=(...a)=>e.check(_f(...a)),e.min=(...a)=>e.check(Do(...a)),e.max=(...a)=>e.check(yc(...a)),e.length=(...a)=>e.check(wc(...a)),e.nonempty=(...a)=>e.check(Do(1,...a)),e.lowercase=a=>e.check(gf(a)),e.uppercase=a=>e.check(mf(a)),e.trim=()=>e.check(yf()),e.normalize=(...a)=>e.check(vf(...a)),e.toLowerCase=()=>e.check(wf()),e.toUpperCase=()=>e.check(xf()),e.slugify=()=>e.check(Sf())}),vg=x("ZodString",(e,t)=>{Qs.init(e,t),Cc.init(e,t),e.email=n=>e.check(Nh(yg,n)),e.url=n=>e.check(Zh(wg,n)),e.jwt=n=>e.check(nf(Dg,n)),e.emoji=n=>e.check(qh(xg,n)),e.guid=n=>e.check(ta(sa,n)),e.uuid=n=>e.check(Dh(ho,n)),e.uuidv4=n=>e.check(Mh(ho,n)),e.uuidv6=n=>e.check(jh(ho,n)),e.uuidv7=n=>e.check(Uh(ho,n)),e.nanoid=n=>e.check(Hh(Sg,n)),e.guid=n=>e.check(ta(sa,n)),e.cuid=n=>e.check(Fh(Tg,n)),e.cuid2=n=>e.check(Bh(Eg,n)),e.ulid=n=>e.check(Gh(Cg,n)),e.base64=n=>e.check(Qh($g,n)),e.base64url=n=>e.check(ef(Og,n)),e.xid=n=>e.check(Wh(Ag,n)),e.ksuid=n=>e.check(Jh(Pg,n)),e.ipv4=n=>e.check(Vh(Rg,n)),e.ipv6=n=>e.check(Yh(Lg,n)),e.cidrv4=n=>e.check(Xh(zg,n)),e.cidrv6=n=>e.check(Kh(Ig,n)),e.e164=n=>e.check(tf(Ng,n)),e.datetime=n=>e.check(eg(n)),e.date=n=>e.check(ng(n)),e.time=n=>e.check(og(n)),e.duration=n=>e.check(ig(n))});function P(e){return Oh(vg,e)}const ve=x("ZodStringFormat",(e,t)=>{be.init(e,t),Cc.init(e,t)}),yg=x("ZodEmail",(e,t)=>{Zp.init(e,t),ve.init(e,t)}),sa=x("ZodGUID",(e,t)=>{jp.init(e,t),ve.init(e,t)}),ho=x("ZodUUID",(e,t)=>{Up.init(e,t),ve.init(e,t)}),wg=x("ZodURL",(e,t)=>{qp.init(e,t),ve.init(e,t)}),xg=x("ZodEmoji",(e,t)=>{Hp.init(e,t),ve.init(e,t)}),Sg=x("ZodNanoID",(e,t)=>{Fp.init(e,t),ve.init(e,t)}),Tg=x("ZodCUID",(e,t)=>{Bp.init(e,t),ve.init(e,t)}),Eg=x("ZodCUID2",(e,t)=>{Gp.init(e,t),ve.init(e,t)}),Cg=x("ZodULID",(e,t)=>{Wp.init(e,t),ve.init(e,t)}),Ag=x("ZodXID",(e,t)=>{Jp.init(e,t),ve.init(e,t)}),Pg=x("ZodKSUID",(e,t)=>{Vp.init(e,t),ve.init(e,t)}),Rg=x("ZodIPv4",(e,t)=>{eh.init(e,t),ve.init(e,t)}),Lg=x("ZodIPv6",(e,t)=>{th.init(e,t),ve.init(e,t)}),zg=x("ZodCIDRv4",(e,t)=>{nh.init(e,t),ve.init(e,t)}),Ig=x("ZodCIDRv6",(e,t)=>{rh.init(e,t),ve.init(e,t)}),$g=x("ZodBase64",(e,t)=>{oh.init(e,t),ve.init(e,t)}),Og=x("ZodBase64URL",(e,t)=>{ih.init(e,t),ve.init(e,t)}),Ng=x("ZodE164",(e,t)=>{ah.init(e,t),ve.init(e,t)}),Dg=x("ZodJWT",(e,t)=>{lh.init(e,t),ve.init(e,t)}),Ac=x("ZodNumber",(e,t)=>{var r,o,i,a,d,l,p,h,g;mc.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(m,k,w)=>zf(e,m,k),e.gt=(m,k)=>e.check(ra(m,k)),e.gte=(m,k)=>e.check(_s(m,k)),e.min=(m,k)=>e.check(_s(m,k)),e.lt=(m,k)=>e.check(na(m,k)),e.lte=(m,k)=>e.check(ks(m,k)),e.max=(m,k)=>e.check(ks(m,k)),e.int=m=>e.check(ia(m)),e.safe=m=>e.check(ia(m)),e.positive=m=>e.check(ra(0,m)),e.nonnegative=m=>e.check(_s(0,m)),e.negative=m=>e.check(na(0,m)),e.nonpositive=m=>e.check(ks(0,m)),e.multipleOf=(m,k)=>e.check(oa(m,k)),e.step=(m,k)=>e.check(oa(m,k)),e.finite=()=>e;const n=e._zod.bag;e.minValue=(i=Math.max((r=n.minimum)!=null?r:Number.NEGATIVE_INFINITY,(o=n.exclusiveMinimum)!=null?o:Number.NEGATIVE_INFINITY))!=null?i:null,e.maxValue=(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=(g=n.format)!=null?g:null});function qt(e){return cf(Ac,e)}const Mg=x("ZodNumberFormat",(e,t)=>{uh.init(e,t),Ac.init(e,t)});function ia(e){return lf(Mg,e)}const jg=x("ZodBoolean",(e,t)=>{dh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>If(e,n,r)});function fe(e){return uf(jg,e)}const Ug=x("ZodAny",(e,t)=>{ph.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Of()});function Pc(){return df(Ug)}const Zg=x("ZodUnknown",(e,t)=>{hh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nf()});function aa(){return pf(Zg)}const qg=x("ZodNever",(e,t)=>{fh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$f(e,n,r)});function Hg(e){return hf(qg,e)}const Fg=x("ZodArray",(e,t)=>{gh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zf(e,n,r,o),e.element=t.element,e.min=(n,r)=>e.check(Do(n,r)),e.nonempty=n=>e.check(Do(1,n)),e.max=(n,r)=>e.check(yc(n,r)),e.length=(n,r)=>e.check(wc(n,r)),e.unwrap=()=>e.element});function ct(e,t){return Tf(Fg,e,t)}const Bg=x("ZodObject",(e,t)=>{bh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qf(e,n,r,o),ne(e,"shape",()=>t.shape),e.keyof=()=>mt(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:aa()})),e.loose=()=>e.clone(D(y({},e._zod.def),{catchall:aa()})),e.strict=()=>e.clone(D(y({},e._zod.def),{catchall:Hg()})),e.strip=()=>e.clone(D(y({},e._zod.def),{catchall:void 0})),e.extend=n=>Dd(e,n),e.safeExtend=n=>Md(e,n),e.merge=n=>jd(e,n),e.pick=n=>Od(e,n),e.omit=n=>Nd(e,n),e.partial=(...n)=>Ud(zc,e,n[0]),e.required=(...n)=>Zd(Ic,e,n[0])});function he(e,t){const n=y({type:"object",shape:e!=null?e:{}},U(t));return new Bg(n)}const Rc=x("ZodUnion",(e,t)=>{_c.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hf(e,n,r,o),e.options=t.options});function Gg(e,t){return new Rc(y({type:"union",options:e},U(t)))}const Wg=x("ZodDiscriminatedUnion",(e,t)=>{Rc.init(e,t),kh.init(e,t)});function Lc(e,t,n){return new Wg(y({type:"union",options:t,discriminator:e},U(n)))}const Jg=x("ZodIntersection",(e,t)=>{_h.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ff(e,n,r,o)});function Vg(e,t){return new Jg({type:"intersection",left:e,right:t})}const Yg=x("ZodRecord",(e,t)=>{vh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bf(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function jt(e,t,n){return new Yg(y({type:"record",keyType:e,valueType:t},U(n)))}const Is=x("ZodEnum",(e,t)=>{yh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Df(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 Is(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 Is(D(y(D(y({},t),{checks:[]}),U(o)),{entries:i}))}});function mt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Is(y({type:"enum",entries:n},U(t)))}const Xg=x("ZodLiteral",(e,t)=>{wh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Mf(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 gt(e,t){return new Xg(y({type:"literal",values:Array.isArray(e)?e:[e]},U(t)))}const Kg=x("ZodTransform",(e,t)=>{xh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uf(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new ec(e.constructor.name);n.addIssue=i=>{var a,d,l;if(typeof i=="string")n.issues.push(Zr(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(Zr(p))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Qg(e){return new Kg({type:"transform",transform:e})}const zc=x("ZodOptional",(e,t)=>{vc.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ec(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ca(e){return new zc({type:"optional",innerType:e})}const em=x("ZodExactOptional",(e,t)=>{Sh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ec(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tm(e){return new em({type:"optional",innerType:e})}const nm=x("ZodNullable",(e,t)=>{Th.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function la(e){return new nm({type:"nullable",innerType:e})}const rm=x("ZodDefault",(e,t)=>{Eh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function om(e,t){return new rm({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():oc(t)}})}const sm=x("ZodPrefault",(e,t)=>{Ch.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function im(e,t){return new sm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():oc(t)}})}const Ic=x("ZodNonOptional",(e,t)=>{Ah.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function am(e,t){return new Ic(y({type:"nonoptional",innerType:e},U(t)))}const cm=x("ZodCatch",(e,t)=>{Ph.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lm(e,t){return new cm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const um=x("ZodPipe",(e,t)=>{Rh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xf(e,n,r,o),e.in=t.in,e.out=t.out});function ua(e,t){return new um({type:"pipe",in:e,out:t})}const dm=x("ZodReadonly",(e,t)=>{Lh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kf(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function pm(e){return new dm({type:"readonly",innerType:e})}const hm=x("ZodCustom",(e,t)=>{zh.init(e,t),ke.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jf(e,n)});function fm(e,t={}){return Ef(hm,e,t)}function gm(e){return Cf(e)}const mm=he({name:P().min(1).max(100).optional(),command:P().min(1).max(500),args:ct(P()).optional(),failOnError:fe().default(!0).optional(),timeout:qt().int().min(1e3).max(3e5).default(3e4).optional(),workingDirectory:P().optional(),env:jt(P(),P()).optional(),runOnBackground:fe().optional(),agentTags:ct(P()).optional()});he({name:P(),command:P(),success:fe(),exitCode:qt().optional(),stdout:P().optional(),stderr:P().optional(),error:P().optional(),duration:qt(),failOnError:fe()});const En=he({path:P(),extraCommands:ct(mm).optional(),id:P().uuid().optional(),rotationKey:P().optional(),usageStatus:mt(["free","in_use"]).optional(),agentTags:ct(P()).optional()}),bm=Lc("operation",[En.extend({operation:gt("create"),content:P().optional(),contentPath:P().optional(),encoding:mt(["utf-8","base64"]).optional()}),En.extend({operation:gt("merge"),data:jt(P(),Pc()),mergeStrategy:mt(["deep","shallow"]).optional(),arrayMergeStrategy:mt(["concat","replace"]).optional()}),En.extend({operation:gt("modify"),content:P().optional(),contentPath:P().optional(),createIfMissing:fe().optional()}),En.extend({operation:gt("delete"),ignoreIfMissing:fe().optional()}),En.extend({operation:gt("createDirectory"),contentPath:P().optional(),mode:qt().optional(),ignoreIfExists:fe().optional()}),En.extend({operation:gt("download"),url:P().url(),headers:jt(P(),P()).optional(),timeout:qt().min(1e3).max(3e5).optional()}),En.extend({operation:gt("gitClone"),gitUrl:P(),gitSecretKey:P().optional(),sourceBranch:P().optional(),targetBranch:P().optional(),originalBranch:P().optional(),defaultBranch:P().optional()})]);var Ee=(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))(Ee||{});const km=he({type:mt(["json","file","regex"]).describe("Extraction method"),source:P().describe("Source to extract from (file path or stdout/stderr)"),schema:he({}).passthrough().optional().describe("JSON schema for validation"),pattern:P().optional().describe("Regex pattern for extraction")}),_m=he({type:mt(["issue_update","bulk_issue_update","notification","webhook"]).describe("Hook type"),config:Pc().describe("Hook-specific configuration")});he({command:P().optional().describe("Legacy — unused in SDK mode"),args:ct(P()).optional().describe("Legacy — unused in SDK mode"),env:jt(P(),P()).optional().describe("Environment variables"),workingDirectory:P().optional().describe("Working directory for command execution"),fileOperations:ct(bm).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:km.optional().describe("Schema for extracting result data"),postExecutionHooks:ct(_m).optional().describe("Hooks to run after task completion"),executionMode:mt(["claudeAgentSdk","openaiAgentSdk","opencodeSdk","cursorSdk","codexSdk"]).optional().default("claudeAgentSdk").describe("Execution mode (default: claudeAgentSdk)"),executionPlan:Lc("executionMode",[he({executionMode:gt("claudeAgentSdk"),promptText:P(),sdkOptions:he({model:P(),permissionMode:mt(["plan","acceptEdits","bypassPermissions","ask"]),settingSources:ct(P()),allowDangerouslySkipPermissions:fe(),persistSession:fe(),streamSdkEvents:fe().optional(),allowedTools:ct(P()).optional(),settings:he({enabledPlugins:jt(P(),fe())}),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("opencodeSdk"),promptText:P(),sdkOptions:he({provider:P(),model:P(),allowedTools:ct(P()).optional(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("openaiAgentSdk"),promptText:P(),sdkOptions:he({model:P(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("codexSdk"),promptText:P(),sdkOptions:he({model:P().optional(),sandboxMode:mt(["read-only","workspace-write","danger-full-access"]).optional(),approvalPolicy:mt(["never","on-request","on-failure","untrusted"]).optional(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()}),he({executionMode:gt("cursorSdk"),promptText:P(),sdkOptions:he({model:P(),env:jt(P(),P()).optional()}),resume:he({sessionId:P().optional(),continue:fe()}).optional()})]).optional().describe("Backend-built prompt + resolved SDK options for this phase"),planEnabled:fe().optional().default(!1).describe("Enable planning phase (computed at runtime for agent)"),planContent:P().optional().describe("Final approved plan content"),planApproved:fe().optional().describe("Plan approval status"),planApprovedAt:P().optional().describe("ISO timestamp of approval"),planRejected:fe().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:ct(he({feedback:P(),rejectedAt:P()})).optional().describe("All rejection messages in chronological order"),notificationChannelPlanMessageId:qt().optional(),notificationChannelPlanMessageSentAt:P().optional(),notificationChannelCompletedMessageId:qt().optional(),notificationChannelFailedMessageId:qt().optional(),streamSdkEvents:fe().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:fe().optional().describe("True when planApproved was cleared for rePlan=true retry — indicates the plan had been approved before"),planComments:ct(he({id:P(),selectedText:P(),startOffset:qt(),endOffset:qt(),commentText:P(),createdAt:P()})).optional().describe("Inline review comments attached to the plan"),hasAiConfigSecrets:fe().optional().describe("True when AI Config has secret-backed env vars; agent must fetch resolved values via /tasks/:id/resolve-secrets"),hasCredentials:fe().optional().describe("True when the task has credentials attached; agent must fetch resolved values via /tasks/:id/resolve-credentials"),mcpServersMode:mt(["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:fe().optional().describe("When true, the MCP server registers browser_interact and browser_get_context (browser_automate tasks only)")});Ee.PENDING+"",Ee.CANCELLED,Ee.ASSIGNED+"",Ee.CANCELLED,Ee.IN_PROGRESS+"",Ee.CANCELLED,Ee.FAILED,Ee.WAITING_FOR_INPUT+"",Ee.CANCELLED,Ee.WAITING_FOR_PLAN_APPROVAL+"",Ee.CANCELLED,Ee.PLAN_APPROVED+"",Ee.CANCELLED,Ee.PLAN_REJECTED+"",Ee.CANCELLED,Ee.COMPLETED+"",Ee.RESULT_REJECTED+"",Ee.CANCELLED,Ee.FAILED+"",Ee.CANCELLED+"";const $c="browser_capture",vm="browser_automate";function da(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 ym(e,t){const n=da(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===da(r)}function pa(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:[])ym(n,d)&&d.length>o&&(o=d.length,r=a.id);return r}class Oc extends Error{}function Nc(e){return z(this,null,function*(){if(!e.ok){const t=yield e.json().catch(()=>({message:`HTTP ${e.status}`})),n=t.message||t.error||`HTTP ${e.status}`;throw e.status===401?new Oc(n):new Error(n)}return e.json()})}const wm=3e4;let Dc=wm;function xm(e){Number.isFinite(e)&&e>0&&(Dc=e)}function jo(r){return z(this,arguments,function*(e,t={},n=Dc){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 Fe(e,t,n,r){return z(this,null,function*(){const i=`${e.backendUrl.replace(/\/+$/,"")}/api${n}`,a=yield jo(i,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${e.token}`},body:r!==void 0?JSON.stringify(r):void 0});return Nc(a)})}function Sm(e,t){return z(this,null,function*(){return Fe(e,"GET",`/projects/by-key/${encodeURIComponent(t)}`)})}const Tm=["project","note","ctx"];function Em(e){var n,r;const t=Tm.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 $s(e,t){return z(this,null,function*(){var h,g,m,k,w,v;Em(t);const{project:n,note:r,ctx:o,advancedOpts:i,titleOverride:a,titleInstruction:d,allowSubmit:l,type:p=$c}=t;return Fe(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}:{}),(g=i==null?void 0:i.selectedSkillIds)!=null&&g.length?{selectedSkillIds:i.selectedSkillIds}:{}),(m=i==null?void 0:i.selectedPluginSkillIds)!=null&&m.length?{selectedPluginSkillIds:i.selectedPluginSkillIds}:{}),(k=i==null?void 0:i.selectedMcpServerIds)!=null&&k.length?{selectedMcpServerIds:i.selectedMcpServerIds}:{}),(w=i==null?void 0:i.selectedSlashCommandIds)!=null&&w.length?{selectedSlashCommandIds:i.selectedSlashCommandIds}:{}),(v=i==null?void 0:i.selectedRemoteContextProviderIds)!=null&&v.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 ha(e,t){return z(this,null,function*(){return $s(e,D(y({},t),{type:vm}))})}function fa(e,t,n,r){return z(this,null,function*(){var o;return Fe(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 Cm(e,t){return z(this,null,function*(){const n=t?`?projectId=${encodeURIComponent(t)}`:"";return Fe(e,"GET",`/claude-templates${n}`)})}function Mc(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}`)})}function Am(e,t){return z(this,null,function*(){return Fe(e,"GET",`/planning-sessions/${t}`)})}function ga(e){return z(this,null,function*(){return Fe(e,"GET","/projects")})}function Pm(e){return z(this,null,function*(){return(yield Fe(e,"GET","/tenants/current")).membership})}function ma(e,t){if(!e||e.includes("tenant:*")||e.includes(t))return!0;const n=t.split(":")[0];return e.includes(`${n}:*`)}function Os(e,t,n){return z(this,null,function*(){const o=`${e.backendUrl.replace(/\/+$/,"")}/api/auth/tokens/exchange-code`,i=yield jo(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:t,origin:n})});return Nc(i)})}function Rm(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}/browser-commands/pending`)})}function Lm(e,t,n,r,o){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/browser-commands/${n}/result`,{status:r,message:o})})}function zm(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}/chunks`)})}function Im(e,t,n){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/instructions`,{content:n})})}function $m(e,t){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/cancel`)})}function Om(e,t){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/approve-result`)})}function Nm(e,t,n){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/reject-result`,{feedback:n})})}function Uo(e,t){return z(this,null,function*(){return Fe(e,"GET",`/tasks/${t}/interactions?filter=unanswered`)})}function jc(e,t,n,r){return z(this,null,function*(){return Fe(e,"POST",`/tasks/${t}/interactions/${n}/answer`,{answer:r})})}function Dm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vs={exports:{}};/*!
1512
1512
  * Pusher JavaScript Library v8.5.0
1513
1513
  * https://pusher.com/
1514
1514
  *
1515
1515
  * Copyright 2020, Pusher
1516
1516
  * Released under the MIT licence.
1517
- */var ba;function Nm(){return ba||(ba=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,T){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,N){C.__proto__=N}||function(C,N){for(var J in N)N.hasOwnProperty(J)&&(C[J]=N[J])},M(E,T)};return function(E,T){M(E,T);function C(){this.constructor=E}E.prototype=T===null?Object.create(T):(C.prototype=T.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 T="",C=0;C<E.length-2;C+=3){var N=E[C]<<16|E[C+1]<<8|E[C+2];T+=this._encodeByte(N>>>18&63),T+=this._encodeByte(N>>>12&63),T+=this._encodeByte(N>>>6&63),T+=this._encodeByte(N>>>0&63)}var J=E.length-C;if(J>0){var N=E[C]<<16|(J===2?E[C+1]<<8:0);T+=this._encodeByte(N>>>18&63),T+=this._encodeByte(N>>>12&63),J===2?T+=this._encodeByte(N>>>6&63):T+=this._paddingCharacter||"",T+=this._paddingCharacter||""}return T},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 T=this._getPaddingLength(E),C=E.length-T,N=new Uint8Array(this.maxDecodedLength(C)),J=0,ye=0,Oe=0,Be=0,te=0,we=0,ot=0;ye<C-4;ye+=4)Be=this._decodeChar(E.charCodeAt(ye+0)),te=this._decodeChar(E.charCodeAt(ye+1)),we=this._decodeChar(E.charCodeAt(ye+2)),ot=this._decodeChar(E.charCodeAt(ye+3)),N[J++]=Be<<2|te>>>4,N[J++]=te<<4|we>>>2,N[J++]=we<<6|ot,Oe|=Be&p,Oe|=te&p,Oe|=we&p,Oe|=ot&p;if(ye<C-1&&(Be=this._decodeChar(E.charCodeAt(ye)),te=this._decodeChar(E.charCodeAt(ye+1)),N[J++]=Be<<2|te>>>4,Oe|=Be&p,Oe|=te&p),ye<C-2&&(we=this._decodeChar(E.charCodeAt(ye+2)),N[J++]=te<<4|we>>>2,Oe|=we&p),ye<C-3&&(ot=this._decodeChar(E.charCodeAt(ye+3)),N[J++]=we<<6|ot,Oe|=ot&p),Oe!==0)throw new Error("Base64Coder: incorrect characters for decoding");return N},M.prototype._encodeByte=function(E){var T=E;return T+=65,T+=25-E>>>8&6,T+=51-E>>>8&-75,T+=61-E>>>8&-15,T+=62-E>>>8&3,String.fromCharCode(T)},M.prototype._decodeChar=function(E){var T=p;return T+=(42-E&E-44)>>>8&-p+E-43+62,T+=(46-E&E-48)>>>8&-p+E-47+63,T+=(47-E&E-58)>>>8&-p+E-48+52,T+=(64-E&E-91)>>>8&-p+E-65+0,T+=(96-E&E-123)>>>8&-p+E-97+26,T},M.prototype._getPaddingLength=function(E){var T=0;if(this._paddingCharacter){for(var C=E.length-1;C>=0&&E[C]===this._paddingCharacter;C--)T++;if(E.length<4||T>2)throw new Error("Base64Coder: incorrect padding")}return T},M})();d.Coder=h;var g=new h;function m(M){return g.encode(M)}d.encode=m;function k(M){return g.decode(M)}d.decode=k;var w=(function(M){l(E,M);function E(){return M!==null&&M.apply(this,arguments)||this}return E.prototype._encodeByte=function(T){var C=T;return C+=65,C+=25-T>>>8&6,C+=51-T>>>8&-75,C+=61-T>>>8&-13,C+=62-T>>>8&49,String.fromCharCode(C)},E.prototype._decodeChar=function(T){var C=p;return C+=(44-T&T-46)>>>8&-p+T-45+62,C+=(94-T&T-96)>>>8&-p+T-95+63,C+=(47-T&T-58)>>>8&-p+T-48+52,C+=(64-T&T-91)>>>8&-p+T-65+0,C+=(96-T&T-123)>>>8&-p+T-97+26,C},E})(h);d.URLSafeCoder=w;var v=new w;function Z(M){return v.encode(M)}d.encodeURLSafe=Z;function K(M){return v.decode(M)}d.decodeURLSafe=K,d.encodedLength=function(M){return g.encodedLength(M)},d.maxDecodedLength=function(M){return g.maxDecodedLength(M)},d.decodedLength=function(M){return g.decodedLength(M)}},978(a,d){var l="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var w=void 0;if(k<224){if(m>=h.length)throw new Error(l);var v=h[++m];if((v&192)!==128)throw new Error(l);k=(k&31)<<6|v&63,w=128}else if(k<240){if(m>=h.length-1)throw new Error(l);var v=h[++m],Z=h[++m];if((v&192)!==128||(Z&192)!==128)throw new Error(l);k=(k&15)<<12|(v&63)<<6|Z&63,w=2048}else if(k<248){if(m>=h.length-2)throw new Error(l);var v=h[++m],Z=h[++m],K=h[++m];if((v&192)!==128||(Z&192)!==128||(K&192)!==128)throw new Error(l);k=(k&15)<<18|(v&63)<<12|(Z&63)<<6|K&63,w=65536}else throw new Error(l);if(k<w||k>=55296&&k<=57343)throw new Error(l);if(k>=65536){if(k>1114111)throw new Error(l);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,l){a.exports=l(207).default},207(a,d,l){l.d(d,{default:()=>io});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+"]",S=!1,R=function(){S||(s.apply(null,arguments),S=!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"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var S=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 ee=function(Pe){Pe||S.cleanup()},re=0;re<B.length;re++)B[re](O,ee)}});S.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 w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),v=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});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 T 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 N 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 ye extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Oe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Be extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class te extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class we extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const nn=function(u,s,c,f,b){const S=G.createXHR();S.open("POST",c.endpoint,!0),S.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)S.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)S.setRequestHeader(R,O[R])}return S.onreadystatechange=function(){if(S.readyState===4)if(S.status===200){let O,B=!1;try{O=JSON.parse(S.responseText),B=!0}catch(ee){b(new we(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${S.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 we(S.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${S.status} from ${c.endpoint}. ${O}`),null)}},S.send(s),S};function rn(u){return pe(sn(u))}var dt=String.fromCharCode,It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",on=function(u){var s=u.charCodeAt(0);return s<128?u:s<2048?dt(192|s>>>6)+dt(128|s&63):dt(224|s>>>12&15)+dt(128|s>>>6&63)+dt(128|s&63)},sn=function(u){return u.replace(/[^\x00-\x7F]/g,on)},$t=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=[It.charAt(c>>>18),It.charAt(c>>>12&63),s>=2?"=":It.charAt(c>>>6&63),s>=1?"=":It.charAt(c&63)];return f.join("")},pe=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,$t)};class vt{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 _e=vt;function yn(u){window.clearTimeout(u)}function le(u){window.clearInterval(u)}class Ge extends _e{constructor(s,c){super(setTimeout,yn,s,function(f){return c(),null})}}class an extends _e{constructor(s,c){super(setInterval,le,s,function(f){return c(),f})}}var yt={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ge(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 xe=yt;function Te(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]=Te(u[b]||{},f[b]):u[b]=f[b]}return u}function H(){for(var u=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?u.push(arguments[s]):u.push(Ae(arguments[s]));return u.join(" : ")}function oe(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 Q(u,s){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s(u[c],c,u)}function Ne(u){var s=[];return Q(u,function(c,f){s.push(f)}),s}function We(u){var s=[];return Q(u,function(c){s.push(c)}),s}function je(u,s,c){for(var f=0;f<u.length;f++)s.call(c||window,u[f],f,u)}function Ft(u,s){for(var c=[],f=0;f<u.length;f++)c.push(s(u[f],f,u,c));return c}function wt(u,s){var c={};return Q(u,function(f,b){c[b]=s(f)}),c}function De(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 Ce(u,s){var c={};return Q(u,function(f,b){(s&&s(f,b,u,c)||f)&&(c[b]=f)}),c}function ze(u){var s=[];return Q(u,function(c,f){s.push([f,c])}),s}function Ue(u,s){for(var c=0;c<u.length;c++)if(s(u[c],c,u))return!0;return!1}function fr(u,s){for(var c=0;c<u.length;c++)if(!s(u[c],c,u))return!1;return!0}function Ye(u){return wt(u,function(s){return typeof s=="object"&&(s=Ae(s)),encodeURIComponent(rn(s.toString()))})}function st(u){var s=Ce(u,function(f){return f!==void 0}),c=Ft(ze(Ye(s)),xe.method("join","=")).join("&");return c}function xt(u){var s=[],c=[];return(function f(b,S){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(S),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],S+"["+R+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],S+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(u,"$")}function Ae(u){try{return JSON.stringify(u)}catch(s){return JSON.stringify(xt(u))}}class gr{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=H.apply(this,arguments);io.log?io.log(f):io.logToConsole&&s.bind(this)(f)}}const ue=new gr;var Wr=function(u,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&ue.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var S=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var R=u.getDocument(),O=R.createElement("script");u.auth_callbacks[S]=function(re){b(null,re)};var B="Pusher.auth_callbacks['"+S+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ee=R.getElementsByTagName("head")[0]||R.documentElement;ee.insertBefore(O,ee.firstChild)};const mr=Wr;class Jr{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 Mn{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=st(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var jn=function(u,s){return function(c,f){var b="http"+(s?"s":"")+"://",S=b+(u.host||u.options.host)+u.options.path,R=G.createJSONPRequest(S,c),O=G.ScriptReceivers.create(function(B,ee){h.remove(O),R.cleanup(),ee&&ee.host&&(u.host=ee.host),f&&f(B,ee)});R.send(O)}},St={name:"jsonp",getAgent:jn};const cn=St;function wn(u,s,c){var f=u+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function xn(u,s){var c="/app/"+u,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ss={getInitial:function(u,s){var c=(s.httpPath||"")+xn(u,"flash=false");return wn("ws",s,c)}},Un={getInitial:function(u,s){var c=(s.httpPath||"/pusher")+xn(u);return wn("http",s,c)}},Zn={getInitial:function(u,s){return wn("http",s,s.httpPath||"/pusher")},getPath:function(u,s){return xn(u)}};class is{constructor(){this._callbacks={}}get(s){return this._callbacks[Bt(s)]}add(s,c,f){var b=Bt(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?[Bt(s)]:Ne(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){je(s,function(b){this._callbacks[b]=De(this._callbacks[b]||[],function(S){return c&&c!==S.fn||f&&f!==S.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){je(s,function(c){delete this._callbacks[c]},this)}}function Bt(u){return"_"+u}class Tt{constructor(s){this.callbacks=new is,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=De(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 S=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),S&&S.length>0)for(var b=0;b<S.length;b++)S[b].fn.apply(S[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class as extends Tt{constructor(s,c,f,b,S){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=S,this.state="new",this.timeline=S.timeline,this.activityTimeout=S.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return xe.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),ue.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(xe.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Te({cid:this.id},s)}}class de{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new as(this.hooks,s,c,f,b)}}var ln=new de({urls:ss,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(u){return G.createWebSocket(u)}}),Vr={urls:Un,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},br=Te({getSocket:function(u){return G.HTTPFactory.createStreamingSocket(u)}},Vr),qn=Te({getSocket:function(u){return G.HTTPFactory.createPollingSocket(u)}},Vr),kr={isSupported:function(){return G.isXHRSupported()}},Yr=new de(Te({},br,kr)),cs=new de(Te({},qn,kr)),pt={ws:ln,xhr_streaming:Yr,xhr_polling:cs};const ht=pt;var Xr=new de({file:"sockjs",urls:Zn,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:v.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(u,s){u.send(JSON.stringify({path:s}))}}),_r={isSupported:function(u){var s=G.isXDRSupported(u.useTLS);return s}},vr=new de(Te({},br,_r)),Kr=new de(Te({},qn,_r));ht.xdr_streaming=vr,ht.xdr_polling=Kr,ht.sockjs=Xr;const Et=ht;class Qr extends Tt{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 eo=new Qr;class to{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=Te({},b,{activityTimeout:this.pingDelay});var S=this.transport.createConnection(s,c,f,b),R=null,O=function(){S.unbind("open",O),S.bind("closed",B),R=xe.now()},B=ee=>{if(S.unbind("closed",B),ee.code===1002||ee.code===1003)this.manager.reportDeath();else if(!ee.wasClean&&R){var re=xe.now()-R;re<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(re/2,this.minPingDelay))}};return S.bind("open",O),S}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const yr={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=yr.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}},Gt=yr;class j extends Tt{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),ue.debug("Event sent",b),this.send(Gt.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=Gt.decodeMessage(f)}catch(S){this.emit("error",{type:"MessageParseError",error:S,data:f.data})}if(b!==void 0){switch(ue.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=()=>{Q(s,(f,b)=>{this.transport.unbind(b,f)})};Q(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=Gt.getCloseAction(s),f=Gt.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=Gt.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=Gt.getCloseAction(s)||"backoff",f=Gt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Te({transport:this.transport,action:s},c))}}class 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 Tt{constructor(s,c){super(function(f,b){ue.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 T("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=M.buildLogSuffix("triggeringClientEvents");ue.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,ue.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof we?{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 se 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){Q(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Se=function(u,s,c,f){function b(S){return S instanceof c?S:new c(function(R){R(S)})}return new(c||(c=Promise))(function(S,R){function O(re){try{ee(f.next(re))}catch(Pe){R(Pe)}}function B(re){try{ee(f.throw(re))}catch(Pe){R(Pe)}}function ee(re){re.done?S(re.value):b(re.value).then(O,B)}ee((f=f.apply(u,s||[])).next())})};class Je extends se{constructor(s,c){super(s,c),this.members=new Me}authorize(s,c){super.authorize(s,(f,b)=>Se(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var S=JSON.parse(b.channel_data);this.members.setMyID(S.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");ue.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 S=this.members.removeMember(f);S&&this.emit("pusher:member_removed",S);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 Ct=l(978),Ot=l(594);class wr extends se{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 S=b.shared_secret;if(!S){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Ot.decode)(S),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Oe("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){ue.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){ue.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Ot.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){ue.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Ot.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){ue.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let S=this.nacl.secretbox.open(f,b,this.key);if(S===null){ue.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){ue.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(S=this.nacl.secretbox.open(f,b,this.key),S===null){ue.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(S))});return}this.emit(s,this.getDataToEmit(S))}getDataToEmit(s){let c=(0,Ct.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class Ie extends Tt{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 Ge(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ge(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ge(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 Ge(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Te({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return Te({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),ue.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 no{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=ro(s,c)),this.channels[s]}all(){return We(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Q(this.channels,function(s){s.disconnect()})}}function ro(u,s){if(u.indexOf("private-encrypted-")===0){if(s.config.nacl)return Wt.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 Oe(`${c}. ${f}`)}else{if(u.indexOf("private-")===0)return Wt.createPrivateChannel(u,s);if(u.indexOf("presence-")===0)return Wt.createPresenceChannel(u,s);if(u.indexOf("#")===0)throw new C('Cannot create a channel with name "'+u+'".');return Wt.createChannel(u,s)}}var Nl={createChannels(){return new no},createConnectionManager(u,s){return new Ie(u,s)},createChannel(u,s){return new I(u,s)},createPrivateChannel(u,s){return new se(u,s)},createPresenceChannel(u,s){return new Je(u,s)},createEncryptedChannel(u,s,c){return new wr(u,s,c)},createTimelineSender(u,s){return new A(u,s)},createHandshake(u,s){return new _(u,s)},createAssistantToTheTransportManager(u,s,c){return new to(u,s,c)}};const Wt=Nl;class wi{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Wt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Sn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Ue(this.strategies,xe.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,S=this.timeout,R=null,O=(B,ee)=>{ee?c(null,ee):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(S&&(S=S*2,this.timeoutLimit&&(S=Math.min(S,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:S,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:S,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var S=null,R=null;return f.timeout>0&&(S=new Ge(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&S&&S.isRunning()&&!f.failFast||(S&&S.ensureAborted(),b(O,B))}),{abort:function(){S&&S.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class ls{constructor(s){this.strategies=s}isSupported(){return Ue(this.strategies,xe.method("isSupported"))}connect(s,c){return Dl(this.strategies,s,function(f,b){return function(S,R){if(b[f].error=S,S){Ml(b)&&c(!0);return}je(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function Dl(u,s,c){var f=Ft(u,function(b,S,R,O){return b.connect(s,c(S,O))});return{abort:function(){je(f,jl)},forceMinPriority:function(b){je(f,function(S){S.forceMinPriority(b)})}}}function Ml(u){return fr(u,function(s){return!!s.error})}function jl(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class Ul{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=Zl(f),S=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=xe.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||S>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new Sn([O],{timeout:b.latency*2+1e3,failFast:!0}))):S++)}var B=xe.now(),ee=R.pop().connect(s,function re(Pe,ao){Pe?(xi(f),R.length>0?(B=xe.now(),ee=R.pop().connect(s,re)):c(Pe)):(ql(f,ao.transport.name,xe.now()-B,S),c(null,ao))});return{abort:function(){ee.abort()},forceMinPriority:function(re){s=re,ee&&ee.forceMinPriority(re)}}}}function us(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function Zl(u){var s=G.getLocalStorage();if(s)try{var c=s[us(u)];if(c)return JSON.parse(c)}catch(f){xi(u)}return null}function ql(u,s,c,f){var b=G.getLocalStorage();if(b)try{b[us(u)]=Ae({timestamp:xe.now(),transport:s,latency:c,cacheSkipCount:f})}catch(S){}}function xi(u){var s=G.getLocalStorage();if(s)try{delete s[us(u)]}catch(c){}}class oo{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,S=new Ge(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){S.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class xr{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 Hl{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,S){S&&f.abort(),c(b,S)});return f}}function Sr(u){return function(){return u.isSupported()}}var Fl=function(u,s,c){var f={};function b(Ni,Zu,qu,Hu,Fu){var Di=c(u,Ni,Zu,qu,Hu,Fu);return f[Ni]=Di,Di}var S=Object.assign({},s,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),R=Object.assign({},S,{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},ee=new wi({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),re=new wi({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Pe=b("ws","ws",3,S,ee),ao=b("wss","ws",3,R,ee),Nu=b("sockjs","sockjs",1,O),Ri=b("xhr_streaming","xhr_streaming",1,O,re),Du=b("xdr_streaming","xdr_streaming",1,O,re),Li=b("xhr_polling","xhr_polling",1,O),Mu=b("xdr_polling","xdr_polling",1,O),zi=new Sn([Pe],B),ju=new Sn([ao],B),Uu=new Sn([Nu],B),Ii=new Sn([new xr(Sr(Ri),Ri,Du)],B),$i=new Sn([new xr(Sr(Li),Li,Mu)],B),Oi=new Sn([new xr(Sr(Ii),new ls([Ii,new oo($i,{delay:4e3})]),$i)],B),hs=new xr(Sr(Oi),Oi,Uu),fs;return s.useTLS?fs=new ls([zi,new oo(hs,{delay:2e3})]):fs=new ls([zi,new oo(ju,{delay:2e3}),new oo(hs,{delay:5e3})]),new Ul(new Hl(new xr(Sr(Pe),fs,hs)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const Bl=Fl;function Gl(){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"),v.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 Wl={getRequest:function(u){var s=new window.XDomainRequest;return s.ontimeout=function(){u.emit("error",new N),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 Jl=Wl,Vl=256*1024;class Yl extends Tt{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>Vl}}var ds;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(ds||(ds={}));const Tn=ds;var Xl=1;class Kl{constructor(s,c){this.hooks=s,this.session=Ti(1e3)+"/"+nu(8),this.location=Ql(c),this.readyState=Tn.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===Tn.OPEN)try{return G.createSocketRequest("POST",Si(eu(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=Tn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Tn.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===Tn.CONNECTING?(s&&s.hostname&&(this.location.base=tu(this.location.base,s.hostname)),this.readyState=Tn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Tn.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",Si(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){xe.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function Ql(u){var s=/([^\?]*)\/*(\??.*)/.exec(u);return{base:s[1],queryString:s[2]}}function eu(u,s){return u.base+"/"+s+"/xhr_send"}function Si(u){var s=u.indexOf("?")===-1?"?":"&";return u+s+"t="+ +new Date+"&n="+Xl++}function tu(u,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+s+c[3]}function Ti(u){return G.randomInt(u)}function nu(u){for(var s=[],c=0;c<u;c++)s.push(Ti(32).toString(32));return s.join("")}const ru=Kl;var ou={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 su=ou;var iu={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 au=iu;var cu={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 lu=cu;var uu={createStreamingSocket(u){return this.createSocket(su,u)},createPollingSocket(u){return this.createSocket(au,u)},createSocket(u,s){return new ru(u,s)},createXHR(u,s){return this.createRequest(lu,u,s)},createRequest(u,s,c){return new Yl(u,s,c)}};const Ei=uu;Ei.createXDR=function(u,s){return this.createRequest(Jl,u,s)};var du={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:Bl,Transports:Et,transportConnectionInitializer:Gl,HTTPFactory:Ei,TimelineTransport:cn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var s=()=>{this.onDocumentBody(u.ready)};window.JSON?s():v.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:nn,jsonp:mr}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,s){return new Mn(u,s)},createScriptRequest(u){return new Jr(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 eo},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=du;var ps;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(ps||(ps={}));const so=ps;class pu{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Te({},c,{timestamp:xe.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(so.ERROR,s)}info(s){this.log(so.INFO,s)}debug(s){this.log(so.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=Te({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,S)=>{b||this.sent++,c&&c(b,S)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class hu{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 Ci(new J,c)}else return Ci(new te,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),S=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){S=Wt.createHandshake(b,function(Pe){f=!0,re(),c(null,Pe)})},B=function(Pe){re(),c(Pe)},ee=function(){re();var Pe;Pe=Ae(b),c(new ye(Pe))},re=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ee)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",ee),b.initialize(),{abort:()=>{f||(re(),S?S.close():b.close())},forceMinPriority:Pe=>{f||this.priority<Pe&&(S?S.close():b.close())}}}}function Ci(u,s){return xe.defer(function(){s(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:fu}=G;var gu=function(u,s,c,f,b,S){var R=fu[c];if(!R)throw new Be(c);var O=(!u.enabledTransports||oe(u.enabledTransports,s)!==-1)&&(!u.disabledTransports||oe(u.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},b),B=new hu(s,f,S?S.getAssistant(R):R,b)):B=mu,B},mu={isSupported:function(){return!1},connect:function(u,s){var c=xe.defer(function(){s(new te)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function bu(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&&ue.warn("The disableStats option is deprecated in favor of enableStats")}const ku=(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},_u=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=ku(s,u);G.getAuthorizers()[u.transport](G,f,u,E.UserAuthentication,c)}},vu=(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},yu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=vu(s,u);G.getAuthorizers()[u.transport](G,f,u,E.ChannelAuthorization,c)}},wu=(u,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,S)=>{const R=u.channel(b.channelName);c(R,f).authorize(b.socketId,S)}};function Ai(u,s){let c={activityTimeout:u.activityTimeout||m.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||m.httpPath,httpPort:u.httpPort||m.httpPort,httpsPort:u.httpsPort||m.httpsPort,pongTimeout:u.pongTimeout||m.pongTimeout,statsHost:u.statsHost||m.stats_host,unavailableTimeout:u.unavailableTimeout||m.unavailableTimeout,wsPath:u.wsPath||m.wsPath,wsPort:u.wsPort||m.wsPort,wssPort:u.wssPort||m.wssPort,enableStats:Cu(u),httpHost:xu(u),useTLS:Eu(u),wsHost:Su(u),userAuthenticator:Au(u),channelAuthorizer:Ru(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 xu(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:m.httpHost}function Su(u){return u.wsHost?u.wsHost:Tu(u.cluster)}function Tu(u){return`ws-${u}.pusher.com`}function Eu(u){return G.getProtocol()==="https:"?!0:u.forceTLS!==!1}function Cu(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}const Pi=u=>"customHandler"in u&&u.customHandler!=null;function Au(u){const s=Object.assign(Object.assign({},m.userAuthentication),u.userAuthentication);return Pi(s)?s.customHandler:_u(s)}function Pu(u,s){let c;if("channelAuthorization"in u)c=Object.assign(Object.assign({},m.channelAuthorization),u.channelAuthorization);else if(c={transport:u.authTransport||m.authTransport,endpoint:u.authEndpoint||m.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:wu(s,c,u.authorizer)};return c}function Ru(u,s){const c=Pu(u,s);return Pi(c)?c.customHandler:yu(c)}class Lu extends Tt{constructor(s){super(function(c,f){ue.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 zu(){let u,s;return{promise:new Promise((f,b)=>{u=f,s=b}),resolve:u,reject:s}}const Iu=zu;class $u extends Tt{constructor(s){super(function(c,f){ue.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){ue.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 Lu(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){ue.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){ue.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}=Iu();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Ze{static ready(){Ze.isReady=!0;for(var s=0,c=Ze.instances.length;s<c;s++)Ze.instances[s].connect()}static getClientFeatures(){return Ne(Ce({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){Ou(s),bu(c),this.key=s,this.options=c,this.config=Ai(this.options,this),this.channels=Wt.createChannels(),this.global_emitter=new Tt,this.sessionID=G.randomInt(1e9),this.timeline=new pu(this.key,this.sessionID,{cluster:this.config.cluster,features:Ze.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:so.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Wt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,gu);this.connection=Wt.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 S=b.event,R=S.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=>{ue.warn(b)}),Ze.instances.push(this),this.timeline.info({instances:Ze.instances.length}),this.user=new $u(this),Ze.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=Ai(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 an(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()}}Ze.instances=[],Ze.isReady=!1,Ze.logToConsole=!1,Ze.Runtime=G,Ze.ScriptReceivers=G.ScriptReceivers,Ze.DependenciesReceivers=G.DependenciesReceivers,Ze.auth_callbacks=G.auth_callbacks;const io=Ze;function Ou(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Ze)}},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})())})(vs)),vs.exports}var Dm=Nm();const Mm=Om(Dm);let zt=null,Hn=null;function jm(e){return z(this,null,function*(){return Hn||(Hn=z(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield jo(`${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();zt=new Mm(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)=>{jo(`${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))}}})}),Hn.catch(()=>{Hn=null}),Hn)})}function Um(e){if(!e||!zt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return zt.connection.bind("state_change",n),()=>zt==null?void 0:zt.connection.unbind("state_change",n)}function Zm(e,t,n){return z(this,null,function*(){if(yield jm(e),!zt)return()=>{};const r=zt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(lo.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(lo.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(lo.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(lo.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=Um(n.onReconnect);return()=>{r.unbind_all(),zt==null||zt.unsubscribe(`private-task-${t}`),o==null||o()}})}const ei="ap-sdk-active-automation";function qm(){try{const e=sessionStorage.getItem(ei);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 jc(e){try{sessionStorage.setItem(ei,JSON.stringify(e))}catch(t){}}function Uc(){try{sessionStorage.removeItem(ei)}catch(e){}}function Hm(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 Fm(),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 Fm(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const ti="shared",Zc="ap-sdk-panel-size:",ka=280,_a=200;function Bm(e){try{const t=sessionStorage.getItem(Zc+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 Gm(e,t){try{sessionStorage.setItem(Zc+e,JSON.stringify(t))}catch(n){}}function fo(e,t,n){return Math.min(Math.max(e,t),n)}function va(){return window.innerWidth-32}function ya(){return window.innerHeight-64}function ni(e,t){const n=Bm(t);n&&(e.style.width=`${fo(n.width,ka,va())}px`,e.style.height=`${fo(n.height,_a,ya())}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 g=k=>{o&&(p=fo(d+(k.clientX-i),ka,va()),h=fo(l+(k.clientY-a),_a,ya()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),Gm(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const w=e.getBoundingClientRect();d=w.width,l=w.height,p=d,h=l,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function ri(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Dn=ri();function qc(e){Dn=e}var Cn={exec:()=>null};function Fn(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(Ve.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Wm=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Ve={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:Fn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Fn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}>`))},Jm=/^(?:[ \t]*(?:\n|$))+/,Vm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ym=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Br=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Xm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Hc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Fc=Y(Hc).replace(/bull/g,oi).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(),Km=Y(Hc).replace(/bull/g,oi).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(),si=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Qm=/^[^\n]+/,ii=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,eb=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ii).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tb=Y(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,oi).getRegex(),ns="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",ai=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,nb=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",ai).replace("tag",ns).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Bc=e=>Y(si).replace("hr",Br).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",ns).getRegex(),rb=Bc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ob=Bc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),sb=Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ob).getRegex(),ci={blockquote:sb,code:Vm,def:eb,fences:Ym,heading:Xm,hr:Br,html:nb,lheading:Fc,list:tb,newline:Jm,paragraph:rb,table:Cn,text:Qm},wa=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Br).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",ns).getRegex(),ib=D(y({},ci),{lheading:Km,table:wa,paragraph:Y(si).replace("hr",Br).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wa).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",ns).getRegex()}),ab=D(y({},ci),{html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ai).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:Cn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(si).replace("hr",Br).replace("heading",` *#{1,6} *[^
1519
- ]`).replace("lheading",Fc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),cb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,lb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Gc=/^( {2,}|\\)\n(?!\s*$)/,ub=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tn=/[\p{P}\p{S}]/u,pr=/[\s\p{P}\p{S}]/u,Gr=/[^\s\p{P}\p{S}]/u,db=Y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,pr).getRegex(),pb=/[\p{Pi}\p{Ps}"']/u,Wc=/(?!~)[\p{P}\p{S}]/u,hb=/(?!~)[\s\p{P}\p{S}]/u,fb=/(?:[^\s\p{P}\p{S}]|~)/u,gb=Y(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",Wm?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Jc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,mb=Y(Jc,"u").replace(/punct/g,tn).getRegex(),bb=Y(Jc,"u").replace(/punct/g,Wc).getRegex(),kb=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,_b=Y(kb,"u").replace(/openQuote/g,pb).replace(/punct/g,tn).getRegex(),Vc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",vb=Y(Vc,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),yb=Y(Vc,"gu").replace(/notPunctSpace/g,fb).replace(/punctSpace/g,hb).replace(/punct/g,Wc).getRegex(),wb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",xb=Y(wb,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),Sb=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),Tb="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Eb=Y(Tb,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),Cb=Y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,tn).getRegex(),Ab="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Pb=Y(Ab,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),Rb=Y(/\\(punct)/,"gu").replace(/punct/g,tn).getRegex(),Lb=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(),zb=Y(ai).replace("(?:-->|$)","-->").getRegex(),Ib=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",zb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,$b=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Zo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Yc=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",Zo).replace("ref",ii).getRegex(),Xc=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",ii).getRegex(),Ob=Y("reflink|nolink(?!\\()","g").replace("reflink",Yc).replace("nolink",Xc).getRegex(),xa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,li={_backpedal:Cn,anyPunctuation:Rb,autolink:Lb,blockSkip:gb,br:Gc,code:lb,del:Cn,delLDelim:Cn,delRDelim:Cn,emStrongLDelim:mb,emStrongRDelimAst:vb,emStrongRDelimUnd:Sb,escape:cb,link:$b,nolink:Xc,punctuation:db,reflink:Yc,reflinkSearch:Ob,tag:Ib,text:ub,url:Cn},Nb=D(y({},li),{emStrongLDelim:_b,emStrongRDelimAst:xb,emStrongRDelimUnd:Eb,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",Zo).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zo).getRegex()}),Ns=D(y({},li),{emStrongRDelimAst:yb,emStrongLDelim:bb,delLDelim:Cb,delRDelim:Pb,url:Y(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",xa).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",xa).getRegex()}),Db=D(y({},Ns),{br:Y(Gc).replace("{2,}","*").getRegex(),text:Y(Ns.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),go={normal:ci,gfm:ib,pedantic:ab},Er={normal:li,gfm:Ns,breaks:Db,pedantic:Nb},Mb={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Sa=e=>Mb[e];function Nt(e,t){if(t){if(Ve.escapeTest.test(e))return e.replace(Ve.escapeReplace,Sa)}else if(Ve.escapeTestNoEncode.test(e))return e.replace(Ve.escapeReplaceNoEncode,Sa);return e}function Ta(e){try{e=encodeURI(e).replace(Ve.percentDecode,"%")}catch(t){return null}return e}function Ea(e,t){var i;let n=e.replace(Ve.findPipe,(a,d,l)=>{let p=!1,h=d;for(;--h>=0&&l[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Ve.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(Ve.slashPipe,"|");return r}function un(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 Ca(e){let t=e.split(`
1517
+ */var ba;function Mm(){return ba||(ba=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,T){return M=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,N){C.__proto__=N}||function(C,N){for(var J in N)N.hasOwnProperty(J)&&(C[J]=N[J])},M(E,T)};return function(E,T){M(E,T);function C(){this.constructor=E}E.prototype=T===null?Object.create(T):(C.prototype=T.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 T="",C=0;C<E.length-2;C+=3){var N=E[C]<<16|E[C+1]<<8|E[C+2];T+=this._encodeByte(N>>>18&63),T+=this._encodeByte(N>>>12&63),T+=this._encodeByte(N>>>6&63),T+=this._encodeByte(N>>>0&63)}var J=E.length-C;if(J>0){var N=E[C]<<16|(J===2?E[C+1]<<8:0);T+=this._encodeByte(N>>>18&63),T+=this._encodeByte(N>>>12&63),J===2?T+=this._encodeByte(N>>>6&63):T+=this._paddingCharacter||"",T+=this._paddingCharacter||""}return T},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 T=this._getPaddingLength(E),C=E.length-T,N=new Uint8Array(this.maxDecodedLength(C)),J=0,ye=0,Oe=0,Be=0,te=0,we=0,ot=0;ye<C-4;ye+=4)Be=this._decodeChar(E.charCodeAt(ye+0)),te=this._decodeChar(E.charCodeAt(ye+1)),we=this._decodeChar(E.charCodeAt(ye+2)),ot=this._decodeChar(E.charCodeAt(ye+3)),N[J++]=Be<<2|te>>>4,N[J++]=te<<4|we>>>2,N[J++]=we<<6|ot,Oe|=Be&p,Oe|=te&p,Oe|=we&p,Oe|=ot&p;if(ye<C-1&&(Be=this._decodeChar(E.charCodeAt(ye)),te=this._decodeChar(E.charCodeAt(ye+1)),N[J++]=Be<<2|te>>>4,Oe|=Be&p,Oe|=te&p),ye<C-2&&(we=this._decodeChar(E.charCodeAt(ye+2)),N[J++]=te<<4|we>>>2,Oe|=we&p),ye<C-3&&(ot=this._decodeChar(E.charCodeAt(ye+3)),N[J++]=we<<6|ot,Oe|=ot&p),Oe!==0)throw new Error("Base64Coder: incorrect characters for decoding");return N},M.prototype._encodeByte=function(E){var T=E;return T+=65,T+=25-E>>>8&6,T+=51-E>>>8&-75,T+=61-E>>>8&-15,T+=62-E>>>8&3,String.fromCharCode(T)},M.prototype._decodeChar=function(E){var T=p;return T+=(42-E&E-44)>>>8&-p+E-43+62,T+=(46-E&E-48)>>>8&-p+E-47+63,T+=(47-E&E-58)>>>8&-p+E-48+52,T+=(64-E&E-91)>>>8&-p+E-65+0,T+=(96-E&E-123)>>>8&-p+E-97+26,T},M.prototype._getPaddingLength=function(E){var T=0;if(this._paddingCharacter){for(var C=E.length-1;C>=0&&E[C]===this._paddingCharacter;C--)T++;if(E.length<4||T>2)throw new Error("Base64Coder: incorrect padding")}return T},M})();d.Coder=h;var g=new h;function m(M){return g.encode(M)}d.encode=m;function k(M){return g.decode(M)}d.decode=k;var w=(function(M){l(E,M);function E(){return M!==null&&M.apply(this,arguments)||this}return E.prototype._encodeByte=function(T){var C=T;return C+=65,C+=25-T>>>8&6,C+=51-T>>>8&-75,C+=61-T>>>8&-13,C+=62-T>>>8&49,String.fromCharCode(C)},E.prototype._decodeChar=function(T){var C=p;return C+=(44-T&T-46)>>>8&-p+T-45+62,C+=(94-T&T-96)>>>8&-p+T-95+63,C+=(47-T&T-58)>>>8&-p+T-48+52,C+=(64-T&T-91)>>>8&-p+T-65+0,C+=(96-T&T-123)>>>8&-p+T-97+26,C},E})(h);d.URLSafeCoder=w;var v=new w;function Z(M){return v.encode(M)}d.encodeURLSafe=Z;function K(M){return v.decode(M)}d.decodeURLSafe=K,d.encodedLength=function(M){return g.encodedLength(M)},d.maxDecodedLength=function(M){return g.maxDecodedLength(M)},d.decodedLength=function(M){return g.decodedLength(M)}},978(a,d){var l="utf8: invalid source encoding";function p(h){for(var g=[],m=0;m<h.length;m++){var k=h[m];if(k&128){var w=void 0;if(k<224){if(m>=h.length)throw new Error(l);var v=h[++m];if((v&192)!==128)throw new Error(l);k=(k&31)<<6|v&63,w=128}else if(k<240){if(m>=h.length-1)throw new Error(l);var v=h[++m],Z=h[++m];if((v&192)!==128||(Z&192)!==128)throw new Error(l);k=(k&15)<<12|(v&63)<<6|Z&63,w=2048}else if(k<248){if(m>=h.length-2)throw new Error(l);var v=h[++m],Z=h[++m],K=h[++m];if((v&192)!==128||(Z&192)!==128||(K&192)!==128)throw new Error(l);k=(k&15)<<18|(v&63)<<12|(Z&63)<<6|K&63,w=65536}else throw new Error(l);if(k<w||k>=55296&&k<=57343)throw new Error(l);if(k>=65536){if(k>1114111)throw new Error(l);k-=65536,g.push(String.fromCharCode(55296|k>>10)),k=56320|k&1023}}g.push(String.fromCharCode(k))}return g.join("")}d.D4=p},721(a,d,l){a.exports=l(207).default},207(a,d,l){l.d(d,{default:()=>io});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+"]",S=!1,R=function(){S||(s.apply(null,arguments),S=!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"),g={VERSION:"8.5.0",PROTOCOL:7,wsPort:80,wssPort:443,wsPath:"",httpHost:"sockjs.pusher.com",httpPort:80,httpsPort:443,httpPath:"/pusher",stats_host:"stats.pusher.com",authEndpoint:"/pusher/auth",authTransport:"ajax",activityTimeout:12e4,pongTimeout:3e4,unavailableTimeout:1e4,userAuthentication:{endpoint:"/pusher/user-auth",transport:"ajax"},channelAuthorization:{endpoint:"/pusher/auth",transport:"ajax"},cdn_http:"http://js.pusher.com",cdn_https:"https://js.pusher.com",dependency_suffix:""};const m=g;class k{constructor(s){this.options=s,this.receivers=s.receivers||h,this.loading={}}load(s,c,f){var b=this;if(b.loading[s]&&b.loading[s].length>0)b.loading[s].push(f);else{b.loading[s]=[f];var S=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 ee=function(Pe){Pe||S.cleanup()},re=0;re<B.length;re++)B[re](O,ee)}});S.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 w=new p("_pusher_dependencies","Pusher.DependenciesReceivers"),v=new k({cdn_http:m.cdn_http,cdn_https:m.cdn_https,version:m.VERSION,suffix:m.dependency_suffix,receivers:w});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 T 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 N 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 ye extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Oe extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class Be extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class te extends Error{constructor(s){super(s),Object.setPrototypeOf(this,new.target.prototype)}}class we extends Error{constructor(s,c){super(c),this.status=s,Object.setPrototypeOf(this,new.target.prototype)}}const nn=function(u,s,c,f,b){const S=G.createXHR();S.open("POST",c.endpoint,!0),S.setRequestHeader("Content-Type","application/x-www-form-urlencoded");for(var R in c.headers)S.setRequestHeader(R,c.headers[R]);if(c.headersProvider!=null){let O=c.headersProvider();for(var R in O)S.setRequestHeader(R,O[R])}return S.onreadystatechange=function(){if(S.readyState===4)if(S.status===200){let O,B=!1;try{O=JSON.parse(S.responseText),B=!0}catch(ee){b(new we(200,`JSON returned from ${f.toString()} endpoint was invalid, yet status code was 200. Data was: ${S.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 we(S.status,`Unable to retrieve auth string from ${f.toString()} endpoint - received status: ${S.status} from ${c.endpoint}. ${O}`),null)}},S.send(s),S};function rn(u){return pe(sn(u))}var dt=String.fromCharCode,It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",on=function(u){var s=u.charCodeAt(0);return s<128?u:s<2048?dt(192|s>>>6)+dt(128|s&63):dt(224|s>>>12&15)+dt(128|s>>>6&63)+dt(128|s&63)},sn=function(u){return u.replace(/[^\x00-\x7F]/g,on)},$t=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=[It.charAt(c>>>18),It.charAt(c>>>12&63),s>=2?"=":It.charAt(c>>>6&63),s>=1?"=":It.charAt(c&63)];return f.join("")},pe=window.btoa||function(u){return u.replace(/[\s\S]{1,3}/g,$t)};class vt{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 _e=vt;function yn(u){window.clearTimeout(u)}function le(u){window.clearInterval(u)}class Ge extends _e{constructor(s,c){super(setTimeout,yn,s,function(f){return c(),null})}}class an extends _e{constructor(s,c){super(setInterval,le,s,function(f){return c(),f})}}var yt={now(){return Date.now?Date.now():new Date().valueOf()},defer(u){return new Ge(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 xe=yt;function Te(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]=Te(u[b]||{},f[b]):u[b]=f[b]}return u}function H(){for(var u=["Pusher"],s=0;s<arguments.length;s++)typeof arguments[s]=="string"?u.push(arguments[s]):u.push(Ae(arguments[s]));return u.join(" : ")}function oe(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 Q(u,s){for(var c in u)Object.prototype.hasOwnProperty.call(u,c)&&s(u[c],c,u)}function Ne(u){var s=[];return Q(u,function(c,f){s.push(f)}),s}function We(u){var s=[];return Q(u,function(c){s.push(c)}),s}function je(u,s,c){for(var f=0;f<u.length;f++)s.call(c||window,u[f],f,u)}function Ft(u,s){for(var c=[],f=0;f<u.length;f++)c.push(s(u[f],f,u,c));return c}function wt(u,s){var c={};return Q(u,function(f,b){c[b]=s(f)}),c}function De(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 Ce(u,s){var c={};return Q(u,function(f,b){(s&&s(f,b,u,c)||f)&&(c[b]=f)}),c}function ze(u){var s=[];return Q(u,function(c,f){s.push([f,c])}),s}function Ue(u,s){for(var c=0;c<u.length;c++)if(s(u[c],c,u))return!0;return!1}function fr(u,s){for(var c=0;c<u.length;c++)if(!s(u[c],c,u))return!1;return!0}function Ye(u){return wt(u,function(s){return typeof s=="object"&&(s=Ae(s)),encodeURIComponent(rn(s.toString()))})}function st(u){var s=Ce(u,function(f){return f!==void 0}),c=Ft(ze(Ye(s)),xe.method("join","=")).join("&");return c}function xt(u){var s=[],c=[];return(function f(b,S){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(S),Object.prototype.toString.apply(b)==="[object Array]")for(B=[],R=0;R<b.length;R+=1)B[R]=f(b[R],S+"["+R+"]");else{B={};for(O in b)Object.prototype.hasOwnProperty.call(b,O)&&(B[O]=f(b[O],S+"["+JSON.stringify(O)+"]"))}return B;case"number":case"string":case"boolean":return b}})(u,"$")}function Ae(u){try{return JSON.stringify(u)}catch(s){return JSON.stringify(xt(u))}}class gr{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=H.apply(this,arguments);io.log?io.log(f):io.logToConsole&&s.bind(this)(f)}}const ue=new gr;var Wr=function(u,s,c,f,b){(c.headers!==void 0||c.headersProvider!=null)&&ue.warn(`To send headers with the ${f.toString()} request, you must use AJAX, rather than JSONP.`);var S=u.nextAuthCallbackID.toString();u.nextAuthCallbackID++;var R=u.getDocument(),O=R.createElement("script");u.auth_callbacks[S]=function(re){b(null,re)};var B="Pusher.auth_callbacks['"+S+"']";O.src=c.endpoint+"?callback="+encodeURIComponent(B)+"&"+s;var ee=R.getElementsByTagName("head")[0]||R.documentElement;ee.insertBefore(O,ee.firstChild)};const mr=Wr;class Jr{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 Mn{constructor(s,c){this.url=s,this.data=c}send(s){if(!this.request){var c=st(this.data),f=this.url+"/"+s.number+"?"+c;this.request=G.createScriptRequest(f),this.request.send(s)}}cleanup(){this.request&&this.request.cleanup()}}var jn=function(u,s){return function(c,f){var b="http"+(s?"s":"")+"://",S=b+(u.host||u.options.host)+u.options.path,R=G.createJSONPRequest(S,c),O=G.ScriptReceivers.create(function(B,ee){h.remove(O),R.cleanup(),ee&&ee.host&&(u.host=ee.host),f&&f(B,ee)});R.send(O)}},St={name:"jsonp",getAgent:jn};const cn=St;function wn(u,s,c){var f=u+(s.useTLS?"s":""),b=s.useTLS?s.hostTLS:s.hostNonTLS;return f+"://"+b+c}function xn(u,s){var c="/app/"+u,f="?protocol="+m.PROTOCOL+"&client=js&version="+m.VERSION+(s?"&"+s:"");return c+f}var ss={getInitial:function(u,s){var c=(s.httpPath||"")+xn(u,"flash=false");return wn("ws",s,c)}},Un={getInitial:function(u,s){var c=(s.httpPath||"/pusher")+xn(u);return wn("http",s,c)}},Zn={getInitial:function(u,s){return wn("http",s,s.httpPath||"/pusher")},getPath:function(u,s){return xn(u)}};class is{constructor(){this._callbacks={}}get(s){return this._callbacks[Bt(s)]}add(s,c,f){var b=Bt(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?[Bt(s)]:Ne(this._callbacks);c||f?this.removeCallback(b,c,f):this.removeAllCallbacks(b)}removeCallback(s,c,f){je(s,function(b){this._callbacks[b]=De(this._callbacks[b]||[],function(S){return c&&c!==S.fn||f&&f!==S.context}),this._callbacks[b].length===0&&delete this._callbacks[b]},this)}removeAllCallbacks(s){je(s,function(c){delete this._callbacks[c]},this)}}function Bt(u){return"_"+u}class Tt{constructor(s){this.callbacks=new is,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=De(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 S=this.callbacks.get(s),R=[];if(f?R.push(c,f):c&&R.push(c),S&&S.length>0)for(var b=0;b<S.length;b++)S[b].fn.apply(S[b].context||window,R);else this.failThrough&&this.failThrough(s,c);return this}}class as extends Tt{constructor(s,c,f,b,S){super(),this.initialize=G.transportConnectionInitializer,this.hooks=s,this.name=c,this.priority=f,this.key=b,this.options=S,this.state="new",this.timeline=S.timeline,this.activityTimeout=S.activityTimeout,this.id=this.timeline.generateUniqueID()}handlesActivityChecks(){return!!this.hooks.handlesActivityChecks}supportsPing(){return!!this.hooks.supportsPing}connect(){if(this.socket||this.state!=="initialized")return!1;var s=this.hooks.urls.getInitial(this.key,this.options);try{this.socket=this.hooks.getSocket(s,this.options)}catch(c){return xe.defer(()=>{this.onError(c),this.changeState("closed")}),!1}return this.bindListeners(),ue.debug("Connecting",{transport:this.name,url:s}),this.changeState("connecting"),!0}close(){return this.socket?(this.socket.close(),!0):!1}send(s){return this.state==="open"?(xe.defer(()=>{this.socket&&this.socket.send(s)}),!0):!1}ping(){this.state==="open"&&this.supportsPing()&&this.socket.ping()}onOpen(){this.hooks.beforeOpen&&this.hooks.beforeOpen(this.socket,this.hooks.urls.getPath(this.key,this.options)),this.changeState("open"),this.socket.onopen=void 0}onError(s){this.emit("error",{type:"WebSocketError",error:s}),this.timeline.error(this.buildTimelineMessage({error:s.toString()}))}onClose(s){s?this.changeState("closed",{code:s.code,reason:s.reason,wasClean:s.wasClean}):this.changeState("closed"),this.unbindListeners(),this.socket=void 0}onMessage(s){this.emit("message",s)}onActivity(){this.emit("activity")}bindListeners(){this.socket.onopen=()=>{this.onOpen()},this.socket.onerror=s=>{this.onError(s)},this.socket.onclose=s=>{this.onClose(s)},this.socket.onmessage=s=>{this.onMessage(s)},this.supportsPing()&&(this.socket.onactivity=()=>{this.onActivity()})}unbindListeners(){this.socket&&(this.socket.onopen=void 0,this.socket.onerror=void 0,this.socket.onclose=void 0,this.socket.onmessage=void 0,this.supportsPing()&&(this.socket.onactivity=void 0))}changeState(s,c){this.state=s,this.timeline.info(this.buildTimelineMessage({state:s,params:c})),this.emit(s,c)}buildTimelineMessage(s){return Te({cid:this.id},s)}}class de{constructor(s){this.hooks=s}isSupported(s){return this.hooks.isSupported(s)}createConnection(s,c,f,b){return new as(this.hooks,s,c,f,b)}}var ln=new de({urls:ss,handlesActivityChecks:!1,supportsPing:!1,isInitialized:function(){return!!G.getWebSocketAPI()},isSupported:function(){return!!G.getWebSocketAPI()},getSocket:function(u){return G.createWebSocket(u)}}),Vr={urls:Un,handlesActivityChecks:!1,supportsPing:!0,isInitialized:function(){return!0}},br=Te({getSocket:function(u){return G.HTTPFactory.createStreamingSocket(u)}},Vr),qn=Te({getSocket:function(u){return G.HTTPFactory.createPollingSocket(u)}},Vr),kr={isSupported:function(){return G.isXHRSupported()}},Yr=new de(Te({},br,kr)),cs=new de(Te({},qn,kr)),pt={ws:ln,xhr_streaming:Yr,xhr_polling:cs};const ht=pt;var Xr=new de({file:"sockjs",urls:Zn,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:v.getPath("sockjs",{useTLS:s.useTLS}),ignore_null_origin:s.ignoreNullOrigin})},beforeOpen:function(u,s){u.send(JSON.stringify({path:s}))}}),_r={isSupported:function(u){var s=G.isXDRSupported(u.useTLS);return s}},vr=new de(Te({},br,_r)),Kr=new de(Te({},qn,_r));ht.xdr_streaming=vr,ht.xdr_polling=Kr,ht.sockjs=Xr;const Et=ht;class Qr extends Tt{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 eo=new Qr;class to{constructor(s,c,f){this.manager=s,this.transport=c,this.minPingDelay=f.minPingDelay,this.maxPingDelay=f.maxPingDelay,this.pingDelay=void 0}createConnection(s,c,f,b){b=Te({},b,{activityTimeout:this.pingDelay});var S=this.transport.createConnection(s,c,f,b),R=null,O=function(){S.unbind("open",O),S.bind("closed",B),R=xe.now()},B=ee=>{if(S.unbind("closed",B),ee.code===1002||ee.code===1003)this.manager.reportDeath();else if(!ee.wasClean&&R){var re=xe.now()-R;re<2*this.maxPingDelay&&(this.manager.reportDeath(),this.pingDelay=Math.max(re/2,this.minPingDelay))}};return S.bind("open",O),S}isSupported(s){return this.manager.isAlive()&&this.transport.isSupported(s)}}const yr={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=yr.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}},Gt=yr;class j extends Tt{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),ue.debug("Event sent",b),this.send(Gt.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=Gt.decodeMessage(f)}catch(S){this.emit("error",{type:"MessageParseError",error:S,data:f.data})}if(b!==void 0){switch(ue.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=()=>{Q(s,(f,b)=>{this.transport.unbind(b,f)})};Q(s,(f,b)=>{this.transport.bind(b,f)})}handleCloseEvent(s){var c=Gt.getCloseAction(s),f=Gt.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=Gt.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=Gt.getCloseAction(s)||"backoff",f=Gt.getCloseError(s);this.finish(c,{error:f})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)}unbindListeners(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)}finish(s,c){this.callback(Te({transport:this.transport,action:s},c))}}class 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 Tt{constructor(s,c){super(function(f,b){ue.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 T("Event '"+s+"' does not start with 'client-'");if(!this.subscribed){var f=M.buildLogSuffix("triggeringClientEvents");ue.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,ue.error(s.toString()),this.emit("pusher:subscription_error",Object.assign({},{type:"AuthError",error:s.message},s instanceof we?{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 se 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){Q(this.members,(c,f)=>{s(this.get(f))})}setMyID(s){this.myID=s}onSubscription(s){this.members=s.presence.hash,this.count=s.presence.count,this.me=this.get(this.myID)}addMember(s){return this.get(s.user_id)===null&&this.count++,this.members[s.user_id]=s.user_info,this.get(s.user_id)}removeMember(s){var c=this.get(s.user_id);return c&&(delete this.members[s.user_id],this.count--),c}reset(){this.members={},this.count=0,this.myID=null,this.me=null}}var Se=function(u,s,c,f){function b(S){return S instanceof c?S:new c(function(R){R(S)})}return new(c||(c=Promise))(function(S,R){function O(re){try{ee(f.next(re))}catch(Pe){R(Pe)}}function B(re){try{ee(f.throw(re))}catch(Pe){R(Pe)}}function ee(re){re.done?S(re.value):b(re.value).then(O,B)}ee((f=f.apply(u,s||[])).next())})};class Je extends se{constructor(s,c){super(s,c),this.members=new Me}authorize(s,c){super.authorize(s,(f,b)=>Se(this,void 0,void 0,function*(){if(!f)if(b=b,b.channel_data!=null){var S=JSON.parse(b.channel_data);this.members.setMyID(S.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");ue.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 S=this.members.removeMember(f);S&&this.emit("pusher:member_removed",S);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 Ct=l(978),Ot=l(594);class wr extends se{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 S=b.shared_secret;if(!S){c(new Error(`No shared_secret key in auth payload for encrypted channel: ${this.name}`),null);return}this.key=(0,Ot.decode)(S),delete b.shared_secret,c(null,b)})}trigger(s,c){throw new Oe("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){ue.debug("Received encrypted event before key has been retrieved from the authEndpoint");return}if(!c.ciphertext||!c.nonce){ue.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+c);return}let f=(0,Ot.decode)(c.ciphertext);if(f.length<this.nacl.secretbox.overheadLength){ue.error(`Expected encrypted event ciphertext length to be ${this.nacl.secretbox.overheadLength}, got: ${f.length}`);return}let b=(0,Ot.decode)(c.nonce);if(b.length<this.nacl.secretbox.nonceLength){ue.error(`Expected encrypted event nonce length to be ${this.nacl.secretbox.nonceLength}, got: ${b.length}`);return}let S=this.nacl.secretbox.open(f,b,this.key);if(S===null){ue.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){ue.error(`Failed to make a request to the authEndpoint: ${O}. Unable to fetch new key, so dropping encrypted event`);return}if(S=this.nacl.secretbox.open(f,b,this.key),S===null){ue.error("Failed to decrypt event with new key. Dropping encrypted event");return}this.emit(s,this.getDataToEmit(S))});return}this.emit(s,this.getDataToEmit(S))}getDataToEmit(s){let c=(0,Ct.D4)(s);try{return JSON.parse(c)}catch(f){return c}}}class Ie extends Tt{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 Ge(s||0,()=>{this.disconnectInternally(),this.connect()})}clearRetryTimer(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)}setUnavailableTimer(){this.unavailableTimer=new Ge(this.options.unavailableTimeout,()=>{this.updateState("unavailable")})}clearUnavailableTimer(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()}sendActivityCheck(){this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new Ge(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 Ge(this.activityTimeout,()=>{this.sendActivityCheck()}))}stopActivityCheck(){this.activityTimer&&this.activityTimer.ensureAborted()}buildConnectionCallbacks(s){return Te({},s,{message:c=>{this.resetActivityCheck(),this.emit("message",c)},ping:()=>{this.send_event("pusher:pong",{})},activity:()=>{this.resetActivityCheck()},error:c=>{this.emit("error",c)},closed:()=>{this.abandonConnection(),this.shouldRetry()&&this.retryIn(1e3)}})}buildHandshakeCallbacks(s){return Te({},s,{connected:c=>{this.activityTimeout=Math.min(this.options.activityTimeout,c.activityTimeout,c.connection.activityTimeout||1/0),this.clearUnavailableTimer(),this.setConnection(c.connection),this.socket_id=this.connection.id,this.updateState("connected",{socket_id:this.socket_id})}})}buildErrorCallbacks(){let s=c=>f=>{f.error&&this.emit("error",{type:"WebSocketError",error:f.error}),c(f)};return{tls_only:s(()=>{this.usingTLS=!0,this.updateStrategy(),this.retryIn(0)}),refused:s(()=>{this.disconnect()}),backoff:s(()=>{this.retryIn(1e3)}),retry:s(()=>{this.retryIn(0)})}}setConnection(s){this.connection=s;for(var c in this.connectionCallbacks)this.connection.bind(c,this.connectionCallbacks[c]);this.resetActivityCheck()}abandonConnection(){if(this.connection){this.stopActivityCheck();for(var s in this.connectionCallbacks)this.connection.unbind(s,this.connectionCallbacks[s]);var c=this.connection;return this.connection=null,c}}updateState(s,c){var f=this.state;if(this.state=s,f!==s){var b=s;b==="connected"&&(b+=" with new socket ID "+c.socket_id),ue.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 no{constructor(){this.channels={}}add(s,c){return this.channels[s]||(this.channels[s]=ro(s,c)),this.channels[s]}all(){return We(this.channels)}find(s){return this.channels[s]}remove(s){var c=this.channels[s];return delete this.channels[s],c}disconnect(){Q(this.channels,function(s){s.disconnect()})}}function ro(u,s){if(u.indexOf("private-encrypted-")===0){if(s.config.nacl)return Wt.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 Oe(`${c}. ${f}`)}else{if(u.indexOf("private-")===0)return Wt.createPrivateChannel(u,s);if(u.indexOf("presence-")===0)return Wt.createPresenceChannel(u,s);if(u.indexOf("#")===0)throw new C('Cannot create a channel with name "'+u+'".');return Wt.createChannel(u,s)}}var Dl={createChannels(){return new no},createConnectionManager(u,s){return new Ie(u,s)},createChannel(u,s){return new I(u,s)},createPrivateChannel(u,s){return new se(u,s)},createPresenceChannel(u,s){return new Je(u,s)},createEncryptedChannel(u,s,c){return new wr(u,s,c)},createTimelineSender(u,s){return new A(u,s)},createHandshake(u,s){return new _(u,s)},createAssistantToTheTransportManager(u,s,c){return new to(u,s,c)}};const Wt=Dl;class wi{constructor(s){this.options=s||{},this.livesLeft=this.options.lives||1/0}getAssistant(s){return Wt.createAssistantToTheTransportManager(this,s,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})}isAlive(){return this.livesLeft>0}reportDeath(){this.livesLeft-=1}}class Sn{constructor(s,c){this.strategies=s,this.loop=!!c.loop,this.failFast=!!c.failFast,this.timeout=c.timeout,this.timeoutLimit=c.timeoutLimit}isSupported(){return Ue(this.strategies,xe.method("isSupported"))}connect(s,c){var f=this.strategies,b=0,S=this.timeout,R=null,O=(B,ee)=>{ee?c(null,ee):(b=b+1,this.loop&&(b=b%f.length),b<f.length?(S&&(S=S*2,this.timeoutLimit&&(S=Math.min(S,this.timeoutLimit))),R=this.tryStrategy(f[b],s,{timeout:S,failFast:this.failFast},O)):c(!0))};return R=this.tryStrategy(f[b],s,{timeout:S,failFast:this.failFast},O),{abort:function(){R.abort()},forceMinPriority:function(B){s=B,R&&R.forceMinPriority(B)}}}tryStrategy(s,c,f,b){var S=null,R=null;return f.timeout>0&&(S=new Ge(f.timeout,function(){R.abort(),b(!0)})),R=s.connect(c,function(O,B){O&&S&&S.isRunning()&&!f.failFast||(S&&S.ensureAborted(),b(O,B))}),{abort:function(){S&&S.ensureAborted(),R.abort()},forceMinPriority:function(O){R.forceMinPriority(O)}}}}class ls{constructor(s){this.strategies=s}isSupported(){return Ue(this.strategies,xe.method("isSupported"))}connect(s,c){return Ml(this.strategies,s,function(f,b){return function(S,R){if(b[f].error=S,S){jl(b)&&c(!0);return}je(b,function(O){O.forceMinPriority(R.transport.priority)}),c(null,R)}})}}function Ml(u,s,c){var f=Ft(u,function(b,S,R,O){return b.connect(s,c(S,O))});return{abort:function(){je(f,Ul)},forceMinPriority:function(b){je(f,function(S){S.forceMinPriority(b)})}}}function jl(u){return fr(u,function(s){return!!s.error})}function Ul(u){!u.error&&!u.aborted&&(u.abort(),u.aborted=!0)}class Zl{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=ql(f),S=b&&b.cacheSkipCount?b.cacheSkipCount:0,R=[this.strategy];if(b&&b.timestamp+this.ttl>=xe.now()){var O=this.transports[b.transport];O&&(["ws","wss"].includes(b.transport)||S>3?(this.timeline.info({cached:!0,transport:b.transport,latency:b.latency}),R.push(new Sn([O],{timeout:b.latency*2+1e3,failFast:!0}))):S++)}var B=xe.now(),ee=R.pop().connect(s,function re(Pe,ao){Pe?(xi(f),R.length>0?(B=xe.now(),ee=R.pop().connect(s,re)):c(Pe)):(Hl(f,ao.transport.name,xe.now()-B,S),c(null,ao))});return{abort:function(){ee.abort()},forceMinPriority:function(re){s=re,ee&&ee.forceMinPriority(re)}}}}function us(u){return"pusherTransport"+(u?"TLS":"NonTLS")}function ql(u){var s=G.getLocalStorage();if(s)try{var c=s[us(u)];if(c)return JSON.parse(c)}catch(f){xi(u)}return null}function Hl(u,s,c,f){var b=G.getLocalStorage();if(b)try{b[us(u)]=Ae({timestamp:xe.now(),transport:s,latency:c,cacheSkipCount:f})}catch(S){}}function xi(u){var s=G.getLocalStorage();if(s)try{delete s[us(u)]}catch(c){}}class oo{constructor(s,{delay:c}){this.strategy=s,this.options={delay:c}}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy,b,S=new Ge(this.options.delay,function(){b=f.connect(s,c)});return{abort:function(){S.ensureAborted(),b&&b.abort()},forceMinPriority:function(R){s=R,b&&b.forceMinPriority(R)}}}}class xr{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 Fl{constructor(s){this.strategy=s}isSupported(){return this.strategy.isSupported()}connect(s,c){var f=this.strategy.connect(s,function(b,S){S&&f.abort(),c(b,S)});return f}}function Sr(u){return function(){return u.isSupported()}}var Bl=function(u,s,c){var f={};function b(Ni,qu,Hu,Fu,Bu){var Di=c(u,Ni,qu,Hu,Fu,Bu);return f[Ni]=Di,Di}var S=Object.assign({},s,{hostNonTLS:u.wsHost+":"+u.wsPort,hostTLS:u.wsHost+":"+u.wssPort,httpPath:u.wsPath}),R=Object.assign({},S,{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},ee=new wi({minPingDelay:1e4,maxPingDelay:u.activityTimeout}),re=new wi({lives:2,minPingDelay:1e4,maxPingDelay:u.activityTimeout}),Pe=b("ws","ws",3,S,ee),ao=b("wss","ws",3,R,ee),Du=b("sockjs","sockjs",1,O),Ri=b("xhr_streaming","xhr_streaming",1,O,re),Mu=b("xdr_streaming","xdr_streaming",1,O,re),Li=b("xhr_polling","xhr_polling",1,O),ju=b("xdr_polling","xdr_polling",1,O),zi=new Sn([Pe],B),Uu=new Sn([ao],B),Zu=new Sn([Du],B),Ii=new Sn([new xr(Sr(Ri),Ri,Mu)],B),$i=new Sn([new xr(Sr(Li),Li,ju)],B),Oi=new Sn([new xr(Sr(Ii),new ls([Ii,new oo($i,{delay:4e3})]),$i)],B),hs=new xr(Sr(Oi),Oi,Zu),fs;return s.useTLS?fs=new ls([zi,new oo(hs,{delay:2e3})]):fs=new ls([zi,new oo(Uu,{delay:2e3}),new oo(hs,{delay:5e3})]),new Zl(new Fl(new xr(Sr(Pe),fs,hs)),f,{ttl:18e5,timeline:s.timeline,useTLS:s.useTLS})};const Gl=Bl;function Wl(){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"),v.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 Jl={getRequest:function(u){var s=new window.XDomainRequest;return s.ontimeout=function(){u.emit("error",new N),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 Vl=Jl,Yl=256*1024;class Xl extends Tt{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>Yl}}var ds;(function(u){u[u.CONNECTING=0]="CONNECTING",u[u.OPEN=1]="OPEN",u[u.CLOSED=3]="CLOSED"})(ds||(ds={}));const Tn=ds;var Kl=1;class Ql{constructor(s,c){this.hooks=s,this.session=Ti(1e3)+"/"+ru(8),this.location=eu(c),this.readyState=Tn.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===Tn.OPEN)try{return G.createSocketRequest("POST",Si(tu(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=Tn.CLOSED,this.onclose&&this.onclose({code:s,reason:c,wasClean:f})}onChunk(s){if(s.status===200){this.readyState===Tn.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===Tn.CONNECTING?(s&&s.hostname&&(this.location.base=nu(this.location.base,s.hostname)),this.readyState=Tn.OPEN,this.onopen&&this.onopen()):this.onClose(1006,"Server lost session",!0)}onEvent(s){this.readyState===Tn.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",Si(this.hooks.getReceiveURL(this.location,this.session))),this.stream.bind("chunk",s=>{this.onChunk(s)}),this.stream.bind("finished",s=>{this.hooks.onFinished(this,s)}),this.stream.bind("buffer_too_long",()=>{this.reconnect()});try{this.stream.start()}catch(s){xe.defer(()=>{this.onError(s),this.onClose(1006,"Could not start streaming",!1)})}}closeStream(){this.stream&&(this.stream.unbind_all(),this.stream.close(),this.stream=null)}}function eu(u){var s=/([^\?]*)\/*(\??.*)/.exec(u);return{base:s[1],queryString:s[2]}}function tu(u,s){return u.base+"/"+s+"/xhr_send"}function Si(u){var s=u.indexOf("?")===-1?"?":"&";return u+s+"t="+ +new Date+"&n="+Kl++}function nu(u,s){var c=/(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(u);return c[1]+s+c[3]}function Ti(u){return G.randomInt(u)}function ru(u){for(var s=[],c=0;c<u;c++)s.push(Ti(32).toString(32));return s.join("")}const ou=Ql;var su={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 iu=su;var au={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 cu=au;var lu={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 uu=lu;var du={createStreamingSocket(u){return this.createSocket(iu,u)},createPollingSocket(u){return this.createSocket(cu,u)},createSocket(u,s){return new ou(u,s)},createXHR(u,s){return this.createRequest(uu,u,s)},createRequest(u,s,c){return new Xl(u,s,c)}};const Ei=du;Ei.createXDR=function(u,s){return this.createRequest(Vl,u,s)};var pu={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:h,DependenciesReceivers:w,getDefaultStrategy:Gl,Transports:Et,transportConnectionInitializer:Wl,HTTPFactory:Ei,TimelineTransport:cn,getXHRAPI(){return window.XMLHttpRequest},getWebSocketAPI(){return window.WebSocket||window.MozWebSocket},setup(u){window.Pusher=u;var s=()=>{this.onDocumentBody(u.ready)};window.JSON?s():v.load("json2",{},s)},getDocument(){return document},getProtocol(){return this.getDocument().location.protocol},getAuthorizers(){return{ajax:nn,jsonp:mr}},onDocumentBody(u){document.body?u():setTimeout(()=>{this.onDocumentBody(u)},0)},createJSONPRequest(u,s){return new Mn(u,s)},createScriptRequest(u){return new Jr(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 eo},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=pu;var ps;(function(u){u[u.ERROR=3]="ERROR",u[u.INFO=6]="INFO",u[u.DEBUG=7]="DEBUG"})(ps||(ps={}));const so=ps;class hu{constructor(s,c,f){this.key=s,this.session=c,this.events=[],this.options=f||{},this.sent=0,this.uniqueID=0}log(s,c){s<=this.options.level&&(this.events.push(Te({},c,{timestamp:xe.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())}error(s){this.log(so.ERROR,s)}info(s){this.log(so.INFO,s)}debug(s){this.log(so.DEBUG,s)}isEmpty(){return this.events.length===0}send(s,c){var f=Te({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],s(f,(b,S)=>{b||this.sent++,c&&c(b,S)}),!0}generateUniqueID(){return this.uniqueID++,this.uniqueID}}class fu{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 Ci(new J,c)}else return Ci(new te,c);var f=!1,b=this.transport.createConnection(this.name,this.priority,this.options.key,this.options),S=null,R=function(){b.unbind("initialized",R),b.connect()},O=function(){S=Wt.createHandshake(b,function(Pe){f=!0,re(),c(null,Pe)})},B=function(Pe){re(),c(Pe)},ee=function(){re();var Pe;Pe=Ae(b),c(new ye(Pe))},re=function(){b.unbind("initialized",R),b.unbind("open",O),b.unbind("error",B),b.unbind("closed",ee)};return b.bind("initialized",R),b.bind("open",O),b.bind("error",B),b.bind("closed",ee),b.initialize(),{abort:()=>{f||(re(),S?S.close():b.close())},forceMinPriority:Pe=>{f||this.priority<Pe&&(S?S.close():b.close())}}}}function Ci(u,s){return xe.defer(function(){s(u)}),{abort:function(){},forceMinPriority:function(){}}}const{Transports:gu}=G;var mu=function(u,s,c,f,b,S){var R=gu[c];if(!R)throw new Be(c);var O=(!u.enabledTransports||oe(u.enabledTransports,s)!==-1)&&(!u.disabledTransports||oe(u.disabledTransports,s)===-1),B;return O?(b=Object.assign({ignoreNullOrigin:u.ignoreNullOrigin},b),B=new fu(s,f,S?S.getAssistant(R):R,b)):B=bu,B},bu={isSupported:function(){return!1},connect:function(u,s){var c=xe.defer(function(){s(new te)});return{abort:function(){c.ensureAborted()},forceMinPriority:function(){}}}};function ku(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&&ue.warn("The disableStats option is deprecated in favor of enableStats")}const _u=(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},vu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=_u(s,u);G.getAuthorizers()[u.transport](G,f,u,E.UserAuthentication,c)}},yu=(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},wu=u=>{if(typeof G.getAuthorizers()[u.transport]=="undefined")throw`'${u.transport}' is not a recognized auth transport`;return(s,c)=>{const f=yu(s,u);G.getAuthorizers()[u.transport](G,f,u,E.ChannelAuthorization,c)}},xu=(u,s,c)=>{const f={authTransport:s.transport,authEndpoint:s.endpoint,auth:{params:s.params,headers:s.headers}};return(b,S)=>{const R=u.channel(b.channelName);c(R,f).authorize(b.socketId,S)}};function Ai(u,s){let c={activityTimeout:u.activityTimeout||m.activityTimeout,cluster:u.cluster,httpPath:u.httpPath||m.httpPath,httpPort:u.httpPort||m.httpPort,httpsPort:u.httpsPort||m.httpsPort,pongTimeout:u.pongTimeout||m.pongTimeout,statsHost:u.statsHost||m.stats_host,unavailableTimeout:u.unavailableTimeout||m.unavailableTimeout,wsPath:u.wsPath||m.wsPath,wsPort:u.wsPort||m.wsPort,wssPort:u.wssPort||m.wssPort,enableStats:Au(u),httpHost:Su(u),useTLS:Cu(u),wsHost:Tu(u),userAuthenticator:Pu(u),channelAuthorizer:Lu(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 Su(u){return u.httpHost?u.httpHost:u.cluster?`sockjs-${u.cluster}.pusher.com`:m.httpHost}function Tu(u){return u.wsHost?u.wsHost:Eu(u.cluster)}function Eu(u){return`ws-${u}.pusher.com`}function Cu(u){return G.getProtocol()==="https:"?!0:u.forceTLS!==!1}function Au(u){return"enableStats"in u?u.enableStats:"disableStats"in u?!u.disableStats:!1}const Pi=u=>"customHandler"in u&&u.customHandler!=null;function Pu(u){const s=Object.assign(Object.assign({},m.userAuthentication),u.userAuthentication);return Pi(s)?s.customHandler:vu(s)}function Ru(u,s){let c;if("channelAuthorization"in u)c=Object.assign(Object.assign({},m.channelAuthorization),u.channelAuthorization);else if(c={transport:u.authTransport||m.authTransport,endpoint:u.authEndpoint||m.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:xu(s,c,u.authorizer)};return c}function Lu(u,s){const c=Ru(u,s);return Pi(c)?c.customHandler:wu(c)}class zu extends Tt{constructor(s){super(function(c,f){ue.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 Iu(){let u,s;return{promise:new Promise((f,b)=>{u=f,s=b}),resolve:u,reject:s}}const $u=Iu;class Ou extends Tt{constructor(s){super(function(c,f){ue.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){ue.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 zu(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){ue.error(`Failed parsing user data after signin: ${s.user_data}`),this._cleanup();return}if(typeof this.user_data.id!="string"||this.user_data.id===""){ue.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}=$u();s.done=!1;const f=()=>{s.done=!0};s.then(f).catch(f),this.signinDonePromise=s,this._signinDoneResolve=c}}class Ze{static ready(){Ze.isReady=!0;for(var s=0,c=Ze.instances.length;s<c;s++)Ze.instances[s].connect()}static getClientFeatures(){return Ne(Ce({ws:G.Transports.ws},function(s){return s.isSupported({})}))}constructor(s,c){Nu(s),ku(c),this.key=s,this.options=c,this.config=Ai(this.options,this),this.channels=Wt.createChannels(),this.global_emitter=new Tt,this.sessionID=G.randomInt(1e9),this.timeline=new hu(this.key,this.sessionID,{cluster:this.config.cluster,features:Ze.getClientFeatures(),params:this.config.timelineParams||{},limit:50,level:so.INFO,version:m.VERSION}),this.config.enableStats&&(this.timelineSender=Wt.createTimelineSender(this.timeline,{host:this.config.statsHost,path:"/timeline/v2/"+G.TimelineTransport.name}));var f=b=>G.getDefaultStrategy(this.config,b,mu);this.connection=Wt.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 S=b.event,R=S.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=>{ue.warn(b)}),Ze.instances.push(this),this.timeline.info({instances:Ze.instances.length}),this.user=new Ou(this),Ze.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=Ai(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 an(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()}}Ze.instances=[],Ze.isReady=!1,Ze.logToConsole=!1,Ze.Runtime=G,Ze.ScriptReceivers=G.ScriptReceivers,Ze.DependenciesReceivers=G.DependenciesReceivers,Ze.auth_callbacks=G.auth_callbacks;const io=Ze;function Nu(u){if(u==null)throw"You must pass your app key when you instantiate Pusher."}G.setup(Ze)}},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})())})(vs)),vs.exports}var jm=Mm();const Um=Dm(jm);let zt=null,Hn=null;function Zm(e){return z(this,null,function*(){return Hn||(Hn=z(null,null,function*(){const t=e.backendUrl.replace(/\/+$/,""),n=yield jo(`${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();zt=new Um(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)=>{jo(`${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))}}})}),Hn.catch(()=>{Hn=null}),Hn)})}function qm(e){if(!e||!zt)return null;let t=!1;const n=({current:r})=>{r==="connected"&&t?(t=!1,e()):r!=="connected"&&(t=!0)};return zt.connection.bind("state_change",n),()=>zt==null?void 0:zt.connection.unbind("state_change",n)}function Hm(e,t,n){return z(this,null,function*(){if(yield Zm(e),!zt)return()=>{};const r=zt.subscribe(`private-task-${t}`);n.onStatusUpdate&&r.bind(lo.TASK_STATUS_UPDATED,n.onStatusUpdate),n.onInteractionCreated&&r.bind(lo.TASK_INTERACTION_CREATED,n.onInteractionCreated),n.onInteractionAnswered&&r.bind(lo.TASK_INTERACTION_ANSWERED,n.onInteractionAnswered),n.onBrowserCommandCreated&&r.bind(lo.TASK_BROWSER_COMMAND_CREATED,n.onBrowserCommandCreated);const o=qm(n.onReconnect);return()=>{r.unbind_all(),zt==null||zt.unsubscribe(`private-task-${t}`),o==null||o()}})}const ei="ap-sdk-active-automation";function Fm(){try{const e=sessionStorage.getItem(ei);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 Uc(e){try{sessionStorage.setItem(ei,JSON.stringify(e))}catch(t){}}function Zc(){try{sessionStorage.removeItem(ei)}catch(e){}}function Bm(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 Gm(),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 Gm(){return new Promise(e=>{typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>e()):setTimeout(e,16)})}const ti="shared",qc="ap-sdk-panel-size:",ka=280,_a=200;function Wm(e){try{const t=sessionStorage.getItem(qc+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 Jm(e,t){try{sessionStorage.setItem(qc+e,JSON.stringify(t))}catch(n){}}function fo(e,t,n){return Math.min(Math.max(e,t),n)}function va(){return window.innerWidth-32}function ya(){return window.innerHeight-64}function ni(e,t){const n=Wm(t);n&&(e.style.width=`${fo(n.width,ka,va())}px`,e.style.height=`${fo(n.height,_a,ya())}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 g=k=>{o&&(p=fo(d+(k.clientX-i),ka,va()),h=fo(l+(k.clientY-a),_a,ya()),e.style.width=`${p}px`,e.style.height=`${h}px`)},m=()=>{o&&(o=!1,document.removeEventListener("pointermove",g),document.removeEventListener("pointerup",m),Jm(t,{width:p,height:h}))};r.addEventListener("pointerdown",k=>{k.preventDefault(),k.stopPropagation(),o=!0,i=k.clientX,a=k.clientY;const w=e.getBoundingClientRect();d=w.width,l=w.height,p=d,h=l,document.addEventListener("pointermove",g),document.addEventListener("pointerup",m)})}function ri(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Dn=ri();function Hc(e){Dn=e}var Cn={exec:()=>null};function Fn(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(Ve.caret,"$1"),n=n.replace(o,a),r},getRegex:()=>new RegExp(n,t)};return r}var Vm=((e="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+e)}catch(t){return!1}})(),Ve={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:Fn(e=>new RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Fn(e=>new RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:Fn(e=>new RegExp(`^ {0,${e}}>`))},Ym=/^(?:[ \t]*(?:\n|$))+/,Xm=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Km=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Br=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Qm=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oi=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Fc=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Bc=Y(Fc).replace(/bull/g,oi).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(),eb=Y(Fc).replace(/bull/g,oi).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(),si=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,tb=/^[^\n]+/,ii=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,nb=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ii).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rb=Y(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,oi).getRegex(),ns="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",ai=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ob=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",ai).replace("tag",ns).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Gc=e=>Y(si).replace("hr",Br).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",ns).getRegex(),sb=Gc(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ib=Gc(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ab=Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ib).getRegex(),ci={blockquote:ab,code:Xm,def:nb,fences:Km,heading:Qm,hr:Br,html:ob,lheading:Bc,list:rb,newline:Ym,paragraph:sb,table:Cn,text:tb},wa=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Br).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",ns).getRegex(),cb=D(y({},ci),{lheading:eb,table:wa,paragraph:Y(si).replace("hr",Br).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",wa).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",ns).getRegex()}),lb=D(y({},ci),{html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",ai).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:Cn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(si).replace("hr",Br).replace("heading",` *#{1,6} *[^
1519
+ ]`).replace("lheading",Bc).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()}),ub=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,db=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Wc=/^( {2,}|\\)\n(?!\s*$)/,pb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tn=/[\p{P}\p{S}]/u,pr=/[\s\p{P}\p{S}]/u,Gr=/[^\s\p{P}\p{S}]/u,hb=Y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,pr).getRegex(),fb=/[\p{Pi}\p{Ps}"']/u,Jc=/(?!~)[\p{P}\p{S}]/u,gb=/(?!~)[\s\p{P}\p{S}]/u,mb=/(?:[^\s\p{P}\p{S}]|~)/u,bb=Y(/link|precode-code|html/,"g").replace("link",new RegExp("\\[(?:[^\\[\\]`]|(?<a>`+)[^`]+\\k<a>(?!`))*?\\]\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)]|\\((?:\\\\[\\s\\S]|[^\\\\\\(\\)])*\\))*\\)")).replace("precode-",Vm?"(?<!`)()":"(^^|[^`])").replace("code",new RegExp("(?<b>`+)[^`]+\\k<b>(?!`)")).replace("html",/<(?! )[^<>]*?>/).getRegex(),Vc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kb=Y(Vc,"u").replace(/punct/g,tn).getRegex(),_b=Y(Vc,"u").replace(/punct/g,Jc).getRegex(),vb=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,yb=Y(vb,"u").replace(/openQuote/g,fb).replace(/punct/g,tn).getRegex(),Yc="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",wb=Y(Yc,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),xb=Y(Yc,"gu").replace(/notPunctSpace/g,mb).replace(/punctSpace/g,gb).replace(/punct/g,Jc).getRegex(),Sb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",Tb=Y(Sb,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),Eb=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),Cb="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Ab=Y(Cb,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),Pb=Y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,tn).getRegex(),Rb="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Lb=Y(Rb,"gu").replace(/notPunctSpace/g,Gr).replace(/punctSpace/g,pr).replace(/punct/g,tn).getRegex(),zb=Y(/\\(punct)/,"gu").replace(/punct/g,tn).getRegex(),Ib=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(),$b=Y(ai).replace("(?:-->|$)","-->").getRegex(),Ob=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",$b).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Zo=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Nb=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Zo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Xc=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",Zo).replace("ref",ii).getRegex(),Kc=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",ii).getRegex(),Db=Y("reflink|nolink(?!\\()","g").replace("reflink",Xc).replace("nolink",Kc).getRegex(),xa=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,li={_backpedal:Cn,anyPunctuation:zb,autolink:Ib,blockSkip:bb,br:Wc,code:db,del:Cn,delLDelim:Cn,delRDelim:Cn,emStrongLDelim:kb,emStrongRDelimAst:wb,emStrongRDelimUnd:Eb,escape:ub,link:Nb,nolink:Kc,punctuation:hb,reflink:Xc,reflinkSearch:Db,tag:Ob,text:pb,url:Cn},Mb=D(y({},li),{emStrongLDelim:yb,emStrongRDelimAst:Tb,emStrongRDelimUnd:Ab,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",Zo).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Zo).getRegex()}),Ns=D(y({},li),{emStrongRDelimAst:xb,emStrongLDelim:_b,delLDelim:Pb,delRDelim:Lb,url:Y(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",xa).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",xa).getRegex()}),jb=D(y({},Ns),{br:Y(Wc).replace("{2,}","*").getRegex(),text:Y(Ns.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()}),go={normal:ci,gfm:cb,pedantic:lb},Er={normal:li,gfm:Ns,breaks:jb,pedantic:Mb},Ub={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Sa=e=>Ub[e];function Nt(e,t){if(t){if(Ve.escapeTest.test(e))return e.replace(Ve.escapeReplace,Sa)}else if(Ve.escapeTestNoEncode.test(e))return e.replace(Ve.escapeReplaceNoEncode,Sa);return e}function Ta(e){try{e=encodeURI(e).replace(Ve.percentDecode,"%")}catch(t){return null}return e}function Ea(e,t){var i;let n=e.replace(Ve.findPipe,(a,d,l)=>{let p=!1,h=d;for(;--h>=0&&l[h]==="\\";)p=!p;return p?"|":" |"}),r=n.split(Ve.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(Ve.slashPipe,"|");return r}function un(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 Ca(e){let t=e.split(`
1520
1520
  `),n=t.length-1;for(;n>=0&&Ve.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
1521
- `)}function jb(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 Ub(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 Aa(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 Zb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1521
+ `)}function Zb(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 qb(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 Aa(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 Hb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let o=r[1];return t.split(`
1522
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(`
1523
- `)}var qo=class{constructor(e){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=e||Dn}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]:Ca(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=Zb(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=un(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:un(t[0],`
1523
+ `)}var qo=class{constructor(e){ie(this,"options");ie(this,"rules");ie(this,"lexer");this.options=e||Dn}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]:Ca(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=Hb(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=un(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:un(t[0],`
1524
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:un(t[0],`
1525
1525
  `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let n=un(t[0],`
1526
1526
  `).split(`
@@ -1534,7 +1534,7 @@ ${h}`:h;let g=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
1534
1534
  ${w}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((m==null?void 0:m.type)==="list"){let k=m,w=k.raw+`
1535
1535
  `+n.join(`
1536
1536
  `),v=this.list(w);i[i.length-1]=v,r=r.substring(0,r.length-m.raw.length)+v.raw,o=o.substring(0,o.length-k.raw.length)+v.raw,n=w.substring(i.at(-1).raw.length).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 g=Ub(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 g=qb(t[2].split(`
1538
1538
  `,1)[0],t[1].length),m=e.split(`
1539
1539
  `,1)[0],k=!g.trim(),w=0;if(this.options.pedantic?(w=2,h=g.trimStart()):k?w=t[1].length+1:(w=g.search(this.rules.other.nonSpaceChar),w=w>4?1:w,h=g.slice(w),w+=t[1].length),k&&this.rules.other.blankLine.test(m)&&(p+=m+`
1540
1540
  `,e=e.substring(m.length+1),l=!0),!l){let v=this.rules.other.nextBulletRegex(w),Z=this.rules.other.hrRegex(w),K=this.rules.other.fencesBeginRegex(w),M=this.rules.other.headingBeginRegex(w),E=this.rules.other.htmlBeginRegex(w),T=this.rules.other.blockquoteBeginRegex(w);for(;e;){let C=e.split(`
@@ -1546,7 +1546,7 @@ ${w}`,o=o.substring(0,o.length-k.text.length)+Z.text;break}else if((m==null?void
1546
1546
  `):[],i={type:"table",raw:un(t[0],`
1547
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(Ea(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:un(t[0],`
1548
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)===`
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=un(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=jb(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)),Aa(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 Aa(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,g=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(r=g.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){l+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+l);let m=[...r[0]][0].length,k=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let v=k.slice(1,-1);return{type:"em",raw:k,text:v,tokens:this.lexer.inlineTokens(v)}}let w=k.slice(2,-2);return{type:"strong",raw:k,text:w,tokens:this.lexer.inlineTokens(w)}}}}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),g=h.slice(o,-o);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Rt=class Ds{constructor(t){ie(this,"tokens");ie(this,"options");ie(this,"state");ie(this,"inlineQueue");ie(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Dn,this.options.tokenizer=this.options.tokenizer||new qo,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:Ve,block:go.normal,inline:Er.normal};this.options.pedantic?(n.block=go.pedantic,n.inline=Er.pedantic):this.options.gfm&&(n.block=go.gfm,this.options.breaks?n.inline=Er.breaks:n.inline=Er.gfm),this.tokenizer.rules=n}static get rules(){return{block:go,inline:Er}}static lex(t,n){return new Ds(n).lex(t)}static lexInline(t,n){return new Ds(n).inlineTokens(t)}lex(t){t=t.replace(Ve.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=un(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{let i=Zb(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)),Aa(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 Aa(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,g=p==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+o);(r=g.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){d+=a;continue}else if(r[5]||r[6]){if(o%3&&!((o+a)%3)){l+=a;continue}if(h)break}if(d-=a,d>0)continue;a=Math.min(a,a+d+l);let m=[...r[0]][0].length,k=e.slice(0,o+r.index+m+a);if(Math.min(o,a)%2){let v=k.slice(1,-1);return{type:"em",raw:k,text:v,tokens:this.lexer.inlineTokens(v)}}let w=k.slice(2,-2);return{type:"strong",raw:k,text:w,tokens:this.lexer.inlineTokens(w)}}}}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),g=h.slice(o,-o);return{type:"del",raw:h,text:g,tokens:this.lexer.inlineTokens(g)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let n,r;return t[2]==="@"?(n=t[1],r="mailto:"+n):(n=t[1],r=n),{type:"link",raw:t[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n,r;let t;if(t=this.rules.inline.url.exec(e)){let o,i;if(t[2]==="@")o=t[0],i="mailto:"+o;else{let a;do a=t[0],t[0]=(r=(n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])!=null?r:"";while(a!==t[0]);o=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},Rt=class Ds{constructor(t){ie(this,"tokens");ie(this,"options");ie(this,"state");ie(this,"inlineQueue");ie(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Dn,this.options.tokenizer=this.options.tokenizer||new qo,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:Ve,block:go.normal,inline:Er.normal};this.options.pedantic?(n.block=go.pedantic,n.inline=Er.pedantic):this.options.gfm&&(n.block=go.gfm,this.options.breaks?n.inline=Er.breaks:n.inline=Er.gfm),this.tokenizer.rules=n}static get rules(){return{block:go,inline:Er}}static lex(t,n){return new Ds(n).lex(t)}static lexInline(t,n){return new Ds(n).inlineTokens(t)}lex(t){t=t.replace(Ve.carriageReturn,`
1550
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(Ve.tabCharGlobal," ").replace(Ve.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+=`
1551
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(`
1552
1552
  `)?"":`
@@ -1578,9 +1578,9 @@ ${this.parser.parse(e)}</blockquote>
1578
1578
  `}tablerow({text:e}){return`<tr>
1579
1579
  ${e}</tr>
1580
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}>
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>${Nt(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=Ta(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Nt(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=Ta(e);if(o===null)return Nt(n);e=o;let i=`<img src="${e}" alt="${Nt(n)}"`;return t&&(i+=` title="${Nt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Nt(e.text)}},ui=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}},Lt=class Ms{constructor(t){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=t||Dn,this.options.renderer=this.options.renderer||new Ho,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ui}static parse(t,n){return new Ms(n).parse(t)}static parseInline(t,n){return new Ms(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}},vo,Ir=(vo=class{constructor(e){ie(this,"options");ie(this,"block");this.options=e||Dn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Rt.lex:Rt.lexInline}provideParser(e=this.block){return e?Lt.parse:Lt.parseInline}},ie(vo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(vo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),vo),qb=class{constructor(...e){ie(this,"defaults",ri());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",Lt);ie(this,"Renderer",Ho);ie(this,"TextRenderer",ui);ie(this,"Lexer",Rt);ie(this,"Tokenizer",qo);ie(this,"Hooks",Ir);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 Ho(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 qo(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 Ir;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];Ir.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Ir.passThroughHooksRespectAsync.has(i))return z(this,null,function*(){let g=yield d.call(o,p);return l.call(o,g)});let h=d.call(o,p);return l.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return z(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield l.apply(o,p)),g});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 Rt.lex(e,t!=null?t:this.defaults)}parser(e,t){return Lt.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?Rt.lex:Rt.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?Lt.parse:Lt.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?Rt.lex:Rt.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?Lt.parse:Lt.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>"+Nt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},In=new qb;function ce(e,t){return In.parse(e,t)}ce.options=ce.setOptions=function(e){return In.setOptions(e),ce.defaults=In.defaults,qc(ce.defaults),ce};ce.getDefaults=ri;ce.defaults=Dn;function Hb(...e){return In.use(...e),ce.defaults=In.defaults,qc(ce.defaults),ce}ce.use=Hb;ce.walkTokens=function(e,t){return In.walkTokens(e,t)};ce.parseInline=In.parseInline;ce.Parser=Lt;ce.parser=Lt.parse;ce.Renderer=Ho;ce.TextRenderer=ui;ce.Lexer=Rt;ce.lexer=Rt.lex;ce.Tokenizer=qo;ce.Hooks=Ir;ce.parse=ce;ce.options;ce.setOptions;ce.walkTokens;ce.parseInline;Lt.parse;Rt.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:Kc,setPrototypeOf:Pa,isFrozen:Fb,getPrototypeOf:Bb,getOwnPropertyDescriptor:Gb}=Object;let{freeze:nt,seal:kt,create:js}=Object,{apply:Us,construct:Zs}=typeof Reflect!="undefined"&&Reflect;nt||(nt=function(t){return t});kt||(kt=function(t){return t});Us||(Us=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)});Zs||(Zs=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 mo=rt(Array.prototype.forEach),Wb=rt(Array.prototype.lastIndexOf),Ra=rt(Array.prototype.pop),Cr=rt(Array.prototype.push),Jb=rt(Array.prototype.splice),xo=rt(String.prototype.toLowerCase),ys=rt(String.prototype.toString),ws=rt(String.prototype.match),Ar=rt(String.prototype.replace),Vb=rt(String.prototype.indexOf),Yb=rt(String.prototype.trim),At=rt(Object.prototype.hasOwnProperty),Xe=rt(RegExp.prototype.test),Pr=Xb(TypeError);function rt(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 Us(e,t,r)}}function Xb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Zs(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xo;Pa&&Pa(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Fb(t)||(t[r]=i),o=i)}e[o]=!0}return e}function Kb(e){for(let t=0;t<e.length;t++)At(e,t)||(e[t]=null);return e}function Dt(e){const t=js(null);for(const[n,r]of Kc(e))At(e,n)&&(Array.isArray(r)?t[n]=Kb(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Dt(r):t[n]=r);return t}function Rr(e,t){for(;e!==null;){const r=Gb(e,t);if(r){if(r.get)return rt(r.get);if(typeof r.value=="function")return rt(r.value)}e=Bb(e)}function n(){return null}return n}const La=nt(["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"]),xs=nt(["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"]),Ss=nt(["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"]),Qb=nt(["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"]),Ts=nt(["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"]),ek=nt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),za=nt(["#text"]),Ia=nt(["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"]),Es=nt(["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"]),$a=nt(["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"]),bo=nt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),tk=kt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),nk=kt(/<%[\w\W]*|[\w\W]*%>/gm),rk=kt(/\$\{[\w\W]*/gm),ok=kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),sk=kt(/^aria-[\-\w]+$/),Qc=kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ik=kt(/^(?:\w+script|data):/i),ak=kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),el=kt(/^html$/i),ck=kt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Oa=Object.freeze({__proto__:null,ARIA_ATTR:sk,ATTR_WHITESPACE:ak,CUSTOM_ELEMENT:ck,DATA_ATTR:ok,DOCTYPE_NAME:el,ERB_EXPR:nk,IS_ALLOWED_URI:Qc,IS_SCRIPT_OR_DATA:ik,MUSTACHE_EXPR:tk,TMPLIT_EXPR:rk});const Lr={element:1,text:3,progressingInstruction:7,comment:8,document:9},lk=function(){return typeof window=="undefined"?null:window},uk=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}},Na=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function tl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lk();const t=j=>tl(j);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Lr.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:g,DOMParser:m,trustedTypes:k}=e,w=l.prototype,v=Rr(w,"cloneNode"),Z=Rr(w,"remove"),K=Rr(w,"nextSibling"),M=Rr(w,"childNodes"),E=Rr(w,"parentNode");if(typeof a=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let T,C="";const{implementation:N,createNodeIterator:J,createDocumentFragment:ye,getElementsByTagName:Oe}=n,{importNode:Be}=r;let te=Na();t.isSupported=typeof Kc=="function"&&typeof E=="function"&&N&&N.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:we,ERB_EXPR:ot,TMPLIT_EXPR:nn,DATA_ATTR:rn,ARIA_ATTR:dt,IS_SCRIPT_OR_DATA:It,ATTR_WHITESPACE:on,CUSTOM_ELEMENT:sn}=Oa;let{IS_ALLOWED_URI:$t}=Oa,pe=null;const vt=V({},[...La,...xs,...Ss,...Ts,...za]);let _e=null;const yn=V({},[...Ia,...Es,...$a,...bo]);let le=Object.seal(js(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}})),Ge=null,an=null;const yt=Object.seal(js(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xe=!0,Te=!0,H=!1,oe=!0,Q=!1,Ne=!0,We=!1,je=!1,Ft=!1,wt=!1,De=!1,Ce=!1,ze=!0,Ue=!1;const fr="user-content-";let Ye=!0,st=!1,xt={},Ae=null;const gr=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 ue=null;const Wr=V({},["audio","video","img","source","image","track"]);let mr=null;const Jr=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Mn="http://www.w3.org/1998/Math/MathML",jn="http://www.w3.org/2000/svg",St="http://www.w3.org/1999/xhtml";let cn=St,wn=!1,xn=null;const ss=V({},[Mn,jn,St],ys);let Un=V({},["mi","mo","mn","ms","mtext"]),Zn=V({},["annotation-xml"]);const is=V({},["title","style","font","a","script"]);let Bt=null;const Tt=["application/xhtml+xml","text/html"],as="text/html";let de=null,ln=null;const Vr=n.createElement("form"),br=function(_){return _ instanceof RegExp||_ instanceof Function},qn=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ln&&ln===_)){if((!_||typeof _!="object")&&(_={}),_=Dt(_),Bt=Tt.indexOf(_.PARSER_MEDIA_TYPE)===-1?as:_.PARSER_MEDIA_TYPE,de=Bt==="application/xhtml+xml"?ys:xo,pe=At(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,de):vt,_e=At(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,de):yn,xn=At(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,ys):ss,mr=At(_,"ADD_URI_SAFE_ATTR")?V(Dt(Jr),_.ADD_URI_SAFE_ATTR,de):Jr,ue=At(_,"ADD_DATA_URI_TAGS")?V(Dt(Wr),_.ADD_DATA_URI_TAGS,de):Wr,Ae=At(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,de):gr,Ge=At(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,de):Dt({}),an=At(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,de):Dt({}),xt=At(_,"USE_PROFILES")?_.USE_PROFILES:!1,xe=_.ALLOW_ARIA_ATTR!==!1,Te=_.ALLOW_DATA_ATTR!==!1,H=_.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=_.SAFE_FOR_TEMPLATES||!1,Ne=_.SAFE_FOR_XML!==!1,We=_.WHOLE_DOCUMENT||!1,wt=_.RETURN_DOM||!1,De=_.RETURN_DOM_FRAGMENT||!1,Ce=_.RETURN_TRUSTED_TYPE||!1,Ft=_.FORCE_BODY||!1,ze=_.SANITIZE_DOM!==!1,Ue=_.SANITIZE_NAMED_PROPS||!1,Ye=_.KEEP_CONTENT!==!1,st=_.IN_PLACE||!1,$t=_.ALLOWED_URI_REGEXP||Qc,cn=_.NAMESPACE||St,Un=_.MATHML_TEXT_INTEGRATION_POINTS||Un,Zn=_.HTML_INTEGRATION_POINTS||Zn,le=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&br(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(le.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&br(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(le.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Q&&(Te=!1),De&&(wt=!0),xt&&(pe=V({},za),_e=[],xt.html===!0&&(V(pe,La),V(_e,Ia)),xt.svg===!0&&(V(pe,xs),V(_e,Es),V(_e,bo)),xt.svgFilters===!0&&(V(pe,Ss),V(_e,Es),V(_e,bo)),xt.mathMl===!0&&(V(pe,Ts),V(_e,$a),V(_e,bo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?yt.tagCheck=_.ADD_TAGS:(pe===vt&&(pe=Dt(pe)),V(pe,_.ADD_TAGS,de))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?yt.attributeCheck=_.ADD_ATTR:(_e===yn&&(_e=Dt(_e)),V(_e,_.ADD_ATTR,de))),_.ADD_URI_SAFE_ATTR&&V(mr,_.ADD_URI_SAFE_ATTR,de),_.FORBID_CONTENTS&&(Ae===gr&&(Ae=Dt(Ae)),V(Ae,_.FORBID_CONTENTS,de)),_.ADD_FORBID_CONTENTS&&(Ae===gr&&(Ae=Dt(Ae)),V(Ae,_.ADD_FORBID_CONTENTS,de)),Ye&&(pe["#text"]=!0),We&&V(pe,["html","head","body"]),pe.table&&(V(pe,["tbody"]),delete Ge.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Pr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Pr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=_.TRUSTED_TYPES_POLICY,C=T.createHTML("")}else T===void 0&&(T=uk(k,o)),T!==null&&typeof C=="string"&&(C=T.createHTML(""));nt&&nt(_),ln=_}},kr=V({},[...xs,...Ss,...Qb]),Yr=V({},[...Ts,...ek]),cs=function(_){let A=E(_);(!A||!A.tagName)&&(A={namespaceURI:cn,tagName:"template"});const I=xo(_.tagName),se=xo(A.tagName);return xn[_.namespaceURI]?_.namespaceURI===jn?A.namespaceURI===St?I==="svg":A.namespaceURI===Mn?I==="svg"&&(se==="annotation-xml"||Un[se]):!!kr[I]:_.namespaceURI===Mn?A.namespaceURI===St?I==="math":A.namespaceURI===jn?I==="math"&&Zn[se]:!!Yr[I]:_.namespaceURI===St?A.namespaceURI===jn&&!Zn[se]||A.namespaceURI===Mn&&!Un[se]?!1:!Yr[I]&&(is[I]||!kr[I]):!!(Bt==="application/xhtml+xml"&&xn[_.namespaceURI]):!1},pt=function(_){Cr(t.removed,{element:_});try{E(_).removeChild(_)}catch(A){Z(_)}},ht=function(_,A){try{Cr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Cr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(wt||De)try{pt(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Xr=function(_){let A=null,I=null;if(Ft)_="<remove></remove>"+_;else{const Se=ws(_,/^[\r\n\t ]+/);I=Se&&Se[0]}Bt==="application/xhtml+xml"&&cn===St&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const se=T?T.createHTML(_):_;if(cn===St)try{A=new m().parseFromString(se,Bt)}catch(Se){}if(!A||!A.documentElement){A=N.createDocument(cn,"template",null);try{A.documentElement.innerHTML=wn?C:se}catch(Se){}}const Me=A.body||A.documentElement;return _&&I&&Me.insertBefore(n.createTextNode(I),Me.childNodes[0]||null),cn===St?Oe.call(A,We?"html":"body")[0]:We?A.documentElement:Me},_r=function(_){return J.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},vr=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Kr=function(_){return typeof d=="function"&&_ instanceof d};function Et(j,_,A){mo(j,I=>{I.call(t,_,A,ln)})}const Qr=function(_){let A=null;if(Et(te.beforeSanitizeElements,_,null),vr(_))return pt(_),!0;const I=de(_.nodeName);if(Et(te.uponSanitizeElement,_,{tagName:I,allowedTags:pe}),Ne&&_.hasChildNodes()&&!Kr(_.firstElementChild)&&Xe(/<[/\w!]/g,_.innerHTML)&&Xe(/<[/\w!]/g,_.textContent)||_.nodeType===Lr.progressingInstruction||Ne&&_.nodeType===Lr.comment&&Xe(/<[/\w]/g,_.data))return pt(_),!0;if(!(yt.tagCheck instanceof Function&&yt.tagCheck(I))&&(!pe[I]||Ge[I])){if(!Ge[I]&&to(I)&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,I)||le.tagNameCheck instanceof Function&&le.tagNameCheck(I)))return!1;if(Ye&&!Ae[I]){const se=E(_)||_.parentNode,Me=M(_)||_.childNodes;if(Me&&se){const Se=Me.length;for(let Je=Se-1;Je>=0;--Je){const Ct=v(Me[Je],!0);Ct.__removalCount=(_.__removalCount||0)+1,se.insertBefore(Ct,K(_))}}}return pt(_),!0}return _ instanceof l&&!cs(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Xe(/<\/no(script|embed|frames)/i,_.innerHTML)?(pt(_),!0):(Q&&_.nodeType===Lr.text&&(A=_.textContent,mo([we,ot,nn],se=>{A=Ar(A,se," ")}),_.textContent!==A&&(Cr(t.removed,{element:_.cloneNode()}),_.textContent=A)),Et(te.afterSanitizeElements,_,null),!1)},eo=function(_,A,I){if(ze&&(A==="id"||A==="name")&&(I in n||I in Vr))return!1;if(!(Te&&!an[A]&&Xe(rn,A))){if(!(xe&&Xe(dt,A))){if(!(yt.attributeCheck instanceof Function&&yt.attributeCheck(A,_))){if(!_e[A]||an[A]){if(!(to(_)&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,_)||le.tagNameCheck instanceof Function&&le.tagNameCheck(_))&&(le.attributeNameCheck instanceof RegExp&&Xe(le.attributeNameCheck,A)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(A,_))||A==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,I)||le.tagNameCheck instanceof Function&&le.tagNameCheck(I))))return!1}else if(!mr[A]){if(!Xe($t,Ar(I,on,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Vb(I,"data:")===0&&ue[_])){if(!(H&&!Xe(It,Ar(I,on,"")))){if(I)return!1}}}}}}}return!0},to=function(_){return _!=="annotation-xml"&&ws(_,sn)},yr=function(_){Et(te.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||vr(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_e,forceKeepAttr:void 0};let se=A.length;for(;se--;){const Me=A[se],{name:Se,namespaceURI:Je,value:Ct}=Me,Ot=de(Se),wr=Ct;let Ie=Se==="value"?wr:Yb(wr);if(I.attrName=Ot,I.attrValue=Ie,I.keepAttr=!0,I.forceKeepAttr=void 0,Et(te.uponSanitizeAttribute,_,I),Ie=I.attrValue,Ue&&(Ot==="id"||Ot==="name")&&(ht(Se,_),Ie=fr+Ie),Ne&&Xe(/((--!?|])>)|<\/(style|title|textarea)/i,Ie)){ht(Se,_);continue}if(Ot==="attributename"&&ws(Ie,"href")){ht(Se,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){ht(Se,_);continue}if(!oe&&Xe(/\/>/i,Ie)){ht(Se,_);continue}Q&&mo([we,ot,nn],ro=>{Ie=Ar(Ie,ro," ")});const no=de(_.nodeName);if(!eo(no,Ot,Ie)){ht(Se,_);continue}if(T&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Je)switch(k.getAttributeType(no,Ot)){case"TrustedHTML":{Ie=T.createHTML(Ie);break}case"TrustedScriptURL":{Ie=T.createScriptURL(Ie);break}}if(Ie!==wr)try{Je?_.setAttributeNS(Je,Se,Ie):_.setAttribute(Se,Ie),vr(_)?pt(_):Ra(t.removed)}catch(ro){ht(Se,_)}}Et(te.afterSanitizeAttributes,_,null)},Gt=function j(_){let A=null;const I=_r(_);for(Et(te.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)Et(te.uponSanitizeShadowNode,A,null),Qr(A),yr(A),A.content instanceof i&&j(A.content);Et(te.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(j){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,se=null,Me=null;if(wn=!j,wn&&(j="<!-->"),typeof j!="string"&&!Kr(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Pr("dirty is not a string, aborting")}else throw Pr("toString is not a function");if(!t.isSupported)return j;if(je||qn(_),t.removed=[],typeof j=="string"&&(st=!1),st){if(j.nodeName){const Ct=de(j.nodeName);if(!pe[Ct]||Ge[Ct])throw Pr("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof d)A=Xr("<!---->"),I=A.ownerDocument.importNode(j,!0),I.nodeType===Lr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!wt&&!Q&&!We&&j.indexOf("<")===-1)return T&&Ce?T.createHTML(j):j;if(A=Xr(j),!A)return wt?null:Ce?C:""}A&&Ft&&pt(A.firstChild);const Se=_r(st?j:A);for(;se=Se.nextNode();)Qr(se),yr(se),se.content instanceof i&&Gt(se.content);if(st)return j;if(wt){if(De)for(Me=ye.call(A.ownerDocument);A.firstChild;)Me.appendChild(A.firstChild);else Me=A;return(_e.shadowroot||_e.shadowrootmode)&&(Me=Be.call(r,Me,!0)),Me}let Je=We?A.outerHTML:A.innerHTML;return We&&pe["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Xe(el,A.ownerDocument.doctype.name)&&(Je="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1583
- `+Je),Q&&mo([we,ot,nn],Ct=>{Je=Ar(Je,Ct," ")}),T&&Ce?T.createHTML(Je):Je},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qn(j),je=!0},t.clearConfig=function(){ln=null,je=!1},t.isValidAttribute=function(j,_,A){ln||qn({});const I=de(j),se=de(_);return eo(I,se,A)},t.addHook=function(j,_){typeof _=="function"&&Cr(te[j],_)},t.removeHook=function(j,_){if(_!==void 0){const A=Wb(te[j],_);return A===-1?void 0:Jb(te[j],A,1)[0]}return Ra(te[j])},t.removeHooks=function(j){te[j]=[]},t.removeAllHooks=function(){te=Na()},t}var dk=tl();function nl(e){const t=ce.parse(e,{gfm:!0,breaks:!0,async:!1});return dk.sanitize(t)}const rl=1e3,pk=32,Da=15e3,hk=new Set(["completed","failed","cancelled"]),fk=4e3;let L=null,Ht=null,He=null,di=null,Fo=null,qs=!1,So=null,Or=null,F={kind:"connecting"},rr=[],lt=!0,cr=null,ge=null,lr=null,Yt=null,Nr=-1,tt=null,Kt=!1,Xt=null,Pn=new Set;function Hs(){Eo(),Uc(),Ht&&clearInterval(Ht),Ht=null,Xt==null||Xt(),Xt=null,He==null||He.destroy(),He=null,L&&en(L),L==null||L.remove(),L=null,di=null,F={kind:"connecting"},rr=[],lt=!0,cr=null,ge=null,lr=null,Yt=null,Fo=null,Nr=-1,tt=null,Kt=!1,Pn=new Set}function pi(e,t,n,r,o){L&&Hs(),di=o!=null?o:null,F={kind:"connecting"},rr=[],lt=!0,cr=null,Nr=-1,tt=null,Kt=!1,Pn=new Set,ge=e,lr=n,Yt=t,Fo=r,jc({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=`
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>${Nt(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=Ta(e);if(o===null)return r;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+Nt(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=Ta(e);if(o===null)return Nt(n);e=o;let i=`<img src="${e}" alt="${Nt(n)}"`;return t&&(i+=` title="${Nt(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Nt(e.text)}},ui=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}},Lt=class Ms{constructor(t){ie(this,"options");ie(this,"renderer");ie(this,"textRenderer");this.options=t||Dn,this.options.renderer=this.options.renderer||new Ho,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ui}static parse(t,n){return new Ms(n).parse(t)}static parseInline(t,n){return new Ms(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}},vo,Ir=(vo=class{constructor(e){ie(this,"options");ie(this,"block");this.options=e||Dn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Rt.lex:Rt.lexInline}provideParser(e=this.block){return e?Lt.parse:Lt.parseInline}},ie(vo,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ie(vo,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),vo),Fb=class{constructor(...e){ie(this,"defaults",ri());ie(this,"options",this.setOptions);ie(this,"parse",this.parseMarkdown(!0));ie(this,"parseInline",this.parseMarkdown(!1));ie(this,"Parser",Lt);ie(this,"Renderer",Ho);ie(this,"TextRenderer",ui);ie(this,"Lexer",Rt);ie(this,"Tokenizer",qo);ie(this,"Hooks",Ir);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 Ho(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 qo(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 Ir;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];Ir.passThroughHooks.has(i)?o[a]=p=>{if(this.defaults.async&&Ir.passThroughHooksRespectAsync.has(i))return z(this,null,function*(){let g=yield d.call(o,p);return l.call(o,g)});let h=d.call(o,p);return l.call(o,h)}:o[a]=(...p)=>{if(this.defaults.async)return z(this,null,function*(){let g=yield d.apply(o,p);return g===!1&&(g=yield l.apply(o,p)),g});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 Rt.lex(e,t!=null?t:this.defaults)}parser(e,t){return Lt.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?Rt.lex:Rt.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?Lt.parse:Lt.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?Rt.lex:Rt.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?Lt.parse:Lt.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>"+Nt(n.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(n);throw n}}},In=new Fb;function ce(e,t){return In.parse(e,t)}ce.options=ce.setOptions=function(e){return In.setOptions(e),ce.defaults=In.defaults,Hc(ce.defaults),ce};ce.getDefaults=ri;ce.defaults=Dn;function Bb(...e){return In.use(...e),ce.defaults=In.defaults,Hc(ce.defaults),ce}ce.use=Bb;ce.walkTokens=function(e,t){return In.walkTokens(e,t)};ce.parseInline=In.parseInline;ce.Parser=Lt;ce.parser=Lt.parse;ce.Renderer=Ho;ce.TextRenderer=ui;ce.Lexer=Rt;ce.lexer=Rt.lex;ce.Tokenizer=qo;ce.Hooks=Ir;ce.parse=ce;ce.options;ce.setOptions;ce.walkTokens;ce.parseInline;Lt.parse;Rt.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:Qc,setPrototypeOf:Pa,isFrozen:Gb,getPrototypeOf:Wb,getOwnPropertyDescriptor:Jb}=Object;let{freeze:nt,seal:kt,create:js}=Object,{apply:Us,construct:Zs}=typeof Reflect!="undefined"&&Reflect;nt||(nt=function(t){return t});kt||(kt=function(t){return t});Us||(Us=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)});Zs||(Zs=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 mo=rt(Array.prototype.forEach),Vb=rt(Array.prototype.lastIndexOf),Ra=rt(Array.prototype.pop),Cr=rt(Array.prototype.push),Yb=rt(Array.prototype.splice),xo=rt(String.prototype.toLowerCase),ys=rt(String.prototype.toString),ws=rt(String.prototype.match),Ar=rt(String.prototype.replace),Xb=rt(String.prototype.indexOf),Kb=rt(String.prototype.trim),At=rt(Object.prototype.hasOwnProperty),Xe=rt(RegExp.prototype.test),Pr=Qb(TypeError);function rt(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 Us(e,t,r)}}function Qb(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return Zs(e,n)}}function V(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xo;Pa&&Pa(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const i=n(o);i!==o&&(Gb(t)||(t[r]=i),o=i)}e[o]=!0}return e}function ek(e){for(let t=0;t<e.length;t++)At(e,t)||(e[t]=null);return e}function Dt(e){const t=js(null);for(const[n,r]of Qc(e))At(e,n)&&(Array.isArray(r)?t[n]=ek(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=Dt(r):t[n]=r);return t}function Rr(e,t){for(;e!==null;){const r=Jb(e,t);if(r){if(r.get)return rt(r.get);if(typeof r.value=="function")return rt(r.value)}e=Wb(e)}function n(){return null}return n}const La=nt(["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"]),xs=nt(["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"]),Ss=nt(["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"]),tk=nt(["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"]),Ts=nt(["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"]),nk=nt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),za=nt(["#text"]),Ia=nt(["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"]),Es=nt(["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"]),$a=nt(["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"]),bo=nt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),rk=kt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ok=kt(/<%[\w\W]*|[\w\W]*%>/gm),sk=kt(/\$\{[\w\W]*/gm),ik=kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),ak=kt(/^aria-[\-\w]+$/),el=kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ck=kt(/^(?:\w+script|data):/i),lk=kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),tl=kt(/^html$/i),uk=kt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Oa=Object.freeze({__proto__:null,ARIA_ATTR:ak,ATTR_WHITESPACE:lk,CUSTOM_ELEMENT:uk,DATA_ATTR:ik,DOCTYPE_NAME:tl,ERB_EXPR:ok,IS_ALLOWED_URI:el,IS_SCRIPT_OR_DATA:ck,MUSTACHE_EXPR:rk,TMPLIT_EXPR:sk});const Lr={element:1,text:3,progressingInstruction:7,comment:8,document:9},dk=function(){return typeof window=="undefined"?null:window},pk=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}},Na=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function nl(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:dk();const t=j=>nl(j);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Lr.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:g,DOMParser:m,trustedTypes:k}=e,w=l.prototype,v=Rr(w,"cloneNode"),Z=Rr(w,"remove"),K=Rr(w,"nextSibling"),M=Rr(w,"childNodes"),E=Rr(w,"parentNode");if(typeof a=="function"){const j=n.createElement("template");j.content&&j.content.ownerDocument&&(n=j.content.ownerDocument)}let T,C="";const{implementation:N,createNodeIterator:J,createDocumentFragment:ye,getElementsByTagName:Oe}=n,{importNode:Be}=r;let te=Na();t.isSupported=typeof Qc=="function"&&typeof E=="function"&&N&&N.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:we,ERB_EXPR:ot,TMPLIT_EXPR:nn,DATA_ATTR:rn,ARIA_ATTR:dt,IS_SCRIPT_OR_DATA:It,ATTR_WHITESPACE:on,CUSTOM_ELEMENT:sn}=Oa;let{IS_ALLOWED_URI:$t}=Oa,pe=null;const vt=V({},[...La,...xs,...Ss,...Ts,...za]);let _e=null;const yn=V({},[...Ia,...Es,...$a,...bo]);let le=Object.seal(js(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}})),Ge=null,an=null;const yt=Object.seal(js(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let xe=!0,Te=!0,H=!1,oe=!0,Q=!1,Ne=!0,We=!1,je=!1,Ft=!1,wt=!1,De=!1,Ce=!1,ze=!0,Ue=!1;const fr="user-content-";let Ye=!0,st=!1,xt={},Ae=null;const gr=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 ue=null;const Wr=V({},["audio","video","img","source","image","track"]);let mr=null;const Jr=V({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Mn="http://www.w3.org/1998/Math/MathML",jn="http://www.w3.org/2000/svg",St="http://www.w3.org/1999/xhtml";let cn=St,wn=!1,xn=null;const ss=V({},[Mn,jn,St],ys);let Un=V({},["mi","mo","mn","ms","mtext"]),Zn=V({},["annotation-xml"]);const is=V({},["title","style","font","a","script"]);let Bt=null;const Tt=["application/xhtml+xml","text/html"],as="text/html";let de=null,ln=null;const Vr=n.createElement("form"),br=function(_){return _ instanceof RegExp||_ instanceof Function},qn=function(){let _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ln&&ln===_)){if((!_||typeof _!="object")&&(_={}),_=Dt(_),Bt=Tt.indexOf(_.PARSER_MEDIA_TYPE)===-1?as:_.PARSER_MEDIA_TYPE,de=Bt==="application/xhtml+xml"?ys:xo,pe=At(_,"ALLOWED_TAGS")?V({},_.ALLOWED_TAGS,de):vt,_e=At(_,"ALLOWED_ATTR")?V({},_.ALLOWED_ATTR,de):yn,xn=At(_,"ALLOWED_NAMESPACES")?V({},_.ALLOWED_NAMESPACES,ys):ss,mr=At(_,"ADD_URI_SAFE_ATTR")?V(Dt(Jr),_.ADD_URI_SAFE_ATTR,de):Jr,ue=At(_,"ADD_DATA_URI_TAGS")?V(Dt(Wr),_.ADD_DATA_URI_TAGS,de):Wr,Ae=At(_,"FORBID_CONTENTS")?V({},_.FORBID_CONTENTS,de):gr,Ge=At(_,"FORBID_TAGS")?V({},_.FORBID_TAGS,de):Dt({}),an=At(_,"FORBID_ATTR")?V({},_.FORBID_ATTR,de):Dt({}),xt=At(_,"USE_PROFILES")?_.USE_PROFILES:!1,xe=_.ALLOW_ARIA_ATTR!==!1,Te=_.ALLOW_DATA_ATTR!==!1,H=_.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=_.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Q=_.SAFE_FOR_TEMPLATES||!1,Ne=_.SAFE_FOR_XML!==!1,We=_.WHOLE_DOCUMENT||!1,wt=_.RETURN_DOM||!1,De=_.RETURN_DOM_FRAGMENT||!1,Ce=_.RETURN_TRUSTED_TYPE||!1,Ft=_.FORCE_BODY||!1,ze=_.SANITIZE_DOM!==!1,Ue=_.SANITIZE_NAMED_PROPS||!1,Ye=_.KEEP_CONTENT!==!1,st=_.IN_PLACE||!1,$t=_.ALLOWED_URI_REGEXP||el,cn=_.NAMESPACE||St,Un=_.MATHML_TEXT_INTEGRATION_POINTS||Un,Zn=_.HTML_INTEGRATION_POINTS||Zn,le=_.CUSTOM_ELEMENT_HANDLING||{},_.CUSTOM_ELEMENT_HANDLING&&br(_.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(le.tagNameCheck=_.CUSTOM_ELEMENT_HANDLING.tagNameCheck),_.CUSTOM_ELEMENT_HANDLING&&br(_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(le.attributeNameCheck=_.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),_.CUSTOM_ELEMENT_HANDLING&&typeof _.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(le.allowCustomizedBuiltInElements=_.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Q&&(Te=!1),De&&(wt=!0),xt&&(pe=V({},za),_e=[],xt.html===!0&&(V(pe,La),V(_e,Ia)),xt.svg===!0&&(V(pe,xs),V(_e,Es),V(_e,bo)),xt.svgFilters===!0&&(V(pe,Ss),V(_e,Es),V(_e,bo)),xt.mathMl===!0&&(V(pe,Ts),V(_e,$a),V(_e,bo))),_.ADD_TAGS&&(typeof _.ADD_TAGS=="function"?yt.tagCheck=_.ADD_TAGS:(pe===vt&&(pe=Dt(pe)),V(pe,_.ADD_TAGS,de))),_.ADD_ATTR&&(typeof _.ADD_ATTR=="function"?yt.attributeCheck=_.ADD_ATTR:(_e===yn&&(_e=Dt(_e)),V(_e,_.ADD_ATTR,de))),_.ADD_URI_SAFE_ATTR&&V(mr,_.ADD_URI_SAFE_ATTR,de),_.FORBID_CONTENTS&&(Ae===gr&&(Ae=Dt(Ae)),V(Ae,_.FORBID_CONTENTS,de)),_.ADD_FORBID_CONTENTS&&(Ae===gr&&(Ae=Dt(Ae)),V(Ae,_.ADD_FORBID_CONTENTS,de)),Ye&&(pe["#text"]=!0),We&&V(pe,["html","head","body"]),pe.table&&(V(pe,["tbody"]),delete Ge.tbody),_.TRUSTED_TYPES_POLICY){if(typeof _.TRUSTED_TYPES_POLICY.createHTML!="function")throw Pr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof _.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Pr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=_.TRUSTED_TYPES_POLICY,C=T.createHTML("")}else T===void 0&&(T=pk(k,o)),T!==null&&typeof C=="string"&&(C=T.createHTML(""));nt&&nt(_),ln=_}},kr=V({},[...xs,...Ss,...tk]),Yr=V({},[...Ts,...nk]),cs=function(_){let A=E(_);(!A||!A.tagName)&&(A={namespaceURI:cn,tagName:"template"});const I=xo(_.tagName),se=xo(A.tagName);return xn[_.namespaceURI]?_.namespaceURI===jn?A.namespaceURI===St?I==="svg":A.namespaceURI===Mn?I==="svg"&&(se==="annotation-xml"||Un[se]):!!kr[I]:_.namespaceURI===Mn?A.namespaceURI===St?I==="math":A.namespaceURI===jn?I==="math"&&Zn[se]:!!Yr[I]:_.namespaceURI===St?A.namespaceURI===jn&&!Zn[se]||A.namespaceURI===Mn&&!Un[se]?!1:!Yr[I]&&(is[I]||!kr[I]):!!(Bt==="application/xhtml+xml"&&xn[_.namespaceURI]):!1},pt=function(_){Cr(t.removed,{element:_});try{E(_).removeChild(_)}catch(A){Z(_)}},ht=function(_,A){try{Cr(t.removed,{attribute:A.getAttributeNode(_),from:A})}catch(I){Cr(t.removed,{attribute:null,from:A})}if(A.removeAttribute(_),_==="is")if(wt||De)try{pt(A)}catch(I){}else try{A.setAttribute(_,"")}catch(I){}},Xr=function(_){let A=null,I=null;if(Ft)_="<remove></remove>"+_;else{const Se=ws(_,/^[\r\n\t ]+/);I=Se&&Se[0]}Bt==="application/xhtml+xml"&&cn===St&&(_='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+_+"</body></html>");const se=T?T.createHTML(_):_;if(cn===St)try{A=new m().parseFromString(se,Bt)}catch(Se){}if(!A||!A.documentElement){A=N.createDocument(cn,"template",null);try{A.documentElement.innerHTML=wn?C:se}catch(Se){}}const Me=A.body||A.documentElement;return _&&I&&Me.insertBefore(n.createTextNode(I),Me.childNodes[0]||null),cn===St?Oe.call(A,We?"html":"body")[0]:We?A.documentElement:Me},_r=function(_){return J.call(_.ownerDocument||_,_,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},vr=function(_){return _ instanceof g&&(typeof _.nodeName!="string"||typeof _.textContent!="string"||typeof _.removeChild!="function"||!(_.attributes instanceof h)||typeof _.removeAttribute!="function"||typeof _.setAttribute!="function"||typeof _.namespaceURI!="string"||typeof _.insertBefore!="function"||typeof _.hasChildNodes!="function")},Kr=function(_){return typeof d=="function"&&_ instanceof d};function Et(j,_,A){mo(j,I=>{I.call(t,_,A,ln)})}const Qr=function(_){let A=null;if(Et(te.beforeSanitizeElements,_,null),vr(_))return pt(_),!0;const I=de(_.nodeName);if(Et(te.uponSanitizeElement,_,{tagName:I,allowedTags:pe}),Ne&&_.hasChildNodes()&&!Kr(_.firstElementChild)&&Xe(/<[/\w!]/g,_.innerHTML)&&Xe(/<[/\w!]/g,_.textContent)||_.nodeType===Lr.progressingInstruction||Ne&&_.nodeType===Lr.comment&&Xe(/<[/\w]/g,_.data))return pt(_),!0;if(!(yt.tagCheck instanceof Function&&yt.tagCheck(I))&&(!pe[I]||Ge[I])){if(!Ge[I]&&to(I)&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,I)||le.tagNameCheck instanceof Function&&le.tagNameCheck(I)))return!1;if(Ye&&!Ae[I]){const se=E(_)||_.parentNode,Me=M(_)||_.childNodes;if(Me&&se){const Se=Me.length;for(let Je=Se-1;Je>=0;--Je){const Ct=v(Me[Je],!0);Ct.__removalCount=(_.__removalCount||0)+1,se.insertBefore(Ct,K(_))}}}return pt(_),!0}return _ instanceof l&&!cs(_)||(I==="noscript"||I==="noembed"||I==="noframes")&&Xe(/<\/no(script|embed|frames)/i,_.innerHTML)?(pt(_),!0):(Q&&_.nodeType===Lr.text&&(A=_.textContent,mo([we,ot,nn],se=>{A=Ar(A,se," ")}),_.textContent!==A&&(Cr(t.removed,{element:_.cloneNode()}),_.textContent=A)),Et(te.afterSanitizeElements,_,null),!1)},eo=function(_,A,I){if(ze&&(A==="id"||A==="name")&&(I in n||I in Vr))return!1;if(!(Te&&!an[A]&&Xe(rn,A))){if(!(xe&&Xe(dt,A))){if(!(yt.attributeCheck instanceof Function&&yt.attributeCheck(A,_))){if(!_e[A]||an[A]){if(!(to(_)&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,_)||le.tagNameCheck instanceof Function&&le.tagNameCheck(_))&&(le.attributeNameCheck instanceof RegExp&&Xe(le.attributeNameCheck,A)||le.attributeNameCheck instanceof Function&&le.attributeNameCheck(A,_))||A==="is"&&le.allowCustomizedBuiltInElements&&(le.tagNameCheck instanceof RegExp&&Xe(le.tagNameCheck,I)||le.tagNameCheck instanceof Function&&le.tagNameCheck(I))))return!1}else if(!mr[A]){if(!Xe($t,Ar(I,on,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&_!=="script"&&Xb(I,"data:")===0&&ue[_])){if(!(H&&!Xe(It,Ar(I,on,"")))){if(I)return!1}}}}}}}return!0},to=function(_){return _!=="annotation-xml"&&ws(_,sn)},yr=function(_){Et(te.beforeSanitizeAttributes,_,null);const{attributes:A}=_;if(!A||vr(_))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:_e,forceKeepAttr:void 0};let se=A.length;for(;se--;){const Me=A[se],{name:Se,namespaceURI:Je,value:Ct}=Me,Ot=de(Se),wr=Ct;let Ie=Se==="value"?wr:Kb(wr);if(I.attrName=Ot,I.attrValue=Ie,I.keepAttr=!0,I.forceKeepAttr=void 0,Et(te.uponSanitizeAttribute,_,I),Ie=I.attrValue,Ue&&(Ot==="id"||Ot==="name")&&(ht(Se,_),Ie=fr+Ie),Ne&&Xe(/((--!?|])>)|<\/(style|title|textarea)/i,Ie)){ht(Se,_);continue}if(Ot==="attributename"&&ws(Ie,"href")){ht(Se,_);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){ht(Se,_);continue}if(!oe&&Xe(/\/>/i,Ie)){ht(Se,_);continue}Q&&mo([we,ot,nn],ro=>{Ie=Ar(Ie,ro," ")});const no=de(_.nodeName);if(!eo(no,Ot,Ie)){ht(Se,_);continue}if(T&&typeof k=="object"&&typeof k.getAttributeType=="function"&&!Je)switch(k.getAttributeType(no,Ot)){case"TrustedHTML":{Ie=T.createHTML(Ie);break}case"TrustedScriptURL":{Ie=T.createScriptURL(Ie);break}}if(Ie!==wr)try{Je?_.setAttributeNS(Je,Se,Ie):_.setAttribute(Se,Ie),vr(_)?pt(_):Ra(t.removed)}catch(ro){ht(Se,_)}}Et(te.afterSanitizeAttributes,_,null)},Gt=function j(_){let A=null;const I=_r(_);for(Et(te.beforeSanitizeShadowDOM,_,null);A=I.nextNode();)Et(te.uponSanitizeShadowNode,A,null),Qr(A),yr(A),A.content instanceof i&&j(A.content);Et(te.afterSanitizeShadowDOM,_,null)};return t.sanitize=function(j){let _=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,se=null,Me=null;if(wn=!j,wn&&(j="<!-->"),typeof j!="string"&&!Kr(j))if(typeof j.toString=="function"){if(j=j.toString(),typeof j!="string")throw Pr("dirty is not a string, aborting")}else throw Pr("toString is not a function");if(!t.isSupported)return j;if(je||qn(_),t.removed=[],typeof j=="string"&&(st=!1),st){if(j.nodeName){const Ct=de(j.nodeName);if(!pe[Ct]||Ge[Ct])throw Pr("root node is forbidden and cannot be sanitized in-place")}}else if(j instanceof d)A=Xr("<!---->"),I=A.ownerDocument.importNode(j,!0),I.nodeType===Lr.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!wt&&!Q&&!We&&j.indexOf("<")===-1)return T&&Ce?T.createHTML(j):j;if(A=Xr(j),!A)return wt?null:Ce?C:""}A&&Ft&&pt(A.firstChild);const Se=_r(st?j:A);for(;se=Se.nextNode();)Qr(se),yr(se),se.content instanceof i&&Gt(se.content);if(st)return j;if(wt){if(De)for(Me=ye.call(A.ownerDocument);A.firstChild;)Me.appendChild(A.firstChild);else Me=A;return(_e.shadowroot||_e.shadowrootmode)&&(Me=Be.call(r,Me,!0)),Me}let Je=We?A.outerHTML:A.innerHTML;return We&&pe["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&Xe(tl,A.ownerDocument.doctype.name)&&(Je="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
1583
+ `+Je),Q&&mo([we,ot,nn],Ct=>{Je=Ar(Je,Ct," ")}),T&&Ce?T.createHTML(Je):Je},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qn(j),je=!0},t.clearConfig=function(){ln=null,je=!1},t.isValidAttribute=function(j,_,A){ln||qn({});const I=de(j),se=de(_);return eo(I,se,A)},t.addHook=function(j,_){typeof _=="function"&&Cr(te[j],_)},t.removeHook=function(j,_){if(_!==void 0){const A=Vb(te[j],_);return A===-1?void 0:Yb(te[j],A,1)[0]}return Ra(te[j])},t.removeHooks=function(j){te[j]=[]},t.removeAllHooks=function(){te=Na()},t}var hk=nl();function rl(e){const t=ce.parse(e,{gfm:!0,breaks:!0,async:!1});return hk.sanitize(t)}const ol=1e3,fk=32,Da=15e3,gk=new Set(["completed","failed","cancelled"]),mk=4e3;let L=null,Ht=null,He=null,di=null,Fo=null,qs=!1,So=null,Or=null,F={kind:"connecting"},rr=[],lt=!0,cr=null,ge=null,lr=null,Yt=null,Nr=-1,tt=null,Kt=!1,Xt=null,Pn=new Set;function Hs(){Eo(),Zc(),Ht&&clearInterval(Ht),Ht=null,Xt==null||Xt(),Xt=null,He==null||He.destroy(),He=null,L&&en(L),L==null||L.remove(),L=null,di=null,F={kind:"connecting"},rr=[],lt=!0,cr=null,ge=null,lr=null,Yt=null,Fo=null,Nr=-1,tt=null,Kt=!1,Pn=new Set}function pi(e,t,n,r,o){L&&Hs(),di=o!=null?o:null,F={kind:"connecting"},rr=[],lt=!0,cr=null,Nr=-1,tt=null,Kt=!1,Pn=new Set,ge=e,lr=n,Yt=t,Fo=r,Uc({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=`
1584
1584
  <div class="ap-sdk-panel__header">
1585
1585
  <span class="ap-sdk-panel__title">
1586
1586
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1593,7 +1593,7 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1593
1593
  <div class="ap-sdk-runner__meta">
1594
1594
  <div class="ap-sdk-runner__meta-row">
1595
1595
  <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--automate">Automate</span>
1596
- <span class="ap-sdk-runner__title" title="${Ek(r)}">${fi(i)}</span>
1596
+ <span class="ap-sdk-runner__title" title="${Ak(r)}">${fi(i)}</span>
1597
1597
  </div>
1598
1598
  <div class="ap-sdk-runner__meta-row ap-sdk-runner__meta-row--controls">
1599
1599
  <span class="ap-sdk-runner__counter" data-ap-runner-counter>0 actions</span>
@@ -1623,15 +1623,15 @@ Please report this to https://github.com/markedjs/marked.`,e){let r="<p>An error
1623
1623
  </div>
1624
1624
  <div class="ap-sdk-runner__hint" data-ap-runner-hint>Closing keeps the task running — resume anytime from My Captures.</div>
1625
1625
  <div class="ap-sdk-panel__status" data-ap-runner-summary style="display:none"></div>
1626
- `,L.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),L.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(L),He=Gs(),Qt(L),ni(L,ti),L.querySelector("[data-ap-close]").addEventListener("click",()=>{Hs(),o==null||o()}),L.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),bk(t,e)}),L.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!qs){qs=!0,d.textContent="Confirm",So=setTimeout(Eo,fk),Or=l=>{l.target!==d&&Eo()},document.addEventListener("click",Or,!0);return}Eo(),gk(t,e)}),L.querySelector("[data-ap-runner-scroll-toggle]").addEventListener("click",()=>{lt=!lt,lt&&Ma(),To()}),L.querySelector("[data-ap-runner-scroll-jump]").addEventListener("click",()=>{lt=!0,Ma(),To()}),L.querySelector("[data-ap-runner-log]").addEventListener("scroll",()=>{if(!lt||!L)return;const a=L.querySelector("[data-ap-runner-log]");a.scrollHeight-a.scrollTop-a.clientHeight>pk&&(lt=!1,To())}),hi(),ol(e,t)}function Ma(){const e=L==null?void 0:L.querySelector("[data-ap-runner-log]");e&&(e.scrollTop=e.scrollHeight)}function To(){if(!L)return;const e=L.querySelector("[data-ap-runner-scroll-toggle]");e&&(e.textContent=lt?"Auto ↓":"Manual",e.title=lt?"Disable auto-scroll":"Enable auto-scroll",e.classList.toggle("ap-sdk-runner__scroll-toggle--active",lt))}function ol(e,t){const n=d=>z(null,null,function*(){if(ge!==e||!L||F.kind!=="idle"&&F.kind!=="connecting"||Pn.has(d.commandId))return;Pn.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()};An({kind:"executing",command:l,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield ja(l,t,e)}),r=d=>{if(!(ge!==e||!L)&&hk.has(d)){if(F.kind==="executing")An({kind:"finishing",status:d,actionsRun:F.actionsRun});else if(F.kind==="connecting"||F.kind==="idle"){const l=F.kind==="idle"?F.actionsRun:0;An({kind:"finished",status:d,actionsRun:l})}}},o=d=>{ge!==e||!L||(d.outputChunk&&Ua([d.outputChunk]),r(d.status))},i=()=>z(null,null,function*(){var d;if(!(ge!==e||!L))try{const l=yield Uo(t,e);ge===e&&L&&(tt=(d=l[0])!=null?d:null,$n())}catch(l){}}),a=()=>z(null,null,function*(){var d;try{const[l,p,h,g]=yield Promise.all([Dc(t,e),Rm(t,e),Uo(t,e),Am(t,e)]);if(ge!==e||!L)return;Ua(p),tt=(d=h[0])!=null?d:null,$n(),r(l.status),g&&g.status==="pending"&&(F.kind==="idle"||F.kind==="connecting")&&!Pn.has(g.id)?(Pn.add(g.id),An({kind:"executing",command:g,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield ja(g,t,e)):F.kind==="connecting"&&An({kind:"idle",actionsRun:0})}catch(l){}});a(),Zm(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(ge!==e||F.kind==="finished"){d();return}Xt=d})}function An(e){F=e,F.kind==="idle"&&cr===null&&(cr=Date.now(),Bo(),Ht=setInterval(Bo,rl)),F.kind==="finished"&&(Ht&&(clearInterval(Ht),Ht=null),Xt==null||Xt(),Xt=null,He==null||He.hide(),Uc()),hi()}function Eo(){qs=!1,So&&(clearTimeout(So),So=null),Or&&(document.removeEventListener("click",Or,!0),Or=null);const e=L==null?void 0:L.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function gk(e,t){return z(this,null,function*(){if(ge!==t||!L)return;const n=L.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield zm(e,t)}catch(r){n&&(n.disabled=!1)}})}function sl(){if(!ge||!Yt||!lr||!Fo)return;const e=ge,t=Yt;jc({taskId:e,backendUrl:lr,title:Fo}),Ht&&clearInterval(Ht),Bo(),Ht=setInterval(Bo,rl);const n=F.kind==="finished"?F.actionsRun:0;Pn=new Set,F={kind:"idle",actionsRun:n},hi(),ol(e,t)}function hi(){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"}`,To(),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",Sk(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(rr.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();$n();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||Kt,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 $n(){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(!tt){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=tt.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1626
+ `,L.addEventListener("wheel",a=>{a.stopPropagation()},{passive:!0}),L.addEventListener("touchmove",a=>{a.stopPropagation()},{passive:!0}),document.body.appendChild(L),He=Gs(),Qt(L),ni(L,ti),L.querySelector("[data-ap-close]").addEventListener("click",()=>{Hs(),o==null||o()}),L.querySelector("[data-ap-runner-chat-form]").addEventListener("submit",a=>{a.preventDefault(),_k(t,e)}),L.querySelector("[data-ap-runner-cancel]").addEventListener("click",a=>{a.stopPropagation();const d=a.currentTarget;if(!qs){qs=!0,d.textContent="Confirm",So=setTimeout(Eo,mk),Or=l=>{l.target!==d&&Eo()},document.addEventListener("click",Or,!0);return}Eo(),bk(t,e)}),L.querySelector("[data-ap-runner-scroll-toggle]").addEventListener("click",()=>{lt=!lt,lt&&Ma(),To()}),L.querySelector("[data-ap-runner-scroll-jump]").addEventListener("click",()=>{lt=!0,Ma(),To()}),L.querySelector("[data-ap-runner-log]").addEventListener("scroll",()=>{if(!lt||!L)return;const a=L.querySelector("[data-ap-runner-log]");a.scrollHeight-a.scrollTop-a.clientHeight>fk&&(lt=!1,To())}),hi(),sl(e,t)}function Ma(){const e=L==null?void 0:L.querySelector("[data-ap-runner-log]");e&&(e.scrollTop=e.scrollHeight)}function To(){if(!L)return;const e=L.querySelector("[data-ap-runner-scroll-toggle]");e&&(e.textContent=lt?"Auto ↓":"Manual",e.title=lt?"Disable auto-scroll":"Enable auto-scroll",e.classList.toggle("ap-sdk-runner__scroll-toggle--active",lt))}function sl(e,t){const n=d=>z(null,null,function*(){if(ge!==e||!L||F.kind!=="idle"&&F.kind!=="connecting"||Pn.has(d.commandId))return;Pn.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()};An({kind:"executing",command:l,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield ja(l,t,e)}),r=d=>{if(!(ge!==e||!L)&&gk.has(d)){if(F.kind==="executing")An({kind:"finishing",status:d,actionsRun:F.actionsRun});else if(F.kind==="connecting"||F.kind==="idle"){const l=F.kind==="idle"?F.actionsRun:0;An({kind:"finished",status:d,actionsRun:l})}}},o=d=>{ge!==e||!L||(d.outputChunk&&Ua([d.outputChunk]),r(d.status))},i=()=>z(null,null,function*(){var d;if(!(ge!==e||!L))try{const l=yield Uo(t,e);ge===e&&L&&(tt=(d=l[0])!=null?d:null,$n())}catch(l){}}),a=()=>z(null,null,function*(){var d;try{const[l,p,h,g]=yield Promise.all([Mc(t,e),zm(t,e),Uo(t,e),Rm(t,e)]);if(ge!==e||!L)return;Ua(p),tt=(d=h[0])!=null?d:null,$n(),r(l.status),g&&g.status==="pending"&&(F.kind==="idle"||F.kind==="connecting")&&!Pn.has(g.id)?(Pn.add(g.id),An({kind:"executing",command:g,actionsRun:F.kind==="idle"?F.actionsRun:0}),yield ja(g,t,e)):F.kind==="connecting"&&An({kind:"idle",actionsRun:0})}catch(l){}});a(),Hm(t,e,{onStatusUpdate:o,onInteractionCreated:i,onInteractionAnswered:i,onBrowserCommandCreated:n,onReconnect:()=>{a()}}).then(d=>{if(ge!==e||F.kind==="finished"){d();return}Xt=d})}function An(e){F=e,F.kind==="idle"&&cr===null&&(cr=Date.now(),Bo(),Ht=setInterval(Bo,ol)),F.kind==="finished"&&(Ht&&(clearInterval(Ht),Ht=null),Xt==null||Xt(),Xt=null,He==null||He.hide(),Zc()),hi()}function Eo(){qs=!1,So&&(clearTimeout(So),So=null),Or&&(document.removeEventListener("click",Or,!0),Or=null);const e=L==null?void 0:L.querySelector("[data-ap-runner-cancel]");e&&(e.textContent="Cancel task")}function bk(e,t){return z(this,null,function*(){if(ge!==t||!L)return;const n=L.querySelector("[data-ap-runner-cancel]");n&&(n.disabled=!0);try{yield $m(e,t)}catch(r){n&&(n.disabled=!1)}})}function il(){if(!ge||!Yt||!lr||!Fo)return;const e=ge,t=Yt;Uc({taskId:e,backendUrl:lr,title:Fo}),Ht&&clearInterval(Ht),Bo(),Ht=setInterval(Bo,ol);const n=F.kind==="finished"?F.actionsRun:0;Pn=new Set,F={kind:"idle",actionsRun:n},hi(),sl(e,t)}function hi(){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"}`,To(),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",Ek(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(rr.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();$n();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||Kt,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 $n(){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(!tt){e.style.display="none",e.innerHTML="",t.placeholder="Send a message to the agent…";return}const n=tt.questionMetadata,r=(o=n==null?void 0:n.options)!=null?o:[];if(t.placeholder="Type your answer…",e.style.display="block",e.innerHTML=`
1627
1627
  <div class="ap-sdk-runner__question-label">${fi((n==null?void 0:n.header)||"The agent has a question")}</div>
1628
- <div class="ap-sdk-runner__question-text ap-sdk-markdown">${nl((n==null?void 0:n.question)||tt.question)}</div>
1628
+ <div class="ap-sdk-runner__question-text ap-sdk-markdown">${rl((n==null?void 0:n.question)||tt.question)}</div>
1629
1629
  ${r.length>0?'<div class="ap-sdk-runner__question-options" data-ap-runner-question-options></div>':""}
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 mk(a.label)),i.appendChild(d)}}}function mk(e){return z(this,null,function*(){var r;if(!L||!tt||!ge||Kt)return;const t=ge,n=Yt;if(n){Kt=!0;try{const o={selectedOption:e};yield Mc(n,t,tt.id,o),tt=null,$n();const i=yield Uo(n,t);ge===t&&L&&(tt=(r=i[0])!=null?r:null,$n())}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{Kt=!1}}})}function Bo(){if(!L||cr===null)return;const e=L.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-cr)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function ja(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})`);He==null||He.update(a),o=_k(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(He==null||He.update(a),e.action==="click")yield Hm(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");vk(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(ge===n&&L&&yk(r,e,o),yield kk(t,n,e.id,r,o),ge!==n||!L)return;He==null||He.hide();const i=(F.kind==="executing"||F.kind==="finishing"?F.actionsRun:0)+1;F.kind==="finishing"?An({kind:"finished",status:F.status,actionsRun:i}):F.kind==="executing"&&An({kind:"idle",actionsRun:i})})}function bk(e,t){return z(this,null,function*(){var a;if(!L||Kt||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){Kt=!0,o.disabled=!0,r.style.display="none";try{if(tt){yield Mc(e,t,tt.id,i),tt=null,$n();try{const d=yield Uo(e,t);ge===t&&L&&(tt=(a=d[0])!=null?a:null,$n())}catch(d){}}else yield Lm(e,t,i),F.kind==="finished"&&sl();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Kt=!1,o.disabled=!1}}})}function kk(e,t,n,r,o){return z(this,null,function*(){try{yield Pm(e,t,n,r,o)}catch(i){}})}function _k(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Ka(t);let n=t.outerHTML,r=!1;return n.length>Da&&(n=n.slice(0,Da),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 kk(a.label)),i.appendChild(d)}}}function kk(e){return z(this,null,function*(){var r;if(!L||!tt||!ge||Kt)return;const t=ge,n=Yt;if(n){Kt=!0;try{const o={selectedOption:e};yield jc(n,t,tt.id,o),tt=null,$n();const i=yield Uo(n,t);ge===t&&L&&(tt=(r=i[0])!=null?r:null,$n())}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{Kt=!1}}})}function Bo(){if(!L||cr===null)return;const e=L.querySelector("[data-ap-runner-timer]");if(!e)return;const t=Math.max(0,Math.floor((Date.now()-cr)/1e3)),n=String(Math.floor(t/60)).padStart(2,"0"),r=String(t%60).padStart(2,"0");e.textContent=`${n}:${r}`}function ja(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})`);He==null||He.update(a),o=yk(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(He==null||He.update(a),e.action==="click")yield Bm(a),o="Clicked";else{if(e.value===void 0)throw new Error("inputText command is missing a value");wk(a,e.value),o="Entered text"}}}catch(a){r="error",o=a instanceof Error?a.message:"Unknown error executing command"}if(ge===n&&L&&xk(r,e,o),yield vk(t,n,e.id,r,o),ge!==n||!L)return;He==null||He.hide();const i=(F.kind==="executing"||F.kind==="finishing"?F.actionsRun:0)+1;F.kind==="finishing"?An({kind:"finished",status:F.status,actionsRun:i}):F.kind==="executing"&&An({kind:"idle",actionsRun:i})})}function _k(e,t){return z(this,null,function*(){var a;if(!L||Kt||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){Kt=!0,o.disabled=!0,r.style.display="none";try{if(tt){yield jc(e,t,tt.id,i),tt=null,$n();try{const d=yield Uo(e,t);ge===t&&L&&(tt=(a=d[0])!=null?a:null,$n())}catch(d){}}else yield Im(e,t,i),F.kind==="finished"&&il();n.value=""}catch(d){r.textContent=d instanceof Error?d.message:"Failed to send — try again.",r.style.display="block"}finally{Kt=!1,o.disabled=!1}}})}function vk(e,t,n,r,o){return z(this,null,function*(){try{yield Lm(e,t,n,r,o)}catch(i){}})}function yk(e){const t=e.cloneNode(!0);t.querySelectorAll("script, style, noscript").forEach(o=>o.remove()),Ka(t);let n=t.outerHTML,r=!1;return n.length>Da&&(n=n.slice(0,Da),r=!0),`URL: ${location.href}
1631
1631
  Title: ${document.title}
1632
1632
 
1633
1633
  ${n}${r?`
1634
- … (truncated)`:""}`}function vk(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 yk(e,t,n){var h,g;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(rr.push({status:e,text:`${r} ${i}${d}`}),!L)return;const l=L.querySelector("[data-ap-runner-log]");if(!l)return;(g=l.querySelector("[data-ap-runner-placeholder]"))==null||g.remove();const p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=rr[rr.length-1].text,l.appendChild(p),lt&&(l.scrollTop=l.scrollHeight)}function wk(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function xk(e){const t=wk(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function Ua(e){var r;const t=e.filter(o=>o.sequence>Nr).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Nr=Math.max(Nr,...t.map(o=>o.sequence)),!L))return;const n=L.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=xk(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=nl(i)):a.textContent=i,n.appendChild(a),lt&&(n.scrollTop=n.scrollHeight)}}function Sk(e){if(!L||!ge||!lr)return;const t=L.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${lr.replace(/\/+$/,"")}/tasks/${ge}`,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 wk(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 xk(e,t,n){var h,g;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(rr.push({status:e,text:`${r} ${i}${d}`}),!L)return;const l=L.querySelector("[data-ap-runner-log]");if(!l)return;(g=l.querySelector("[data-ap-runner-placeholder]"))==null||g.remove();const p=document.createElement("div");p.className=`ap-sdk-runner__log-entry ap-sdk-runner__log-entry--${e}`,p.textContent=rr[rr.length-1].text,l.appendChild(p),lt&&(l.scrollTop=l.scrollHeight)}function Sk(e){var t,n;return(n=(t=e.display)==null?void 0:t.variant)!=null?n:e.sdkEventType}function Tk(e){const t=Sk(e);return(e.stream==="stdout"||e.stream==="stderr"||e.stream==="sdk_event"&&(t==="text"||t==="thinking"))&&e.data.trim()||null}function Ua(e){var r;const t=e.filter(o=>o.sequence>Nr).sort((o,i)=>o.sequence-i.sequence);if(t.length===0||(Nr=Math.max(Nr,...t.map(o=>o.sequence)),!L))return;const n=L.querySelector("[data-ap-runner-log]");if(n)for(const o of t){const i=Tk(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=rl(i)):a.textContent=i,n.appendChild(a),lt&&(n.scrollTop=n.scrollHeight)}}function Ek(e){if(!L||!ge||!lr)return;const t=L.querySelector("[data-ap-runner-summary]");if(!t)return;const n=`${lr.replace(/\/+$/,"")}/tasks/${ge}`,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=`
1635
1635
  <div class="ap-sdk-success-card">
1636
1636
  <p class="ap-sdk-success-headline">${fi(r)}</p>
1637
1637
  ${o?`
@@ -1653,7 +1653,7 @@ ${n}${r?`
1653
1653
  <button class="ap-sdk-runner__text-btn" data-ap-runner-close>Close</button>
1654
1654
  </div>
1655
1655
  </div>
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=di;Hs(),a==null||a()}),o&&Tk(t)}function Tk(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(!ge||!Yt)return;const h=ge,g=Yt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield Im(g,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">✓ Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,l(m instanceof Error?m.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>z(null,null,function*(){if(!ge||!Yt)return;const h=ge,g=Yt,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield $m(g,h,m),m?sl():(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 Ek(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ck(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=di;Hs(),a==null||a()}),o&&Ck(t)}function Ck(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(!ge||!Yt)return;const h=ge,g=Yt;t.disabled=!0,n.disabled=!0,a.style.display="none";try{yield Om(g,h),d.innerHTML='<span class="ap-sdk-status-badge ap-sdk-status-badge--approved">✓ Approved</span>',r.style.display="none"}catch(m){t.disabled=!1,n.disabled=!1,l(m instanceof Error?m.message:"Failed to approve — try again.")}})),n.addEventListener("click",()=>{r.style.display=r.style.display==="none"?"block":"none",r.style.display==="block"&&o.focus()});const p=()=>{i.textContent=o.value.trim()?"Reject & Continue":"Reject Permanently"};o.addEventListener("input",p),i.addEventListener("click",()=>z(null,null,function*(){if(!ge||!Yt)return;const h=ge,g=Yt,m=o.value.trim();i.disabled=!0,t.disabled=!0,a.style.display="none",i.textContent="Rejecting…";try{yield Nm(g,h,m),m?il():(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 Ak(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function fi(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Pk(e,t,n){const r=!!(t.backendUrl&&t.token),o=document.createElement("div");o.className="ap-sdk-advanced",o.innerHTML=`
1657
1657
  <details class="ap-sdk-advanced__details">
1658
1658
  <summary class="ap-sdk-advanced__summary">Advanced options</summary>
1659
1659
  <div class="ap-sdk-advanced__body">
@@ -1672,12 +1672,12 @@ ${n}${r?`
1672
1672
  </div>
1673
1673
  </div>
1674
1674
  </details>
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};Tm(p,n!=null?n:void 0).then(h=>{var m,k;if(l=h,h.length===0){i.style.display="none";return}const g=(m=h.find(w=>w.isDefault&&w.scope==="project"))!=null?m:h.find(w=>w.isDefault&&w.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(w=>`<option value="${Ak(w.id)}">${Pk(w.name)}${w.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=g==null?void 0:g.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var g,m,k,w,v,Z,K,M;const p=a.value||null,h=p?(m=(g=l.find(E=>E.id===p))==null?void 0:g.templateData)!=null?m:{}:{};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}:{}),(w=h.selectedSkillIds)!=null&&w.length?{selectedSkillIds:h.selectedSkillIds}:{}),(v=h.selectedPluginSkillIds)!=null&&v.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(K=h.selectedSlashCommandIds)!=null&&K.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(M=h.selectedRemoteContextProviderIds)!=null&&M.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function Ak(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Pk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const gi="ap-sdk-captures",Rk=50;function hr(){try{const e=localStorage.getItem(gi);return e?JSON.parse(e):[]}catch(e){return[]}}function Lk(e){const t=hr(),n=[e,...t].slice(0,Rk);try{localStorage.setItem(gi,JSON.stringify(n))}catch(r){}}function zk(){try{localStorage.removeItem(gi)}catch(e){}}function il(e){var a,d,l,p,h;if(e.id){const g=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=g==null?void 0:g.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(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 Ik(e,t){return`Click "${e}" ${t.toLowerCase()}`}function al(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Za(e,t){return`Scrolled to (${e}, ${t})`}function $k(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function cl(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1676
- `)}const Ok=400,Nk=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),Dk=new Set(["Control","Meta","Alt","Shift"]);function Mk(e){if(Dk.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("+")):Nk.has(e.key)?e.key:null}function jk(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?il(e):$o(e)||e.tagName.toLowerCase()}let ur=[],Ke=null,Go=null,it=null,Ut=null,Zt=null;function ll(){Go&&(Go.textContent=`● Recording — ${ur.length} step${ur.length===1?"":"s"}`)}function Fs(){Zt&&(clearTimeout(Zt),Zt=null),Ut&&(ur.push(Ut),Ut=null,ll())}function Cs(e){Fs(),ur.push(e),ll()}function Uk(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 Zk(e,t){it&&it(),ur=[],Ut=null,Ke=document.createElement("div"),Ke.className="ap-sdk-recorder-bar",Ke.setAttribute("data-ap-sdk","1"),Ke.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};Cm(p,n!=null?n:void 0).then(h=>{var m,k;if(l=h,h.length===0){i.style.display="none";return}const g=(m=h.find(w=>w.isDefault&&w.scope==="project"))!=null?m:h.find(w=>w.isDefault&&w.scope==="global");a.innerHTML='<option value="">None (use default)</option>'+h.map(w=>`<option value="${Rk(w.id)}">${Lk(w.name)}${w.isDefault?" (Default)":""}</option>`).join(""),a.value=(k=g==null?void 0:g.id)!=null?k:""}).catch(()=>{i.style.display="none"})}else{a.innerHTML='<option value="">None</option>',a.disabled=!0;const p=document.createElement("span");p.className="ap-sdk-advanced__hint",p.textContent="Connect credentials to enable template selection",i.appendChild(p)}return{getOptions(){var g,m,k,w,v,Z,K,M;const p=a.value||null,h=p?(m=(g=l.find(E=>E.id===p))==null?void 0:g.templateData)!=null?m:{}:{};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}:{}),(w=h.selectedSkillIds)!=null&&w.length?{selectedSkillIds:h.selectedSkillIds}:{}),(v=h.selectedPluginSkillIds)!=null&&v.length?{selectedPluginSkillIds:h.selectedPluginSkillIds}:{}),(Z=h.selectedMcpServerIds)!=null&&Z.length?{selectedMcpServerIds:h.selectedMcpServerIds}:{}),(K=h.selectedSlashCommandIds)!=null&&K.length?{selectedSlashCommandIds:h.selectedSlashCommandIds}:{}),(M=h.selectedRemoteContextProviderIds)!=null&&M.length?{selectedRemoteContextProviderIds:h.selectedRemoteContextProviderIds}:{})}}}function Rk(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Lk(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}const gi="ap-sdk-captures",zk=50;function hr(){try{const e=localStorage.getItem(gi);return e?JSON.parse(e):[]}catch(e){return[]}}function Ik(e){const t=hr(),n=[e,...t].slice(0,zk);try{localStorage.setItem(gi,JSON.stringify(n))}catch(r){}}function $k(){try{localStorage.removeItem(gi)}catch(e){}}function al(e){var a,d,l,p,h;if(e.id){const g=document.querySelector(`label[for="${CSS.escape(e.id)}"]`),m=(a=g==null?void 0:g.textContent)==null?void 0:a.trim();if(m)return m}const t=e.closest("label"),n=(d=t==null?void 0:t.textContent)==null?void 0:d.trim();if(n)return n;const r=(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 Ok(e,t){return`Click "${e}" ${t.toLowerCase()}`}function cl(e,t,n){return n?`Typed [redacted] into ${e}`:`Typed "${t}" into ${e}`}function Za(e,t){return`Scrolled to (${e}, ${t})`}function Nk(e,t){return t?`Pressed "${e}" in ${t}`:`Pressed "${e}"`}function ll(e){return e.map((t,n)=>`${n+1}. ${t.description}`).join(`
1676
+ `)}const Dk=400,Mk=new Set(["Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"]),jk=new Set(["Control","Meta","Alt","Shift"]);function Uk(e){if(jk.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("+")):Mk.has(e.key)?e.key:null}function Zk(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement?al(e):$o(e)||e.tagName.toLowerCase()}let ur=[],Ke=null,Go=null,it=null,Ut=null,Zt=null;function ul(){Go&&(Go.textContent=`● Recording — ${ur.length} step${ur.length===1?"":"s"}`)}function Fs(){Zt&&(clearTimeout(Zt),Zt=null),Ut&&(ur.push(Ut),Ut=null,ul())}function Cs(e){Fs(),ur.push(e),ul()}function qk(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 Hk(e,t){it&&it(),ur=[],Ut=null,Ke=document.createElement("div"),Ke.className="ap-sdk-recorder-bar",Ke.setAttribute("data-ap-sdk","1"),Ke.innerHTML=`
1677
1677
  <span class="ap-sdk-recorder-bar__counter" data-ap-recorder-counter>● Recording — 0 steps</span>
1678
1678
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--stop" data-ap-recorder-stop type="button">Stop</button>
1679
1679
  <button class="ap-sdk-recorder-bar__btn ap-sdk-recorder-bar__btn--discard" data-ap-recorder-discard type="button">Discard</button>
1680
- `,document.body.appendChild(Ke),Qt(Ke),Go=Ke.querySelector("[data-ap-recorder-counter]");const n=()=>{Fs();const l=ur;it==null||it(),e(l)},r=()=>{it==null||it()};Ke.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Ke.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=l=>{if($r(l.target))return;const p=l.target;Cs({action:"click",cssSelector:yo(p),elementText:$o(p),description:Ik($o(p),p.tagName),capturedAt:new Date().toISOString()})},i=l=>{if($r(l.target))return;const p=l.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=il(p),g=Td(p),m=g?"[redacted]":Uk(p);Cs(D(y({action:"inputText",cssSelector:yo(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:al(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const l=Math.round(window.scrollX),p=Math.round(window.scrollY);Ut?(Ut.scrollX=l,Ut.scrollY=p,Ut.description=Za(l,p)):Ut={action:"scroll",scrollX:l,scrollY:p,description:Za(l,p),capturedAt:new Date().toISOString()},Zt&&clearTimeout(Zt),Zt=setTimeout(()=>{Zt=null,Fs()},Ok)},d=l=>{if(l.key==="Escape"){r();return}if($r(l.target))return;const p=Mk(l);if(!p)return;const h=l.target instanceof Element?l.target:document.body,g=jk(h);Cs({action:"keypress",cssSelector:yo(h),elementText:g,key:p,description:$k(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),it=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Zt&&(clearTimeout(Zt),Zt=null),Ut=null,Ke&&en(Ke),Ke==null||Ke.remove(),Ke=null,Go=null,it=null}}function qk(){it==null||it()}function Co(){return it!==null}const Hk="data-ap-sdk",Fk="ap-sdk-fab",qa="ap-sdk-fab--dragging",mi="ap-sdk-fab--open",ul="ap-sdk-fab-pos",Wo="ap-sdk-fab--left-edge",Bk='<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>',Gk='<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>',Wk='<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>',Jk='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Mt=null,hn=null,fn=null,ft=null,Bn=null,Gn=null,Wn=null,Ao=null,Dr=null,or=null,Po=null,Ro=null,Lo=null,dl=0,pl=0,hl=0,fl=0,Xn=!1,Pt=!1,Mr=null,Rn=null;function Vk(){Mr=e=>{if(!$){zo();return}if(!Xn){if(Math.hypot(e.clientX-hl,e.clientY-fl)<5)return;Xn=!0,Pt=!0,$.classList.add(qa)}Yk(e.clientX-dl,e.clientY-pl)},Rn=()=>{if(!$){zo();return}Xn?(Xn=!1,$.classList.remove(qa),$.style.transition="",Xk($.getBoundingClientRect())):$.style.transition="",zo()},window.addEventListener("pointermove",Mr),window.addEventListener("pointerup",Rn),window.addEventListener("pointercancel",Rn)}function zo(){Mr&&(window.removeEventListener("pointermove",Mr),Mr=null),Rn&&(window.removeEventListener("pointerup",Rn),window.removeEventListener("pointercancel",Rn),Rn=null)}function Yk(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 Xk(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(Wo)):($.style.left="auto",$.style.right="16px",$.classList.remove(Wo));try{localStorage.setItem(ul,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function Kk(){if($)try{const e=localStorage.getItem(ul);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(Wo)):($.style.left="auto",$.style.right="16px",$.classList.remove(Wo))}catch(e){}}function Kn(){$==null||$.classList.remove(mi),or&&(window.removeEventListener("pointerdown",or,{capture:!0}),or=null)}function Qk(){$&&($.classList.add(mi),or=e=>{!$||$.contains(e.target)||Kn()},requestAnimationFrame(()=>{or&&window.addEventListener("pointerdown",or,{capture:!0})}))}function ko(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function gl(e,t,n){var d;if(Po=e,Ro=t,Lo=n,$)return;$=document.createElement("div"),$.className=Fk,$.setAttribute(Hk,"1"),Bn=document.createElement("div"),Bn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ft=document.createElement("button"),ft.className="ap-sdk-fab__list ap-sdk-fab__sub",ft.setAttribute("aria-label","My captures"),ft.setAttribute("title","View my captures"),ft.appendChild(ko(Jk));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ft.appendChild(o),Bn.appendChild(r),Bn.appendChild(ft),Gn=document.createElement("div"),Gn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",hn=document.createElement("button"),hn.className="ap-sdk-fab__capture ap-sdk-fab__sub",hn.setAttribute("aria-label","Capture element"),hn.setAttribute("title","Capture element to Agent Platform"),hn.appendChild(ko(Gk)),Gn.appendChild(i),Gn.appendChild(hn),Wn=document.createElement("div"),Wn.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",fn=document.createElement("button"),fn.className="ap-sdk-fab__record ap-sdk-fab__sub",fn.setAttribute("aria-label","Record interaction"),fn.setAttribute("title","Record a sequence of interactions"),fn.appendChild(ko(Wk)),Wn.appendChild(a),Wn.appendChild(fn),Mt=document.createElement("button"),Mt.className="ap-sdk-fab__main",Mt.setAttribute("aria-label","Agent Platform"),Mt.setAttribute("title","Agent Platform"),Mt.appendChild(ko(Bk)),$.appendChild(Bn),$.appendChild(Gn),$.appendChild(Wn),$.appendChild(Mt),Mt.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),$!=null&&$.classList.contains(mi)?Kn():Qk()}),hn.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),Kn(),!tr()&&!Co()&&Po&&Po()}),fn.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),Kn(),!tr()&&!Co()&&Ro&&Ro()}),ft.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),Kn(),Lo&&Lo()}),Dr=l=>{if(!$||!($===l.target||$.contains(l.target)))return;const p=$.getBoundingClientRect();dl=l.clientX-p.left,pl=l.clientY-p.top,hl=l.clientX,fl=l.clientY,Xn=!1,Pt=!1,$.style.transition="none",l.stopPropagation(),Vk()},window.addEventListener("pointerdown",Dr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),Qt($),Kk(),Ao=setInterval(()=>{Mt&&Mt.classList.toggle("ap-sdk-fab__main--active",tr()||Co())},200)}function On(e){const t=ft==null?void 0:ft.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function ml(){Xn=!1,Pt=!1,zo(),Kn(),Ao&&(clearInterval(Ao),Ao=null),Dr&&(window.removeEventListener("pointerdown",Dr,{capture:!0}),Dr=null),$&&en($),$==null||$.remove(),$=null,Mt=null,hn=null,fn=null,ft=null,Bn=null,Gn=null,Wn=null,Po=null,Ro=null,Lo=null}function bl(e,t){return z(this,null,function*(){try{if(e.type==="planning"){const r=yield Em(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Dc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function kl(e){return e.filter(t=>!t.approved).length}function _l(e){return z(this,null,function*(){const t=hr();if(!e||t.length===0){On(t.length);return}const n=yield Promise.all(t.map(r=>bl(r,e)));On(kl(n))})}let dn=null;function e_(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Bs(e){if(dn){const d=dn;d.cleanup(),d.popup.closed||d.popup.close(),dn=null}const t=e.replace(/\/+$/,""),n=new URL(t).origin,r=e_(),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",g),clearInterval(m),(dn==null?void 0:dn.popup)===a&&(dn=null)}function g(k){if(k.origin!==n)return;const w=k.data;!w||w.type!=="ap-sdk-oauth"||w.state!==r||!w.code||(p=!0,h(),d({code:w.code}))}window.addEventListener("message",g);const m=window.setInterval(()=>{a.closed&&(h(),p||l(new Error("Connection cancelled.")))},500);dn={popup:a,cleanup:h}}):Promise.reject(new Error("Popup blocked — please allow popups for this site and try again."))}const t_="https://agent-platform.tung.engineering",bi="ap-sdk-config";function n_(){try{const e=sessionStorage.getItem(bi);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()?(vl(),null):t}catch(e){return null}}function rs(e){sessionStorage.setItem(bi,JSON.stringify(e)),o_({backendUrl:e.backendUrl,projectCode:e.projectCode})}function vl(){sessionStorage.removeItem(bi)}const yl="ap-sdk-last-connection";function r_(){try{const e=localStorage.getItem(yl);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 o_(e){try{localStorage.setItem(yl,JSON.stringify(e))}catch(t){}}let X=null;function Jt(){X&&en(X),X==null||X.remove(),X=null}function ki(e){X&&Jt(),X=document.createElement("div"),X.className="ap-sdk-panel",X.setAttribute("data-ap-sdk","1"),X.setAttribute("role","dialog"),X.setAttribute("aria-modal","true"),X.setAttribute("aria-label","Connect to Agent Platform");const t=r_();t?n(t):r(t_),document.body.appendChild(X),Qt(X);function n(i){if(!X)return;X.innerHTML=`
1680
+ `,document.body.appendChild(Ke),Qt(Ke),Go=Ke.querySelector("[data-ap-recorder-counter]");const n=()=>{Fs();const l=ur;it==null||it(),e(l)},r=()=>{it==null||it()};Ke.querySelector("[data-ap-recorder-stop]").addEventListener("click",n),Ke.querySelector("[data-ap-recorder-discard]").addEventListener("click",r);const o=l=>{if($r(l.target))return;const p=l.target;Cs({action:"click",cssSelector:yo(p),elementText:$o(p),description:Ok($o(p),p.tagName),capturedAt:new Date().toISOString()})},i=l=>{if($r(l.target))return;const p=l.target;if(!(p instanceof HTMLInputElement)&&!(p instanceof HTMLTextAreaElement)&&!(p instanceof HTMLSelectElement))return;const h=al(p),g=Ed(p),m=g?"[redacted]":qk(p);Cs(D(y({action:"inputText",cssSelector:yo(p),elementText:h,value:m},g?{redacted:!0}:{}),{description:cl(h,m,g),capturedAt:new Date().toISOString()}))},a=()=>{const l=Math.round(window.scrollX),p=Math.round(window.scrollY);Ut?(Ut.scrollX=l,Ut.scrollY=p,Ut.description=Za(l,p)):Ut={action:"scroll",scrollX:l,scrollY:p,description:Za(l,p),capturedAt:new Date().toISOString()},Zt&&clearTimeout(Zt),Zt=setTimeout(()=>{Zt=null,Fs()},Dk)},d=l=>{if(l.key==="Escape"){r();return}if($r(l.target))return;const p=Uk(l);if(!p)return;const h=l.target instanceof Element?l.target:document.body,g=Zk(h);Cs({action:"keypress",cssSelector:yo(h),elementText:g,key:p,description:Nk(p,g),capturedAt:new Date().toISOString()})};document.addEventListener("click",o,{capture:!0}),document.addEventListener("change",i,{capture:!0}),window.addEventListener("scroll",a,{capture:!0,passive:!0}),document.addEventListener("keydown",d,{capture:!0}),it=()=>{document.removeEventListener("click",o,{capture:!0}),document.removeEventListener("change",i,{capture:!0}),window.removeEventListener("scroll",a,{capture:!0}),document.removeEventListener("keydown",d,{capture:!0}),Zt&&(clearTimeout(Zt),Zt=null),Ut=null,Ke&&en(Ke),Ke==null||Ke.remove(),Ke=null,Go=null,it=null}}function Fk(){it==null||it()}function Co(){return it!==null}const Bk="data-ap-sdk",Gk="ap-sdk-fab",qa="ap-sdk-fab--dragging",mi="ap-sdk-fab--open",dl="ap-sdk-fab-pos",Wo="ap-sdk-fab--left-edge",Wk='<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>',Jk='<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>',Vk='<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>',Yk='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/></svg>';let $=null,Mt=null,hn=null,fn=null,ft=null,Bn=null,Gn=null,Wn=null,Ao=null,Dr=null,or=null,Po=null,Ro=null,Lo=null,pl=0,hl=0,fl=0,gl=0,Xn=!1,Pt=!1,Mr=null,Rn=null;function Xk(){Mr=e=>{if(!$){zo();return}if(!Xn){if(Math.hypot(e.clientX-fl,e.clientY-gl)<5)return;Xn=!0,Pt=!0,$.classList.add(qa)}Kk(e.clientX-pl,e.clientY-hl)},Rn=()=>{if(!$){zo();return}Xn?(Xn=!1,$.classList.remove(qa),$.style.transition="",Qk($.getBoundingClientRect())):$.style.transition="",zo()},window.addEventListener("pointermove",Mr),window.addEventListener("pointerup",Rn),window.addEventListener("pointercancel",Rn)}function zo(){Mr&&(window.removeEventListener("pointermove",Mr),Mr=null),Rn&&(window.removeEventListener("pointerup",Rn),window.removeEventListener("pointercancel",Rn),Rn=null)}function Kk(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 Qk(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(Wo)):($.style.left="auto",$.style.right="16px",$.classList.remove(Wo));try{localStorage.setItem(dl,JSON.stringify({edge:r,bottom:n}))}catch(o){}}function e_(){if($)try{const e=localStorage.getItem(dl);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(Wo)):($.style.left="auto",$.style.right="16px",$.classList.remove(Wo))}catch(e){}}function Kn(){$==null||$.classList.remove(mi),or&&(window.removeEventListener("pointerdown",or,{capture:!0}),or=null)}function t_(){$&&($.classList.add(mi),or=e=>{!$||$.contains(e.target)||Kn()},requestAnimationFrame(()=>{or&&window.addEventListener("pointerdown",or,{capture:!0})}))}function ko(e){return new DOMParser().parseFromString(e,"text/html").body.firstElementChild}function ml(e,t,n){var d;if(Po=e,Ro=t,Lo=n,$)return;$=document.createElement("div"),$.className=Gk,$.setAttribute(Bk,"1"),Bn=document.createElement("div"),Bn.className="ap-sdk-fab__row";const r=document.createElement("span");r.className="ap-sdk-fab__label",r.textContent="View captures",ft=document.createElement("button"),ft.className="ap-sdk-fab__list ap-sdk-fab__sub",ft.setAttribute("aria-label","My captures"),ft.setAttribute("title","View my captures"),ft.appendChild(ko(Yk));const o=document.createElement("span");o.className="ap-sdk-fab__badge",o.setAttribute("data-ap-badge",""),o.style.display="none",ft.appendChild(o),Bn.appendChild(r),Bn.appendChild(ft),Gn=document.createElement("div"),Gn.className="ap-sdk-fab__row";const i=document.createElement("span");i.className="ap-sdk-fab__label",i.textContent="Capture element",hn=document.createElement("button"),hn.className="ap-sdk-fab__capture ap-sdk-fab__sub",hn.setAttribute("aria-label","Capture element"),hn.setAttribute("title","Capture element to Agent Platform"),hn.appendChild(ko(Jk)),Gn.appendChild(i),Gn.appendChild(hn),Wn=document.createElement("div"),Wn.className="ap-sdk-fab__row";const a=document.createElement("span");a.className="ap-sdk-fab__label",a.textContent="Record interaction",fn=document.createElement("button"),fn.className="ap-sdk-fab__record ap-sdk-fab__sub",fn.setAttribute("aria-label","Record interaction"),fn.setAttribute("title","Record a sequence of interactions"),fn.appendChild(ko(Vk)),Wn.appendChild(a),Wn.appendChild(fn),Mt=document.createElement("button"),Mt.className="ap-sdk-fab__main",Mt.setAttribute("aria-label","Agent Platform"),Mt.setAttribute("title","Agent Platform"),Mt.appendChild(ko(Wk)),$.appendChild(Bn),$.appendChild(Gn),$.appendChild(Wn),$.appendChild(Mt),Mt.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),$!=null&&$.classList.contains(mi)?Kn():t_()}),hn.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),Kn(),!tr()&&!Co()&&Po&&Po()}),fn.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),Kn(),!tr()&&!Co()&&Ro&&Ro()}),ft.addEventListener("click",l=>{if(Pt){Pt=!1;return}l.preventDefault(),l.stopPropagation(),Kn(),Lo&&Lo()}),Dr=l=>{if(!$||!($===l.target||$.contains(l.target)))return;const p=$.getBoundingClientRect();pl=l.clientX-p.left,hl=l.clientY-p.top,fl=l.clientX,gl=l.clientY,Xn=!1,Pt=!1,$.style.transition="none",l.stopPropagation(),Xk()},window.addEventListener("pointerdown",Dr,{capture:!0}),((d=document.body)!=null?d:document.documentElement).appendChild($),Qt($),e_(),Ao=setInterval(()=>{Mt&&Mt.classList.toggle("ap-sdk-fab__main--active",tr()||Co())},200)}function On(e){const t=ft==null?void 0:ft.querySelector("[data-ap-badge]");t&&(e>0?(t.textContent=String(e),t.style.display=""):t.style.display="none")}function bl(){Xn=!1,Pt=!1,zo(),Kn(),Ao&&(clearInterval(Ao),Ao=null),Dr&&(window.removeEventListener("pointerdown",Dr,{capture:!0}),Dr=null),$&&en($),$==null||$.remove(),$=null,Mt=null,hn=null,fn=null,ft=null,Bn=null,Gn=null,Wn=null,Po=null,Ro=null,Lo=null}function kl(e,t){return z(this,null,function*(){try{if(e.type==="planning"){const r=yield Am(t,e.id);return{capture:e,status:r.status,approved:r.status==="approved"}}const n=yield Mc(t,e.id);return{capture:e,status:n.status,approved:n.approved===!0}}catch(n){return{capture:e,status:"unavailable",approved:!1}}})}function _l(e){return e.filter(t=>!t.approved).length}function vl(e){return z(this,null,function*(){const t=hr();if(!e||t.length===0){On(t.length);return}const n=yield Promise.all(t.map(r=>kl(r,e)));On(_l(n))})}let dn=null;function n_(){const e=new Uint32Array(4);return crypto.getRandomValues(e),Array.from(e,t=>t.toString(16)).join("")}function Bs(e){if(dn){const d=dn;d.cleanup(),d.popup.closed||d.popup.close(),dn=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",g),clearInterval(m),(dn==null?void 0:dn.popup)===a&&(dn=null)}function g(k){if(k.origin!==n)return;const w=k.data;!w||w.type!=="ap-sdk-oauth"||w.state!==r||!w.code||(p=!0,h(),d({code:w.code}))}window.addEventListener("message",g);const m=window.setInterval(()=>{a.closed&&(h(),p||l(new Error("Connection cancelled.")))},500);dn={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",bi="ap-sdk-config";function o_(){try{const e=sessionStorage.getItem(bi);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()?(yl(),null):t}catch(e){return null}}function rs(e){sessionStorage.setItem(bi,JSON.stringify(e)),i_({backendUrl:e.backendUrl,projectCode:e.projectCode})}function yl(){sessionStorage.removeItem(bi)}const wl="ap-sdk-last-connection";function s_(){try{const e=localStorage.getItem(wl);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 i_(e){try{localStorage.setItem(wl,JSON.stringify(e))}catch(t){}}let X=null;function Jt(){X&&en(X),X==null||X.remove(),X=null}function ki(e){X&&Jt(),X=document.createElement("div"),X.className="ap-sdk-panel",X.setAttribute("data-ap-sdk","1"),X.setAttribute("role","dialog"),X.setAttribute("aria-modal","true"),X.setAttribute("aria-label","Connect to Agent Platform");const t=s_();t?n(t):r(r_),document.body.appendChild(X),Qt(X);function n(i){if(!X)return;X.innerHTML=`
1681
1681
  <div class="ap-sdk-panel__header">
1682
1682
  <span class="ap-sdk-panel__title">
1683
1683
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1742,7 +1742,7 @@ ${n}${r?`
1742
1742
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-save>Save</button>
1743
1743
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-back>Back</button>
1744
1744
  </div>
1745
- `;const h=X.querySelector("[data-ap-cfg-project]"),g=X.querySelector("[data-ap-cfg-status]");X.querySelector("[data-ap-close]").addEventListener("click",()=>{Jt()}),X.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),X.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){pn(g,"error","Please select a project.");return}Jt(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function pn(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 Ha(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 W=null,et=null,Vt=null;function jr(){return W!==null}function qr(){W&&en(W),W==null||W.remove(),W=null,Vt==null||Vt(),Vt=null,et==null||et.destroy(),et=null}function wl(e,t,n,r,o,i,a,d,l,p,h=null,g){var an,yt,xe,Te;W&&qr();const m=!n.backendUrl||!n.token,k=ma(h,"tasks:write"),w=ma(h,"planning-sessions:write"),v={captureType:(an=g==null?void 0:g.captureType)!=null?an:!k&&w?"planning":"task",submitting:!1,completedPicks:(yt=g==null?void 0:g.completedPicks)!=null?yt:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:(xe=g==null?void 0:g.allowSubmit)!=null?xe:!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=`
1745
+ `;const h=X.querySelector("[data-ap-cfg-project]"),g=X.querySelector("[data-ap-cfg-status]");X.querySelector("[data-ap-close]").addEventListener("click",()=>{Jt()}),X.querySelector("[data-ap-back]").addEventListener("click",()=>r(i)),X.querySelector("[data-ap-save]").addEventListener("click",()=>{const m=h.value;if(!m){pn(g,"error","Please select a project.");return}Jt(),e({backendUrl:i,token:a,projectCode:m,expiresAt:d})})}}function pn(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 Ha(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 W=null,et=null,Vt=null;function jr(){return W!==null}function qr(){W&&en(W),W==null||W.remove(),W=null,Vt==null||Vt(),Vt=null,et==null||et.destroy(),et=null}function xl(e,t,n,r,o,i,a,d,l,p,h=null,g){var an,yt,xe,Te;W&&qr();const m=!n.backendUrl||!n.token,k=ma(h,"tasks:write"),w=ma(h,"planning-sessions:write"),v={captureType:(an=g==null?void 0:g.captureType)!=null?an:!k&&w?"planning":"task",submitting:!1,completedPicks:(yt=g==null?void 0:g.completedPicks)!=null?yt:[],currentCtx:e,currentPickedEl:t,awaitingPick:!1,allowSubmit:(xe=g==null?void 0:g.allowSubmit)!=null?xe:!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=`
1746
1746
  <div class="ap-sdk-panel__header">
1747
1747
  <span class="ap-sdk-panel__title">
1748
1748
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1803,7 +1803,7 @@ ${n}${r?`
1803
1803
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-submit>Submit</button>
1804
1804
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-cancel>Cancel</button>
1805
1805
  </div>
1806
- `,W.addEventListener("wheel",H=>{H.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",H=>{H.stopPropagation()},{passive:!0});const Z=W.querySelector(".ap-sdk-panel__body"),K=Ck(Z,n,(Te=r==null?void 0:r.id)!=null?Te:null);document.body.appendChild(W),et=Gs(),v.currentPickedEl&&et.update(v.currentPickedEl),Qt(W),ni(W,ti);const M=W.querySelector("[data-ap-close]"),E=W.querySelector("[data-ap-cancel]"),T=W.querySelector("[data-ap-submit]"),C=W.querySelector("[data-ap-note]"),N=W.querySelector("[data-ap-status]"),J=W.querySelectorAll("[data-ap-type]"),ye=W.querySelector("[data-ap-automate-options]"),Oe=W.querySelector("[data-ap-allow-submit]"),Be=W.querySelector("[data-ap-pick-list]"),te=W.querySelector("[data-ap-context]"),we=W.querySelector("[data-ap-add-another]"),ot=W.querySelector("[data-ap-pick-actions]"),nn=W.querySelector("[data-ap-select-parent]"),rn=W.querySelector("[data-ap-reselect]"),dt=()=>{v.currentPickedEl&&(et==null||et.update(v.currentPickedEl))};window.addEventListener("scroll",dt,{capture:!0,passive:!0}),window.addEventListener("resize",dt),Vt=()=>{window.removeEventListener("scroll",dt,!0),window.removeEventListener("resize",dt)};const It=H=>{H?(te.innerHTML=Fa(H),C.disabled=!1,C.placeholder="Describe the task or planning session…",setTimeout(()=>C.focus(),50)):(te.innerHTML=`
1806
+ `,W.addEventListener("wheel",H=>{H.stopPropagation()},{passive:!0}),W.addEventListener("touchmove",H=>{H.stopPropagation()},{passive:!0});const Z=W.querySelector(".ap-sdk-panel__body"),K=Pk(Z,n,(Te=r==null?void 0:r.id)!=null?Te:null);document.body.appendChild(W),et=Gs(),v.currentPickedEl&&et.update(v.currentPickedEl),Qt(W),ni(W,ti);const M=W.querySelector("[data-ap-close]"),E=W.querySelector("[data-ap-cancel]"),T=W.querySelector("[data-ap-submit]"),C=W.querySelector("[data-ap-note]"),N=W.querySelector("[data-ap-status]"),J=W.querySelectorAll("[data-ap-type]"),ye=W.querySelector("[data-ap-automate-options]"),Oe=W.querySelector("[data-ap-allow-submit]"),Be=W.querySelector("[data-ap-pick-list]"),te=W.querySelector("[data-ap-context]"),we=W.querySelector("[data-ap-add-another]"),ot=W.querySelector("[data-ap-pick-actions]"),nn=W.querySelector("[data-ap-select-parent]"),rn=W.querySelector("[data-ap-reselect]"),dt=()=>{v.currentPickedEl&&(et==null||et.update(v.currentPickedEl))};window.addEventListener("scroll",dt,{capture:!0,passive:!0}),window.addEventListener("resize",dt),Vt=()=>{window.removeEventListener("scroll",dt,!0),window.removeEventListener("resize",dt)};const It=H=>{H?(te.innerHTML=Fa(H),C.disabled=!1,C.placeholder="Describe the task or planning session…",setTimeout(()=>C.focus(),50)):(te.innerHTML=`
1807
1807
  <div class="ap-sdk-panel__context-label">Next element</div>
1808
1808
  <div class="ap-sdk-panel__context-text ap-sdk-awaiting-pick">👆 Hover and click any element on the page</div>
1809
1809
  `,C.disabled=!0,C.placeholder="Pick an element to continue…")},on=()=>{if(v.completedPicks.length===0){Be.style.display="none",Be.innerHTML="";return}Be.style.display="block",Be.innerHTML=v.completedPicks.map((H,oe)=>{var Q;return`
@@ -1815,20 +1815,20 @@ ${n}${r?`
1815
1815
  </div>
1816
1816
  <div class="ap-sdk-pick-entry__instruction">${ut(H.instruction)}</div>
1817
1817
  </div>
1818
- `}).join(""),Be.querySelectorAll("[data-ap-remove]").forEach(H=>{H.addEventListener("click",()=>{const oe=parseInt(H.dataset.apRemove,10);v.completedPicks.splice(oe,1),on()})})},sn=()=>{if(!v.currentPickedEl){ot.style.display="none";return}ot.style.display="",nn.disabled=!v.currentPickedEl.parentElement||v.awaitingPick,rn&&(rn.disabled=v.awaitingPick)},$t=()=>{we&&(we.disabled=!C.value.trim()||v.submitting||v.awaitingPick)},pe=(H,oe)=>{v.currentCtx=H,v.currentPickedEl=oe,It(H),et==null||et.update(oe),sn()};sn(),g&&(C.value=g.note,Oe.checked=g.allowSubmit,ye.style.display=v.captureType==="automate"?"":"none",on(),Jn(N,"success","Reconnected — your draft was kept.")),nn.addEventListener("click",()=>{var oe;const H=(oe=v.currentPickedEl)==null?void 0:oe.parentElement;H&&pe(Qa(H),H)}),rn&&l&&rn.addEventListener("click",()=>{if(v.awaitingPick)return;const H=v.currentCtx,oe=v.currentPickedEl;v.awaitingPick=!0,sn(),$t(),It(null),l((Q,Ne)=>{v.awaitingPick=!1,pe(Q,Ne),$t()},()=>{v.awaitingPick=!1,oe&&pe(H,oe),$t()})});const vt=()=>{qr(),p==null||p()},_e=()=>({captureType:v.captureType,note:C.value,completedPicks:v.completedPicks,currentCtx:v.currentCtx,currentPickedEl:v.currentPickedEl,allowSubmit:v.allowSubmit});M.addEventListener("click",vt),E.addEventListener("click",vt);const yn=W.querySelector("[data-ap-connect-required]");yn&&a&&yn.addEventListener("click",()=>{const H=_e();vt(),a(H)}),J.forEach(H=>{H.addEventListener("click",()=>{v.captureType=H.dataset.apType,J.forEach(oe=>oe.classList.toggle("ap-sdk-active",oe===H)),ye.style.display=v.captureType==="automate"?"":"none"})}),Oe.addEventListener("change",()=>{v.allowSubmit=Oe.checked});const le=W.querySelector("[data-ap-reconfigure]");a?le.addEventListener("click",()=>{const H=_e();vt(),a(H)}):le.style.display="none",we&&d&&(C.addEventListener("input",$t),we.addEventListener("click",()=>{const H=C.value.trim();!H||v.awaitingPick||(v.completedPicks.push({ctx:v.currentCtx,instruction:H}),on(),C.value="",v.awaitingPick=!0,we.disabled=!0,sn(),It(null),d((oe,Q)=>{v.awaitingPick=!1,pe(oe,Q),$t()}))}));const Ge=()=>z(null,null,function*(){var Ft,wt;if(v.submitting)return;if(m){Jn(N,"error","Connect to Agent Platform first.");return}const H=n.backendUrl,oe=n.token,Q=C.value.trim();if(!Q){Jn(N,"error","Please enter an instruction.");return}v.submitting=!0,Ps(W,!0),Jn(N,null,""),T.textContent="Submitting…";const Ne={backendUrl:H,token:oe},We=K.getOptions(),je=[...v.completedPicks,{ctx:v.currentCtx,instruction:Q}];try{const De={id:r==null?void 0:r.id,key:o};let Ce,ze,Ue;if(je.length===1)if(v.captureType==="task")Ce=(yield $s(Ne,{project:De,note:Q,ctx:v.currentCtx,advancedOpts:We})).id,ze="task",Ue=Q.slice(0,120)||v.currentCtx.pageTitle||"Browser capture";else if(v.captureType==="planning"){let Ye=vd(Q,D(y({},v.currentCtx),{ancestry:v.currentCtx.outerTree||v.currentCtx.ancestry}));(Ft=v.currentCtx.innerTree)!=null&&Ft.trim()&&(Ye+=`
1818
+ `}).join(""),Be.querySelectorAll("[data-ap-remove]").forEach(H=>{H.addEventListener("click",()=>{const oe=parseInt(H.dataset.apRemove,10);v.completedPicks.splice(oe,1),on()})})},sn=()=>{if(!v.currentPickedEl){ot.style.display="none";return}ot.style.display="",nn.disabled=!v.currentPickedEl.parentElement||v.awaitingPick,rn&&(rn.disabled=v.awaitingPick)},$t=()=>{we&&(we.disabled=!C.value.trim()||v.submitting||v.awaitingPick)},pe=(H,oe)=>{v.currentCtx=H,v.currentPickedEl=oe,It(H),et==null||et.update(oe),sn()};sn(),g&&(C.value=g.note,Oe.checked=g.allowSubmit,ye.style.display=v.captureType==="automate"?"":"none",on(),Jn(N,"success","Reconnected — your draft was kept.")),nn.addEventListener("click",()=>{var oe;const H=(oe=v.currentPickedEl)==null?void 0:oe.parentElement;H&&pe(Qa(H),H)}),rn&&l&&rn.addEventListener("click",()=>{if(v.awaitingPick)return;const H=v.currentCtx,oe=v.currentPickedEl;v.awaitingPick=!0,sn(),$t(),It(null),l((Q,Ne)=>{v.awaitingPick=!1,pe(Q,Ne),$t()},()=>{v.awaitingPick=!1,oe&&pe(H,oe),$t()})});const vt=()=>{qr(),p==null||p()},_e=()=>({captureType:v.captureType,note:C.value,completedPicks:v.completedPicks,currentCtx:v.currentCtx,currentPickedEl:v.currentPickedEl,allowSubmit:v.allowSubmit});M.addEventListener("click",vt),E.addEventListener("click",vt);const yn=W.querySelector("[data-ap-connect-required]");yn&&a&&yn.addEventListener("click",()=>{const H=_e();vt(),a(H)}),J.forEach(H=>{H.addEventListener("click",()=>{v.captureType=H.dataset.apType,J.forEach(oe=>oe.classList.toggle("ap-sdk-active",oe===H)),ye.style.display=v.captureType==="automate"?"":"none"})}),Oe.addEventListener("change",()=>{v.allowSubmit=Oe.checked});const le=W.querySelector("[data-ap-reconfigure]");a?le.addEventListener("click",()=>{const H=_e();vt(),a(H)}):le.style.display="none",we&&d&&(C.addEventListener("input",$t),we.addEventListener("click",()=>{const H=C.value.trim();!H||v.awaitingPick||(v.completedPicks.push({ctx:v.currentCtx,instruction:H}),on(),C.value="",v.awaitingPick=!0,we.disabled=!0,sn(),It(null),d((oe,Q)=>{v.awaitingPick=!1,pe(oe,Q),$t()}))}));const Ge=()=>z(null,null,function*(){var Ft,wt;if(v.submitting)return;if(m){Jn(N,"error","Connect to Agent Platform first.");return}const H=n.backendUrl,oe=n.token,Q=C.value.trim();if(!Q){Jn(N,"error","Please enter an instruction.");return}v.submitting=!0,Ps(W,!0),Jn(N,null,""),T.textContent="Submitting…";const Ne={backendUrl:H,token:oe},We=K.getOptions(),je=[...v.completedPicks,{ctx:v.currentCtx,instruction:Q}];try{const De={id:r==null?void 0:r.id,key:o};let Ce,ze,Ue;if(je.length===1)if(v.captureType==="task")Ce=(yield $s(Ne,{project:De,note:Q,ctx:v.currentCtx,advancedOpts:We})).id,ze="task",Ue=Q.slice(0,120)||v.currentCtx.pageTitle||"Browser capture";else if(v.captureType==="planning"){let Ye=yd(Q,D(y({},v.currentCtx),{ancestry:v.currentCtx.outerTree||v.currentCtx.ancestry}));(Ft=v.currentCtx.innerTree)!=null&&Ft.trim()&&(Ye+=`
1819
1819
 
1820
1820
  Element tree:
1821
1821
  ${v.currentCtx.innerTree}`),(wt=v.currentCtx.interactionSteps)!=null&&wt.length&&(Ye+=`
1822
1822
 
1823
1823
  Recorded steps:
1824
- ${cl(v.currentCtx.interactionSteps)}`),Ce=(yield fa(Ne,De,Ye,We)).id,ze="planning",Ue=Q.slice(0,120)||v.currentCtx.pageTitle||"Planning session"}else Ce=(yield ha(Ne,{project:De,note:Q,ctx:v.currentCtx,advancedOpts:We,allowSubmit:v.allowSubmit})).id,ze="automate",Ue=Q.slice(0,120)||v.currentCtx.pageTitle||"Browser automation";else{const Ye=i_(je),st=je[0].instruction.slice(0,120)||je[0].ctx.pageTitle||"Multi-element capture",xt=je.map(Ae=>Ae.instruction).filter(Boolean).join(`
1824
+ ${ll(v.currentCtx.interactionSteps)}`),Ce=(yield fa(Ne,De,Ye,We)).id,ze="planning",Ue=Q.slice(0,120)||v.currentCtx.pageTitle||"Planning session"}else Ce=(yield ha(Ne,{project:De,note:Q,ctx:v.currentCtx,advancedOpts:We,allowSubmit:v.allowSubmit})).id,ze="automate",Ue=Q.slice(0,120)||v.currentCtx.pageTitle||"Browser automation";else{const Ye=c_(je),st=je[0].instruction.slice(0,120)||je[0].ctx.pageTitle||"Multi-element capture",xt=je.map(Ae=>Ae.instruction).filter(Boolean).join(`
1825
1825
 
1826
- `);v.captureType==="task"?(Ce=(yield $s(Ne,{project:De,note:Ye,ctx:je[0].ctx,advancedOpts:We,titleOverride:st,type:$c,titleInstruction:xt})).id,ze="task",Ue=st):v.captureType==="planning"?(Ce=(yield fa(Ne,De,Ye,We)).id,ze="planning",Ue=st):(Ce=(yield ha(Ne,{project:De,note:Ye,ctx:je[0].ctx,advancedOpts:We,titleOverride:st,titleInstruction:xt,allowSubmit:v.allowSubmit})).id,ze="automate",Ue=st)}if(Lk({id:Ce,type:ze,title:Ue,backendUrl:H,createdAt:new Date().toISOString()}),_l(Ne).catch(()=>{}),ze==="automate"){vt(),pi(Ce,Ne,H,Ue,p);return}const fr=ze==="task"?`${H.replace(/\/+$/,"")}/tasks/${Ce}`:`${H.replace(/\/+$/,"")}/planning/${Ce}`;c_(N,ze,Ue,fr,vt),W.classList.add("ap-sdk-panel--success"),Vt==null||Vt(),Vt=null,et==null||et.hide(),v.submitting=!1,Ps(W,!1)}catch(De){De instanceof Oc?a_(N,()=>z(null,null,function*(){const{code:Ce}=yield Bs(H),{token:ze,expiresAt:Ue}=yield Os({backendUrl:H},Ce,window.location.origin);rs({backendUrl:H,token:ze,projectCode:o,expiresAt:Ue}),n.token=ze,i({backendUrl:H,token:ze}),yield Ge()})):Jn(N,"error",De instanceof Error?De.message:"An unexpected error occurred."),v.submitting=!1,Ps(W,!1),T.textContent="Submit"}});T.addEventListener("click",Ge),setTimeout(()=>C.focus(),50)}const s_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Fa(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1826
+ `);v.captureType==="task"?(Ce=(yield $s(Ne,{project:De,note:Ye,ctx:je[0].ctx,advancedOpts:We,titleOverride:st,type:$c,titleInstruction:xt})).id,ze="task",Ue=st):v.captureType==="planning"?(Ce=(yield fa(Ne,De,Ye,We)).id,ze="planning",Ue=st):(Ce=(yield ha(Ne,{project:De,note:Ye,ctx:je[0].ctx,advancedOpts:We,titleOverride:st,titleInstruction:xt,allowSubmit:v.allowSubmit})).id,ze="automate",Ue=st)}if(Ik({id:Ce,type:ze,title:Ue,backendUrl:H,createdAt:new Date().toISOString()}),vl(Ne).catch(()=>{}),ze==="automate"){vt(),pi(Ce,Ne,H,Ue,p);return}const fr=ze==="task"?`${H.replace(/\/+$/,"")}/tasks/${Ce}`:`${H.replace(/\/+$/,"")}/planning/${Ce}`;u_(N,ze,Ue,fr,vt),W.classList.add("ap-sdk-panel--success"),Vt==null||Vt(),Vt=null,et==null||et.hide(),v.submitting=!1,Ps(W,!1)}catch(De){De instanceof Oc?l_(N,()=>z(null,null,function*(){const{code:Ce}=yield Bs(H),{token:ze,expiresAt:Ue}=yield Os({backendUrl:H},Ce,window.location.origin);rs({backendUrl:H,token:ze,projectCode:o,expiresAt:Ue}),n.token=ze,i({backendUrl:H,token:ze}),yield Ge()})):Jn(N,"error",De instanceof Error?De.message:"An unexpected error occurred."),v.submitting=!1,Ps(W,!1),T.textContent="Submit"}});T.addEventListener("click",Ge),setTimeout(()=>C.focus(),50)}const a_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};function Fa(e){var t,n;return(t=e.interactionSteps)!=null&&t.length?`
1827
1827
  <div class="ap-sdk-panel__context-label">Recorded steps (${e.interactionSteps.length})</div>
1828
1828
  <div class="ap-sdk-panel__context-steps">
1829
1829
  ${e.interactionSteps.map(r=>`
1830
1830
  <div class="ap-sdk-panel__context-step">
1831
- <span class="ap-sdk-panel__context-step-icon">${s_[r.action]}</span>
1831
+ <span class="ap-sdk-panel__context-step-icon">${a_[r.action]}</span>
1832
1832
  <span class="ap-sdk-panel__context-step-text">${ut(r.description)}</span>
1833
1833
  </div>
1834
1834
  `).join("")}
@@ -1837,7 +1837,7 @@ ${cl(v.currentCtx.interactionSteps)}`),Ce=(yield fa(Ne,De,Ye,We)).id,ze="plannin
1837
1837
  <div class="ap-sdk-panel__context-label">Captured element</div>
1838
1838
  <div class="ap-sdk-panel__context-text" title="${ut((n=e.elementText)!=null?n:"")}">${ut(e.elementText||"(no text)")}</div>
1839
1839
  ${e.cssSelector?`<div class="ap-sdk-panel__context-selector" title="${ut(e.cssSelector)}">${ut(e.cssSelector)}</div>`:""}
1840
- `}function i_(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:",cl(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(`
1840
+ `}function c_(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:",ll(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(`
1841
1841
  Element tree:
1842
1842
  ${t.ctx.innerTree}`),r.push("",`Instruction:
1843
1843
  ${t.instruction}`),r.join(`
@@ -1845,10 +1845,10 @@ ${t.instruction}`),r.join(`
1845
1845
 
1846
1846
  ---
1847
1847
 
1848
- `)}function Jn(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 a_(e,t){e.style.display="block",e.className="ap-sdk-panel__status ap-sdk-panel__status--error",e.innerHTML=`
1848
+ `)}function Jn(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 l_(e,t){e.style.display="block",e.className="ap-sdk-panel__status ap-sdk-panel__status--error",e.innerHTML=`
1849
1849
  <p>Your session expired.</p>
1850
1850
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--primary" data-ap-reconnect type="button">Reconnect</button>
1851
- `;const n=e.querySelector("[data-ap-reconnect]");n.addEventListener("click",()=>z(null,null,function*(){n.disabled=!0,n.textContent="Connecting…";try{yield t()}catch(r){Jn(e,"error",r instanceof Error?r.message:"Could not reconnect — please try again.")}}))}function c_(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=`
1851
+ `;const n=e.querySelector("[data-ap-reconnect]");n.addEventListener("click",()=>z(null,null,function*(){n.disabled=!0,n.textContent="Connecting…";try{yield t()}catch(r){Jn(e,"error",r instanceof Error?r.message:"Could not reconnect — please try again.")}}))}function u_(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=`
1852
1852
  <div class="ap-sdk-success-card">
1853
1853
  <svg class="ap-sdk-success-check" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
1854
1854
  <circle class="ap-sdk-success-check__circle" cx="24" cy="24" r="22"/>
@@ -1864,7 +1864,7 @@ ${t.instruction}`),r.join(`
1864
1864
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--ghost" data-ap-success-close>Close</button>
1865
1865
  </div>
1866
1866
  </div>
1867
- `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Ps(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function ut(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ae=null;function xl(){return ae!==null}function zn(){ae&&en(ae),ae==null||ae.remove(),ae=null}function l_(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function u_(e){if(ae){zn();return}ae=document.createElement("div"),ae.className="ap-sdk-panel",ae.setAttribute("data-ap-sdk","1"),ae.setAttribute("role","dialog"),ae.setAttribute("aria-modal","true"),ae.setAttribute("aria-label","My captures"),ae.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ae.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ae.innerHTML=`
1867
+ `,e.querySelector("[data-ap-success-view]").addEventListener("click",()=>window.open(r,"_blank","noopener,noreferrer")),e.querySelector("[data-ap-success-close]").addEventListener("click",o)}function Ps(e,t){e.querySelectorAll("button, input, textarea, select").forEach(n=>{n.disabled=t})}function ut(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}let ae=null;function Sl(){return ae!==null}function zn(){ae&&en(ae),ae==null||ae.remove(),ae=null}function d_(e){return e==="task"?"Task":e==="planning"?"Planning":"Automate"}function p_(e){if(ae){zn();return}ae=document.createElement("div"),ae.className="ap-sdk-panel",ae.setAttribute("data-ap-sdk","1"),ae.setAttribute("role","dialog"),ae.setAttribute("aria-modal","true"),ae.setAttribute("aria-label","My captures"),ae.addEventListener("wheel",t=>{t.stopPropagation()},{passive:!0}),ae.addEventListener("touchmove",t=>{t.stopPropagation()},{passive:!0}),ae.innerHTML=`
1868
1868
  <div class="ap-sdk-panel__header">
1869
1869
  <span class="ap-sdk-panel__title">
1870
1870
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1877,18 +1877,18 @@ ${t.instruction}`),r.join(`
1877
1877
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-clear-history>Clear history</button>
1878
1878
  <button class="ap-sdk-panel__btn ap-sdk-panel__btn--secondary" data-ap-close-list>Close</button>
1879
1879
  </div>
1880
- `,document.body.appendChild(ae),Qt(ae),ni(ae,ti),ae.querySelector("[data-ap-close]").addEventListener("click",()=>{zn()}),ae.querySelector("[data-ap-close-list]").addEventListener("click",()=>{zn()}),ae.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{zk(),On(0),Ba(e)}),Ba(e)}function Ba(e){if(!ae)return;const t=ae.querySelector("[data-ap-list-body]"),n=hr();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=>`
1880
+ `,document.body.appendChild(ae),Qt(ae),ni(ae,ti),ae.querySelector("[data-ap-close]").addEventListener("click",()=>{zn()}),ae.querySelector("[data-ap-close-list]").addEventListener("click",()=>{zn()}),ae.querySelector("[data-ap-clear-history]").addEventListener("click",()=>{$k(),On(0),Ba(e)}),Ba(e)}function Ba(e){if(!ae)return;const t=ae.querySelector("[data-ap-list-body]"),n=hr();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=>`
1881
1881
  <div class="ap-sdk-list-item">
1882
1882
  <div class="ap-sdk-list-item__row">
1883
- <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${l_(r.type)}</span>
1884
- <span class="ap-sdk-list-item__title" title="${_o(r.title)}">${h_(r.title)}</span>
1883
+ <span class="ap-sdk-list-item__badge ap-sdk-list-item__badge--${r.type}">${d_(r.type)}</span>
1884
+ <span class="ap-sdk-list-item__title" title="${_o(r.title)}">${g_(r.title)}</span>
1885
1885
  </div>
1886
1886
  <div class="ap-sdk-list-item__row">
1887
1887
  <span class="ap-sdk-status-badge" data-ap-status="${_o(r.id)}">${e?"…":"—"}</span>
1888
- ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${_o(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${_o(p_(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1888
+ ${r.type==="automate"&&e?`<button class="ap-sdk-list-item__link" data-ap-resume="${_o(r.id)}">Resume →</button>`:`<a class="ap-sdk-list-item__link" href="${_o(f_(r))}" target="_blank" rel="noopener noreferrer">View →</a>`}
1889
1889
  </div>
1890
1890
  </div>
1891
- `).join(""),e){const r=e;Promise.all(n.map(o=>d_(o,r))).then(o=>{On(kl(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(zn(),pi(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function d_(e,t){return z(this,null,function*(){const n=yield bl(e,t),r=ae==null?void 0:ae.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 p_(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function _o(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function h_(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let bt=null,Jo=!1;function f_(){bt==null||bt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),bt&&bt.observe(document.body,{childList:!0}),Jo=!1}function Sl(){bt||(bt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Jo||(Jo=!0,queueMicrotask(f_))}),bt.observe(document.body,{childList:!0}))}function g_(){bt==null||bt.disconnect(),bt=null,Jo=!1}const m_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Re=null,gn=[];function Io(){Re&&en(Re),Re==null||Re.remove(),Re=null,gn=[]}function b_(e,t,n){Re&&Io(),gn=[...e],Re=document.createElement("div"),Re.className="ap-sdk-panel ap-sdk-record-review",Re.setAttribute("data-ap-sdk","1"),Re.setAttribute("role","dialog"),Re.setAttribute("aria-modal","true"),Re.setAttribute("aria-label","Review recorded steps"),Re.innerHTML=`
1891
+ `).join(""),e){const r=e;Promise.all(n.map(o=>h_(o,r))).then(o=>{On(_l(o))}),t.querySelectorAll("[data-ap-resume]").forEach(o=>{o.addEventListener("click",()=>{const i=o.dataset.apResume,a=n.find(d=>d.id===i);a&&(zn(),pi(a.id,r,a.backendUrl,a.title,()=>{}))})})}}function h_(e,t){return z(this,null,function*(){const n=yield kl(e,t),r=ae==null?void 0:ae.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 f_(e){const t=e.backendUrl.replace(/\/+$/,"");return e.type==="planning"?`${t}/planning/${e.id}`:`${t}/tasks/${e.id}`}function _o(e){return e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function g_(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}let bt=null,Jo=!1;function m_(){bt==null||bt.disconnect(),Array.from(document.body.querySelectorAll(':scope > [data-ap-sdk="1"]')).forEach(e=>document.body.appendChild(e)),bt&&bt.observe(document.body,{childList:!0}),Jo=!1}function Tl(){bt||(bt=new MutationObserver(e=>{!e.some(n=>Array.from(n.addedNodes).some(r=>r instanceof Element&&r.getAttribute("data-ap-sdk")!=="1"))||Jo||(Jo=!0,queueMicrotask(m_))}),bt.observe(document.body,{childList:!0}))}function b_(){bt==null||bt.disconnect(),bt=null,Jo=!1}const k_={click:"🖱",inputText:"⌨",scroll:"↕",keypress:"⌤"};let Re=null,gn=[];function Io(){Re&&en(Re),Re==null||Re.remove(),Re=null,gn=[]}function __(e,t,n){Re&&Io(),gn=[...e],Re=document.createElement("div"),Re.className="ap-sdk-panel ap-sdk-record-review",Re.setAttribute("data-ap-sdk","1"),Re.setAttribute("role","dialog"),Re.setAttribute("aria-modal","true"),Re.setAttribute("aria-label","Review recorded steps"),Re.innerHTML=`
1892
1892
  <div class="ap-sdk-panel__header">
1893
1893
  <span class="ap-sdk-panel__title">
1894
1894
  <span class="ap-sdk-panel__logo">AP</span>
@@ -1905,9 +1905,9 @@ ${t.instruction}`),r.join(`
1905
1905
  </div>
1906
1906
  `,document.body.appendChild(Re),Qt(Re);const r=Re.querySelector("[data-ap-review-list]"),o=Re.querySelector("[data-ap-review-continue]"),i=()=>{if(gn.length===0){r.innerHTML='<p class="ap-sdk-list-empty">No steps recorded.</p>',o.disabled=!0;return}o.disabled=!1,r.innerHTML=gn.map((d,l)=>{var p;return`
1907
1907
  <div class="ap-sdk-record-step" data-step-index="${l}">
1908
- <span class="ap-sdk-record-step__icon">${m_[d.action]}</span>
1909
- ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${k_((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${Tl(d.description)}</span>`}
1908
+ <span class="ap-sdk-record-step__icon">${k_[d.action]}</span>
1909
+ ${d.action==="inputText"&&!d.redacted?`<input class="ap-sdk-record-step__input" type="text" value="${v_((p=d.value)!=null?p:"")}" data-ap-step-value />`:`<span class="ap-sdk-record-step__description">${El(d.description)}</span>`}
1910
1910
  <button class="ap-sdk-record-step__remove" data-ap-step-remove="${l}" aria-label="Remove step ${l+1}">✕</button>
1911
1911
  </div>
1912
- `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const l=parseInt(d.dataset.apStepRemove,10);gn.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 g;const h=gn[p];h.value=d.value,h.description=al((g=h.elementText)!=null?g:"",d.value,!1)})})};i();const a=()=>{Io()};Re.querySelector("[data-ap-review-close]").addEventListener("click",a),Re.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(gn.length===0)return;const d=gn,l=D(y({},Va()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Io(),t(l)})}function Tl(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function k_(e){return Tl(e)}let q=null,Vo=null,Yo=null,Xo=null;function _i(e,t,n){Vo=e,Yo=t,Xo=n,gl(e,t,n)}const El="#agent-platform-web-sdk",Cl="ap-sdk-fab-unlocked";let Ln=null;function Al(){try{if(localStorage.getItem(Cl)==="1")return!0}catch(e){}return window.location.hash===El}function Ga(){try{localStorage.setItem(Cl,"1")}catch(e){}}function Pl(e){return z(this,null,function*(){var t,n,r,o;if(Fr(),!(q&&q.projectCode===e.projectCode&&q.backendUrl===((t=e.backendUrl)!=null?t:null)&&q.token===((n=e.token)!=null?n:null))){if(q={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1,permissions:null},_i(()=>Rl(),()=>v_(),()=>yi()),On(hr().length),q.backendUrl&&q.token){const i=q.backendUrl,a=q.token;yield Ol(),_l({backendUrl:i,token:a}).catch(()=>{}),$l({backendUrl:i,token:a}).catch(()=>{});const d=qm();d&&pi(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}Sl()}})}function vi(e,t){return z(this,null,function*(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");q.backendUrl=e,q.token=t,q.project=null,q.permissions=null,yield Ol(),$l({backendUrl:e,token:t}).catch(()=>{})})}function Rl(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");if(tr())return;Fr();const e=(t,n,r)=>{wl(t,n,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,o=>z(null,null,function*(){yield vi(o.backendUrl,o.token)}),o=>{ki(i=>{rs(i),os(i).then(()=>e(o.currentCtx,o.currentPickedEl,o)).catch(console.error)})},o=>{bs((i,a)=>{jr()&&o(i,a)},()=>{Ll()})},(o,i)=>{bs((a,d)=>{jr()&&o(a,d)},()=>{jr()&&i()})},()=>{tr()&&Ws()},q.permissions,r)};bs((t,n)=>z(null,null,function*(){xl()&&zn(),e(t,n)}),()=>{})}function __(){Ws()}function v_(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");if(Co())return;Fr();const e=(t,n)=>{wl(t,null,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,r=>z(null,null,function*(){yield vi(r.backendUrl,r.token)}),r=>{ki(o=>{rs(o),os(o).then(()=>e(r.currentCtx,r)).catch(console.error)})},void 0,void 0,()=>{},q.permissions,n)};Zk(t=>{b_(t,n=>e(n))})}function Ll(){jr()&&qr()}function y_(){return tr()}function zl(){g_(),Ln&&(window.removeEventListener("hashchange",Ln),Ln=null),Ws(),qk(),Io(),qr(),zn(),ml(),Vo=null,Yo=null,Xo=null,q=null}function Il(){if(typeof window=="undefined"||typeof document=="undefined")return;Fr();const e=n_(),t=()=>{e?os(e).catch(console.error):(_i(()=>Hr(),()=>Hr(),()=>yi()),On(hr().length),Sl())};if(Al()){Ga(),t();return}Ln=()=>{window.location.hash===El&&(Ga(),window.removeEventListener("hashchange",Ln),Ln=null,t())},window.addEventListener("hashchange",Ln)}function w_(){Vo&&Yo&&Xo&&gl(Vo,Yo,Xo)}function x_(){ml()}function Hr(){ki(e=>{rs(e),os(e).catch(console.error)})}function S_(){vl(),zl(),Fr(),Al()&&(_i(()=>Hr(),()=>Hr(),()=>yi()),On(hr().length))}function os(e){return z(this,null,function*(){yield Pl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function yi(){if(xl()){zn();return}jr()&&qr();const e=q!=null&&q.backendUrl&&(q!=null&&q.token)?{backendUrl:q.backendUrl,token:q.token}:null;u_(e)}function $l(e){return z(this,null,function*(){const t=yield Cm(e);q&&(q.permissions=t.permissions)})}function Ol(){return z(this,null,function*(){if(!(!q||!q.backendUrl||!q.token||q.project||q.resolvingProject)){q.resolvingProject=!0;try{q.project=yield wm({backendUrl:q.backendUrl,token:q.token},q.projectCode)}catch(e){}finally{q&&(q.resolvingProject=!1)}}})}Il();exports.activateElementPicker=Rl;exports.autoInit=Il;exports.clearConfig=S_;exports.closePanelIfOpen=Ll;exports.configure=Hr;exports.deactivateElementPicker=__;exports.destroy=zl;exports.hideFab=x_;exports.init=Pl;exports.isPickerRunning=y_;exports.showFab=w_;exports.updateCredentials=vi;
1912
+ `}).join(""),r.querySelectorAll("[data-ap-step-remove]").forEach(d=>{d.addEventListener("click",()=>{const l=parseInt(d.dataset.apStepRemove,10);gn.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 g;const h=gn[p];h.value=d.value,h.description=cl((g=h.elementText)!=null?g:"",d.value,!1)})})};i();const a=()=>{Io()};Re.querySelector("[data-ap-review-close]").addEventListener("click",a),Re.querySelector("[data-ap-review-cancel]").addEventListener("click",a),o.addEventListener("click",()=>{if(gn.length===0)return;const d=gn,l=D(y({},Va()),{pageUrl:window.location.href,pageTitle:document.title,interactionSteps:d});Io(),t(l)})}function El(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v_(e){return El(e)}let q=null,Vo=null,Yo=null,Xo=null;function _i(e,t,n){Vo=e,Yo=t,Xo=n,ml(e,t,n)}const Cl="#agent-platform-web-sdk",Al="ap-sdk-fab-unlocked";let Ln=null;function Pl(){try{if(localStorage.getItem(Al)==="1")return!0}catch(e){}return window.location.hash===Cl}function Ga(){try{localStorage.setItem(Al,"1")}catch(e){}}function Rl(e){return z(this,null,function*(){var t,n,r,o;if(Fr(),e.requestTimeoutMs!=null&&xm(e.requestTimeoutMs),!(q&&q.projectCode===e.projectCode&&q.backendUrl===((t=e.backendUrl)!=null?t:null)&&q.token===((n=e.token)!=null?n:null))){if(q={projectCode:e.projectCode,backendUrl:(r=e.backendUrl)!=null?r:null,token:(o=e.token)!=null?o:null,project:null,resolvingProject:!1,permissions:null},_i(()=>Ll(),()=>w_(),()=>yi()),On(hr().length),q.backendUrl&&q.token){const i=q.backendUrl,a=q.token;yield Nl(),vl({backendUrl:i,token:a}).catch(()=>{}),Ol({backendUrl:i,token:a}).catch(()=>{});const d=Fm();d&&pi(d.taskId,{backendUrl:i,token:a},d.backendUrl,d.title,()=>{})}Tl()}})}function vi(e,t){return z(this,null,function*(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");q.backendUrl=e,q.token=t,q.project=null,q.permissions=null,yield Nl(),Ol({backendUrl:e,token:t}).catch(()=>{})})}function Ll(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");if(tr())return;Fr();const e=(t,n,r)=>{xl(t,n,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,o=>z(null,null,function*(){yield vi(o.backendUrl,o.token)}),o=>{ki(i=>{rs(i),os(i).then(()=>e(o.currentCtx,o.currentPickedEl,o)).catch(console.error)})},o=>{bs((i,a)=>{jr()&&o(i,a)},()=>{zl()})},(o,i)=>{bs((a,d)=>{jr()&&o(a,d)},()=>{jr()&&i()})},()=>{tr()&&Ws()},q.permissions,r)};bs((t,n)=>z(null,null,function*(){Sl()&&zn(),e(t,n)}),()=>{})}function y_(){Ws()}function w_(){if(!q)throw new Error("AgentPlatformSDK: call init() first.");if(Co())return;Fr();const e=(t,n)=>{xl(t,null,{backendUrl:q.backendUrl,token:q.token},q.project,q.projectCode,r=>z(null,null,function*(){yield vi(r.backendUrl,r.token)}),r=>{ki(o=>{rs(o),os(o).then(()=>e(r.currentCtx,r)).catch(console.error)})},void 0,void 0,()=>{},q.permissions,n)};Hk(t=>{__(t,n=>e(n))})}function zl(){jr()&&qr()}function x_(){return tr()}function Il(){b_(),Ln&&(window.removeEventListener("hashchange",Ln),Ln=null),Ws(),Fk(),Io(),qr(),zn(),bl(),Vo=null,Yo=null,Xo=null,q=null}function $l(){if(typeof window=="undefined"||typeof document=="undefined")return;Fr();const e=o_(),t=()=>{e?os(e).catch(console.error):(_i(()=>Hr(),()=>Hr(),()=>yi()),On(hr().length),Tl())};if(Pl()){Ga(),t();return}Ln=()=>{window.location.hash===Cl&&(Ga(),window.removeEventListener("hashchange",Ln),Ln=null,t())},window.addEventListener("hashchange",Ln)}function S_(){Vo&&Yo&&Xo&&ml(Vo,Yo,Xo)}function T_(){bl()}function Hr(){ki(e=>{rs(e),os(e).catch(console.error)})}function E_(){yl(),Il(),Fr(),Pl()&&(_i(()=>Hr(),()=>Hr(),()=>yi()),On(hr().length))}function os(e){return z(this,null,function*(){yield Rl({projectCode:e.projectCode,backendUrl:e.backendUrl,token:e.token})})}function yi(){if(Sl()){zn();return}jr()&&qr();const e=q!=null&&q.backendUrl&&(q!=null&&q.token)?{backendUrl:q.backendUrl,token:q.token}:null;p_(e)}function Ol(e){return z(this,null,function*(){const t=yield Pm(e);q&&(q.permissions=t.permissions)})}function Nl(){return z(this,null,function*(){if(!(!q||!q.backendUrl||!q.token||q.project||q.resolvingProject)){q.resolvingProject=!0;try{q.project=yield Sm({backendUrl:q.backendUrl,token:q.token},q.projectCode)}catch(e){}finally{q&&(q.resolvingProject=!1)}}})}$l();exports.activateElementPicker=Ll;exports.autoInit=$l;exports.clearConfig=E_;exports.closePanelIfOpen=zl;exports.configure=Hr;exports.deactivateElementPicker=y_;exports.destroy=Il;exports.hideFab=T_;exports.init=Rl;exports.isPickerRunning=x_;exports.showFab=S_;exports.updateCredentials=vi;
1913
1913
  //# sourceMappingURL=web-sdk.cjs.map