sliccy 6.38.3 → 6.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/assets/{account-store-BORvzSQq.js → account-store-8zHKHzZf.js} +1 -1
- package/dist/ui/assets/account-store-Cxz3loXT.js +100 -0
- package/dist/ui/assets/{adobe-CU6NlL0T.js → adobe-CD47VxQ1.js} +1 -1
- package/dist/ui/assets/{adobe-DdHlU93S.js → adobe-C__bPqu-.js} +1 -1
- package/dist/ui/assets/{agent-message-to-chat-BiQK7aJN.js → agent-message-to-chat-BKTzrtDE.js} +1 -1
- package/dist/ui/assets/{apply-layout-DUR7KSGL.js → apply-layout-DaQTyGVJ.js} +1 -1
- package/dist/ui/assets/{apps-BgX-J-Yl.js → apps-BSqeYsFl.js} +1 -1
- package/dist/ui/assets/{azure-openai-V25UMsKF.js → azure-openai-BfVVshcW.js} +1 -1
- package/dist/ui/assets/{azure-openai-pYPwGdSB.js → azure-openai-DAJX2mxQ.js} +1 -1
- package/dist/ui/assets/{cerebras-DaB3zjMd.js → cerebras-DH7EiStU.js} +1 -1
- package/dist/ui/assets/{cerebras-Dp20Udx0.js → cerebras-kGQ6eAhx.js} +1 -1
- package/dist/ui/assets/{connect-surface-CNtw9oZJ.js → connect-surface-BWUXCSRt.js} +1 -1
- package/dist/ui/assets/{fs-Dn3RP1Lq.js → fs-C0NPGido.js} +1 -1
- package/dist/ui/assets/{fs-BlQ4jTOP.js → fs-Cequurmj.js} +2 -2
- package/dist/ui/assets/{github-DuIT8iG4.js → github-5sgbo7jZ.js} +1 -1
- package/dist/ui/assets/{github-BoyJ6Q7u.js → github-Zugg5Qj-.js} +2 -2
- package/dist/ui/assets/{github-copilot-QH1AnaLO.js → github-copilot-Bo9JF5a-.js} +1 -1
- package/dist/ui/assets/{github-copilot-CFJ7q5lJ.js → github-copilot-kBcOKHxp.js} +1 -1
- package/dist/ui/assets/{github-install-C1Dwn9TP.js → github-install-CvpnvL5c.js} +1 -1
- package/dist/ui/assets/{github-zip-DjhAbKNH.js → github-zip-BWQMOpzT.js} +1 -1
- package/dist/ui/assets/{index-AMF5XZgS.js → index-BCcTZIpf.js} +265 -250
- package/dist/ui/assets/{kernel-worker-B9-cCXjo.js → kernel-worker-C-AHxfuN.js} +29 -29
- package/dist/ui/assets/{local-llm-CFPAE6pE.js → local-llm-C7Qt3nVY.js} +1 -1
- package/dist/ui/assets/{local-llm-B75eUG8N.js → local-llm-PR0ztiYK.js} +1 -1
- package/dist/ui/assets/magick-wasm-DZJeTjwR.js +43 -0
- package/dist/ui/assets/{main-nALFb6yZ.js → main-CjKZsW9X.js} +3 -3
- package/dist/ui/assets/{mount-D1hgegom.js → mount-BS2IDRu-.js} +2 -2
- package/dist/ui/assets/{mount-Dke3kUg8.js → mount-DrKRVo4a.js} +1 -1
- package/dist/ui/assets/{mount-recovery-DIHdQWdz.js → mount-recovery-Cln0Kwvu.js} +1 -1
- package/dist/ui/assets/{new-session-4OBXYg-h.js → new-session-BUyVHhRL.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-BEllfRIX.js → oauth-bootstrap-ChJOKAmZ.js} +2 -2
- package/dist/ui/assets/{openai-codex-CZTUch8L.js → openai-codex-DBXsg0MM.js} +1 -1
- package/dist/ui/assets/{openai-codex-8O2JRzKQ.js → openai-codex-DcvV7I52.js} +1 -1
- package/dist/ui/assets/{openrouter-D0FxXajp.js → openrouter-D52jlKXD.js} +1 -1
- package/dist/ui/assets/{openrouter-DkTW2gi3.js → openrouter-DBBBsBmt.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-BdA6-C4_.js → openrouter-oauth-D35pGOT5.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-DYLEDzkH.js → openrouter-oauth-jbgq6X1-.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-0SO1fBY3.js → panel-rpc-handlers-gpN6c-a2.js} +2 -2
- package/dist/ui/assets/{provider-9m5dQSTE.js → provider-BUmrpCDs.js} +1 -1
- package/dist/ui/assets/{provider-settings-B2DSjiyI.js → provider-settings-DEeVOQVO.js} +1 -1
- package/dist/ui/assets/{provider-settings-HSE2jiCE.js → provider-settings-E2_3_Nn0.js} +1 -1
- package/dist/ui/assets/{provider-store-access-CSBrr5SV.js → provider-store-access-BNb6Ckg9.js} +2 -2
- package/dist/ui/assets/provider-store-access-BpxhTrT1.js +1 -0
- package/dist/ui/assets/{provider-CKkJfIXZ.js → provider-wlWK7FGl.js} +2 -2
- package/dist/ui/assets/{providers-Bhm8rBZ9.js → providers-CBlACIFz.js} +2 -2
- package/dist/ui/assets/{providers-CkGb6zvF.js → providers-D91y678Z.js} +1 -1
- package/dist/ui/assets/{quick-llm-CseLed9i.js → quick-llm-TL2ngvw6.js} +1 -1
- package/dist/ui/assets/{recovery-screen-BXy0Nnbk.js → recovery-screen-B2hwv_k3.js} +1 -1
- package/dist/ui/assets/{redirect-uri-D28fT3gk.js → redirect-uri-COdP9xBw.js} +1 -1
- package/dist/ui/assets/{session-freezer-Cw9eEgw5.js → session-freezer-lTtNV89v.js} +13 -13
- package/dist/ui/assets/{setup-feature-flags-remote-Cahrsjys.js → setup-feature-flags-remote-BdWq_ZXF.js} +1 -1
- package/dist/ui/assets/{setup-standalone-prelude-C5K2p1RB.js → setup-standalone-prelude-U4VmZy8w.js} +1 -1
- package/dist/ui/assets/{setup-sudo-D4EAqOET.js → setup-sudo-BIhsJd5L.js} +2 -2
- package/dist/ui/assets/{skills-Bvf2XCga.js → skills-Bh7wIvj-.js} +1 -1
- package/dist/ui/assets/{store-CfeyPIfP.js → store-B0ZSErNM.js} +1 -1
- package/dist/ui/assets/{store-DRrNKx4Y.js → store-Cbq0lKAx.js} +1 -1
- package/dist/ui/assets/{sudo-Bm-G6AvV.js → sudo-DPfno2Fe.js} +1 -1
- package/dist/ui/assets/{tool-result-images-Dw3zBAjg.js → tool-result-images-BJnG1-lQ.js} +1 -1
- package/dist/ui/assets/{transcript-limits-Ne0pE4Ui.js → transcript-limits-BZmlTnX6.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-SkLMOUYB.js → upgrade-detection-DLES83VK.js} +1 -1
- package/dist/ui/assets/{wc-extension-DBqmAjYV.js → wc-extension-Bh63DngU.js} +2 -2
- package/dist/ui/assets/{wc-follower-Bf2jCPLP.js → wc-follower-_jlSzC2-.js} +3 -3
- package/dist/ui/assets/{wc-live-BIJ_JrcU.js → wc-live-pHaHvtg9.js} +3 -3
- package/dist/ui/assets/{wc-nav-CwIiflZ4.js → wc-nav-nGeFgw0Y.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-B2KQeIY3.js → wc-onboarding-C5rtuepw.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-Dn0O931v.js → wc-placeholder-C0YTlp-D.js} +2 -2
- package/dist/ui/assets/{wc-settings-Bhxwtczn.js → wc-settings-Bzucq5Ey.js} +2 -2
- package/dist/ui/assets/{wc-shell-CYnpa7rb.js → wc-shell-C4nE6X2z.js} +2 -2
- package/dist/ui/assets/{wc-sprinkles-DIgb8nrh.js → wc-sprinkles-CiwBe9NF.js} +2 -2
- package/dist/ui/assets/{wc-tray-ClUDiDou.js → wc-tray-CAvYhNoy.js} +2 -2
- package/dist/ui/assets/{xai-grok-DgFan4FI.js → xai-grok-C1YVEpmg.js} +1 -1
- package/dist/ui/assets/{xai-grok-DkrBddqH.js → xai-grok-CZvU2oSp.js} +1 -1
- package/dist/ui/index.html +6 -6
- package/dist/ui/packages/webapp/index.html +6 -6
- package/package.json +1 -1
- package/dist/ui/assets/account-store-BQLpy1uD.js +0 -100
- package/dist/ui/assets/magick-wasm-7Gy4Vlf5.js +0 -43
- package/dist/ui/assets/provider-store-access-DUD3weBK.js +0 -1
|
@@ -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-Bhm8rBZ9.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-CBlACIFz.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-D91y678Z.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-BJnG1-lQ.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(K(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(K(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 Qt(e){return T({"~kind":`Never`},{not:{}},e)}function $t(e){return D(e,`Never`)}function en(e,t={}){return Ft(e,t)}function tn(e){return en(e)}function nn(e){return kt(e)&&C(e,`~optional`)}function rn(e){return w(e).filter(t=>!nn(e[t]))}function an(e){return w(e)}function on(e){return et(e)}function k(e,t={}){let n=rn(e);return T({"~kind":`Object`},{type:`object`,...n.length>0?{required:n}:{},properties:e},t)}function A(e){return D(e,`Object`)}function sn(e){return Ot(e,[`~kind`,`type`,`properties`,`required`])}function cn(e){return T({"~kind":`Unknown`},{},e)}function ln(e){return D(e,`Unknown`)}function un(e,t,n){return T({"~kind":`Cyclic`},{$defs:w(e).reduce((t,n)=>({...t,[n]:E(e[n],{},{$id:n})}),{}),$ref:t},n)}function dn(e){return D(e,`Cyclic`)}function fn(e){return Pe(e)&&C(e,`~unsafe`)&&Me(e[`~unsafe`])}function pn(e){return D(e,`Infer`)}function mn(e,t,n,r={}){return T({"~kind":`Dependent`},{if:e,then:t,else:n},r)}function hn(e){return D(e,`Dependent`)}function gn(e){return Ot(e,[`~kind`,`if`,`then`,`else`])}function _n(e){return D(e,`Enum`)}function vn(e,t={}){return T({"~kind":`Intersect`},{allOf:e},t)}function j(e){return D(e,`Intersect`)}function yn(e){return Ot(e,[`~kind`,`allOf`])}function bn(){throw Error(`Unreachable`)}var xn=e({Hash:()=>Jn,HashCode:()=>qn});function Sn(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 Cn(e){return typeof e==`number`}var M;(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`})(M||={});let wn=BigInt(`14695981039346656037`);const[Tn,En]=[BigInt(`1099511628211`),BigInt(`18446744073709551616`)],Dn=Array.from({length:256}).map((e,t)=>BigInt(t)),On=new Float64Array(1),kn=new DataView(On.buffer),An=new Uint8Array(On.buffer);function N(e){wn^=Dn[e],wn=wn*Tn%En}function jn(e){N(M.Array);for(let t of e)Kn(t)}function Mn(e){N(M.BigInt),kn.setBigInt64(0,e);for(let e of An)N(e)}function Nn(e){N(M.Boolean),N(+!!e)}function Pn(e){N(M.Constructor),Kn(e.toString())}function Fn(e){N(M.Date),Kn(e.getTime())}function In(e){N(M.Function),Kn(e.toString())}function Ln(e){N(M.Null)}function Rn(e){N(M.Number),kn.setFloat64(0,e,!0);for(let e of An)N(e)}function zn(e){N(M.Object);for(let t of Sn(e).sort())Kn(t),Kn(e[t])}function Bn(e){N(M.RegExp),Hn(e.toString())}const Vn=new TextEncoder;function Hn(e){N(M.String);for(let t of Vn.encode(e))N(t)}function Un(e){N(M.Symbol),Kn(e.toString())}function Wn(e){N(M.TypeArray);let t=new Uint8Array(e.buffer);for(let e=0;e<t.length;e++)N(t[e])}function Gn(e){return N(M.Undefined)}function Kn(e){return st(e)?Wn(e):lt(e)?Fn(e):ct(e)?Bn(e):it(e)?Nn(e.valueOf()):ot(e)?Hn(e.valueOf()):at(e)?Rn(e.valueOf()):Cn(e)?Rn(e):Ee(e)?jn(e):Oe(e)?Nn(e):De(e)?Mn(e):ke(e)?Pn(e):Me(e)?Ln(e):b(e)?zn(e):Fe(e)?Hn(e):Ie(e)?Un(e):Le(e)?Gn(e):Ae(e)?In(e):bn()}function qn(e){return wn=BigInt(`14695981039346656037`),Kn(e),wn}function Jn(e){return qn(e).toString(16).padStart(16,`0`)}function Yn(e){return kt(e)&&C(e,`~codec`)&&b(e[`~codec`])&&C(e[`~codec`],`encode`)&&C(e[`~codec`],`decode`)}function Xn(e){return kt(e)&&C(e,`~immutable`)}function Zn(e,t={}){return Mt(e,t)}function Qn(e){return kt(e)&&C(e,`~readonly`)}function $n(e){return T({"~kind":`BigInt`},{type:`bigint`},e)}function er(e){return D(e,`BigInt`)}function tr(e){return D(e,`Boolean`)}const nr=`-?(?:0|[1-9][0-9]*)`;function rr(e){return T({"~kind":`Integer`},{type:`integer`},e)}function ir(e){return D(e,`Integer`)}var ar=class extends Error{constructor(e){super(`Invalid Literal value`),Object.defineProperty(this,"cause",{value:{value:e},writable:!1,configurable:!1,enumerable:!1})}};function or(e){return De(e)?`bigint`:Oe(e)?`boolean`:Ne(e)?`number`:Fe(e)?`string`:(()=>{throw new ar(e)})()}function P(e,t){return T({"~kind":`Literal`},{type:or(e),const:e},t)}function sr(e){return De(e)||Oe(e)||Ne(e)||Fe(e)}function cr(e){return F(e)&&De(e.const)}function lr(e){return F(e)&&Oe(e.const)}function ur(e){return F(e)&&Ne(e.const)}function dr(e){return F(e)&&Fe(e.const)}function F(e){return D(e,`Literal`)}function fr(e){return T({"~kind":`Null`},{type:`null`},e)}function pr(e){return D(e,`Null`)}const mr=`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`;function hr(e){return T({"~kind":`Number`},{type:`number`},e)}function gr(e){return D(e,`Number`)}function _r(e){return T({"~kind":`Symbol`},{type:`symbol`},e)}function vr(e){return D(e,`Symbol`)}function yr(e){return T({"~kind":`String`},{type:`string`},e)}function br(e){return D(e,`String`)}function I(e,t={}){return T({"~kind":`Union`},{anyOf:e},t)}function L(e){return D(e,`Union`)}function xr(e){return Ot(e,[`~kind`,`anyOf`])}function Sr(e){let t=Ga(e);return x(t.length,2)?t[0]:[]}function Cr(e){return!0}function wr(e){return S(e,(e,t)=>Er(e)?wr(t):!1,()=>!0)}function Tr(e){return!x(e.length,0)&&wr(e)}function Er(e){return L(e)?Tr(e.anyOf):F(e)?Cr(e.const):!1}function Dr(e){return Tr(e)}function Or(e){return T({"~kind":`TemplateLiteral`},{type:`string`,pattern:e},{})}function kr(e,t,n=[]){return S(e,(e,r)=>kr(r,t,[...n,`${e}${t}`]),()=>n)}function Ar(e,t){return x(e.length,0)?[`${t}`]:kr(e,t)}function jr(e,t,n=[]){return S(t,(t,r)=>jr(e,r,[...n,...Mr(e,t)]),()=>n)}function Mr(e,t){return L(t)?jr(e,t.anyOf):F(t)?Ar(e,t.const):bn()}function Nr(e,t){return S(t,(t,n)=>Nr(Mr(e,t),n),()=>e)}function Pr(e){return e.map(e=>P(e))}function Fr(e){return I(Pr(Nr([],e)))}function Ir(e){return x(e.length,0)?bn():x(e.length,1)&&F(e[0])?e[0]:Fr(e)}function Lr(e){let t=Sr(e);return x(t.length,0)?yr():Dr(t)?Ir(t):Or(e)}function Rr(e){let t=Lr(e);return po(t)?yr():t}function zr(e,t){return T({"~kind":`Record`},{type:`object`,patternProperties:{[e]:t}})}function Br(e){return zr(Ui,e)}function Vr(e){return k({true:e,false:e})}function Hr(e,t={}){let[n,r,i]=[e,e.length,!1];return T({"~kind":`Tuple`},{type:`array`,additionalItems:i,items:n,minItems:r},t)}function R(e){return D(e,`Tuple`)}function Ur(e){return Ot(e,[`~kind`,`type`,`items`,`minItems`,`additionalItems`])}function Wr(e){return Ot(e,[`~readonly`])}function Gr(e,t){return E(Wr(e),{},t)}function Kr(e,t,n,r){return Gr(K(e,t,n),r)}function qr(e,t={}){return Gr(e,t)}function Jr(e){return Ot(e,[`~optional`])}function Yr(e,t){return E(Jr(e),{},t)}function Xr(e,t,n,r){return Yr(K(e,t,n),r)}function Zr(e,t={}){return Yr(e,t)}function Qr(e){return e.reduceRight((e,t,n)=>({[n]:t,...e}),{})}function $r(e){return k(Qr(e.items))}function ei(e,t){return Qn(e)?!!Qn(t):!1}function ti(e,t){return nn(e)?!!nn(t):!1}function ni(e,t){let n=ei(e,t),r=ti(e,t),i=qr(Zr(yi([e,t])));return n&&r?Zn(en(i)):n&&!r?Zn(i):!n&&r?en(i):i}function ri(e,t,n){return n in e?n in t?ni(e[n],t[n]):e[n]:n in t?t[n]:Qt()}function ii(e,t){return[...new Set([...w(t),...w(e)])].reduce((n,r)=>({...n,[r]:ri(e,t,r)}),{})}function ai(e){return A(e)?e.properties:R(e)?Qr(e.items):bn()}function oi(e,t){return k(ii(ai(e),ai(t)))}function si(e,t){let n=fc(e,t);return x(n,`left-inside`)?e:x(n,`right-inside`)||x(n,`equal`)?t:Qt()}function ci(e){return A(e)||R(e)}function li(e,t){let n=L(e),r=L(t);return n||r}function ui(e,t){let n=Si(e),r=Si(t),i=li(n,r),a=ci(n),o=ci(r);return i?yi([n,r]):a&&o?oi(n,r):a&&!o?n:!a&&o?r:si(n,r)}function di(e,t,n=[]){return S(t,(t,r)=>di(e,r,[...n,ui(e,t)]),()=>x(n.length,0)?[e]:n)}function fi(e,t,n=[]){return S(e,(e,r)=>fi(r,t,[...n,...pi([e],t)]),()=>n)}function pi(e,t=[]){return S(e,(e,n)=>L(e)?pi(n,fi(e.anyOf,t)):pi(n,di(e,t)),()=>t)}function mi(e,t){return vo(dc({},e,t))?[]:[e]}function hi(e,t){return e.reduce((e,n)=>[...e,...mi(n,t)],[])}function gi(e,t){let n=Si(e);return xi(hi(L(n)?n.anyOf:[n],t))}function _i(e,t,n){return xi([vn([e,t]),gi(n,e)])}function vi(e){return xi(e.map(e=>P(e)))}function yi(e){return Ci(_c(pi(e)))}function bi(e){return Si(Rr(e))}function xi(e){return Ci(_c(e))}function Si(e){return hn(e)?_i(e.if,e.then,e.else):_n(e)?vi(e.enum):j(e)?yi(e.allOf):po(e)?bi(e.pattern):L(e)?xi(e.anyOf):e}function Ci(e){return x(e.length,1)?e[0]:x(e.length,0)?Qt():I(e)}function wi(e,t){return Ri(vi(e),t)}function Ti(e,t){return zr(Vi,t)}function Ei(e,t){return Ri(yi(e),t)}function Di(e,t){return Fe(e)||Ne(e)?k({[e]:t}):x(e,!1)?k({false:t}):x(e,!0)?k({true:t}):k({})}function Oi(e,t){return zr(Hi,t)}function ki(e,t){return C(e,`pattern`)&&(Fe(e.pattern)||e.pattern instanceof RegExp)?zr(e.pattern.toString(),t):zr(Ui,t)}function Ai(e,t){return Dr(Sr(e))?Ri(bi(e),t):zr(e,t)}function ji(e){return L(e)?Mi(e.anyOf):[e]}function Mi(e){return e.reduce((e,t)=>[...e,...ji(t)],[])}function Ni(e){return e.some(e=>br(e)||gr(e)||ir(e))}function Pi(e,t){return x(Ni(e),!0)?zr(Ui,t):void 0}function Fi(e,t){return e.reduce((e,n)=>F(n)&&(Fe(n.const)||Ne(n.const))?{...e,[n.const]:t}:e,{})}function Ii(e,t){return k(Fi(e,t))}function Li(e,t){let n=Mi(e),r=Pi(n,t);return kt(r)?r:Ii(n,t)}function Ri(e,t){return Zt(e)?Br(t):tr(e)?Vr(t):_n(e)?wi(e.enum,t):ir(e)?Ti(e,t):j(e)?Ei(e.allOf,t):F(e)?Di(e.const,t):gr(e)?Oi(e,t):L(e)?Li(e.anyOf,t):br(e)?ki(e,t):po(e)?Ai(e.pattern,t):k({})}function zi(e,t,n){return G([e])?E(Ri(e,t),{},n):Wi(e,t,n)}function Bi(e,t,n,r,i){return zi(K(e,t,n),K(e,t,r),i)}const Vi=`^${nr}$`,Hi=`^${mr}$`,Ui=`^.*$`;function Wi(e,t,n={}){return O(`Record`,[e,t],n)}function Gi(e,t,n={}){return zi(e,t,n)}function Ki(e,t){return zr(e,t)}function qi(e){return x(e,Ui)?yr():x(e,Vi)?rr():x(e,Hi)?hr():Lr(e)}function Ji(e){return w(e.patternProperties)[0]}function Yi(e){return qi(Ji(e))}function Xi(e){return e.patternProperties[Ji(e)]}function Zi(e){return D(e,`Record`)}function Qi(e){return T({"~kind":`Rest`},{type:`rest`,items:e},{})}function $i(e){return D(e,`Rest`)}function ea(e){return D(e,`This`)}function ta(e){return T({"~kind":`Undefined`},{type:`undefined`},e)}function na(e){return D(e,`Undefined`)}function ra(e){return D(e,`Void`)}function ia(e){return $n()}function aa(e){return yr()}function oa(e){return hr()}function sa(e){return rr()}function ca(e){return Qt()}function la(e){return P(e)}function ua(e){return e}function da(e){return I(e[1])}function fa(e){return e.length===3?[...e[0],...e[2]]:e.length===1?[...e[0]]:[]}function pa(e){return[e[0],...e[1]]}function ma(e){return e}function ha(e){return e[1]}function ga(e){return x(e.length,2)}function _a(e,t,n){return ga(e)?t(e[0],e[1]):n()}function va(e,t){return x(t.indexOf(e),0)?[e,t.slice(e.length)]:[]}function ya(e,t){for(let n=0;n<e.length;n++){let r=va(e[n],t);if(ga(r))return r}return[]}function ba(e,t){return Array.from({length:t-e+1},(t,n)=>String.fromCharCode(e+n))}const xa=[...ba(97,122),...ba(65,90)],Sa=[`0`,...ba(49,57)];function Ca(e){let t=e.indexOf(`*/`);return x(t,-1)?``:e.slice(t+2)}function wa(e){let t=e.indexOf(`
|
|
2
|
+
`);return x(t,-1)?``:e.slice(t)}function Ta(e){return e.replace(/^[ \t\r\f\v]+/,``)}function Ea(e){let t=Ta(e);return t.startsWith(`/*`)?Ea(Ca(t.slice(2))):t.startsWith(`//`)?Ea(wa(t.slice(2))):t}function Da(e){let t=e.trimStart();return t.startsWith(`/*`)?Da(Ca(t.slice(2))):t.startsWith(`//`)?Da(wa(t.slice(2))):t}[...Sa];function Oa(e,t){return ya([e],t)}function ka(e,t){return x(e,``)?[``,t]:e.startsWith(`
|
|
3
|
+
`)?Oa(e,Ea(t)):e.startsWith(` `)?Oa(e,t):Oa(e,Da(t))}[...xa,...Sa],[...Sa];function Aa(e){return x(e,``)?[]:[e.slice(0,1),e.slice(1)]}function ja(e,t){return S(e,(e,n)=>t.startsWith(e)?!0:ja(n,t),()=>!1)}function Ma(e,t,n=``){return _a(Aa(t),(r,i)=>ja(e,t)?[n,t]:Ma(e,i,`${n}${r}`),()=>[])}function Na(e,t){return _a(Ma(e,t),(e,t)=>x(e,``)?[]:[e,t],()=>[])}const z=(e,t,n=()=>[])=>e.length===2?t(e):n(),Pa=e=>z(ka(`-?(?:0|[1-9][0-9]*)n`,e),([e,t])=>[ia(e),t]),Fa=e=>z(ka(`.*`,e),([e,t])=>[aa(e),t]),Ia=e=>z(ka(`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,e),([e,t])=>[oa(e),t]),La=e=>z(ka(`-?(?:0|[1-9][0-9]*)`,e),([e,t])=>[sa(e),t]),Ra=e=>z(ka(`(?!)`,e),([e,t])=>[ca(e),t]),za=e=>z(Na([`-?(?:0|[1-9][0-9]*)n`,`.*`,`-?(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?`,`-?(?:0|[1-9][0-9]*)`,`(?!)`,`(`,`)`,`$`,`|`],e),([e,t])=>[la(e),t]),Ba=e=>z(z(Pa(e),([e,t])=>[e,t],()=>z(Fa(e),([e,t])=>[e,t],()=>z(Ia(e),([e,t])=>[e,t],()=>z(La(e),([e,t])=>[e,t],()=>z(Ra(e),([e,t])=>[e,t],()=>z(Va(e),([e,t])=>[e,t],()=>z(za(e),([e,t])=>[e,t],()=>[]))))))),([e,t])=>[ua(e),t]),Va=e=>z(z(ka(`(`,e),([e,t])=>z(Wa(t),([t,n])=>z(ka(`)`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[da(e),t]),Ha=e=>z(z(z(Ua(e),([e,t])=>z(ka(`|`,t),([t,n])=>z(Ha(n),([n,r])=>[[e,t,n],r]))),([e,t])=>[e,t],()=>z(z(Ua(e),([e,t])=>[[e],t]),([e,t])=>[e,t],()=>z([[],e],([e,t])=>[e,t],()=>[]))),([e,t])=>[fa(e),t]),Ua=e=>z(z(Ba(e),([e,t])=>z(Wa(t),([t,n])=>[[e,t],n])),([e,t])=>[pa(e),t]),Wa=e=>z(z(Ha(e),([e,t])=>[e,t],()=>z(Ua(e),([e,t])=>[e,t],()=>[])),([e,t])=>[ma(e),t]),Ga=e=>z(z(ka(`^`,e),([e,t])=>z(Wa(t),([t,n])=>z(ka(`$`,n),([n,r])=>[[e,t,n],r]))),([e,t])=>[ha(e),t]);function Ka(e){return e.join(`|`)}function qa(e){return e.slice(1,e.length-1)}function Ja(e,t,n){return ao(t,`${n}${e}`)}function Ya(e,t){return ao(e,`${t}-?(?:0|[1-9][0-9]*)n`)}function Xa(e,t){return ao(e,`${t}${nr}`)}function Za(e,t){return ao(e,`${t}${mr}`)}function Qa(e,t){return io(I([P(`false`),P(`true`)]),e,t)}function $a(e,t){return ao(e,`${t}.*`)}function eo(e,t,n){return ao(t,`${n}${qa(e)}`)}function to(e,t,n){return io(co(e,{}),t,n)}function no(e,t,n){return io(vi(e),t,n)}function ro(e,t,n,r=[]){return S(e,(e,i)=>ro(i,t,n,[...r,io(e,[],``)]),()=>ao(t,`${n}(${Ka(r)})`))}function io(e,t,n){return _n(e)?no(e.enum,t,n):ir(e)?Xa(t,n):F(e)?Ja(e.const,t,n):er(e)?Ya(t,n):tr(e)?Qa(t,n):gr(e)?Za(t,n):br(e)?$a(t,n):po(e)?eo(e.pattern,t,n):fo(e)?to(e.parameters[0],t,n):L(e)?ro(e.anyOf,t,n):`(?!)`}function ao(e,t){return S(e,(e,n)=>io(e,n,t),()=>t)}function oo(e){return`^${ao(e,``)}$`}function so(e){return Or(oo(e))}function co(e,t){return G(e)?E(so(e),{},t):uo(e,t)}function lo(e,t,n,r){return co(gf(e,t,n),r)}function uo(e,t={}){return O(`TemplateLiteral`,[e],t)}function fo(e){return kt(e)&&C(e,`action`)&&x(e.action,`TemplateLiteral`)}function po(e){return D(e,`TemplateLiteral`)}function mo(e){return T({"~kind":`ExtendsUnion`},{inferred:e})}function ho(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsUnion`)&&b(e.inferred)}function B(e){return T({"~kind":`ExtendsTrue`},{inferred:e})}function go(e){return b(e)&&C(e,`~kind`)&&C(e,`inferred`)&&x(e[`~kind`],`ExtendsTrue`)&&b(e.inferred)}function V(){return T({"~kind":`ExtendsFalse`},{})}function _o(e){return b(e)&&C(e,`~kind`)&&x(e[`~kind`],`ExtendsFalse`)}function vo(e){return ho(e)||go(e)}function H(e,t,n){return vo(e)?t(e.inferred):n()}function yo(e,t,n,r){return H(W(e,n,r),r=>B(v(v(e,r),{[t]:n})),()=>V())}function bo(e,t){return B(e)}function xo(e,t,n,r,i){return H(W(e,t,n),e=>H(W(e,t,r),e=>B(e),()=>V()),()=>H(W(e,t,i),e=>B(e),()=>V()))}function So(e,t,n){return W(e,t,vi(n))}function Co(e,t,n){return S(n,(n,r)=>H(W(e,t,n),e=>Co(e,t,r),()=>V()),()=>B(e))}function wo(e,t,n){return W(e,t,bi(n))}function To(e,t,n){return S(n,(n,r)=>H(W(e,t,n),e=>B(e),()=>To(e,t,r)),()=>V())}function U(e,t,n){return Zt(n)?bo(e,t):hn(n)?xo(e,t,n.if,n.then,n.else):_n(n)?So(e,t,n.enum):pn(n)?yo(e,n.name,t,n.extends):j(n)?Co(e,t,n.allOf):po(n)?wo(e,t,n.pattern):L(n)?To(e,t,n.anyOf):ln(n)?B(e):V()}function Eo(e,t,n){return pn(n)?U(e,t,n):Zt(n)||ln(n)?B(e):mo(e)}function Do(e,t){let n=Xn(e),r=Xn(t);return n&&r||!n&&r?!0:!(n&&!r)}function Oo(e,t,n,r){return Rt(r)?Do(t,r)?W(e,n,r.items):V():U(e,t,r)}function ko(e,t,n){return er(n)?B(e):U(e,t,n)}function Ao(e,t,n){return tr(n)?B(e):U(e,t,n)}function jo(e,t,n,r,i){let a=pn(r)?t:r,o=pn(r)?r:t,s=nn(t),c=nn(r);return!s&&c?V():H(W(e,a,o),e=>Po(e,n,i),()=>V())}function Mo(e,t,n,r){return S(r,(r,i)=>jo(e,t,n,r,i),()=>nn(t)?B(e):V())}function No(e,t,n){return S(t,(t,r)=>Mo(e,t,r,n),()=>B(e))}function Po(e,t,n){return No(e,t,n)}function Fo(e,t,n){return ra(n)?B(e):W(e,t,n)}function Io(e,t,n,r){return Zt(r)||ln(r)?B(e):Vt(r)?H(Po(e,t,r.parameters),e=>Fo(e,n,r.instanceType),()=>V()):V()}function Lo(e,t,n,r,i){return H(W(e,t,i),()=>W(e,n,i),()=>W(e,r,i))}function Ro(e,t,n){return W(e,vi(t),n)}function zo(e,t,n,r){return Zt(r)||ln(r)?B(e):Wt(r)?H(Po(e,t,r.parameters),e=>Fo(e,n,r.returnType),()=>V()):V()}function Bo(e,t,n){return ir(n)||gr(n)?B(e):U(e,t,n)}function Vo(e,t,n){return W(e,yi(t),n)}function Ho(e,t,n){return t===n?B(e):V()}function Uo(e,t,n){return F(n)?Ho(e,t,n.const):er(n)?B(e):U(e,P(t),n)}function Wo(e,t,n){return F(n)?Ho(e,t,n.const):tr(n)?B(e):U(e,P(t),n)}function Go(e,t,n){return F(n)?Ho(e,t,n.const):gr(n)?B(e):U(e,P(t),n)}function Ko(e,t,n){return F(n)?Ho(e,t,n.const):br(n)?B(e):U(e,P(t),n)}function qo(e,t,n){return De(t.const)?Uo(e,t.const,n):Oe(t.const)?Wo(e,t.const,n):Ne(t.const)?Go(e,t.const,n):Fe(t.const)?Ko(e,t.const,n):bn()}function Jo(e,t,n){return pn(n)?U(e,t,n):B(e)}function Yo(e,t,n){return pr(n)?B(e):U(e,t,n)}function Xo(e,t,n){return gr(n)?B(e):U(e,t,n)}function Zo(e,t,n){return nn(t)?nn(n)?B(e):V():B(e)}function Qo(e,t,n){return pn(n)&&$t(n.extends)?V():H(W(e,t,n),e=>Zo(e,t,n),()=>V())}function $o(e,t){return e.reduce((e,n)=>n in t&&vo(t[n])?{...e,...t[n].inferred}:bn(),{})}function es(e,t,n){let r={};for(let i of w(n))r[i]=i in t?Qo({},t[i],n[i]):nn(n[i])?pn(n[i])?B(v(e,{[n[i].name]:n[i].extends})):B(e):V();let i=et(r).every(e=>vo(e)),a=i?$o(w(r),r):{};return i?B(a):V()}function ts(e,t,n){let r=es(e,t,n);return vo(r)?B(v(e,r.inferred)):V()}function ns(e,t,n){return ts(e,t,n)}function rs(e,t){return w(t).reduce((n,r)=>({...n,[r]:C(e,r)?L(n[r])?I([...n[r].anyOf,t[r]]):I([e[r],t[r]]):t[r]}),e)}function is(e,t,n,r){return S(t,(t,i)=>H(W({},e[t],n),t=>is(e,i,n,rs(r,t)),()=>V()),()=>B(r))}function as(e,t,n,r){return is(t,w(t),r,e)}function os(e,t,n){return Zi(n)?as(e,t,Ji(n),Xi(n)):A(n)?ns(e,t,n.properties):U(e,k(t),n)}function ss(e,t){return x(w(t).length,0)?B(e):V()}function cs(e,t,n,r,i){return W(e,n,i)}function ls(e,t,n,r){return Zi(r)?cs(e,qi(t),n,qi(Ji(r)),Xi(r)):A(r)?ss(e,r.properties):Zt(r)||ln(r)?B(e):V()}function us(e,t,n){return br(n)?B(e):U(e,t,n)}function ds(e,t,n){return vr(n)?B(e):U(e,t,n)}function fs(e,t,n){return W(e,bi(t),n)}function ps(e,t){return T({"~kind":`Inferrable`},{name:e,type:t},{})}function ms(e){return b(e)&&C(e,`~kind`)&&C(e,`name`)&&C(e,`type`)&&x(e[`~kind`],`Inferrable`)&&Fe(e.name)&&b(e.type)}function hs(e){return $i(e)?pn(e.items)?Rt(e.items.extends)?ps(e.items.name,e.items.extends.items):ln(e.items.extends)?ps(e.items.name,e.items.extends):void 0:bn():void 0}function gs(e){return pn(e)?ps(e.name,e.extends):void 0}function _s(e,t,n=[]){return S(e,(e,r)=>H(W({},e,t),()=>_s(r,t,[...n,e]),()=>void 0),()=>n)}function vs(e,t,n,r){let i=_s(n,r);return Ee(i)?B(v(e,{[t]:Hr(i)})):V()}function ys(e,t,n,r){let i=_s(n,r);return Ee(i)?B(v(e,{[t]:I(i)})):V()}function bs(e){return[...e].reverse()}function xs(e,t){return t?bs(e):e}function Ss(e){let t=e.length>0?e[0]:void 0;return kt(kt(t)?hs(t):void 0)}function Cs(e,t,n,r,i,a){return H(W(e,n,i),e=>Es(e,t,r,a),()=>V())}function ws(e,t,n,r,i){let a=hs(r);return ms(a)?vs(e,a.name,xs(n,t),a.type):S(n,(n,a)=>Cs(e,t,n,a,r,i),()=>V())}function Ts(e,t,n,r){return S(r,(r,i)=>ws(e,t,n,r,i),()=>x(n.length,0)?B(e):V())}function Es(e,t,n,r){return Ts(e,t,n,r)}function Ds(e,t,n){let r=hf(e,pf([],[]),n),i=Ss(r);return Es(e,i,xs(t,i),xs(r,i))}function Os(e,t,n){let r=gs(n);return ms(r)?ys(e,r.name,t,r.type):S(t,(t,r)=>H(W(e,t,n),e=>Os(e,r,n),()=>V()),()=>B(e))}function ks(e,t,n){let r=hf(e,pf([],[]),t);return R(n)?Ds(e,r,n.items):Rt(n)?Os(e,r,n.items):U(e,Hr(r),n)}function As(e,t,n){return ra(n)||na(n)?B(e):U(e,t,n)}function js(e,t,n){return S(n,(n,r)=>H(W(e,t,n),e=>B(e),()=>js(e,t,r)),()=>V())}function Ms(e,t,n){return S(t,(t,r)=>H(js(e,t,n),e=>Ms(e,r,n),()=>V()),()=>B(e))}function Ns(e,t,n){let r=gs(n);return ms(r)?ys(e,r.name,t,r.type):L(n)?Ms(e,t,n.anyOf):Ms(e,t,[n])}function Ps(e,t,n){return pn(n)?U(e,t,n):Zt(n)||ln(n)?B(e):V()}function Fs(e,t,n){return ra(n)?B(e):U(e,t,n)}function W(e,t,n){return Zt(t)?Eo(e,t,n):Rt(t)?Oo(e,t,t.items,n):er(t)?ko(e,t,n):tr(t)?Ao(e,t,n):Vt(t)?Io(e,t.parameters,t.instanceType,n):hn(t)?Lo(e,t.if,t.then,t.else,n):_n(t)?Ro(e,t.enum,n):Wt(t)?zo(e,t.parameters,t.returnType,n):ir(t)?Bo(e,t,n):j(t)?Vo(e,t.allOf,n):F(t)?qo(e,t,n):$t(t)?Jo(e,t,n):pr(t)?Yo(e,t,n):gr(t)?Xo(e,t,n):A(t)?os(e,t.properties,n):Zi(t)?ls(e,Ji(t),Xi(t),n):br(t)?us(e,t,n):vr(t)?ds(e,t,n):po(t)?fs(e,t.pattern,n):R(t)?ks(e,t.items,n):na(t)?As(e,t,n):L(t)?Ns(e,t.anyOf,n):ln(t)?Ps(e,t,n):ra(t)?Fs(e,t,n):V()}function Is(e,t){return yi([...e,k(t)])}function Ls(e,t,n){return G(e)?E(Is(e,t),{},n):zs(e,t,n)}function Rs(e,t,n,r,i){return Ls(gf(e,t,n),mf(e,t,r),i)}function zs(e,t,n={}){return O(`Interface`,[e,t],n)}function Bs(e){return kt(e)&&C(e,`action`)&&x(e.action,`Interface`)}function Vs(e,t,n){return e.includes(n)?!0:Ws([...e,n],t,t[n])}function Hs(e,t,n){return Us(e,t,on(n))}function Us(e,t,n){return S(n,(n,r)=>Ws(e,t,n)?!0:Us(e,t,r),()=>!1)}function Ws(e,t,n){return qt(n)?Vs(e,t,n.$ref):Rt(n)?Ws(e,t,n.items):Vt(n)?Us(e,t,[...n.parameters,n.instanceType]):Wt(n)?Us(e,t,[...n.parameters,n.returnType]):Bs(n)?Hs(e,t,n.parameters[1]):j(n)?Us(e,t,n.allOf):A(n)?Hs(e,t,n.properties):L(n)?Us(e,t,n.anyOf):R(n)?Us(e,t,n.items):Zi(n)?Ws(e,t,Xi(n)):!1}function Gs(e,t,n){return Ws(e,t,n)}function Ks(e,t){return t.reduce((t,n)=>Gs([n],e,e[n])?[...t,n]:t,[])}function qs(e){return Ks(e,an(e))}function Js(e,t,n){return n.includes(t)?n:t in e?Zs(e,e[t],[...n,t]):bn()}function Ys(e,t,n){return Xs(e,on(t),n)}function Xs(e,t,n){return t.reduce((t,n)=>Zs(e,n,t),n)}function Zs(e,t,n){return qt(t)?Js(e,t.$ref,n):Rt(t)?Zs(e,t.items,n):Vt(t)?Xs(e,[...t.parameters,t.instanceType],n):Wt(t)?Xs(e,[...t.parameters,t.returnType],n):Bs(t)?Ys(e,t.parameters[1],n):j(t)?Xs(e,t.allOf,n):A(t)?Ys(e,t.properties,n):L(t)?Xs(e,t.anyOf,n):R(t)?Xs(e,t.items,n):Zi(t)?Zs(e,Xi(t),n):n}function Qs(e,t,n){return Zs(e,n,[t])}function $s(e){return Xt()}function ec(e){return w(e).reduce((t,n)=>({...t,[n]:nc(e[n])}),{})}function tc(e){return e.reduce((e,t)=>[...e,nc(t)],[])}function nc(e){return qt(e)?$s(e.$ref):Rt(e)?Lt(nc(e.items),zt(e)):Vt(e)?Bt(tc(e.parameters),nc(e.instanceType)):Wt(e)?Ut(tc(e.parameters),nc(e.returnType)):j(e)?vn(tc(e.allOf)):A(e)?k(ec(e.properties)):Zi(e)?Gi(Yi(e),nc(Xi(e))):L(e)?I(tc(e.anyOf)):R(e)?Hr(tc(e.items)):e}function rc(e,t){return t in e?nc(e[t]):cn()}function ic(e){return rc(e.$defs,e.$ref)}function ac(e,t,n){let r=gf(e,pf([],[]),t),i=mf({},pf([],[]),n);return yi([...r,k(i)])}function oc(e,t){return w(e).filter(e=>t.includes(e)).reduce((t,n)=>{let r=e[n],i=Bs(r)?ac(e,r.parameters[0],r.parameters[1]):r;return{...t,[n]:i}},{})}function sc(e,t,n){return un(oc(e,Qs(e,t,n)),t)}function cc(e,t){return t in e?qt(e[t])?cc(e,e[t].$ref):e[t]:Qt()}function lc(e,t){return cc(e,t)}function uc(e){return dn(e)?ic(e):fn(e)?cn():e}function dc(e,t,n){return W(e,uc(t),uc(n))}function fc(e,t){let n=[ln(e)?V():dc({},e,t),ln(e)?B({}):dc({},t,e)];return vo(n[0])&&vo(n[1])?`equal`:vo(n[0])&&_o(n[1])?`left-inside`:_o(n[0])&&vo(n[1])?`right-inside`:`disjoint`}function pc(e,t){return t.filter(t=>fc(e,t)!==`right-inside`)}function mc(e,t){return x(t.some(t=>{let n=fc(e,t);return x(n,`left-inside`)||x(n,`equal`)}),!1)}function hc(e,t){let n=Si(e);return Zt(n)?[n]:mc(n,t)?[...pc(n,t),n]:t}function gc(e){return e.reduce((e,t)=>A(t)?[...e,t]:$t(t)?e:hc(t,e),[])}function _c(e){return Mi(gc(e))}function vc(e,t){return E(Si(e),{},t)}function yc(e,t,n,r){return vc(K(e,t,n),r)}function bc(e,t=[]){return At(e)&&x(e.action,`Conditional`)?qt(e.parameters[0])?bc(e.parameters[2],bc(e.parameters[3],[...t,e.parameters[0].$ref])):bc(e.parameters[2],bc(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 xc(e,t){return e.reduce((e,n)=>[...e,t.includes(n.name)],[])}function Sc(e,t,n=[]){return S(e,(e,r)=>S(t,(t,i)=>Sc(r,i,[...n,[t,e]]),()=>n),()=>n)}function Cc(e){return L(e)?[...e.anyOf]:[e]}function wc(e,t){return e.reduce((e,n)=>[...e,[...n,t]],[])}function Tc(e,t){return t.reduce((t,n)=>[...t,...wc(e,n)],[])}function Ec(e){return e.reduce((e,t)=>x(t[0],!0)?Tc(e,Cc(t[1])):Tc(e,[t[1]]),[[]])}function Dc(e,t,n){let r=Sc(t,xc(e,bc(n)));return At(n)&&x(n.action,`Conditional`)||At(n)&&x(n.action,`Mapped`)?Ec(r):[t]}function Oc(){return[`(not-resolvable)`,Qt()]}function kc(){return[`(not-generic)`,Qt()]}function Ac(e,t,n){return[e,Jt(t,n)]}function jc(e,t,n){return t in e?Mc(e,t,e[t],n):Oc()}function Mc(e,t,n,r){return Yt(n)?Ac(t,n.parameters,n.expression):qt(n)?jc(e,n.$ref,r):kc()}function Nc(e,t,n){return Mc(e,`(anonymous)`,t,n)}function Pc(e,t,n){if(pn(t)||Kc(t)||vo(dc({},t,n)))return;let r={parameter:e,expect:n,actual:t};throw Error(`Argument for parameter ${e} does not satisfy constraint`,{cause:r})}function Fc(e,t,n,r,i){let a=K(e,t,i);return Pc(n,a,r),v(e,{[n]:a})}function Ic(e,t,n,r,i){let a=K(e,t,n.extends),o=K(e,t,n.equals);return S(i,(i,o)=>Lc(Fc(e,t,n.name,a,i),t,r,o),()=>Lc(Fc(e,t,n.name,a,o),t,r,[]))}function Lc(e,t,n,r){return S(n,(n,i)=>Ic(e,t,n,i,r),()=>e)}function Rc(e,t,n,r){return Lc(e,t,n,r)}function zc(e){return Re(e.callstack.length,0)?e.callstack[e.callstack.length-1]:``}function Bc(e,t){return x(zc(e),t)}function Vc(e,t,n,r,i,a){let o=Rc(e,t,r,a),s=K(o,pf([...t.callstack,n.$ref],t.visited),i);return K(o,pf([],[]),s)}function Hc(e,t,n,r,i,a){return a.reduce((a,o)=>[...a,Vc(e,t,n,r,i,o)],[])}function Uc(e,t,n,r,i,a){let o=Hc(e,t,n,r,i,Dc(r,a,i));return x(o.length,1)?o[0]:xi(o)}function Wc(e,t,n,r){let i=gf(e,t,r),a=Nc(e,n,r),o=a[0],s=a[1];return Yt(s)?Bc(t,o)?Gc(Kt(o),i):Uc(e,t,Kt(o),s.parameters,s.expression,i):Gc(n,i)}function Gc(e,t){return T({"~kind":`Call`},{type:`call`,target:e,arguments:t},{})}function Kc(e){return D(e,`Call`)}function qc(e){return Ot(e,[`~immutable`])}function Jc(e,t){return E(qc(e),{},t)}function Yc(e,t,n,r){return Jc(K(e,t,n),r)}function Xc(e,t){return e(t)}function Zc(e,t){return Fe(t)?P(Xc(e,t)):P(t)}function Qc(e,t){return el(e,bi(t))}function $c(e,t){return I(t.map(t=>el(e,t)))}function el(e,t){return F(t)?Zc(e,t.const):po(t)?Qc(e,t.pattern):L(t)?$c(e,t.anyOf):t}function tl(e,t={}){return O(`Capitalize`,[e],t)}function nl(e,t={}){return O(`Lowercase`,[e],t)}function rl(e,t={}){return O(`Uncapitalize`,[e],t)}function il(e,t={}){return O(`Uppercase`,[e],t)}const al=e=>e[0].toUpperCase()+e.slice(1),ol=e=>e.toLowerCase(),sl=e=>e[0].toLowerCase()+e.slice(1),cl=e=>e.toUpperCase();function ll(e,t){return G([e])?E(el(al,e),{},t):tl(e,t)}function ul(e,t){return G([e])?E(el(ol,e),{},t):nl(e,t)}function dl(e,t){return G([e])?E(el(sl,e),{},t):rl(e,t)}function fl(e,t){return G([e])?E(el(cl,e),{},t):il(e,t)}function pl(e,t,n,r){return ll(K(e,t,n),r)}function ml(e,t,n,r){return ul(K(e,t,n),r)}function hl(e,t,n,r){return dl(K(e,t,n),r)}function gl(e,t,n,r){return fl(K(e,t,n),r)}function _l(e,t,n,r,i={}){return O(`Conditional`,[e,t,n,r],i)}function vl(e,t,n,r,i,a){let o=dc(e,n,r);return ho(o)?I([K(o.inferred,t,i),K(e,t,a)]):go(o)?K(o.inferred,t,i):K(e,t,a)}function yl(e,t,n,r,i,a,o){return G([n,r])?E(vl(e,t,n,r,i,a),{},o):_l(n,r,i,a,o)}function bl(e,t,n,r,i,a,o){return yl(e,t,K(e,t,n),K(e,t,r),i,a,o)}function xl(e,t={}){return O(`ConstructorParameters`,[e],t)}function Sl(e){let t=Vt(e)?e.parameters:[];return Hr(hf({},pf([],[]),t))}function Cl(e,t){return G([e])?E(Sl(e),{},t):xl(e,t)}function wl(e,t,n,r){return Cl(K(e,t,n),r)}function Tl(e,t,n={}){return O(`Exclude`,[e,t],n)}function El(e,t,n){return G([e,t])?E(gi(e,t),{},n):Tl(e,t,n)}function Dl(e,t,n,r,i){return El(K(e,t,n),K(e,t,r),i)}function Ol(e,t,n={}){return O(`Extract`,[e,t],n)}function kl(e,t){return vo(dc({},e,t))?[e]:[]}function Al(e,t){return e.reduce((e,n)=>[...e,...kl(n,t)],[])}function jl(e,t){let n=Si(e);return xi(Al(L(n)?n.anyOf:[n],t))}function Ml(e,t,n){return G([e,t])?E(jl(e,t),{},n):Ol(e,t,n)}function Nl(e,t,n,r,i){return Ml(K(e,t,n),K(e,t,r),i)}function Pl(e,t,n={}){return O(`Index`,[e,t],n)}function Fl(e,t){return Wl(lc(e,t))}function Il(e,t,n){return Wl(_i(e,t,n))}function Ll(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]:yi([e[r],t[r]])}),{});return v(v(a,o),s)}function Rl(e){return e.reduce((e,t)=>Ll(e,Wl(t)),{})}function zl(e){return e}function Bl(e){return Wl($r(Hr(e)))}function Vl(e,t){return w(e).filter(e=>e in t).reduce((n,r)=>({...n,[r]:xi([e[r],t[r]])}),{})}function Hl(e,t){return S(e,(e,n)=>Hl(n,Vl(t,Wl(e))),()=>t)}function Ul(e){return S(e,(e,t)=>Hl(t,Wl(e)),()=>bn())}function Wl(e){return dn(e)?Fl(e.$defs,e.$ref):hn(e)?Il(e.if,e.then,e.else):j(e)?Rl(e.allOf):L(e)?Ul(e.anyOf):R(e)?Bl(e.items):A(e)?zl(e.properties):{}}function Gl(e){return k(Wl(e))}const Kl=RegExp(`^(?:0|[1-9][0-9]*)$`);function ql(e){let t=`${e}`;return Kl.test(t)?parseInt(t):e}function Jl(e){return P(ql(e))}function Yl(e){return e.map(e=>Xl(e))}function Xl(e){return j(e)?vn(Yl(e.allOf)):L(e)?I(Yl(e.anyOf)):F(e)?Jl(e.const):e}function Zl(e,t){return vo(dc({},Xl(t),hr()))?e:F(t)&&x(t.const,`length`)?hr():Qt()}function Ql(e,t){return au(lc(e,t))}function $l(e,t,n){return au(_i(e,t,n))}function eu(e){return au(vi(e))}function tu(e){return au(yi(e))}function nu(e){return[`${e}`]}function ru(e){return au(bi(e))}function iu(e){return e.reduce((e,t)=>[...e,...au(t)],[])}function au(e){return dn(e)?Ql(e.$defs,e.$ref):hn(e)?$l(e.if,e.then,e.else):_n(e)?eu(e.enum):j(e)?tu(e.allOf):F(e)?nu(e.const):po(e)?ru(e.pattern):L(e)?iu(e.anyOf):[]}function ou(e){return au(e)}function su(e,t){return t.map(t=>cu(e,t))}function cu(e,t){return Rt(t)?Lt(cu(e,t.items)):Vt(t)?Bt(su(e,t.parameters),cu(e,t.instanceType)):Wt(t)?Ut(su(e,t.parameters),cu(e,t.returnType)):R(t)?Hr(su(e,t.items)):L(t)?I(su(e,t.anyOf)):j(t)?vn(su(e,t.allOf)):ea(t)?k(e):t}function lu(e,t){return cu(e,t)}function uu(e,t){return lu(e,t in e?e[t]:Qt())}function du(e,t){return t.reduce((t,n)=>[...t,uu(e,n)],[])}function fu(e,t){return xi(du(e,ou(t)))}const pu=new RegExp(Vi);function mu(e){return e.filter(e=>pu.test(e))}function hu(e){return xi(du(e,mu(an(e))))}function gu(e,t){return gr(t)?hu(e):fu(e,t)}function _u(e){return P(ql(e))}function vu(e){return e.map(e=>yu(e))}function yu(e){return j(e)?vn(vu(e.allOf)):L(e)?I(vu(e.anyOf)):F(e)?_u(e.const):e}function bu(e,t){return e.reduceRight((e,n,r)=>vo(dc({},P(r),t))?[n,...e]:e,[])}function xu(e,t){return Ci(bu(e,yu(t)))}function Su(e){return Ci(e)}function Cu(e,t){return F(t)&&x(t.const,`length`)?P(e.length):gr(t)||ir(t)?Su(e):xu(e,t)}function wu(e,t){return Rt(e)?Zl(e.items,t):A(e)?gu(e.properties,t):R(e)?Cu(e.items,t):Qt()}function Tu(e){return dn(e)||hn(e)||j(e)||L(e)?Gl(e):e}function Eu(e,t,n){return G([e,t])?E(wu(Tu(e),t),{},n):Pl(e,t,n)}function Du(e,t,n,r,i){return Eu(K(e,t,n),K(e,t,r),i)}function Ou(e,t={}){return O(`InstanceType`,[e],t)}function ku(e){return Vt(e)?e.instanceType:Qt()}function Au(e,t){return G([e])?E(ku(e),{},t):Ou(e,t)}function ju(e,t,n,r={}){return Au(K(e,t,n),r)}function Mu(e,t={}){return O(`KeyOf`,[e],t)}function Nu(){return I([hr(),yr(),_r()])}function Pu(e){return hr()}function Fu(e){return e.reduce((e,t)=>sr(t)?[...e,P(ql(t))]:bn(),[])}function Iu(e){return Ci(Fu(w(e)))}function Lu(e){return Yi(e)}function Ru(e){return Ci(e.map((e,t)=>P(t)))}function zu(e){return Zt(e)?Nu():Rt(e)?Pu(e.items):A(e)?Iu(e.properties):Zi(e)?Lu(e):R(e)?Ru(e.items):Qt()}function Bu(e){return dn(e)||hn(e)||j(e)||L(e)?Gl(e):e}function Vu(e,t){return G([e])?E(zu(Bu(e)),{},t):Mu(e,t)}function Hu(e,t,n,r){return Vu(K(e,t,n),r)}function Uu(e,t,n,r,i={}){return O(`Mapped`,[e,t,n,r],i)}function Wu(e){return Ju(bi(e))}function Gu(e){return e.reduce((e,t)=>[...e,...Ju(t)],[])}function Ku(e){return Ju(vi(e))}function qu(e){return Ne(e)?[P(`${e}`)]:[P(e)]}function Ju(e){return _n(e)?Ku(e.enum):F(e)?qu(e.const):po(e)?Wu(e.pattern):L(e)?Gu(e.anyOf):[e]}function Yu(e){return Ju(e)}function Xu(e){return po(e)?bi(e.pattern):e}function Zu(e,t,n,r,i,a){let o=v(e,{[n.name]:r}),s=Xu(K(o,t,i)),c=K(o,t,a);return ur(s)||dr(s)?{[s.const]:c}:{}}function Qu(e,t,n,r,i,a){return r.reduce((r,o)=>[...r,Zu(e,t,n,o,i,a)],[])}function $u(e){return e.reduce((e,t)=>[...e,k(t)],[])}function ed(e,t,n,r,i,a){return yi($u(Qu(e,t,n,Yu(r),i,a)))}function td(e,t,n,r,i,a,o){return G([r])?E(ed(e,t,n,r,i,a),{},o):Uu(n,r,i,a,o)}function nd(e,t,n,r,i,a,o){return td(e,t,n,K(e,t,r),i,a,o)}function rd(e,t,n){let r=v(e,t);return w(t).filter(e=>n.includes(e)).reduce((e,n)=>({...e,[n]:sc(r,n,t[n])}),{})}function id(e,t,n){let r=v(e,t);return w(t).filter(e=>!n.includes(e)).reduce((e,n)=>({...e,[n]:K(r,pf([],[]),t[n])}),{})}function ad(e,t,n){let r=qs(t),i=rd(e,t,r),a=id(e,t,r);return E({...i,...a},{},n)}function od(e,t,n,r){return ad(e,n,r)}function sd(e,t={}){return O(`NonNullable`,[e],t)}function cd(e){return El(e,I([fr(),ta()]),{})}function ld(e,t){return G([e])?E(cd(e),{},t):sd(e,t)}function ud(e,t,n,r){return ld(K(e,t,n),r)}function dd(e,t,n={}){return O(`Omit`,[e,t],n)}function fd(e){let t=Gl(e);return A(t)?t.properties:bn()}function pd(e,t){return w(e).reduce((n,r)=>t.includes(r)?n:{...n,[r]:e[r]},{})}function md(e,t){return k(pd(fd(e),ou(t)))}function hd(e,t,n){return G([e,t])?E(md(e,t),{},n):dd(e,t,n)}function gd(e,t,n,r,i){return hd(K(e,t,n),K(e,t,r),i)}function _d(e,t={}){return O(`Parameters`,[e],t)}function vd(e){let t=Wt(e)?e.parameters:[];return Hr(hf({},pf([],[]),t))}function yd(e,t){return G([e])?E(vd(e),{},t):_d(e,t)}function bd(e,t,n,r){return yd(K(e,t,n),r)}function xd(e,t={}){return O(`Partial`,[e],t)}function Sd(e,t){let n=Dd(lc(e,t));return un(v(e,{[t]:n}),t)}function Cd(e,t,n){return Dd(_i(e,t,n))}function wd(e){return Dd(yi(e))}function Td(e){return I(e.map(e=>Dd(e)))}function Ed(e){return k(w(e).reduce((t,n)=>({...t,[n]:en(e[n])}),{}))}function Dd(e){return dn(e)?Sd(e.$defs,e.$ref):hn(e)?Cd(e.if,e.then,e.else):j(e)?wd(e.allOf):L(e)?Td(e.anyOf):A(e)?Ed(e.properties):k({})}function Od(e,t){return G([e])?E(Dd(e),{},t):xd(e,t)}function kd(e,t,n,r){return Od(K(e,t,n),r)}function Ad(e,t,n={}){return O(`Pick`,[e,t],n)}function jd(e,t){return w(e).reduce((n,r)=>t.includes(r)?v(n,{[r]:e[r]}):n,{})}function Md(e,t){return k(jd(fd(e),ou(t)))}function Nd(e,t,n){return G([e,t])?E(Md(e,t),{},n):Ad(e,t,n)}function Pd(e,t,n,r,i){return Nd(K(e,t,n),K(e,t,r),i)}function Fd(e,t={}){return O(`ReadonlyObject`,[e],t)}function Id(e){return wf(Lt(e))}function Ld(e,t){let n=Ud(lc(e,t));return un(v(e,{[t]:n}),t)}function Rd(e,t,n){return Ud(_i(e,t,n))}function zd(e){return Ud(yi(e))}function Bd(e){return k(w(e).reduce((t,n)=>({...t,[n]:Zn(e[n])}),{}))}function Vd(e){return wf(Hr(e))}function Hd(e){return I(e.map(e=>Ud(e)))}function Ud(e){return Rt(e)?Id(e.items):dn(e)?Ld(e.$defs,e.$ref):hn(e)?Rd(e.if,e.then,e.else):j(e)?zd(e.allOf):A(e)?Bd(e.properties):R(e)?Vd(e.items):L(e)?Hd(e.anyOf):e}function Wd(e,t){return G([e])?E(Ud(e),{},t):Fd(e)}function Gd(e,t,n,r){return Wd(K(e,t,n),r)}function Kd(e,t,n,r){return t.visited.includes(r)?n:r in e?K(e,pf(t.callstack,[...t.visited,r]),e[r]):n}function qd(e,t){let n=Qd(lc(e,t));return un(v(e,{[t]:n}),t)}function Jd(e,t,n){return Qd(_i(e,t,n))}function Yd(e){return Qd(yi(e))}function Xd(e){return I(e.map(e=>Qd(e)))}function Zd(e){return k(w(e).reduce((t,n)=>({...t,[n]:Zr(e[n])}),{}))}function Qd(e){return dn(e)?qd(e.$defs,e.$ref):hn(e)?Jd(e.if,e.then,e.else):j(e)?Yd(e.allOf):L(e)?Xd(e.anyOf):A(e)?Zd(e.properties):k({})}function $d(e,t={}){return O(`Required`,[e],t)}function ef(e,t){return G([e])?E(Qd(e),{},t):$d(e,t)}function tf(e,t,n,r){return ef(K(e,t,n),r)}function nf(e,t={}){return O(`ReturnType`,[e],t)}function rf(e){return Wt(e)?e.returnType:Qt()}function af(e,t){return G([e])?E(rf(e),{},t):nf(e,t)}function of(e,t,n,r={}){return af(K(e,t,n),r)}function sf(e,t){return O(`With`,[e,t],{})}function cf(e,t){return lf(e,t)}function lf(e,t){return G([e])?E(e,{},t):sf(e,t)}function uf(e,t,n,r){return lf(K(e,t,n),r)}function df(e){return $i(e)?R(e.items)?ff(e.items.items):pn(e.items)||qt(e.items)?[e]:[Qt()]:[e]}function ff(e){return e.reduce((e,t)=>[...e,...df(t)],[])}function pf(e,t){return{callstack:e,visited:t}}function G(e){return S(e,(e,t)=>!qt(e)&&G(t),()=>!0)}function mf(e,t,n){return w(n).reduce((r,i)=>({...r,[i]:K(e,t,n[i])}),{})}function hf(e,t,n){return ff(gf(e,t,n))}function gf(e,t,n){return n.map(n=>K(e,t,n))}function _f(e,t){let n=nn(e)?Ft(t,{}):t,r=Qn(e)?Mt(n,{}):n;return Xn(e)?Sf(r,{}):r}function vf(e,t,n,r,i){return x(n,`AddImmutable`)?Cf(e,t,r[0],i):x(n,`RemoveImmutable`)?Yc(e,t,r[0],i):x(n,`AddReadonly`)?Nt(e,t,r[0],i):x(n,`RemoveReadonly`)?Kr(e,t,r[0],i):x(n,`AddOptional`)?It(e,t,r[0],i):x(n,`RemoveOptional`)?Xr(e,t,r[0],i):x(n,`Capitalize`)?pl(e,t,r[0],i):x(n,`Conditional`)?bl(e,t,r[0],r[1],r[2],r[3],i):x(n,`ConstructorParameters`)?wl(e,t,r[0],i):x(n,`Evaluate`)?yc(e,t,r[0],i):x(n,`Exclude`)?Dl(e,t,r[0],r[1],i):x(n,`Extract`)?Nl(e,t,r[0],r[1],i):x(n,`Index`)?Du(e,t,r[0],r[1],i):x(n,`InstanceType`)?ju(e,t,r[0],i):x(n,`Interface`)?Rs(e,t,r[0],r[1],i):x(n,`KeyOf`)?Hu(e,t,r[0],i):x(n,`Lowercase`)?ml(e,t,r[0],i):x(n,`Mapped`)?nd(e,t,r[0],r[1],r[2],r[3],i):x(n,`Module`)?od(e,t,r[0],i):x(n,`NonNullable`)?ud(e,t,r[0],i):x(n,`Pick`)?Pd(e,t,r[0],r[1],i):x(n,`Parameters`)?bd(e,t,r[0],i):x(n,`Partial`)?kd(e,t,r[0],i):x(n,`Omit`)?gd(e,t,r[0],r[1],i):x(n,`ReadonlyObject`)?Gd(e,t,r[0],i):x(n,`Record`)?Bi(e,t,r[0],r[1],i):x(n,`Required`)?tf(e,t,r[0],i):x(n,`ReturnType`)?of(e,t,r[0],i):x(n,`TemplateLiteral`)?lo(e,t,r[0],i):x(n,`Uncapitalize`)?hl(e,t,r[0],i):x(n,`Uppercase`)?gl(e,t,r[0],i):x(n,`With`)?uf(e,t,r[0],r[1]):O(n,r,i)}function yf(e,t,n){return _f(n,qt(n)?Kd(e,t,n,n.$ref):Rt(n)?Lt(K(e,t,n.items),zt(n)):Kc(n)?Wc(e,t,n.target,n.arguments):Vt(n)?Bt(gf(e,t,n.parameters),K(e,t,n.instanceType),Ht(n)):Wt(n)?Ut(gf(e,t,n.parameters),K(e,t,n.returnType),Gt(n)):hn(n)?mn(K(e,t,n.if),K(e,t,n.then),K(e,t,n.else),gn(n)):j(n)?vn(gf(e,t,n.allOf),yn(n)):A(n)?k(mf(e,t,n.properties),sn(n)):Zi(n)?Ki(Ji(n),K(e,t,Xi(n))):$i(n)?Qi(K(e,t,n.items)):R(n)?Hr(hf(e,t,n.items),Ur(n)):L(n)?I(gf(e,t,n.anyOf),xr(n)):n)}function K(e,t,n){return At(n)?vf(e,t,n.action,n.parameters,n.options):yf(e,t,n)}function bf(e,t){return K(e,pf([],[]),t)}function xf(e){return E(e,{"~immutable":!0},{})}function Sf(e,t){return E(xf(e),{},t)}function Cf(e,t,n,r){return Sf(K(e,t,n),r)}function wf(e,t={}){return Sf(e,t)}function Tf(e,t={}){return vc(e,t)}function Ef(e,t){let n=fc(e,t);return x(n,`right-inside`)?1:+!!x(n,`disjoint`)}function Df(e,t,n=[]){return S(t,(r,i)=>x(Ef(e,r),1)?Df(e,i,[...n,r]):[...n,e,...t],()=>[...n,e])}function Of(e,t=[]){return S(e,(e,n)=>Of(n,Df(e,t)),()=>t)}function kf(e){return Of(e)}const Af=Symbol.for(`yaml.alias`),jf=Symbol.for(`yaml.document`),Mf=Symbol.for(`yaml.map`),Nf=Symbol.for(`yaml.pair`),Pf=Symbol.for(`yaml.scalar`),Ff=Symbol.for(`yaml.seq`),If=Symbol.for(`yaml.node.type`),Lf=e=>!!e&&typeof e==`object`&&e[If]===Af,Rf=e=>!!e&&typeof e==`object`&&e[If]===jf,zf=e=>!!e&&typeof e==`object`&&e[If]===Mf,q=e=>!!e&&typeof e==`object`&&e[If]===Nf,J=e=>!!e&&typeof e==`object`&&e[If]===Pf,Bf=e=>!!e&&typeof e==`object`&&e[If]===Ff;function Vf(e){if(e&&typeof e==`object`)switch(e[If]){case Mf:case Ff:return!0}return!1}function Y(e){if(e&&typeof e==`object`)switch(e[If]){case Af:case Mf:case Pf:case Ff:return!0}return!1}const Hf=e=>(J(e)||Vf(e))&&!!e.anchor,Uf=Symbol(`break visit`),Wf=Symbol(`skip children`),Gf=Symbol(`remove node`);function Kf(e,t){let n=Jf(t);Rf(e)?qf(null,e.contents,n,Object.freeze([e]))===Gf&&(e.contents=null):qf(null,e,n,Object.freeze([]))}Kf.BREAK=Uf,Kf.SKIP=Wf,Kf.REMOVE=Gf;function qf(e,t,n,r){let i=Yf(e,t,n,r);if(Y(i)||q(i))return Xf(e,r,i),qf(e,i,n,r);if(typeof i!=`symbol`){if(Vf(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=qf(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Uf)return Uf;else i===Gf&&(t.items.splice(e,1),--e)}}else if(q(t)){r=Object.freeze(r.concat(t));let e=qf(`key`,t.key,n,r);if(e===Uf)return Uf;e===Gf&&(t.key=null);let i=qf(`value`,t.value,n,r);if(i===Uf)return Uf;i===Gf&&(t.value=null)}}return i}function Jf(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 Yf(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(zf(t))return n.Map?.(e,t,r);if(Bf(t))return n.Seq?.(e,t,r);if(q(t))return n.Pair?.(e,t,r);if(J(t))return n.Scalar?.(e,t,r);if(Lf(t))return n.Alias?.(e,t,r)}function Xf(e,t,n){let r=t[t.length-1];if(Vf(r))r.items[e]=n;else if(q(r))e===`key`?r.key=n:r.value=n;else if(Rf(r))r.contents=n;else{let e=Lf(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}function Zf(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 Qf(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=Qf(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=Qf(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=Qf(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=Qf(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function $f(e,t,n){if(Array.isArray(e))return e.map((e,t)=>$f(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Hf(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 ep=class{constructor(e){Object.defineProperty(this,If,{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(!Rf(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=$f(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Qf(i,{"":o},``,o):o}},tp=class extends ep{constructor(e){super(Af),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=[],Kf(e,{Node:(e,t)=>{(Lf(t)||Hf(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||=($f(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=np(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(Zf(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 np(e,t,n){if(Lf(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Vf(t)){let r=0;for(let i of t.items){let t=np(e,i,n);t>r&&(r=t)}return r}if(q(t)){let r=np(e,t.key,n),i=np(e,t.value,n);return Math.max(r,i)}return 1}const rp=e=>!e||typeof e!=`function`&&typeof e!=`object`;var X=class extends ep{constructor(e){super(Pf),this.value=e}toJSON(e,t){return t?.keep?this.value:$f(this.value,e,t)}toString(){return String(this.value)}};X.BLOCK_FOLDED=`BLOCK_FOLDED`,X.BLOCK_LITERAL=`BLOCK_LITERAL`,X.PLAIN=`PLAIN`,X.QUOTE_DOUBLE=`QUOTE_DOUBLE`,X.QUOTE_SINGLE=`QUOTE_SINGLE`;function ip(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 ap(e,t,n){if(Rf(e)&&(e=e.contents),Y(e))return e;if(q(e)){let t=n.schema[Mf].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 tp(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=`tag:yaml.org,2002:`+t.slice(2));let l=ip(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new X(e);return c&&(c.node=t),t}l=e instanceof Map?o[Mf]:Symbol.iterator in Object(e)?o[Ff]:o[Mf]}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 X(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function op(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 ap(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}const sp=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done;var cp=class extends ep{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=>Y(t)||q(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(sp(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Vf(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,op(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(Vf(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&&J(i)?i.value:i:Vf(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!q(t))return!1;let n=t.value;return n==null||e&&J(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 Vf(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(Vf(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,op(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}};const lp=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function up(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const dp=(e,t,n)=>e.endsWith(`
|
|
4
|
+
`)?up(n,t):n.includes(`
|
|
5
|
+
`)?`
|
|
6
|
+
`+up(n,t):(e.endsWith(` `)?``:` `)+n,fp=`flow`;function pp(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=mp(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=mp(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 mp(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 hp=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),gp=e=>/^(%|---|\.\.\.)/m.test(e);function _p(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 vp(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(gp(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:pp(o,a,`quoted`,hp(t,!1))}function yp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
15
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return vp(e,t);let n=t.indent||(gp(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:pp(r,n,fp,hp(t,!1))}function bp(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=vp;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?yp:i&&!t?vp:n?yp:vp}return r(e,t)}let xp;try{xp=RegExp(`(^|(?<!
|
|
16
|
+
))
|
|
17
|
+
+(?!
|
|
18
|
+
|$)`,`g`)}catch{xp=/\n+(?!\n|$)/g}function Sp({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 bp(n,r);let l=r.indent||(r.forceBlockIndent||gp(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===X.BLOCK_FOLDED?!1:t===X.BLOCK_LITERAL||!_p(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(xp,`$&${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=hp(r,!0);o!==`folded`&&t!==X.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=pp(`${_}${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 Cp(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 bp(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
27
|
+
`)?bp(a,t):Sp(e,t,n,r);if(!s&&!u&&i!==X.PLAIN&&a.includes(`
|
|
28
|
+
`))return Sp(e,t,n,r);if(gp(a)){if(c===``)return t.forceBlockIndent=!0,Sp(e,t,n,r);if(s&&c===l)return bp(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 bp(a,t)}return s?d:pp(d,c,fp,hp(t,!1))}function wp(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!==X.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=X.QUOTE_DOUBLE);let c=e=>{switch(e){case X.BLOCK_FOLDED:case X.BLOCK_LITERAL:return i||a?bp(o.value,t):Sp(o,t,n,r);case X.QUOTE_DOUBLE:return vp(o.value,t);case X.QUOTE_SINGLE:return yp(o.value,t);case X.PLAIN:return Cp(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 Tp(e,t){let n=Object.assign({blockQuote:!0,commentString:lp,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 Ep(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(J(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 Dp(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(J(e)||Vf(e))&&e.anchor;a&&Zf(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 Op(e,t,n,r){if(q(e))return e.toString(t,n,r);if(Lf(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=Y(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Ep(t.doc.schema.tags,a);let o=Dp(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):J(a)?wp(a,t,n,r):a.toString(t,n,r);return o?J(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function kp({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=Y(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Vf(e)||!Y(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||Vf(e)||(J(e)?e.type===X.BLOCK_FOLDED||e.type===X.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Op(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+=dp(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=dp(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=dp(g,n.indent,l(f))));let ee,_,te;Y(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&&J(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Bf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ne=!1,re=Op(t,n,()=>ne=!0,()=>h=!0),ie=` `;if(f||ee||_){if(ie=ee?`
|
|
29
|
+
`:``,_){let e=l(_);ie+=`\n${up(e,n.indent)}`}re===``&&!n.inFlow?ie===`
|
|
30
|
+
`&&te&&(ie=`
|
|
31
|
+
|
|
32
|
+
`):ie+=`\n${n.indent}`}else if(!p&&Vf(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+=dp(g,n.indent,l(te)):h&&i&&i(),g}function Ap(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}const jp={identify:e=>e===`<<`||typeof e==`symbol`&&e.description===`<<`,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new X(Symbol(`<<`)),{addToJSMap:Np}),stringify:()=>`<<`},Mp=(e,t)=>(jp.identify(t)||J(t)&&(!t.type||t.type===X.PLAIN)&&jp.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===jp.tag&&e.default);function Np(e,t,n){let r=Fp(e,n);if(Bf(r))for(let n of r.items)Pp(e,t,n);else if(Array.isArray(r))for(let n of r)Pp(e,t,n);else Pp(e,t,r)}function Pp(e,t,n){let r=Fp(e,n);if(!zf(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 Fp(e,t){return e&&Lf(t)?t.resolve(e.doc,e):t}function Ip(e,t,{key:n,value:r}){if(Y(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Mp(e,n))Np(e,t,r);else{let i=$f(n,``,e);if(t instanceof Map)t.set(i,$f(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Lp(n,i,e),o=$f(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Lp(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(Y(e)&&n?.doc){let t=Tp(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)+`..."`),Ap(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 Rp(e,t,n){return new zp(ap(e,void 0,n),ap(t,void 0,n))}var zp=class e{constructor(e,t=null){Object.defineProperty(this,If,{value:Nf}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return Y(n)&&(n=n.clone(t)),Y(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Ip(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?kp(this,e,t,n):JSON.stringify(this)}};function Bp(e,t,n){return(t.inFlow??e.flow?Hp:Vp)(e,t,n)}function Vp({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(Y(i))!d&&i.spaceBefore&&f.push(``),Up(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(q(i)){let e=Y(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Up(n,f,e.commentBefore,d))}d=!1;let s=Op(i,u,()=>o=null,()=>d=!0);o&&(s+=dp(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
|
+
`+up(l(e),c),s&&s()):d&&o&&o(),p}function Hp({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(Y(i))i.spaceBefore&&d.push(``),Up(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(q(i)){let e=Y(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Up(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=Y(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=Op(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+=dp(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 Up({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=up(t(r),e);n.push(i.trimStart())}}function Wp(e,t){let n=J(t)?t.value:t;for(let r of e)if(q(r)&&(r.key===t||r.key===n||J(r.key)&&r.key.value===n))return r}var Gp=class extends cp{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Mf,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(Rp(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=q(e)?e:!e||typeof e!=`object`||!(`key`in e)?new zp(e,e?.value):new zp(e.key,e.value);let r=Wp(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);J(r.value)&&rp(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=Wp(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Wp(this.items,e)?.value;return(!t&&J(n)?n.value:n)??void 0}has(e){return!!Wp(this.items,e)}set(e,t){this.add(new zp(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)Ip(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!q(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})),Bp(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}};const Kp={collection:`map`,default:!0,nodeClass:Gp,tag:`tag:yaml.org,2002:map`,resolve(e,t){return zf(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Gp.from(e,t,n)};var qp=class extends cp{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Ff,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Jp(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Jp(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&J(r)?r.value:r}has(e){let t=Jp(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Jp(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];J(r)&&rp(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($f(e,String(r++),t));return n}toString(e,t,n){return e?Bp(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(ap(a,void 0,n))}}return i}};function Jp(e){let t=J(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}const Yp={collection:`seq`,default:!0,nodeClass:qp,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Bf(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>qp.from(e,t,n)};function Xp(e){return typeof e==`bigint`||Number.isInteger(e)}const Zp=({value:e})=>JSON.stringify(e),Qp=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Zp},{identify:e=>e==null,createNode:()=>new X(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Zp},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:Zp},{identify:Xp,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})=>Xp(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:Zp}];[Kp,Yp].concat(Qp,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}});function $p(e,t,n){let{replacer:r}=n,i=new qp(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(Rp(o,s,n))}return i}var em=class e extends qp{constructor(){super(),this.add=Gp.prototype.add.bind(this),this.delete=Gp.prototype.delete.bind(this),this.get=Gp.prototype.get.bind(this),this.has=Gp.prototype.has.bind(this),this.set=Gp.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(q(e)?(r=$f(e.key,``,t),i=$f(e.value,r,t)):r=$f(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=$p(e,t,n),i=new this;return i.items=r.items,i}};em.tag=`tag:yaml.org,2002:omap`;var tm=class e extends Gp{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=q(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new zp(e.key,null):new zp(e,null),Wp(this.items,t.key)||this.items.push(t)}get(e,t){let n=Wp(this.items,e);return!t&&q(n)?J(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=Wp(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new zp(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(Rp(e,null,n));return i}};tm.tag=`tag:yaml.org,2002:set`;const nm=Symbol(`break visit`),rm=Symbol(`skip children`),im=Symbol(`remove item`);function am(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),om(Object.freeze([]),e,t)}am.BREAK=nm,am.SKIP=rm,am.REMOVE=im,am.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},am.parentCollection=(e,t)=>{let n=am.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 om(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=om(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===nm)return nm;else r===im&&(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,k({command:yr({description:`Bash command to execute`}),timeout:tn(hr({description:`Timeout in seconds (optional, no default timeout)`}))});var sm=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 sm{};function cm(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 lm(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 um(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 dm(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 fm(e,t){return um(e,t,``)}function pm(e,t){return dm(e,t,``)}function mm(e,t){return t.slice(0,hm(e,t))}function hm(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 gm(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 _m(e,t){if(t)return ym(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function vm(e,t){if(t)return ym(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function ym(e,t){if(!t)return[vm(e),_m(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=gm(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}const bm=`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}`,xm=RegExp(`[${bm}]+|\\s+|[^${bm}]`,`ug`);new class extends sm{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=gm(e,r)}else n=e.match(xm)||[];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)&&Sm(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Sm(n,i,r,null,t.intlSegmenter),e}};function Sm(e,t,n,r,i){if(t&&n){let[a,o]=ym(t.value,i),[s,c]=ym(n.value,i);if(e){let r=cm(a,s);e.value=dm(e.value,s,r),t.value=fm(t.value,r),n.value=fm(n.value,r)}if(r){let e=lm(o,c);r.value=um(r.value,c,e),t.value=pm(t.value,e),n.value=pm(n.value,e)}}else if(n){if(e){let e=vm(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=vm(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=vm(r.value,i),[a,o]=ym(t.value,i),s=cm(n,a);t.value=fm(t.value,s);let c=lm(fm(n,s),o);t.value=pm(t.value,c),r.value=um(r.value,n,c),e.value=dm(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=vm(r.value,i),n=mm(_m(t.value,i),e);t.value=pm(t.value,n)}else if(e){let n=mm(_m(e.value,i),vm(t.value,i));t.value=fm(t.value,n)}}new class extends sm{tokenize(e){let t=RegExp(`(\\r?\\n)|[${bm}]+|[^\\S\\n\\r]+|[^${bm}]`,`ug`);return e.match(t)||[]}},new class extends sm{constructor(){super(...arguments),this.tokenize=Cm}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 Cm(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 wm(e){return e==`.`||e==`!`||e==`?`}new class extends sm{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(wm(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 sm{tokenize(e){return e.split(/([{}:;,]|\s+)/)}},new class extends sm{constructor(){super(...arguments),this.tokenize=Cm}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(Tm(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 Tm(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]=Tm(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]=Tm(e[s],t,n,r,s);t.pop(),n.pop()}else o=e;return o}new class extends sm{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}};const Em=k({oldText:yr({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:yr({description:`Replacement text for this targeted edit.`})},{});k({path:yr({description:`Path to the file to edit (relative or absolute)`}),edits:Lt(Em,{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.`})},{}),k({path:yr({description:`Path to the file to read (relative or absolute)`}),offset:tn(hr({description:`Line number to start reading from (1-indexed)`})),limit:tn(hr({description:`Maximum number of lines to read`}))}),k({path:yr({description:`Path to the file to write (relative or absolute)`}),content:yr({description:`Content to write to the file`})});const Dm={enabled:!0,reserveTokens:16384,keepRecentTokens:2e4};function Om(e,t,n){return n.enabled?e>t-n.reserveTokens:!1}function km(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 Am(e){let t=0;switch(e.role){case`user`:return t=km(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=km(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 Z=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];Z.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=>{if(Am(e)<=r)return e;let t=e.role;if(t!==`toolResult`&&t!==`assistant`)return e;let n=e,o=Lm(n.content);return t===`toolResult`?(i++,a+=o,zm(e)):(Array.isArray(n.content)?n.content:[]).filter(e=>e.type===`toolCall`).length===0?e:(i++,a+=o,zm(e))}),elidedCount:i,elidedBytes:a}}function Vm(e,t,n){let r=0,i=0,a=Bm(e.map(e=>{let t=Km(e);return t!==e&&(r++,i+=Lm(e.content)-Lm(t.content)),t}),t,n);return{messages:a.messages,elidedCount:r+a.elidedCount,elidedBytes:i+a.elidedBytes}}function Hm(e){let t=0;for(let n of e)t+=Am(n);return t}function Um(e,t){return e.length!==t.length||e.some((e,n)=>e!==t[n])}function Wm(e,t){try{e.onCompactionStateChange?.(t)}catch(e){Z.warn(`onCompactionStateChange listener threw`,{error:e instanceof Error?e.message:String(e)})}}function Gm(e,t,n,r,i,a){let o=Bm(e,n,r),s=o.messages,c=o.elidedCount,l=o.elidedBytes,u=c>0?Hm(s):t,d=u>n*i;if(d){let e=Vm(s,n,r);s=e.messages,c+=e.elidedCount,l+=e.elidedBytes}if(!d&&c===0)return{messages:e,isHopeless:!1,earlyReturn:null};Z.warn(`Compaction oversized-message elision`,{totalTokens:t,postSizeTokens:u,contextWindow:n,isHopeless:d,elidedCount:c,elidedBytes:l});let f=Om(Hm(s),n,a)?null:s;return{messages:s,isHopeless:d,earlyReturn:f}}function Km(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 qm(e){for(let t=e.length-1;t>=0;t--)if(jm(e[t],`user`))return t;return-1}function Jm(e,t,n,r){let i=qm(t),a=t.map((e,t)=>i!==-1&&t>=i?e:Km(e));if(Om(Hm([...e,...a]),n,r))for(let t=0;t<a.length;t++){let i=Km(a[t]);if(i!==a[t]&&(a=[...a.slice(0,t),i,...a.slice(t+1)],!Om(Hm([...e,...a]),n,r)))break}return a}function Ym(e,t){let n=0,r=e.length;for(let i=e.length-1;i>=0;i--){let a=Am(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?(Z.warn(`Cannot find valid cut point for compaction`),null):{messagesToSummarize:e.slice(0,r),messagesToKeep:Mm(e.slice(r))}}async function Xm(e,t,n,r){if(!(!e.onMemoryUpdates||e.shouldExtractMemories?.()===!1))try{Wm(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()),Z.info(`Memory extraction applied`,{bulletsLength:i.length})}catch(e){Z.warn(`onMemoryUpdates callback threw`,{error:e instanceof Error?e.message:String(e)})}else Z.info(`Memory extraction returned no durable memories`)}catch(e){Z.warn(`Memory extraction call failed (compaction still applied)`,{error:e instanceof Error?e.message:String(e)})}}async function Zm(e,t,n,r,i,a,o,s){try{let c=Bm(n,a,i).messages,l=Fm(Nm(c)),u=Math.floor(.8*i);Wm(e,`summarizing`);let d=await Im(e.model,t,l,`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.`,u,e.headers,s),f={role:`user`,content:[{type:`text`,text:`<context-summary>\n${d}\n</context-summary>`}],timestamp:Date.now()};return Z.info(`LLM summarization successful`,{originalMessages:o,compactedMessages:1+r.length,summaryLength:d.length}),await Xm(e,t,l,s),Wm(e,`idle`),[f,...r]}catch(e){return Z.warn(`LLM summarization failed, falling back to naive drop`,{error:e instanceof Error?e.message:String(e)}),null}}function Qm(e){let t=e.contextWindow??2e5,n=e.reserveTokens??Dm.reserveTokens,r=e.keepRecentTokens??Dm.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=Hm(o);if(!c?.force&&!Om(l,t,a))return o;let u=Gm(o,l,t,n,i,a);if(u.earlyReturn)return u.earlyReturn;let d=u.messages,f=u.isHopeless;Z.info(`Context compaction triggered`,{totalTokens:l,contextWindow:t,threshold:t-n,messageCount:d.length});let p=Ym(d,r);if(!p)return d;let{messagesToSummarize:m,messagesToKeep:h}=p;Z.info(`Compaction cut point`,{summarizing:m.length,keeping:h.length});let g=f?void 0:e.getApiKey();if(g){let r=await Zm(e,g,m,h,n,t,o.length,s);if(r){let[e,...n]=r;return[e,...Jm([e],n,t,a)]}}else f||Z.warn(`No API key available for LLM summarization, falling back to naive drop`);Wm(e,`fallback`),Wm(e,`idle`);let ee={role:`user`,content:[{type:`text`,text:`[Earlier conversation messages were compacted to save context space]`}],timestamp:Date.now()},_=Jm([ee],h,t,a);return Z.info(`Naive compaction applied`,{originalMessages:o.length,compactedMessages:1+_.length}),[ee,..._]}}function $m(){return d()?`extension-direct`:c()?`extension-delegate`:globalThis.__slicc_connect_mode?`connect`:`node-rest`}function eh(){return $m()===`node-rest`}const th=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 nh(e,t){return th({type:e,payload:t})}const rh=n(`secret-scrub`),ih=async e=>e;function ah(){let e=$m();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?(rh.debug(`SW scrub-tool-result returned error`,{error:t.error}),e):typeof t.text==`string`?t.text:e}catch(t){return rh.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 nh(`secrets.scrub-tool-result`,{text:e});return t?.error?(rh.debug(`Bridge scrub-tool-result returned error`,{error:t.error}),e):typeof t?.text==`string`?t.text:e}catch(t){return rh.debug(`Bridge scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}:e===`connect`?ih: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 rh.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 rh.debug(`Server scrub-tool-result failed`,{error:t instanceof Error?t.message:String(t)}),e}}}const oh=n(`tool-adapter`);function sh(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 ch(e){let t=sh(e),n=[];for(let e of t)e.type===`image`?n.push(await ae(e)):n.push(e);return n}function lh(e,t,n,r){if(!r)return{tracked:null,effectiveSignal:n};let i=r.processManager.spawn({kind:`tool`,argv:[e.name,...hh(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 uh(e,t){e&&e.manager.exit(e.record.pid,t)}async function dh(e,t,n){if(!n||typeof e!=`string`||e.length===0)return e;try{return await n.scrubToolResult(e)}catch(n){return oh.warn(`Tool-result scrub failed, falling back to unscrubbed content`,{tool:t,error:n instanceof Error?n.message:String(n)}),e}}async function fh(e,t){try{return await ch(e)}catch(n){return oh.warn(`Image processing failed, falling back to raw content`,{tool:t,error:n instanceof Error?n.message:String(n)}),sh(e)}}function ph(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=lh(e,i,a,t);try{let t=await e.execute(i??{},c.effectiveSignal),r=await fh(await dh(t.content,e.name,n),e.name);return uh(c.tracked,+!!t.isError),{content:r,details:{isError:t.isError}}}catch(e){throw uh(c.tracked,c.tracked?.record.abort.signal.aborted?null:1),e}finally{s&&re(s),c.tracked?.unsubscribeKill()}}}}function mh(e,t,n){return e.map(e=>ph(e,t,n))}function hh(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 gh(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 _h=e({ACCOUNTS_KEY:()=>bh,__test__:()=>kh,addAccount:()=>Yh,applyProviderDefaults:()=>Rh,clearAllSettings:()=>xg,clearApiKey:()=>gg,clearBaseUrl:()=>yg,clearSelectedProvider:()=>pg,exportProviders:()=>bg,getAccounts:()=>$,getAllAvailableModels:()=>Hh,getAllExtraOAuthDomains:()=>Kh,getApiKey:()=>mg,getApiKeyForProvider:()=>ig,getApiVersionForProvider:()=>sg,getAvailableProviders:()=>Ah,getBaseUrl:()=>_g,getBaseUrlForProvider:()=>ag,getDeploymentForProvider:()=>og,getExtraOAuthDomains:()=>Uh,getOAuthAccountInfo:()=>Ih,getProviderConfig:()=>Nh,getProviderModels:()=>Fh,getRawApiKeyForProvider:()=>rg,getSelectedModelId:()=>cg,getSelectedProvider:()=>dg,isModelHiddenFromPicker:()=>Bh,logoutOAuthAccount:()=>Qh,maskOAuthTokenWithRetry:()=>$h,migrateLegacyAuthOnlySelection:()=>Dh,persistOAuthMaskViaServiceWorker:()=>eg,providerOffersLlmModels:()=>jh,removeAccount:()=>Zh,resolveCurrentModel:()=>Eg,resolveModelById:()=>Tg,resolveModelByShorthand:()=>Dg,resolveModelIdForScoop:()=>kg,saveOAuthAccount:()=>ng,setApiKey:()=>hg,setBaseUrl:()=>vg,setExtraOAuthDomains:()=>Wh,setExtraOAuthDomainsAsync:()=>Gh,setSelectedModelId:()=>lg,setSelectedProvider:()=>fg});const vh=_,yh=p,bh=`slicc_accounts`,xh=`selected-model`,Sh=[`slicc_provider`,`slicc_api_key`,`slicc_base_url`,`anthropic_api_key`,`api_provider`,`azure_resource`,`bedrock_region`],Ch=new Set([`github`]);function wh(e){let t;try{t=m()}catch{return!1}return t.includes(e)&&!o(e)}let Th=!1;function Eh(){if(!Th){Th=!0;for(let e of Sh)try{localStorage.removeItem(e)}catch{}Dh()}}function Dh(){try{let e=localStorage.getItem(xh);if(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t);(Ch.has(n)||wh(n))&&localStorage.removeItem(xh)}}}catch{}try{let e=localStorage.getItem(bh);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`&&wh(e.providerId)));n.length!==t.length&&localStorage.setItem(bh,JSON.stringify(n))}catch{}}function Oh(){Th=!1}const kh={_resetLegacyCleanup:Oh};function Ah(){let e=m().filter(o),t=a();return[...new Set([...e,...t])].filter(e=>!s(e)?.hidden)}function jh(e){try{if(Fh(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 Mh(e,t){try{if(Fh(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 Nh(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 Ph(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 Fh(e){try{if(e===`bedrock-camp`){let e=ee(ag(`bedrock-camp`));return yh(`amazon-bedrock`).filter(t=>g(t,e)).map(e=>({...e,api:`bedrock-camp-converse`,provider:`bedrock-camp`}))}let t=Nh(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 yh(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=Cg(e,n.id,``,a),n.name&&(s.name=n.name),i===`anthropic`){let e=gh(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&&Ph(s,c),Ph(s,n),s})}if(t.isOAuth){let n=yh(`anthropic`),r=`${e}-anthropic`;return n.map(n=>{let i={...n,api:r,provider:e},a=t.modelOverrides?.[n.id];return a&&Ph(i,a),i})}return yh(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 Ih(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 Lh=Object.assign({})[`/packages/webapp/providers.json`]??[],Q=n(`provider-settings`);function Rh(e=Lh){if(e.length===0||$().length>0)return;let t=new Set(Ah());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}Yh(n.providerId,n.apiKey,n.baseUrl)}let n=e.find(e=>e.providerId&&e.apiKey&&t.has(e.providerId));n?.model&&!localStorage.getItem(xh)&&localStorage.setItem(xh,`${n.providerId}:${n.model}`)}const zh=[/haiku/i];function Bh(e){return zh.some(t=>t.test(e))}function Vh(e){return e.filter(e=>!Bh(e.id))}function Hh(){let e=$();if(e.length===0)return[];let t=new Map;for(let n of e){if(t.has(n.providerId))continue;let e=Nh(n.providerId);if(e.hidden||wh(n.providerId))continue;let r=Vh(Fh(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 $(){Eh();let e=localStorage.getItem(bh);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 Uh(e){return ce(localStorage)[e]??[]}function Wh(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 Gh(e,t){if(i()){Wh(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 Kh(){return ce(localStorage)}function qh(e){localStorage.setItem(bh,JSON.stringify(e))}async function Jh(e){if(i()){qh(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(bh,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 Yh(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),qh(a)}async function Xh(e){let t=$m();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 nh(`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 Zh(e){let t=$().find(t=>t.providerId===e),n=Nh(e);t&&n?.isOAuth&&await Qh(e),await Xh(e),await Jh($().filter(t=>t.providerId!==e));let r=localStorage.getItem(xh)??``,i=r.indexOf(`:`);i>0&&r.slice(0,i)===e&&localStorage.removeItem(xh)}async function Qh(e){let t=$().find(t=>t.providerId===e);if(!t)return;let n=Nh(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 Jh($().map(t=>t.providerId===e?{providerId:t.providerId,apiKey:``,baseUrl:t.baseUrl,userName:t.userName,userAvatar:t.userAvatar,loggedOut:!0}:t)),await Xh(e)}}async function $h(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 eg(e,t,n){let r={providerId:e.providerId,accessToken:e.accessToken,domains:e.domains.join(`,`)},{maskedValue:i,lastError:a}=await $h(()=>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 tg(e,t){if(e.accessToken)return`scopes`in e?e.scopes:t?.scopes}async function ng(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:tg(e,t)}),await Jh(n);let r=Nh(e.providerId)?.oauthTokenDomains??[],i=Uh(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=$m();try{if(s===`extension-direct`)await eg({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:Jh});else if(s===`extension-delegate`)await eg({providerId:e.providerId,accessToken:e.accessToken,domains:o},{sendMaskRequest:t=>nh(`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:Jh});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 Jh(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 rg(e){let t=$().find(t=>t.providerId===e);return t&&(t.accessToken||t.apiKey)||null}function ig(e){let t=$().find(t=>t.providerId===e);return t?t.accessToken||t.apiKey||(Nh(e).optionalApiKey?`local`:null):null}function ag(e){return $().find(t=>t.providerId===e)?.baseUrl??null}function og(e){return $().find(t=>t.providerId===e)?.deployment??null}function sg(e){return $().find(t=>t.providerId===e)?.apiVersion??null}function cg(){let e=localStorage.getItem(xh)||``,t=e.indexOf(`:`);return t>=0?e.slice(t+1):e}function lg(e){let t=e.indexOf(`:`);if(t>0){let n=e.slice(0,t),r=new Set([...a(),...Ah()]),i=n.includes(`.`);if(r.has(n)||!i){localStorage.setItem(xh,e);return}}let n=dg();localStorage.setItem(xh,`${n}:${e}`)}function ug(){return localStorage.getItem(xh)||``}function dg(){let e=ug(),t=e.indexOf(`:`);if(t>0)return e.slice(0,t);let n=$(),r=cg();if(r){let e=n.find(e=>jh(e.providerId)&&Mh(e.providerId,r));if(e)return e.providerId}let i=n.find(e=>jh(e.providerId));return i?i.providerId:n.length>0?n[0].providerId:`anthropic`}function fg(e){let t=cg();localStorage.setItem(xh,`${e}:${t}`)}function pg(){let e=cg();localStorage.setItem(xh,e)}function mg(){return ig(dg())}function hg(e){let t=dg();Yh(t,e,ag(t)??void 0)}async function gg(){await Zh(dg())}function _g(){return ag(dg())}function vg(e){let t=dg(),n=rg(t);n&&Yh(t,n,e||void 0)}function yg(){let e=dg(),t=rg(e);t&&Yh(e,t)}function bg(){let e=$(),t=dg(),n=cg();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 xg(){let e=$();await Promise.allSettled(e.map(e=>Zh(e.providerId))),localStorage.removeItem(bh),localStorage.removeItem(xh);for(let e of Sh)localStorage.removeItem(e)}function Sg(e){return/^(?:gpt[-.]?|o[0-9]|chatgpt)/i.test(e)?`openai`:`anthropic`}function Cg(e,t,n,r){return{id:t,name:t,provider:e,api:r??`${e}-${Sg(t)}`,baseUrl:n??``,contextWindow:2e5,maxTokens:16384,input:[`text`,`image`],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},reasoning:!0}}function wg(e,t){return t.isOAuth||e===`azure-ai-foundry`?`anthropic`:e===`bedrock-camp`?`amazon-bedrock`:e}function Tg(e){if(!e)return Eg();let t=dg(),n=ag(t),r=Nh(t);try{let i=wg(t,r),a=vh(i,e);if(!a?.id)throw Error(`Model ${e} not found`);let o=a;return r.isOAuth?o=Fh(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=Fh(t).find(t=>t.id===e);return r?n?{...r,baseUrl:n}:r:Cg(t,e,n)}return Eg()}}function Eg(){let e=dg(),t=cg(),n=ag(e),r=Fh(e),i=Nh(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=wg(e,i),a=vh(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?Cg(e,o,n):vh(`anthropic`,`claude-sonnet-4-0`)}}function Dg(e){let t=e.toLowerCase();if(!t)return null;let n=null;try{n=dg()}catch{}if(n!==null){let e=Og(t,[n]);if(e!==null)return e}return Og(t,$().map(e=>e.providerId))}function Og(e,t){let n=null,r=-1;for(let i of t)for(let t of Fh(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&&Ag(t.id,n??``)>0)&&(r=o,n=t.id)}return n}function kg(e){if(!e)return null;let t=[e],n=Dg(e);n!==null&&n!==e&&t.push(n);let r=[];try{r=Fh(dg())}catch{}for(let n of t)if(!(r.length>0&&!r.some(e=>e.id===n)))try{if(Tg(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 Ag(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{Um as $,Tt as $t,$h as A,w as An,tr as At,hg as B,cn as Bt,Nh as C,b as Cn,F as Ct,dg as D,Le as Dn,dr as Dt,cg as E,Ie as En,ur as Et,Eg as F,bn as Ft,fg as G,qt as Gt,Wh as H,k as Ht,Tg as I,vn as It,ah as J,Vt as Jt,gh as K,Kt,Dg as L,j as Lt,eg as M,Yn as Mt,jh as N,Jn as Nt,Bh as O,Xe as On,P as Ot,Zh as P,xn as Pt,Qm as Q,kt as Qt,kg as R,_n as Rt,Ih as S,Ne as Sn,pr as St,rg as T,Fe as Tn,lr as Tt,Gh as U,nn as Ut,vg as V,A as Vt,lg as W,$t as Wt,eh as X,Rt as Xt,nh as Y,zt as Yt,$m as Z,Lt as Zt,Ah as _,ze as _n,I as _t,Rh as a,C as an,po as at,og as b,He as bn,vr as bt,yg as c,Oe as cn,Zi as ct,$ as d,x as dn,Ji as dt,Ct as en,Mm as et,Hh as f,Ae as fn,Xi as ft,sg as g,Be as gn,L as gt,ig as h,je as hn,Rr as ht,Yh as i,Ye as in,cf as it,Dh as j,Te as jn,er as jt,Qh as k,We as kn,ir as kt,pg as l,ke as ln,Gi as lt,mg as m,Re as mn,Hr as mt,kh as n,Ze as nn,Tf as nt,xg as o,Ee as on,ra as ot,Kh as p,Ve as pn,R as pt,mh as q,Wt as qt,_h as r,Je as rn,bf as rt,gg as s,De as sn,na as st,bh as t,Qe as tn,kf as tt,bg as u,rt as un,Yi as ut,_g as v,Ke as vn,br as vt,Fh as w,Pe as wn,cr as wt,Uh as x,Me as xn,gr as xt,ag as y,qe as yn,yr as yt,ng as z,dn as zt};
|
|
@@ -1,2 +1,2 @@
|
|
|
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{K as e,d as t,y as n,z as r}from"./account-store-BORvzSQq.js";import{a as i}from"./diagnostics-DN_idNHx.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{a as o,i as s,r as c}from"./compat-Bn8HnC3L.js";import{a as l,r as u,s as d,t as f}from"./legacy-api-aliases-DAkrHYf9.js";import{t as p}from"./panel-rpc-B3MSVImO.js";import{a as m,i as h,o as g,s as _}from"./bedrock-camp-BDCjQMZx.js";import"./provider-settings-B2DSjiyI.js";import{n as v,t as ee}from"./silent-renew-backoff-tbYCpSw6.js";import{getOAuthPageOrigin as te}from"./oauth-service-Dmnx-pbE.js";import{t as ne}from"./llm-session-id-bZQs6gBN.js";var re={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function y(e,t){return m(e,t)}function b(e,t,n){return e!==`xhigh`||!t?e:_(t,n)?`xhigh`:g(t,n)?`max`:`high`}function ie(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return b((()=>{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 x(e,t){if(!y(e.id,e.name))return t;let n=t,r=b(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}var S=Object.assign({"/packages/webapp/providers/adobe-config.json":re})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function C(){let e=n(`adobe`);if(e)return e.replace(/\/$/,``);if(S.proxyEndpoint)return S.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}var w=new Map,T=new Map,E=`slicc-adobe-models`;function D(e){try{localStorage.setItem(E,JSON.stringify(e))}catch{}}async function O(e){let t=w.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[G]:`6.38.3`}});if(t.ok){let n=await t.json();return w.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 k(e){let t=e.clientId||S.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 A(e){return e.scopes||S.scopes}function j(e){return e.imsEnvironment||S.imsEnvironment||`prod`}var M={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function N(e){return M[e??S.imsEnvironment??`prod`]??M.prod}var P=typeof chrome<`u`&&!!chrome?.runtime?.id;function F(){return t().find(e=>e.providerId===`adobe`)}async function se(e,t){try{let n=await fetch(`${N(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 I(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}var L={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!S.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,T.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 D(n),n}for(let t of w.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(E);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 i=C(),a=await O(i),o=k(a),s=A(a),c=j(a),l=P?null:await te(),u=P?null:v({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),d=P?S.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(`${N(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=I(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let _=await se(g.accessToken,c);await r({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:_.name,userAvatar:_.avatar,scopes:g.scope,baseUrl:S.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=F();if(e?.accessToken)try{let t=w.values().next().value??{},n=t.clientId||S.clientId,r=j(t);if(n){let t=await fetch(`${N(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 r({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>F()?.accessToken?V():null,refreshModels:async e=>{await $(e);let t=L.getModelIds?.();t?.length&&D(t)}},R=null,ce=ee();async function z(){let e=F();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(()=>V());if(t)return t;let n=F();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function B(){let e=F();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function V(){if(typeof window>`u`){let e=p();if(!e)return null;try{let{accessToken:t}=await e.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return t}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return R||(R=le().finally(()=>{R=null}),R)}function H(e,t){let n=k(t),r=A(t),i=j(t),a=P?null:v({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),o=P?S.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:`${N(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function U(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 W(e,t){let n=F();await r({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:n?.userName,userAvatar:n?.userAvatar,scopes:e.scope,baseUrl:S.proxyEndpoint?void 0:t})}async function le(){try{let e=C(),{authorizeUrl:t,expectedNonce:n}=H(e,await O(e)),{createOAuthLauncher:r}=await a(async()=>{let{createOAuthLauncher:e}=await import(`./oauth-service-Dmnx-pbE.js`);return{createOAuthLauncher:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),i=await r()(t,{interactive:!1});if(!i||!U(i,n))return null;let o=I(i);return o?(await W(o,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))),o.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}var G=`X-Slicc-Version`;function K(e){let t={},n=G.toLowerCase();if(e.headers)for(let[r,i]of Object.entries(e.headers))r.toLowerCase()!==n&&(t[r]=i);return t[G]=`6.38.3`,{...e,headers:t}}var ue=`adobe-provider-fallback`,q=new Set;function J(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 q.has(t)||(q.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":ne(ue)}}}function de(){q.clear()}function Y(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()}}}var X=(e,t,n={})=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=u(a,t,K(J({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=f(a,t,K(J(x(e,h(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(Y(e,t)),r.end()}})(),r},Z=(e,t,n)=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=d(a,t,K(J({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=l(a,t,K(J(x(e,h(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(Y(e,t)),r.end()}})(),r};function fe(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 pe(){let e=new Map;for(let t of s())try{for(let n of c(t))e.set(n.id,n)}catch{}return e}function me(t,n,r){let i=`adobe-${t.api===`openai`?`openai`:`anthropic`}`,a=r.get(t.id);if(a)return{...a,provider:`adobe`,api:i};let o=e(t.id,r);return{id:t.id,name:t.name??t.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 he(e,t){for(let t of e)T.set(t.id,fe(t));let n=pe();return e.map(e=>me(e,t,n))}async function ge(e){try{let t=e??await z(),n=C(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[G]:`6.38.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 he(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}var Q=new Map;function _e(){return c(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=C(),n=Q.get(t);if(n)return n;let r=await ge(e);return r?(Q.set(t,r),r):_e()}function ve(){o({api:`adobe-anthropic`,stream:X,streamSimple:Z}),o({api:`adobe-openai`,stream:X,streamSimple:Z})}export{de as __resetAdobeSessionIdWarningCacheForTests,L as config,I as extractTokenFromUrl,$ as getAdobeModels,z as getValidAccessToken,B as isTokenExpired,ve as register};
|
|
2
|
+
import{K as e,d as t,y as n,z as r}from"./account-store-8zHKHzZf.js";import{a as i}from"./diagnostics-DN_idNHx.js";import{t as a}from"./preload-helper-Czpn1I53.js";import{a as o,i as s,r as c}from"./compat-Bn8HnC3L.js";import{a as l,r as u,s as d,t as f}from"./legacy-api-aliases-DAkrHYf9.js";import{t as p}from"./panel-rpc-B3MSVImO.js";import{a as m,i as h,o as g,s as _}from"./bedrock-camp-BDCjQMZx.js";import"./provider-settings-DEeVOQVO.js";import{n as v,t as ee}from"./silent-renew-backoff-tbYCpSw6.js";import{getOAuthPageOrigin as te}from"./oauth-service-Dmnx-pbE.js";import{t as ne}from"./llm-session-id-bZQs6gBN.js";var re={proxyEndpoint:`https://adobe-llm-proxy.paolo-moz.workers.dev`,redirectUri:`https://www.sliccy.ai/auth/callback`,extensionRedirectUri:`https://akjjllgokmbgpbdbmafpiefnhidlmbgf.chromiumapp.org/adobe`};function y(e,t){return m(e,t)}function b(e,t,n){return e!==`xhigh`||!t?e:_(t,n)?`xhigh`:g(t,n)?`max`:`high`}function ie(e,t){let n=e?t?.thinkingLevelMap?.[e]:void 0;return b((()=>{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 x(e,t){if(!y(e.id,e.name))return t;let n=t,r=b(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}var S=Object.assign({"/packages/webapp/providers/adobe-config.json":re})[`/packages/webapp/providers/adobe-config.json`]??{clientId:``,proxyEndpoint:``,scopes:`openid,profile,email`};function C(){let e=n(`adobe`);if(e)return e.replace(/\/$/,``);if(S.proxyEndpoint)return S.proxyEndpoint.replace(/\/$/,``);throw Error(`Adobe proxy endpoint not configured — set it in Settings or adobe-config.json`)}var w=new Map,T=new Map,E=`slicc-adobe-models`;function D(e){try{localStorage.setItem(E,JSON.stringify(e))}catch{}}async function O(e){let t=w.get(e);if(t)return t;try{let t=await fetch(`${e}/v1/config`,{headers:{[G]:`6.39.1`}});if(t.ok){let n=await t.json();return w.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 k(e){let t=e.clientId||S.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 A(e){return e.scopes||S.scopes}function j(e){return e.imsEnvironment||S.imsEnvironment||`prod`}var M={prod:`https://ims-na1.adobelogin.com`,stg1:`https://ims-na1-stg1.adobelogin.com`};function N(e){return M[e??S.imsEnvironment??`prod`]??M.prod}var P=typeof chrome<`u`&&!!chrome?.runtime?.id;function F(){return t().find(e=>e.providerId===`adobe`)}async function se(e,t){try{let n=await fetch(`${N(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 I(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}var L={id:`adobe`,name:`Adobe`,description:`Claude via Adobe — login with your Adobe ID`,requiresApiKey:!1,requiresBaseUrl:!S.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,T.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 D(n),n}for(let t of w.values())if(t.models?.length)return t.models.map(t=>e(t));try{let e=localStorage.getItem(E);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 i=C(),a=await O(i),o=k(a),s=A(a),c=j(a),l=P?null:await te(),u=P?null:v({pageHref:l.href,pageOrigin:l.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),d=P?S.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(`${N(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=I(h);if(!g){console.error(`[adobe] Could not extract token from redirect URL`);return}let _=await se(g.accessToken,c);await r({providerId:`adobe`,accessToken:g.accessToken,tokenExpiresAt:Date.now()+g.expiresIn*1e3,userName:_.name,userAvatar:_.avatar,scopes:g.scope,baseUrl:S.proxyEndpoint?void 0:i}),await $().catch(e=>console.warn(`[adobe] Failed to fetch models after login:`,e instanceof Error?e.message:String(e))),t()},onOAuthLogout:async()=>{let e=F();if(e?.accessToken)try{let t=w.values().next().value??{},n=t.clientId||S.clientId,r=j(t);if(n){let t=await fetch(`${N(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 r({providerId:`adobe`,accessToken:``})},onSilentRenew:async()=>F()?.accessToken?V():null,refreshModels:async e=>{await $(e);let t=L.getModelIds?.();t?.length&&D(t)}},R=null,ce=ee();async function z(){let e=F();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(()=>V());if(t)return t;let n=F();if((n?.tokenExpiresAt??0)-Date.now()>0&&n?.accessToken)return n.accessToken;throw Error(`Adobe session expired — please log in again`)}function B(){let e=F();return!e?.tokenExpiresAt||Date.now()>e.tokenExpiresAt-6e4}async function V(){if(typeof window>`u`){let e=p();if(!e)return null;try{let{accessToken:t}=await e.call(`silent-renew`,{providerId:`adobe`},{timeoutMs:13e4});return t}catch(e){return console.warn(`[adobe] worker→page silent-renew bridge failed:`,e instanceof Error?e.message:String(e)),null}}return R||(R=le().finally(()=>{R=null}),R)}function H(e,t){let n=k(t),r=A(t),i=j(t),a=P?null:v({pageHref:window.location.href,pageOrigin:window.location.origin,configuredRedirectUri:S.redirectUri},()=>crypto.randomUUID()),o=P?S.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:`${N(i)}/ims/authorize/v2?${l}`,expectedNonce:c,proxyEndpoint:e}}function U(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 W(e,t){let n=F();await r({providerId:`adobe`,accessToken:e.accessToken,tokenExpiresAt:Date.now()+e.expiresIn*1e3,userName:n?.userName,userAvatar:n?.userAvatar,scopes:e.scope,baseUrl:S.proxyEndpoint?void 0:t})}async function le(){try{let e=C(),{authorizeUrl:t,expectedNonce:n}=H(e,await O(e)),{createOAuthLauncher:r}=await a(async()=>{let{createOAuthLauncher:e}=await import(`./oauth-service-Dmnx-pbE.js`);return{createOAuthLauncher:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),i=await r()(t,{interactive:!1});if(!i||!U(i,n))return null;let o=I(i);return o?(await W(o,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))),o.accessToken):null}catch(e){return console.warn(`[adobe] Silent renewal error:`,e instanceof Error?e.message:String(e)),null}}var G=`X-Slicc-Version`;function K(e){let t={},n=G.toLowerCase();if(e.headers)for(let[r,i]of Object.entries(e.headers))r.toLowerCase()!==n&&(t[r]=i);return t[G]=`6.39.1`,{...e,headers:t}}var ue=`adobe-provider-fallback`,q=new Set;function J(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 q.has(t)||(q.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":ne(ue)}}}function de(){q.clear()}function Y(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()}}}var X=(e,t,n={})=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=u(a,t,K(J({...n,apiKey:i},`streamAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=f(a,t,K(J(x(e,h(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(Y(e,t)),r.end()}})(),r},Z=(e,t,n)=>{let r=i();return(async()=>{try{let i=await z();if(String(e.api).includes(`openai`)){let a={...e,baseUrl:`${C()}/v1`,api:`openai-completions`,compat:{...e.compat,supportsStore:!1,supportsDeveloperRole:!1}},o=d(a,t,K(J({...n,apiKey:i},`streamSimpleAdobe[openai]`)));for await(let e of o)r.push(e)}else{let a={...e,baseUrl:C(),api:`anthropic-messages`},o=l(a,t,K(J(x(e,h(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(Y(e,t)),r.end()}})(),r};function fe(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 pe(){let e=new Map;for(let t of s())try{for(let n of c(t))e.set(n.id,n)}catch{}return e}function me(t,n,r){let i=`adobe-${t.api===`openai`?`openai`:`anthropic`}`,a=r.get(t.id);if(a)return{...a,provider:`adobe`,api:i};let o=e(t.id,r);return{id:t.id,name:t.name??t.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 he(e,t){for(let t of e)T.set(t.id,fe(t));let n=pe();return e.map(e=>me(e,t,n))}async function ge(e){try{let t=e??await z(),n=C(),r=await fetch(`${n}/v1/models`,{headers:{Authorization:`Bearer ${t}`,[G]:`6.39.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 he(e.data,n)}}catch(e){console.warn(`[adobe] Failed to fetch proxy models:`,e instanceof Error?e.message:String(e))}return null}var Q=new Map;function _e(){return c(`anthropic`).map(e=>({...e,provider:`adobe`,api:`adobe-anthropic`}))}async function $(e){let t=C(),n=Q.get(t);if(n)return n;let r=await ge(e);return r?(Q.set(t,r),r):_e()}function ve(){o({api:`adobe-anthropic`,stream:X,streamSimple:Z}),o({api:`adobe-openai`,stream:X,streamSimple:Z})}export{de as __resetAdobeSessionIdWarningCacheForTests,L as config,I as extractTokenFromUrl,$ as getAdobeModels,z as getValidAccessToken,B as isTokenExpired,ve as register};
|
|
@@ -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-BQLpy1uD.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-HSE2jiCE.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.38.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.38.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.38.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};
|
|
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-Cxz3loXT.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-E2_3_Nn0.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.39.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.39.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.39.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};
|