sliccy 6.36.1 → 6.36.3

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.
Files changed (80) hide show
  1. package/README.md +1 -1
  2. package/dist/ui/assets/{account-store-BPoIjUWo.js → account-store-BsVUIQOw.js} +1 -1
  3. package/dist/ui/assets/account-store-znf4YsvT.js +100 -0
  4. package/dist/ui/assets/{adobe-ZwTQuXVn.js → adobe-B-G0qK0D.js} +1 -1
  5. package/dist/ui/assets/{adobe-BtvDXbO6.js → adobe-C21ldvGI.js} +1 -1
  6. package/dist/ui/assets/{apply-layout-DGuagG3O.js → apply-layout-9S_GJcaw.js} +1 -1
  7. package/dist/ui/assets/{apps-CPJor-vd.js → apps-C03dqYxn.js} +1 -1
  8. package/dist/ui/assets/{azure-openai-BGiYVM8_.js → azure-openai-BHxfmX0d.js} +1 -1
  9. package/dist/ui/assets/{azure-openai-D5LFX6rN.js → azure-openai-CkDIJBaD.js} +1 -1
  10. package/dist/ui/assets/{cerebras-C-KJ55Nf.js → cerebras-BtZzbqJB.js} +1 -1
  11. package/dist/ui/assets/{cerebras-DSr-Gksx.js → cerebras-D3uj_bkn.js} +1 -1
  12. package/dist/ui/assets/{connect-surface-D8-FTGyl.js → connect-surface-Dw3yRn88.js} +1 -1
  13. package/dist/ui/assets/fs-BL6AR1Xh.js +1 -0
  14. package/dist/ui/assets/fs-D2eomhrw.js +2 -0
  15. package/dist/ui/assets/{github-BS1Aazzh.js → github-CU77WW-Y.js} +1 -1
  16. package/dist/ui/assets/{github-IzhkSfso.js → github-DnwlZ3qp.js} +2 -2
  17. package/dist/ui/assets/{github-copilot-Dzy7mFgc.js → github-copilot-DN6dgk1N.js} +1 -1
  18. package/dist/ui/assets/{github-copilot-D_zbjEyk.js → github-copilot-MP4j0XRo.js} +1 -1
  19. package/dist/ui/assets/{github-install-a7Ejw59n.js → github-install-UQ7nbhli.js} +1 -1
  20. package/dist/ui/assets/{github-zip-Pqv3coha.js → github-zip-3JYoEHcr.js} +1 -1
  21. package/dist/ui/assets/{kernel-worker-Dl_JMcuL.js → kernel-worker-C0yN3bMa.js} +638 -638
  22. package/dist/ui/assets/{local-llm-CtEBOLAg.js → local-llm-BTP2-qR0.js} +1 -1
  23. package/dist/ui/assets/{local-llm-8Ak42724.js → local-llm-DLk1zNRk.js} +1 -1
  24. package/dist/ui/assets/{main-zEtUCHG6.js → main-D0aDW7dI.js} +3 -3
  25. package/dist/ui/assets/{mount-BVwUYXd6.js → mount-CA1nkJfM.js} +1 -1
  26. package/dist/ui/assets/{mount-Bp2qulzr.js → mount-CtYchR0b.js} +2 -2
  27. package/dist/ui/assets/{mount-recovery-I-Tp2nyU.js → mount-recovery-D0Uw7POK.js} +1 -1
  28. package/dist/ui/assets/{new-session-C5PhXtrQ.js → new-session-CF2gPWC1.js} +2 -2
  29. package/dist/ui/assets/{oauth-bootstrap-Uik9ds4c.js → oauth-bootstrap-Bu8AuX2j.js} +2 -2
  30. package/dist/ui/assets/{openai-codex-E2HYe5Du.js → openai-codex-DK2b7zSA.js} +1 -1
  31. package/dist/ui/assets/{openai-codex-BLK0e6a5.js → openai-codex-tmbd2RnD.js} +1 -1
  32. package/dist/ui/assets/{openrouter-BLFB4MGf.js → openrouter-BrdbtNgO.js} +1 -1
  33. package/dist/ui/assets/{openrouter-DB8He763.js → openrouter-DX7kKVL-.js} +1 -1
  34. package/dist/ui/assets/{openrouter-oauth-ClN0i4tH.js → openrouter-oauth-Br4WDhoE.js} +1 -1
  35. package/dist/ui/assets/{openrouter-oauth-Cpm2u_dg.js → openrouter-oauth-CVQ824Zt.js} +1 -1
  36. package/dist/ui/assets/{panel-rpc-handlers-lnZb60Rt.js → panel-rpc-handlers-Bfxkxx5J.js} +2 -2
  37. package/dist/ui/assets/{provider-BdmwWmQS.js → provider-B6O7d_Jy.js} +1 -1
  38. package/dist/ui/assets/{provider-settings-DVpmC_lZ.js → provider-settings-CcFYbum_.js} +1 -1
  39. package/dist/ui/assets/provider-settings-P2_KioxZ.js +2 -0
  40. package/dist/ui/assets/provider-store-access-D41AM1Rp.js +1 -0
  41. package/dist/ui/assets/{provider-store-access-Dx9H58mW.js → provider-store-access-Db_6xiNy.js} +2 -2
  42. package/dist/ui/assets/{provider-96kWJcTE.js → provider-wDZa8qds.js} +2 -2
  43. package/dist/ui/assets/{providers-CT6VoJvM.js → providers-DVUoGVmy.js} +2 -2
  44. package/dist/ui/assets/{providers-BSimKR2P.js → providers-Du510s9j.js} +1 -1
  45. package/dist/ui/assets/{quick-llm-CXCFdmgt.js → quick-llm-C7YPhjOB.js} +1 -1
  46. package/dist/ui/assets/{redirect-uri-CgOU4Ebo.js → redirect-uri-ykFWOm9h.js} +1 -1
  47. package/dist/ui/assets/{session-freezer-B4pYST_y.js → session-freezer-DIxzI168.js} +2 -2
  48. package/dist/ui/assets/{setup-feature-flags-remote-VVQ8bEov.js → setup-feature-flags-remote-CzyJ2QV8.js} +1 -1
  49. package/dist/ui/assets/{setup-standalone-prelude-DRgrME0b.js → setup-standalone-prelude-Dwyo3CdN.js} +1 -1
  50. package/dist/ui/assets/{setup-sudo-CZRygbDQ.js → setup-sudo-DqvCWEmC.js} +2 -2
  51. package/dist/ui/assets/sidecar-repair-B31h6Aw0.js +1 -0
  52. package/dist/ui/assets/sidecar-repair-DVW7uarV.js +1 -0
  53. package/dist/ui/assets/{skills-eMqRe5We.js → skills-DA03as_d.js} +1 -1
  54. package/dist/ui/assets/sprinkle-manager-Va9wmmlp.js +1 -0
  55. package/dist/ui/assets/{store-dcEskkmo.js → store-BH3_kdH5.js} +1 -1
  56. package/dist/ui/assets/{store-B4o4IOcc.js → store-DCvtFteN.js} +1 -1
  57. package/dist/ui/assets/{sudo-J6-rjwW5.js → sudo-C9QF4TW_.js} +1 -1
  58. package/dist/ui/assets/{upgrade-detection-xtcHFxq3.js → upgrade-detection-yIuO5HDA.js} +1 -1
  59. package/dist/ui/assets/{wc-extension-Bw-rEIKw.js → wc-extension-CjGB-jnJ.js} +2 -2
  60. package/dist/ui/assets/{wc-follower-CwDoDCi7.js → wc-follower-BFEAsew5.js} +3 -3
  61. package/dist/ui/assets/wc-live-BFfQvxM_.js +8 -0
  62. package/dist/ui/assets/{wc-nav-BQELNrHM.js → wc-nav-atG_2DGf.js} +2 -2
  63. package/dist/ui/assets/{wc-onboarding-CwdXLjWp.js → wc-onboarding-Ce9e26Is.js} +2 -2
  64. package/dist/ui/assets/{wc-placeholder-D7xn01go.js → wc-placeholder-DX9y0YpM.js} +2 -2
  65. package/dist/ui/assets/{wc-settings-LzT6fb5Y.js → wc-settings-BtebouCv.js} +2 -2
  66. package/dist/ui/assets/{wc-shell-Ro18u__K.js → wc-shell-C5G_Z_Nm.js} +2 -2
  67. package/dist/ui/assets/{wc-sprinkles-h8RIkuWf.js → wc-sprinkles-CBs-7e08.js} +2 -2
  68. package/dist/ui/assets/{wc-tray-Dno9DhYq.js → wc-tray-DfbZkyXQ.js} +2 -2
  69. package/dist/ui/assets/{xai-grok-BayGNhyx.js → xai-grok-CsTPz3zx.js} +1 -1
  70. package/dist/ui/assets/{xai-grok-BE85ER4a.js → xai-grok-D-n7QM3r.js} +1 -1
  71. package/dist/ui/index.html +7 -7
  72. package/dist/ui/packages/webapp/index.html +7 -7
  73. package/package.json +1 -1
  74. package/dist/ui/assets/account-store-BwdL0okL.js +0 -100
  75. package/dist/ui/assets/fs-CNclmIFL.js +0 -2
  76. package/dist/ui/assets/fs-qY4ZuRre.js +0 -1
  77. package/dist/ui/assets/provider-settings-BqBgwiF6.js +0 -2
  78. package/dist/ui/assets/provider-store-access-LRrCmTJU.js +0 -1
  79. package/dist/ui/assets/sprinkle-manager-7WNxOLFK.js +0 -1
  80. package/dist/ui/assets/wc-live-srTKyrkd.js +0 -8
package/README.md CHANGED
@@ -11,7 +11,7 @@ If this scares, confuses, or excites you, keep reading.
11
11
 
12
12
  # slicc — Self-Licking Ice Cream Cone
13
13
 
14
- [![39% Vibe_Coded](https://img.shields.io/badge/39%25-Vibe_Coded-ff69b4?style=for-the-badge&logo=claude&logoColor=white)](https://github.com/ai-ecoverse/vibe-coded-badge-action)
14
+ [![40% Vibe_Coded](https://img.shields.io/badge/40%25-Vibe_Coded-ff69b4?style=for-the-badge&logo=claude&logoColor=white)](https://github.com/ai-ecoverse/vibe-coded-badge-action)
15
15
 
16
16
  [![npm](https://img.shields.io/npm/v/sliccy)](https://www.npmjs.com/package/sliccy)
17
17
 
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/oauth-service-Dmnx-pbE.js","assets/preload-helper-Czpn1I53.js","assets/proxied-fetch-ULPrH97b.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/base64-DpPqYZJF.js","assets/src-CAWTvdAa.js","assets/runtime-env-DH4NDw4t.js","assets/fetch-body-D2PwksUW.js","assets/panel-rpc-B3MSVImO.js","assets/permissions-surface-registry-CilCRwhh.js"])))=>i.map(i=>d[i]);
2
- import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{i as r,n as i,r as a}from"./compat-Bn8HnC3L.js";import"./context-compaction-DDaM9TWa.js";import{t as o}from"./logger-DDBAeTLF.js";import"./src-CAWTvdAa.js";import{o as s,t as c}from"./proxied-fetch-ULPrH97b.js";import{t as l}from"./secret-topology-DCQNOMWj.js";import{t as u}from"./secrets-bridge-client-BZMh3a0J.js";import"./tool-ui-DfXu6quJ.js";import"./tool-result-images-D8kQ0hH0.js";import{n as d,o as f,t as p}from"./providers-CT6VoJvM.js";import{n as m,t as h}from"./panel-rpc-B3MSVImO.js";import{c as g,r as _,t as v}from"./bedrock-camp-BDCjQMZx.js";var y={assign:0,create:0,clone:0,discard:0,update:0};function b(e){return Array.isArray(e)}function x(e){return C(e,null)}function S(e){return C(typeof e,`object`)&&!x(e)}function C(e,t){return e===t}function ee(e){if(!S(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!x(t)&&C(typeof t.constructor,`function`)&&!(C(t.constructor,globalThis.Object)||C(t.constructor.name,`Object`))}function te(e){return C(e,`__proto__`)||C(e,`constructor`)||C(e,`prototype`)}function ne(e,t){return te(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function re(e){return Object.getOwnPropertyNames(e)}function ie(e){return Object.getOwnPropertySymbols(e)}function ae(e){return globalThis.ArrayBuffer.isView(e)}function w(e){return e instanceof globalThis.RegExp}function oe(e){return e instanceof globalThis.Set}function se(e){return e instanceof globalThis.Map}function ce(e){return e}function le(e){return ne(e,`~kind`)||ne(e,`~unsafe`)}function ue(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(te(e))continue;let r=n[e];ne(r,`value`)&&Object.defineProperty(t,e,{...r,value:T(r.value)})}return t}function de(e){let t={};for(let n of re(e))te(n)||(t[n]=T(e[n]));for(let n of ie(e))t[n]=T(e[n]);return t}function fe(e){return ee(e)?ce(e):le(e)?ue(e):de(e)}function pe(e){return e.map(e=>T(e))}function me(e){return e.slice()}function he(e){return new RegExp(e.source,e.flags)}function ge(e){return new Map(T([...e.entries()]))}function _e(e){return new Set(T([...e.values()]))}function T(e){return ae(e)?me(e):w(e)?he(e):se(e)?ge(e):oe(e)?_e(e):b(e)?pe(e):S(e)?fe(e):e}function ve(e){return y.clone+=1,T(e)}var ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function be(){return ye}function xe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Se(e,t){return{...e,...t}}function Ce(e,t,n={}){y.create+=1;let r=be(),i=Se(t,n),a=r.enumerableKind?Se(i,e):xe(i,e);return r.immutableTypes?Object.freeze(a):a}function we(e,t,n){y.update+=1;let r=be(),i=ve(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function Te(e){return S(e)}function Ee(e){return we(e,{"~optional":!0},{})}function De(e,t){return we(Ee(e),{},t)}function Oe(e,t){return Ce({"~kind":`Array`},{type:`array`,items:e},t)}function ke(e,t={}){return De(e,t)}function Ae(e){return ke(e)}function je(e){return Te(e)&&ne(e,`~optional`)}function Me(e){return re(e).filter(t=>!je(e[t]))}function Ne(e,t={}){let n=Me(e);return Ce({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Pe;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Pe||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var Fe=new Float64Array(1);new DataView(Fe.buffer),new Uint8Array(Fe.buffer),new TextEncoder;var Ie=`-?(?:0|[1-9][0-9]*)`,Le=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function Re(e){return Ce({"~kind":`Number`},{type:`number`},e)}function E(e){return Ce({"~kind":`String`},{type:`string`},e)}var ze=`^${Ie}$`;`${Le}`;function Be(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ve=[...Be(97,122),...Be(65,90)],He=[`0`,...Be(49,57)];[...He],[...Ve,...He],[...He],new RegExp(ze);var Ue=Symbol.for(`yaml.alias`),We=Symbol.for(`yaml.document`),D=Symbol.for(`yaml.map`),Ge=Symbol.for(`yaml.pair`),Ke=Symbol.for(`yaml.scalar`),qe=Symbol.for(`yaml.seq`),O=Symbol.for(`yaml.node.type`),Je=e=>!!e&&typeof e==`object`&&e[O]===Ue,Ye=e=>!!e&&typeof e==`object`&&e[O]===We,Xe=e=>!!e&&typeof e==`object`&&e[O]===D,k=e=>!!e&&typeof e==`object`&&e[O]===Ge,A=e=>!!e&&typeof e==`object`&&e[O]===Ke,Ze=e=>!!e&&typeof e==`object`&&e[O]===qe;function j(e){if(e&&typeof e==`object`)switch(e[O]){case D:case qe:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[O]){case Ue:case D:case Ke:case qe:return!0}return!1}var Qe=e=>(A(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),$e=Symbol(`skip children`),et=Symbol(`remove node`);function tt(e,t){let n=rt(t);Ye(e)?nt(null,e.contents,n,Object.freeze([e]))===et&&(e.contents=null):nt(null,e,n,Object.freeze([]))}tt.BREAK=N,tt.SKIP=$e,tt.REMOVE=et;function nt(e,t,n,r){let i=it(e,t,n,r);if(M(i)||k(i))return at(e,r,i),nt(e,i,n,r);if(typeof i!=`symbol`){if(j(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=nt(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===et&&(t.items.splice(e,1),--e)}}else if(k(t)){r=Object.freeze(r.concat(t));let e=nt(`key`,t.key,n,r);if(e===N)return N;e===et&&(t.key=null);let i=nt(`value`,t.value,n,r);if(i===N)return N;i===et&&(t.value=null)}}return i}function rt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function it(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Xe(t))return n.Map?.(e,t,r);if(Ze(t))return n.Seq?.(e,t,r);if(k(t))return n.Pair?.(e,t,r);if(A(t))return n.Scalar?.(e,t,r);if(Je(t))return n.Alias?.(e,t,r)}function at(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(k(r))e===`key`?r.key=n:r.value=n;else if(Ye(r))r.contents=n;else{let e=Je(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function ot(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function st(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=st(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=st(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=st(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=st(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function P(e,t,n){if(Array.isArray(e))return e.map((e,t)=>P(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Qe(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ct=class{constructor(e){Object.defineProperty(this,O,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Ye(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=P(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?st(i,{"":o},``,o):o}},lt=class extends ct{constructor(e){super(Ue),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],tt(e,{Node:(e,t)=>{(Je(t)||Qe(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(P(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ut(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ot(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ut(e,t,n){if(Je(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(j(t)){let r=0;for(let i of t.items){let t=ut(e,i,n);t>r&&(r=t)}return r}if(k(t)){let r=ut(e,t.key,n),i=ut(e,t.value,n);return Math.max(r,i)}return 1}var dt=e=>!e||typeof e!=`function`&&typeof e!=`object`,F=class extends ct{constructor(e){super(Ke),this.value=e}toJSON(e,t){return t?.keep?this.value:P(this.value,e,t)}toString(){return String(this.value)}};F.BLOCK_FOLDED=`BLOCK_FOLDED`,F.BLOCK_LITERAL=`BLOCK_LITERAL`,F.PLAIN=`PLAIN`,F.QUOTE_DOUBLE=`QUOTE_DOUBLE`,F.QUOTE_SINGLE=`QUOTE_SINGLE`;var ft=`tag:yaml.org,2002:`;function pt(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function mt(e,t,n){if(Ye(e)&&(e=e.contents),M(e))return e;if(k(e)){let t=n.schema[D].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new lt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ft+t.slice(2));let l=pt(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new F(e);return c&&(c.node=t),t}l=e instanceof Map?o[D]:Symbol.iterator in Object(e)?o[qe]:o[D]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new F(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ht(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return mt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var gt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,_t=class extends ct{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>M(t)||k(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(gt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(j(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(j(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&A(i)?i.value:i:j(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!k(t))return!1;let n=t.value;return n==null||e&&A(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return j(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(j(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},vt=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function yt(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var I=(e,t,n)=>e.endsWith(`
2
+ import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./preload-helper-Czpn1I53.js";import{i as r,n as i,r as a}from"./compat-Bn8HnC3L.js";import"./context-compaction-DDaM9TWa.js";import{t as o}from"./logger-DDBAeTLF.js";import"./src-CAWTvdAa.js";import{o as s,t as c}from"./proxied-fetch-ULPrH97b.js";import{t as l}from"./secret-topology-DCQNOMWj.js";import{t as u}from"./secrets-bridge-client-BZMh3a0J.js";import"./tool-ui-DfXu6quJ.js";import"./tool-result-images-D8kQ0hH0.js";import{n as d,o as f,t as p}from"./providers-DVUoGVmy.js";import{n as m,t as h}from"./panel-rpc-B3MSVImO.js";import{c as g,r as _,t as v}from"./bedrock-camp-BDCjQMZx.js";var y={assign:0,create:0,clone:0,discard:0,update:0};function b(e){return Array.isArray(e)}function x(e){return C(e,null)}function S(e){return C(typeof e,`object`)&&!x(e)}function C(e,t){return e===t}function ee(e){if(!S(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!x(t)&&C(typeof t.constructor,`function`)&&!(C(t.constructor,globalThis.Object)||C(t.constructor.name,`Object`))}function te(e){return C(e,`__proto__`)||C(e,`constructor`)||C(e,`prototype`)}function ne(e,t){return te(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function re(e){return Object.getOwnPropertyNames(e)}function ie(e){return Object.getOwnPropertySymbols(e)}function ae(e){return globalThis.ArrayBuffer.isView(e)}function w(e){return e instanceof globalThis.RegExp}function oe(e){return e instanceof globalThis.Set}function se(e){return e instanceof globalThis.Map}function ce(e){return e}function le(e){return ne(e,`~kind`)||ne(e,`~unsafe`)}function ue(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(te(e))continue;let r=n[e];ne(r,`value`)&&Object.defineProperty(t,e,{...r,value:T(r.value)})}return t}function de(e){let t={};for(let n of re(e))te(n)||(t[n]=T(e[n]));for(let n of ie(e))t[n]=T(e[n]);return t}function fe(e){return ee(e)?ce(e):le(e)?ue(e):de(e)}function pe(e){return e.map(e=>T(e))}function me(e){return e.slice()}function he(e){return new RegExp(e.source,e.flags)}function ge(e){return new Map(T([...e.entries()]))}function _e(e){return new Set(T([...e.values()]))}function T(e){return ae(e)?me(e):w(e)?he(e):se(e)?ge(e):oe(e)?_e(e):b(e)?pe(e):S(e)?fe(e):e}function ve(e){return y.clone+=1,T(e)}var ye={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function be(){return ye}function xe(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Se(e,t){return{...e,...t}}function Ce(e,t,n={}){y.create+=1;let r=be(),i=Se(t,n),a=r.enumerableKind?Se(i,e):xe(i,e);return r.immutableTypes?Object.freeze(a):a}function we(e,t,n){y.update+=1;let r=be(),i=ve(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function Te(e){return S(e)}function Ee(e){return we(e,{"~optional":!0},{})}function De(e,t){return we(Ee(e),{},t)}function Oe(e,t){return Ce({"~kind":`Array`},{type:`array`,items:e},t)}function ke(e,t={}){return De(e,t)}function Ae(e){return ke(e)}function je(e){return Te(e)&&ne(e,`~optional`)}function Me(e){return re(e).filter(t=>!je(e[t]))}function Ne(e,t={}){let n=Me(e);return Ce({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}var Pe;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(Pe||={}),Array.from({length:256}).map((e,t)=>BigInt(t));var Fe=new Float64Array(1);new DataView(Fe.buffer),new Uint8Array(Fe.buffer),new TextEncoder;var Ie=`-?(?:0|[1-9][0-9]*)`,Le=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function Re(e){return Ce({"~kind":`Number`},{type:`number`},e)}function E(e){return Ce({"~kind":`String`},{type:`string`},e)}var ze=`^${Ie}$`;`${Le}`;function Be(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}var Ve=[...Be(97,122),...Be(65,90)],He=[`0`,...Be(49,57)];[...He],[...Ve,...He],[...He],new RegExp(ze);var Ue=Symbol.for(`yaml.alias`),We=Symbol.for(`yaml.document`),D=Symbol.for(`yaml.map`),Ge=Symbol.for(`yaml.pair`),Ke=Symbol.for(`yaml.scalar`),qe=Symbol.for(`yaml.seq`),O=Symbol.for(`yaml.node.type`),Je=e=>!!e&&typeof e==`object`&&e[O]===Ue,Ye=e=>!!e&&typeof e==`object`&&e[O]===We,Xe=e=>!!e&&typeof e==`object`&&e[O]===D,k=e=>!!e&&typeof e==`object`&&e[O]===Ge,A=e=>!!e&&typeof e==`object`&&e[O]===Ke,Ze=e=>!!e&&typeof e==`object`&&e[O]===qe;function j(e){if(e&&typeof e==`object`)switch(e[O]){case D:case qe:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[O]){case Ue:case D:case Ke:case qe:return!0}return!1}var Qe=e=>(A(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),$e=Symbol(`skip children`),et=Symbol(`remove node`);function tt(e,t){let n=rt(t);Ye(e)?nt(null,e.contents,n,Object.freeze([e]))===et&&(e.contents=null):nt(null,e,n,Object.freeze([]))}tt.BREAK=N,tt.SKIP=$e,tt.REMOVE=et;function nt(e,t,n,r){let i=it(e,t,n,r);if(M(i)||k(i))return at(e,r,i),nt(e,i,n,r);if(typeof i!=`symbol`){if(j(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=nt(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===et&&(t.items.splice(e,1),--e)}}else if(k(t)){r=Object.freeze(r.concat(t));let e=nt(`key`,t.key,n,r);if(e===N)return N;e===et&&(t.key=null);let i=nt(`value`,t.value,n,r);if(i===N)return N;i===et&&(t.value=null)}}return i}function rt(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function it(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Xe(t))return n.Map?.(e,t,r);if(Ze(t))return n.Seq?.(e,t,r);if(k(t))return n.Pair?.(e,t,r);if(A(t))return n.Scalar?.(e,t,r);if(Je(t))return n.Alias?.(e,t,r)}function at(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(k(r))e===`key`?r.key=n:r.value=n;else if(Ye(r))r.contents=n;else{let e=Je(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function ot(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function st(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=st(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=st(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=st(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=st(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function P(e,t,n){if(Array.isArray(e))return e.map((e,t)=>P(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Qe(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var ct=class{constructor(e){Object.defineProperty(this,O,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Ye(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=P(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?st(i,{"":o},``,o):o}},lt=class extends ct{constructor(e){super(Ue),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],tt(e,{Node:(e,t)=>{(Je(t)||Qe(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(P(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=ut(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(ot(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function ut(e,t,n){if(Je(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(j(t)){let r=0;for(let i of t.items){let t=ut(e,i,n);t>r&&(r=t)}return r}if(k(t)){let r=ut(e,t.key,n),i=ut(e,t.value,n);return Math.max(r,i)}return 1}var dt=e=>!e||typeof e!=`function`&&typeof e!=`object`,F=class extends ct{constructor(e){super(Ke),this.value=e}toJSON(e,t){return t?.keep?this.value:P(this.value,e,t)}toString(){return String(this.value)}};F.BLOCK_FOLDED=`BLOCK_FOLDED`,F.BLOCK_LITERAL=`BLOCK_LITERAL`,F.PLAIN=`PLAIN`,F.QUOTE_DOUBLE=`QUOTE_DOUBLE`,F.QUOTE_SINGLE=`QUOTE_SINGLE`;var ft=`tag:yaml.org,2002:`;function pt(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function mt(e,t,n){if(Ye(e)&&(e=e.contents),M(e))return e;if(k(e)){let t=n.schema[D].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new lt(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=ft+t.slice(2));let l=pt(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new F(e);return c&&(c.node=t),t}l=e instanceof Map?o[D]:Symbol.iterator in Object(e)?o[qe]:o[D]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new F(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ht(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return mt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var gt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,_t=class extends ct{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>M(t)||k(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(gt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(j(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(j(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&A(i)?i.value:i:j(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!k(t))return!1;let n=t.value;return n==null||e&&A(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return j(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(j(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ht(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},vt=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function yt(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var I=(e,t,n)=>e.endsWith(`
3
3
  `)?yt(n,t):n.includes(`
4
4
  `)?`
5
5
  `+yt(n,t):(e.endsWith(` `)?``:` `)+n,bt=`flow`,xt=`block`,St=`quoted`;function Ct(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=wt(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
@@ -0,0 +1,100 @@
1
+ import{n as e,t}from"./rolldown-runtime-Dd_uD5pT.js";import{t as n}from"./logger-LESFN7Hj.js";import{n as r,r as i}from"./panel-rpc-BPwAqRch.js";import{n as a,o,t as s}from"./providers-Du510s9j.js";import"./src-CcFD5QfS.js";import{r as c,s as l,t as u}from"./proxied-fetch-BML_ivCH.js";import{t as d}from"./runtime-env-byAg9ij-.js";import{c as f,d as p,f as m,l as h,r as g,t as ee,u as _}from"./bedrock-camp-CFmElpzZ.js";import{t as te}from"./port-bridge-client-OGFANy96.js";import{i as ne,r as re}from"./tool-ui-t6ocn6AG.js";import{n as ie,r as ae,t as oe}from"./tool-result-images-Dw3zBAjg.js";const se=`slicc_oauth_extra_domains`;function ce(e){try{let t=e.getItem(se);if(!t)return{};let n=JSON.parse(t);if(typeof n!=`object`||!n||Array.isArray(n))return{};let r={};for(let[e,t]of Object.entries(n)){if(typeof e!=`string`||!Array.isArray(t))continue;let n=t.filter(e=>typeof e==`string`&&e.length>0);n.length>0&&(r[e]=n)}return r}catch{return{}}}function le(e,t){try{e.setItem(se,JSON.stringify(t))}catch(e){throw Error(`Failed to persist OAuth extras (localStorage quota exceeded?): ${e instanceof Error?e.message:String(e)}`)}}const ue={assign:0,create:0,clone:0,discard:0,update:0};function v(e,t){return ue.assign+=1,{...e,...t}}function y(e,t,n){return e>=t&&e<=n}function de(e){return e===8205}function fe(e){return y(e,55296,56319)}function pe(e){return y(e,127462,127487)}function me(e){return y(e,65024,65039)}function he(e){return y(e,768,879)||y(e,6832,6911)||y(e,7616,7679)||y(e,65056,65071)}function ge(e){return e>65535?2:1}function _e(e,t){for(;t<e.length;){let n=e.codePointAt(t);if(he(n)||me(n))t+=ge(n);else break}return t}function ve(e,t){let n=e.codePointAt(t),r=t+ge(n);for(r=_e(e,r);r<e.length-1&&e[r]===`‍`;){let t=e.codePointAt(r+1);r+=1+ge(t),r=_e(e,r)}return pe(n)&&r<e.length&&pe(e.codePointAt(r))&&(r+=ge(e.codePointAt(r))),r}function ye(e){return fe(e)||he(e)||me(e)||de(e)}function be(e){let t=0,n=0;for(;n<e.length;)n=ve(e,n),t++;return t}function xe(e,t){if(t===0)return!0;let n=0,r=0;for(;r<e.length;)if(r=ve(e,r),n++,n>=t)return!0;return!1}function Se(e,t){let n=0,r=0;for(;r<e.length;)if(r=ve(e,r),n++,n>t)return!1;return!0}function Ce(e,t){if(t===0)return!0;let n=0;for(;n<e.length;){if(ye(e.charCodeAt(n)))return xe(e,t);if(n++,n>=t)return!0}return!1}function we(e,t){let n=0;for(;n<e.length;){if(ye(e.charCodeAt(n)))return Se(e,t);if(n++,n>t)return!1}return!0}var Te=e({Entries:()=>Qe,EntriesRegExp:()=>Ze,Every:()=>Je,EveryAll:()=>Ye,GraphemeCount:()=>Ge,HasPropertyKey:()=>C,IsArray:()=>Ee,IsBigInt:()=>De,IsBoolean:()=>Oe,IsClassInstance:()=>Ue,IsConstructor:()=>ke,IsDeepEqual:()=>rt,IsEqual:()=>x,IsFunction:()=>Ae,IsGreaterEqualThan:()=>Ve,IsGreaterThan:()=>Re,IsInteger:()=>je,IsLessEqualThan:()=>Be,IsLessThan:()=>ze,IsMaxLength:()=>Ke,IsMinLength:()=>qe,IsMultipleOf:()=>He,IsNull:()=>Me,IsNumber:()=>Ne,IsObject:()=>b,IsObjectNotArray:()=>Pe,IsString:()=>Fe,IsSymbol:()=>Ie,IsUndefined:()=>Le,IsUnsafePropertyKey:()=>Xe,IsValueLike:()=>We,Keys:()=>w,ShiftLeft:()=>S,Symbols:()=>$e,Values:()=>et});function Ee(e){return Array.isArray(e)}function De(e){return x(typeof e,`bigint`)}function Oe(e){return x(typeof e,`boolean`)}function ke(e){if(Le(e)||!Ae(e))return!1;let t=Function.prototype.toString.call(e);return!!(/^class\s/.test(t)||/\[native code\]/.test(t))}function Ae(e){return x(typeof e,`function`)}function je(e){return Number.isInteger(e)}function Me(e){return x(e,null)}function Ne(e){return Number.isFinite(e)}function Pe(e){return b(e)&&!Ee(e)}function b(e){return x(typeof e,`object`)&&!Me(e)}function Fe(e){return x(typeof e,`string`)}function Ie(e){return x(typeof e,`symbol`)}function Le(e){return x(e,void 0)}function x(e,t){return e===t}function Re(e,t){return e>t}function ze(e,t){return e<t}function Be(e,t){return e<=t}function Ve(e,t){return e>=t}function He(e,t){if(De(e)||De(t))return BigInt(e)%BigInt(t)===0n;if(!Ne(e)||je(e)&&1/t%1==0)return!0;let n=e%t;return Math.min(Math.abs(n),Math.abs(n-t),Math.abs(n+t))<1e-10}function Ue(e){if(!b(e))return!1;let t=globalThis.Object.getPrototypeOf(e);return!Me(t)&&x(typeof t.constructor,`function`)&&!(x(t.constructor,globalThis.Object)||x(t.constructor.name,`Object`))}function We(e){return De(e)||Oe(e)||Me(e)||Ne(e)||Fe(e)||Le(e)}function Ge(e){return be(e)}function Ke(e,t){return we(e,t)}function qe(e,t){return Ce(e,t)}function Je(e,t,n){for(let r=t;r<e.length;r++)if(!n(e[r],r))return!1;return!0}function Ye(e,t,n){let r=!0;for(let i=t;i<e.length;i++)n(e[i],i)||(r=!1);return r}function S(e,t,n){return x(e.length,0)?n():t(e[0],e.slice(1))}function Xe(e){return x(e,`__proto__`)||x(e,`constructor`)||x(e,`prototype`)}function C(e,t){return Xe(t)?Object.prototype.hasOwnProperty.call(e,t):t in e}function Ze(e){return w(e).map(t=>[RegExp(`^${t}$`),e[t]])}function Qe(e){return Object.entries(e)}function w(e){return Object.getOwnPropertyNames(e)}function $e(e){return Object.getOwnPropertySymbols(e)}function et(e){return Object.values(e)}function tt(e,t){if(!b(t))return!1;let n=w(e);return x(n.length,w(t).length)&&n.every(n=>rt(e[n],t[n]))}function nt(e,t){return Ee(t)&&x(e.length,t.length)&&e.every((n,r)=>rt(e[r],t[r]))}function rt(e,t){return Ee(e)?nt(e,t):b(e)?tt(e,t):x(e,t)}function it(e){return e instanceof Boolean}function at(e){return e instanceof Number}function ot(e){return e instanceof String}function st(e){return globalThis.ArrayBuffer.isView(e)}function ct(e){return e instanceof globalThis.RegExp}function lt(e){return e instanceof globalThis.Date}function ut(e){return e instanceof globalThis.Set}function dt(e){return e instanceof globalThis.Map}function ft(e){return e}function pt(e){return C(e,`~kind`)||C(e,`~unsafe`)}function mt(e){let t={},n=Object.getOwnPropertyDescriptors(e);for(let e of Object.keys(n)){if(Xe(e))continue;let r=n[e];C(r,`value`)&&Object.defineProperty(t,e,{...r,value:St(r.value)})}return t}function ht(e){let t={};for(let n of w(e))Xe(n)||(t[n]=St(e[n]));for(let n of $e(e))t[n]=St(e[n]);return t}function gt(e){return Ue(e)?ft(e):pt(e)?mt(e):ht(e)}function _t(e){return e.map(e=>St(e))}function vt(e){return e.slice()}function yt(e){return new RegExp(e.source,e.flags)}function bt(e){return new Map(St([...e.entries()]))}function xt(e){return new Set(St([...e.values()]))}function St(e){return st(e)?vt(e):ct(e)?yt(e):dt(e)?bt(e):ut(e)?xt(e):Ee(e)?_t(e):b(e)?gt(e):e}function Ct(e){return ue.clone+=1,St(e)}const wt={immutableTypes:!1,maxErrors:8,useAcceleration:!0,exactOptionalPropertyTypes:!1,enumerableKind:!1,correctiveParse:!1,unionPrioritySort:!0};function Tt(){return wt}function Et(e,t){for(let n of Object.keys(t))Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:!1,value:t[n]});return e}function Dt(e,t){return{...e,...t}}function T(e,t,n={}){ue.create+=1;let r=Tt(),i=Dt(t,n),a=r.enumerableKind?Dt(i,e):Et(i,e);return r.immutableTypes?Object.freeze(a):a}function Ot(e,t){ue.discard+=1;let n={},r=Object.getOwnPropertyDescriptors(Ct(e)),i=new Set(t);for(let e of Object.keys(r))i.has(e)||Object.defineProperty(n,e,r[e]);return n}function E(e,t,n){ue.update+=1;let r=Tt(),i=Ct(e);for(let e of Object.keys(t))Object.defineProperty(i,e,{configurable:!0,writable:!0,enumerable:r.enumerableKind,value:t[e]});for(let e of Object.keys(n))Object.defineProperty(i,e,{configurable:!0,enumerable:!0,writable:!0,value:n[e]});return i}function D(e,t){return b(e)&&C(e,`~kind`)&&x(e[`~kind`],t)}function kt(e){return b(e)}function O(e,t,n){return T({"~kind":`Deferred`},{type:`deferred`,action:e,parameters:t,options:n},{})}function At(e){return D(e,`Deferred`)}function jt(e){return E(e,{"~readonly":!0},{})}function Mt(e,t){return E(jt(e),{},t)}function Nt(e,t,n,r){return Mt(q(e,t,n),r)}function Pt(e){return E(e,{"~optional":!0},{})}function Ft(e,t){return E(Pt(e),{},t)}function It(e,t,n,r){return Ft(q(e,t,n),r)}function Lt(e,t){return T({"~kind":`Array`},{type:`array`,items:e},t)}function Rt(e){return D(e,`Array`)}function zt(e){return Ot(e,[`~kind`,`type`,`items`])}function Bt(e,t,n={}){return T({"~kind":`Constructor`},{type:`constructor`,parameters:e,instanceType:t},n)}function Vt(e){return D(e,`Constructor`)}function Ht(e){return Ot(e,[`~kind`,`type`,`parameters`,`instanceType`])}function Ut(e,t,n={}){return T({"~kind":`Function`},{type:`function`,parameters:e,returnType:t},n)}function Wt(e){return D(e,`Function`)}function Gt(e){return Ot(e,[`~kind`,`type`,`parameters`,`returnType`])}function Kt(e,t){return T({"~kind":`Ref`},{$ref:e},t)}function qt(e){return D(e,`Ref`)}function Jt(e,t){return T({"~kind":`Generic`},{type:`generic`,parameters:e,expression:t})}function Yt(e){return D(e,`Generic`)}function Xt(e){return T({"~kind":`Any`},{},e)}function Zt(e){return D(e,`Any`)}function k(e){return T({"~kind":`Never`},{not:{}},e)}function Qt(e){return D(e,`Never`)}function $t(e,t={}){return Ft(e,t)}function en(e){return $t(e)}function tn(e){return kt(e)&&C(e,`~optional`)}function nn(e){return w(e).filter(t=>!tn(e[t]))}function rn(e){return w(e)}function an(e){return et(e)}function A(e,t={}){let n=nn(e);return T({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function j(e){return D(e,`Object`)}function on(e){return Ot(e,[`~kind`,`type`,`properties`,`required`])}function sn(e){return T({"~kind":`Unknown`},{},e)}function cn(e){return D(e,`Unknown`)}function ln(e,t,n){return T({"~kind":`Cyclic`},{$defs:w(e).reduce((t,n)=>({...t,[n]:E(e[n],{},{$id:n})}),{}),$ref:t},n)}function un(e){return D(e,`Cyclic`)}function dn(e){return Pe(e)&&C(e,`~unsafe`)&&Me(e[`~unsafe`])}function fn(e){return D(e,`Infer`)}function pn(e,t,n,r={}){return T({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function mn(e){return D(e,`Dependent`)}function hn(e){return Ot(e,[`~kind`,`if`,`then`,`else`])}function gn(e){return D(e,`Enum`)}function _n(e,t={}){return T({"~kind":`Intersect`},{allOf:e},t)}function M(e){return D(e,`Intersect`)}function vn(e){return Ot(e,[`~kind`,`allOf`])}function yn(){throw Error(`Unreachable`)}var bn=e({Hash:()=>qn,HashCode:()=>Kn});function xn(e){let t=new Set,n=e;for(;n&&n!==Object.prototype;){for(let e of Reflect.ownKeys(n))e!==`constructor`&&typeof e!=`symbol`&&t.add(e);n=Object.getPrototypeOf(n)}return[...t]}function Sn(e){return typeof e==`number`}var N;(function(e){e[e.Array=0]=`Array`,e[e.BigInt=1]=`BigInt`,e[e.Boolean=2]=`Boolean`,e[e.Date=3]=`Date`,e[e.Constructor=4]=`Constructor`,e[e.Function=5]=`Function`,e[e.Null=6]=`Null`,e[e.Number=7]=`Number`,e[e.Object=8]=`Object`,e[e.RegExp=9]=`RegExp`,e[e.String=10]=`String`,e[e.Symbol=11]=`Symbol`,e[e.TypeArray=12]=`TypeArray`,e[e.Undefined=13]=`Undefined`})(N||={});let Cn=BigInt(`14695981039346656037`);const[wn,Tn]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],En=Array.from({length:256}).map((e,t)=>BigInt(t)),Dn=new Float64Array(1),On=new DataView(Dn.buffer),kn=new Uint8Array(Dn.buffer);function P(e){Cn^=En[e],Cn=Cn*wn%Tn}function An(e){P(N.Array);for(let t of e)Gn(t)}function jn(e){P(N.BigInt),On.setBigInt64(0,e);for(let e of kn)P(e)}function Mn(e){P(N.Boolean),P(+!!e)}function Nn(e){P(N.Constructor),Gn(e.toString())}function Pn(e){P(N.Date),Gn(e.getTime())}function Fn(e){P(N.Function),Gn(e.toString())}function In(e){P(N.Null)}function Ln(e){P(N.Number),On.setFloat64(0,e,!0);for(let e of kn)P(e)}function Rn(e){P(N.Object);for(let t of xn(e).sort())Gn(t),Gn(e[t])}function zn(e){P(N.RegExp),Vn(e.toString())}const Bn=new TextEncoder;function Vn(e){P(N.String);for(let t of Bn.encode(e))P(t)}function Hn(e){P(N.Symbol),Gn(e.toString())}function Un(e){P(N.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)P(t[e])}function Wn(e){return P(N.Undefined)}function Gn(e){return st(e)?Un(e):lt(e)?Pn(e):ct(e)?zn(e):it(e)?Mn(e.valueOf()):ot(e)?Vn(e.valueOf()):at(e)?Ln(e.valueOf()):Sn(e)?Ln(e):Ee(e)?An(e):Oe(e)?Mn(e):De(e)?jn(e):ke(e)?Nn(e):Me(e)?In(e):b(e)?Rn(e):Fe(e)?Vn(e):Ie(e)?Hn(e):Le(e)?Wn(e):Ae(e)?Fn(e):yn()}function Kn(e){return Cn=BigInt(`14695981039346656037`),Gn(e),Cn}function qn(e){return Kn(e).toString(16).padStart(16,`0`)}function Jn(e){return kt(e)&&C(e,`~codec`)&&b(e[`~codec`])&&C(e[`~codec`],`encode`)&&C(e[`~codec`],`decode`)}function Yn(e){return kt(e)&&C(e,`~immutable`)}function Xn(e,t={}){return Mt(e,t)}function Zn(e){return kt(e)&&C(e,`~readonly`)}function Qn(e){return T({"~kind":`BigInt`},{type:`bigint`},e)}function $n(e){return D(e,`BigInt`)}function er(e){return D(e,`Boolean`)}const tr=`-?(?:0|[1-9][0-9]*)`;function nr(e){return T({"~kind":`Integer`},{type:`integer`},e)}function rr(e){return D(e,`Integer`)}var ir=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function ar(e){return De(e)?`bigint`:Oe(e)?`boolean`:Ne(e)?`number`:Fe(e)?`string`:(()=>{throw new ir(e)})()}function F(e,t){return T({"~kind":`Literal`},{type:ar(e),const:e},t)}function or(e){return De(e)||Oe(e)||Ne(e)||Fe(e)}function sr(e){return I(e)&&De(e.const)}function cr(e){return I(e)&&Oe(e.const)}function lr(e){return I(e)&&Ne(e.const)}function ur(e){return I(e)&&Fe(e.const)}function I(e){return D(e,`Literal`)}function dr(e){return T({"~kind":`Null`},{type:`null`},e)}function fr(e){return D(e,`Null`)}const pr=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function mr(e){return T({"~kind":`Number`},{type:`number`},e)}function hr(e){return D(e,`Number`)}function gr(e){return T({"~kind":`Symbol`},{type:`symbol`},e)}function _r(e){return D(e,`Symbol`)}function vr(e){return T({"~kind":`String`},{type:`string`},e)}function yr(e){return D(e,`String`)}function L(e,t={}){return T({"~kind":`Union`},{anyOf:e},t)}function R(e){return D(e,`Union`)}function br(e){return Ot(e,[`~kind`,`anyOf`])}function xr(e){let t=Wa(e);return x(t.length,2)?t[0]:[]}function Sr(e){return!0}function Cr(e){return S(e,(e,t)=>Tr(e)?Cr(t):!1,()=>!0)}function wr(e){return!x(e.length,0)&&Cr(e)}function Tr(e){return R(e)?wr(e.anyOf):I(e)?Sr(e.const):!1}function Er(e){return wr(e)}function Dr(e){return T({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function Or(e,t,n=[]){return S(e,(e,r)=>Or(r,t,[...n,`${e}${t}`]),()=>n)}function kr(e,t){return x(e.length,0)?[`${t}`]:Or(e,t)}function Ar(e,t,n=[]){return S(t,(t,r)=>Ar(e,r,[...n,...jr(e,t)]),()=>n)}function jr(e,t){return R(t)?Ar(e,t.anyOf):I(t)?kr(e,t.const):yn()}function Mr(e,t){return S(t,(t,n)=>Mr(jr(e,t),n),()=>e)}function Nr(e){return e.map(e=>F(e))}function Pr(e){return L(Nr(Mr([],e)))}function Fr(e){return x(e.length,0)?yn():x(e.length,1)&&I(e[0])?e[0]:Pr(e)}function Ir(e){let t=xr(e);return x(t.length,0)?vr():Er(t)?Fr(t):Dr(e)}function Lr(e){let t=Ir(e);return fo(t)?vr():t}function Rr(e,t){return T({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function zr(e){return Rr(Hi,e)}function Br(e){return A({true:e,false:e})}function Vr(e,t={}){let[n,r,i]=[e,e.length,!1];return T({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function z(e){return D(e,`Tuple`)}function Hr(e){return Ot(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function Ur(e){return Ot(e,[`~readonly`])}function Wr(e,t){return E(Ur(e),{},t)}function Gr(e,t,n,r){return Wr(q(e,t,n),r)}function Kr(e,t={}){return Wr(e,t)}function qr(e){return Ot(e,[`~optional`])}function Jr(e,t){return E(qr(e),{},t)}function Yr(e,t,n,r){return Jr(q(e,t,n),r)}function Xr(e,t={}){return Jr(e,t)}function Zr(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function Qr(e){return A(Zr(e.items))}function $r(e,t){return Zn(e)?!!Zn(t):!1}function ei(e,t){return tn(e)?!!tn(t):!1}function ti(e,t){let n=$r(e,t),r=ei(e,t),i=Kr(Xr(vi([e,t])));return n&&r?Xn($t(i)):n&&!r?Xn(i):!n&&r?$t(i):i}function ni(e,t,n){return n in e?n in t?ti(e[n],t[n]):e[n]:n in t?t[n]:k()}function ri(e,t){return[...new Set([...w(t),...w(e)])].reduce((n,r)=>({...n,[r]:ni(e,t,r)}),{})}function ii(e){return j(e)?e.properties:z(e)?Zr(e.items):yn()}function ai(e,t){return A(ri(ii(e),ii(t)))}function oi(e,t){let n=dc(e,t);return x(n,`left-inside`)?e:x(n,`right-inside`)||x(n,`equal`)?t:k()}function si(e){return j(e)||z(e)}function ci(e,t){let n=R(e),r=R(t);return n||r}function li(e,t){let n=xi(e),r=xi(t),i=ci(n,r),a=si(n),o=si(r);return i?vi([n,r]):a&&o?ai(n,r):a&&!o?n:!a&&o?r:oi(n,r)}function ui(e,t,n=[]){return S(t,(t,r)=>ui(e,r,[...n,li(e,t)]),()=>x(n.length,0)?[e]:n)}function di(e,t,n=[]){return S(e,(e,r)=>di(r,t,[...n,...fi([e],t)]),()=>n)}function fi(e,t=[]){return S(e,(e,n)=>R(e)?fi(n,di(e.anyOf,t)):fi(n,ui(e,t)),()=>t)}function pi(e,t){return _o(uc({},e,t))?[]:[e]}function mi(e,t){return e.reduce((e,n)=>[...e,...pi(n,t)],[])}function hi(e,t){let n=xi(e);return bi(mi(R(n)?n.anyOf:[n],t))}function gi(e,t,n){return bi([_n([e,t]),hi(n,e)])}function _i(e){return bi(e.map(e=>F(e)))}function vi(e){return Si(gc(fi(e)))}function yi(e){return xi(Lr(e))}function bi(e){return Si(gc(e))}function xi(e){return mn(e)?gi(e.if,e.then,e.else):gn(e)?_i(e.enum):M(e)?vi(e.allOf):fo(e)?yi(e.pattern):R(e)?bi(e.anyOf):e}function Si(e){return x(e.length,1)?e[0]:x(e.length,0)?k():L(e)}function Ci(e,t){return Li(_i(e),t)}function wi(e,t){return Rr(Bi,t)}function Ti(e,t){return Li(vi(e),t)}function Ei(e,t){return Fe(e)||Ne(e)?A({[e]:t}):x(e,!1)?A({false:t}):x(e,!0)?A({true:t}):A({})}function Di(e,t){return Rr(Vi,t)}function Oi(e,t){return C(e,`pattern`)&&(Fe(e.pattern)||e.pattern instanceof RegExp)?Rr(e.pattern.toString(),t):Rr(Hi,t)}function ki(e,t){return Er(xr(e))?Li(yi(e),t):Rr(e,t)}function Ai(e){return R(e)?ji(e.anyOf):[e]}function ji(e){return e.reduce((e,t)=>[...e,...Ai(t)],[])}function Mi(e){return e.some(e=>yr(e)||hr(e)||rr(e))}function Ni(e,t){return x(Mi(e),!0)?Rr(Hi,t):void 0}function Pi(e,t){return e.reduce((e,n)=>I(n)&&(Fe(n.const)||Ne(n.const))?{...e,[n.const]:t}:e,{})}function Fi(e,t){return A(Pi(e,t))}function Ii(e,t){let n=ji(e),r=Ni(n,t);return kt(r)?r:Fi(n,t)}function Li(e,t){return Zt(e)?zr(t):er(e)?Br(t):gn(e)?Ci(e.enum,t):rr(e)?wi(e,t):M(e)?Ti(e.allOf,t):I(e)?Ei(e.const,t):hr(e)?Di(e,t):R(e)?Ii(e.anyOf,t):yr(e)?Oi(e,t):fo(e)?ki(e.pattern,t):A({})}function Ri(e,t,n){return K([e])?E(Li(e,t),{},n):Ui(e,t,n)}function zi(e,t,n,r,i){return Ri(q(e,t,n),q(e,t,r),i)}const Bi=`^${tr}$`,Vi=`^${pr}$`,Hi=`^.*$`;function Ui(e,t,n={}){return O(`Record`,[e,t],n)}function Wi(e,t,n={}){return Ri(e,t,n)}function Gi(e,t){return Rr(e,t)}function Ki(e){return x(e,Hi)?vr():x(e,Bi)?nr():x(e,Vi)?mr():Ir(e)}function qi(e){return w(e.patternProperties)[0]}function Ji(e){return Ki(qi(e))}function Yi(e){return e.patternProperties[qi(e)]}function Xi(e){return D(e,`Record`)}function Zi(e){return T({"~kind":`Rest`},{type:`rest`,items:e},{})}function Qi(e){return D(e,`Rest`)}function $i(e){return D(e,`This`)}function ea(e){return T({"~kind":`Undefined`},{type:`undefined`},e)}function ta(e){return D(e,`Undefined`)}function na(e){return D(e,`Void`)}function ra(e){return Qn()}function ia(e){return vr()}function aa(e){return mr()}function oa(e){return nr()}function sa(e){return k()}function ca(e){return F(e)}function la(e){return e}function ua(e){return L(e[1])}function da(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function fa(e){return[e[0],...e[1]]}function pa(e){return e}function ma(e){return e[1]}function ha(e){return x(e.length,2)}function ga(e,t,n){return ha(e)?t(e[0],e[1]):n()}function _a(e,t){return x(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function va(e,t){for(let n=0;n<e.length;n++){let r=_a(e[n],t);if(ha(r))return r}return[]}function ya(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const ba=[...ya(97,122),...ya(65,90)],xa=[`0`,...ya(49,57)];function Sa(e){let t=e.indexOf(`*/`);return x(t,-1)?``:e.slice(t+2)}function Ca(e){let t=e.indexOf(`
2
+ `);return x(t,-1)?``:e.slice(t)}function wa(e){return e.replace(/^[ \t\r\f\v]+/,``)}function Ta(e){let t=wa(e);return t.startsWith(`/*`)?Ta(Sa(t.slice(2))):t.startsWith(`//`)?Ta(Ca(t.slice(2))):t}function Ea(e){let t=e.trimStart();return t.startsWith(`/*`)?Ea(Sa(t.slice(2))):t.startsWith(`//`)?Ea(Ca(t.slice(2))):t}[...xa];function Da(e,t){return va([e],t)}function Oa(e,t){return x(e,``)?[``,t]:e.startsWith(`
3
+ `)?Da(e,Ta(t)):e.startsWith(` `)?Da(e,t):Da(e,Ea(t))}[...ba,...xa],[...xa];function ka(e){return x(e,``)?[]:[e.slice(0,1),e.slice(1)]}function Aa(e,t){return S(e,(e,n)=>t.startsWith(e)?!0:Aa(n,t),()=>!1)}function ja(e,t,n=``){return ga(ka(t),(r,i)=>Aa(e,t)?[n,t]:ja(e,i,`${n}${r}`),()=>[])}function Ma(e,t){return ga(ja(e,t),(e,t)=>x(e,``)?[]:[e,t],()=>[])}const B=(e,t,n=()=>[])=>e.length===2?t(e):n(),Na=e=>B(Oa(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[ra(e),t]),Pa=e=>B(Oa(`.*`,e),([e,t])=>[ia(e),t]),Fa=e=>B(Oa(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[aa(e),t]),Ia=e=>B(Oa(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[oa(e),t]),La=e=>B(Oa(`(?!)`,e),([e,t])=>[sa(e),t]),Ra=e=>B(Ma([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[ca(e),t]),za=e=>B(B(Na(e),([e,t])=>[e,t],()=>B(Pa(e),([e,t])=>[e,t],()=>B(Fa(e),([e,t])=>[e,t],()=>B(Ia(e),([e,t])=>[e,t],()=>B(La(e),([e,t])=>[e,t],()=>B(Ba(e),([e,t])=>[e,t],()=>B(Ra(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[la(e),t]),Ba=e=>B(B(Oa(`(`,e),([e,t])=>B(Ua(t),([t,n])=>B(Oa(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[ua(e),t]),Va=e=>B(B(B(Ha(e),([e,t])=>B(Oa(`|`,t),([t,n])=>B(Va(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>B(B(Ha(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>B([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[da(e),t]),Ha=e=>B(B(za(e),([e,t])=>B(Ua(t),([t,n])=>[[e,t],n])),([e,t])=>[fa(e),t]),Ua=e=>B(B(Va(e),([e,t])=>[e,t],()=>B(Ha(e),([e,t])=>[e,t],()=>[])),([e,t])=>[pa(e),t]),Wa=e=>B(B(Oa(`^`,e),([e,t])=>B(Ua(t),([t,n])=>B(Oa(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[ma(e),t]);function Ga(e){return e.join(`|`)}function Ka(e){return e.slice(1,e.length-1)}function qa(e,t,n){return io(t,`${n}${e}`)}function Ja(e,t){return io(e,`${t}-?(?:0|[1-9][0-9]*)n`)}function Ya(e,t){return io(e,`${t}${tr}`)}function Xa(e,t){return io(e,`${t}${pr}`)}function Za(e,t){return ro(L([F(`false`),F(`true`)]),e,t)}function Qa(e,t){return io(e,`${t}.*`)}function $a(e,t,n){return io(t,`${n}${Ka(e)}`)}function eo(e,t,n){return ro(so(e,{}),t,n)}function to(e,t,n){return ro(_i(e),t,n)}function no(e,t,n,r=[]){return S(e,(e,i)=>no(i,t,n,[...r,ro(e,[],``)]),()=>io(t,`${n}(${Ga(r)})`))}function ro(e,t,n){return gn(e)?to(e.enum,t,n):rr(e)?Ya(t,n):I(e)?qa(e.const,t,n):$n(e)?Ja(t,n):er(e)?Za(t,n):hr(e)?Xa(t,n):yr(e)?Qa(t,n):fo(e)?$a(e.pattern,t,n):uo(e)?eo(e.parameters[0],t,n):R(e)?no(e.anyOf,t,n):`(?!)`}function io(e,t){return S(e,(e,n)=>ro(e,n,t),()=>t)}function ao(e){return`^${io(e,``)}$`}function oo(e){return Dr(ao(e))}function so(e,t){return K(e)?E(oo(e),{},t):lo(e,t)}function co(e,t,n,r){return so(hf(e,t,n),r)}function lo(e,t={}){return O(`TemplateLiteral`,[e],t)}function uo(e){return kt(e)&&C(e,`action`)&&x(e.action,`TemplateLiteral`)}function fo(e){return D(e,`TemplateLiteral`)}function po(e){return T({"~kind":`ExtendsUnion`},{inferred:e})}function mo(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsUnion`)&&b(e.inferred)}function V(e){return T({"~kind":`ExtendsTrue`},{inferred:e})}function ho(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsTrue`)&&b(e.inferred)}function H(){return T({"~kind":`ExtendsFalse`},{})}function go(e){return b(e)&&C(e,`~kind`)&&x(e[`~kind`],`ExtendsFalse`)}function _o(e){return mo(e)||ho(e)}function U(e,t,n){return _o(e)?t(e.inferred):n()}function vo(e,t,n,r){return U(G(e,n,r),r=>V(v(v(e,r),{[t]:n})),()=>H())}function yo(e,t){return V(e)}function bo(e,t,n,r,i){return U(G(e,t,n),e=>U(G(e,t,r),e=>V(e),()=>H()),()=>U(G(e,t,i),e=>V(e),()=>H()))}function xo(e,t,n){return G(e,t,_i(n))}function So(e,t,n){return S(n,(n,r)=>U(G(e,t,n),e=>So(e,t,r),()=>H()),()=>V(e))}function Co(e,t,n){return G(e,t,yi(n))}function wo(e,t,n){return S(n,(n,r)=>U(G(e,t,n),e=>V(e),()=>wo(e,t,r)),()=>H())}function W(e,t,n){return Zt(n)?yo(e,t):mn(n)?bo(e,t,n.if,n.then,n.else):gn(n)?xo(e,t,n.enum):fn(n)?vo(e,n.name,t,n.extends):M(n)?So(e,t,n.allOf):fo(n)?Co(e,t,n.pattern):R(n)?wo(e,t,n.anyOf):cn(n)?V(e):H()}function To(e,t,n){return fn(n)?W(e,t,n):Zt(n)||cn(n)?V(e):po(e)}function Eo(e,t){let n=Yn(e),r=Yn(t);return n&&r||!n&&r?!0:!(n&&!r)}function Do(e,t,n,r){return Rt(r)?Eo(t,r)?G(e,n,r.items):H():W(e,t,r)}function Oo(e,t,n){return $n(n)?V(e):W(e,t,n)}function ko(e,t,n){return er(n)?V(e):W(e,t,n)}function Ao(e,t,n,r,i){let a=fn(r)?t:r,o=fn(r)?r:t,s=tn(t),c=tn(r);return!s&&c?H():U(G(e,a,o),e=>No(e,n,i),()=>H())}function jo(e,t,n,r){return S(r,(r,i)=>Ao(e,t,n,r,i),()=>tn(t)?V(e):H())}function Mo(e,t,n){return S(t,(t,r)=>jo(e,t,r,n),()=>V(e))}function No(e,t,n){return Mo(e,t,n)}function Po(e,t,n){return na(n)?V(e):G(e,t,n)}function Fo(e,t,n,r){return Zt(r)||cn(r)?V(e):Vt(r)?U(No(e,t,r.parameters),e=>Po(e,n,r.instanceType),()=>H()):H()}function Io(e,t,n,r,i){return U(G(e,t,i),()=>G(e,n,i),()=>G(e,r,i))}function Lo(e,t,n){return G(e,_i(t),n)}function Ro(e,t,n,r){return Zt(r)||cn(r)?V(e):Wt(r)?U(No(e,t,r.parameters),e=>Po(e,n,r.returnType),()=>H()):H()}function zo(e,t,n){return rr(n)||hr(n)?V(e):W(e,t,n)}function Bo(e,t,n){return G(e,vi(t),n)}function Vo(e,t,n){return t===n?V(e):H()}function Ho(e,t,n){return I(n)?Vo(e,t,n.const):$n(n)?V(e):W(e,F(t),n)}function Uo(e,t,n){return I(n)?Vo(e,t,n.const):er(n)?V(e):W(e,F(t),n)}function Wo(e,t,n){return I(n)?Vo(e,t,n.const):hr(n)?V(e):W(e,F(t),n)}function Go(e,t,n){return I(n)?Vo(e,t,n.const):yr(n)?V(e):W(e,F(t),n)}function Ko(e,t,n){return De(t.const)?Ho(e,t.const,n):Oe(t.const)?Uo(e,t.const,n):Ne(t.const)?Wo(e,t.const,n):Fe(t.const)?Go(e,t.const,n):yn()}function qo(e,t,n){return fn(n)?W(e,t,n):V(e)}function Jo(e,t,n){return fr(n)?V(e):W(e,t,n)}function Yo(e,t,n){return hr(n)?V(e):W(e,t,n)}function Xo(e,t,n){return tn(t)?tn(n)?V(e):H():V(e)}function Zo(e,t,n){return fn(n)&&Qt(n.extends)?H():U(G(e,t,n),e=>Xo(e,t,n),()=>H())}function Qo(e,t){return e.reduce((e,n)=>n in t&&_o(t[n])?{...e,...t[n].inferred}:yn(),{})}function $o(e,t,n){let r={};for(let i of w(n))r[i]=i in t?Zo({},t[i],n[i]):tn(n[i])?fn(n[i])?V(v(e,{[n[i].name]:n[i].extends})):V(e):H();let i=et(r).every(e=>_o(e)),a=i?Qo(w(r),r):{};return i?V(a):H()}function es(e,t,n){let r=$o(e,t,n);return _o(r)?V(v(e,r.inferred)):H()}function ts(e,t,n){return es(e,t,n)}function ns(e,t){return w(t).reduce((n,r)=>({...n,[r]:C(e,r)?R(n[r])?L([...n[r].anyOf,t[r]]):L([e[r],t[r]]):t[r]}),e)}function rs(e,t,n,r){return S(t,(t,i)=>U(G({},e[t],n),t=>rs(e,i,n,ns(r,t)),()=>H()),()=>V(r))}function is(e,t,n,r){return rs(t,w(t),r,e)}function as(e,t,n){return Xi(n)?is(e,t,qi(n),Yi(n)):j(n)?ts(e,t,n.properties):W(e,A(t),n)}function os(e,t){return x(w(t).length,0)?V(e):H()}function ss(e,t,n,r,i){return G(e,n,i)}function cs(e,t,n,r){return Xi(r)?ss(e,Ki(t),n,Ki(qi(r)),Yi(r)):j(r)?os(e,r.properties):Zt(r)||cn(r)?V(e):H()}function ls(e,t,n){return yr(n)?V(e):W(e,t,n)}function us(e,t,n){return _r(n)?V(e):W(e,t,n)}function ds(e,t,n){return G(e,yi(t),n)}function fs(e,t){return T({"~kind":`Inferrable`},{name:e,type:t},{})}function ps(e){return b(e)&&C(e,`~kind`)&&C(e,`name`)&&C(e,`type`)&&x(e[`~kind`],`Inferrable`)&&Fe(e.name)&&b(e.type)}function ms(e){return Qi(e)?fn(e.items)?Rt(e.items.extends)?fs(e.items.name,e.items.extends.items):cn(e.items.extends)?fs(e.items.name,e.items.extends):void 0:yn():void 0}function hs(e){return fn(e)?fs(e.name,e.extends):void 0}function gs(e,t,n=[]){return S(e,(e,r)=>U(G({},e,t),()=>gs(r,t,[...n,e]),()=>void 0),()=>n)}function _s(e,t,n,r){let i=gs(n,r);return Ee(i)?V(v(e,{[t]:Vr(i)})):H()}function vs(e,t,n,r){let i=gs(n,r);return Ee(i)?V(v(e,{[t]:L(i)})):H()}function ys(e){return[...e].reverse()}function bs(e,t){return t?ys(e):e}function xs(e){let t=e.length>0?e[0]:void 0;return kt(kt(t)?ms(t):void 0)}function Ss(e,t,n,r,i,a){return U(G(e,n,i),e=>Ts(e,t,r,a),()=>H())}function Cs(e,t,n,r,i){let a=ms(r);return ps(a)?_s(e,a.name,bs(n,t),a.type):S(n,(n,a)=>Ss(e,t,n,a,r,i),()=>H())}function ws(e,t,n,r){return S(r,(r,i)=>Cs(e,t,n,r,i),()=>x(n.length,0)?V(e):H())}function Ts(e,t,n,r){return ws(e,t,n,r)}function Es(e,t,n){let r=mf(e,ff([],[]),n),i=xs(r);return Ts(e,i,bs(t,i),bs(r,i))}function Ds(e,t,n){let r=hs(n);return ps(r)?vs(e,r.name,t,r.type):S(t,(t,r)=>U(G(e,t,n),e=>Ds(e,r,n),()=>H()),()=>V(e))}function Os(e,t,n){let r=mf(e,ff([],[]),t);return z(n)?Es(e,r,n.items):Rt(n)?Ds(e,r,n.items):W(e,Vr(r),n)}function ks(e,t,n){return na(n)||ta(n)?V(e):W(e,t,n)}function As(e,t,n){return S(n,(n,r)=>U(G(e,t,n),e=>V(e),()=>As(e,t,r)),()=>H())}function js(e,t,n){return S(t,(t,r)=>U(As(e,t,n),e=>js(e,r,n),()=>H()),()=>V(e))}function Ms(e,t,n){let r=hs(n);return ps(r)?vs(e,r.name,t,r.type):R(n)?js(e,t,n.anyOf):js(e,t,[n])}function Ns(e,t,n){return fn(n)?W(e,t,n):Zt(n)||cn(n)?V(e):H()}function Ps(e,t,n){return na(n)?V(e):W(e,t,n)}function G(e,t,n){return Zt(t)?To(e,t,n):Rt(t)?Do(e,t,t.items,n):$n(t)?Oo(e,t,n):er(t)?ko(e,t,n):Vt(t)?Fo(e,t.parameters,t.instanceType,n):mn(t)?Io(e,t.if,t.then,t.else,n):gn(t)?Lo(e,t.enum,n):Wt(t)?Ro(e,t.parameters,t.returnType,n):rr(t)?zo(e,t,n):M(t)?Bo(e,t.allOf,n):I(t)?Ko(e,t,n):Qt(t)?qo(e,t,n):fr(t)?Jo(e,t,n):hr(t)?Yo(e,t,n):j(t)?as(e,t.properties,n):Xi(t)?cs(e,qi(t),Yi(t),n):yr(t)?ls(e,t,n):_r(t)?us(e,t,n):fo(t)?ds(e,t.pattern,n):z(t)?Os(e,t.items,n):ta(t)?ks(e,t,n):R(t)?Ms(e,t.anyOf,n):cn(t)?Ns(e,t,n):na(t)?Ps(e,t,n):H()}function Fs(e,t){return vi([...e,A(t)])}function Is(e,t,n){return K(e)?E(Fs(e,t),{},n):Rs(e,t,n)}function Ls(e,t,n,r,i){return Is(hf(e,t,n),pf(e,t,r),i)}function Rs(e,t,n={}){return O(`Interface`,[e,t],n)}function zs(e){return kt(e)&&C(e,`action`)&&x(e.action,`Interface`)}function Bs(e,t,n){return e.includes(n)?!0:Us([...e,n],t,t[n])}function Vs(e,t,n){return Hs(e,t,an(n))}function Hs(e,t,n){return S(n,(n,r)=>Us(e,t,n)?!0:Hs(e,t,r),()=>!1)}function Us(e,t,n){return qt(n)?Bs(e,t,n.$ref):Rt(n)?Us(e,t,n.items):Vt(n)?Hs(e,t,[...n.parameters,n.instanceType]):Wt(n)?Hs(e,t,[...n.parameters,n.returnType]):zs(n)?Vs(e,t,n.parameters[1]):M(n)?Hs(e,t,n.allOf):j(n)?Vs(e,t,n.properties):R(n)?Hs(e,t,n.anyOf):z(n)?Hs(e,t,n.items):Xi(n)?Us(e,t,Yi(n)):!1}function Ws(e,t,n){return Us(e,t,n)}function Gs(e,t){return t.reduce((t,n)=>Ws([n],e,e[n])?[...t,n]:t,[])}function Ks(e){return Gs(e,rn(e))}function qs(e,t,n){return n.includes(t)?n:t in e?Xs(e,e[t],[...n,t]):yn()}function Js(e,t,n){return Ys(e,an(t),n)}function Ys(e,t,n){return t.reduce((t,n)=>Xs(e,n,t),n)}function Xs(e,t,n){return qt(t)?qs(e,t.$ref,n):Rt(t)?Xs(e,t.items,n):Vt(t)?Ys(e,[...t.parameters,t.instanceType],n):Wt(t)?Ys(e,[...t.parameters,t.returnType],n):zs(t)?Js(e,t.parameters[1],n):M(t)?Ys(e,t.allOf,n):j(t)?Js(e,t.properties,n):R(t)?Ys(e,t.anyOf,n):z(t)?Ys(e,t.items,n):Xi(t)?Xs(e,Yi(t),n):n}function Zs(e,t,n){return Xs(e,n,[t])}function Qs(e){return Xt()}function $s(e){return w(e).reduce((t,n)=>({...t,[n]:tc(e[n])}),{})}function ec(e){return e.reduce((e,t)=>[...e,tc(t)],[])}function tc(e){return qt(e)?Qs(e.$ref):Rt(e)?Lt(tc(e.items),zt(e)):Vt(e)?Bt(ec(e.parameters),tc(e.instanceType)):Wt(e)?Ut(ec(e.parameters),tc(e.returnType)):M(e)?_n(ec(e.allOf)):j(e)?A($s(e.properties)):Xi(e)?Wi(Ji(e),tc(Yi(e))):R(e)?L(ec(e.anyOf)):z(e)?Vr(ec(e.items)):e}function nc(e,t){return t in e?tc(e[t]):sn()}function rc(e){return nc(e.$defs,e.$ref)}function ic(e,t,n){let r=hf(e,ff([],[]),t),i=pf({},ff([],[]),n);return vi([...r,A(i)])}function ac(e,t){return w(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=zs(r)?ic(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function oc(e,t,n){return ln(ac(e,Zs(e,t,n)),t)}function sc(e,t){return t in e?qt(e[t])?sc(e,e[t].$ref):e[t]:k()}function cc(e,t){return sc(e,t)}function lc(e){return un(e)?rc(e):dn(e)?sn():e}function uc(e,t,n){return G(e,lc(t),lc(n))}function dc(e,t){let n=[cn(e)?H():uc({},e,t),cn(e)?V({}):uc({},t,e)];return _o(n[0])&&_o(n[1])?`equal`:_o(n[0])&&go(n[1])?`left-inside`:go(n[0])&&_o(n[1])?`right-inside`:`disjoint`}function fc(e,t){return t.filter(t=>dc(e,t)!==`right-inside`)}function pc(e,t){return x(t.some(t=>{let n=dc(e,t);return x(n,`left-inside`)||x(n,`equal`)}),!1)}function mc(e,t){let n=xi(e);return Zt(n)?[n]:pc(n,t)?[...fc(n,t),n]:t}function hc(e){return e.reduce((e,t)=>j(t)?[...e,t]:Qt(t)?e:mc(t,e),[])}function gc(e){return ji(hc(e))}function _c(e,t){return E(xi(e),{},t)}function vc(e,t,n,r){return _c(q(e,t,n),r)}function yc(e,t=[]){return At(e)&&x(e.action,`Conditional`)?qt(e.parameters[0])?yc(e.parameters[2],yc(e.parameters[3],[...t,e.parameters[0].$ref])):yc(e.parameters[2],yc(e.parameters[3],t)):At(e)&&x(e.action,`Mapped`)&&At(e.parameters[1])&&x(e.parameters[1].action,`KeyOf`)&&qt(e.parameters[1].parameters[0])?[...t,e.parameters[1].parameters[0].$ref]:t}function bc(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function xc(e,t,n=[]){return S(e,(e,r)=>S(t,(t,i)=>xc(r,i,[...n,[t,e]]),()=>n),()=>n)}function Sc(e){return R(e)?[...e.anyOf]:[e]}function Cc(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function wc(e,t){return t.reduce((t,n)=>[...t,...Cc(e,n)],[])}function Tc(e){return e.reduce((e,t)=>x(t[0],!0)?wc(e,Sc(t[1])):wc(e,[t[1]]),[[]])}function Ec(e,t,n){let r=xc(t,bc(e,yc(n)));return At(n)&&x(n.action,`Conditional`)||At(n)&&x(n.action,`Mapped`)?Tc(r):[t]}function Dc(){return[`(not-resolvable)`,k()]}function Oc(){return[`(not-generic)`,k()]}function kc(e,t,n){return[e,Jt(t,n)]}function Ac(e,t,n){return t in e?jc(e,t,e[t],n):Dc()}function jc(e,t,n,r){return Yt(n)?kc(t,n.parameters,n.expression):qt(n)?Ac(e,n.$ref,r):Oc()}function Mc(e,t,n){return jc(e,`(anonymous)`,t,n)}function Nc(e,t,n){if(fn(t)||Gc(t)||_o(uc({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function Pc(e,t,n,r,i){let a=q(e,t,i);return Nc(n,a,r),v(e,{[n]:a})}function Fc(e,t,n,r,i){let a=q(e,t,n.extends),o=q(e,t,n.equals);return S(i,(i,o)=>Ic(Pc(e,t,n.name,a,i),t,r,o),()=>Ic(Pc(e,t,n.name,a,o),t,r,[]))}function Ic(e,t,n,r){return S(n,(n,i)=>Fc(e,t,n,i,r),()=>e)}function Lc(e,t,n,r){return Ic(e,t,n,r)}function Rc(e){return Re(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function zc(e,t){return x(Rc(e),t)}function Bc(e,t,n,r,i,a){let o=Lc(e,t,r,a),s=q(o,ff([...t.callstack,n.$ref],t.visited),i);return q(o,ff([],[]),s)}function Vc(e,t,n,r,i,a){return a.reduce((a,o)=>[...a,Bc(e,t,n,r,i,o)],[])}function Hc(e,t,n,r,i,a){let o=Vc(e,t,n,r,i,Ec(r,a,i));return x(o.length,1)?o[0]:bi(o)}function Uc(e,t,n,r){let i=hf(e,t,r),a=Mc(e,n,r),o=a[0],s=a[1];return Yt(s)?zc(t,o)?Wc(Kt(o),i):Hc(e,t,Kt(o),s.parameters,s.expression,i):Wc(n,i)}function Wc(e,t){return T({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function Gc(e){return D(e,`Call`)}function Kc(e){return Ot(e,[`~immutable`])}function qc(e,t){return E(Kc(e),{},t)}function Jc(e,t,n,r){return qc(q(e,t,n),r)}function Yc(e,t){return e(t)}function Xc(e,t){return Fe(t)?F(Yc(e,t)):F(t)}function Zc(e,t){return $c(e,yi(t))}function Qc(e,t){return L(t.map(t=>$c(e,t)))}function $c(e,t){return I(t)?Xc(e,t.const):fo(t)?Zc(e,t.pattern):R(t)?Qc(e,t.anyOf):t}function el(e,t={}){return O(`Capitalize`,[e],t)}function tl(e,t={}){return O(`Lowercase`,[e],t)}function nl(e,t={}){return O(`Uncapitalize`,[e],t)}function rl(e,t={}){return O(`Uppercase`,[e],t)}const il=e=>e[0].toUpperCase()+e.slice(1),al=e=>e.toLowerCase(),ol=e=>e[0].toLowerCase()+e.slice(1),sl=e=>e.toUpperCase();function cl(e,t){return K([e])?E($c(il,e),{},t):el(e,t)}function ll(e,t){return K([e])?E($c(al,e),{},t):tl(e,t)}function ul(e,t){return K([e])?E($c(ol,e),{},t):nl(e,t)}function dl(e,t){return K([e])?E($c(sl,e),{},t):rl(e,t)}function fl(e,t,n,r){return cl(q(e,t,n),r)}function pl(e,t,n,r){return ll(q(e,t,n),r)}function ml(e,t,n,r){return ul(q(e,t,n),r)}function hl(e,t,n,r){return dl(q(e,t,n),r)}function gl(e,t,n,r,i={}){return O(`Conditional`,[e,t,n,r],i)}function _l(e,t,n,r,i,a){let o=uc(e,n,r);return mo(o)?L([q(o.inferred,t,i),q(e,t,a)]):ho(o)?q(o.inferred,t,i):q(e,t,a)}function vl(e,t,n,r,i,a,o){return K([n,r])?E(_l(e,t,n,r,i,a),{},o):gl(n,r,i,a,o)}function yl(e,t,n,r,i,a,o){return vl(e,t,q(e,t,n),q(e,t,r),i,a,o)}function bl(e,t={}){return O(`ConstructorParameters`,[e],t)}function xl(e){let t=Vt(e)?e.parameters:[];return Vr(mf({},ff([],[]),t))}function Sl(e,t){return K([e])?E(xl(e),{},t):bl(e,t)}function Cl(e,t,n,r){return Sl(q(e,t,n),r)}function wl(e,t,n={}){return O(`Exclude`,[e,t],n)}function Tl(e,t,n){return K([e,t])?E(hi(e,t),{},n):wl(e,t,n)}function El(e,t,n,r,i){return Tl(q(e,t,n),q(e,t,r),i)}function Dl(e,t,n={}){return O(`Extract`,[e,t],n)}function Ol(e,t){return _o(uc({},e,t))?[e]:[]}function kl(e,t){return e.reduce((e,n)=>[...e,...Ol(n,t)],[])}function Al(e,t){let n=xi(e);return bi(kl(R(n)?n.anyOf:[n],t))}function jl(e,t,n){return K([e,t])?E(Al(e,t),{},n):Dl(e,t,n)}function Ml(e,t,n,r,i){return jl(q(e,t,n),q(e,t,r),i)}function Nl(e,t,n={}){return O(`Index`,[e,t],n)}function Pl(e,t){return Ul(cc(e,t))}function Fl(e,t,n){return Ul(gi(e,t,n))}function Il(e,t){let n=w(e).filter(e=>!C(t,e)),r=w(t).filter(t=>!C(e,t)),i=w(e).filter(e=>C(t,e)),a=n.reduce((t,n)=>({...t,[n]:e[n]}),{}),o=r.reduce((e,n)=>({...e,[n]:t[n]}),{}),s=i.reduce((n,r)=>({...n,[r]:vi([e[r],t[r]])}),{});return v(v(a,o),s)}function Ll(e){return e.reduce((e,t)=>Il(e,Ul(t)),{})}function Rl(e){return e}function zl(e){return Ul(Qr(Vr(e)))}function Bl(e,t){return w(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:bi([e[r],t[r]])}),{})}function Vl(e,t){return S(e,(e,n)=>Vl(n,Bl(t,Ul(e))),()=>t)}function Hl(e){return S(e,(e,t)=>Vl(t,Ul(e)),()=>yn())}function Ul(e){return un(e)?Pl(e.$defs,e.$ref):mn(e)?Fl(e.if,e.then,e.else):M(e)?Ll(e.allOf):R(e)?Hl(e.anyOf):z(e)?zl(e.items):j(e)?Rl(e.properties):{}}function Wl(e){return A(Ul(e))}const Gl=RegExp(`^(?:0|[1-9][0-9]*)$`);function Kl(e){let t=`${e}`;return Gl.test(t)?parseInt(t):e}function ql(e){return F(Kl(e))}function Jl(e){return e.map(e=>Yl(e))}function Yl(e){return M(e)?_n(Jl(e.allOf)):R(e)?L(Jl(e.anyOf)):I(e)?ql(e.const):e}function Xl(e,t){return _o(uc({},Yl(t),mr()))?e:I(t)&&x(t.const,`length`)?mr():k()}function Zl(e,t){return iu(cc(e,t))}function Ql(e,t,n){return iu(gi(e,t,n))}function $l(e){return iu(_i(e))}function eu(e){return iu(vi(e))}function tu(e){return[`${e}`]}function nu(e){return iu(yi(e))}function ru(e){return e.reduce((e,t)=>[...e,...iu(t)],[])}function iu(e){return un(e)?Zl(e.$defs,e.$ref):mn(e)?Ql(e.if,e.then,e.else):gn(e)?$l(e.enum):M(e)?eu(e.allOf):I(e)?tu(e.const):fo(e)?nu(e.pattern):R(e)?ru(e.anyOf):[]}function au(e){return iu(e)}function ou(e,t){return t.map(t=>su(e,t))}function su(e,t){return Rt(t)?Lt(su(e,t.items)):Vt(t)?Bt(ou(e,t.parameters),su(e,t.instanceType)):Wt(t)?Ut(ou(e,t.parameters),su(e,t.returnType)):z(t)?Vr(ou(e,t.items)):R(t)?L(ou(e,t.anyOf)):M(t)?_n(ou(e,t.allOf)):$i(t)?A(e):t}function cu(e,t){return su(e,t)}function lu(e,t){return cu(e,t in e?e[t]:k())}function uu(e,t){return t.reduce((t,n)=>[...t,lu(e,n)],[])}function du(e,t){return bi(uu(e,au(t)))}const fu=new RegExp(Bi);function pu(e){return e.filter(e=>fu.test(e))}function mu(e){return bi(uu(e,pu(rn(e))))}function hu(e,t){return hr(t)?mu(e):du(e,t)}function gu(e){return F(Kl(e))}function _u(e){return e.map(e=>vu(e))}function vu(e){return M(e)?_n(_u(e.allOf)):R(e)?L(_u(e.anyOf)):I(e)?gu(e.const):e}function yu(e,t){return e.reduceRight((e,n,r)=>_o(uc({},F(r),t))?[n,...e]:e,[])}function bu(e,t){return Si(yu(e,vu(t)))}function xu(e){return Si(e)}function Su(e,t){return I(t)&&x(t.const,`length`)?F(e.length):hr(t)||rr(t)?xu(e):bu(e,t)}function Cu(e,t){return Rt(e)?Xl(e.items,t):j(e)?hu(e.properties,t):z(e)?Su(e.items,t):k()}function wu(e){return un(e)||mn(e)||M(e)||R(e)?Wl(e):e}function Tu(e,t,n){return K([e,t])?E(Cu(wu(e),t),{},n):Nl(e,t,n)}function Eu(e,t,n,r,i){return Tu(q(e,t,n),q(e,t,r),i)}function Du(e,t={}){return O(`InstanceType`,[e],t)}function Ou(e){return Vt(e)?e.instanceType:k()}function ku(e,t){return K([e])?E(Ou(e),{},t):Du(e,t)}function Au(e,t,n,r={}){return ku(q(e,t,n),r)}function ju(e,t={}){return O(`KeyOf`,[e],t)}function Mu(){return L([mr(),vr(),gr()])}function Nu(e){return mr()}function Pu(e){return e.reduce((e,t)=>or(t)?[...e,F(Kl(t))]:yn(),[])}function Fu(e){return Si(Pu(w(e)))}function Iu(e){return Ji(e)}function Lu(e){return Si(e.map((e,t)=>F(t)))}function Ru(e){return Zt(e)?Mu():Rt(e)?Nu(e.items):j(e)?Fu(e.properties):Xi(e)?Iu(e):z(e)?Lu(e.items):k()}function zu(e){return un(e)||mn(e)||M(e)||R(e)?Wl(e):e}function Bu(e,t){return K([e])?E(Ru(zu(e)),{},t):ju(e,t)}function Vu(e,t,n,r){return Bu(q(e,t,n),r)}function Hu(e,t,n,r,i={}){return O(`Mapped`,[e,t,n,r],i)}function Uu(e){return qu(yi(e))}function Wu(e){return e.reduce((e,t)=>[...e,...qu(t)],[])}function Gu(e){return qu(_i(e))}function Ku(e){return Ne(e)?[F(`${e}`)]:[F(e)]}function qu(e){return gn(e)?Gu(e.enum):I(e)?Ku(e.const):fo(e)?Uu(e.pattern):R(e)?Wu(e.anyOf):[e]}function Ju(e){return qu(e)}function Yu(e){return fo(e)?yi(e.pattern):e}function Xu(e,t,n,r,i,a){let o=v(e,{[n.name]:r}),s=Yu(q(o,t,i)),c=q(o,t,a);return lr(s)||ur(s)?{[s.const]:c}:{}}function Zu(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,Xu(e,t,n,o,i,a)],[])}function Qu(e){return e.reduce((e,t)=>[...e,A(t)],[])}function $u(e,t,n,r,i,a){return vi(Qu(Zu(e,t,n,Ju(r),i,a)))}function ed(e,t,n,r,i,a,o){return K([r])?E($u(e,t,n,r,i,a),{},o):Hu(n,r,i,a,o)}function td(e,t,n,r,i,a,o){return ed(e,t,n,q(e,t,r),i,a,o)}function nd(e,t,n){let r=v(e,t);return w(t).filter(e=>n.includes(e)).reduce((e,n)=>({...e,[n]:oc(r,n,t[n])}),{})}function rd(e,t,n){let r=v(e,t);return w(t).filter(e=>!n.includes(e)).reduce((e,n)=>({...e,[n]:q(r,ff([],[]),t[n])}),{})}function id(e,t,n){let r=Ks(t),i=nd(e,t,r),a=rd(e,t,r);return E({...i,...a},{},n)}function ad(e,t,n,r){return id(e,n,r)}function od(e,t={}){return O(`NonNullable`,[e],t)}function sd(e){return Tl(e,L([dr(),ea()]),{})}function cd(e,t){return K([e])?E(sd(e),{},t):od(e,t)}function ld(e,t,n,r){return cd(q(e,t,n),r)}function ud(e,t,n={}){return O(`Omit`,[e,t],n)}function dd(e){let t=Wl(e);return j(t)?t.properties:yn()}function fd(e,t){return w(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function pd(e,t){return A(fd(dd(e),au(t)))}function md(e,t,n){return K([e,t])?E(pd(e,t),{},n):ud(e,t,n)}function hd(e,t,n,r,i){return md(q(e,t,n),q(e,t,r),i)}function gd(e,t={}){return O(`Parameters`,[e],t)}function _d(e){let t=Wt(e)?e.parameters:[];return Vr(mf({},ff([],[]),t))}function vd(e,t){return K([e])?E(_d(e),{},t):gd(e,t)}function yd(e,t,n,r){return vd(q(e,t,n),r)}function bd(e,t={}){return O(`Partial`,[e],t)}function xd(e,t){let n=Ed(cc(e,t));return ln(v(e,{[t]:n}),t)}function Sd(e,t,n){return Ed(gi(e,t,n))}function Cd(e){return Ed(vi(e))}function wd(e){return L(e.map(e=>Ed(e)))}function Td(e){return A(w(e).reduce((t,n)=>({...t,[n]:$t(e[n])}),{}))}function Ed(e){return un(e)?xd(e.$defs,e.$ref):mn(e)?Sd(e.if,e.then,e.else):M(e)?Cd(e.allOf):R(e)?wd(e.anyOf):j(e)?Td(e.properties):A({})}function Dd(e,t){return K([e])?E(Ed(e),{},t):bd(e,t)}function Od(e,t,n,r){return Dd(q(e,t,n),r)}function kd(e,t,n={}){return O(`Pick`,[e,t],n)}function Ad(e,t){return w(e).reduce((n,r)=>t.includes(r)?v(n,{[r]:e[r]}):n,{})}function jd(e,t){return A(Ad(dd(e),au(t)))}function Md(e,t,n){return K([e,t])?E(jd(e,t),{},n):kd(e,t,n)}function Nd(e,t,n,r,i){return Md(q(e,t,n),q(e,t,r),i)}function Pd(e,t={}){return O(`ReadonlyObject`,[e],t)}function Fd(e){return Cf(Lt(e))}function Id(e,t){let n=Hd(cc(e,t));return ln(v(e,{[t]:n}),t)}function Ld(e,t,n){return Hd(gi(e,t,n))}function Rd(e){return Hd(vi(e))}function zd(e){return A(w(e).reduce((t,n)=>({...t,[n]:Xn(e[n])}),{}))}function Bd(e){return Cf(Vr(e))}function Vd(e){return L(e.map(e=>Hd(e)))}function Hd(e){return Rt(e)?Fd(e.items):un(e)?Id(e.$defs,e.$ref):mn(e)?Ld(e.if,e.then,e.else):M(e)?Rd(e.allOf):j(e)?zd(e.properties):z(e)?Bd(e.items):R(e)?Vd(e.anyOf):e}function Ud(e,t){return K([e])?E(Hd(e),{},t):Pd(e)}function Wd(e,t,n,r){return Ud(q(e,t,n),r)}function Gd(e,t,n,r){return t.visited.includes(r)?n:r in e?q(e,ff(t.callstack,[...t.visited,r]),e[r]):n}function Kd(e,t){let n=Zd(cc(e,t));return ln(v(e,{[t]:n}),t)}function qd(e,t,n){return Zd(gi(e,t,n))}function Jd(e){return Zd(vi(e))}function Yd(e){return L(e.map(e=>Zd(e)))}function Xd(e){return A(w(e).reduce((t,n)=>({...t,[n]:Xr(e[n])}),{}))}function Zd(e){return un(e)?Kd(e.$defs,e.$ref):mn(e)?qd(e.if,e.then,e.else):M(e)?Jd(e.allOf):R(e)?Yd(e.anyOf):j(e)?Xd(e.properties):A({})}function Qd(e,t={}){return O(`Required`,[e],t)}function $d(e,t){return K([e])?E(Zd(e),{},t):Qd(e,t)}function ef(e,t,n,r){return $d(q(e,t,n),r)}function tf(e,t={}){return O(`ReturnType`,[e],t)}function nf(e){return Wt(e)?e.returnType:k()}function rf(e,t){return K([e])?E(nf(e),{},t):tf(e,t)}function af(e,t,n,r={}){return rf(q(e,t,n),r)}function of(e,t){return O(`With`,[e,t],{})}function sf(e,t){return cf(e,t)}function cf(e,t){return K([e])?E(e,{},t):of(e,t)}function lf(e,t,n,r){return cf(q(e,t,n),r)}function uf(e){return Qi(e)?z(e.items)?df(e.items.items):fn(e.items)||qt(e.items)?[e]:[k()]:[e]}function df(e){return e.reduce((e,t)=>[...e,...uf(t)],[])}function ff(e,t){return{callstack:e,visited:t}}function K(e){return S(e,(e,t)=>!qt(e)&&K(t),()=>!0)}function pf(e,t,n){return w(n).reduce((r,i)=>({...r,[i]:q(e,t,n[i])}),{})}function mf(e,t,n){return df(hf(e,t,n))}function hf(e,t,n){return n.map(n=>q(e,t,n))}function gf(e,t){let n=tn(e)?Ft(t,{}):t,r=Zn(e)?Mt(n,{}):n;return Yn(e)?xf(r,{}):r}function _f(e,t,n,r,i){return x(n,`AddImmutable`)?Sf(e,t,r[0],i):x(n,`RemoveImmutable`)?Jc(e,t,r[0],i):x(n,`AddReadonly`)?Nt(e,t,r[0],i):x(n,`RemoveReadonly`)?Gr(e,t,r[0],i):x(n,`AddOptional`)?It(e,t,r[0],i):x(n,`RemoveOptional`)?Yr(e,t,r[0],i):x(n,`Capitalize`)?fl(e,t,r[0],i):x(n,`Conditional`)?yl(e,t,r[0],r[1],r[2],r[3],i):x(n,`ConstructorParameters`)?Cl(e,t,r[0],i):x(n,`Evaluate`)?vc(e,t,r[0],i):x(n,`Exclude`)?El(e,t,r[0],r[1],i):x(n,`Extract`)?Ml(e,t,r[0],r[1],i):x(n,`Index`)?Eu(e,t,r[0],r[1],i):x(n,`InstanceType`)?Au(e,t,r[0],i):x(n,`Interface`)?Ls(e,t,r[0],r[1],i):x(n,`KeyOf`)?Vu(e,t,r[0],i):x(n,`Lowercase`)?pl(e,t,r[0],i):x(n,`Mapped`)?td(e,t,r[0],r[1],r[2],r[3],i):x(n,`Module`)?ad(e,t,r[0],i):x(n,`NonNullable`)?ld(e,t,r[0],i):x(n,`Pick`)?Nd(e,t,r[0],r[1],i):x(n,`Parameters`)?yd(e,t,r[0],i):x(n,`Partial`)?Od(e,t,r[0],i):x(n,`Omit`)?hd(e,t,r[0],r[1],i):x(n,`ReadonlyObject`)?Wd(e,t,r[0],i):x(n,`Record`)?zi(e,t,r[0],r[1],i):x(n,`Required`)?ef(e,t,r[0],i):x(n,`ReturnType`)?af(e,t,r[0],i):x(n,`TemplateLiteral`)?co(e,t,r[0],i):x(n,`Uncapitalize`)?ml(e,t,r[0],i):x(n,`Uppercase`)?hl(e,t,r[0],i):x(n,`With`)?lf(e,t,r[0],r[1]):O(n,r,i)}function vf(e,t,n){return gf(n,qt(n)?Gd(e,t,n,n.$ref):Rt(n)?Lt(q(e,t,n.items),zt(n)):Gc(n)?Uc(e,t,n.target,n.arguments):Vt(n)?Bt(hf(e,t,n.parameters),q(e,t,n.instanceType),Ht(n)):Wt(n)?Ut(hf(e,t,n.parameters),q(e,t,n.returnType),Gt(n)):mn(n)?pn(q(e,t,n.if),q(e,t,n.then),q(e,t,n.else),hn(n)):M(n)?_n(hf(e,t,n.allOf),vn(n)):j(n)?A(pf(e,t,n.properties),on(n)):Xi(n)?Gi(qi(n),q(e,t,Yi(n))):Qi(n)?Zi(q(e,t,n.items)):z(n)?Vr(mf(e,t,n.items),Hr(n)):R(n)?L(hf(e,t,n.anyOf),br(n)):n)}function q(e,t,n){return At(n)?_f(e,t,n.action,n.parameters,n.options):vf(e,t,n)}function yf(e,t){return q(e,ff([],[]),t)}function bf(e){return E(e,{"~immutable":!0},{})}function xf(e,t){return E(bf(e),{},t)}function Sf(e,t,n,r){return xf(q(e,t,n),r)}function Cf(e,t={}){return xf(e,t)}function wf(e,t={}){return _c(e,t)}function Tf(e,t){let n=dc(e,t);return x(n,`right-inside`)?1:+!!x(n,`disjoint`)}function Ef(e,t,n=[]){return S(t,(r,i)=>x(Tf(e,r),1)?Ef(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function Df(e,t=[]){return S(e,(e,n)=>Df(n,Ef(e,t)),()=>t)}function Of(e){return Df(e)}const kf=Symbol.for(`yaml.alias`),Af=Symbol.for(`yaml.document`),jf=Symbol.for(`yaml.map`),Mf=Symbol.for(`yaml.pair`),Nf=Symbol.for(`yaml.scalar`),Pf=Symbol.for(`yaml.seq`),Ff=Symbol.for(`yaml.node.type`),If=e=>!!e&&typeof e==`object`&&e[Ff]===kf,Lf=e=>!!e&&typeof e==`object`&&e[Ff]===Af,Rf=e=>!!e&&typeof e==`object`&&e[Ff]===jf,J=e=>!!e&&typeof e==`object`&&e[Ff]===Mf,Y=e=>!!e&&typeof e==`object`&&e[Ff]===Nf,zf=e=>!!e&&typeof e==`object`&&e[Ff]===Pf;function Bf(e){if(e&&typeof e==`object`)switch(e[Ff]){case jf:case Pf:return!0}return!1}function X(e){if(e&&typeof e==`object`)switch(e[Ff]){case kf:case jf:case Nf:case Pf:return!0}return!1}const Vf=e=>(Y(e)||Bf(e))&&!!e.anchor,Hf=Symbol(`break visit`),Uf=Symbol(`skip children`),Wf=Symbol(`remove node`);function Gf(e,t){let n=qf(t);Lf(e)?Kf(null,e.contents,n,Object.freeze([e]))===Wf&&(e.contents=null):Kf(null,e,n,Object.freeze([]))}Gf.BREAK=Hf,Gf.SKIP=Uf,Gf.REMOVE=Wf;function Kf(e,t,n,r){let i=Jf(e,t,n,r);if(X(i)||J(i))return Yf(e,r,i),Kf(e,i,n,r);if(typeof i!=`symbol`){if(Bf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Kf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Hf)return Hf;else i===Wf&&(t.items.splice(e,1),--e)}}else if(J(t)){r=Object.freeze(r.concat(t));let e=Kf(`key`,t.key,n,r);if(e===Hf)return Hf;e===Wf&&(t.key=null);let i=Kf(`value`,t.value,n,r);if(i===Hf)return Hf;i===Wf&&(t.value=null)}}return i}function qf(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Jf(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Rf(t))return n.Map?.(e,t,r);if(zf(t))return n.Seq?.(e,t,r);if(J(t))return n.Pair?.(e,t,r);if(Y(t))return n.Scalar?.(e,t,r);if(If(t))return n.Alias?.(e,t,r)}function Yf(e,t,n){let r=t[t.length-1];if(Bf(r))r.items[e]=n;else if(J(r))e===`key`?r.key=n:r.value=n;else if(Lf(r))r.contents=n;else{let e=If(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function Xf(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Zf(e,t,n,r){if(r&&typeof r==`object`)if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Zf(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Zf(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Zf(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Zf(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function Qf(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Qf(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Vf(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var $f=class{constructor(e){Object.defineProperty(this,Ff,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Lf(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Qf(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Zf(i,{"":o},``,o):o}},ep=class extends $f{constructor(e){super(kf),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Gf(e,{Node:(e,t)=>{(If(t)||Vf(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}return r}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r,t);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(Qf(a,null,t),n.get(a)),o?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=tp(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Xf(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function tp(e,t,n){if(If(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Bf(t)){let r=0;for(let i of t.items){let t=tp(e,i,n);t>r&&(r=t)}return r}if(J(t)){let r=tp(e,t.key,n),i=tp(e,t.value,n);return Math.max(r,i)}return 1}const np=e=>!e||typeof e!=`function`&&typeof e!=`object`;var Z=class extends $f{constructor(e){super(Nf),this.value=e}toJSON(e,t){return t?.keep?this.value:Qf(this.value,e,t)}toString(){return String(this.value)}};Z.BLOCK_FOLDED=`BLOCK_FOLDED`,Z.BLOCK_LITERAL=`BLOCK_LITERAL`,Z.PLAIN=`PLAIN`,Z.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Z.QUOTE_SINGLE=`QUOTE_SINGLE`;function rp(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function ip(e,t,n){if(Lf(e)&&(e=e.contents),X(e))return e;if(J(e)){let t=n.schema[jf].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new ep(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=rp(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Z(e);return c&&(c.node=t),t}l=e instanceof Map?o[jf]:Symbol.iterator in Object(e)?o[Pf]:o[jf]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new Z(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ap(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return ip(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const op=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var sp=class extends $f{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>X(t)||J(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(op(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Bf(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ap(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Bf(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&Y(i)?i.value:i:Bf(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!J(t))return!1;let n=t.value;return n==null||e&&Y(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Bf(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Bf(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ap(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const cp=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function lp(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const up=(e,t,n)=>e.endsWith(`
4
+ `)?lp(n,t):n.includes(`
5
+ `)?`
6
+ `+lp(n,t):(e.endsWith(` `)?``:` `)+n,dp=`flow`;function fp(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,ee=-1;n===`block`&&(h=pp(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}ee=h}if(r===`
7
+ `)n===`block`&&(h=pp(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
8
+ `&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
9
+ `&&t!==` `&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>ee+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let _=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?_=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(_+=`${e[i]}\\`),_+=`\n${t}${e.slice(i+1,a)}`)}return _}function pp(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
10
+ `);r=t,i=t+1,a=e[i]}return r}const mp=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),hp=e=>/^(%|---|\.\.\.)/m.test(e);function gp(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
11
+ `){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function _p(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(hp(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
12
+
13
+ `;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
14
+ `,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:fp(o,a,`quoted`,mp(t,!1))}function vp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
15
+ `)||/[ \t]\n|\n[ \t]/.test(e))return _p(e,t);let n=t.indent||(hp(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:fp(r,n,dp,mp(t,!1))}function yp(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=_p;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?vp:i&&!t?_p:n?vp:_p}return r(e,t)}let bp;try{bp=RegExp(`(^|(?<!
16
+ ))
17
+ +(?!
18
+ |$)`,`g`)}catch{bp=/\n+(?!\n|$)/g}function xp({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return yp(n,r);let l=r.indent||(r.forceBlockIndent||hp(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Z.BLOCK_FOLDED?!1:t===Z.BLOCK_LITERAL||!gp(n,c,l.length);if(!n)return u?`|
19
+ `:`>
20
+ `;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
21
+ `&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
22
+ `);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
23
+ `&&(p=p.slice(0,-1)),p.replace(bp,`$&${l}`));let h=!1,g,ee=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
24
+ `)ee=g;else break}let _=n.substring(0,ee<g?ee+1:g);_&&=(n=n.substring(_.length),_.replace(/\n+/g,`$&${l}`));let te=(h?l?`2`:`1`:``)+d;if(e&&(te+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
25
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=mp(r,!0);o!==`folded`&&t!==Z.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=fp(`${_}${e}${p}`,l,`block`,a);if(!i)return`>${te}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${te}\n${l}${_}${n}${p}`}function Sp(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
26
+ `)||u&&/[[\]{},]/.test(a))return yp(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
27
+ `)?yp(a,t):xp(e,t,n,r);if(!s&&!u&&i!==Z.PLAIN&&a.includes(`
28
+ `))return xp(e,t,n,r);if(hp(a)){if(c===``)return t.forceBlockIndent=!0,xp(e,t,n,r);if(s&&c===l)return yp(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return yp(a,t)}return s?d:fp(d,c,dp,mp(t,!1))}function Cp(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==Z.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=Z.QUOTE_DOUBLE);let c=e=>{switch(e){case Z.BLOCK_FOLDED:case Z.BLOCK_LITERAL:return i||a?yp(o.value,t):xp(o,t,n,r);case Z.QUOTE_DOUBLE:return _p(o.value,t);case Z.QUOTE_SINGLE:return vp(o.value,t);case Z.PLAIN:return Sp(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function wp(e,t){let n=Object.assign({blockQuote:!0,commentString:cp,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Tp(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(Y(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Ep(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(Y(e)||Bf(e))&&e.anchor;a&&Xf(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Dp(e,t,n,r){if(J(e))return e.toString(t,n,r);if(If(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=X(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Tp(t.doc.schema.tags,a);let o=Ep(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):Y(a)?Cp(a,t,n,r):a.toString(t,n,r);return o?Y(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Op({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=X(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Bf(e)||!X(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Bf(e)||(Y(e)?e.type===Z.BLOCK_FOLDED||e.type===Z.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Dp(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=up(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=up(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=up(g,n.indent,l(f))));let ee,_,te;X(t)?(ee=!!t.spaceBefore,_=t.commentBefore,te=t.comment):(ee=!1,_=null,te=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&Y(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&zf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ne=!1,re=Dp(t,n,()=>ne=!0,()=>h=!0),ie=` `;if(f||ee||_){if(ie=ee?`
29
+ `:``,_){let e=l(_);ie+=`\n${lp(e,n.indent)}`}re===``&&!n.inFlow?ie===`
30
+ `&&te&&(ie=`
31
+
32
+ `):ie+=`\n${n.indent}`}else if(!p&&Bf(t)){let e=re[0],r=re.indexOf(`
33
+ `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=re.indexOf(` `);e===`&`&&n!==-1&&n<r&&re[n+1]===`!`&&(n=re.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(ie=`\n${n.indent}`)}}else(re===``||re[0]===`
34
+ `)&&(ie=``);return g+=ie+re,n.inFlow?ne&&r&&r():te&&!ne?g+=up(g,n.indent,l(te)):h&&i&&i(),g}function kp(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}const Ap={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Z(Symbol(`<<`)),{addToJSMap:Mp}),stringify:()=>`<<`},jp=(e,t)=>(Ap.identify(t)||Y(t)&&(!t.type||t.type===Z.PLAIN)&&Ap.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Ap.tag&&e.default);function Mp(e,t,n){let r=Pp(e,n);if(zf(r))for(let n of r.items)Np(e,t,n);else if(Array.isArray(r))for(let n of r)Np(e,t,n);else Np(e,t,r)}function Np(e,t,n){let r=Pp(e,n);if(!Rf(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Pp(e,t){return e&&If(t)?t.resolve(e.doc,e):t}function Fp(e,t,{key:n,value:r}){if(X(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(jp(e,n))Mp(e,t,r);else{let i=Qf(n,``,e);if(t instanceof Map)t.set(i,Qf(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Ip(n,i,e),o=Qf(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Ip(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(X(e)&&n?.doc){let t=wp(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),kp(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Lp(e,t,n){return new Rp(ip(e,void 0,n),ip(t,void 0,n))}var Rp=class e{constructor(e,t=null){Object.defineProperty(this,Ff,{value:Mf}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return X(n)&&(n=n.clone(t)),X(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Fp(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Op(this,e,t,n):JSON.stringify(this)}};function zp(e,t,n){return(t.inFlow??e.flow?Vp:Bp)(e,t,n)}function Bp({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(X(i))!d&&i.spaceBefore&&f.push(``),Hp(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(J(i)){let e=X(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Hp(n,f,e.commentBefore,d))}d=!1;let s=Dp(i,u,()=>o=null,()=>d=!0);o&&(s+=up(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
35
+ `}}return e?(p+=`
36
+ `+lp(l(e),c),s&&s()):d&&o&&o(),p}function Vp({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(X(i))i.spaceBefore&&d.push(``),Hp(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(J(i)){let e=X(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Hp(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=X(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Dp(i,c,()=>a=null);l||=d.length>u||o.includes(`
37
+ `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=up(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
38
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Hp({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=lp(t(r),e);n.push(i.trimStart())}}function Up(e,t){let n=Y(t)?t.value:t;for(let r of e)if(J(r)&&(r.key===t||r.key===n||Y(r.key)&&r.key.value===n))return r}var Wp=class extends sp{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(jf,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Lp(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=J(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Rp(e,e?.value):new Rp(e.key,e.value);let r=Up(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);Y(r.value)&&np(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Up(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Up(this.items,e)?.value;return(!t&&Y(n)?n.value:n)??void 0}has(e){return!!Up(this.items,e)}set(e,t){this.add(new Rp(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Fp(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!J(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),zp(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};const Gp={collection:`map`,default:!0,nodeClass:Wp,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Rf(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Wp.from(e,t,n)};var Kp=class extends sp{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Pf,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=qp(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=qp(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&Y(r)?r.value:r}has(e){let t=qp(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=qp(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];Y(r)&&np(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Qf(e,String(r++),t));return n}toString(e,t,n){return e?zp(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(ip(a,void 0,n))}}return i}};function qp(e){let t=Y(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}const Jp={collection:`seq`,default:!0,nodeClass:Kp,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return zf(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Kp.from(e,t,n)};function Yp(e){return typeof e==`bigint`||Number.isInteger(e)}const Xp=({value:e})=>JSON.stringify(e),Zp=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Xp},{identify:e=>e==null,createNode:()=>new Z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Xp},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Xp},{identify:Yp,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Yp(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Xp}];[Gp,Jp].concat(Zp,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function Qp(e,t,n){let{replacer:r}=n,i=new Kp(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e))if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`);else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Lp(o,s,n))}return i}var $p=class e extends Kp{constructor(){super(),this.add=Wp.prototype.add.bind(this),this.delete=Wp.prototype.delete.bind(this),this.get=Wp.prototype.get.bind(this),this.has=Wp.prototype.has.bind(this),this.set=Wp.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(J(e)?(r=Qf(e.key,``,t),i=Qf(e.value,r,t)):r=Qf(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Qp(e,t,n),i=new this;return i.items=r.items,i}};$p.tag=`tag:yaml.org,2002:omap`;var em=class e extends Wp{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=J(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Rp(e.key,null):new Rp(e,null),Up(this.items,t.key)||this.items.push(t)}get(e,t){let n=Up(this.items,e);return!t&&J(n)?Y(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Up(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Rp(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Lp(e,null,n));return i}};em.tag=`tag:yaml.org,2002:set`;const tm=Symbol(`break visit`),nm=Symbol(`skip children`),rm=Symbol(`remove item`);function im(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),am(Object.freeze([]),e,t)}im.BREAK=tm,im.SKIP=nm,im.REMOVE=rm,im.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},im.parentCollection=(e,t)=>{let n=im.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function am(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=am(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===tm)return tm;else r===rm&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}t(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.{0,2}\/|^\.{1,2}$/,l=/\/$/,u=`node-ignore`;typeof Symbol<`u`&&(u=Symbol.for(`node-ignore`));let d=u,f=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),p=/([0-z])-([0-z])/g,m=()=>!1,h=e=>e.replace(p,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),g=e=>{let{length:t}=e;return e.slice(0,t-t%2)},ee=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${g(r)}${i}`:i===`]`&&r.length%2==0?`[${h(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],_=/(^|\\\/)?\\\*$/,te=`regex`,ne=`checkRegex`,re={[te](e,t){return`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`},[ne](e,t){return`${t?`${t}[^/]*`:`[^/]*`}(?=$|\\/$)`}},ie=e=>ee.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),ae=e=>typeof e==`string`,oe=e=>e&&ae(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,se=e=>e.split(s).filter(Boolean);var ce=class{constructor(e,t,n,r,i,a){this.pattern=e,this.mark=t,this.negative=i,f(this,`body`,n),f(this,`ignoreCase`,r),f(this,`regexPrefix`,a)}get regex(){let e=`_regex`;return this[e]?this[e]:this._make(te,e)}get checkRegex(){let e=`_checkRegex`;return this[e]?this[e]:this._make(ne,e)}_make(e,t){let n=this.regexPrefix.replace(_,re[e]),r=this.ignoreCase?new RegExp(n,`i`):new RegExp(n);return f(this,t,r)}};let le=({pattern:e,mark:t},n)=>{let r=!1,i=e;i.indexOf(`!`)===0&&(r=!0,i=i.substr(1)),i=i.replace(a,`!`).replace(o,`#`);let s=ie(i);return new ce(e,t,i,n,r,s)};var ue=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[d]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(ae(e)&&(e={pattern:e}),oe(e.pattern)){let t=le(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(ae(e)?se(e):e).forEach(this._add,this),this._added}test(e,t,n){let r=!1,i=!1,a;this._rules.forEach(o=>{let{negative:s}=o;i===s&&r!==i||s&&!r&&!i&&!t||o[n].test(e)&&(r=!s,i=s,a=s?void 0:o)});let o={ignored:r,unignored:i};return a&&(o.rule=a),o}};let v=(e,t)=>{throw new t(e)},y=(e,t,n)=>ae(e)?e?!y.isNotRelative(e)||n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),de=e=>c.test(e);y.isNotRelative=de,y.convert=e=>e;var fe=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){f(this,d,!0),this._rules=new ue(t),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,t,n,r){let i=e&&y.convert(e);return y(i,e,this._strictPathCheck?v:m),this._t(i,t,n,r)}checkIgnore(e){if(!l.test(e))return this.test(e);let t=e.split(`/`).filter(Boolean);if(t.pop(),t.length){let e=this._t(t.join(`/`)+`/`,this._testCache,!0,t);if(e.ignored)return e}return this._rules.test(e,!1,ne)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`).filter(Boolean),r.pop(),!r.length)return t[e]=this._rules.test(e,n,te);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._rules.test(e,n,te)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let pe=e=>new fe(e),me=e=>y(e&&y.convert(e),e,m),he=()=>{y.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;y.isNotRelative=t=>e.test(t)||de(t)};typeof process<`u`&&process.platform===`win32`&&he(),t.exports=pe,pe.default=pe,t.exports.isPathValid=me,f(t.exports,Symbol.for(`setupWindows`),he)}))(),globalThis.Buffer,A({command:vr({description:`Bash command to execute`}),timeout:en(mr({description:`Timeout in seconds (optional, no default timeout)`}))});var om=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}};new class extends om{};function sm(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function cm(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function lm(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function um(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function dm(e,t){return lm(e,t,``)}function fm(e,t){return um(e,t,``)}function pm(e,t){return t.slice(0,mm(e,t))}function mm(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function hm(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function gm(e,t){if(t)return vm(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function _m(e,t){if(t)return vm(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function vm(e,t){if(!t)return[_m(e),gm(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=hm(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}const ym=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,bm=RegExp(`[${ym}]+|\\s+|[^${ym}]`,`ug`);new class extends om{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=hm(e,r)}else n=e.match(bm)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&xm(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&xm(n,i,r,null,t.intlSegmenter),e}};function xm(e,t,n,r,i){if(t&&n){let[a,o]=vm(t.value,i),[s,c]=vm(n.value,i);if(e){let r=sm(a,s);e.value=um(e.value,s,r),t.value=dm(t.value,r),n.value=dm(n.value,r)}if(r){let e=cm(o,c);r.value=lm(r.value,c,e),t.value=fm(t.value,e),n.value=fm(n.value,e)}}else if(n){if(e){let e=_m(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=_m(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=_m(r.value,i),[a,o]=vm(t.value,i),s=sm(n,a);t.value=dm(t.value,s);let c=cm(dm(n,s),o);t.value=fm(t.value,c),r.value=lm(r.value,n,c),e.value=um(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=_m(r.value,i),n=pm(gm(t.value,i),e);t.value=fm(t.value,n)}else if(e){let n=pm(gm(e.value,i),_m(t.value,i));t.value=dm(t.value,n)}}new class extends om{tokenize(e){let t=RegExp(`(\\r?\\n)|[${ym}]+|[^\\S\\n\\r]+|[^${ym}]`,`ug`);return e.match(t)||[]}},new class extends om{constructor(){super(...arguments),this.tokenize=Sm}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
39
+ `))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
40
+ `))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
41
+ `)&&(e=e.slice(0,-1)),t.endsWith(`
42
+ `)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Sm(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
43
+ `));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Cm(e){return e==`.`||e==`!`||e==`?`}new class extends om{tokenize(e){let t=[],n=0;for(let r=0;r<e.length;r++){if(r==e.length-1){t.push(e.slice(n));break}if(Cm(e[r])&&e[r+1].match(/\s/)){for(t.push(e.slice(n,r+1)),r=n=r+1;e[r+1]?.match(/\s/);)r++;t.push(e.slice(n,r+1)),n=r+1}}return t}},new class extends om{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends om{constructor(){super(...arguments),this.tokenize=Sm}get useLongestToken(){return!0}castInput(e,t){let{undefinedReplacement:n,stringifyReplacer:r=(e,t)=>t===void 0?n:t}=t;return typeof e==`string`?e:JSON.stringify(wm(e,null,null,r),null,` `)}equals(e,t,n){return super.equals(e.replace(/,([\r\n])/g,`$1`),t.replace(/,([\r\n])/g,`$1`),n)}};function wm(e,t,n,r,i){t||=[],n||=[],r&&(e=r(i===void 0?``:i,e));let a;for(a=0;a<t.length;a+=1)if(t[a]===e)return n[a];let o;if(Object.prototype.toString.call(e)===`[object Array]`){for(t.push(e),o=Array(e.length),n.push(o),a=0;a<e.length;a+=1)o[a]=wm(e[a],t,n,r,String(a));return t.pop(),n.pop(),o}if(e&&e.toJSON&&(e=e.toJSON()),typeof e==`object`&&e){t.push(e),o={},n.push(o);let i=[],s;for(s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.push(s);for(i.sort(),a=0;a<i.length;a+=1)s=i[a],o[s]=wm(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends om{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};const Tm=A({oldText:vr({description:`Exact text for one targeted replacement. It must be unique in the original file and must not overlap with any other edits[].oldText in the same call.`}),newText:vr({description:`Replacement text for this targeted edit.`})},{});A({path:vr({description:`Path to the file to edit (relative or absolute)`}),edits:Lt(Tm,{description:`One or more targeted replacements. Each edit is matched against the original file, not incrementally. Do not include overlapping or nested edits. If two changes touch the same block or nearby lines, merge them into one edit instead.`})},{}),A({path:vr({description:`Path to the file to read (relative or absolute)`}),offset:en(mr({description:`Line number to start reading from (1-indexed)`})),limit:en(mr({description:`Maximum number of lines to read`}))}),A({path:vr({description:`Path to the file to write (relative or absolute)`}),content:vr({description:`Content to write to the file`})});const Em={enabled:!0,reserveTokens:16384,keepRecentTokens:2e4};function Dm(e,t,n){return n.enabled?e>t-n.reserveTokens:!1}function Om(e){if(typeof e==`string`)return e.length;let t=0;for(let n of e)n.type===`text`&&n.text?t+=n.text.length:n.type===`image`&&(t+=4800);return t}function km(e){let t=0;switch(e.role){case`user`:return t=Om(e.content),Math.ceil(t/4);case`assistant`:{let n=e;for(let e of n.content)e.type===`text`?t+=e.text.length:e.type===`thinking`?t+=e.thinking.length:e.type===`toolCall`&&(t+=e.name.length+JSON.stringify(e.arguments).length);return Math.ceil(t/4)}case`custom`:case`toolResult`:return t=Om(e.content),Math.ceil(t/4);case`bashExecution`:return t=e.command.length+e.output.length,Math.ceil(t/4);case`branchSummary`:case`compactionSummary`:return t=e.summary.length,Math.ceil(t/4)}return 0}const Am=n(`context-compaction`);function jm(e,t){return e.role===t}function Mm(e){let t=0;for(;t<e.length&&jm(e[t],`toolResult`);){let n=e[t];Am.warn(`Dropping orphaned toolResult (no preceding assistant message)`,{toolCallId:n.toolCallId}),t++}return t>0?e.slice(t):e}function Nm(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${Pm(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${Pm(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${Pm(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${Pm(e.content)}\n</${e.role}>`)}}return t.join(`
44
+
45
+ `)}function Pm(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
46
+ `)}function Fm(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
47
+
48
+ Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
49
+
50
+ <conversation>
51
+ ${e}
52
+ </conversation>`}async function Im(e,t,n,r,i,a,o){let s=await h(e,{systemPrompt:n,messages:[{role:`user`,content:[{type:`text`,text:r}],timestamp:Date.now()}]},{maxTokens:i,apiKey:t,headers:a,signal:o});if(s.stopReason===`error`)throw Error(`Compaction call failed: ${s.errorMessage||`Unknown error`}`);return s.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
53
+ `).trim()}function Lm(e){if(typeof e==`string`)return e.length;if(!Array.isArray(e))return 0;let t=0;for(let n of e){let e=n;if(e.type===`text`&&e.text)t+=e.text.length;else if(e.type===`thinking`&&e.thinking)t+=e.thinking.length;else if(e.type===`toolCall`&&e.arguments!==void 0)try{t+=JSON.stringify(e.arguments).length}catch{}else e.type===`image`&&e.source?.data&&(t+=e.source.data.length)}return t}function Rm(e,t){let n=Math.max(1,Math.round(e/1024));return`[${t===`assistant`?`Assistant message elided`:`Tool result elided`}: ${n} KB, exceeds half the context window. Re-run with smaller arguments — e.g. open --view --size low.]`}function zm(e){let t=e.role,n=e.content,r=Lm(n);if(t===`toolResult`)return{...e,content:[{type:`text`,text:Rm(r,t)}]};let i=(Array.isArray(n)?n.filter(e=>e.type===`toolCall`):[]).map(e=>{let t=0;if(e.arguments!==void 0)try{t=JSON.stringify(e.arguments).length}catch{}return{type:e.type,id:e.id,name:e.name,arguments:{elided:!0,originalBytes:t}}});return{...e,content:[{type:`text`,text:Rm(r,t)},...i]}}function Bm(e,t,n){let r=(t-n)/2,i=0,a=0;return{messages:e.map(e=>{let t=Gm(e);if(t!==e&&(i++,a+=Lm(e.content)-Lm(t.content)),km(t)<=r)return t;let n=t.role;if(n!==`toolResult`&&n!==`assistant`)return t;let o=t,s=Lm(o.content);return n===`toolResult`?(i++,a+=s,zm(t)):(Array.isArray(o.content)?o.content:[]).filter(e=>e.type===`toolCall`).length===0?t:(i++,a+=s,zm(t))}),elidedCount:i,elidedBytes:a}}function Vm(e){let t=0;for(let n of e)t+=km(n);return t}function Hm(e,t){return e.length!==t.length||e.some((e,n)=>e!==t[n])}function Um(e,t){try{e.onCompactionStateChange?.(t)}catch(e){Am.warn(`onCompactionStateChange listener threw`,{error:e instanceof Error?e.message:String(e)})}}function Wm(e,t,n,r,i,a){if(t<=n*i)return{messages:e,isHopeless:!1,earlyReturn:null};let o=Bm(e,n,r),s=o.messages;return Am.warn(`Compaction hopeless branch`,{totalTokens:t,contextWindow:n,multiplier:i,elidedCount:o.elidedCount,elidedBytes:o.elidedBytes}),{messages:s,isHopeless:!0,earlyReturn:Dm(Vm(s),n,a)?null:s}}function Gm(e){let t=e.content;if(!Array.isArray(t))return e;let n=!1,r=t.map(e=>{let t=e;return t.type===`image`?(n=!0,{type:`text`,text:`[image elided during compaction: ~${Math.max(1,Math.round((t.source?.data??t.data??``).length/1024))} KB. Re-attach or re-read the image if it is still needed.]`}):e});return n?{...e,content:r}:e}function Km(e){for(let t=e.length-1;t>=0;t--)if(jm(e[t],`user`))return t;return-1}function qm(e,t,n,r){let i=Km(t),a=t.map((e,t)=>i!==-1&&t>=i?e:Gm(e));if(Dm(Vm([...e,...a]),n,r))for(let t=0;t<a.length;t++){let i=Gm(a[t]);if(i!==a[t]&&(a=[...a.slice(0,t),i,...a.slice(t+1)],!Dm(Vm([...e,...a]),n,r)))break}return a}function Jm(e,t){let n=0,r=e.length;for(let i=e.length-1;i>=0;i--){let a=km(e[i]);if(n+a>t&&r<e.length)break;n+=a,r=i}for(;r>0&&jm(e[r],`toolResult`);)r--;return r<=0||r>=e.length?(Am.warn(`Cannot find valid cut point for compaction`),null):{messagesToSummarize:e.slice(0,r),messagesToKeep:Mm(e.slice(r))}}async function Ym(e,t,n,r){if(e.onMemoryUpdates)try{Um(e,`extracting-memory`);let i=await Im(e.model,t,n,`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
54
+
55
+ Focus on:
56
+ - User preferences, working style, opinions stated explicitly.
57
+ - Stable project facts (architecture decisions, conventions, constraints).
58
+ - Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
59
+ - External resources/links the user named.
60
+
61
+ DO NOT include:
62
+ - Ephemeral state (current task, in-progress work).
63
+ - Information already obvious from the codebase (file paths, function names, framework conventions).
64
+ - Generic restatements of what the conversation was about.
65
+
66
+ If nothing in the conversation is worth persisting, return exactly the single line:
67
+ NONE
68
+
69
+ Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`,2048,e.headers,r);if(i?.trim()&&i.trim()!==`NONE`)try{await e.onMemoryUpdates(i.trim()),Am.info(`Memory extraction applied`,{bulletsLength:i.length})}catch(e){Am.warn(`onMemoryUpdates callback threw`,{error:e instanceof Error?e.message:String(e)})}else Am.info(`Memory extraction returned no durable memories`)}catch(e){Am.warn(`Memory extraction call failed (compaction still applied)`,{error:e instanceof Error?e.message:String(e)})}}async function Xm(e,t,n,r,i,a,o){try{let s=Fm(Nm(n)),c=Math.floor(.8*i);Um(e,`summarizing`);let l=await Im(e.model,t,s,`Produce a structured context checkpoint summary of the conversation above that another LLM can use to continue the work.
70
+
71
+ Use this EXACT format:
72
+
73
+ ## Goal
74
+ [What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
75
+
76
+ ## Constraints & Preferences
77
+ - [Any constraints, preferences, or requirements mentioned by user]
78
+ - [Or "(none)" if none were mentioned]
79
+
80
+ ## Progress
81
+ ### Done
82
+ - [x] [Completed tasks/changes]
83
+
84
+ ### In Progress
85
+ - [ ] [Current work]
86
+
87
+ ### Blocked
88
+ - [Issues preventing progress, if any]
89
+
90
+ ## Key Decisions
91
+ - **[Decision]**: [Brief rationale]
92
+
93
+ ## Next Steps
94
+ 1. [Ordered list of what should happen next]
95
+
96
+ ## Critical Context
97
+ - [Any data, examples, or references needed to continue]
98
+ - [Or "(none)" if not applicable]
99
+
100
+ Keep each section concise. Preserve exact file paths, function names, and error messages. Output ONLY the summary, with no preamble or follow-up.`,c,e.headers,o),u={role:`user`,content:[{type:`text`,text:`<context-summary>\n${l}\n</context-summary>`}],timestamp:Date.now()};return Am.info(`LLM summarization successful`,{originalMessages:a,compactedMessages:1+r.length,summaryLength:l.length}),await Ym(e,t,s,o),Um(e,`idle`),[u,...r]}catch(e){return Am.warn(`LLM summarization failed, falling back to naive drop`,{error:e instanceof Error?e.message:String(e)}),null}}function Zm(e){let t=e.contextWindow??2e5,n=e.reserveTokens??Em.reserveTokens,r=e.keepRecentTokens??Em.keepRecentTokens,i=e.hopelessMultiplier??4,a={enabled:!0,reserveTokens:n,keepRecentTokens:r};return async(o,s,c)=>{if(o.length===0)return o;let l=Vm(o);if(!c?.force&&!Dm(l,t,a))return o;let u=Wm(o,l,t,n,i,a);if(u.earlyReturn)return u.earlyReturn;let d=u.messages,f=u.isHopeless;Am.info(`Context compaction triggered`,{totalTokens:l,contextWindow:t,threshold:t-n,messageCount:d.length});let p=Jm(d,r);if(!p)return d;let{messagesToSummarize:m,messagesToKeep:h}=p;Am.info(`Compaction cut point`,{summarizing:m.length,keeping:h.length});let g=f?void 0:e.getApiKey();if(g){let r=await Xm(e,g,m,h,n,o.length,s);if(r){let[e,...n]=r;return[e,...qm([e],n,t,a)]}}else f||Am.warn(`No API key available for LLM summarization, falling back to naive drop`);Um(e,`fallback`),Um(e,`idle`);let ee={role:`user`,content:[{type:`text`,text:`[Earlier conversation messages were compacted to save context space]`}],timestamp:Date.now()},_=qm([ee],h,t,a);return Am.info(`Naive compaction applied`,{originalMessages:o.length,compactedMessages:1+_.length}),[ee,..._]}}function Qm(){return d()?`extension-direct`:c()?`extension-delegate`:globalThis.__slicc_connect_mode?`connect`:`node-rest`}function $m(){return Qm()===`node-rest`}const eh=te({portName:`secrets.crud`,panelRpcOp:`secrets-bridge`,timeoutMs:1e4,onUnavailable:`resolve-undefined`,makeError:e=>Error(e),logNamespace:`secrets-bridge`,toPortMessage:({type:e,payload:t})=>({type:e,...t}),toPanelRpcPayload:({type:e,payload:t})=>({type:e,payload:t})});function th(e,t){return eh({type:e,payload:t})}const nh=n(`secret-scrub`),rh=async e=>e;function ih(){let e=Qm();return e===`extension-direct`?async e=>{if(!e)return e;try{let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.scrub-tool-result`,text:e},e=>t(e??{}))});return t.error?(nh.debug(`SW scrub-tool-result returned error`,{error:t.error}),e):typeof t.text==`string`?t.text:e}catch(t){return nh.debug(`SW scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}:e===`extension-delegate`?async e=>{if(!e)return e;try{let t=await th(`secrets.scrub-tool-result`,{text:e});return t?.error?(nh.debug(`Bridge scrub-tool-result returned error`,{error:t.error}),e):typeof t?.text==`string`?t.text:e}catch(t){return nh.debug(`Bridge scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}:e===`connect`?rh:async e=>{if(!e)return e;try{let t=await fetch(l(`/api/secrets/scrub`),{method:`POST`,headers:u({"content-type":`application/json`}),body:JSON.stringify({text:e})});if(!t.ok)return nh.debug(`Server scrub-tool-result returned non-ok`,{status:t.status}),e;let n=await t.json();return typeof n.text==`string`?n.text:e}catch(t){return nh.debug(`Server scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}}const ah=n(`tool-adapter`);function oh(e){let t=[],n=0;for(let r of e.matchAll(oe())){let i=ie(r[0]);if(!i)continue;let a=e.slice(n,r.index);a.trim()&&t.push({type:`text`,text:a.trimEnd()}),t.push({type:`image`,mimeType:i.mimeType,data:i.data}),n=r.index+r[0].length}let r=e.slice(n);return(r.trim()||t.length===0)&&t.push({type:`text`,text:r||e}),t}async function sh(e){let t=oh(e),n=[];for(let e of t)e.type===`image`?n.push(await ae(e)):n.push(e);return n}function ch(e,t,n,r){if(!r)return{tracked:null,effectiveSignal:n};let i=r.processManager.spawn({kind:`tool`,argv:[e.name,...mh(t)],owner:r.owner,ppid:r.getParentPid?.()});n?.aborted?r.processManager.signal(i.pid,`SIGINT`):n&&n.addEventListener(`abort`,()=>r.processManager.signal(i.pid,`SIGINT`),{once:!0});let a=r.processManager.onSignal((e,t)=>{e.pid===i.pid&&t===`SIGKILL`&&r.processManager.exit(i.pid,null)});return{tracked:{record:i,manager:r.processManager,unsubscribeKill:a},effectiveSignal:i.abort.signal}}function lh(e,t){e&&e.manager.exit(e.record.pid,t)}async function uh(e,t,n){if(!n||typeof e!=`string`||e.length===0)return e;try{return await n.scrubToolResult(e)}catch(n){return ah.warn(`Tool-result scrub failed, falling back to unscrubbed content`,{tool:t,error:n instanceof Error?n.message:String(n)}),e}}async function dh(e,t){try{return await sh(e)}catch(n){return ah.warn(`Image processing failed, falling back to raw content`,{tool:t,error:n instanceof Error?n.message:String(n)}),oh(e)}}function fh(e,t,n){return{name:e.name,label:e.name,description:e.description,parameters:e.inputSchema,async execute(r,i,a,o){let s;o&&(s=ne({onUpdate:o,toolName:e.name,toolCallId:r}));let c=ch(e,i,a,t);try{let t=await e.execute(i??{},c.effectiveSignal),r=await dh(await uh(t.content,e.name,n),e.name);return lh(c.tracked,+!!t.isError),{content:r,details:{isError:t.isError}}}catch(e){throw lh(c.tracked,c.tracked?.record.abort.signal.aborted?null:1),e}finally{s&&re(s),c.tracked?.unsubscribeKill()}}}}function ph(e,t,n){return e.map(e=>fh(e,t,n))}function mh(e){if(typeof e!=`object`||!e)return[];let t=e;for(let e of[`command`,`file_path`,`path`,`pattern`,`url`,`key`,`name`,`query`,`message`]){let n=t[e];if(typeof n==`string`&&n.length>0)return[n]}for(let e of Object.values(t))if(typeof e==`string`&&e.length>0)return[e];return[]}function hh(e,t){let n={input:0,output:0,cacheRead:0,cacheWrite:0},r=f(e);if(!r)return n;let i;for(let e of t.values()){let t=f(e.id);!t||t.family!==r.family||(!i||t.major>i.major||t.major===i.major&&t.minor>i.minor)&&(i={major:t.major,minor:t.minor,cost:e.cost})}return i?.cost??n}var gh=e({ACCOUNTS_KEY:()=>yh,__test__:()=>Oh,addAccount:()=>Jh,applyProviderDefaults:()=>Lh,clearAllSettings:()=>bg,clearApiKey:()=>hg,clearBaseUrl:()=>vg,clearSelectedProvider:()=>fg,exportProviders:()=>yg,getAccounts:()=>$,getAllAvailableModels:()=>Vh,getAllExtraOAuthDomains:()=>Gh,getApiKey:()=>pg,getApiKeyForProvider:()=>rg,getApiVersionForProvider:()=>og,getAvailableProviders:()=>kh,getBaseUrl:()=>gg,getBaseUrlForProvider:()=>ig,getDeploymentForProvider:()=>ag,getExtraOAuthDomains:()=>Hh,getOAuthAccountInfo:()=>Fh,getProviderConfig:()=>Mh,getProviderModels:()=>Ph,getRawApiKeyForProvider:()=>ng,getSelectedModelId:()=>sg,getSelectedProvider:()=>ug,isModelHiddenFromPicker:()=>zh,logoutOAuthAccount:()=>Zh,maskOAuthTokenWithRetry:()=>Qh,migrateLegacyAuthOnlySelection:()=>Eh,persistOAuthMaskViaServiceWorker:()=>$h,providerOffersLlmModels:()=>Ah,removeAccount:()=>Xh,resolveCurrentModel:()=>Tg,resolveModelById:()=>wg,resolveModelByShorthand:()=>Eg,resolveModelIdForScoop:()=>Og,saveOAuthAccount:()=>tg,setApiKey:()=>mg,setBaseUrl:()=>_g,setExtraOAuthDomains:()=>Uh,setExtraOAuthDomainsAsync:()=>Wh,setSelectedModelId:()=>cg,setSelectedProvider:()=>dg});const _h=_,vh=p,yh=`slicc_accounts`,bh=`selected-model`,xh=[`slicc_provider`,`slicc_api_key`,`slicc_base_url`,`anthropic_api_key`,`api_provider`,`azure_resource`,`bedrock_region`],Sh=new Set([`github`]);function Ch(e){let t;try{t=m()}catch{return!1}return t.includes(e)&&!o(e)}let wh=!1;function Th(){if(!wh){wh=!0;for(let e of xh)try{localStorage.removeItem(e)}catch{}Eh()}}function Eh(){try{let e=localStorage.getItem(bh);if(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);(Sh.has(n)||Ch(n))&&localStorage.removeItem(bh)}}}catch{}try{let e=localStorage.getItem(yh);if(!e)return;let t=JSON.parse(e);if(!Array.isArray(t))return;let n=t.filter(e=>!(typeof e==`object`&&e&&typeof e.providerId==`string`&&Ch(e.providerId)));n.length!==t.length&&localStorage.setItem(yh,JSON.stringify(n))}catch{}}function Dh(){wh=!1}const Oh={_resetLegacyCleanup:Dh};function kh(){let e=m().filter(o),t=a();return[...new Set([...e,...t])].filter(e=>!s(e)?.hidden)}function Ah(e){try{if(Ph(e).length>0)return!0}catch{}try{if(p(e).length>0)return!0}catch{}let t=s(e);return!!(t?.modelOverrides&&Object.keys(t.modelOverrides).length>0)}function jh(e,t){try{if(Ph(e).some(e=>e.id===t))return!0}catch{}try{if(p(e).some(e=>e.id===t))return!0}catch{}let n=s(e);return!!(n?.modelOverrides&&Object.hasOwn(n.modelOverrides,t))}function Mh(e){return s(e)||{id:e,name:e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),description:`${e} provider`,requiresApiKey:!0,requiresBaseUrl:!1}}function Nh(e,t){t.context_window!==void 0&&(e.contextWindow=t.context_window),t.max_tokens!==void 0&&(e.maxTokens=t.max_tokens),t.reasoning!==void 0&&(e.reasoning=t.reasoning),t.input!==void 0&&(e.input=t.input),t.cost!==void 0&&(e.cost=t.cost,e.inputCost=t.cost.input,e.outputCost=t.cost.output,e.cacheReadCost=t.cost.cacheRead,e.cacheWriteCost=t.cost.cacheWrite),t.compat!==void 0&&(e.compat={...e.compat??{},...t.compat}),t.thinkingLevelMap!==void 0&&(e.thinkingLevelMap={...e.thinkingLevelMap??{},...t.thinkingLevelMap})}function Ph(e){try{if(e===`bedrock-camp`){let e=ee(ig(`bedrock-camp`));return vh(`amazon-bedrock`).filter(t=>g(t,e)).map(e=>({...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}))}let t=Mh(e);if(t.getModelIds){let n;try{n=t.getModelIds()}catch(t){return Q.error(`Provider getModelIds callback failed`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}let r=new Map;for(let e of m())try{for(let t of vh(e))r.set(t.id,t)}catch{}return n.map(n=>{let i=n.api===`openai`?`openai`:`anthropic`,a=`${e}-${i}`,o=r.get(n.id),s;if(o)s={...o,api:a,provider:e};else if(s=Sg(e,n.id,``,a),n.name&&(s.name=n.name),i===`anthropic`){let e=hh(n.id,r);s.cost=e,s.inputCost=e.input,s.outputCost=e.output,s.cacheReadCost=e.cacheRead,s.cacheWriteCost=e.cacheWrite}let c=t.modelOverrides?.[n.id];return c&&Nh(s,c),Nh(s,n),s})}if(t.isOAuth){let n=vh(`anthropic`),r=`${e}-anthropic`;return n.map(n=>{let i={...n,api:r,provider:e},a=t.modelOverrides?.[n.id];return a&&Nh(i,a),i})}return vh(e===`azure-ai-foundry`?`anthropic`:e)}catch(t){return Q.error(`Failed to load models`,{providerId:e,error:t instanceof Error?t.message:String(t)}),[]}}function Fh(e){let t=$().find(t=>t.providerId===e);if(!t?.accessToken)return null;let n=!!t.tokenExpiresAt&&Date.now()>t.tokenExpiresAt-6e4;return{token:t.accessToken,maskedValue:t.maskedValue,expiresAt:t.tokenExpiresAt,userName:t.userName,userAvatar:t.userAvatar,scopes:t.scopes,expired:n}}const Ih=Object.assign({})[`/packages/webapp/providers.json`]??[],Q=n(`provider-settings`);function Lh(e=Ih){if(e.length===0||$().length>0)return;let t=new Set(kh());for(let n of e)if(!(!n.providerId||!n.apiKey)){if(!t.has(n.providerId)){Q.warn(`Unknown provider "${n.providerId}" in providers.json — skipping`);continue}Jh(n.providerId,n.apiKey,n.baseUrl)}let n=e.find(e=>e.providerId&&e.apiKey&&t.has(e.providerId));n?.model&&!localStorage.getItem(bh)&&localStorage.setItem(bh,`${n.providerId}:${n.model}`)}const Rh=[/haiku/i];function zh(e){return Rh.some(t=>t.test(e))}function Bh(e){return e.filter(e=>!zh(e.id))}function Vh(){let e=$();if(e.length===0)return[];let t=new Map;for(let n of e){if(t.has(n.providerId))continue;let e=Mh(n.providerId);if(e.hidden||Ch(n.providerId))continue;let r=Bh(Ph(n.providerId));if(r.length===0)continue;let i={providerId:n.providerId,providerName:e.name,models:r};t.set(n.providerId,i)}return[...t.values()]}function $(){Th();let e=localStorage.getItem(yh);if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`object`&&!!e&&typeof e.providerId==`string`&&typeof e.apiKey==`string`):[]}catch{return[]}}function Hh(e){return ce(localStorage)[e]??[]}function Uh(e,t){let n=ce(localStorage),r=t.map(e=>e.trim()).filter(e=>e.length>0);r.length===0?delete n[e]:n[e]=r,le(localStorage,n)}async function Wh(e,t){if(i()){Uh(e,t);return}let n=r();if(!n)throw Error(`setExtraOAuthDomainsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let{storeAfter:a}=await n.call(`oauth-extras-set`,{providerId:e,domains:t});try{le(localStorage,a)}catch(t){Q.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{providerId:e,error:t instanceof Error?t.message:String(t)})}}function Gh(){return ce(localStorage)}function Kh(e){localStorage.setItem(yh,JSON.stringify(e))}async function qh(e){if(i()){Kh(e);return}let t=r();if(!t)throw Error(`saveAccountsAsync: no DOM and no panel-rpc client — cannot persist to page localStorage`);let n=JSON.stringify(e),{storedJson:a}=await t.call(`save-oauth-accounts`,{accountsJson:n});try{localStorage.setItem(yh,a)}catch(e){Q.warn(`worker-shim mirror failed after successful page write — reload to refresh`,{error:e instanceof Error?e.message:String(e)})}}function Jh(e,t,n,r,i){let a=$().filter(t=>t.providerId!==e),o={providerId:e,apiKey:t};n&&(o.baseUrl=n),r&&(o.deployment=r),i&&(o.apiVersion=i),a.push(o),Kh(a)}async function Yh(e){let t=Qm();try{if(t===`extension-direct`){let t=await new Promise(t=>{chrome.runtime.sendMessage({type:`secrets.delete`,name:`oauth.${e}.token`},n=>{chrome.runtime.lastError&&Q.error(`SW secrets.delete transport failed`,{providerId:e,error:chrome.runtime.lastError.message}),t(n??{})})});t.error&&Q.error(`SW secrets.delete returned error`,{providerId:e,error:t.error})}else if(t===`extension-delegate`){let t=await th(`secrets.delete`,{name:`oauth.${e}.token`});t?.error&&Q.error(`Bridge secrets.delete returned error`,{providerId:e,error:t.error})}else if(t!==`connect`){let t=await fetch(l(`/api/secrets/oauth/${e}`),{method:`DELETE`,headers:u()});!t.ok&&t.status!==404&&Q.warn(`OAuth replica DELETE non-ok`,{providerId:e,status:t.status})}}catch(n){Q.error(`OAuth replica removal failed`,{providerId:e,topology:t,error:n instanceof Error?n.message:String(n)})}}async function Xh(e){let t=$().find(t=>t.providerId===e),n=Mh(e);t&&n?.isOAuth&&await Zh(e),await Yh(e),await qh($().filter(t=>t.providerId!==e));let r=localStorage.getItem(bh)??``,i=r.indexOf(`:`);i>0&&r.slice(0,i)===e&&localStorage.removeItem(bh)}async function Zh(e){let t=$().find(t=>t.providerId===e);if(!t)return;let n=Mh(e);if(n?.isOAuth){if(n.onOAuthLogout)try{await n.onOAuthLogout()}catch(t){Q.warn(`onOAuthLogout failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})}if(n.getOAuthLogoutUrl){let r=n.getOAuthLogoutUrl(t);if(r){let{openIdpLogoutUrl:t}=await import(`./oauth-service-a6YE6xTR.js`);await t(r).catch(t=>{Q.warn(`IdP logout popup failed`,{providerId:e,error:t instanceof Error?t.message:String(t)})})}}await qh($().map(t=>t.providerId===e?{providerId:t.providerId,apiKey:``,baseUrl:t.baseUrl,userName:t.userName,userAvatar:t.userAvatar,loggedOut:!0}:t)),await Yh(e)}}async function Qh(e,t={}){let n=Math.max(1,t.attempts??3),r=t.delayMs??150,i=t.sleep??(e=>new Promise(t=>setTimeout(t,e))),a;for(let t=0;t<n;t++){let o=await e();if(o.maskedValue)return{maskedValue:o.maskedValue};o.error&&(a=o.error),t<n-1&&await i(r)}return{lastError:a}}async function $h(e,t,n){let r={providerId:e.providerId,accessToken:e.accessToken,domains:e.domains.join(`,`)},{maskedValue:i,lastError:a}=await Qh(()=>t.sendMaskRequest(r),n);if(!i){Q.error(`OAuth mask give-up: no masked value after retries`,{providerId:e.providerId,reason:a??`no error reported (cold SW or empty reply)`});return}let o=t.getAccounts(),s=o.find(t=>t.providerId===e.providerId);s&&(s.maskedValue=i,await t.saveAccounts(o))}function eg(e,t){if(e.accessToken)return`scopes`in e?e.scopes:t?.scopes}async function tg(e){let t=$().find(t=>t.providerId===e.providerId),n=$().filter(t=>t.providerId!==e.providerId);n.push({providerId:e.providerId,apiKey:``,accessToken:e.accessToken,refreshToken:e.refreshToken,tokenExpiresAt:e.tokenExpiresAt,userName:e.userName,userAvatar:e.userAvatar,baseUrl:e.baseUrl??t?.baseUrl,scopes:eg(e,t)}),await qh(n);let r=Mh(e.providerId)?.oauthTokenDomains??[],i=Hh(e.providerId),a=new Set,o=[];for(let e of[...r,...i]){let t=e.toLowerCase();a.has(t)||(a.add(t),o.push(e))}if(o.length===0)return;let s=Qm();try{if(s===`extension-direct`)await $h({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>new Promise(n=>{chrome.runtime.sendMessage({type:`secrets.mask-oauth-token`,...t},t=>{chrome.runtime.lastError&&Q.error(`SW mask-oauth-token transport failed`,{providerId:e.providerId,error:chrome.runtime.lastError.message});let r=typeof t==`object`&&t?t:void 0;r?.error&&Q.warn(`SW mask-oauth-token returned error`,{providerId:e.providerId,error:r.error}),n(r??{})})}),getAccounts:$,saveAccounts:qh});else if(s===`extension-delegate`)await $h({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>th(`secrets.mask-oauth-token`,t).then(t=>(t?.error&&Q.warn(`Bridge mask-oauth-token returned error`,{providerId:e.providerId,error:t.error}),t??{})).catch(t=>(Q.error(`Bridge mask-oauth-token transport failed`,{providerId:e.providerId,error:t instanceof Error?t.message:String(t)}),{})),getAccounts:$,saveAccounts:qh});else if(s!==`connect`){let t=await fetch(l(`/api/secrets/oauth-update`),{method:`POST`,headers:u({"Content-Type":`application/json`}),body:JSON.stringify({providerId:e.providerId,accessToken:e.accessToken,domains:o})});if(t.ok){let n=await t.json();if(typeof n.maskedValue==`string`){let t=$(),r=t.find(t=>t.providerId===e.providerId);r&&(r.maskedValue=n.maskedValue,await qh(t))}else Q.warn(`OAuth replica POST ok but missing maskedValue`,{providerId:e.providerId})}else Q.warn(`OAuth replica POST non-ok`,{providerId:e.providerId,status:t.status})}}catch(t){Q.error(`OAuth replica sync failed`,{providerId:e.providerId,topology:s,error:t instanceof Error?t.message:String(t)})}}function ng(e){let t=$().find(t=>t.providerId===e);return t&&(t.accessToken||t.apiKey)||null}function rg(e){let t=$().find(t=>t.providerId===e);return t?t.accessToken||t.apiKey||(Mh(e).optionalApiKey?`local`:null):null}function ig(e){return $().find(t=>t.providerId===e)?.baseUrl??null}function ag(e){return $().find(t=>t.providerId===e)?.deployment??null}function og(e){return $().find(t=>t.providerId===e)?.apiVersion??null}function sg(){let e=localStorage.getItem(bh)||``,t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function cg(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t),r=new Set([...a(),...kh()]),i=n.includes(`.`);if(r.has(n)||!i){localStorage.setItem(bh,e);return}}let n=ug();localStorage.setItem(bh,`${n}:${e}`)}function lg(){return localStorage.getItem(bh)||``}function ug(){let e=lg(),t=e.indexOf(`:`);if(t>0)return e.slice(0,t);let n=$(),r=sg();if(r){let e=n.find(e=>Ah(e.providerId)&&jh(e.providerId,r));if(e)return e.providerId}let i=n.find(e=>Ah(e.providerId));return i?i.providerId:n.length>0?n[0].providerId:`anthropic`}function dg(e){let t=sg();localStorage.setItem(bh,`${e}:${t}`)}function fg(){let e=sg();localStorage.setItem(bh,e)}function pg(){return rg(ug())}function mg(e){let t=ug();Jh(t,e,ig(t)??void 0)}async function hg(){await Xh(ug())}function gg(){return ig(ug())}function _g(e){let t=ug(),n=ng(t);n&&Jh(t,n,e||void 0)}function vg(){let e=ug(),t=ng(e);t&&Jh(e,t)}function yg(){let e=$(),t=ug(),n=sg();return e.map(e=>{let r={providerId:e.providerId,apiKey:e.apiKey};return e.baseUrl&&(r.baseUrl=e.baseUrl),e.providerId===t&&n&&(r.model=n),r})}async function bg(){let e=$();await Promise.allSettled(e.map(e=>Xh(e.providerId))),localStorage.removeItem(yh),localStorage.removeItem(bh);for(let e of xh)localStorage.removeItem(e)}function xg(e){return/^(?:gpt[-.]?|o[0-9]|chatgpt)/i.test(e)?`openai`:`anthropic`}function Sg(e,t,n,r){return{id:t,name:t,provider:e,api:r??`${e}-${xg(t)}`,baseUrl:n??``,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!0}}function Cg(e,t){return t.isOAuth||e===`azure-ai-foundry`?`anthropic`:e===`bedrock-camp`?`amazon-bedrock`:e}function wg(e){if(!e)return Tg();let t=ug(),n=ig(t),r=Mh(t);try{let i=Cg(t,r),a=_h(i,e);if(!a?.id)throw Error(`Model ${e} not found`);let o=a;return r.isOAuth?o=Ph(t).find(t=>t.id===e)||{...o,api:`${t}-anthropic`,provider:t}:t===`bedrock-camp`&&(o={...o,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(o={...o,baseUrl:n}),o}catch(i){if(Q.debug(`resolveModelById: pi-ai lookup miss, using provider fallback`,{providerId:t,modelId:e,error:i instanceof Error?i.message:String(i)}),r.isOAuth){let r=Ph(t).find(t=>t.id===e);return r?n?{...r,baseUrl:n}:r:Sg(t,e,n)}return Tg()}}function Tg(){let e=ug(),t=sg(),n=ig(e),r=Ph(e),i=Mh(e),a=i.defaultModelId?r.find(e=>e.id.toLowerCase().includes(i.defaultModelId.toLowerCase()))?.id:void 0,o=t||a||r[0]?.id||`claude-sonnet-4-6`;try{let t=Cg(e,i),a=_h(t,o);if(!a?.id)throw Error(`Model ${o} not found in ${t} registry`);let s=a;return i.isOAuth?s=r.find(e=>e.id===o)||{...s,api:`${e}-anthropic`,provider:e}:e===`bedrock-camp`&&(s={...s,api:`bedrock-camp-converse`,provider:`bedrock-camp`}),n&&(s={...s,baseUrl:n}),s}catch(t){Q.debug(`resolveCurrentModel: pi-ai lookup miss, using provider fallback`,{providerId:e,effectiveModelId:o,error:t instanceof Error?t.message:String(t)});let a=r.find(e=>e.id===o);return a?n?{...a,baseUrl:n}:a:i.isOAuth?Sg(e,o,n):_h(`anthropic`,`claude-sonnet-4-0`)}}function Eg(e){let t=e.toLowerCase();if(!t)return null;let n=null;try{n=ug()}catch{}if(n!==null){let e=Dg(t,[n]);if(e!==null)return e}return Dg(t,$().map(e=>e.providerId))}function Dg(e,t){let n=null,r=-1;for(let i of t)for(let t of Ph(i)){let i=t.id.toLowerCase(),a=(t.name??``).toLowerCase();if(!i.includes(e)&&!a.includes(e))continue;let o=t.contextWindow??0;(o>r||o===r&&kg(t.id,n??``)>0)&&(r=o,n=t.id)}return n}function Og(e){if(!e)return null;let t=[e],n=Eg(e);n!==null&&n!==e&&t.push(n);let r=[];try{r=Ph(ug())}catch{}for(let n of t)if(!(r.length>0&&!r.some(e=>e.id===n)))try{if(wg(n).id===n)return n}catch(t){Q.debug(`resolveModelIdForScoop: candidate did not resolve`,{input:e,candidate:n,error:t instanceof Error?t.message:String(t)})}return null}function kg(e,t){let n=e.match(/\d+/g)?.map(Number)??[],r=t.match(/\d+/g)?.map(Number)??[],i=Math.max(n.length,r.length);for(let e=0;e<i;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}export{Hm as $,Tt as $t,Qh as A,w as An,er as At,mg as B,sn as Bt,Mh as C,b as Cn,I as Ct,ug as D,Le as Dn,ur as Dt,sg as E,Ie as En,lr as Et,Tg as F,yn as Ft,dg as G,qt as Gt,Uh as H,A as Ht,wg as I,_n as It,ih as J,Vt as Jt,hh as K,Kt,Eg as L,M as Lt,$h as M,Jn as Mt,Ah as N,qn as Nt,zh as O,Xe as On,F as Ot,Xh as P,bn as Pt,Zm as Q,kt as Qt,Og as R,gn as Rt,Fh as S,Ne as Sn,fr as St,ng as T,Fe as Tn,cr as Tt,Wh as U,tn as Ut,_g as V,j as Vt,cg as W,Qt as Wt,$m as X,Rt as Xt,th as Y,zt as Yt,Qm as Z,Lt as Zt,kh as _,ze as _n,L as _t,Lh as a,C as an,fo as at,ag as b,He as bn,_r as bt,vg as c,Oe as cn,Xi as ct,$ as d,x as dn,qi as dt,Ct as en,Mm as et,Vh as f,Ae as fn,Yi as ft,og as g,Be as gn,R as gt,rg as h,je as hn,Lr as ht,Jh as i,Ye as in,sf as it,Eh as j,Te as jn,$n as jt,Zh as k,We as kn,rr as kt,fg as l,ke as ln,Wi as lt,pg as m,Re as mn,Vr as mt,Oh as n,Ze as nn,wf as nt,bg as o,Ee as on,na as ot,Gh as p,Ve as pn,z as pt,ph as q,Wt as qt,gh as r,Je as rn,yf as rt,hg as s,De as sn,ta as st,yh as t,Qe as tn,Of as tt,yg as u,rt as un,Ji as ut,gg as v,Ke as vn,yr as vt,Ph as w,Pe as wn,sr as wt,Hh as x,Me as xn,hr as xt,ig as y,qe as yn,vr as yt,tg as z,un as zt};
@@ -1 +1 @@
1
- import{n as e}from"./panel-rpc-BPwAqRch.js";import{K as t,d as n,y as r,z as i}from"./account-store-BwdL0okL.js";import{a}from"./diagnostics-DN_idNHx.js";import{a as o,d as s,f as c,i as l,o as u,p as d,s as f}from"./bedrock-camp-CFmElpzZ.js";import{a as p,r as m,s as h,t as g}from"./legacy-api-aliases-BVP0Ho8x.js";import{n as _}from"./llm-session-id-ZObKEXzb.js";import{n as v,t as ee}from"./silent-renew-backoff-BrAZcbzt.js";import{getOAuthPageOrigin as te}from"./oauth-service-a6YE6xTR.js";import"./provider-settings-DVpmC_lZ.js";var ne={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function re(e,t){return o(e,t)}function y(e,t,n){return e!==`xhigh`||!t?e:f(t,n)?`xhigh`:u(t,n)?`max`:`high`}function ie(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return y((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ae(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function b(e,t){if(!re(e.id,e.name))return t;let n=t,r=y(n.effort??ie(n.reasoning,e),e.id,e.name);return{...t,onPayload:ae(r,n.onPayload)}}function oe(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}const x=Object.assign({"/packages/webapp/providers/adobe-config.json":ne})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function S(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(x.proxyEndpoint)return x.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}const C=new Map,w=new Map,T=`slicc-adobe-models`;function E(e){try{localStorage.setItem(T,JSON.stringify(e))}catch{}}async function D(e){let t=C.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.36.1`}});if(t.ok){let n=await t.json();return C.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function O(e){let t=e.clientId||x.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function k(e){return e.scopes||x.scopes}function A(e){return e.imsEnvironment||x.imsEnvironment||`prod`}const j={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function M(e){return j[e??x.imsEnvironment??`prod`]??j.prod}const N=typeof chrome<`u`&&!!chrome?.runtime?.id;function P(){return n().find(e=>e.providerId===`adobe`)}async function se(e,t){try{let n=await fetch(`${M(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function F(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}const I={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!x.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>oe(e,w.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return E(n),n}for(let t of C.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(T);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,t,n)=>{let r=S(),a=await D(r),o=O(a),s=k(a),c=A(a),l=N?null:await te(),u=N?null:v({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:x.redirectUri},()=>crypto.randomUUID()),d=N?x.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),n?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${M(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=F(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let _=await se(g.accessToken,c);await i({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:_.name,userAvatar:_.avatar,scopes:g.scope,baseUrl:x.proxyEndpoint?void 0:r}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=P();if(e?.accessToken)try{let t=C.values().next().value??{},n=t.clientId||x.clientId,r=A(t);if(n){let t=await fetch(`${M(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await i({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>P()?.accessToken?z():null,refreshModels:async e=>{await $(e);let t=I.getModelIds?.();t?.length&&E(t)}};let L=null;const ce=ee();async function R(){let e=P();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await ce.run(()=>z());if(t)return t;let n=P();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function le(){let e=P();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function z(){if(typeof window>`u`){let t=e();if(!t)return null;try{let{accessToken:e}=await t.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return e}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return L||(L=U().finally(()=>{L=null}),L)}function B(e,t){let n=O(t),r=k(t),i=A(t),a=N?null:v({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:x.redirectUri},()=>crypto.randomUUID()),o=N?x.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${M(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function V(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function H(e,t){let n=P();await i({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:n?.userName,userAvatar:n?.userAvatar,scopes:e.scope,baseUrl:x.proxyEndpoint?void 0:t})}async function U(){try{let e=S(),{authorizeUrl:t,expectedNonce:n}=B(e,await D(e)),{createOAuthLauncher:r}=await import(`./oauth-service-a6YE6xTR.js`),i=await r()(t,{interactive:!1});if(!i||!V(i,n))return null;let a=F(i);return a?(await H(a,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),a.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}const W=`X-Slicc-Version`;function G(e){let t={};if(e.headers)for(let[n,r]of Object.entries(e.headers))n.toLowerCase()!==`x-slicc-version`&&(t[n]=r);return t[W]=`6.36.1`,{...e,headers:t}}const K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":_(`adobe-provider-fallback`)}}}function ue(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const Y=(e,t,n={})=>{let r=a();return(async()=>{try{let i=await R();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${S()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=m(a,t,G(q({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:S(),api:`anthropic-messages`},o=g(a,t,G(q(b(e,l(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r},X=(e,t,n)=>{let r=a();return(async()=>{try{let i=await R();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${S()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=h(a,t,G(q({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:S(),api:`anthropic-messages`},o=p(a,t,G(q(b(e,l(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r};function de(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function Z(){let e=new Map;for(let t of c())try{for(let n of s(t))e.set(n.id,n)}catch{}return e}function fe(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function pe(e,t){for(let t of e)w.set(t.id,de(t));let n=Z();return e.map(e=>fe(e,t,n))}async function me(e){try{let t=e??await R(),n=S(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.36.1`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return pe(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}const Q=new Map;function he(){return s(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=S(),n=Q.get(t);if(n)return n;let r=await me(e);return r?(Q.set(t,r),r):he()}function ge(){d({api:`adobe-anthropic`,stream:Y,streamSimple:X}),d({api:`adobe-openai`,stream:Y,streamSimple:X})}export{ue as __resetAdobeSessionIdWarningCacheForTests,I as config,F as extractTokenFromUrl,$ as getAdobeModels,R as getValidAccessToken,le as isTokenExpired,ge as register};
1
+ import{n as e}from"./panel-rpc-BPwAqRch.js";import{K as t,d as n,y as r,z as i}from"./account-store-znf4YsvT.js";import{a}from"./diagnostics-DN_idNHx.js";import{a as o,d as s,f as c,i as l,o as u,p as d,s as f}from"./bedrock-camp-CFmElpzZ.js";import{a as p,r as m,s as h,t as g}from"./legacy-api-aliases-BVP0Ho8x.js";import{n as _}from"./llm-session-id-ZObKEXzb.js";import{n as v,t as ee}from"./silent-renew-backoff-BrAZcbzt.js";import{getOAuthPageOrigin as te}from"./oauth-service-a6YE6xTR.js";import"./provider-settings-CcFYbum_.js";var ne={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function re(e,t){return o(e,t)}function y(e,t,n){return e!==`xhigh`||!t?e:f(t,n)?`xhigh`:u(t,n)?`max`:`high`}function ie(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return y((()=>{if(typeof n==`string`)return n;switch(e){case`minimal`:case`low`:return`low`;case`medium`:return`medium`;case`xhigh`:return`xhigh`;default:return`high`}})(),t?.id,t?.name)}function ae(e,t){return async(n,r)=>{let i=t?await t(n,r)??n:n,a=i.thinking;return a&&a.type===`enabled`&&(i.thinking={type:`adaptive`,...a.display===void 0?{}:{display:a.display}},i.output_config={...i.output_config??{},effort:e}),i}}function b(e,t){if(!re(e.id,e.name))return t;let n=t,r=y(n.effort??ie(n.reasoning,e),e.id,e.name);return{...t,onPayload:ae(r,n.onPayload)}}function oe(e,t){let n={id:e.id,name:e.name??e.id},r=t?.api??e.api,i=t?.context_window??e.context_window,a=t?.max_tokens??e.max_tokens,o=t?.reasoning??e.reasoning,s=t?.input??e.input;r&&(n.api=r),i!==void 0&&(n.context_window=i),a!==void 0&&(n.max_tokens=a),o!==void 0&&(n.reasoning=o),s&&(n.input=s);let c=t?.cost??e.cost;return c&&(n.cost=c),/haiku/i.test(e.id)&&(n.compat={supportsEagerToolInputStreaming:!1}),/sonnet-5\b/i.test(e.id)&&!n.thinkingLevelMap&&(n.thinkingLevelMap={xhigh:`xhigh`}),n}const x=Object.assign({"/packages/webapp/providers/adobe-config.json":ne})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function S(){let e=r(`adobe`);if(e)return e.replace(/\/$/,``);if(x.proxyEndpoint)return x.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}const C=new Map,w=new Map,T=`slicc-adobe-models`;function E(e){try{localStorage.setItem(T,JSON.stringify(e))}catch{}}async function D(e){let t=C.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[W]:`6.36.3`}});if(t.ok){let n=await t.json();return C.set(e,n),n}console.warn(`[adobe] Proxy /v1/config returned ${t.status}, falling back to build-time config`)}catch(e){console.warn(`[adobe] Failed to fetch proxy config:`,e instanceof Error?e.message:String(e))}return{}}function O(e){let t=e.clientId||x.clientId;if(!t)throw Error(`Could not determine IMS client ID — proxy /v1/config did not return one and adobe-config.json is empty`);return t}function k(e){return e.scopes||x.scopes}function A(e){return e.imsEnvironment||x.imsEnvironment||`prod`}const j={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function M(e){return j[e??x.imsEnvironment??`prod`]??j.prod}const N=typeof chrome<`u`&&!!chrome?.runtime?.id;function P(){return n().find(e=>e.providerId===`adobe`)}async function se(e,t){try{let n=await fetch(`${M(t)}/ims/userinfo/v2`,{headers:{Authorization:`Bearer ${e}`}});if(n.ok){let e=await n.json();return{name:e.displayName||e.name||e.email,avatar:e.picture||e.avatar_url}}console.warn(`[adobe] User profile fetch returned ${n.status}, account will have no display name`)}catch(e){console.warn(`[adobe] Failed to fetch user profile:`,e instanceof Error?e.message:String(e))}return{}}function F(e){let t=e.indexOf(`#`);if(t<0)return null;let n=new URLSearchParams(e.slice(t+1)),r=n.get(`access_token`);return r?{accessToken:r,expiresIn:parseInt(n.get(`expires_in`)??`86400`,10),scope:n.get(`scope`)??void 0}:null}const I={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!x.proxyEndpoint,baseUrlPlaceholder:`https://your-proxy.example.com`,baseUrlDescription:`Anthropic-compatible proxy endpoint`,isOAuth:!0,defaultModelId:`sonnet`,oauthTokenDomains:[`ims-na1.adobelogin.com`,`ims-na1-stg1.adobelogin.com`,`*.adobelogin.com`,`*.adobe.io`,`firefall.adobe.io`,`admin.hlx.page`,`admin.hlx.live`,`admin.aem.page`,`admin.aem.live`],getModelIds:()=>{let e=e=>oe(e,w.get(e.id));for(let t of Q.values())if(t.length){let n=t.map(t=>e({id:t.id,name:t.name??t.id,reasoning:t.reasoning,input:t.input,cost:t.cost}));return E(n),n}for(let t of C.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(T);if(e){let t=JSON.parse(e);if(t.length)return t}}catch{}return[{id:`claude-sonnet-4-6`,name:`Claude Sonnet 4.6`}]},onOAuthLogin:async(e,t,n)=>{let r=S(),a=await D(r),o=O(a),s=k(a),c=A(a),l=N?null:await te(),u=N?null:v({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:x.redirectUri},()=>crypto.randomUUID()),d=N?x.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:u.redirectUri,f=u?.oauthState,p=u?.expectedNonce??null,m=new URLSearchParams({client_id:o,scope:s,response_type:`token`,redirect_uri:d});f&&m.set(`state`,f),n?.forceReauth&&m.set(`prompt`,`login`);let h=await e(`${M(c)}/ims/authorize/v2?${m}`);if(!h)return;if(p&&h)try{if(new URL(h).searchParams.get(`nonce`)!==p){console.error(`[adobe] OAuth nonce mismatch — possible CSRF`);return}}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}let g=F(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let _=await se(g.accessToken,c);await i({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:_.name,userAvatar:_.avatar,scopes:g.scope,baseUrl:x.proxyEndpoint?void 0:r}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=P();if(e?.accessToken)try{let t=C.values().next().value??{},n=t.clientId||x.clientId,r=A(t);if(n){let t=await fetch(`${M(r)}/ims/revoke`,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:new URLSearchParams({token:e.accessToken,token_type_hint:`access_token`,client_id:n})});t.ok||console.warn(`[adobe] Token revocation returned ${t.status}, token may still be valid server-side`)}}catch(e){console.warn(`[adobe] Failed to revoke token:`,e instanceof Error?e.message:String(e))}await i({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>P()?.accessToken?z():null,refreshModels:async e=>{await $(e);let t=I.getModelIds?.();t?.length&&E(t)}};let L=null;const ce=ee();async function R(){let e=P();if(!e?.accessToken)throw Error(`Not logged in to Adobe — please log in first`);if((e.tokenExpiresAt??0)-Date.now()>6e4)return e.accessToken;console.log(`[adobe] Token expired or expiring soon, attempting silent renewal...`);let t=await ce.run(()=>z());if(t)return t;let n=P();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function le(){let e=P();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function z(){if(typeof window>`u`){let t=e();if(!t)return null;try{let{accessToken:e}=await t.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return e}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return L||(L=U().finally(()=>{L=null}),L)}function B(e,t){let n=O(t),r=k(t),i=A(t),a=N?null:v({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:x.redirectUri},()=>crypto.randomUUID()),o=N?x.extensionRedirectUri??`https://${chrome.runtime.id}.chromiumapp.org/`:a.redirectUri,s=a?.oauthState,c=a?.expectedNonce??null,l=new URLSearchParams({client_id:n,scope:r,response_type:`token`,redirect_uri:o,prompt:`none`});return s&&l.set(`state`,s),{authorizeUrl:`${M(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function V(e,t){if(!t)return!0;try{if(new URL(e).searchParams.get(`nonce`)!==t)return console.error(`[adobe] OAuth nonce mismatch — possible CSRF`),!1}catch(e){console.warn(`[adobe] Nonce check skipped (URL parse failed):`,e instanceof Error?e.message:String(e))}return!0}async function H(e,t){let n=P();await i({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:n?.userName,userAvatar:n?.userAvatar,scopes:e.scope,baseUrl:x.proxyEndpoint?void 0:t})}async function U(){try{let e=S(),{authorizeUrl:t,expectedNonce:n}=B(e,await D(e)),{createOAuthLauncher:r}=await import(`./oauth-service-a6YE6xTR.js`),i=await r()(t,{interactive:!1});if(!i||!V(i,n))return null;let a=F(i);return a?(await H(a,e),console.log(`[adobe] Token renewed silently`),await $().catch(e=>console.warn(`[adobe] Failed to refresh models after silent renewal:`,e instanceof Error?e.message:String(e))),a.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}const W=`X-Slicc-Version`;function G(e){let t={};if(e.headers)for(let[n,r]of Object.entries(e.headers))n.toLowerCase()!==`x-slicc-version`&&(t[n]=r);return t[W]=`6.36.3`,{...e,headers:t}}const K=new Set;function q(e,t){if(e.headers){for(let[t,n]of Object.entries(e.headers))if(t.toLowerCase()===`x-session-id`&&n!=null)return e}return K.has(t)||(K.add(t),console.warn(`[adobe] Missing X-Session-Id from ${t} — using daily fallback. Attach an X-Session-Id header at the call site (see scoop-context.ts streamWithSessionId or docs/pitfalls.md).`)),{...e,headers:{...e.headers??{},"X-Session-Id":_(`adobe-provider-fallback`)}}}function ue(){K.clear()}function J(e,t){return{type:`error`,reason:`error`,error:{role:`assistant`,content:[],api:`adobe-anthropic`,provider:`adobe`,model:e.id,usage:{input:0,output:0,cacheRead:0,cacheWrite:0,totalTokens:0,cost:{input:0,output:0,cacheRead:0,cacheWrite:0,total:0}},stopReason:`error`,errorMessage:t instanceof Error?t.message:String(t),timestamp:Date.now()}}}const Y=(e,t,n={})=>{let r=a();return(async()=>{try{let i=await R();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${S()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=m(a,t,G(q({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:S(),api:`anthropic-messages`},o=g(a,t,G(q(b(e,l(e.id,e.name,{...n,apiKey:i})),`streamAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r},X=(e,t,n)=>{let r=a();return(async()=>{try{let i=await R();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${S()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=h(a,t,G(q({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:S(),api:`anthropic-messages`},o=p(a,t,G(q(b(e,l(e.id,e.name,{...n,apiKey:i})),`streamSimpleAdobe[anthropic]`)));for await(let e of o)r.push(e)}r.end()}catch(t){console.error(`[adobe] Stream error:`,t instanceof Error?t.message:String(t)),r.push(J(e,t)),r.end()}})(),r};function de(e){let t={id:e.id,name:e.name};return e.api!==void 0&&(t.api=e.api),e.context_window!==void 0&&(t.context_window=e.context_window),e.max_tokens!==void 0&&(t.max_tokens=e.max_tokens),e.reasoning!==void 0&&(t.reasoning=e.reasoning),e.input!==void 0&&(t.input=e.input),t}function Z(){let e=new Map;for(let t of c())try{for(let n of s(t))e.set(n.id,n)}catch{}return e}function fe(e,n,r){let i=`adobe-${e.api===`openai`?`openai`:`anthropic`}`,a=r.get(e.id);if(a)return{...a,provider:`adobe`,api:i};let o=t(e.id,r);return{id:e.id,name:e.name??e.id,provider:`adobe`,api:i,baseUrl:n,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:o,inputCost:o.input,outputCost:o.output,cacheReadCost:o.cacheRead,cacheWriteCost:o.cacheWrite,reasoning:!0}}function pe(e,t){for(let t of e)w.set(t.id,de(t));let n=Z();return e.map(e=>fe(e,t,n))}async function me(e){try{let t=e??await R(),n=S(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[W]:`6.36.3`}});if(!r.ok)console.warn(`[adobe] Proxy /v1/models returned ${r.status}, falling back to Anthropic models`);else{let e=await r.json();if(e.data?.length)return pe(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}const Q=new Map;function he(){return s(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=S(),n=Q.get(t);if(n)return n;let r=await me(e);return r?(Q.set(t,r),r):he()}function ge(){d({api:`adobe-anthropic`,stream:Y,streamSimple:X}),d({api:`adobe-openai`,stream:Y,streamSimple:X})}export{ue as __resetAdobeSessionIdWarningCacheForTests,I as config,F as extractTokenFromUrl,$ as getAdobeModels,R as getValidAccessToken,le as isTokenExpired,ge as register};